-Add new setting "Delete shift"
-Move "Shift" frontend to V1 module
This commit is contained in:
miroman-afk
2022-02-01 01:55:15 +03:00
parent 57949aa89a
commit 5497b611ef
29 changed files with 1359 additions and 3 deletions

36
commands/GETSettings.php Normal file
View File

@@ -0,0 +1,36 @@
<?php
namespace App\Commands;
use App\Component\Models\Settings;
use App\Console\Commands\HRCCommand;
use App\Console\Commands\HRCCommandInterface;
class GETSettings extends HRCCommand implements HRCCommandInterface {
protected $signature = 'getsettings';
public function command($input, $output = null) {
if (isset($input['code'])) {
$setting = Settings::where('code', $input['code'])->first();
if ($setting) {
return [
'status' => 'success',
'name' => $setting['name'],
'code' => $setting['code'],
'value' => $setting['value'],
];
} else {
return [
'status' => 'error',
'more' => 'Setting not found',
];
}
} else {
$settings = Settings::all();
return [
'status' => 'success',
'settings' => $settings,
];
}
}
}

View File

@@ -0,0 +1,86 @@
<?php
namespace App\Commands;
use App\Component\Models\ExchangeActions;
use App\Component\Models\ExchangeDeleted;
use App\Component\Models\ExchangeItems;
use App\Component\Models\ExchangeOrders;
use App\Component\Models\ExchangeShifts;
use App\Console\Commands\HRCCommand;
use App\Console\Commands\HRCCommandInterface;
class POSTDeleteData extends HRCCommand implements HRCCommandInterface {
protected $signature = 'postdeletedata';
public function command($input, $output = null) {
if ($input['value'] == 'delete_shift') {
if ($input['shift_id']) {
$exchange_shift = ExchangeShifts::where('id', $input['shift_id'])->first();
$exchange_orders = ExchangeOrders::where('shift_id', '=', $input['shift_id'])->get();
$exchange_items = ExchangeItems::where('shift_id', '=', $input['shift_id'])->get();
$exchange_actions = ExchangeActions::where('shift_id', '=', $input['shift_id'])->get();
$exchange_deleted = ExchangeDeleted::where('shift_id', '=', $input['shift_id'])->get();
if ($exchange_shift) {
$exchange_shift = ExchangeShifts::find($input['shift_id']);
$exchange_shift->delete();
}
if ($exchange_orders) {
foreach ($exchange_orders as $key => $exchange_order) {
$order = ExchangeOrders::find($exchange_order['id']);
$order->delete();
}
}
if ($exchange_items) {
foreach ($exchange_items as $key => $exchange_item) {
$item = ExchangeItems::find($exchange_item['id']);
$item->delete();
}
}
if ($exchange_actions) {
foreach ($exchange_actions as $key => $exchange_action) {
$action = ExchangeActions::find($exchange_action['id']);
$action->delete();
}
}
if ($exchange_deleted) {
foreach ($exchange_deleted as $key => $exchange_delete) {
$delete = ExchangeDeleted::find($exchange_delete['id']);
$delete->delete();
}
}
function dirDel($dir) {
$d = opendir($dir);
while (($entry = readdir($d)) !== false) {
if ($entry != "." && $entry != "..") {
if (is_dir($dir . "/" . $entry)) {
dirDel($dir . "/" . $entry);
} else {
unlink($dir . "/" . $entry);
}
}
}
closedir($d);
rmdir($dir);
}
$cache_dir = __DIR__ . "\\..\\..\\..\\Cache\\";
dirDel($cache_dir);
return [
'status' => 'success',
'message' => 'Данные удалены',
];
} else {
return [
'status' => 'error',
'message' => 'Check input data',
];
}
} else {
return [
'status' => 'error',
'message' => 'Check input data',
];
}
}
}

View File

