update Schedule full CRUD
This commit is contained in:
@@ -56,6 +56,9 @@
|
||||
'name',
|
||||
'serial',
|
||||
'ip_address',
|
||||
'subnet_mask',
|
||||
'gateway',
|
||||
'mac_address',
|
||||
[
|
||||
'attribute' => 'status',
|
||||
'format' => 'raw',
|
||||
@@ -63,13 +66,7 @@
|
||||
'contentOptions' => ['class' => 'text-center'],
|
||||
'value' => \app\helpers\DeviceGrid::status($statusArray)
|
||||
],
|
||||
[
|
||||
'attribute' => 'type',
|
||||
'format' => 'raw',
|
||||
'filter' => $typeArray,
|
||||
'contentOptions' => ['class' => 'text-center'],
|
||||
'value' => \app\helpers\DeviceGrid::type($typeArray)
|
||||
],
|
||||
'type',
|
||||
[
|
||||
'attribute' => 'area_id',
|
||||
'format' => 'raw',
|
||||
@@ -77,14 +74,7 @@
|
||||
'contentOptions' => ['class' => 'text-center'],
|
||||
'value' => \app\helpers\DeviceGrid::area($areaArray)
|
||||
],
|
||||
[
|
||||
'attribute' => 'created_at',
|
||||
'value' => \app\helpers\CommonGrid::createdAt()
|
||||
],
|
||||
[
|
||||
'attribute' => 'modified_at',
|
||||
'value' => \app\helpers\CommonGrid::modifiedAt()
|
||||
]
|
||||
'version'
|
||||
]
|
||||
])}
|
||||
{/Pjax}
|
||||
|
||||
125
views/schedule/form.tpl
Normal file
125
views/schedule/form.tpl
Normal file
@@ -0,0 +1,125 @@
|
||||
<style>
|
||||
.select-picker{
|
||||
width: 80px;
|
||||
}
|
||||
</style>
|
||||
<input type="hidden" name="CurrentPos" value="">
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<div class="form-group" id="name">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">Tên lịch trình <i class="text-red">*</i></div>
|
||||
<input type="text" class="form-control" value="{$model->name|default:""}" name="Name">
|
||||
</div>
|
||||
<span class="help-block hidden"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">Chú thích</div>
|
||||
<input type="text" class="form-control" value="{$model->description|default:""}" name="Description">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Ngày</th>
|
||||
<th style="width: 25%;" class="text-center">Khung giờ 1</th>
|
||||
<th style="width: 25%;" class="text-center">Khung giờ 2</th>
|
||||
<th style="width: 25%;" class="text-center">Khung giờ 3</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach from=$dayOfWeek item=day key=k}
|
||||
<tr>
|
||||
<td>{$day}</td>
|
||||
<td class="text-center">
|
||||
<div class="time-picker-data" id="data-{$k}1">
|
||||
{if $model[$k|cat:"Time1"]}
|
||||
{$time=explode("-",$model[$k|cat:"Time1"])}
|
||||
{if $time[0]!=="00:00" || $time[1]!=="00:00"}
|
||||
<span style="cursor: pointer;" onclick="openFormTimePicker(this);" data-id="{$k}1">{$time[0]} - {$time[1]}</span>
|
||||
{else}
|
||||
<i class="fa fa-plus fa-1-5x text-green" style="cursor: pointer;" onclick="openFormTimePicker(this);" data-id="{$k}1"></i>
|
||||
{/if}
|
||||
{else}
|
||||
<i class="fa fa-plus fa-1-5x text-green" style="cursor: pointer;" onclick="openFormTimePicker(this);" data-id="{$k}1"></i>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="time-picker-form hidden" id="form-{$k}1">
|
||||
<input type='text' name='From{$k}1' class="select-picker" value="{$time[0]|default:"00:00"}" readonly="">
|
||||
-
|
||||
<input type='text' name='To{$k}1' class="select-picker" value="{$time[1]|default:"00:00"}" readonly="">
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<div class="time-picker-data" id="data-{$k}2">
|
||||
{if $model[$k|cat:"Time2"]}
|
||||
{$time=explode("-",$model[$k|cat:"Time2"])}
|
||||
{if $time[0]!=="00:00" || $time[1]!=="00:00"}
|
||||
<span style="cursor: pointer;" onclick="openFormTimePicker(this);" data-id="{$k}2">{$time[0]} - {$time[1]}</span>
|
||||
{else}
|
||||
<i class="fa fa-plus fa-1-5x text-green" style="cursor: pointer;" onclick="openFormTimePicker(this);" data-id="{$k}2"></i>
|
||||
{/if}
|
||||
{else}
|
||||
<i class="fa fa-plus fa-1-5x text-green" style="cursor: pointer;" onclick="openFormTimePicker(this);" data-id="{$k}2"></i>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="time-picker-form hidden" id="form-{$k}2">
|
||||
<input type='text' name='From{$k}2' class="select-picker" value="{$time[0]|default:"00:00"}" readonly="">
|
||||
-
|
||||
<input type='text' name='To{$k}2' class="select-picker" value="{$time[1]|default:"00:00"}" readonly="">
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<div class="time-picker-data" id="data-{$k}3">
|
||||
{if $model[$k|cat:"Time3"]}
|
||||
{$time=explode("-",$model[$k|cat:"Time3"])}
|
||||
{if $time[0]!=="00:00" || $time[1]!=="00:00"}
|
||||
<span style="cursor: pointer;" onclick="openFormTimePicker(this);" data-id="{$k}3">{$time[0]} - {$time[1]}</span>
|
||||
{else}
|
||||
<i class="fa fa-plus fa-1-5x text-green" style="cursor: pointer;" onclick="openFormTimePicker(this);" data-id="{$k}3"></i>
|
||||
{/if}
|
||||
{else}
|
||||
<i class="fa fa-plus fa-1-5x text-green" style="cursor: pointer;" onclick="openFormTimePicker(this);" data-id="{$k}3"></i>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="time-picker-form hidden" id="form-{$k}3">
|
||||
<input type='text' name='From{$k}3' class="select-picker" value="{$time[0]|default:"00:00"}" readonly="">
|
||||
-
|
||||
<input type='text' name='To{$k}3' class="select-picker" value="{$time[0]|default:"00:00"}" readonly="">
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-info btn-xs dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
|
||||
<i class="fa fa-copy"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
{foreach from=$dayOfWeek item=d_copy key=k_copy}
|
||||
{if $k_copy!==$k}
|
||||
<li>
|
||||
<a href="#" onclick="_copy(this);
|
||||
return false;" data-from="{$k}" data-target="{$k_copy}">{$d_copy}</a>
|
||||
</li>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="text-right">
|
||||
<button class="btn btn-primary" onclick="save(this);" data-href="{$url}">
|
||||
<i class="fa fa-floppy-o"></i> Lưu
|
||||
</button>
|
||||
<button class="btn btn-default" data-dismiss="modal">
|
||||
<span class="fa fa-remove"></span> Hủy
|
||||
</button>
|
||||
</div>
|
||||
57
views/schedule/index.tpl
Normal file
57
views/schedule/index.tpl
Normal file
@@ -0,0 +1,57 @@
|
||||
{extends file=$smarty.current_dir|cat:'/../extends.tpl'}
|
||||
{use class="yii\helpers\Url"}
|
||||
{use class="yii\grid\GridView"}
|
||||
{use class="yii\widgets\Pjax" type="block"}
|
||||
{use class="app\assets\ScheduleAsset"}
|
||||
{ScheduleAsset::register($this)|void}
|
||||
{block name='content'}
|
||||
<div class="schedule-index">
|
||||
<div class="" style="font-size: 15px;">
|
||||
<label class="action-button" onclick="_create(this);" data-href="{Url::to(['create'])}">
|
||||
<i class="fa fa-plus-square fa-1-5x"></i> Thêm
|
||||
</label>
|
||||
<label class="action-button" onclick="_form(this);" data-href="{Url::to(['update'])}">
|
||||
<i class="fa fa-edit fa-1-5x"></i> Tùy chỉnh
|
||||
</label>
|
||||
<label class="action-button" onclick="_delete(this);" data-href="{Url::to(['delete'])}">
|
||||
<i class="fa fa-trash fa-1-5x"></i> Xóa
|
||||
</label>
|
||||
</div>
|
||||
{Pjax id="schedule-list"}
|
||||
{GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'filterModel' => $searchModel,
|
||||
'layout'=> \app\helpers\CommonGrid::getLayout(),
|
||||
'tableOptions' => [
|
||||
'class' => 'table table-striped table-bordered table-hover',
|
||||
'style' => 'background:#fff;min-width:700px;'
|
||||
],
|
||||
'rowOptions' => \app\helpers\CommonGrid::rows("schedule", true),
|
||||
'columns' => [
|
||||
[
|
||||
'class' => 'yii\grid\SerialColumn',
|
||||
'contentOptions' => ['class' => 'text-center'],
|
||||
'headerOptions' => ['class' => 'text-center', 'style' => 'width:3%']
|
||||
],
|
||||
[
|
||||
'header' => "<input type='checkbox' value='0' class='checkbox-schedule' id='checkall-schedule'>",
|
||||
'format' => 'raw',
|
||||
'contentOptions' => ['class' => 'text-center'],
|
||||
'headerOptions' => ['class' => 'text-center', 'style' => 'width:3%'],
|
||||
'value' => \app\helpers\CommonGrid::checkbox("schedule")
|
||||
],
|
||||
'name',
|
||||
'description',
|
||||
[
|
||||
'attribute' => 'created_at',
|
||||
'value' => \app\helpers\CommonGrid::createdAt()
|
||||
],
|
||||
[
|
||||
'attribute' => 'modified_at',
|
||||
'value' => \app\helpers\CommonGrid::modifiedAt()
|
||||
]
|
||||
]
|
||||
])}
|
||||
{/Pjax}
|
||||
</div>
|
||||
{/block}
|
||||
Reference in New Issue
Block a user