Server_AccessControl/views/device/index.tpl
2020-11-05 13:59:42 +07:00

143 lines
7.0 KiB
Smarty

{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\DeviceAsset"}
{DeviceAsset::register($this)|void}
{block name='content'}
<div class="device-index">
<input type='hidden' name='URL_sync_schedule' value="{Url::to(['sync-schedule'])}">
<input type='hidden' name='URL_sync_staff' value="{Url::to(['sync-staff'])}">
<input type='hidden' name='URL_open_door' value="{Url::to(['open-doors-of-device'])}">
<input type='hidden' name='pageSize' value="{Yii::$app->params["pageSize"]}">
<input type='hidden' name='get_data_sync_url' value="{Url::to(['get-data-sync'])}">
<input type='hidden' name='sync_schedule_url' value="{Url::to(['sync-schedule'])}">
<input type='hidden' name='sync_staffs_url' value="{Url::to(['sync-staffs'])}">
<input type='hidden' name='get_logs_sync_url' value="{Url::to(['sync-logs'])}">
<div class="" style="font-size: 15px;">
{if Yii::$app->user->can("deviceCreate")}
<label class="action-button" onclick="common.form(this, 'device');" data-href="{Url::to(['create'])}">
<i class="fa fa-plus-square fa-1-5x"></i> Thêm
</label>
{/if}
{if Yii::$app->user->can("deviceUpdate")}
<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>
{/if}
{if Yii::$app->user->can("deviceDelete")}
<label class="action-button" onclick="_delete(this);" data-href="{Url::to(['delete'])}">
<i class="fa fa-trash fa-1-5x"></i> Xóa
</label>
{/if}
{if Yii::$app->user->can("deviceSyncDeviceToServer")}
<label class="action-button" onclick="_getLogs(this);" data-href="{Url::to(['get-logs'])}">
<i class="fa fa-exchange fa-1-5x"></i> Lấy các sự kiện
</label>
{/if}
{if Yii::$app->user->can("deviceChangeIP")}
<label class="action-button" onclick="_form(this);" data-href="{Url::to(['change-ip'])}">
<i class="fa fa-pencil fa-1-5x"></i> Thay đổi địa chỉ IP
</label>
{/if}
{if Yii::$app->user->can("deviceSyncServerToDevice")}
<label class="action-button" onclick="_sync(this);" data-href="{Url::to(['sync'])}">
<i class="fa fa-refresh fa-1-5x"></i> Đồng bộ dữ liệu đến thiết bị
</label>
{/if}
{if Yii::$app->user->can("deviceExport")}
<label class="action-button" onclick="_export(this);" data-href="{Url::to(['export'])}">
<i class="fa fa-download fa-1-5x"></i> Xuất
</label>
{/if}
{if Yii::$app->user->can("deviceOpenDoors")}
<label class="action-button" onclick="openAllDoors(this);" data-href="{Url::to(['open-all-doors'])}">
<i class="fa fa-reply fa-1-5x"></i> Mở tất cả cửa
</label>
{/if}
<label class="action-button" onclick="_logs(this);" data-href="{Url::to(['logs'])}">
<i class="fa fa-file fa-1-5x"></i> Ghi nhận hệ thống
</label>
<div class="pull-right" id="btn-check-all" style="padding: 10px;">
<input type='checkbox' value='0' class='checkbox-device-all' id='checkbox-device-all'> Chọn tất cả
</div>
</div>
<div class="hidden">
<input type="file" name="file" id="file">
<input type="hidden" value="{Url::to(['upload'])}" name="upload_file_url">
</div>
{Pjax id="device-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("device"),
'columns' => [
[
'class' => 'yii\grid\SerialColumn',
'contentOptions' => ['class' => 'text-center'],
'headerOptions' => ['class' => 'text-center', 'style' => 'width:3%']
],
[
'header' => "<input type='checkbox' value='0' class='checkbox-device' id='checkall-device'>",
'format' => 'raw',
'contentOptions' => ['class' => 'text-center'],
'headerOptions' => ['class' => 'text-center', 'style' => 'width:3%'],
'value' => \app\helpers\DeviceGrid::checkbox("device", false)
],
'name',
[
'attribute' => 'serial',
'headerOptions' => ['style' => 'width:10%']
],
[
'attribute' => 'ip_address',
'headerOptions' => ['style' => 'width:10%']
],
'subnet_mask',
'gateway',
'mac_address',
[
'attribute' => 'status',
'format' => 'raw',
'filter' => $statusArray,
'contentOptions' => ['class' => 'text-center'],
'value' => \app\helpers\DeviceGrid::status($statusArray)
],
[
'attribute' => 'type',
'contentOptions' => ['class' => 'text-center'],
'headerOptions' => ['style' => 'width:5%']
],
[
'attribute' => 'area_id',
'format' => 'raw',
'filter' => $areaArray,
'contentOptions' => ['class' => 'text-center'],
'value' => \app\helpers\DeviceGrid::area($areaArray)
],
'version',
[
'attribute' => 'door',
'format' => 'raw',
'headerOptions' => ['style' => 'width:10%'],
'contentOptions' => \app\helpers\DeviceGrid::openDoorHeader(),
'value' => \app\helpers\DeviceGrid::openDoor()
]
],
'pager' => [
'firstPageLabel' => "<i class='fa fa-backward'></i>",
'lastPageLabel' => "<i class='fa fa-forward'></i>",
'nextPageLabel' => "<i class='fa fa-chevron-right'></i>",
'prevPageLabel' => "<i class='fa fa-chevron-left'></i>",
'maxButtonCount' => 5
]
])}
{/Pjax}
</div>
{/block}