@@ -1,6 +1,6 @@
{ {
"name": "hrc-admin/hello-world", "name": "hrc-admin/hello-world",
"version": "2.11", "version": "2.12",
"require": { "require": {
"horeca/admin-php-module-core": "dev-master" "horeca/admin-php-module-core": "dev-master"
}, },

View File

@@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Log;
class DeleteSettingsFrontendFolder extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up() {
function dirDel($dir) {
$d = opendir($dir);
while (($entry = readdir($d)) !== false) {
if ($entry != "." && $entry != "..") {
if (is_dir($dir . "/" . $entry)) {
dirDel($dir . "/" . $entry);
} else {
unlink($dir . "/" . $entry);
}
}
}
closedir($d);
rmdir($dir);
}
if (file_exists(CORE_PATH . '/../Settings/web/')) {
dirDel(CORE_PATH . '/../Settings/web/');
} else {
Log::debug('Settings frontend already deleted!');
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down() {
//
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace Database\Component\Seeders;
use App\Component\Models\Settings;
use Illuminate\Database\Seeder;
class AddDeleteShiftSetting extends Seeder {
/**
* Run the database seeds.
*
* @return void
*/
public function run() {
$check_setting = Settings::where('name', 'Удаление смен')->where('code', 11)->first();
if (!$check_setting) {
$setting = new Settings;
$setting->name = 'Удаление смен';
$setting->value = '0';
$setting->code = 11;
$setting->is_common = 1;
$setting->save();
}
}
}

View File

@@ -1,5 +1,5 @@
[info] [info]
name=V1 name=V1
version=2.11 version=2.12
[build] [build]
version=2.11 version=2.12

51
web/controllers/market.js Normal file
View File

@@ -0,0 +1,51 @@
(function () {
'use strict';
angular
.module('app')
.controller('MarketCtrl', MarketCtrl);
MarketCtrl.$inject = ['$scope', 'smartRequest', '$location', 'Notification'];
function MarketCtrl($scope, smartRequest, $location, Notification) {
$scope.key = '';
$scope.getListModules = function () {
smartRequest.get('settings/pay/modules', function (data) {
$scope.modules = data.modules;
});
};
$scope.showModuleActivate = function (id) {
$scope.selectedModule = $scope.getModulerById(id);
$('#activate-module').modal();
};
$scope.activateModule = function () {
$('#btn-activated').prop('disabled', false);
smartRequest.post('settings/activate/module', {
key: $scope.key,
module: $scope.selectedModule.name,
}, function(data) {
if (data.message == 'Активация прошла успешно') {
Notification.success(data.message);
$location.path('/');
} else {
Notification.error(data.message);
}
});
};
$scope.getModulerById = function(id) {
var res;
$scope.modules.forEach(function (item) {
if (item.id == id) {
res = item;
return;
}
});
return res;
};
$scope.getListModules();
}
})();

View File

@@ -0,0 +1,62 @@
(function () {
'use strict';
angular
.module('app')
.controller('ModulesCtrl', ModulesCtrl);
ModulesCtrl.$inject = ['$scope', 'smartRequest', '$location', 'Notification'];
function ModulesCtrl($scope, smartRequest, $location, Notification) {
$scope.modules = [];
$scope.isAllSelected = false;
$scope.getListModules = function () {
smartRequest.get('settings/modules', function (data) {
$scope.modules = data.modules.modules;
$scope.modules.forEach(function (el) {
el.selected = false;
});
});
};
$scope.toggleAll = function () {
var toggleStatus = !$scope.isAllSelected;
angular.forEach($scope.modules, function (itm) { itm.selected = toggleStatus; });
$scope.isAllSelected = toggleStatus;
};
$scope.optionToggled = function () {
$scope.isAllSelected = $scope.modules.every(function (itm) { return itm.selected; });
};
$scope.updateModules = function () {
$scope.buttonDownload(true);
smartRequest.post('settings/update/modules', {
'modules': JSON.stringify($scope.toObject($scope.getSelectedModules()))
}, function(data) {
Notification.success('Модули обновлены');
$scope.getListModules();
$scope.buttonDownload(false);
});
};
$scope.getSelectedModules = function () {
return $scope.modules.filter(function (el) {
return el.selected;
});
};
$scope.toObject = function (arr) {
var rv = {};
for (var i = 0; i < arr.length; i++)
rv[i] = arr[i];
return rv;
};
$scope.buttonDownload = function(toggle) {
$('#btn-download').prop('disabled', toggle);
};
$scope.getListModules();
}
})();

View File

@@ -0,0 +1,49 @@
(function () {
'use strict';
angular
.module('app')
.controller('SettingsCtrl', SettingsCtrl);
SettingsCtrl.$inject = ['$scope', 'smartRequest', 'Notification'];
function SettingsCtrl($scope, smartRequest, Notification) {
$scope.settings = [];
$scope.terminalKey = '';
$scope.menuCode = '';
$scope.listSettings = function () {
$scope.settings = [];
smartRequest.get('settings/all?global=0', function (data) {
$scope.settings = $scope.settings.concat(data.settings);
});
smartRequest.get('v1/settings', function (data) {
$scope.settings = $scope.settings.concat(data.settings);
});
};
$scope.onSettingChange = function (setting) {
if (setting.value.length > 0) {
smartRequest.post('settings/update', {
code: setting.code,
value: setting.value
});
Notification.success('Настройки обновлены');
}
};
$scope.getRealisation = function() {
smartRequest.get('sync/realisation?terminal=' + $scope.terminalKey + '&menu=' + $scope.menuCode, function(data) {
});
};
$scope.switchDishes = function() {
smartRequest.get('sync/replace/dishes', function(data) {
console.log(data);
});
};
$scope.listSettings();
}
})();

View File

@@ -48,6 +48,30 @@
$scope.countOfPages = data.pages; $scope.countOfPages = data.pages;
$scope.pages = $scope.makePages(); $scope.pages = $scope.makePages();
}); });
smartRequest.get('v1/settings?code=11', function (data) {
$scope.delete_shift_value = data.value;
});
};
$scope.deleteShift = function (shift) {
$('#preload-modal').modal();
Notification.primary('Дождитесь удаления! Страница обновится автоматически.');
smartRequest.post('v1/deletedata', {
value: 'delete_shift',
shift_id: shift.id
}, function (data) {
$scope.status = data.status;
$scope.message = data.message;
if (data.status == 'success') {
Notification.success(data.message);
setTimeout(function() {
location.reload();
}, 1000);
}
if ($scope.status == 'error') {
Notification.error(data.message);
}
});
}; };
$scope.reportDelete = function (shift) { $scope.reportDelete = function (shift) {

View File

@@ -0,0 +1,183 @@
(function () {
'use strict';
angular
.module('app')
.controller('TerminalsCtrl', TerminalsCtrl);
TerminalsCtrl.$inject = ['$scope', 'smartRequest', 'Notification'];
function TerminalsCtrl($scope, smartRequest, Notification) {
$scope.terminals = [];
$scope.tasks = [];
$scope.printers = [];
$scope.settings = {
sizes: [56, 80],
speeds: [4800, 9600, 19200, 38400, 57600, 115200],
types: ['COM', 'LAN', 'Windows'],
com_ports: ['COM1', 'COM2', 'COM3', 'COM4', 'COM5', 'COM6', 'COM7', 'COM8', 'COM9', 'COM10']
};
$scope.terminal_id = 0;
$scope.active_tasks = [];
$scope.terminalLogs = [];
$scope.update = function () {
smartRequest.get('settings/terminals', function (data) {
$scope.terminals = data.terminals;
});
};
$scope.update();
$scope.onLicence = function (key, active) {
if (active === false) {
smartRequest.post('licence/reject', {
'key': key
},
function () {
$scope.update();
},
function () {
$scope.update();
});
}
else {
smartRequest.post('licence/apply', {
'key': key
},
function () {
$scope.update();
},
function () {
$scope.update();
});
}
};
$scope.isTaskActive = function (task) {
for (var i = 0; i < $scope.active_tasks.length; i++) {
if (task.code == $scope.active_tasks[i].code) {
return false;
}
}
return true;
};
$scope.editTerminal = function (id) {
$scope.terminal_id = id;
smartRequest.get('settings/update/list', function (data) {
for (var i = 0; i < data.update_list.length; i++) {
data.update_list[i].active = false;
data.update_list[i].period = parseInt(data.update_list[i].default);
}
$scope.all_tasks = data.update_list;
});
smartRequest.get('settings/update/active?terminal=' + id, function (data) {
for (var i = 0; i < data.update_list.length; i++) {
data.update_list[i].active = true;
data.update_list[i].period = parseInt(data.update_list[i].period);
}
$scope.active_tasks = data.update_list;
$('#edit-terminal').modal();
});
};
$scope.getEquipment = function (id) {
smartRequest.get('v1/equipment?terminal=' + id, function (data) {
$scope.printers = data.printers;
$scope.groups = data.printer_groups;
$scope.terminal_id = id;
});
$('#equipment').modal();
};
$scope.updateEquipment = function (printer) {
smartRequest.post('v1/printers', {
terminal: $scope.terminal_id,
id: printer.id,
name: printer.name,
ip_address: printer.ip,
com_port: printer.com_port,
type: printer.type,
speed: printer.speed,
group: printer.printer_group,
template: printer.template,
size: printer.size,
driver: printer.driver,
more: printer.more
}, function(data) {
Notification.success('Данные принтера сохранены');
});
};
$scope.updateFiscal = function (fiscal) {
smartRequest.post('v1/fiscals', {
terminal: $scope.terminal_id,
pass: fiscal.password,
ip: fiscal.ip
}, function(data) {
Notification.success('Данные ФР изменены');
});
};
$scope.addTask = function () {
smartRequest.get('settings/equipment/task?terminal=' + $scope.terminal_id, function (data) {
Notification.success('Задача запушена');
});
};
$scope.objectHasProperty = function (object, name) {
return object.hasOwnProperty(name);
};
$scope.changeTask = function (task) {
if (task.active) {
smartRequest.post('settings/update/enable', {
terminal: $scope.terminal_id,
task: task.code,
period: task.period
});
}
else {
smartRequest.post('settings/update/disable', {
terminal: $scope.terminal_id,
task: task.code
});
}
};
$scope.changePeriod = function (task) {
if (task.active) {
smartRequest.post('settings/update/enable', {
terminal: $scope.terminal_id,
task: task.code,
period: task.period
});
}
};
$scope.runTask = function (task) {
smartRequest.post('settings/update/force', {
terminal: $scope.terminal_id,
task: task.code
}, function (data) {
Notification.success('Задача запушена');
});
};
$scope.showLogs = function (terminal_key) {
smartRequest.get('settings/terminal/logs?terminal=' + terminal_key, function (data) {
$scope.terminalLogs = data.logs;
$('#logs').modal();
});
};
}
})();

View File

@@ -0,0 +1,19 @@
(function() {
'use strict';
angular
.module('app')
.controller('UserLogCtrl', UserLogCtrl);
UserLogCtrl.$inject = ['$scope', 'smartRequest', '$rootScope'];
function UserLogCtrl($scope, smartRequest, $rootScope) {
$scope.logs = [];
$scope.getLogs = function() {
smartRequest.get('log/user/list', function(data) {
$scope.logs = data.logs;
});
};
$scope.getLogs();
}
})();

104
web/controllers/users.js Normal file
View File

@@ -0,0 +1,104 @@
(function() {
'use strict';
angular
.module('app')
.controller('UsersCtrl', UsersCtrl);
UsersCtrl.$inject = ['$scope', 'smartRequest', '$rootScope'];
function UsersCtrl($scope, smartRequest, $rootScope) {
$scope.users = [];
$scope.currentUser = {};
$scope.newUser = {};
$scope.update = function() {
smartRequest.get('settings/users/list', function(data) {
$scope.users = data.users;
});
};
$scope.edit = function(user) {
$scope.currentUser = user;
$scope.allRights = [];
smartRequest.get('right/all', function(data) {
$scope.allRights = data.rights;
smartRequest.get('right/user?id=' + $scope.currentUser.id, function(data) {
for (var i = 0; i < $scope.allRights.length; i++) {
$scope.allRights[i].is_active = false;
for (var j = 0; j < data.rights.length; j++) {
if($scope.allRights[i].code === data.rights[j].code) {
$scope.allRights[i].is_active = true;
break;
}
}
}
$scope.currentUser.rights = $scope.allRights;
});
});
$('#edit-user').modal();
};
$scope.save = function() {
$('#edit-user').modal('toggle');
smartRequest.post('settings/users/edit', {
id: $scope.currentUser.id,
name: $scope.currentUser.name,
login: $scope.currentUser.login,
password: $scope.currentUser.password
}, function(data) {
$scope.update();
});
};
$scope.delete = function() {
$('#edit-user').modal('toggle');
$('#edit-user-confirm-delete').modal('toggle');
smartRequest.post('settings/users/delete', {
id: $scope.currentUser.id
}, function(data) {
$scope.currentUser = {};
$scope.update();
});
};
$scope.add = function() {
$scope.newUser = {};
$('#new-user').modal();
};
$scope.create = function() {
$('#new-user').modal('toggle');
smartRequest.post('settings/users/add', {
name: $scope.newUser.name,
login: $scope.newUser.login,
password: $scope.newUser.password
}, function(data) {
$scope.update();
});
};
$scope.onRight = function(code) {
smartRequest.post('right/toggle', {
id: $scope.currentUser.id,
code: code
}, function(data) {
smartRequest.get('right/list', function(data) {
$rootScope.globals.currentUser.rights = data.rights;
});
});
};
$scope.update();
}
})();

View File

@@ -37,5 +37,37 @@ item: [
url: 'app.reports' url: 'app.reports'
} }
] ]
},
{
name: 'Терминалы',
acl: 'terminals',
url: 'app.terminals',
icon: 'desktop_windows',
order: 100
},
{
name: 'Пользователи',
acl: 'users',
icon: 'account_box',
order: 101,
items: [
{
name: 'Управление',
acl: 'users',
url: 'app.users'
},
{
name: 'Логи',
acl: 'users',
url: 'app.user_logs'
}
]
},
{
name: 'Настройки',
acl: 'settings',
url: 'app.settings',
icon: 'settings',
order: 102
} }
]; ];

