Skip to content

Commit

Permalink
Use locale dates formats in order and reservation emails
Browse files Browse the repository at this point in the history
fixes tastyigniter/ti-ext-reservation#30

Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com>
  • Loading branch information
sampoyigi committed Jun 14, 2022
1 parent f499635 commit 3f5303e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
12 changes: 5 additions & 7 deletions app/admin/models/Orders_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,17 +361,15 @@ public function mailGetData()
$data['order_comment'] = $model->comment;

$data['order_type'] = $model->order_type_name;
$data['order_time'] = Carbon::createFromTimeString($model->order_time)->format(lang('system::lang.php.time_format'));
$data['order_date'] = $model->order_date->format(lang('system::lang.php.date_format'));
$data['order_added'] = $model->created_at->format(lang('system::lang.php.date_time_format'));
$data['order_time'] = Carbon::createFromTimeString($model->order_time)->isoFormat(lang('system::lang.moment.time_format'));
$data['order_date'] = $model->order_date->isoFormat(lang('system::lang.moment.date_format'));
$data['order_added'] = $model->created_at->isoFormat(lang('system::lang.moment.date_time_format'));

$data['invoice_id'] = $model->invoice_number;
$data['invoice_number'] = $model->invoice_number;
$data['invoice_date'] = $model->invoice_date ? $model->invoice_date->format(lang('system::lang.php.date_format')) : null;
$data['invoice_date'] = $model->invoice_date ? $model->invoice_date->isoFormat(lang('system::lang.moment.date_format')) : null;

$data['order_payment'] = ($model->payment_method)
? $model->payment_method->name
: lang('admin::lang.orders.text_no_payment');
$data['order_payment'] = $model->payment_method->name ?? lang('admin::lang.orders.text_no_payment');

$data['order_menus'] = [];
$menus = $model->getOrderMenusWithOptions();
Expand Down
4 changes: 2 additions & 2 deletions app/admin/models/Reservations_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,8 @@ public function mailGetData()
$data['reservation'] = $model;
$data['reservation_number'] = $model->reservation_id;
$data['reservation_id'] = $model->reservation_id;
$data['reservation_time'] = Carbon::createFromTimeString($model->reserve_time)->format(lang('system::lang.php.time_format'));
$data['reservation_date'] = $model->reserve_date->format(lang('system::lang.php.date_format_long'));
$data['reservation_time'] = Carbon::createFromTimeString($model->reserve_time)->isoFormat(lang('system::lang.moment.time_format'));
$data['reservation_date'] = $model->reserve_date->isoFormat(lang('system::lang.moment.date_format_long'));
$data['reservation_guest_no'] = $model->guest_num;
$data['first_name'] = $model->first_name;
$data['last_name'] = $model->last_name;
Expand Down

0 comments on commit 3f5303e

Please sign in to comment.