diff --git a/assets/css/kds.css b/assets/css/kds.css index 739d895..f893568 100644 --- a/assets/css/kds.css +++ b/assets/css/kds.css @@ -29,4 +29,7 @@ max-width: 320px; } -} \ No newline at end of file +} +input[type="text"] { + width: 320px; +} diff --git a/controllers/Summary.php b/controllers/Summary.php index 8a8d6dd..8691e13 100644 --- a/controllers/Summary.php +++ b/controllers/Summary.php @@ -11,9 +11,11 @@ use Admin\Models\Staffs_model; use Admin\Models\Statuses_model; use Carbon\Carbon; +use DateTime; use Igniter\Flame\Exception\ApplicationException; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Request; +use Illuminate\Http\RedirectResponse; use Thoughtco\KitchenDisplay\Models\Views as KitchenViews; /** @@ -279,4 +281,44 @@ public function view($route, $viewId) } + public function contact(): RedirectResponse + { + $orderId = Request::get('orderId', -1); + $eta = Request::get('eta', '45'); + + // get newest order + /** @var Orders_model $order */ + $order = Orders_model::where('order_id', $orderId)->first(); + $order->updateOrderStatus( + $order->status_id, + [ + 'comment' => sprintf(lang('lang:thoughtco.kitchendisplay::default.eta'), $eta), + 'notify' => false, + ] + ); + + // check if ETA is valid + $etaDateTime = (new DateTime())->modify('+' . $eta . ' minutes'); + $orderDateTime = DateTime::createFromFormat('Y-m-d H:i:s', $order->order_date->format('Y-m-d') . ' ' . $order->order_time); + // flash()->info($orderDateTime->format('Y-m-d H:i:s')); + if (! $order->order_time_is_asap && $etaDateTime < $orderDateTime) + { + flash()->warning(lang('lang:thoughtco.kitchendisplay::default.eta_too_low'))->now(); + return back(); + } + + // send mail to customer + $mailView = 'admin::_mail.order_update '; + $order->mailSend($mailView, 'customer'); + + // flash success message in kitchen display + + $order->order_date = $etaDateTime->format('Y-m-d'); + $order->order_time = $etaDateTime->format('H:i'); + $order->save(); + flash()->success(sprintf(lang('lang:thoughtco.kitchendisplay::default.eta_success'), $eta))->now(); + + return back(); + } + } diff --git a/language/de/default.php b/language/de/default.php new file mode 100644 index 0000000..93a0f17 --- /dev/null +++ b/language/de/default.php @@ -0,0 +1,8 @@ + 'Die geschätzte Wartezeit für Ihre Bestellung beträgt %d Minuten.', + 'eta_too_low' => 'Die Wartezeit ist niedriger als vom Kunden angegeben! Wurde die Wunschzeit beachtet?', + 'eta_success' => 'Successfully set ETA to %d minutes', + 'btn_eta' => 'Wartezeit erfolgreich auf %d Minuten angegeben', +]; \ No newline at end of file diff --git a/language/en/default.php b/language/en/default.php index 5a0ffd8..644b893 100644 --- a/language/en/default.php +++ b/language/en/default.php @@ -52,6 +52,7 @@ 'label_card_status' => 'Show status', 'label_card_items' => 'Show menu items', 'label_card_assign' => 'Show assign', + 'label_card_eta' => 'Show ETA combo box', 'label_card_print' => 'Show print', 'option_blank' => 'Blank', @@ -81,4 +82,8 @@ 'value_delivery' => 'Delivery only', 'value_collection' => 'Collection only', + 'eta' => 'The estimated time of arrival for your order is %d minutes', + 'eta_too_low' => 'The ETA is earlier than the time requested. Did you take the reservation time into account?', + 'eta_success' => 'Successfully set ETA to %d minutes', + 'btn_eta' => 'Send ETA' ]; diff --git a/models/config/views.php b/models/config/views.php index 82cbf32..8c34ccd 100644 --- a/models/config/views.php +++ b/models/config/views.php @@ -326,6 +326,12 @@ 'type' => 'switch', 'default' => FALSE, ], + 'display[eta]' => [ + 'tab' => 'lang:thoughtco.kitchendisplay::default.tab_cards', + 'label' => 'thoughtco.kitchendisplay::default.label_card_eta', + 'type' => 'switch', + 'default' => FALSE, + ] ] ] ], diff --git a/views/summary/view.blade.php b/views/summary/view.blade.php index 495f74f..d7fe8b8 100644 --- a/views/summary/view.blade.php +++ b/views/summary/view.blade.php @@ -54,7 +54,19 @@ @if($viewSettings->display['card_status'])