View File

@@ -45,4 +45,36 @@
data: {title: 'Отчеты'}, data: {title: 'Отчеты'},
controller: 'ReportsCtrl', controller: 'ReportsCtrl',
resolve: ['scripts/controllers/reports.js', 'moment', 'datetimepicker', 'select2'] resolve: ['scripts/controllers/reports.js', 'moment', 'datetimepicker', 'select2']
},
{
code: 'app.users',
url: '/users',
templateUrl: '../views/users/index.html',
data: {title: 'Пользователи'},
controller: 'UsersCtrl',
resolve: ['scripts/controllers/users.js']
},
{
code: 'app.settings',
url: '/settings',
templateUrl: '../views/settings/index.html',
data: {title: 'Настройки'},
controller: 'SettingsCtrl',
resolve: ['scripts/controllers/settings.js']
},
{
code: 'app.terminals',
url: '/terminals',
templateUrl: '../views/terminals/index.html',
data: { title : 'Терминалы' },
controller: 'TerminalsCtrl',
resolve: ['scripts/controllers/terminals.js']
},
{
code: 'app.user_logs',
url: '/logs',
templateUrl: '../views/users/logs.html',
data: { title : 'Логи пользователей' },
controller: 'UserLogCtrl',
resolve: ['scripts/controllers/user_logs.js']
} }

