Skip to content

Commit

Permalink
Minor fixes
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 Mar 10, 2022
1 parent e716ec3 commit 992d4ce
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
17 changes: 12 additions & 5 deletions app/admin/formwidgets/ScheduleEditor.php
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
10 changes: 5 additions & 5 deletions app/admin/formwidgets/scheduleeditor/schedules.blade.php
@@ -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
2 changes: 1 addition & 1 deletion app/main/formwidgets/components/component.blade.php
Expand Up @@ -3,7 +3,7 @@ class="components-item"
data-control="component"
data-component-alias="{{ $component->alias }}"
>
<div class="btn btn-light text-left p-3 component{{ $component->fatalError ? ' border-danger' : '' }}">
<div class="btn btn-light text-left p-3 w-100 component{{ $component->fatalError ? ' border-danger' : '' }}">
<div
class="components-item-info"
data-component-control="load"
Expand Down
1 change: 1 addition & 0 deletions app/system/models/config/mail_templates_model.php
Expand Up @@ -62,6 +62,7 @@
'label' => 'lang:admin::lang.column_date_added',
'type' => 'timetense',
'searchable' => TRUE,
'invisible' => TRUE,
],
'template_id' => [
'label' => 'lang:admin::lang.column_id',
Expand Down

0 comments on commit 992d4ce

Please sign in to comment.