One large-type page for the front desk (Hotel Reservation System > Rezeption, first menu entry): - today's arrivals, departures, guests in house and overdue arrivals, each guest as a card with big room number, name, people, nights, room type and booking source - one obvious button per guest: Einchecken / Auschecken (and "Früher abreisen"); after each action a big confirmation with "Rückgängig" instead of confirm dialogs; Post/Redirect/Get so reload never repeats - uses HotelBookingDetail::changeStatus(), so status history and hooks (casposbridge posts the nights) run as in the order page; check-out does not require payment in QloApps because guests pay at the POS - shows the CASPOS state per guest; other days are read-only - tiles to Belegungsplan and Neue Reservierung (Book Now) - employee profile "Rezeption" that only sees Rezeption, Belegungsplan, Book Now, orders, customers, carts and guest registration cards - docker/test-frontdesk.php: 21 checks with throw-away guests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
78 lines
2.8 KiB
PHP
78 lines
2.8 KiB
PHP
<?php
|
|
|
|
require_once _PS_MODULE_DIR_.'frontdesk/classes/FrontDeskPage.php';
|
|
|
|
class AdminFrontDeskController extends ModuleAdminController
|
|
{
|
|
public function __construct()
|
|
{
|
|
$this->bootstrap = true;
|
|
$this->display = 'view';
|
|
parent::__construct();
|
|
$this->meta_title = 'Rezeption';
|
|
}
|
|
|
|
public function initToolbar()
|
|
{
|
|
parent::initToolbar();
|
|
$this->toolbar_btn = array();
|
|
}
|
|
|
|
public function initPageHeaderToolbar()
|
|
{
|
|
parent::initPageHeaderToolbar();
|
|
$this->page_header_toolbar_btn = array();
|
|
}
|
|
|
|
protected function day()
|
|
{
|
|
$day = Tools::getValue('day');
|
|
return $day && Validate::isDate($day) ? date('Y-m-d', strtotime($day)) : date('Y-m-d');
|
|
}
|
|
|
|
public function postProcess()
|
|
{
|
|
if (!Tools::isSubmit('submitFrontDesk')) {
|
|
return parent::postProcess();
|
|
}
|
|
if (!$this->tabAccess['edit']) {
|
|
$this->errors[] = 'Keine Berechtigung.';
|
|
return;
|
|
}
|
|
$id = (int)Tools::getValue('id_booking');
|
|
$action = Tools::getValue('fd_action');
|
|
$service = new FrontDeskService((int)$this->context->language->id);
|
|
list($ok, $msg) = $service->act($id, $action, (int)$this->context->employee->id);
|
|
$undo = array('checkin' => 'undo_checkin', 'checkout' => 'undo_checkout');
|
|
$flash = array('ok' => (bool)$ok, 'msg' => $msg, 'undo' => $ok && isset($undo[$action]) ? array($id, $undo[$action]) : null);
|
|
$this->context->cookie->frontdesk_flash = json_encode($flash);
|
|
$this->context->cookie->write();
|
|
// Post/Redirect/Get: reloading the page must not repeat the action
|
|
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&day='.$this->day());
|
|
}
|
|
|
|
public function renderView()
|
|
{
|
|
$flash = null;
|
|
if (!empty($this->context->cookie->frontdesk_flash)) {
|
|
$flash = json_decode($this->context->cookie->frontdesk_flash, true);
|
|
unset($this->context->cookie->frontdesk_flash);
|
|
$this->context->cookie->write();
|
|
}
|
|
$link = $this->context->link;
|
|
$page = new FrontDeskPage(
|
|
new FrontDeskService((int)$this->context->language->id),
|
|
$this->day(),
|
|
self::$currentIndex.'&token='.$this->token,
|
|
array(
|
|
'planUrl' => Tab::getIdFromClassName('AdminOccupancyPlan') ? $link->getAdminLink('AdminOccupancyPlan') : null,
|
|
'reserveUrl' => $link->getAdminLink('AdminHotelRoomsBooking'),
|
|
'orderUrl' => function ($idOrder) use ($link) {
|
|
return $link->getAdminLink('AdminOrders').'&id_order='.(int)$idOrder.'&vieworder';
|
|
},
|
|
)
|
|
);
|
|
return $page->render($flash);
|
|
}
|
|
}
|