update CardRegister full CRUD

This commit is contained in:
dongpd 2020-10-10 17:37:52 +07:00
parent 2a8b009c12
commit 64e62ca3ce
13 changed files with 526 additions and 23 deletions

View File

@ -3,7 +3,7 @@
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Oct 10, 2020 at 11:10 AM
-- Generation Time: Oct 10, 2020 at 12:36 PM
-- Server version: 10.4.8-MariaDB
-- PHP Version: 7.1.33
@ -175,17 +175,20 @@ CREATE TABLE `staff` (
`date_in` int(11) NOT NULL DEFAULT 0,
`address` text DEFAULT NULL,
`created_at` int(11) NOT NULL DEFAULT 0,
`modified_at` int(11) NOT NULL DEFAULT 0
`modified_at` int(11) NOT NULL DEFAULT 0,
`card_register_time` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `staff`
--
INSERT INTO `staff` (`id`, `code`, `name`, `card_number`, `department_id`, `gender`, `birthday`, `email`, `phone`, `date_in`, `address`, `created_at`, `modified_at`) VALUES
(1, 1, 'Phạm Đức Đông', 1000001, 1, 'M', 691231867, '', '', 1602319867, '', 1602319867, 1602319867),
(2, 2, 'Ngô Văn Dũng', 10000002, 1, 'M', 608719882, '', '', 1602319882, '', 1602319882, 1602319882),
(3, 3, 'Hoàng Hồng Sơn', 10000003, 1, 'M', 622544932, NULL, NULL, 1602320932, NULL, 1602320932, 1602320932);
INSERT INTO `staff` (`id`, `code`, `name`, `card_number`, `department_id`, `gender`, `birthday`, `email`, `phone`, `date_in`, `address`, `created_at`, `modified_at`, `card_register_time`) VALUES
(1, 1, 'Phạm Đức Đông', 1001, 1, 'M', 691231867, '', '', 1602319867, '', 1602319867, 1602319867, 1602326177),
(2, 2, 'Ngô Văn Dũng', 1002, 1, 'M', 608719882, '', '', 1602319882, '', 1602319882, 1602319882, 1602326183),
(3, 3, 'Hoàng Hồng Sơn', 0, 1, 'M', 622544932, NULL, NULL, 1602320932, NULL, 1602320932, 1602320932, 1602319867),
(4, 4, 'Lê Hải Châu', 0, 1, 'M', 1602323106, '', '', 1602323106, '', 1602323106, 1602323106, 1602325273),
(5, 5, 'Nguyễn Hữu Hoàng Sơn', 0, 1, 'M', 1602324895, '', '', 1602324895, '', 1602324895, 1602324895, 1602324895);
-- --------------------------------------------------------
@ -229,7 +232,15 @@ INSERT INTO `system_logs` (`id`, `user_id`, `time`, `action`, `description`, `ty
(20, 1, 1602318893, 'delete', 'Xóa 2 nhân viên', 'staff'),
(21, 1, 1602319867, 'insert', 'Thêm mới nhân viên: Phạm Đức Đông', 'staff'),
(22, 1, 1602319882, 'insert', 'Thêm mới nhân viên: Ngô Văn Dũng', 'staff'),
(23, 1, 1602320932, 'import', 'Nhập dữ liệu: 1 nhân viên mới', 'staff');
(23, 1, 1602320932, 'import', 'Nhập dữ liệu: 1 nhân viên mới', 'staff'),
(24, 1, 1602323106, 'insert', 'Thêm mới nhân viên: Lê Hải Châu', 'staff'),
(25, 1, 1602324895, 'insert', 'Thêm mới nhân viên: Nguyễn Hữu Hoàng Sơn', 'staff'),
(26, 1, 1602324933, 'register', 'Đăng ký thẻ mới: Lê Hải Châu', 'card-register'),
(27, 1, 1602325239, 'update', 'Thay đổi đăng ký thẻ: Lê Hải Châu', 'card-register'),
(28, 1, 1602325273, 'update', 'Thay đổi đăng ký thẻ: Lê Hải Châu', 'card-register'),
(29, 1, 1602325978, 'delete', 'Xóa đăng ký thẻ: 4 nhân viên', 'card-register'),
(30, 1, 1602326177, 'register', 'Đăng ký thẻ mới: Phạm Đức Đông', 'card-register'),
(31, 1, 1602326183, 'register', 'Đăng ký thẻ mới: Ngô Văn Dũng', 'card-register');
-- --------------------------------------------------------
@ -353,13 +364,13 @@ ALTER TABLE `device`
-- AUTO_INCREMENT for table `staff`
--
ALTER TABLE `staff`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `system_logs`
--
ALTER TABLE `system_logs`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=24;
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=32;
--
-- AUTO_INCREMENT for table `user`

View File

@ -0,0 +1,23 @@
<?php
namespace app\assets;
use yii\web\AssetBundle;
class CardRegisterAsset extends AssetBundle {
public $basePath = '@webroot';
public $baseUrl = '@web';
public $css = [
];
public $js = [
'js/card-register.js'
];
public $depends = [
'yii\web\YiiAsset',
'app\assets\AppAsset',
// 'yii\jui\JuiAsset',
'yii\bootstrap\BootstrapAsset',
];
}

View File

@ -0,0 +1,194 @@
<?php
namespace app\controllers;
use Yii;
use app\models\Staff;
use app\models\StaffSearch;
use app\models\Department;
use app\models\common;
use yii\web\Controller;
use yii\filters\VerbFilter;
use yii\helpers\Html;
use yii\helpers\Url;
/**
* StaffController implements the CRUD actions for Staff model.
*/
class CardRegisterController extends Controller {
public function init() {
parent::init();
if (Yii::$app->user->isGuest)
return $this->redirect(['/site/login']);
}
/**
* {@inheritdoc}
*/
public function behaviors() {
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
],
];
}
public function actionIndex() {
$this->view->title = 'Đăng ký thẻ';
$searchModel = new StaffSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
$dataProvider->query->andFilterWhere(["<>", "card_number", 0]);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
"departmentArray" => Department::departmentArray()
]);
}
public function actionCreate() {
$model = new Staff();
Yii::$app->response->format = "json";
if (Yii::$app->request->post()) {
$data = Yii::$app->request->post();
$check = Staff::findOne(['card_number' => $data['CardNumber']]);
if ($check)
return ["status" => false, "type" => "card"];
$staff = $model->findOne($data["Staff"]);
$staff->card_number = $data["CardNumber"];
$staff->card_register_time = time();
if ($staff->save()) {
common::insertSystemLogs(["action" => "register", "description" => "Đăng ký thẻ mới: " . $staff->name, "type" => Yii::$app->controller->id]);
return ["status" => true];
} else
return ["status" => false, "type" => "error"];
} else {
return [
"title" => Html::tag("i", "", ["class" => "fa fa-plus-square"]) . " Thêm",
"form" => $this->renderPartial("form", [
"model" => $model,
"url" => Url::to(["create"]),
"staffArray" => Staff::staffArray()
])
];
}
}
public function actionUpdate($id) {
$model = $this->findModel($id);
Yii::$app->response->format = "json";
if (Yii::$app->request->post()) {
$data = Yii::$app->request->post();
$check = Staff::findOne(['card_number' => $data['CardNumber']]);
if ($check && $check->id != $id)
return ["status" => false, "type" => "card"];
$model->card_number = $data["CardNumber"];
$model->card_register_time = time();
if ($model->save()) {
common::insertSystemLogs(["action" => "update", "description" => "Thay đổi đăng ký thẻ: " . $model->name, "type" => Yii::$app->controller->id]);
return ["status" => true];
} else
return ["status" => false, "type" => "error"];
} else {
return [
"title" => Html::tag("i", "", ["class" => "fa fa-edit"]) . " Tùy chỉnh",
"form" => $this->renderPartial("form", [
"model" => $model,
"url" => Url::to(["update", "id" => $id]),
"staffArray" => [$model->id => $model->code . "-" . $model->name]
])
];
}
}
public function actionDelete() {
if (Yii::$app->request->post()) {
$lists = Yii::$app->request->post("lists");
Staff::updateAll(["card_number" => 0], ["IN", "id", $lists]);
common::insertSystemLogs(["action" => "delete", "description" => "Xóa đăng ký thẻ: " . count($lists) . " nhân viên", "type" => Yii::$app->controller->id]);
}
}
protected function findModel($id) {
if (($model = Staff::findOne($id)) !== null) {
return $model;
}
throw new NotFoundHttpException('The requested page does not exist.');
}
public function actionExport() {
$objPHPExcel = new \PHPExcel();
$objPHPExcel->setActiveSheetIndex(0);
$toExcelFile[] = ["Mã nhân viên", "Tên nhân viên", "Số thẻ", "Phòng ban", "Ngày dăng ký thẻ"];
$staffs = Staff::find()->andWhere(["<>", "card_number", 0])->all();
$departmentArray = Department::departmentArray();
foreach ($staffs as $k => $v) {
$ExportData[] = $v->code;
$ExportData[] = $v->name;
$ExportData[] = $v->card_number;
$ExportData[] = isset($departmentArray[$v->department_id]) ? $departmentArray[$v->department_id] : "";
$ExportData[] = date("H:i:s d/m/Y", $v->card_register_time);
$toExcelFile[] = $ExportData;
unset($ExportData);
}
$totals = count($staffs) + 1;
$activeSheet = $objPHPExcel->getActiveSheet();
$activeSheet->getStyle("A1:E" . $totals)->getFont()->setName('Time New Roman')->setSize(10);
$activeSheet->getStyle("A1:E1")->applyFromArray([
'fill' => array(
'type' => \PHPExcel_Style_Fill::FILL_SOLID,
'color' => array('rgb' => '7ac3ec')
)
]);
$rowCount = 1;
for ($i = 0; $i < count($toExcelFile); $i++) {
$column = 'A';
$row = $toExcelFile[$i];
for ($j = 0; $j < count($row); $j++) {
if (!isset($row[$j]))
$value = NULL;
elseif ($row[$j] != "")
$value = strip_tags($row[$j]);
else
$value = "";
$activeSheet->setCellValue($column . $rowCount, $value);
$column = chr(ord($column) + 1);
}
$rowCount++;
}
$activeSheet->getStyle("A1:E" . $totals)->applyFromArray([
'alignment' => [
'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
],
'borders' => [
'allborders' => [
'style' => \PHPExcel_Style_Border::BORDER_THIN
]
]
]);
$objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
ob_end_clean();
header('Content-type: application/vnd.ms-excel');
header('Content-Disposition: attachment; filename="card_register_' . date("YmdHis") . '.xlsx"');
header('Cache-Control: max-age=0');
common::SaveViaTempFile($objWriter);
exit();
}
public function actionLogs() {
if (Yii::$app->request->isAjax) {
Yii::$app->response->format = "json";
return [
"title" => Html::tag("i", "", ["class" => "fa fa-file"]) . " Ghi nhận hệ thống",
"form" => \app\widgets\SystemLogsView::widget(['type' => Yii::$app->controller->id])
];
}
}
}

View File

@ -59,9 +59,11 @@ class StaffController extends Controller {
$check = Staff::findOne(['code' => $data['Code']]);
if ($check)
return ["status" => false, "type" => "code"];
if ($data['CardNumber'] !== "" && $data['CardNumber'] !== "0") {
$check = Staff::findOne(['card_number' => $data['CardNumber']]);
if ($check)
return ["status" => false, "type" => "card"];
}
if ($model->create($data)) {
common::insertSystemLogs(["action" => "insert", "description" => "Thêm mới nhân viên: " . $data["Name"], "type" => Yii::$app->controller->id]);
return ["status" => true];
@ -88,11 +90,16 @@ class StaffController extends Controller {
$check = Staff::findOne(['code' => $data['Code']]);
if ($check && $check->id != $id)
return ["status" => false, "type" => "code"];
if ($data['CardNumber'] !== "" && $data['CardNumber'] !== "0") {
$check = Staff::findOne(['card_number' => $data['CardNumber']]);
if ($check && $check->id != $id)
return ["status" => false, "type" => "card"];
}
$model->name = $data["Name"];
$model->code = $data["Code"];
if ($model->card_number !== $data["CardNumber"]) {
$model->card_register_time = time();
}
$model->card_number = $data["CardNumber"] != "" ? $data["CardNumber"] : 0;
$model->department_id = $data["Department"];
$model->gender = $data["Gender"];
@ -239,6 +246,7 @@ class StaffController extends Controller {
$val["I"] !== "" ? date_format(date_create_from_format('d/m/Y', $val["I"]), 'U') : 0,
$val["J"],
time(),
time(),
time()
];
}

View File

@ -28,4 +28,10 @@ class StaffGrid extends CommonGrid {
};
}
public static function cardRegisterTime() {
return function($model) {
return date("H:i:s d/m/Y", $model->card_register_time);
};
}
}

View File

@ -20,6 +20,7 @@ use Yii;
* @property string $address
* @property int $created_at
* @property int $modified_at
* @property int $card_register_time
*/
class Staff extends \yii\db\ActiveRecord {
@ -36,7 +37,7 @@ class Staff extends \yii\db\ActiveRecord {
public function rules() {
return [
[['code', 'name', 'gender'], 'required'],
[['code', 'card_number', 'department_id', 'birthday', 'date_in', 'created_at', 'modified_at'], 'integer'],
[['code', 'card_number', 'department_id', 'birthday', 'date_in', 'created_at', 'modified_at', 'card_register_time'], 'integer'],
[['address'], 'string'],
[['name', 'email'], 'string', 'max' => 100],
[['gender'], 'string', 'max' => 10],
@ -62,6 +63,7 @@ class Staff extends \yii\db\ActiveRecord {
'address' => 'Địa chỉ',
'created_at' => 'Thời gian tạo',
'modified_at' => 'Thời gian sửa',
'card_register_time' => 'Ngày đăng ký thẻ'
];
}
@ -80,7 +82,8 @@ class Staff extends \yii\db\ActiveRecord {
"date_in" => date_format(date_create_from_format('d/m/Y', $data["DateIn"]), 'U'),
"address" => $data["Address"],
"created_at" => time(),
"modified_at" => time()
"modified_at" => time(),
"card_register_time" => time()
], '');
if ($r) {
try {
@ -93,7 +96,7 @@ class Staff extends \yii\db\ActiveRecord {
}
public function multiCreate($datas) {
$field = ['code', 'name', 'card_number', 'department_id', 'gender', 'birthday', 'email', 'phone', 'date_in', 'address', 'created_at', 'modified_at'];
$field = ['code', 'name', 'card_number', 'department_id', 'gender', 'birthday', 'email', 'phone', 'date_in', 'address', 'created_at', 'modified_at', 'card_register_time'];
static::getDb()->createCommand()->batchInsert($this->tableName(), $field, $datas)->execute();
return;
}
@ -108,4 +111,13 @@ class Staff extends \yii\db\ActiveRecord {
return ["status" => true, "description" => ""];
}
public static function staffArray() {
$lists = self::find()->andWhere(["card_number" => 0])->all();
$results = [];
foreach ($lists as $key => $value) {
$results[$value->id] = $value->code . "-" . $value->name;
}
return $results;
}
}

View File

@ -2,6 +2,11 @@
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group/>
<group>
<file>file:/C:/xampp/htdocs/Server_AccessControl/views/card-register/form.tpl</file>
<file>file:/C:/xampp/htdocs/Server_AccessControl/views/card-register/index.tpl</file>
<file>file:/C:/xampp/htdocs/Server_AccessControl/controllers/CardRegisterController.php</file>
<file>file:/C:/xampp/htdocs/Server_AccessControl/web/js/card-register.js</file>
</group>
</open-files>
</project-private>

View File

@ -20,8 +20,8 @@ use yii\widgets\ActiveForm;
<nav class="navbar navbar-static-top" role="navigation">
<div class="collapse navbar-collapse pull-left" id="navbar-collapse">
<ul class="nav navbar-nav" style="font-size: 20px;">
<li class="<?php if (in_array($this->context->id, ['department', 'staff'])) echo "active"; ?>">
<a href="<?php echo \yii\helpers\Url::to(['/department']); ?>">
<li class="<?php if (in_array($this->context->id, ['department', 'staff', 'card-register'])) echo "active"; ?>">
<a href="<?php echo \yii\helpers\Url::to(['/staff']); ?>">
Nhân sự
</a>
</li>

View File

@ -13,11 +13,11 @@
],
['label' => 'Login', 'url' => ['site/login'], 'visible' => Yii::$app->user->isGuest],
];
if (in_array($this->context->id, ['department', 'staff'])) {
if (in_array($this->context->id, ['department', 'staff', 'card-register'])) {
$items = [
['label' => 'Phòng ban', 'url' => ['/department'], 'icon' => 'building'],
['label' => 'Nhân viên', 'url' => ['/staff'], 'icon' => 'users'],
['label' => 'Đăng ký thẻ', 'url' => ['/dashboard'], 'icon' => 'credit-card']
['label' => 'Đăng ký thẻ', 'url' => ['/card-register'], 'icon' => 'credit-card']
];
}
if (in_array($this->context->id, ['area', 'device'])) {

View File

@ -0,0 +1,37 @@
<style>
.input-group-addon{
width: 140px;
text-align: left;
}
.input-group{
width: 100%;
}
.select2{
width: 100% !important;
}
</style>
<div class="form-group" id="staff">
<div class="input-group">
<div class="input-group-addon">Nhân viên <i class="text-red">*</i></div>
<select class="form-control" name="Staff" id="Staff">
<option value="0"></option>
{html_options options=$staffArray selected=$model->id|default:0}
</select>
</div>
<span class="help-block hidden"></span>
</div>
<div class="form-group" id="card_number">
<div class="input-group">
<div class="input-group-addon">Mã thẻ <i class="text-red">*</i></div>
<input type="number" class="form-control" value="{$model->card_number|default:""}" name="CardNumber">
</div>
<span class="help-block hidden"></span>
</div>
<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>

View File

@ -0,0 +1,65 @@
{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\CardRegisterAsset"}
{CardRegisterAsset::register($this)|void}
{block name='content'}
<div class="staff-index">
<div class="" style="font-size: 15px;">
<label class="action-button" onclick="common.form(this, 'card-register');" 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>
<label class="action-button" onclick="_export(this);" data-href="{Url::to(['export'])}">
<i class="fa fa-download fa-1-5x"></i> Xuất
</label>
<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>
{Pjax id="staff-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("staff"),
'columns' => [
[
'class' => 'yii\grid\SerialColumn',
'contentOptions' => ['class' => 'text-center'],
'headerOptions' => ['class' => 'text-center', 'style' => 'width:3%']
],
[
'header' => "<input type='checkbox' value='0' class='checkbox-staff' id='checkall-staff'>",
'format' => 'raw',
'contentOptions' => ['class' => 'text-center'],
'headerOptions' => ['class' => 'text-center', 'style' => 'width:3%'],
'value' => \app\helpers\CommonGrid::checkbox("staff", false)
],
'code',
'name',
'card_number',
[
'attribute' => 'department_id',
'filter' => $departmentArray,
'value' => \app\helpers\StaffGrid::department($departmentArray)
],
[
'attribute' => 'card_register_time',
'value' => \app\helpers\StaffGrid::cardRegisterTime()
]
]
])}
{/Pjax}
</div>
{/block}

139
web/js/card-register.js Normal file
View File

@ -0,0 +1,139 @@
$(function () {
common.checkboxInit("staff");
});
function validate() {
var error = 0;
var Staff = $("select[name='Staff']").val();
if (Staff === "0") {
common.error("staff", "Hãy chọn nhân viên");
error++;
} else {
common.success("staff");
}
var CardNumber = $("input[name='CardNumber']").val();
if (CardNumber === "") {
common.error("card_number", "Số thẻ không được để trống");
error++;
} else {
common.success("card_number");
}
return error == 0 ? true : false;
}
function save(e) {
if (validate()) {
common.modalBlock(true);
$.ajax({
url: $(e).attr('data-href'),
type: 'POST',
data: {
Staff: $("select[name='Staff']").val(),
CardNumber: $("input[name='CardNumber']").val()
},
success: function (data) {
common.modalBlock(false);
if (data.status) {
notification.success("Đã lưu thông tin", 1000);
$.pjax.reload({container: '#staff-list'});
$("#staff-list").on('pjax:success', function () {
common.checkboxInit("staff");
});
$("#myModal").modal("hide");
} else {
if (data.type === "card") {
common.error("card_number", "Số thẻ đã tồn tại");
} else {
notification.danger("Có lỗi xảy ra, không lưu được dữ liệu!", 1000);
}
}
},
error: function (jqXHR, textStatus, errorThrown) {
common.modalBlock(false);
common.ajaxError();
}
});
}
}
function _form(e) {
var lists = [];
$.each($("input[name='checkbox-staff']:checked"), function () {
lists.push($(this).val());
});
if (lists.length == 0) {
alert("Vui lòng lựa chọn đối tượng để thay đổi!");
return;
}
if (lists.length > 1) {
alert("Tác vụ này không thể lựa chọn nhiều hơn một đối tượng!");
return;
}
common.modalBlock(true);
$.ajax({
url: $(e).attr('data-href') + "?id=" + lists[0],
type: 'POST',
success: function (data) {
common.modalBlock(false);
common.modalOpen(data.form, false, data.title);
},
error: function (jqXHR, textStatus, errorThrown) {
common.modalBlock(false);
common.ajaxError();
}
});
}
function _delete(e) {
var lists = [];
$.each($("input[name='checkbox-staff']:checked"), function () {
lists.push($(this).val());
});
if (lists.length == 0) {
alert("Vui lòng lựa chọn đối tượng để xóa!");
return;
}
if (confirm("Bạn có chắc chắn muốn xóa các đối tượng đã lựa chọn không?")) {
common.modalBlock(true);
$.ajax({
url: $(e).attr('data-href'),
type: 'POST',
data: {
lists: lists
},
success: function (data) {
common.modalBlock(false);
notification.danger("Đã xóa dữ liệu", 1000);
$.pjax.reload({container: '#staff-list'});
$("#staff-list").on('pjax:success', function () {
common.checkboxInit("staff");
});
},
error: function (jqXHR, textStatus, errorThrown) {
common.modalBlock(false);
common.ajaxError();
}
});
}
}
function _export(e) {
window.location = $(e).attr("data-href");
}
function _logs(e) {
common.modalBlock(true);
$.ajax({
url: $(e).attr('data-href'),
type: 'POST',
success: function (data) {
common.modalBlock(false);
common.modalOpen(data.form, true, data.title);
},
error: function (jqXHR, textStatus, errorThrown) {
common.modalBlock(false);
common.ajaxError();
}
});
}

View File

@ -239,6 +239,9 @@ common.form = function (e, obj, bigSize) {
$('#Department').select2();
common.dateTimePickerByClass("DatePicker", "DD/MM/YYYY");
}
if (obj === 'card-register') {
$('#Staff').select2();
}
},
error: function (jqXHR, textStatus, errorThrown) {
common.modalBlock(false);