Yii2Assets / yii2-fullscreen-modal
https://blog.sathit.me/
https://coreui.io/docs/components/bootstrap/modal/
https://stackoverflow.com/questions/31426626/yii2-multiple-bootstrap-modal-items-on-same-page
https://www.youtube.com/watch?reload=9&v=SpyVEbFQ6Bc
////activity.php
<?php
use kartik\grid\GridView;
use yii\helpers\Html;
use kartik\widgets\ActiveForm;
use yii\helpers\Url;
use yii\bootstrap\Modal;
use prawee\widgets\ButtonAjax;
use yii\widgets\Pjax;
$this->title = 'รายงานการใช้ยานพาหนะ โรงพยาบาลม่วงสามสิบ';
$this->params['breadcrumbs'][] = ['label' => 'รายงาน', 'url' => ['rfcar/index']];
$this->params['breadcrumbs'][] = 'จำนวนการใช้รถ';
?>
<div class='well'>
<?php $form = ActiveForm::begin(); ?>
ระหว่างวันที่:
<?php
echo yii\jui\DatePicker::widget([
'name' => 'date1',
'value' => $date1,
'language' => 'th',
'dateFormat' => 'yyyy-MM-dd',
'clientOptions' => [
'changeMonth' => true,
'changeYear' => true,
]
]);
?>
ถึง:
<?php
echo yii\jui\DatePicker::widget([
'name' => 'date2',
'value' => $date2,
'language' => 'th',
'dateFormat' => 'yyyy-MM-dd',
'clientOptions' => [
'changeMonth' => true,
'changeYear' => true,
]
]);
?>
<button class='btn btn-danger'> ตกลง </button>
<?php $form = ActiveForm::begin([ ]);
echo Html::a('ทั้งหมด', ['rfcar/car_alls'], ['class' => 'btn btn-info', 'style' => 'margin-left:5px','target'=>'_blank']);
echo Html::a('ผลงานทุกคน', ['rfcar/driver_all'], ['class' => 'btn btn-primary', 'style' => 'margin-left:5px','target'=>'_blank']);?>
<br>
<p>
<?= Html::button('กฤษฎา', ['value'=>Url::to(['rfcar/driver_tod']), 'class' => 'btn btn-success','id'=>'modalButton']); ?>
</p>
<?php Modal::begin([
'id' => 'modaltod',
'header' => '<h4 class="modal-title">TOD</h4>',
'size'=>'modal-lg',
'footer' => '<a href="#" class="btn btn-primary" data-dismiss="modal">ปิด</a>',
]);
Modal::end();
?>
</div>
<div class="modal inmodal" id="myModal2" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content animated fadeIn">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<h3 class="modal-title">Create New User</h3>
<small class="font-bold"></small>
</div>
<div class="modal-body">
<div id='modalContent'></div>
</div>
</div>
</div>
</div>
<button href="<?php echo Url::to('create-popup');?>" type="button" class="btn btn-primary openModal">Create New User</button>
<div>
<p>
<?= Html::button('ประไพ', ['value'=>Url::to(['rfcar/driver_tod']), 'class' => 'showModalButton btn btn-success']); ?>
</p>
<?php Modal::begin([
//'id' => 'modalpai',
'id' => $model->id,
'header' => '<h4><a color-blue>)ประไพ สายพฤกษ์</a></h4>',
'size'=>'modal-lg',
'footer' => '<a href="#" class="btn btn-info" data-dismiss="modal">ปิด</a>',
]);
echo "<div id='modalContent'></div>";
Modal::end();
?>
</div>
<p>
<?= Html::button('Quick Search', ['value' =>Url::to('rfcar/driver_yut'),'class' =>'btn btn-success', 'id'=>'modalButton']) ?>
</p>
<?php
Modal::begin([
'header'=> '<h4>My Modal Popup</h4>',
'id' => 'modal',
'size' => 'modal-lg',
]);
echo "<div id='modalContent'></div>";
Modal::end();
###################################
echo Html::a('3.วีระยุทธ', ['rfcar/driver_yut'], ['class' => 'btn btn-warning', 'style' => 'margin-left:5px','id'=>'modalButton']);
echo Html::a('Chatree', 'rfcar/driver_yut', ['class' => 'btn btn-primary modal-form', 'data-size' => 'modal-lg']);
echo Html::a('4.ธานิน', ['rfcar/driver_tanin'], ['class' => 'btn btn-danger', 'style' => 'margin-left:5px','id'=>'modalButton']);
echo Html::a('5.สามารถ', ['rfcar/driver_sm'], ['class' => 'btn btn-primary', 'style' => 'margin-left:5px','target'=>'_blank']);
echo Html::a('6.สายันต์', ['rfcar/driver_sy'], ['class' => 'btn btn-info', 'style' => 'margin-left:5px','target'=>'_blank']);
echo Html::a('7.เฉลิมเกียรติ', ['rfcar/driver_sk'], ['class' => 'btn btn-success', 'style' => 'margin-left:5px','target'=>'_blank']);
echo Html::a('8.มนตรี', ['rfcar/driver_mt'], ['class' => 'btn btn-info', 'style' => 'margin-left:5px','target'=>'_blank']);
//echo Html::a('เอ๊ะ', ['rfcar/driver_tod'], ['class' => 'btn btn-danger', 'style' => 'margin-left:5px','target'=>'_blank']);
echo Html::button('ทดสอบ', ['value'=>Url::to(['rfcar/driver_tod']), 'class' =>'btn btn-danger','id'=>'modalButton']);
ActiveForm::end();?>
<?php ActiveForm::end(); ?>
</div>
<div>
<?php
echo GridView::widget([
'dataProvider' => $dataProvider,
'panel' => [
'before'=>'<a>รายงานประเภทกิจกกรรมการใช้รถ</a>',
'after'=>'<b style="color:red">ประมวลผลจากวันที่ </b>'.$date1 .'<b style="color:red">ถึงวันที่</b>' .$date2
],
'columns' => [
['class' => 'yii\grid\SerialColumn'],
[
'attribute' => 'cactiv_id',
'header' => 'รหัสกิจกรรม',
],
[
'attribute' => 'cactiv_name',
'header' => 'ประเภทกิจกกรรมใช้รถ',
],
[
'attribute' => 'จำนวน',
'format' => 'raw',
'value' => function($model) {
$cactiv_id = $model['cactiv_id'];
$name = $model['amount'];
return Html::a(Html::encode($name), ['rfcar/caractiv_list', 'cactiv_id' =>$cactiv_id],['class' => 'btn btn-info',
//'id'=>'modalButton',
'data-toggle' => 'modal',
// 'data-target' => '#activity-modal',
'data-pjax' => '0'
]);
}
],
]
] )
?>
<?php
$this->registerJsFile('@web/js/main.js', ['depends' => [\yii\web\JqueryAsset::className()]]);
?>
<?php
$script = <<< JS
//Open Modal And Saved
$(document).on('click',".openModal",function(e) {
$("#myModal2").modal("show");
$("#myModal2").find("#modalContent").load($(this).attr("href"));
});
JS;
$this->registerJs($script);
?>
ไม่มีความคิดเห็น:
แสดงความคิดเห็น