v.2.11
-Force update button on dashboard
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Dishes;
|
||||
use App\Component\Models\OnlineItems;
|
||||
use App\Component\Models\Terminal;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
@@ -11,7 +12,12 @@ class TopDishes extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'gettopdishes';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
|
||||
$terminal = Terminal::where('soft', '=', 1)->where('is_active', '=', 1)->first();
|
||||
if ($terminal) {
|
||||
$terminalKey = $terminal['key'];
|
||||
} else {
|
||||
$terminalKey = 0;
|
||||
}
|
||||
$info = OnlineItems::where('menu_code', '>', 0)->get()->unique('menu_code');
|
||||
$count = OnlineItems::where('menu_code', '>', 0)->count();
|
||||
if ($count > 0) {
|
||||
@@ -58,7 +64,7 @@ class TopDishes extends HRCCommand implements HRCCommandInterface {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'dishes' => $sorted,
|
||||
// 'info' => $info,
|
||||
'terminal' => $terminalKey,
|
||||
// 'test' => $dishes,
|
||||
// 'count' => $dishCount,
|
||||
];
|
||||
@@ -66,7 +72,7 @@ class TopDishes extends HRCCommand implements HRCCommandInterface {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'dishes' => [],
|
||||
// 'info' => $info,
|
||||
'terminal' => $terminalKey,
|
||||
// 'test' => $dishes,
|
||||
// 'count' => $dishCount,
|
||||
];
|
||||
|
||||
@@ -277,6 +277,179 @@
|
||||
});
|
||||
};
|
||||
|
||||
$scope.updateData = function () {
|
||||
smartRequest.get('dashboard/online/updatetime', function (data) {
|
||||
$scope.update_time = data.updated;
|
||||
});
|
||||
|
||||
smartRequest.get('dashboard/online/updatetime', function (data) {
|
||||
$scope.update_time = data.updated;
|
||||
});
|
||||
|
||||
smartRequest.get('dashboard/online/info', function (data) {
|
||||
$scope.shiftInfo = data;
|
||||
});
|
||||
|
||||
smartRequest.get('dashboard/online/payments', function (data) {
|
||||
$scope.payments.labels = data.payments.map(payment => payment.name);
|
||||
$scope.payments.data = data.payments.map(payment => payment.value);
|
||||
});
|
||||
|
||||
smartRequest.get('dashboard/online/orders', function (data) {
|
||||
var total = data.wait_count + data.closed_count + data.deleted_count + data.returned_count;
|
||||
|
||||
$scope.orders_closed.percent = $scope.calcPercentageForGroupOrders(total, data.closed_count);
|
||||
$scope.orders_closed.total = data.closed_count;
|
||||
$scope.orders_closed.sum = data.closed_sum;
|
||||
|
||||
$scope.orders_waited.percent = $scope.calcPercentageForGroupOrders(total, data.wait_count);
|
||||
$scope.orders_waited.total = data.wait_count;
|
||||
$scope.orders_waited.sum = data.wait_sum;
|
||||
|
||||
$scope.orders_deleted.percent = $scope.calcPercentageForGroupOrders(total, data.deleted_count);
|
||||
$scope.orders_deleted.total = data.deleted_count;
|
||||
$scope.orders_deleted.sum = data.deleted_sum;
|
||||
|
||||
$scope.orders_returned.percent = $scope.calcPercentageForGroupOrders(total, data.returned_count);
|
||||
$scope.orders_returned.total = data.returned_count;
|
||||
$scope.orders_returned.sum = data.returned_sum;
|
||||
});
|
||||
|
||||
smartRequest.get('dashboard/online/middle', function (data) {
|
||||
$scope.middle = data.middle_check;
|
||||
});
|
||||
|
||||
smartRequest.get('dashboard/online/total', function (data) {
|
||||
$scope.total = data.total;
|
||||
});
|
||||
|
||||
smartRequest.get('dashboard/online/staff', function (data) {
|
||||
$scope.personals = data.staff;
|
||||
});
|
||||
|
||||
smartRequest.get('v1/topdishes', function (data) {
|
||||
$scope.dishes = data.dishes;
|
||||
$scope.terminalId = data.terminal;
|
||||
if ($scope.terminalId > 0) {
|
||||
smartRequest.post('settings/update/force', {
|
||||
task: 'online',
|
||||
terminal: $scope.terminalId,
|
||||
}, function(data) {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
smartRequest.get('dashboard/online/folders', function (data) {
|
||||
$scope.folders.labels = data.folders.map(folder => folder.name);
|
||||
$scope.folders.data = data.folders.map(folder => Math.roundClearNG(folder.count));
|
||||
});
|
||||
|
||||
smartRequest.get('dashboard/online/printers', function (data) {
|
||||
$scope.printers.labels = [];
|
||||
$scope.printers.data = [];
|
||||
|
||||
for (var i = 0; i < data.printers.length; i++) {
|
||||
$scope.printers.labels.push(data.printers[i].name);
|
||||
$scope.printers.data.push(Math.roundClearNG(data.printers[i].count, -2));
|
||||
}
|
||||
});
|
||||
|
||||
smartRequest.get('dashboard/online/tables', function (data) {
|
||||
$scope.tables = data.tables;
|
||||
});
|
||||
|
||||
smartRequest.get('dashboard/online/menu', function (data) {
|
||||
$scope.menus.labels = [];
|
||||
$scope.menus.data = [];
|
||||
|
||||
for (var i = 0; i < data.menus.length; i++) {
|
||||
$scope.menus.labels.push(data.menus[i].menu_name);
|
||||
$scope.menus.data.push(Math.roundClearNG(data.menus[i].count, -2));
|
||||
}
|
||||
});
|
||||
|
||||
smartRequest.get('dashboard/online/profit', function (data) {
|
||||
$scope.profit = data.profit;
|
||||
});
|
||||
|
||||
smartRequest.get('dashboard/online/guests', function (data) {
|
||||
$scope.guests = data.guestsCount;
|
||||
$scope.namedGuests = data.namedGuests;
|
||||
$scope.sumNamedGuests = data.totalSum;
|
||||
});
|
||||
|
||||
smartRequest.get('dashboard/online/deleted', function (data) {
|
||||
$scope.deleted = Math.roundNG(data.count, -2);
|
||||
$scope.deleted_sum = Math.roundNG(data.sum, -2);
|
||||
});
|
||||
|
||||
smartRequest.get('dashboard/online/discount', function (data) {
|
||||
$scope.discounts = Math.roundNG(data.count, -2);
|
||||
$scope.discounts_sum = Math.roundNG(data.sum, -2);
|
||||
$scope.tot_disc_sum = Math.roundNG(data.total_sum, -2);
|
||||
});
|
||||
|
||||
smartRequest.get('dashboard/online/guests/median', function (data) {
|
||||
$scope.medianGuests.labels = [];
|
||||
$scope.medianGuests.data = [[]];
|
||||
|
||||
var tempData = [];
|
||||
var tempTime = [];
|
||||
for (var i = 0; i < data.data.length; i++) {
|
||||
var newDate = $scope.getMomentDate(data.data[i].time);
|
||||
|
||||
tempData.push(parseInt(data.data[i].count));
|
||||
tempTime.push(newDate);
|
||||
|
||||
var indexTime = $scope.getIntervals(tempTime[i], $scope.medianGuests.labels);
|
||||
|
||||
if (indexTime == -1) {
|
||||
$scope.medianGuests.labels.push(tempTime[i]);
|
||||
$scope.medianGuests.data[0].push(tempData[i]);
|
||||
} else {
|
||||
$scope.medianGuests.data[0][indexTime] += tempData[i];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
smartRequest.get('dashboard/online/finance/median', function (data) {
|
||||
$scope.medianFinance.labels = [];
|
||||
$scope.medianFinance.data = [[], [], []];
|
||||
|
||||
var tempSum = [];
|
||||
var tempTotalCost = [];
|
||||
var tempProffit = [];
|
||||
var tempTime = [];
|
||||
|
||||
for (var i = 0; i < data.data.length; i++) {
|
||||
var newDate = $scope.getMomentDate(data.data[i].time);
|
||||
|
||||
tempSum.push(data.data[i].sum);
|
||||
tempTotalCost.push(data.data[i].totalCost);
|
||||
var proffit = parseFloat((tempSum[i] - tempTotalCost[i]).toFixed(2));
|
||||
tempProffit.push(proffit);
|
||||
tempTime.push(newDate);
|
||||
|
||||
var indexTime = $scope.getIntervals(tempTime[i], $scope.medianFinance.labels);
|
||||
|
||||
$scope.fillMedianFinance(indexTime, tempTime[i], tempSum[i], tempTotalCost[i], tempProffit[i]);
|
||||
}
|
||||
|
||||
for (var i = 0; i < $scope.medianFinance.data.length; i++) {
|
||||
for (var j = 0; j < $scope.medianFinance.data[i].length; j++) {
|
||||
var data = $scope.medianFinance.data[i][j];
|
||||
data = Math.round(data * 100) / 100;
|
||||
$scope.medianFinance.data[i][j] = data;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$scope.checkUpdate();
|
||||
};
|
||||
|
||||
|
||||
$scope.update = function () {
|
||||
smartRequest.get('dashboard/online/updatetime', function (data) {
|
||||
$scope.update_time = data.updated;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div id="container-floating">
|
||||
<div class="nd1 nds" data-toggle="tooltip" data-placement="left" title="Обновить" ng-click="update()" style="background-color: #d3a411"
|
||||
<div class="nd1 nds" data-toggle="tooltip" data-placement="left" title="Обновить" ng-click="updateData()" style="background-color: #d3a411"
|
||||
onmouseenter="$(this).tooltip('show')">
|
||||
<i class="material-icons"></i>
|
||||
</div>
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 28 KiB |
@@ -1,22 +0,0 @@
|
||||
|
||||
|
||||
<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" style="height: 366px">
|
||||
<div style="position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 9999;
|
||||
background-image: url('../views/shifts/images/350.gif');
|
||||
background-repeat: no-repeat;
|
||||
background-color: #FFF;
|
||||
background-position: center;"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user