View File

@@ -0,0 +1,34 @@
<div class="padding">
<div class="col-md-6">
<div class="row">
<h4 class="text-muted" style="margin-bottom: 40px;" ng-if="modules.length > 0">Доступные обновления модулей</h4>
<h4 class="text-muted" style="margin-bottom: 40px;" ng-if="modules.length === 0">Нет доступных обновлений</h4>
<div ng-if="modules.length > 0">
<div class="box">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th><input type="checkbox" ng-click="toggleAll()" ng-model="isAllSelected"> Выбрать все</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="module in modules">
<td>
<input type="checkbox" ng-model="module.selected" ng-change="optionToggled()">
<strong>{{ module.name }}</strong>
<br> У вас установлена версия {{ module.version }}.
<strong>Обновите до {{ module.l_version }}</strong>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<button class="btn success pull-right" id="btn-download" ng-click="updateModules()">Обновить модули</button>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,17 @@
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h5 class="modal-title">Активация модуля {{ selectedModule.name }}</h5>
</div>
<div class="modal-body p-lg">
<div class="form-horizontal">
<div class="form-group">
<label class="form-control-label">Введите ключ</label>
<input type="text" class="form-control" placeholder="XXXX-XXXX-XXXX" ng-model="key" autofocus>
</div>
<button class="btn success p-x-md pull-right" id="btn-activated" ng-click="activateModule()">Активировать</button>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,29 @@
<div class="padding">
<h4 class="text-muted" style="margin-bottom: 40px;" ng-if="modules.length > 0">Дополнительные модули</h4>
<div class="row">
<div class="col-md-3" ng-if="modules.length > 0" ng-repeat="module in modules">
<div class="box">
<div class="item">
<img ng-src="{{ module.image }}" class="w-full" width="275" height="170">
</div>
<div class="p-a">
<div class="m-b">
<a class="_800">{{ module.name }}</a>
<div class="text-muted m-b-xs">
<span class="m-r">Автор: {{ module.author }}</span>
</div>
<p class="h-3x">{{ module.description }}</p>
</div>
<div>
<button class="btn success btn-block" ng-click="showModuleActivate(module.id)">Активировать</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="activate-module">
<div ui-include="'../views/modules/items/activate.html'"></div>
</div>

