v.2.30
Small fix
This commit is contained in:
@@ -2099,7 +2099,7 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface
|
||||
}
|
||||
}
|
||||
|
||||
if ($reportType == "report_construct") {
|
||||
if ($reportType == 'report_construct') {
|
||||
$code = Filesystem::GetCode($input['token']);
|
||||
$cache = Cache::get($code, 'shift', $input);
|
||||
if ($cache) {
|
||||
@@ -2413,6 +2413,30 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface
|
||||
return $cache;
|
||||
}
|
||||
}
|
||||
|
||||
if ($reportType == 'presales') {
|
||||
$code = Filesystem::GetCode($input['token']);
|
||||
$cache = Cache::get($code, 'shift', $input);
|
||||
if ($cache) {
|
||||
return $cache;
|
||||
}
|
||||
if (isset($input['shift_id'])) {
|
||||
|
||||
}
|
||||
if (isset($input['start_date']) && isset($input['end_date'])) {
|
||||
$end_date = date('Y-m-d H:i:s', strtotime($input['end_date'] . ' 23:59:59'));
|
||||
$start_date = date('Y-m-d H:i:s', strtotime($input['start_date'] . ' 00:00:01'));
|
||||
$shifts = ExchangeShifts::select('id', 'opened', 'closed')
|
||||
->where('opened', '>', $start_date)
|
||||
->where('closed', '<', $end_date)
|
||||
->get();
|
||||
$collection = new Collection();
|
||||
foreach ($shifts as $shift) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
return [
|
||||
'status' => 'success',
|
||||
|
||||
216
web/controllers/jointjs.js
Normal file
216
web/controllers/jointjs.js
Normal file
@@ -0,0 +1,216 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
angular
|
||||
.module('app', ['angular.drag.resize', 'ng-context-menu'])
|
||||
.controller('JointCtrl', JointCtrl);
|
||||
|
||||
JointCtrl.$inject = ['$scope', 'smartRequest', 'Notification', '$http'];
|
||||
|
||||
function JointCtrl($scope, smartRequest, Notification) {
|
||||
document.getElementById('aside').remove();
|
||||
document.getElementById("view").style.display = "flex";
|
||||
document.getElementById("view").style.justifyContent = "center";
|
||||
document.getElementById("view").style.alignItems = "center";
|
||||
//$scope.percentWidth = document.getElementById('tables').clientWidth / 1024;
|
||||
//$scope.percentHeight = document.getElementById('tables').clientHeight / 768;
|
||||
$scope.percentWidth = document.getElementById('tables').offsetWidth / 1024;
|
||||
$scope.percentHeight = document.getElementById('tables').offsetHeight / 768;
|
||||
console.log(document.getElementById('tables').offsetWidth / 1024);
|
||||
console.log(document.getElementById('tables').offsetHeight / 768);
|
||||
|
||||
const { dia, shapes, highlighters } = joint;
|
||||
|
||||
// Paper
|
||||
|
||||
const paperContainer = document.getElementById("paper-container");
|
||||
|
||||
const graph = new dia.Graph({}, { cellNamespace: shapes });
|
||||
const paper = new dia.Paper({
|
||||
model: graph,
|
||||
cellViewNamespace: shapes,
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
gridSize: 5,
|
||||
async: true,
|
||||
frozen: true,
|
||||
sorting: dia.Paper.sorting.APPROX,
|
||||
background: { color: "#F3F7F6" },
|
||||
clickThreshold: 10,
|
||||
defaultConnector: {
|
||||
name: "rounded"
|
||||
},
|
||||
defaultRouter: {
|
||||
name: "manhattan",
|
||||
args: {
|
||||
step: 5,
|
||||
endDirections: ["bottom"],
|
||||
startDirections: ["top"],
|
||||
padding: { bottom: 30 }
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
paperContainer.appendChild(paper.el);
|
||||
const ResizeTool = joint.elementTools.Control.extend({
|
||||
getPosition: function (view) {
|
||||
const model = view.model;
|
||||
const { width, height } = model.size();
|
||||
return { x: width, y: height };
|
||||
},
|
||||
setPosition: function (view, coordinates) {
|
||||
const model = view.model;
|
||||
model.resize(Math.max(coordinates.x, 40), Math.max(coordinates.y, 40));
|
||||
}
|
||||
});
|
||||
const toolsView = new joint.dia.ToolsView({
|
||||
tools: [
|
||||
new ResizeTool({
|
||||
selector: "body",
|
||||
handleAttributes: {
|
||||
fill: "#4666E5"
|
||||
}
|
||||
})
|
||||
]
|
||||
});
|
||||
const color = "#ff4468";
|
||||
|
||||
paper.svg.prepend(
|
||||
V.createSVGStyle(`
|
||||
.joint-element .selection {
|
||||
stroke: ${color};
|
||||
}
|
||||
.joint-link .selection {
|
||||
stroke: ${color};
|
||||
stroke-dasharray: 5;
|
||||
stroke-dashoffset: 10;
|
||||
animation: dash 0.5s infinite linear;
|
||||
}
|
||||
@keyframes dash {
|
||||
to {
|
||||
stroke-dashoffset: 0;
|
||||
}
|
||||
}
|
||||
`)
|
||||
);
|
||||
|
||||
function element(w, h, x, y, table_id) {
|
||||
const el = new shapes.standard.Rectangle({
|
||||
position: { x, y},
|
||||
size: { width: w * $scope.percentWidth, height: h * $scope.percentHeight},
|
||||
attrs: {
|
||||
label: {
|
||||
text: `СТОЛ ${table_id}`,
|
||||
fontFamily: "sans-serif",
|
||||
fontSize: "60%"
|
||||
}
|
||||
},
|
||||
z: 2
|
||||
});
|
||||
graph.addCell(el);
|
||||
return el;
|
||||
}
|
||||
|
||||
function elementC(x, y) {
|
||||
const el = new shapes.standard.Circle({
|
||||
position: { x, y },
|
||||
size: { width: 50, height: 50 },
|
||||
attrs: {
|
||||
label: {
|
||||
text: `ℹ️`,
|
||||
fontFamily: "sans-serif"
|
||||
}
|
||||
},
|
||||
z: 2
|
||||
});
|
||||
graph.addCell(el);
|
||||
return el;
|
||||
}
|
||||
|
||||
function link(target, source) {
|
||||
const l = new shapes.standard.Link({
|
||||
source: { id: source.id },
|
||||
target: { id: target.id },
|
||||
z: 1
|
||||
});
|
||||
graph.addCell(l);
|
||||
return l;
|
||||
}
|
||||
smartRequest.get('v1/roommap?method=map&type=place&id=2', function (data) {
|
||||
$scope.place = data.place;
|
||||
$scope.place_id = data.place_id;
|
||||
$scope.tables = data.tables;
|
||||
console.log($scope.tables);
|
||||
$scope.tables.forEach(function (el) {
|
||||
element(el.width, el.height, el.y * $scope.percentWidth, el.x * $scope.percentHeight, el.table_id);
|
||||
});
|
||||
});
|
||||
|
||||
//const el1 = element(470 * $scope.percentWidth, 235 * $scope.percentHeight, 470 * $scope.percentHeight, 150 * $scope.percentWidth);
|
||||
|
||||
/* link(el1, el4);
|
||||
link(el2, el4);
|
||||
link(el3, el5);
|
||||
link(el4, el5);
|
||||
link(el6, el1);
|
||||
link(el6, el2);*/
|
||||
paper.unfreeze();
|
||||
|
||||
function getElementPredecessorLinks(el) {
|
||||
return graph
|
||||
.getSubgraph([el, ...graph.getPredecessors(el)])
|
||||
.filter((cell) => cell.isLink());
|
||||
}
|
||||
|
||||
function highlightCell(cell) {
|
||||
highlighters.addClass.add(
|
||||
cell.findView(paper),
|
||||
cell.isElement() ? "body" : "line",
|
||||
"selection",
|
||||
{ className: "selection" }
|
||||
);
|
||||
}
|
||||
|
||||
function unhighlightCell(cell) {
|
||||
highlighters.addClass.remove(
|
||||
cell.findView(paper).removeTools(toolsView),
|
||||
"selection"
|
||||
);
|
||||
}
|
||||
|
||||
let selection = null;
|
||||
|
||||
function selectElement(el) {
|
||||
if (selection === el) return;
|
||||
if (selection) {
|
||||
unhighlightCell(selection);
|
||||
graph.getLinks().forEach((link) => unhighlightCell(link));
|
||||
}
|
||||
if (el) {
|
||||
highlightCell(el);
|
||||
getElementPredecessorLinks(el).forEach((link) => highlightCell(link));
|
||||
selection = el;
|
||||
selection.findView(paper).addTools(
|
||||
new joint.dia.ToolsView({
|
||||
tools: [
|
||||
new ResizeTool({
|
||||
selector: "body",
|
||||
handleAttributes: {
|
||||
fill: "#4666E5"
|
||||
}
|
||||
})
|
||||
]
|
||||
})
|
||||
);
|
||||
} else {
|
||||
selection = null;
|
||||
}
|
||||
}
|
||||
|
||||
paper.on("element:pointerclick", (elementView) =>
|
||||
selectElement(elementView.model)
|
||||
);
|
||||
paper.on("blank:pointerclick", (elementView) => selectElement(null));
|
||||
/*selectElement(el2);*/
|
||||
|
||||
}
|
||||
})();
|
||||
@@ -20,7 +20,10 @@
|
||||
$('#save_tables').hide();
|
||||
$('#save_places').hide();
|
||||
$('#back').hide();
|
||||
|
||||
document.getElementById('aside').remove();
|
||||
document.getElementById("view").style.display = "flex";
|
||||
document.getElementById("view").style.justifyContent = "center";
|
||||
document.getElementById("view").style.alignItems = "center";
|
||||
|
||||
$scope.getRoomMap = function () {
|
||||
smartRequest.get('v1/roommap?method=map&type=full', function (data) {
|
||||
|
||||
@@ -20,6 +20,13 @@ item: [
|
||||
icon: 'dashboard',
|
||||
order: 0
|
||||
},
|
||||
{
|
||||
name: 'JointJS (dev)',
|
||||
acl: 'jointjs',
|
||||
url: 'app.jointjs',
|
||||
icon: 'dashboard',
|
||||
order: 0
|
||||
},
|
||||
{
|
||||
name: 'Монитор активности',
|
||||
acl: 'activitymonitor',
|
||||
|
||||
@@ -38,6 +38,14 @@
|
||||
controller: 'RoommapCtrl',
|
||||
resolve: ['scripts/controllers/roommap.js']
|
||||
},
|
||||
{
|
||||
code: 'app.jointjs',
|
||||
url: '/v1/jointjs',
|
||||
templateUrl: '../views/jointjs/index.html',
|
||||
data: { title : 'JointJs' },
|
||||
controller: 'JointCtrl',
|
||||
resolve: ['scripts/controllers/jointjs.js']
|
||||
},
|
||||
{
|
||||
code: 'app.loyalty',
|
||||
url: '/v1/loyalty',
|
||||
|
||||
5
web/views/jointjs/index.html
Normal file
5
web/views/jointjs/index.html
Normal file
@@ -0,0 +1,5 @@
|
||||
<div id="tables" class="box" style="width: 95vw;
|
||||
height: 80vh;
|
||||
margin: 1.5rem;">
|
||||
<div id="paper-container"></div>
|
||||
</div>
|
||||
35
web/views/jointjs/items/create-place.html
Normal file
35
web/views/jointjs/items/create-place.html
Normal file
@@ -0,0 +1,35 @@
|
||||
<div class="modal-dialog" id="animate" ui-class="fade-down-big">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Создание зала</h5>
|
||||
</div>
|
||||
<div class="modal-body text-center p-lg">
|
||||
<div class="box">
|
||||
<div class="box-divider m-0"></div>
|
||||
<div class="box-body">
|
||||
<form role="form">
|
||||
<div class="form-group row">
|
||||
<label for="inputName" class="col-sm-2 form-control-label">Имя</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id="inputName"
|
||||
ng-model="placeName"
|
||||
placeholder="{{placeName}}"/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn dark-white p-x-md" data-dismiss="modal">Отмена</button>
|
||||
<button type="button" class="btn danger p-x-md" data-dismiss="modal"
|
||||
ng-click="savePlace(placeName)">Сохранить
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div><!-- /.modal-content -->
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript" src="/libs/js/moment/locale/ru.js"></script>
|
||||
51
web/views/jointjs/items/create-table.html
Normal file
51
web/views/jointjs/items/create-table.html
Normal file
@@ -0,0 +1,51 @@
|
||||
<div class="modal-dialog" id="animate" ui-class="fade-down-big">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Добавление стола</h5>
|
||||
</div>
|
||||
<div class="modal-body text-center p-lg">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<small>Высота и ширина стола должны быть не меньше 80px.</small>
|
||||
</div>
|
||||
<div class="box-divider m-0"></div>
|
||||
<div class="box-body">
|
||||
<form role="form">
|
||||
<div class="form-group row">
|
||||
<label for="inputName" class="col-sm-2 form-control-label">Имя</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control"
|
||||
ng-model="editPlaceTableId"
|
||||
placeholder="{{editPlaceTableId}}" hidden/>
|
||||
<input type="text" class="form-control" id="inputName"
|
||||
ng-model="tableName"
|
||||
placeholder="{{tableName}}"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="inputType" class="col-sm-2 form-control-label">Вид стола</label>
|
||||
<div class="col-sm-10">
|
||||
<select id="inputType" class="form-control c-select" ng-model="tableType">
|
||||
<option value="0">Прямоугольный</option>
|
||||
<option value="1">Круглый</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn dark-white p-x-md" data-dismiss="modal">Отмена</button>
|
||||
<button type="button" class="btn danger p-x-md" data-dismiss="modal"
|
||||
ng-click="saveNewTable(editPlaceTableId, tableName, tableType)">Сохранить
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div><!-- /.modal-content -->
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript" src="/libs/js/moment/locale/ru.js"></script>
|
||||
38
web/views/jointjs/items/edit-place.html
Normal file
38
web/views/jointjs/items/edit-place.html
Normal file
@@ -0,0 +1,38 @@
|
||||
<div class="modal-dialog" id="animate" ui-class="fade-down-big">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Редактирование зала</h5>
|
||||
</div>
|
||||
<div class="modal-body text-center p-lg">
|
||||
<div class="box">
|
||||
<div class="box-divider m-0"></div>
|
||||
<div class="box-body">
|
||||
<form role="form">
|
||||
<div class="form-group row">
|
||||
<label for="inputName" class="col-sm-2 form-control-label">Имя</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id="inputId"
|
||||
ng-model="editPlaceId"
|
||||
placeholder="{{editPlaceId}}" hidden/>
|
||||
<input type="text" class="form-control" id="inputName"
|
||||
ng-model="editPlaceName"
|
||||
placeholder="{{editPlaceName}}"/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn dark-white p-x-md" data-dismiss="modal">Отмена</button>
|
||||
<button type="button" class="btn danger p-x-md" data-dismiss="modal"
|
||||
ng-click="updatePlace(editPlaceId,editPlaceName)">Сохранить
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div><!-- /.modal-content -->
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript" src="/libs/js/moment/locale/ru.js"></script>
|
||||
70
web/views/jointjs/items/edit-table.html
Normal file
70
web/views/jointjs/items/edit-table.html
Normal file
@@ -0,0 +1,70 @@
|
||||
<div class="modal-dialog" id="animate" ui-class="fade-down-big">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Редактирование стола</h5>
|
||||
</div>
|
||||
<div class="modal-body text-center p-lg">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<small>Номер стола должен отличаться от существующих.</small>
|
||||
<small>Высота и ширина стола должны быть не меньше 80px.</small>
|
||||
</div>
|
||||
<div class="box-divider m-0"></div>
|
||||
<div class="box-body">
|
||||
<form role="form">
|
||||
<div class="form-group row">
|
||||
<label for="inputNumber" class="col-sm-2 form-control-label">Номер</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id="inputNumber" placeholder="{{tableId}}"
|
||||
ng-model="tableId"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="inputName" class="col-sm-2 form-control-label">Имя</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id="inputName"
|
||||
ng-model="tableName"
|
||||
placeholder="{{tableName}}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="inputWidth" class="col-sm-2 form-control-label">Ширина</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id="inputWidth" placeholder="{{tableWidth}}"
|
||||
ng-model="tableWidth"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="inputHeight" class="col-sm-2 form-control-label">Высота</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id="inputHeight" placeholder="{{tableHeight}}"
|
||||
ng-model="tableHeight"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="inputType" class="col-sm-2 form-control-label">Вид стола</label>
|
||||
<div class="col-sm-10">
|
||||
<select id="inputType" class="form-control c-select" ng-model="tableType">
|
||||
<option value="0">Прямоугольный</option>
|
||||
<option value="1">Круглый</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn dark-white p-x-md" data-dismiss="modal">Отмена</button>
|
||||
<button type="button" class="btn danger p-x-md" data-dismiss="modal"
|
||||
ng-click="saveTable(tableIndex, tableId, tableName, tableWidth, tableHeight, tableType)">Сохранить
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div><!-- /.modal-content -->
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript" src="/libs/js/moment/locale/ru.js"></script>
|
||||
@@ -35,7 +35,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="padding" id="places">
|
||||
<div class="padding" id="places" style="width: 100vw;">
|
||||
<div class="box">
|
||||
<div class="padding">
|
||||
<h4>Список залов
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
<hr/>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered m-a-0">
|
||||
<table class="table table-responsive table-bordered m-a-0">
|
||||
<thead>
|
||||
<th ng-repeat="place in roommap">
|
||||
<button type="button" class="btn info btn-block" sglclick="getTables(place.place_id)"
|
||||
@@ -78,7 +78,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="padding" id="background_1" ng-style="{'max-width':(maxWidth) + 'px', 'width':(screenWidth) + 'vw'}">
|
||||
<div class="padding" id="background_1" ng-style="{'width':(100) + 'vw'}"><!--'max-width':(maxWidth) + 'px', -->
|
||||
<div class="box">
|
||||
<div class="padding" id="background">
|
||||
<!--<div id="tables" class="box" ng-style="{'height':(windowHeight) + 'px'}">-->
|
||||
@@ -96,18 +96,16 @@
|
||||
</div>
|
||||
<div ng-repeat="table in tables" ng-model="tables" context-menu>
|
||||
|
||||
<div ng-if="table.type == 0" id="{{ 'table_' + $index }}" class="demo-div" draggable resize
|
||||
<button ng-if="table.type == 0" id="{{ 'table_' + $index }}" class="demo-div md-btn white" draggable resize
|
||||
context-menu
|
||||
data-target="table-{{ $index }}"
|
||||
ng-mouseup="getCoords($event, $index, table.table_id, table.place_id)"
|
||||
ng-style="{'width':'' + table.width * percentWidth + 'px', 'height':'' + table.height * percentHeight + 'px', 'top':'calc(' + top + 'px + ' + table.x * percentHeight + 'px)', 'left': 'calc(' + left + 'px + ' + table.y * percentWidth + 'px)'}"
|
||||
style="position: fixed;cursor: default;font-family: sans-serif;text-align: center;background-color: #FFFFFF;border: 2px solid #2196f3; z-index: 1; border-radius: 5%">
|
||||
<div class="box-header">
|
||||
<small>{{table.name}}</small>
|
||||
<small>{{table.table_id}}</small>
|
||||
</div>
|
||||
<small style="font-size: 70%">{{table.name}}</small>
|
||||
<small style="font-size: 70%">{{table.table_id}}</small>
|
||||
|
||||
</div>
|
||||
</button>
|
||||
|
||||
<div ng-if="table.type == 1" id="{{ 'table_' + $index }}" class="demo-div" draggable resize
|
||||
context-menu
|
||||
@@ -119,8 +117,8 @@
|
||||
ng-style="{'width':'' + table.width * percentWidth + 'px', 'height':'' + table.height * percentHeight + 'px'}"
|
||||
style="background: transparent; box-shadow: 0 0px 0px transparent;">
|
||||
<div class="box-header">
|
||||
<small>{{table.name}}</small>
|
||||
<small>{{table.table_id}}</small>
|
||||
<small style="font-size: 70%">{{table.name}}</small>
|
||||
<small style="font-size: 70%">{{table.table_id}}</small>
|
||||
</div>
|
||||
<div class="box-footer"></div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user