<?php
/* @var $this UsersController */
/* @var $model Users */
/* @var $form CActiveForm */
?>

<div class="form-normal form-horizontal clearfix">
	<div class="col-lg-11">

		<?php $form = $this->beginWidget('CActiveForm', array(
			'id' => 'users-form',
			'enableAjaxValidation' => FALSE,
			'enableClientValidation' => true,
			'clientOptions' => array(
				'validateOnSubmit' => true,
				// 'afterValidate'=>'js:notificationForm',
			),
			'errorMessageCssClass' => 'label label-danger',
			'htmlOptions' => array('class' => 'form-horizontal', 'role' => 'form')
		)); ?>

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

		<div class="form-group">

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

			<div class="col-sm-9">
				<?php echo $form->error($model, 'username'); ?>
				<?php
				if (YII::app()->user->record->level == 1) {

					echo $form->textField($model, 'username', array('class' => 'form-control', 'placeholder' => 'Username'));
				} else {

					echo $form->textField($model, 'username', array('class' => 'form-control', 'placeholder' => 'Username', 'readonly' => true));
				}

				?>
			</div>

		</div>


		<div class="form-group">

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

			<div class="col-sm-9">
				<?php echo $form->error($model, 'email'); ?>
				<?php echo $form->textField($model, 'email', array('class' => 'form-control', 'placeholder' => 'Alamat Email Aktif')); ?>
			</div>

		</div>


		<div class="form-group">

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

			<div class="col-sm-9">
				<?php echo $form->error($model, 'first_name'); ?>
				<?php echo $form->textField($model, 'first_name', array('class' => 'form-control', 'placeholder' => 'Nama Depan')); ?>
			</div>

		</div>


		<div class="form-group">

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

			<div class="col-sm-9">
				<?php echo $form->error($model, 'last_name'); ?>
				<?php echo $form->textField($model, 'last_name', array('class' => 'form-control', 'placeholder' => 'Nama Belakang')); ?>
			</div>

		</div>


		<div class="form-group">

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

			<div class="col-sm-9">
				<?php echo $form->error($model, 'location'); ?>
				<?php echo $form->textArea($model, 'location', array('class' => 'form-control', 'placeholder' => 'Alamat Lengkap')); ?>
			</div>

		</div>

		<!--
			<div class="form-group">

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

				<div class="col-sm-9">
					<?php echo $form->error($model, 'website'); ?>
					<?php echo $form->textField($model, 'website', array('class' => 'form-control', 'placeholder' => 'Website')); ?>
				</div>

			</div>


			<div class="form-group">

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

				<div class="col-sm-9">
					<?php echo $form->error($model, 'bio'); ?>
					<?php echo $form->textArea($model, 'bio', array('class' => 'form-control', 'placeholder' => 'Bio')); ?>
				</div>

			</div>

			<div class="form-group">

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

				<div class="col-sm-9">
					<?php echo $form->error($model, 'job'); ?>
					<?php echo $form->textField($model, 'job', array('class' => 'form-control', 'placeholder' => 'Pekerjaan')); ?>
				</div>

			</div>
		-->

		<div class="form-group">

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

			<div class="col-sm-9">
				<?php echo $form->error($model, 'phone'); ?>
				<?php echo $form->textField($model, 'phone', array('class' => 'form-control', 'placeholder' => 'No. HP')); ?>
			</div>

		</div>
		<!--
			<div class="form-group">

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

				<div class="col-sm-9">
					<?php echo $form->error($model, 'pin'); ?>
					<?php echo $form->textField($model, 'pin', array('class' => 'form-control', 'placeholder' => 'Pin BB')); ?>
				</div>

			</div>
		-->

		<div class="form-group">

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

			<div class="col-sm-9">
				<?php echo $form->error($model, 'birth'); ?>
				<div data-min-view="2" data-date-format="yyyy-mm-dd" class="input-group date datetimepicker"><?php echo $form->textField($model, 'birth', array('class' => 'form-control')); ?><span class="input-group-addon btn btn-primary"><i class="icon-th mdi mdi-calendar"></i></span>
				</div>
			</div>

		</div>


		<div class="form-group">

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

			<div class="col-sm-8 be-radio"">
				<?php echo $form->error($model, 'gender'); ?>
				<?php
				echo $form->radioButtonList(
					$model,
					'gender',
					array('1' => 'Laki-laki', '0' => 'Perempuan'),
					array(
						'template' => '{input}{label}',
						'separator' => '',
						'labelOptions' => array(
							'style' => 'padding-right:20px;margin-left:15px'
						),

					)
				);
				?>
				</div>

			</div>


				<!-- <div class=" form-group">

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

				<div class="col-sm-9">

					<?php echo $form->error($model, 'facebook'); ?>
					<?php echo $form->textField($model, 'facebook', array('class' => 'form-control', 'placeholder' => 'Facebook Account')); ?>

				</div>

			</div>


			<div class="form-group">

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

				<div class="col-sm-9">

					<?php echo $form->error($model, 'twitter'); ?>
					<?php echo $form->textField($model, 'twitter', array('class' => 'form-control', 'placeholder' => 'Twitter Account')); ?>

				</div>

			</div>


			<div class="form-group">

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

				<div class="col-sm-9">

					<?php echo $form->error($model, 'gplus'); ?>
					<?php echo $form->textField($model, 'gplus', array('class' => 'form-control', 'placeholder' => 'Google+ Account')); ?>

				</div>

			</div> -->

			<?php if (YII::app()->user->record->level == 1) : ?>
				<div class="form-group">

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

					<div class="col-sm-9">
						<?php echo $form->error($model, 'division'); ?>
						<?php
						echo $form->dropDownList(
							$model,
							"division",
							CHtml::listData(
								Village::model()->findall(array('condition' => 'status=1')),
								'id_village',
								'name'
							),
							array("empty" => "-- Unit Kerja --", 'class' => 'select2 form-control')
						);
						?>

					</div>

				</div>
			<?php endif; ?>


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

	<div class=" text-right">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Submit' : 'Edit Profil', array('class' => 'btn btn-info btn-flat pull-right')); ?>
		<BR><BR>
	</div>

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