View File

@@ -0,0 +1,57 @@
<div class="padding">
<div class="box">
<div class="table-responsive">
<table class="table table-bordered m-a-0">
<thead>
<tr>
<th>Параметр</th>
<th>Значение</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="setting in settings">
<td>{{ setting.name }}</td>
<td>
<input type="text" class="form-control" ng-model="setting.value" ng-keyup="onSettingChange(setting)"
/>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="padding">
<div class="box">
<div class="box-header b-b">
<h3>Импорт реализации</h3>
</div>
<div class="box-body">
<div class="col-md-6">
<div class="form-group">
<label for="terminalKey">Terminal key</label>
<input type="number" class="form-control" ng-model="terminalKey">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="menuCode">Menu</label>
<input type="number" class="form-control" ng-model="menuCode">
</div>
</div>
<button class="btn success p-x-md" ng-click="createBot()">Загрузить</button>
</div>
</div>
</div>
<div class="padding">
<div class="box">
<div class="box-header b-b">
<h3>Перенос кодов</h3>
</div>
<div class="box-body">
<button class="btn success p-x-md" ng-click="switchDishes()">Перенос блюд</button>
</div>
</div>
</div>

View File

@@ -59,6 +59,7 @@
<a class="dropdown-item" ng-click="reportPay(shift)">По отделам</a> <a class="dropdown-item" ng-click="reportPay(shift)">По отделам</a>
<a class="dropdown-item" ng-click="reportOut(shift)">По внешним заказам</a> <a class="dropdown-item" ng-click="reportOut(shift)">По внешним заказам</a>
<a class="dropdown-item" ng-click="restoreShift(shift)">Восстановить смену</a> <a class="dropdown-item" ng-click="restoreShift(shift)">Восстановить смену</a>
<a class="dropdown-item" ng-if="delete_shift_value > 0" ng-click="deleteShift(shift)">Удалить смену</a>
</div> </div>
</div> </div>
</td> </td>

View File

