Skip to content

Commit

Permalink
Bring back locations admin page
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Poyigi <[email protected]>
  • Loading branch information
sampoyigi committed May 9, 2024
1 parent e56200c commit c5c1c7c
Show file tree
Hide file tree
Showing 6 changed files with 343 additions and 111 deletions.
5 changes: 4 additions & 1 deletion resources/lang/en/default.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

return [
'text_title' => 'Locations',
'text_tab_texts' => 'Text',
'text_gallery' => 'Gallery',

Expand Down Expand Up @@ -181,7 +182,8 @@
'text_mealtime' => 'Available during %s (%s - %s)',
'text_price_form' => 'From %s',

'text_form_name' => 'Location Settings',
'text_form_name' => 'Location',
'text_settings_form_name' => 'Location Settings',
'text_settings' => 'Settings',
'text_tab_general' => 'General',
'text_tab_schedules' => 'Schedules',
Expand Down Expand Up @@ -218,6 +220,7 @@
'text_asap_only' => 'ASAP only',
'text_later_only' => 'Later only',
'text_side_menu_location' => 'Locations',
'text_tab_desc_location' => 'Manage your restaurant locations.',

'column_city' => 'City',
'column_state' => 'State',
Expand Down
293 changes: 216 additions & 77 deletions resources/models/location.php
Original file line number Diff line number Diff line change
@@ -1,106 +1,245 @@
<?php

$config['form']['fields'] = [
'location_name' => [
'label' => 'lang:igniter::admin.label_name',
'type' => 'text',
'span' => 'left',
$config['list']['filter'] = [
'search' => [
'prompt' => 'lang:igniter.local::default.text_filter_search',
'mode' => 'all',
],
'scopes' => [
'status' => [
'label' => 'lang:igniter::admin.text_filter_status',
'type' => 'switch',
'conditions' => 'location_status = :filtered',
],
],
'permalink_slug' => [
'label' => 'lang:igniter.local::default.label_permalink_slug',
'type' => 'permalink',
'span' => 'right',
'comment' => 'lang:igniter::admin.help_permalink',
];

$config['list']['toolbar'] = [
'buttons' => [
'create' => [
'label' => 'lang:igniter::admin.button_new',
'class' => 'btn btn-primary',
'href' => 'locations/create',
],
],
'location_email' => [
'label' => 'lang:igniter::admin.label_email',
'type' => 'text',
'span' => 'left',
];

$config['list']['bulkActions'] = [
'status' => [
'label' => 'lang:igniter::admin.list.actions.label_status',
'type' => 'dropdown',
'class' => 'btn btn-light',
'statusColumn' => 'location_status',
'menuItems' => [
'enable' => [
'label' => 'lang:igniter::admin.list.actions.label_enable',
'type' => 'button',
'class' => 'dropdown-item',
],
'disable' => [
'label' => 'lang:igniter::admin.list.actions.label_disable',
'type' => 'button',
'class' => 'dropdown-item text-danger',
],
],
],
'location_telephone' => [
'label' => 'lang:igniter.local::default.label_telephone',
'type' => 'text',
'span' => 'right',
'delete' => [
'label' => 'lang:igniter::admin.button_delete',
'class' => 'btn btn-light text-danger',
'data-request-confirm' => 'lang:igniter::admin.alert_warning_confirm',
],
'location_address_1' => [
'label' => 'lang:igniter.local::default.label_address_1',
'type' => 'text',
'span' => 'left',
];

$config['list']['columns'] = [
'edit' => [
'type' => 'button',
'iconCssClass' => 'fa fa-pencil',
'attributes' => [
'class' => 'btn btn-edit',
'href' => 'locations/edit/{location_id}',
],
],
'location_address_2' => [
'label' => 'lang:igniter.local::default.label_address_2',
'default' => [
'type' => 'button',
'iconCssClass' => 'fa fa-star-o',
'attributes' => [
'class' => 'btn btn-outline-warning bg-transparent',
'data-request' => 'onSetDefault',
'data-request-data' => 'default:{location_id}',
],
],
'location_name' => [
'label' => 'lang:igniter::admin.label_name',
'type' => 'text',
'span' => 'right',
'searchable' => true,
],
'location_city' => [
'label' => 'lang:igniter.local::default.label_city',
'label' => 'lang:igniter.local::default.column_city',
'type' => 'text',
'span' => 'left',
'searchable' => true,
],
'location_state' => [
'label' => 'lang:igniter.local::default.label_state',
'label' => 'lang:igniter.local::default.column_state',
'type' => 'text',
'span' => 'right',
'searchable' => true,
],
'location_postcode' => [
'label' => 'lang:igniter.local::default.label_postcode',
'label' => 'lang:igniter.local::default.column_postcode',
'type' => 'text',
'span' => 'left',
],
'thumb' => [
'label' => 'lang:igniter.local::default.label_image',
'type' => 'mediafinder',
'span' => 'left',
'mode' => 'inline',
'useAttachment' => true,
'comment' => 'lang:igniter.local::default.help_image',
],
'is_auto_lat_lng' => [
'label' => 'lang:igniter.local::default.label_auto_lat_lng',
'type' => 'switch',
'default' => true,
'onText' => 'lang:igniter::admin.text_yes',
'offText' => 'lang:igniter::admin.text_no',
'span' => 'left',
'searchable' => true,
],
'location_telephone' => [
'label' => 'lang:igniter.local::default.column_telephone',
'type' => 'text',
'searchable' => true,
],
'location_status' => [
'label' => 'lang:igniter::admin.label_status',
'type' => 'switch',
'default' => 1,
'span' => 'right',
'cssClass' => 'flex-width',
],
'is_default' => [
'label' => 'lang:igniter::admin.text_is_default',
'type' => 'switch',
'default' => 1,
'span' => 'right',
'cssClass' => 'flex-width',
'location_id' => [
'label' => 'lang:igniter::admin.column_id',
'invisible' => true,
],
'location_lat' => [
'label' => 'lang:igniter.local::default.label_latitude',
'type' => 'text',
'span' => 'left',
'trigger' => [
'action' => 'hide',
'field' => 'is_auto_lat_lng',
'condition' => 'checked',
],
'created_at' => [
'label' => 'lang:igniter::admin.column_date_added',
'invisible' => true,
'type' => 'datetime',
],
'location_lng' => [
'label' => 'lang:igniter.local::default.label_longitude',
'type' => 'text',
'span' => 'right',
'trigger' => [
'action' => 'hide',
'field' => 'is_auto_lat_lng',
'condition' => 'checked',
'updated_at' => [
'label' => 'lang:igniter::admin.column_date_updated',
'invisible' => true,
'type' => 'datetime',
],
];

$config['form']['toolbar'] = [
'buttons' => [
'save' => [
'label' => 'lang:igniter::admin.button_save',
'context' => ['create', 'edit', 'settings'],
'partial' => 'form/toolbar_save_button',
'saveActions' => ['continue', 'close'],
'class' => 'btn btn-primary',
'data-request' => 'onSave',
'data-progress-indicator' => 'igniter::admin.text_saving',
],
'delete' => [
'label' => 'lang:igniter::admin.button_icon_delete',
'class' => 'btn btn-danger',
'data-request' => 'onDelete',
'data-request-data' => "_method:'DELETE'",
'data-request-confirm' => 'lang:igniter::admin.alert_warning_confirm',
'data-progress-indicator' => 'igniter::admin.text_deleting',
'context' => ['edit'],
],
],
'description' => [
'label' => 'lang:igniter::admin.label_description',
'type' => 'richeditor',
'size' => 'small',
];

$config['form']['tabs'] = [
'defaultTab' => 'lang:igniter.local::default.text_tab_general',
'fields' => [
'location_name' => [
'label' => 'lang:igniter::admin.label_name',
'type' => 'text',
'span' => 'left',
],
'permalink_slug' => [
'label' => 'lang:igniter.local::default.label_permalink_slug',
'type' => 'permalink',
'span' => 'right',
'comment' => 'lang:igniter::admin.help_permalink',
],
'location_email' => [
'label' => 'lang:igniter::admin.label_email',
'type' => 'text',
'span' => 'left',
],
'location_telephone' => [
'label' => 'lang:igniter.local::default.label_telephone',
'type' => 'text',
'span' => 'right',
],
'location_address_1' => [
'label' => 'lang:igniter.local::default.label_address_1',
'type' => 'text',
'span' => 'left',
],
'location_address_2' => [
'label' => 'lang:igniter.local::default.label_address_2',
'type' => 'text',
'span' => 'right',
],
'location_city' => [
'label' => 'lang:igniter.local::default.label_city',
'type' => 'text',
'span' => 'left',
],
'location_state' => [
'label' => 'lang:igniter.local::default.label_state',
'type' => 'text',
'span' => 'right',
],
'location_postcode' => [
'label' => 'lang:igniter.local::default.label_postcode',
'type' => 'text',
'span' => 'left',
],
'thumb' => [
'label' => 'lang:igniter.local::default.label_image',
'type' => 'mediafinder',
'span' => 'left',
'mode' => 'inline',
'useAttachment' => true,
'comment' => 'lang:igniter.local::default.help_image',
],
'is_auto_lat_lng' => [
'label' => 'lang:igniter.local::default.label_auto_lat_lng',
'type' => 'switch',
'default' => true,
'onText' => 'lang:igniter::admin.text_yes',
'offText' => 'lang:igniter::admin.text_no',
'span' => 'left',
],
'location_status' => [
'label' => 'lang:igniter::admin.label_status',
'type' => 'switch',
'default' => 1,
'span' => 'right',
'cssClass' => 'flex-width',
],
'is_default' => [
'label' => 'lang:igniter::admin.text_is_default',
'type' => 'switch',
'default' => 1,
'span' => 'right',
'cssClass' => 'flex-width',
],
'location_lat' => [
'label' => 'lang:igniter.local::default.label_latitude',
'type' => 'text',
'span' => 'left',
'trigger' => [
'action' => 'hide',
'field' => 'is_auto_lat_lng',
'condition' => 'checked',
],
],
'location_lng' => [
'label' => 'lang:igniter.local::default.label_longitude',
'type' => 'text',
'span' => 'right',
'trigger' => [
'action' => 'hide',
'field' => 'is_auto_lat_lng',
'condition' => 'checked',
],
],
'description' => [
'label' => 'lang:igniter::admin.label_description',
'type' => 'richeditor',
'size' => 'small',
],
],
];

Expand Down
15 changes: 5 additions & 10 deletions resources/views/_partials/locationpicker/locationpicker.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ class="flex-fill text-reset"
<a
class="fw-bold text-reset text-sm cursor-pointer"
data-alias="locationpicker"
data-toggle="record-editor"
data-handler="{{ $this->getEventHandler('onLoadForm') }}"
data-record-data='{"location": "{{ $location->location_id }}"}'
href="{{ admin_url('locations/edit/'.$location->location_id) }}"
>
<span>@lang('igniter::admin.text_edit')</span>
</a>
Expand All @@ -60,13 +58,10 @@ class="fw-bold text-reset text-sm cursor-pointer"
<hr class="dropdown-divider">
</li>
<li class="dropdown-footer">
<button
type="button"
class="dropdown-item"
data-alias="locationpicker"
data-toggle="record-editor"
data-handler="{{ $this->getEventHandler('onLoadForm') }}"
><i class="fa fa-fw fa-plus-circle"></i>@lang('igniter.local::default.text_add_location')</button>
<a
class="dropdown-item border-0 text-left py-2 px-3"
href="{{ admin_url('locations/create') }}"
><i class="fa fa-fw fa-plus-circle"></i>@lang('igniter.local::default.text_add_location')</a>
</li>
@endif
</ul>
Expand Down
Loading

0 comments on commit c5c1c7c

Please sign in to comment.