From 85fd6af04fe573cf39d030c130f1196dce97464a Mon Sep 17 00:00:00 2001
From: miroman-afk <74014189+miroman-afk@users.noreply.github.com>
Date: Fri, 25 Mar 2022 00:03:43 +0300
Subject: [PATCH] v.2.15
Order history
---
commands/GETOrderHistory.php | 54 +++++++++++
database/seeders/Add53ActionType.php | 22 +++++
database/seeders/Add54ActionType.php | 22 +++++
models/Staff.php | 9 ++
models/Units.php | 9 ++
models/UnitsList.php | 9 ++
web/controllers/dashboard.js | 11 +++
.../items/items-total — копия.html | 55 ++++++++++++
web/views/dashboard/items/items-total.html | 89 +++++++++++++------
web/views/dashboard/items/more-total.html | 2 +-
10 files changed, 256 insertions(+), 26 deletions(-)
create mode 100644 commands/GETOrderHistory.php
create mode 100644 database/seeders/Add53ActionType.php
create mode 100644 database/seeders/Add54ActionType.php
create mode 100644 models/Staff.php
create mode 100644 models/Units.php
create mode 100644 models/UnitsList.php
create mode 100644 web/views/dashboard/items/items-total — копия.html
diff --git a/commands/GETOrderHistory.php b/commands/GETOrderHistory.php
new file mode 100644
index 0000000..e78172b
--- /dev/null
+++ b/commands/GETOrderHistory.php
@@ -0,0 +1,54 @@
+orderBy('time', 'asc')->get();
+ foreach ($order as $key => $item) {
+ $action_type = ActionTypes::where('type_id', $item['type_action'])->first();
+ $action_name = $action_type['name'];
+ $staff = Staff::where('code', $item['who'])->first();
+ $staff_name = $staff['name'];
+ if ($item['type_action'] == 45 || $item['type_action'] == 39) {
+ $action_name = $item['value'];
+ }
+ if ($item['type_action'] == 46 || $item['type_action'] == 35) {
+ $action_name = $action_name . ': ' . $item['value'];
+ }
+ if ($item['type_action'] == 2) {
+ $shiftOnlineItem = ShiftOnlineItems::where('order_code', $item['order_code'])->where('dish_code', $item['more'])->first();
+ $unitsList = UnitsList::where('id', $shiftOnlineItem['units_code'])->first();
+ $units = Units::where('id', $unitsList['unit_id'])->first();
+ $unit_name = $units['name'];
+ $dish = Dishes::where('code', $item['more'])->first();
+ $action_name = $action_name . ': ' . $dish['name'] . ' в количестве ' . $item['value'] . ' ' . $unit_name;
+ }
+ $order_info[] = array('id' => $key, 'action' => $action_name, 'who' => $staff_name, 'time' => $item['time'], 'workgroup' => $item['workgroup'], 'workcode' => $item['workcode']);
+ }
+ return [
+ 'status' => 'success',
+ 'actions' => $order_info,
+ ];
+ } else {
+ return [
+ 'status' => 'success',
+ 'error_message' => 'Проверьте введенные данные',
+ ];
+ }
+ }
+}
\ No newline at end of file
diff --git a/database/seeders/Add53ActionType.php b/database/seeders/Add53ActionType.php
new file mode 100644
index 0000000..2b6354e
--- /dev/null
+++ b/database/seeders/Add53ActionType.php
@@ -0,0 +1,22 @@
+count() == 0) {
+ $types = ActionTypes::upsert([
+ ['name' => 'Выход из заказа', 'type_id' => 53],
+ ], ['name'], ['type_id']
+ );
+ }
+ }
+}
diff --git a/database/seeders/Add54ActionType.php b/database/seeders/Add54ActionType.php
new file mode 100644
index 0000000..c69d794
--- /dev/null
+++ b/database/seeders/Add54ActionType.php
@@ -0,0 +1,22 @@
+count() == 0) {
+ $types = ActionTypes::upsert([
+ ['name' => 'Автоматический выход из заказа', 'type_id' => 54],
+ ], ['name'], ['type_id']
+ );
+ }
+ }
+}
diff --git a/models/Staff.php b/models/Staff.php
new file mode 100644
index 0000000..2bf2b59
--- /dev/null
+++ b/models/Staff.php
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+ | Блюдо |
+ Количество |
+ Сумма, BYN |
+
+
+
+
+
+ | {{ item.name }} |
+ {{ item.count }} |
+ {{ item.sale_price | curr }} |
+
+
+
+
+
+ |
+ Итого: {{ order.total | curr }} BYN |
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/views/dashboard/items/items-total.html b/web/views/dashboard/items/items-total.html
index 660006b..82bbe39 100644
--- a/web/views/dashboard/items/items-total.html
+++ b/web/views/dashboard/items/items-total.html
@@ -24,32 +24,71 @@
-
-
-
-
- | Блюдо |
- Количество |
- Сумма, BYN |
-
-
-
-
-
- | {{ item.name }} |
- {{ item.count }} |
- {{ item.sale_price | curr }} |
-
-
-
-
-
- |
- Итого: {{ order.total | curr }} BYN |
-
-
-
+
+
+
+
+
+
+
+
+ | Блюдо |
+ Количество |
+ Сумма, BYN |
+
+
+
+
+ | {{ item.name }} |
+ {{ item.count }} |
+ {{ item.sale_price | curr }} |
+
+
+
+
+ |
+ Итого: {{ order.total | curr }} BYN |
+
+
+
+
+
+
+
+
+
+
+ | Действие |
+ Персонал |
+ Время |
+ Группа |
+ Место |
+
+
+
+
+ | {{ action.action }} |
+ {{ action.who }} |
+ {{ action.time }} |
+ {{ action.workgroup }} |
+ {{ action.workcode }} |
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/views/dashboard/items/more-total.html b/web/views/dashboard/items/more-total.html
index fb0d4f8..a6389cc 100644
--- a/web/views/dashboard/items/more-total.html
+++ b/web/views/dashboard/items/more-total.html
@@ -17,7 +17,7 @@
-
+
| {{ order.number }} |
{{ order.opened }} |
{{ getClosedDate(order.closed) }} |