v.2.30
Добавлен расширенный отчет по реализации Добавлен монитор активности
This commit is contained in:
210
web/controllers/activitymonitor.js
Normal file
210
web/controllers/activitymonitor.js
Normal file
@@ -0,0 +1,210 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
angular
|
||||
.module('app', ['angular.drag.resize', 'ng-context-menu', 'ui.bootstrap', 'ui.utils'])
|
||||
.controller('ActivityMonitorCtrl', ActivityMonitorCtrl);
|
||||
|
||||
ActivityMonitorCtrl.$inject = ['$scope', 'smartRequest', 'Notification'];
|
||||
|
||||
function ActivityMonitorCtrl($scope, smartRequest, Notification) {
|
||||
Element.prototype.remove = function () {
|
||||
this.parentElement.removeChild(this);
|
||||
}
|
||||
NodeList.prototype.remove = HTMLCollection.prototype.remove = function () {
|
||||
for (var i = this.length - 1; i >= 0; i--) {
|
||||
if (this[i] && this[i].parentElement) {
|
||||
this[i].parentElement.removeChild(this[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$scope.dataTablesOpt = {
|
||||
language: {
|
||||
url: "https://cdn.datatables.net/plug-ins/1.13.3/i18n/ru.json",
|
||||
},
|
||||
autoWidth: false,
|
||||
searching: true,
|
||||
paging: false,
|
||||
info: false,
|
||||
};
|
||||
|
||||
$scope.places = [];
|
||||
$scope.tables = [];
|
||||
$scope.newTables = [];
|
||||
$scope.newTables2 = [];
|
||||
$scope.roommap = [];
|
||||
$scope.newElement = 0;
|
||||
$scope.firstPlace = 1;
|
||||
$('#create_table').hide();
|
||||
$('#create_place').hide();
|
||||
$('#places').hide();
|
||||
$('#background').hide();
|
||||
$('#background_1').hide();
|
||||
$('#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) {
|
||||
$('#back').show();
|
||||
$scope.roommap = data.roommap;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.back = function () {
|
||||
location.reload();
|
||||
};
|
||||
|
||||
|
||||
$scope.getPlaces = function () {
|
||||
smartRequest.get('v1/roommap?method=map&type=places', function (data) {
|
||||
$scope.places = data.places;
|
||||
console.log($scope.places);
|
||||
});
|
||||
|
||||
smartRequest.get('v1/roommap?method=statistic&type=places', function (places_info) {
|
||||
$scope.places_ooc = places_info.opened_orders_count;
|
||||
$scope.places_oos = places_info.opened_orders_sum;
|
||||
$scope.places_oocc = places_info.opened_orders_client_count;
|
||||
$scope.places_coc = places_info.closed_orders_count;
|
||||
$scope.places_cos = places_info.closed_orders_sum;
|
||||
$scope.places_cocc = places_info.closed_orders_client_count;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.getTables = function (place_id) {
|
||||
|
||||
$('#places').hide();
|
||||
$('#background').show();
|
||||
$('#background_1').show();
|
||||
$('#create_table').show();
|
||||
$('#back').show();
|
||||
$scope.maxWidth = 1024;
|
||||
$scope.windowHeight = 65;
|
||||
$scope.screenHeight = screen.height;
|
||||
$scope.windowWidth = window.innerWidth;
|
||||
$scope.screenWidth = 80;
|
||||
|
||||
smartRequest.get('v1/roommap?method=map&type=place&id=' + place_id, function (data) {
|
||||
$scope.place = data.place;
|
||||
$scope.place_id = data.place_id;
|
||||
$scope.left = 0;
|
||||
$scope.top = 0;
|
||||
$scope.tables = data.tables;
|
||||
$scope.percentWidth = document.getElementById('tables').clientWidth / 1024;
|
||||
$scope.percentHeight = document.getElementById('tables').clientHeight / 768;
|
||||
});
|
||||
smartRequest.get('v1/roommap?method=statistic&type=place&place_id=' + place_id, function (place_info) {
|
||||
$scope.place_ooc = place_info.opened_orders_count;
|
||||
$scope.place_oos = place_info.opened_orders_sum;
|
||||
$scope.place_oocc = place_info.opened_orders_client_count;
|
||||
$scope.place_coc = place_info.closed_orders_count;
|
||||
$scope.place_cos = place_info.closed_orders_sum;
|
||||
$scope.place_cocc = place_info.closed_orders_client_count;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.getTables($scope.firstPlace);
|
||||
$scope.getPlaces();
|
||||
|
||||
$scope.getTableInfo = function (place_id, table_id) {
|
||||
smartRequest.get('v1/roommap?method=statistic&type=place&place_id=' + place_id + '&table_id=' + table_id, function (data) {
|
||||
$scope.place_name = data.place_name;
|
||||
$scope.place_id = place_id;
|
||||
$scope.waited_count = data.waited_count;
|
||||
$scope.waited_sum = data.waited_sum;
|
||||
$scope.closed_count = data.closed_count;
|
||||
$scope.closed_sum = data.closed_sum;
|
||||
$scope.deleted_count = data.deleted_count;
|
||||
$scope.deleted_sum = data.deleted_sum;
|
||||
$scope.returned_count = data.returned_count;
|
||||
$scope.returned_sum = data.returned_sum;
|
||||
$scope.cancellations_count = data.cancellations_count;
|
||||
$scope.cancellations_sum = data.cancellations_sum;
|
||||
$scope.orders = data.orders;
|
||||
$scope.orders.forEach(function(order) {
|
||||
$scope.title = '';
|
||||
if (order.is_printed_before_edit) {
|
||||
$scope.title = $scope.title + '➖ Распечатан предчек до удаления позиции!<br>';
|
||||
}
|
||||
if (order.hasMove) {
|
||||
$scope.title = $scope.title + '➖ Использовался перенос заказа!<br>';
|
||||
}
|
||||
if (order.hasMerge) {
|
||||
$scope.title = $scope.title + '➖ Использовалось объединение заказов!<br>';
|
||||
}
|
||||
if (order.hasSlice) {
|
||||
$scope.title = $scope.title + '➖ Использовалось разбиение заказа!<br>';
|
||||
}
|
||||
if (order.hasDelete) {
|
||||
$scope.title = $scope.title + '➖ Присутствует удаление товаров!<br>';
|
||||
}
|
||||
order.title = $scope.title;
|
||||
});
|
||||
|
||||
if ($scope.waited_count + $scope.closed_count + $scope.deleted_count + $scope.returned_count + $scope.cancellations_count > 0) {
|
||||
$('#orders').modal();
|
||||
$(function () {
|
||||
$('[data-toggle="tooltip"]').tooltip({ html:true });
|
||||
});
|
||||
} else {
|
||||
Notification.error('Заказы отсутствуют');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
$scope.getOrderInfo = function (order_id, opened, closed) {
|
||||
$scope.clients_modal = false;
|
||||
$scope.orders_modal = true;
|
||||
smartRequest.get('v1/orderhistory?order_id=' + order_id, function (actions) {
|
||||
$scope.actions = actions;
|
||||
});
|
||||
smartRequest.get('v1/orderinfo?order_id=' + order_id + '&opened=' + opened + '&closed=' + closed, function (data) {
|
||||
$scope.order = data.info;
|
||||
$scope.cols = 5;
|
||||
if ($scope.order.returned_count > 0) {
|
||||
$scope.cols = $scope.cols + 1;
|
||||
}
|
||||
if ($scope.order.deleted_count > 0) {
|
||||
$scope.cols = $scope.cols + 1;
|
||||
}
|
||||
$scope.backModal('orders', 'order');
|
||||
});
|
||||
};
|
||||
|
||||
$scope.closeModal = function (modalName) {
|
||||
$scope.modalName = '#' + modalName;
|
||||
$('.modal-body').scrollTop(0);
|
||||
$($scope.modalName).modal('dispose');
|
||||
return true;
|
||||
};
|
||||
|
||||
$scope.backModal = function (prevModalName, targetModalName) {
|
||||
$scope.prevModalName = '#' + prevModalName;
|
||||
$scope.targetModalName = '#' + targetModalName;
|
||||
$('.modal-body').scrollTop(0);
|
||||
$($scope.prevModalName).modal('hide');
|
||||
$($scope.targetModalName).modal('toggle');
|
||||
return true;
|
||||
};
|
||||
|
||||
$scope.borderStyle = function (sum, count) {
|
||||
let style = '2px solid rgb(33, 150, 243)';
|
||||
if (sum != 0 && count != 0) {
|
||||
style = '2px solid rgb(255, 0, 0)';
|
||||
}
|
||||
if (sum == 0 && count != 0) {
|
||||
style = '2px solid rgb(0, 255, 0)';
|
||||
}
|
||||
return style;
|
||||
};
|
||||
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user