Skip to content

Commit

Permalink
Add ability for customer to cancel order and reservation
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com>
  • Loading branch information
sampoyigi committed Oct 15, 2021
1 parent 6db349a commit 4a35c7a
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 38 deletions.
13 changes: 10 additions & 3 deletions app/admin/language/en/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -469,12 +469,12 @@
'text_title' => 'Locations',
'text_form_name' => 'Location',
'text_tab_general' => 'Location',
'text_tab_data' => 'Settings',
'text_tab_schedules' => 'Schedules',
'text_tab_delivery_order' => 'Accepting Delivery Orders',
'text_tab_collection_order' => 'Accepting Pick-up Orders',
'text_tab_reservation' => 'Accepting Reservations',
'text_tab_delivery' => 'Delivery',
'text_tab_orders' => 'Orders',
'text_tab_reservation' => 'Reservations',
'text_tab_delivery' => 'Delivery Areas',
'text_tab_gallery' => 'Gallery',
'text_tab_title_address' => 'Address',
'text_filter_search' => 'Search by name, city or state.',
Expand Down Expand Up @@ -538,6 +538,8 @@
'label_future_collection_order' => 'Allow Pre-order for Pick-up',
'label_future_delivery_days' => 'Delivery Pre-order Days In Advance',
'label_future_collection_days' => 'Pick-up Pre-order Days In Advance',
'label_delivery_cancellation_timeout' => 'Deliver Order Cancellation Timeout',
'label_collection_cancellation_timeout' => 'Pick-up Order Cancellation Timeout',
'label_payments' => 'Payments',
'label_offer_reservation' => 'Offer Reservations',
'label_reservation_time_interval' => 'Reservation Time Interval',
Expand All @@ -547,6 +549,7 @@
'label_auto_allocate_table' => 'Automatically Allocate Tables',
'label_limit_guests' => 'Limit Reservation Guests Count',
'label_limit_guests_count' => 'Maximum Guests Per Interval',
'label_reservation_cancellation_timeout' => 'Reservation Cancellation Timeout',
'label_schedule_name' => 'Name',
'label_schedule_type' => 'Type',
'label_schedule_days' => 'Days',
Expand Down Expand Up @@ -594,6 +597,8 @@
'help_collection_time_interval' => 'Set the minutes between each pick-up order time available to your customer.',
'help_delivery_lead_time' => 'Set in minutes the average time it takes an order to be delivered after being placed',
'help_collection_lead_time' => 'Set in minutes the average time it takes an order to be ready for pick-up after being placed',
'help_delivery_cancellation_timeout' => 'Set when a customer can no longer cancel a delivery order. Number of minutes before delivery time. Leave as 0, to disable customer delivery order cancellation.',
'help_collection_cancellation_timeout' => 'Set when a customer can no longer cancel a pick-up order. Number of minutes before pick-up time. Leave as 0, to disable customer pick-up order cancellation.',
'help_future_delivery_days' => 'Set the number of days a customer can order for delivery in advance.',
'help_future_collection_days' => 'Set the number of days a customer can order for pick-up in advance.',
'help_flexible_hours' => 'Start typing to set the opening hours, such as 09:00-01:00 or 09:00-10:00,19:00-01:00',
Expand All @@ -604,6 +609,7 @@
'help_min_reservation_advance_time' => 'Set in days the minimum time before reservation that a guest can book a table',
'help_max_reservation_advance_time' => 'Set in days the maximum time before reservation that a guest can book a table',
'help_limit_guests_count' => 'Set the number of guests that can be booked between each time slot.',
'help_reservation_cancellation_timeout' => 'Set when a customer can no longer cancel a booking. Number of minutes before booking time. Leave as 0, to disable customer booking cancellation.',
'help_delivery_areas' => 'Set delivery conditions to specific geographical area/boundaries. Delivery areas are applied in the order in which they appear. Every location must have at least one delivery area to accept delivery orders.',
'help_delivery_condition' => 'Use the table below to set different delivery charge conditions. Conditions/Rules are applied in the order in which they appear. For free delivery set charge to 0 or -1 to make delivery unavailable. When an \'all\' rule is present, no other condition will be applied.',
'help_delivery_components' => 'All rules must be VALID to apply this delivery area, each rule is matched against the user\'s address component. Values can contain Regular Expressions.',
Expand Down Expand Up @@ -980,6 +986,7 @@
'text_sale_permission_global_access' => 'Global Access',
'text_sale_permission_groups' => 'Groups',
'text_sale_permission_restricted' => 'Restricted Access',
'text_impersonate' => 'Impersonate Staff',

