<?php
/* @var $this PaperController */
/* @var $model Paper */
/* @var $form CActiveForm */
?>
<div class="form-group">
	<div class="col-sm-12">
		<?php $this->widget('zii.widgets.grid.CGridView', array(
			'id' => 'users-grid',
			'dataProvider' => $dataMember,
			'summaryText' => '',
			'itemsCssClass' => 'table-responsive table table-striped table-hover table-vcenter',
			'columns' => array(
				'code',
				'fullname',
				'email',
				'phone',

				array(
					'header' => 'KTP',
					'class' => 'CButtonColumn',
					'template' => '{KTP}',
					'buttons' => array(
						'KTP' =>
						array(
							'url' => 'Yii::app()->createUrl("main/member/view", array("id"=>$data->id_member,"type"=>1))',
							'options' => array(
								'ajax' => array(
									'type' => 'POST',
									'url' => "js:$(this).attr('href')",
									'success' => 'function(data) { $("#viewModal .modal-body p").html(data); $("#viewModal").modal(); }'
								),
							),
						),
					),
				),


				array(
					'header' => 'Pas Foto',
					'class' => 'CButtonColumn',
					'template' => '{Pas Foto}',
					'buttons' => array(
						'Pas Foto' =>
						array(
							'url' => 'Yii::app()->createUrl("main/member/view", array("id"=>$data->id_member,"type"=>2))',
							'options' => array(
								'ajax' => array(
									'type' => 'POST',
									'url' => "js:$(this).attr('href')",
									'success' => 'function(data) { $("#viewModal .modal-body p").html(data); $("#viewModal").modal(); }'
								),
							),
						),
					),
				),


				array(
					'header' => 'Follow Sosmed',
					'class' => 'CButtonColumn',
					'template' => '{Follow Sosmed}',
					'buttons' => array(
						'Follow Sosmed' =>
						array(
							'url' => 'Yii::app()->createUrl("main/member/view", array("id"=>$data->id_member,"type"=>3))',
							'options' => array(
								'ajax' => array(
									'type' => 'POST',
									'url' => "js:$(this).attr('href')",
									'success' => 'function(data) { $("#viewModal .modal-body p").html(data); $("#viewModal").modal(); }'
								),
							),
						),
					),
				),




			),
		)); ?>
	</div>
</div>

<div class="form-normal form-horizontal clearfix">
	<div class="col-md-12">

		<?php $form = $this->beginWidget('CActiveForm', array(
			'id' => 'paper-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-3 control-label">
				<?php echo $form->labelEx($model, 'paper_file'); ?>
			</div>

			<div class="col-sm-9">
				<?php echo $form->textField($model, 'paper_file', array('class' => 'form-control', 'placeholder' => 'Contoh: https://www.youtube.com/watch?v=6CX4nRggsj8')); ?>
				<?php echo $form->error($model, 'paper_file'); ?>
			</div>


		</div>

		<div class="form-group">

			<div class="col-sm-10">
			</div>
			<div class="col-sm-2">
				<?php echo CHtml::submitButton($model->isNewRecord ? 'Simpan' : 'Simpan', array('class' => 'btn btn-info btn-lg btn-block pull-right')); ?>
			</div>

		</div>

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

	</div>
</div>

<iframe width="100%" height="540" src="<?php echo str_replace("https://www.youtube.com/watch?v=", "https://www.youtube.com/embed/", $model->paper_file); ?>" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

<script>
	$(document).ready(function(){
		$('#description').hide();
		$('#Paper_status_1').click(function(){
			$('#description').show();
		});
		$('#Paper_status_0').click(function(){
			$('#description').hide();
		});
	});
</script>