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 @@ + + + \ 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 @@ \ 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) }}