<?php
/* @var $this MemberController */
/* @var $model Member */
/* @var $form CActiveForm */
?>

<div class="row">
	<div class="col-md-12">
		<?php $form = $this->beginWidget('CActiveForm', array(
			'id' => 'member-form',
			'enableAjaxValidation' => false,
			'enableClientValidation' => true,
			'clientOptions' => array(
				'validateOnSubmit' => true,
				// 'afterValidate'=>'js:notificationForm',
			),
			'errorMessageCssClass' => 'parsley-errors-list filled',
			'htmlOptions' => array('enctype' => 'multipart/form-data', 'autocomplete' => 'off'),
		)); ?>

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

		<?php if ($type == 1) { ?>
			<img class="img-responsive" src="<?php echo YII::app()->baseUrl; ?>/image/files/identity/<?php echo $model->image_identity; ?>" />
			<HR>
			<div class="form-group">
				<div class="col-sm-10">
					<?php echo $form->fileField($model, 'image_identity', array('class' => 'btn btn-success btn-lg btn-block')); ?>
					<?php echo $form->error($model, 'image_identity'); ?>
				</div>
				<div class="col-sm-2">
					<?php echo CHtml::submitButton($model->isNewRecord ? 'Simpan' : 'Upload', array('class' => 'btn btn-info btn-lg pull-left')); ?>
				</div>
			</div>

		<?php } elseif ($type == 2) { ?>
			<img class="img-responsive" src="<?php echo YII::app()->baseUrl; ?>/image/files/foto/<?php echo $model->image_foto; ?>" />
			<HR>
			<div class="form-group">
				<div class="col-sm-10">
					<?php echo $form->fileField($model, 'image_foto', array('class' => 'btn btn-success btn-lg btn-block')); ?>
					<?php echo $form->error($model, 'image_foto'); ?>
				</div>
				<div class="col-sm-2">
					<?php echo CHtml::submitButton($model->isNewRecord ? 'Simpan' : 'Upload', array('class' => 'btn btn-info btn-lg pull-left')); ?>
				</div>
			</div>
		<?php } elseif ($type == 3) { ?>

			<?php
			$doc = substr($model->image_sosmed, -4);
			if($doc==".jpg" || $doc=="jpeg"){ ?>
				<img class="img-responsive" src="<?php echo YII::app()->baseUrl; ?>/image/files/sosmed/<?php echo $model->image_sosmed; ?>" />
			<?php }else{ ?>
				<a class="btn btn-success btn-block" href="<?php echo YII::app()->baseUrl; ?>/image/files/sosmed/<?php echo $model->image_sosmed; ?>" />Download</a>
			<?php } ?>
			<HR>
			<div class="form-group">
				<div class="col-sm-10">
					<?php echo $form->fileField($model, 'image_sosmed', array('class' => 'btn btn-success btn-lg btn-block')); ?>
					<?php echo $form->error($model, 'image_sosmed'); ?>
				</div>
				<div class="col-sm-2">
					<?php echo CHtml::submitButton($model->isNewRecord ? 'Simpan' : 'Upload', array('class' => 'btn btn-info btn-lg pull-left')); ?>
				</div>
			</div>
		<?php } ?>



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