'column_group' => 'Staff Groups',
'column_role' => 'Staff Roles',
Expand Down
99 changes: 64 additions & 35 deletions app/admin/models/config/locations_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,17 +228,24 @@
'size' => 'small',
],

'options[working_hours]' => [
'tab' => 'lang:admin::lang.locations.text_tab_schedules',
'type' => 'scheduleeditor',
'context' => ['edit'],
'form' => 'working_hours_model',
],

'options[limit_orders]' => [
'label' => 'lang:admin::lang.locations.label_limit_orders',
'tab' => 'lang:admin::lang.locations.text_tab_data',
'tab' => 'lang:admin::lang.locations.text_tab_orders',
'default' => 0,
'type' => 'switch',
'comment' => 'lang:admin::lang.locations.help_limit_orders',
'span' => 'left',
],
'options[limit_orders_count]' => [
'label' => 'lang:admin::lang.locations.label_limit_orders_count',
'tab' => 'lang:admin::lang.locations.text_tab_data',
'tab' => 'lang:admin::lang.locations.text_tab_orders',
'default' => 50,
'type' => 'number',
'span' => 'right',
Expand All @@ -252,19 +259,19 @@

'delivery_order' => [
'label' => 'lang:admin::lang.locations.text_tab_delivery_order',
'tab' => 'lang:admin::lang.locations.text_tab_data',
'tab' => 'lang:admin::lang.locations.text_tab_orders',
'type' => 'section',
],
'options[offer_delivery]' => [
'label' => 'lang:admin::lang.locations.label_offer_delivery',
'tab' => 'lang:admin::lang.locations.text_tab_data',
'tab' => 'lang:admin::lang.locations.text_tab_orders',
'default' => 1,
'type' => 'switch',
'span' => 'left',
],
'options[future_orders][enable_delivery]' => [
'label' => 'lang:admin::lang.locations.label_future_delivery_order',
'tab' => 'lang:admin::lang.locations.text_tab_data',
'tab' => 'lang:admin::lang.locations.text_tab_orders',
'type' => 'switch',
'span' => 'right',
'trigger' => [
Expand All @@ -275,7 +282,7 @@
],
'options[delivery_time_interval]' => [
'label' => 'lang:admin::lang.locations.label_delivery_time_interval',
'tab' => 'lang:admin::lang.locations.text_tab_data',
'tab' => 'lang:admin::lang.locations.text_tab_orders',
'default' => 15,
'type' => 'number',
'span' => 'left',
Expand All @@ -288,7 +295,7 @@
],
'options[future_orders][delivery_days]' => [
'label' => 'lang:admin::lang.locations.label_future_delivery_days',
'tab' => 'lang:admin::lang.locations.text_tab_data',
'tab' => 'lang:admin::lang.locations.text_tab_orders',
'type' => 'number',
'default' => 5,
'span' => 'right',
Expand All @@ -301,7 +308,7 @@
],
'options[delivery_lead_time]' => [
'label' => 'lang:admin::lang.locations.label_delivery_lead_time',
'tab' => 'lang:admin::lang.locations.text_tab_data',
'tab' => 'lang:admin::lang.locations.text_tab_orders',
'default' => 25,
'type' => 'number',
'span' => 'left',
Expand All @@ -314,7 +321,7 @@
],
'options[delivery_time_restriction]' => [
'label' => 'lang:admin::lang.locations.label_delivery_time_restriction',
'tab' => 'lang:admin::lang.locations.text_tab_data',
'tab' => 'lang:admin::lang.locations.text_tab_orders',
'type' => 'radiotoggle',
'span' => 'right',
'comment' => 'lang:admin::lang.locations.help_delivery_time_restriction',
Expand All @@ -324,22 +331,30 @@
'lang:admin::lang.locations.text_later_only',
],
],
'options[delivery_cancellation_timeout]' => [
'label' => 'lang:admin::lang.locations.label_delivery_cancellation_timeout',
'tab' => 'lang:admin::lang.locations.text_tab_orders',
'type' => 'number',
'span' => 'left',
'default' => 0,
'comment' => 'lang:admin::lang.locations.help_delivery_cancellation_timeout',
],

'collection_order' => [
'label' => 'lang:admin::lang.locations.text_tab_collection_order',
'tab' => 'lang:admin::lang.locations.text_tab_data',
'tab' => 'lang:admin::lang.locations.text_tab_orders',
'type' => 'section',
],
'options[offer_collection]' => [
'label' => 'lang:admin::lang.locations.label_offer_collection',
'tab' => 'lang:admin::lang.locations.text_tab_data',
'tab' => 'lang:admin::lang.locations.text_tab_orders',
'default' => 1,
'type' => 'switch',
'span' => 'left',
],
'options[future_orders][enable_collection]' => [
'label' => 'lang:admin::lang.locations.label_future_collection_order',
'tab' => 'lang:admin::lang.locations.text_tab_data',
'tab' => 'lang:admin::lang.locations.text_tab_orders',
'type' => 'switch',
'span' => 'right',
'trigger' => [
Expand All @@ -350,7 +365,7 @@
],
'options[collection_time_interval]' => [
'label' => 'lang:admin::lang.locations.label_collection_time_interval',
'tab' => 'lang:admin::lang.locations.text_tab_data',
'tab' => 'lang:admin::lang.locations.text_tab_orders',
'default' => 15,
'type' => 'number',
'span' => 'left',
Expand All @@ -363,7 +378,7 @@
],
'options[future_orders][collection_days]' => [
'label' => 'lang:admin::lang.locations.label_future_collection_days',
'tab' => 'lang:admin::lang.locations.text_tab_data',
'tab' => 'lang:admin::lang.locations.text_tab_orders',
'type' => 'number',
'default' => 5,
'span' => 'right',
Expand All @@ -376,7 +391,7 @@
],
'options[collection_lead_time]' => [
'label' => 'lang:admin::lang.locations.label_collection_lead_time',
'tab' => 'lang:admin::lang.locations.text_tab_data',
'tab' => 'lang:admin::lang.locations.text_tab_orders',
'default' => 25,
'type' => 'number',
'span' => 'left',
Expand All @@ -389,7 +404,7 @@
],
'options[collection_time_restriction]' => [
'label' => 'lang:admin::lang.locations.label_collection_time_restriction',
'tab' => 'lang:admin::lang.locations.text_tab_data',
'tab' => 'lang:admin::lang.locations.text_tab_orders',
'type' => 'radiotoggle',
'span' => 'right',
'comment' => 'lang:admin::lang.locations.help_collection_time_restriction',
Expand All @@ -399,22 +414,25 @@
'lang:admin::lang.locations.text_later_only',
],
],

'reservation' => [
'label' => 'lang:admin::lang.locations.text_tab_reservation',
'tab' => 'lang:admin::lang.locations.text_tab_data',
'type' => 'section',
'options[collection_cancellation_timeout]' => [
'label' => 'lang:admin::lang.locations.label_collection_cancellation_timeout',
'tab' => 'lang:admin::lang.locations.text_tab_orders',
'type' => 'number',
'span' => 'left',
'default' => 0,
'comment' => 'lang:admin::lang.locations.help_collection_cancellation_timeout',
],

'options[offer_reservation]' => [
'label' => 'lang:admin::lang.locations.label_offer_reservation',
'tab' => 'lang:admin::lang.locations.text_tab_data',
'tab' => 'lang:admin::lang.locations.text_tab_reservation',
'default' => 1,
'type' => 'switch',
'span' => 'left',
],
'options[auto_allocate_table]' => [
'label' => 'lang:admin::lang.locations.label_auto_allocate_table',
'tab' => 'lang:admin::lang.locations.text_tab_data',
'tab' => 'lang:admin::lang.locations.text_tab_reservation',
'default' => 1,
'type' => 'switch',
'span' => 'right',
Expand All @@ -426,7 +444,7 @@
],
'options[reservation_time_interval]' => [
'label' => 'lang:admin::lang.locations.label_reservation_time_interval',
'tab' => 'lang:admin::lang.locations.text_tab_data',
'tab' => 'lang:admin::lang.locations.text_tab_reservation',
'default' => 15,
'type' => 'number',
'span' => 'left',
Expand All @@ -439,7 +457,7 @@
],
'options[reservation_stay_time]' => [
'label' => 'lang:admin::lang.locations.label_reservation_stay_time',
'tab' => 'lang:admin::lang.locations.text_tab_data',
'tab' => 'lang:admin::lang.locations.text_tab_reservation',
'default' => 45,
'type' => 'number',
'span' => 'right',
Expand All @@ -452,30 +470,40 @@
],
'options[min_reservation_advance_time]' => [
'label' => 'lang:admin::lang.locations.label_min_reservation_advance_time',
'tab' => 'lang:admin::lang.locations.text_tab_data',
'tab' => 'lang:admin::lang.locations.text_tab_reservation',
'default' => 2,
'type' => 'number',
'span' => 'left',
'comment' => 'lang:admin::lang.locations.help_min_reservation_advance_time',
'trigger' => [
'action' => 'enable',
'field' => 'options[offer_reservation]',
'condition' => 'checked',
],
],
'options[max_reservation_advance_time]' => [
'label' => 'lang:admin::lang.locations.label_max_reservation_advance_time',
'tab' => 'lang:admin::lang.locations.text_tab_data',
'tab' => 'lang:admin::lang.locations.text_tab_reservation',
'default' => 30,
'type' => 'number',
'span' => 'right',
'comment' => 'lang:admin::lang.locations.help_max_reservation_advance_time',
'trigger' => [
'action' => 'enable',
'field' => 'options[offer_reservation]',
'condition' => 'checked',
],
],
'options[limit_guests]' => [
'label' => 'lang:admin::lang.locations.label_limit_guests',
'tab' => 'lang:admin::lang.locations.text_tab_data',
'tab' => 'lang:admin::lang.locations.text_tab_reservation',
'default' => 0,
'type' => 'switch',
'span' => 'left',
],
'options[limit_guests_count]' => [
'label' => 'lang:admin::lang.locations.label_limit_guests_count',
'tab' => 'lang:admin::lang.locations.text_tab_data',
'tab' => 'lang:admin::lang.locations.text_tab_reservation',
'default' => 20,
'type' => 'number',
'span' => 'right',
Expand All @@ -486,12 +514,13 @@
'condition' => 'checked',
],
],

'options[working_hours]' => [
'tab' => 'lang:admin::lang.locations.text_tab_schedules',
'type' => 'scheduleeditor',
'context' => ['edit'],
'form' => 'working_hours_model',
'options[reservation_cancellation_timeout]' => [
'label' => 'lang:admin::lang.locations.label_reservation_cancellation_timeout',
'tab' => 'lang:admin::lang.locations.text_tab_reservation',
'type' => 'number',
'span' => 'left',
'default' => 0,
'comment' => 'lang:admin::lang.locations.help_reservation_cancellation_timeout',
],

'options[payments]' => [
Expand Down
5 changes: 5 additions & 0 deletions app/admin/requests/Location.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,17 @@ public function rules()
['options.future_orders.collection_days', 'admin::lang.locations.label_future_collection_days', 'integer'],
['options.delivery_time_restriction', 'admin::lang.locations.label_delivery_time_restriction', 'nullable|integer|max:2'],
['options.collection_time_restriction', 'admin::lang.locations.label_collection_time_restriction', 'nullable|integer|max:2'],
['options.delivery_cancellation_timeout', 'admin::lang.locations.label_delivery_cancellation_timeout', 'integer|min:0|max:999'],
['options.collection_cancellation_timeout', 'admin::lang.locations.label_collection_cancellation_timeout', 'integer|min:0|max:999'],
['options.payments.*', 'admin::lang.locations.label_payments'],
['options.reservation_time_interval', 'admin::lang.locations.label_reservation_time_interval|min:5', 'integer'],
['options.reservation_stay_time', 'admin::lang.locations.reservation_stay_time|min:5', 'integer'],
['options.auto_allocate_table', 'admin::lang.locations.label_auto_allocate_table', 'integer'],
['options.limit_guests', 'admin::lang.locations.label_limit_guests', 'boolean'],
['options.limit_guests_count', 'admin::lang.locations.label_limit_guests_count', 'integer|min:1|max:999'],
['options.min_reservation_advance_time', 'admin::lang.locations.label_min_reservation_advance_time', 'integer|min:0|max:999'],
['options.max_reservation_advance_time', 'admin::lang.locations.label_max_reservation_advance_time', 'integer|min:0|max:999'],
['options.reservation_cancellation_timeout', 'admin::lang.locations.label_reservation_cancellation_timeout', 'integer|min:0|max:999'],
['location_status', 'admin::lang.label_status', 'boolean'],
['permalink_slug', 'admin::lang.locations.label_permalink_slug', 'alpha_dash|max:255'],
['gallery.title', 'admin::lang.locations.label_gallery_title', 'max:128'],
Expand Down

0 comments on commit 4a35c7a

Please sign in to comment.