Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
sampoyigi committed Nov 1, 2021
2 parents 14fc954 + 06257cd commit efd709c
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 22 deletions.
6 changes: 3 additions & 3 deletions app/admin/formwidgets/Connector.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ public function loadAssets()

public function getSaveValue($value)
{
if (!$this->sortable)
return FormField::NO_SAVE_DATA;

return (array)$this->processSaveValue($value);
}

Expand Down Expand Up @@ -229,9 +232,6 @@ protected function processLoadValue()

protected function processSaveValue($value)
{
if (!$this->sortable)
return FormField::NO_SAVE_DATA;

$items = $this->formField->value;
if (!$items instanceof Collection)
return $items;
Expand Down
2 changes: 1 addition & 1 deletion app/admin/formwidgets/ScheduleEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ protected function listSchedules()
return $this->schedulesCache;

$schedules = [];
foreach ($this->availableSchedules as $scheduleCode) {
foreach ($this->model->availableWorkingTypes() as $scheduleCode) {
$schedules[$scheduleCode] = $this->model->createScheduleItem($scheduleCode);
}

Expand Down
2 changes: 1 addition & 1 deletion app/admin/formwidgets/codeeditor/codeeditor.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ class="field-codeeditor size-{{ $size }}"
id="{{ $this->getId('textarea') }}"
rows="20"
class="form-control"
>{!! trim($value) !!}</textarea>
>{{ trim($value) }}</textarea>
</div>
@endif
5 changes: 4 additions & 1 deletion app/admin/traits/HasWorkingHours.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Admin\Classes\ScheduleItem;
use Carbon\Carbon;
use Exception;
use Igniter\Flame\Location\OrderTypes;
use Igniter\Flame\Location\WorkingSchedule;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Event;
Expand Down Expand Up @@ -41,7 +42,9 @@ public function getCurrentTime()

public function availableWorkingTypes()
{
return [static::OPENING, static::DELIVERY, static::COLLECTION];
return array_merge([
static::OPENING,
], collect(OrderTypes::instance()->listOrderTypes())->keys()->all());
}

public function listWorkingHours()
Expand Down
2 changes: 1 addition & 1 deletion app/admin/views/_mail/invite.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
subject = "Invitation to access {{ $site_name }}}"
subject = "Invitation to access {{ $site_name }}"
description = "Invite a new staff to access the TastyIgniter Admin"
==
{{ $staff_name }}, you've been invited to access {{ $site_name }}
Expand Down
2 changes: 1 addition & 1 deletion app/admin/views/_mail/invite_customer.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
subject = "Invitation to access {{ $site_name }}}"
subject = "Invitation to access {{ $site_name }}"
description = "Invite a new customer to access the website"
==
{{ $full_name }}, you've been invited to access {{ $site_name }}
Expand Down
2 changes: 1 addition & 1 deletion app/admin/widgets/Lists.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ protected function validateModel()
*/
protected function parseTableName($sql, $table)
{
return str_replace('@', $table.'.', $sql);
return str_replace('@', DB::getTablePrefix().$table.'.', $sql);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions app/main/template/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,14 @@ public static function getDropdownOptions(Theme $theme = null, $skipCache = FALS

/**
* Returns the unique id of this object.
* ex. account/login.php => account-login
* @return \Main\Classes\Theme
* ex. account/login.blade.php => account-login
* @return string
*/
public function getId()
{
$fileName = $this->getBaseFileName();

return str_replace('/', '-', $fileName);
return str_replace('/', '-', str_before($fileName, '.blade'));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/system/assets/ui/js/updates.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@

$button.attr('disabled', true)

$form.request('onApplyItems').always(function () {
$form.request('onApplyRecommended').always(function () {
$modal.modal('hide')
}).done(function (json) {
if (json['steps'])
Expand Down
5 changes: 3 additions & 2 deletions app/system/classes/BaseComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ public function onRender()

/**
* Renders a requested partial in context of this component,
* @see \Main\Classes\MainController::renderPartial for usage.
* @return mixed
* @see \Main\Classes\MainController::renderPartial for usage.
*/
public function renderPartial()
{
Expand Down Expand Up @@ -150,7 +150,8 @@ public function getEventHandler($handler)

public function param($name, $default = null)
{
if (is_null($segment = $this->controller->param($name, $default)))
$segment = $this->controller->param($name);
if (is_null($segment))
$segment = input($name);

return is_null($segment) ? $default : $segment;
Expand Down
7 changes: 4 additions & 3 deletions app/system/classes/UpdateManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function down()
}

// Rollback app
$modules = Config::get('system.modules', []);
$modules = array_reverse(Config::get('system.modules', []));
foreach ($modules as $module) {
$path = $this->getMigrationPath($module);
$this->migrator->rollbackAll([$module => $path]);
Expand Down Expand Up @@ -465,9 +465,10 @@ public function getIgnoredUpdates()

public function isMarkedAsIgnored($code)
{
$ignoredUpdates = $this->getIgnoredUpdates();
if (!array_key_exists($code, $this->getInstalledItems()))
return FALSE;

return array_get($ignoredUpdates, $code, FALSE);
return array_get($this->getIgnoredUpdates(), $code, FALSE);
}

public function setSecurityKey($key, $info)
Expand Down
22 changes: 18 additions & 4 deletions app/system/traits/ManagesUpdates.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,30 @@ public function search()
return $json;
}

public function onApplyItems()
public function onApplyRecommended()
{
$items = post('items') ?? [];
$itemsCodes = post('install_items') ?? [];
if (!count($items) OR !count($itemsCodes))
$items = collect(post('items') ?? [])->whereIn('name', $itemsCodes);
if ($items->isEmpty())
throw new ApplicationException(lang('system::lang.updates.alert_no_items'));

$this->validateItems();

$items = collect($items)->whereIn('name', $itemsCodes)->all();
$response = UpdateManager::instance()->requestApplyItems($items->all());
$response = array_get($response, 'data', []);

return [
'steps' => $this->buildProcessSteps($response, $items),
];
}

public function onApplyItems()
{
$items = post('items') ?? [];
if (!count($items))
throw new ApplicationException(lang('system::lang.updates.alert_no_items'));

$this->validateItems();

$response = UpdateManager::instance()->requestApplyItems($items);
$response = array_get($response, 'data', []);
Expand Down

0 comments on commit efd709c

Please sign in to comment.