<?php
/* @var $this WeightController */
/* @var $model Weight */
/* @var $form CActiveForm */
?>


<div class="form-normal form-horizontal clearfix">
	<div class="col-lg-9 col-md-10">

		<?php $form = $this->beginWidget('CActiveForm', array(
			'id' => 'weight-form',
			'enableAjaxValidation' => false,
			'enableClientValidation' => true,
			'clientOptions' => array(
				'validateOnSubmit' => true,
		// 'afterValidate' => 'js:notificationForm',
			),
			'errorMessageCssClass' => 'parsley-errors-list filled',
			'htmlOptions' => array('class' => 'form-horizontal', 'role' => 'form', 'autocomplete' => 'off')
		)); ?>

		<?php echo $form->errorSummary($model, null, null, array('class' => 'alert alert-warning')); ?>


		<div class="form-group">

			<div class="col-sm-4 control-label">
				<?php echo $form->labelEx($model, 'kriteria_tema'); ?>
			</div>

			<div class="col-sm-8">
				<?php echo $form->numberField($model, 'kriteria_tema', array('class' => 'form-control price')); ?>
				<?php echo $form->error($model, 'kriteria_tema'); ?>
			</div>

		</div>


		<div class="form-group">

			<div class="col-sm-4 control-label">
				<?php echo $form->labelEx($model, 'kriteria_penulisan'); ?>
			</div>

			<div class="col-sm-8">
				<?php echo $form->numberField($model, 'kriteria_penulisan', array('class' => 'form-control price')); ?>
				<?php echo $form->error($model, 'kriteria_penulisan'); ?>
			</div>

		</div>

		<div class="form-group">

			<div class="col-sm-4 control-label">
				<?php echo $form->labelEx($model, 'kriteria_inovasi'); ?>
			</div>

			<div class="col-sm-8">
				<?php echo $form->numberField($model, 'kriteria_inovasi', array('class' => 'form-control price')); ?>
				<?php echo $form->error($model, 'kriteria_inovasi'); ?>
			</div>

		</div>


		<div class="form-group">

			<div class="col-sm-4 control-label">
				<?php echo $form->labelEx($model, 'kriteria_masalah'); ?>
			</div>

			<div class="col-sm-8">
				<?php echo $form->numberField($model, 'kriteria_masalah', array('class' => 'form-control price')); ?>
				<?php echo $form->error($model, 'kriteria_masalah'); ?>
			</div>

		</div>

		<div class="form-group">

			<div class="col-sm-4 control-label">
				<?php echo $form->labelEx($model, 'kriteria_rekomendasi_kebijakan'); ?>
			</div>

			<div class="col-sm-8">
				<?php echo $form->numberField($model, 'kriteria_rekomendasi_kebijakan', array('class' => 'form-control price')); ?>
				<?php echo $form->error($model, 'kriteria_rekomendasi_kebijakan'); ?>
			</div>

		</div>


		<div class="form-group">

			<div class="col-sm-4 control-label">
				Total Bobot
			</div>

			<div class="col-sm-8">
				<input type="text" class="form-control" id="total_all" readonly="true" />
			</div>

		</div>


		<div class="form-group">
			<div class=" col-md-12">
				<?php echo CHtml::submitButton($model->isNewRecord ? 'Simpan' : 'Edit', array('class' => 'btn btn-info btn-flat pull-right tombol btn-lg')); ?>
			</div>
		</div>

		<?php $this->endWidget(); ?>

	</div>
</div><!-- form -->

<?php

Yii::app()->clientScript->registerScript(
	"welcome_js",
	"
	function sumOfIncome() {
		var sum = 0;
		$('.price').each(function() {
			sum += parseInt(this.value) || 0;
			console.log(sum)
			});
			$('#total_all').val(sum);
			if(sum==100){
				$('.tombol').show();
				}else{
					$('.tombol').hide();
				}
			}
			$('.price').change(function() {
				sumOfIncome();
				})

				$('.price').ready(function() {
					sumOfIncome();
					})


					",
				);

				?>