@@ -0,0 +1,50 @@
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h5 class="modal-title">Управление синхронизацией</h5>
</div>
<div class="modal-body p-lg">
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<th>Задача</th>
<th>Период</th>
<th style="width: 70px">Статус</th>
<th style="width: 70px"><i class="material-icons">&#xE3E7;</i></th>
</thead>
<tbody>
<tr ng-repeat="task in active_tasks">
<td>{{ task.name }} <span class="label primary m-r-xs left5">{{ task.code }}</span></td>
<td><input type="number" class="form-control" ng-model="task.period" ng-change="changePeriod(task)" /></td>
<td>
<label class="ui-switch ui-switch-md m-t-xs">
<input type="checkbox" checked="checked" ng-change="changeTask(task)" ng-model="task.active" />
<i></i>
</label>
</td>
<td>
<button class="btn btn-sm white" ng-click="runTask(task)"><i class="material-icons">&#xE037;</i></button>
</td>
</tr>
<tr ng-repeat="task in all_tasks" ng-if="isTaskActive(task)">
<td>{{ task.name }} <span class="label primary m-r-xs left5">{{ task.code }}</span></td>
<td><input type="number" class="form-control" ng-model="task.period" ng-change="changePeriod(task)" /></td>
<td>
<label class="ui-switch ui-switch-md m-t-xs">
<input type="checkbox" ng-change="changeTask(task)" ng-model="task.active" />
<i></i>
</label>
</td>
<td>
<button class="btn btn-sm white" ng-click="runTask(task)"><i class="material-icons">&#xE037;</i></button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,118 @@
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h5 class="modal-title">Принтеры</h5>
</div>
<div class="modal-body p-lg">
<div class="col-sm-12">
<div class="b-b b-primary nav-active-primary">
<ul class="nav nav-tabs">
<li ng-repeat="printer in printers" class="nav-item">
<a class="nav-link" href="" data-toggle="tab" data-target="#p{{printer.id}}" aria-expanded="false">Принтер: {{printer.name}}</a>
</li>
</ul>
</div>
<div class="tab-content p-a m-b-md">
<div ng-repeat="printer in printers" class="tab-pane animated fadeIn text-muted" id="p{{printer.id}}" aria-expanded="false">
<div class="form-horizontal">
<div ng-if="objectHasProperty(printer, 'type')" class="form-group row">
<label class="col-sm-3 form-control-label">Тип</label>
<div class="col-sm-9">
<select name="size" class="form-control input-c" ng-model="printer.type" ng-options="type for type in settings.types"></select>
</div>
</div>
<div ng-if="objectHasProperty(printer, 'ip') && printer.type == 'LAN'" class="form-group row">
<label class="col-sm-3 form-control-label">IP</label>
<div class="col-sm-9">
<input ng-model="printer.ip" type="text" class="form-control">
</div>
</div>
<div ng-if="objectHasProperty(printer, 'port') && printer.type == 'LAN'" class="form-group row">
<label class="col-sm-3 form-control-label">Порт</label>
<div class="col-sm-9">
<input ng-model="printer.port" type="number" class="form-control">
</div>
</div>
<div ng-if="objectHasProperty(printer, 'com_port') && printer.type == 'COM'" class="form-group row">
<label for="" class="col-sm-3 form-control-label">COM Порт</label>
<div class="col-sm-9">
<select name="speed" class="form-control input-c" ng-model="printer.com_port" ng-options="com_port for com_port in settings.com_ports"></select>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 form-control-label">Бумага</label>
<div class="col-sm-9">
<select name="size" class="form-control input-c" ng-model="printer.size" ng-options="size for size in settings.sizes"></select>
</div>
</div>
<div ng-if="objectHasProperty(printer, 'speed') && printer.type == 'COM'" class="form-group row">
<label class="col-sm-3 form-control-label">Скорость</label>
<div class="col-sm-9">
<select name="speed" class="form-control input-c" ng-model="printer.speed" ng-options="speed for speed in settings.speeds"></select>
</div>
</div>
<div ng-if="objectHasProperty(printer, 'codepage')" class="form-group row">
<label for="" class="col-sm-3 form-control-label">Кодовая страница</label>
<div class="col-sm-9">
<select name="codepage" ng-model="printer.codepage" class="form-control input-c">
<option value="EPSON">EPSON</option>
<option value="WINCOR">WINCOR</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 form-control-label">Группа</label>
<div class="col-sm-9">
<select name="codepage" ng-model="printer.printer_group" class="form-control input-c">
<option ng-repeat="group in groups" value={{group.code}}>{{group.name}}</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 form-control-label">Шаблон</label>
<div class="col-sm-9">
<select name="template" ng-model="printer.template" class="form-control input-c">
<option value="Epson">Epson</option>
<option value="Posbank">Posbank</option>
<option value="Wincor">Wincor</option>
<option value="Spark">Spark</option>
</select>
</div>
</div>
<div ng-if="objectHasProperty(printer, 'driver') && printer.type == 'Windows'" class="form-group row">
<label class="col-sm-3 form-control-label">Драйвер</label>
<div class="col-sm-9">
<input ng-model="printer.driver" type="text" class="form-control">
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 form-control-label">Дополнительный текст</label>
<div class="col-sm-9">
<textarea class="form-control" ng-model="printer.more"></textarea>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<button class="btn btn-fw primary pull-right" ng-click="updateEquipment(printer)">Сохранить
изменения
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,74 @@
<div id="container-floating">
<div class="nd1 nds" data-toggle="tooltip" data-placement="left" title="Обновить" ng-click="update()" style="background-color: #d3a411"
onmouseenter="$(this).tooltip('show')">
<i class="material-icons">&#xE5D5;</i>
</div>
<div id="floating-button" data-toggle="tooltip" data-placement="left" title="Действия" onmouseenter="$(this).tooltip('show')">
<p class="plus">
<i class="material-icons">&#xE5D2;</i>
</p>
<p class="edit">
<i class="material-icons">&#xE5CD;</i>
</p>
</div>
</div>
<div class="padding">
<div class="box">
<!-- <div class="table-responsive"> -->
<table class="table table-striped m-a-0">
<thead>
<tr>
<th>ID</th>
<th>Тип</th>
<th>Код рабочей группы</th>
<th>Код рабочего места</th>
<th>Статус</th>
<th>Последняя активность</th>
<th style="width: 70px"><i class="material-icons">&#xE3E7;</i></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="terminal in terminals">
<td><strong>{{ terminal.key }}</strong></td>
<td><strong>{{ terminal.soft }}</strong></td>
<td>{{ terminal.work_group }}</td>
<td>{{ terminal.work_code }}</td>
<td>
<label class="ui-switch ui-switch-md m-t-xs">
<input type="checkbox" ng-model="terminal.is_active" ng-change="onLicence(terminal.key, terminal.is_active)">
<i></i>
</label>
</td>
<td><span ng-if="terminal.last_activity != '0'">{{ terminal.last_activity }}</span></td>
<td>
<div class="dropdown inline">
<button class="btn btn-sm white dropdown-toggle" data-toggle="dropdown">
<i class="material-icons">&#xE5D2;</i>
</button>
<div class="dropdown-menu pull-right dropdown-menu-scale">
<a class="dropdown-item" ng-click="editTerminal(terminal.key)">Управление синхронизацией</a>
<a class="dropdown-item" ng-click="getEquipment(terminal.key)">Принтеры</a>
<a class="dropdown-item" ng-click="showLogs(terminal.key)">Журнал</a>
</div>
</div>
</td>
</tr>
</tbody>
</table>
<!-- </div> -->
</div>
</div>
<div class="modal fade" id="edit-terminal" data-backdrop="true">
<div ui-include="'../views/terminals/edit.html'"></div>
</div>
<div class="modal fade" id="equipment" data-backdrop="true">
<div ui-include="'../views/terminals/equipment.html'"></div>
</div>
<div class="modal fade" id="logs" data-backdrop="true">
<div ui-include="'../views/terminals/logs.html'"></div>
</div>

