Skip to content

Commit

Permalink
Add print button
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmitchell committed Jul 15, 2021
1 parent ddc0f57 commit 014fd79
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions controllers/Summary.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ public function view($route, $viewId)
'assign' => $viewSettings->display['assign'] ? Staffs_model::getDropdownOptions() : '',
'assign_url' => $assignUrl,
'assigned_to' => $order->assignee ? $order->assignee->staff_id : -1,
'print' => isset($viewSettings->display['print']) && $viewSettings->display['print'] ? \Thoughtco\Printer\Models\Printer::all()->pluck('label', 'id') : '',
];
}
}
Expand Down
2 changes: 1 addition & 1 deletion extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"code": "thoughtco.kitchendisplay",
"name": "Kitchen Display",
"description": "Provides a view of open orders, with the ability to mark orders as in preparation, ready (new status) and complete with one click.",
"version": "v2.1.0",
"version": "v2.2.0",
"author": "ryanmitchell",
"icon": {
"class": "fa fa-recycle",
Expand Down
1 change: 1 addition & 0 deletions language/en/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
'label_card_status' => 'Show status',
'label_card_items' => 'Show menu items',
'label_card_assign' => 'Show assign',
'label_card_print' => 'Show print',

'option_blank' => 'Blank',
'option_name_id' => 'Name / Order ID',
Expand Down
6 changes: 6 additions & 0 deletions models/config/views.php
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,12 @@
'type' => 'switch',
'default' => FALSE,
],
'display[print]' => !(\System\Classes\ExtensionManager::instance()->isDisabled('thoughtco.printer')) ? [
'tab' => 'lang:thoughtco.kitchendisplay::default.tab_cards',
'label' => 'thoughtco.kitchendisplay::default.label_card_print',
'type' => 'switch',
'default' => FALSE,
] : null,
]
]
],
Expand Down
18 changes: 18 additions & 0 deletions views/summary/view.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,24 @@
@endif
</div>
@endif

@if($order->print != '')
<div class="mt-4">
@if (count($order->print) > 1)
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown">@lang('thoughtco.printer::default.btn_print')</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="{{ admin_url('thoughtco/printer/printdocket?sale='.$order->id) }}">@lang('thoughtco.printer::default.btn_print_all')</a>
@foreach ($order->print as $printerid => $printer)
<a class="dropdown-item" href="{{ admin_url('thoughtco/printer/printdocket?sale='.$order->id.'&printer='.$printerid) }}">{{ $printer }}</a>
@endforeach
</div>
</div>
@else
<a class="dropdown-item" href="{{ admin_url('thoughtco/printer/printdocket?sale='.$order->id) }}">@lang('thoughtco.printer::default.btn_print')</a>
@endif
</div>
@endif

</div>
</div>
Expand Down

0 comments on commit 014fd79

Please sign in to comment.