Skip to content

Commit

Permalink
update col names to match new laravel
Browse files Browse the repository at this point in the history
  • Loading branch information
CupNoodles committed Nov 8, 2021
1 parent aae8f33 commit 4f0e1cc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
Empty file modified assets/js/ordermenuedit.js
100644 → 100755
Empty file.
9 changes: 5 additions & 4 deletions controllers/Orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,22 +164,23 @@ public function edit_onSave($context, $recordId){
}
else{


// order_line_ready is a checkbox, fill it in as false if we don't get a value in post data.
if(!isset($vals['order_line_ready'])){
$vals['order_line_ready'] = 0;
}
if(isset($vals['actual_amt']) && $vals['actual_amt'] == ''){
$vals['actual_amt'] = null;
}
$new_qty = $vals['actual_amt'] ? $vals['actual_amt'] : $model->quantity;

$vals['subtotal'] = ($vals['actual_amt'] ? $vals['actual_amt'] : $model->quantity ) * $model->price;

$update_str = '';
$price_diff = 0;

$options = Menu_item_options_model::where('menu_id', $model->menu_id)->get();
foreach($options as $menu_option){
if(isset($vals['menu_options']) && isset($vals['menu_options'][$menu_option->menu_option_id]) ){ // update or insert
$price_diff = 0;

foreach($vals['menu_options'] as $order_menu_option_id=>$option_values_str){

$option_values = json_decode($option_values_str, false);
Expand Down Expand Up @@ -231,7 +232,7 @@ public function edit_onSave($context, $recordId){
}
}
$model->price = $menus_model->menu_price + $price_diff;
$model->subtotal = $model->price * $price_qty;
$model->subtotal = $model->price * $new_qty;


if($update_str != ''){
Expand Down
Empty file modified models/Order_Menu_Options.php
100644 → 100755
Empty file.
6 changes: 3 additions & 3 deletions models/config/orders_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
'label' => 'lang:admin::lang.orders.column_total',
'type' => 'currency',
],
'date_added' => [
'created_at' => [
'label' => 'lang:admin::lang.column_date_added',
'type' => 'timesince',
'invisible' => TRUE,
Expand Down Expand Up @@ -297,7 +297,7 @@
'type' => 'textarea',
'disabled' => TRUE,
],
'date_added' => [
'created_at' => [
'label' => 'lang:admin::lang.orders.label_date_added',
'type' => 'datepicker',
'mode' => 'date',
Expand All @@ -312,7 +312,7 @@
'span' => 'right',
'context' => ['edit', 'preview'],
],
'date_modified' => [
'updated_at' => [
'label' => 'lang:admin::lang.orders.label_date_modified',
'type' => 'datepicker',
'mode' => 'date',
Expand Down

0 comments on commit 4f0e1cc

Please sign in to comment.