View File

@@ -0,0 +1,27 @@
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h5 class="modal-title">Логи терминала</h5>
</div>
<div class="modal-body p-lg">
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th>Log</th>
<th>Time</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="log in terminalLogs">
<td>{{log.value}}</td>
<td>{{log.time}}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,35 @@
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h5 class="modal-title">Отчет по удалениям</h5>
</div>
<div class="modal-body p-lg">
<div class="table-responsive" ng-if="report_delete.length > 0">
<table class="table table-bordered m-a-" ng-repeat="report in report_delete">
<thead>
<th>Заказ #{{ report.order_code }}</th>
</thead>
<tbody>
<tr ng-repeat="item in report.items">
<td>
<h6>{{ item.dish_name }} <small>(<strong>{{ item.count }}</strong> на сумму <strong>{{ item.sum }} BYN</strong>)</small></h6>
<p>
Удалил: <strong>{{ item.who }}</strong><br/>
Подтвердил: <strong>{{ item.approved }}</strong><br/>
Причина: <strong>{{ item.reason }}</strong>
</p>
</td>
</tr>
</tbody>
</table>
</div>
<div ng-if="report_delete.length == 0">
<p>Удаления отсутствуют</p>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,27 @@
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Создание пользователя</h5>
</div>
<div class="modal-body text-center p-lg">
<form role="form" class="ng-pristine ng-valid container">
<div class="form-group row">
<div class="col-sm-12"><input class="form-control" id="new-login" placeholder="Логин" type="text" ng-model="newUser.login"></div>
</div>
<div class="form-group row">
<div class="col-sm-12"><input class="form-control" id="new-name" placeholder="Имя" type="text" ng-model="newUser.name"></div>
</div>
<div class="form-group row">
<div class="col-sm-12"><input class="form-control" id="new-password" placeholder="Пароль" type="password" ng-model="newUser.password"></div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn dark-white p-x-md" data-dismiss="modal">Отмена</button>
<button type="button" class="btn success p-x-md" ng-click="create()">Создать</button>
</div>
</div>
</div>

