Skip to content

Commit

Permalink
Merge branch '3.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
sampoyigi committed Mar 30, 2022
2 parents 3eb06a6 + ef609bc commit 0c08f3c
Show file tree
Hide file tree
Showing 60 changed files with 2,567 additions and 11,183 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/archive.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Archive

on:
schedule:
- cron: "0 0 * * *"

jobs:
archive:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
repo-token: ${{ secrets.ACCESS_TOKEN }}
days-before-stale: 60
days-before-close: 3
stale-issue-message: >
This issue will be closed and archived in 3 days, as there has been no activity in the last 60 days.
If this issue is still relevant or you would like to see it actioned, please respond and we will re-open this issue.
If this issue is critical to your business, consider the [Dedicated Support Service](https://tastyigniter.com/premium-support) where a Service Level Agreement is offered.
stale-pr-message: >
This pull request will be closed and archived in 3 days, as there has been no activity in the last 60 days.
If this is still being worked on, please respond and we will re-open this pull request.
If this pull request is critical to your business, consider the [Dedicated Support Service](https://tastyigniter.com/premium-support) where a Service Level Agreement is offered.
stale-issue-label: 'Status: Archived'
stale-pr-label: 'Status: Archived'
exempt-issue-label: 'Status: In Progress'
exempt-pr-label: 'Status: In Progress'
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- master
- develop
- tests
- 3.x
pull_request:

jobs:
Expand Down
2 changes: 1 addition & 1 deletion app/admin/actions/AssigneeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ protected function assigneeBindListsEvents()
protected function assigneeBindFormEvents()
{
if ($this->controller->isClassExtendedWith('Admin\Actions\FormController')) {
$this->controller->bindEvent('controller.form.extendQuery', function ($query) {
$this->controller->bindEvent('admin.controller.extendFormQuery', function ($query) {
if (!(bool)$this->getConfig('applyScopeOnFormQuery', TRUE))
return;

Expand Down
2 changes: 1 addition & 1 deletion app/admin/actions/LocationAwareController.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ protected function locationBindEvents()
}

if ($this->controller->isClassExtendedWith('Admin\Actions\FormController')) {
$this->controller->bindEvent('controller.form.extendQuery', function ($query) {
$this->controller->bindEvent('admin.controller.extendFormQuery', function ($query) {
if ((bool)$this->getConfig('applyScopeOnFormQuery', TRUE))
$this->locationApplyScope($query);
});
Expand Down
86 changes: 35 additions & 51 deletions app/admin/assets/css/admin.css

Large diffs are not rendered by default.

4,679 changes: 6 additions & 4,673 deletions app/admin/assets/js/admin.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions app/admin/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"prod": "NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"@fortawesome/fontawesome-free": "^5.12.0",
"animate.css": "^3.6.1",
"bootstrap": "^4.6.0",
"bootstrap-colorpicker": "^3.2.0",
"@fortawesome/fontawesome-free": "^5.15.4",
"animate.css": "^3.7.2",
"bootstrap": "^4.6.1",
"bootstrap-colorpicker": "^3.4.0",
"cross-env": "^5.0.1",
"jquery": "^3.5.1",
"jquery-sortablejs": "^1.0.1",
Expand All @@ -20,7 +20,7 @@
"popper.js": "^1.16.1",
"select2": "4.0.13",
"select2-theme-bootstrap4": "0.2.0-beta.2",
"sortablejs": "^1.10.2",
"sortablejs": "^1.14.0",
"sweetalert": "^2.1.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ protected function copyStockQtyFromMenus()
'stockable_id' => $menuItem->menu_id,
'stockable_type' => 'menus',
'quantity' => $menuItem->stock_qty,
'is_tracked' => $menuItem->subtract_stock,
'is_tracked' => (bool)$menuItem->subtract_stock,
'created_at' => now()->toDateTimeString(),
'updated_at' => now()->toDateTimeString(),
]);
Expand Down Expand Up @@ -114,7 +114,7 @@ protected function copyStockQtyFromMenuOptions()
'stockable_id' => $optionValue->option_value_id,
'stockable_type' => 'menu_option_values',
'quantity' => $optionValue->quantity,
'is_tracked' => $optionValue->subtract_stock,
'is_tracked' => (bool)$optionValue->subtract_stock,
'created_at' => now()->toDateTimeString(),
'updated_at' => now()->toDateTimeString(),
]);
Expand Down
6 changes: 6 additions & 0 deletions app/admin/formwidgets/MediaFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,12 @@ public function onAddAttachment()
if (!in_array(HasMedia::class, class_uses_recursive(get_class($this->model))))
return;

if (!array_key_exists($this->fieldName, $this->model->mediable())) {
throw new ApplicationException(sprintf(lang('main::lang.media_manager.alert_missing_mediable'),
$this->fieldName, get_class($this->model)
));
}

$items = post('items');
if (!is_array($items))
throw new ApplicationException(lang('main::lang.media_manager.alert_select_item_to_attach'));
Expand Down
17 changes: 12 additions & 5 deletions app/admin/formwidgets/ScheduleEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
namespace Admin\FormWidgets;

use Admin\Classes\BaseFormWidget;
use Admin\Models\Locations_model;
use Admin\Models\Working_hours_model;
use Admin\Traits\ValidatesForm;
use Admin\Widgets\Form;
use Igniter\Flame\Exception\ApplicationException;
use Igniter\Flame\Location\Models\AbstractLocation;
use Igniter\Flame\Location\OrderTypes;
use Illuminate\Support\Facades\DB;

class ScheduleEditor extends BaseFormWidget
Expand Down Expand Up @@ -72,7 +74,7 @@ public function onLoadRecord()
$scheduleCode = post('recordId');
$scheduleItem = $this->getSchedule($scheduleCode);

$formTitle = sprintf(lang($this->formTitle), lang('admin::lang.text_'.$scheduleCode));
$formTitle = sprintf(lang($this->formTitle), lang($scheduleItem->name));

return $this->makePartial('recordeditor/form', [
'formRecordId' => $scheduleCode,
Expand Down Expand Up @@ -125,10 +127,15 @@ protected function listSchedules()
if ($this->schedulesCache)
return $this->schedulesCache;

$schedules = [];
foreach ($this->model->availableWorkingTypes() as $scheduleCode) {
$schedules[$scheduleCode] = $this->model->createScheduleItem($scheduleCode);
}
$schedules = collect(OrderTypes::instance()->listOrderTypes())
->prepend(['name' => 'admin::lang.text_opening'], Locations_model::OPENING)
->mapWithKeys(function ($definition, $code) {
$scheduleItem = $this->model->createScheduleItem($code);
$scheduleItem->name = array_get($definition, 'name');

return [$code => $scheduleItem];
})
->all();

return $this->schedulesCache = $schedules;
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,76 +1,76 @@
(function (factory) {
"use strict";
var sortable,
jq,
_this = this
;

if (typeof define === "function" && define.amd) {
try {
define(["sortablejs", "jquery"], function(Sortable, $) {
sortable = Sortable;
jq = $;
checkErrors();
factory(Sortable, $);
});
} catch(err) {
checkErrors();
}
return;
} else if (typeof exports === 'object') {
try {
sortable = require('sortablejs');
jq = require('jquery');
} catch(err) { }
}

if (typeof jQuery === 'function' || typeof $ === 'function') {
jq = jQuery || $;
}

if (typeof Sortable !== 'undefined') {
sortable = Sortable;
}

function checkErrors() {
if (!jq) {
throw new Error('jQuery is required for jquery-sortablejs');
}

if (!sortable) {
throw new Error('SortableJS is required for jquery-sortablejs (https://github.com/SortableJS/Sortable)');
}
}
checkErrors();
factory(sortable, jq);
})(function (Sortable, $) {
"use strict";

$.fn.sortable = function (options) {
var retVal,
args = arguments;

this.each(function () {
var $el = $(this),
sortable = $el.data('sortable');

if (!sortable && (options instanceof Object || !options)) {
sortable = new Sortable(this, options);
$el.data('sortable', sortable);
} else if (sortable) {
if (options === 'destroy') {
sortable.destroy();
$el.removeData('sortable');
} else if (options === 'widget') {
retVal = sortable;
} else if (typeof sortable[options] === 'function') {
retVal = sortable[options].apply(sortable, [].slice.call(args, 1));
} else if (options in sortable.options) {
retVal = sortable.option.apply(sortable, args);
}
}
});

return (retVal === void 0) ? this : retVal;
};
});
(function (factory) {
"use strict";
var sortable,
jq,
_this = this
;

if (typeof define === "function" && define.amd) {
try {
define(["sortablejs", "jquery"], function(Sortable, $) {
sortable = Sortable;
jq = $;
checkErrors();
factory(Sortable, $);
});
} catch(err) {
checkErrors();
}
return;
} else if (typeof exports === 'object') {
try {
sortable = require('sortablejs');
jq = require('jquery');
} catch(err) { }
}

if (typeof jQuery === 'function' || typeof $ === 'function') {
jq = jQuery || $;
}

if (typeof Sortable !== 'undefined') {
sortable = Sortable;
}

function checkErrors() {
if (!jq) {
throw new Error('jQuery is required for jquery-sortablejs');
}

if (!sortable) {
throw new Error('SortableJS is required for jquery-sortablejs (https://github.com/SortableJS/Sortable)');
}
}
checkErrors();
factory(sortable, jq);
})(function (Sortable, $) {
"use strict";

$.fn.sortable = function (options) {
var retVal,
args = arguments;

this.each(function () {
var $el = $(this),
sortable = $el.data('sortable');

if (!sortable && (options instanceof Object || !options)) {
sortable = new Sortable(this, options);
$el.data('sortable', sortable);
} else if (sortable) {
if (options === 'destroy') {
sortable.destroy();
$el.removeData('sortable');
} else if (options === 'widget') {
retVal = sortable;
} else if (typeof sortable[options] === 'function') {
retVal = sortable[options].apply(sortable, [].slice.call(args, 1));
} else if (options in sortable.options) {
retVal = sortable.option.apply(sortable, args);
}
}
});

return (retVal === void 0) ? this : retVal;
};
});
10 changes: 5 additions & 5 deletions app/admin/formwidgets/scheduleeditor/schedules.blade.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<div class="row">
@foreach ($schedules as $schedule)
<div class="col-lg-4 py-3">
<div class="d-flex flex-nowrap overflow-auto">
@foreach ($schedules as $scheduleCode => $schedule)
<div class="col-lg-3 {{ $loop->first ? 'py-2 pr-2 pl-0' : 'p-2' }}">
<div
id="{{ $this->getId('item-'.$loop->iteration) }}"
class="card bg-light shadow-sm mb-0"
data-editor-control="load-schedule"
data-schedule-code="{{ $schedule->name }}"
data-schedule-code="{{ $scheduleCode }}"
role="button"
>
<div class="card-body">
<div class="flex-fill">
<h5 class="card-title">{{ lang('admin::lang.text_'.$schedule->name).' '.lang('admin::lang.locations.text_schedule') }}</h5>
<h5 class="card-title">{{ lang($schedule->name).' '.lang('admin::lang.locations.text_schedule') }}</h5>
<p class="card-text">{{ lang('admin::lang.locations.text_'.$schedule->type) }}</p>
</div>

Expand Down
8 changes: 7 additions & 1 deletion app/admin/language/en/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,11 @@
'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_delivery_cancellation_timeout' => 'Delivery Order Cancellation Timeout',
'label_collection_cancellation_timeout' => 'Pick-up Order Cancellation Timeout',
'label_delivery_add_lead_time' => 'Add Lead Time to Delivery Start Time',
'label_collection_add_lead_time' => 'Add Lead Time to Pick-up Start Time',
'label_reservation_include_start_time' => 'Include Start Time in Reservation Timeslots',
'label_payments' => 'Payments',
'label_offer_reservation' => 'Offer Reservations',
'label_reservation_time_interval' => 'Reservation Time Interval',
Expand Down Expand Up @@ -600,6 +603,9 @@
'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_delivery_add_lead_time' => 'Disabling will start the delivery timeslots from the scheduled open time.',
'help_collection_add_lead_time' => 'Disabling will start the pickup timeslots from the scheduled open time.',
'help_reservation_include_start_time' => 'Disabling will start the reservation timeslots from the scheduled open time plus stay time.',
'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 Down
Loading

0 comments on commit 0c08f3c

Please sign in to comment.