51
web/views/users/edit.html Normal file
View File

@@ -0,0 +1,51 @@
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Редактирование пользователя</h5>
</div>
<div class="modal-body p-lg">
<form role="form" class="ng-pristine ng-valid container">
<div class="form-group row">
<div class="col-sm-12"><input class="form-control" id="current-login" placeholder="Логин" type="text" ng-model="currentUser.login"></div>
</div>
<div class="form-group row">
<div class="col-sm-12"><input class="form-control" id="current-name" placeholder="Имя" type="text" ng-model="currentUser.name"></div>
</div>
<div class="form-group row">
<div class="col-sm-12"><input class="form-control" id="current-password" placeholder="Пароль" type="password" ng-model="currentUser.password"></div>
</div>
</form>
<hr />
<div class="table-responsive">
<table class="table table-bordered table-hover">
<thead>
<th>Право</th>
<th>Статус</th>
</thead>
<tbody>
<tr ng-repeat="right in currentUser.rights">
<td>{{ right.name }}</td>
<td style="width: 90px">
<label class="ui-switch ui-switch-md m-t-xs">
<input type="checkbox" ng-model="right.is_active" ng-change="onRight(right.code)">
<i></i>
</label>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn danger p-x-md pull-left" data-toggle="modal" data-target="#edit-user-confirm-delete"><i class="material-icons">&#xE872;</i></button>
<button type="button" class="btn dark-white p-x-md" data-dismiss="modal">Отмена</button>
<button type="button" class="btn success p-x-md" ng-click="save()">Сохранить</button>
</div>
</div>
</div>

View File

@@ -0,0 +1,58 @@
<div id="container-floating">
<div class="nd3 nds" data-toggle="tooltip" data-placement="left" title="Создать" ng-click="add()" style="background-color: #3c80f6" onmouseenter="$(this).tooltip('show')">
<i class="material-icons">&#xE145;</i>
</div>
<div class="nd1 nds" data-toggle="tooltip" data-placement="left" title="Обновить" ng-click="update()" style="background-color: #d3a411" onmouseenter="$(this).tooltip('show')">
<i class="material-icons">&#xE5D5;</i>
</div>
<div id="floating-button" data-toggle="tooltip" data-placement="left" title="Действия" onmouseenter="$(this).tooltip('show')">
<p class="plus"><i class="material-icons">&#xE5D2;</i></p>
<p class="edit"><i class="material-icons">&#xE5CD;</i></p>
</div>
</div>
<div class="padding">
<div class="box">
<div class="table-responsive">
<table class="table table-bordered m-a-0 table-hover">
<thead>
<tr>
<th>ID</th>
<th>Логин</th>
<th>Имя</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="user in users" ng-click="edit(user)">
<td>{{ user.id }}</td>
<td>{{ user.login }}</td>
<td>{{ user.name }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="modal fade" id="edit-user" data-backdrop="true">
<div ui-include="'../views/users/edit.html'"></div>
</div>
<div class="modal fade" id="new-user" data-backdrop="true">
<div ui-include="'../views/users/create.html'"></div>
</div>
<div id="edit-user-confirm-delete" class="modal confirm-box" data-backdrop="true" style="z-index: 1052">
<div class="bottom white b-b" style="height: 90px">
<div class="confirm-box-body p-lg">
<p>Вы действительно хотите удалить пользователя?</p>
</div>
<div class="confirm-box-footer">
<button type="button" class="btn dark-white p-x-md" data-dismiss="modal">Нет</button>
<button type="button" class="btn danger p-x-md" ng-click="delete()">Да</button>
</div>
</div>
</div>

33
web/views/users/logs.html Normal file
View File

@@ -0,0 +1,33 @@
<div class="padding">
<div class="box">
<div class="table-responsive">
<table class="table table-bordered m-a-0">
<thead>
<tr>
<th>Log ID</th>
<th>User</th>
<th>Module</th>
<th>Action type</th>
<th>Action</th>
<th>Old value</th>
<th>New value</th>
<th>Время</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="log in logs">
<td>{{log.id}}</td>
<td>{{log.user}}</td>
<td>{{log.module}}</td>
<td>{{log.action_type}}</td>
<td>{{log.action}}</td>
<td>{{log.old_value}}</td>
<td>{{log.new_value}}</td>
<td>{{log.time}}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>