Add restaurant/café mode: floor, open tabs, and kitchen display (Phase 1)
Deploy Ladill POS / deploy (push) Successful in 30s
Deploy Ladill POS / deploy (push) Successful in 30s
Gated by a per-location service_style (retail | restaurant). Restaurant mode adds: - Floor screen with tables (areas, seats, status) — tap a free table to open a dine-in tab; takeaway/counter orders open from the same screen. - Open tickets (tabs): a sale stays pending while items are added; lines persist as you go (posTicket Alpine component posts each change to the server). - Send-to-kitchen fires un-sent lines; a polling Kitchen Display (KDS) shows active tickets and bumps items queued → preparing → ready → served. - Settlement reuses the existing cash / Ladill Pay flow; paying closes the tab and frees the table (PosSaleService::closeTicket, wired into both pay paths). - Settings gains the mode toggle and a tables manager. Schema is additive (new pos_tables; service_style on locations; order/kitchen columns on sales + lines). Retail flow is untouched. Sidebar surfaces Floor + Kitchen only in restaurant mode. New PosRestaurantTest covers the dine-in lifecycle end to end; suite green (10 passed). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
e9a0c92308
commit
d9e4b6e06e
@@ -8,18 +8,33 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class PosLocation extends Model
|
||||
{
|
||||
public const STYLE_RETAIL = 'retail';
|
||||
|
||||
public const STYLE_RESTAURANT = 'restaurant';
|
||||
|
||||
protected $fillable = [
|
||||
'owner_ref',
|
||||
'name',
|
||||
'currency',
|
||||
'service_style',
|
||||
'receipt_footer',
|
||||
];
|
||||
|
||||
public function isRestaurant(): bool
|
||||
{
|
||||
return $this->service_style === self::STYLE_RESTAURANT;
|
||||
}
|
||||
|
||||
public function products(): HasMany
|
||||
{
|
||||
return $this->hasMany(PosProduct::class, 'location_id');
|
||||
}
|
||||
|
||||
public function tables(): HasMany
|
||||
{
|
||||
return $this->hasMany(PosTable::class, 'location_id');
|
||||
}
|
||||
|
||||
public function sales(): HasMany
|
||||
{
|
||||
return $this->hasMany(PosSale::class, 'location_id');
|
||||
|
||||
@@ -21,12 +21,29 @@ class PosSale extends Model
|
||||
|
||||
public const METHOD_CASH = 'cash';
|
||||
|
||||
public const ORDER_COUNTER = 'counter';
|
||||
|
||||
public const ORDER_DINE_IN = 'dine_in';
|
||||
|
||||
public const ORDER_TAKEAWAY = 'takeaway';
|
||||
|
||||
public const KITCHEN_NONE = 'none';
|
||||
|
||||
public const KITCHEN_ACTIVE = 'active';
|
||||
|
||||
public const KITCHEN_SERVED = 'served';
|
||||
|
||||
protected $fillable = [
|
||||
'owner_ref',
|
||||
'location_id',
|
||||
'table_id',
|
||||
'reference',
|
||||
'status',
|
||||
'payment_method',
|
||||
'order_type',
|
||||
'kitchen_status',
|
||||
'covers',
|
||||
'notes',
|
||||
'pay_order_id',
|
||||
'payment_reference',
|
||||
'customer_name',
|
||||
@@ -37,6 +54,9 @@ class PosSale extends Model
|
||||
'total_minor',
|
||||
'currency',
|
||||
'paid_at',
|
||||
'opened_at',
|
||||
'kitchen_sent_at',
|
||||
'closed_at',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
@@ -46,7 +66,11 @@ class PosSale extends Model
|
||||
'total_minor' => 'integer',
|
||||
'pay_order_id' => 'integer',
|
||||
'crm_customer_id' => 'integer',
|
||||
'covers' => 'integer',
|
||||
'paid_at' => 'datetime',
|
||||
'opened_at' => 'datetime',
|
||||
'kitchen_sent_at' => 'datetime',
|
||||
'closed_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -55,6 +79,26 @@ class PosSale extends Model
|
||||
return $this->belongsTo(PosLocation::class, 'location_id');
|
||||
}
|
||||
|
||||
public function table(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(PosTable::class, 'table_id');
|
||||
}
|
||||
|
||||
public function isOpen(): bool
|
||||
{
|
||||
return $this->status === self::STATUS_PENDING;
|
||||
}
|
||||
|
||||
public function isDineIn(): bool
|
||||
{
|
||||
return $this->order_type === self::ORDER_DINE_IN;
|
||||
}
|
||||
|
||||
public function scopeOpenTickets(Builder $query): Builder
|
||||
{
|
||||
return $query->where('status', self::STATUS_PENDING);
|
||||
}
|
||||
|
||||
public function lines(): HasMany
|
||||
{
|
||||
return $this->hasMany(PosSaleLine::class)->orderBy('position');
|
||||
|
||||
@@ -7,6 +7,19 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class PosSaleLine extends Model
|
||||
{
|
||||
public const KITCHEN_NEW = 'new';
|
||||
|
||||
public const KITCHEN_QUEUED = 'queued';
|
||||
|
||||
public const KITCHEN_PREPARING = 'preparing';
|
||||
|
||||
public const KITCHEN_READY = 'ready';
|
||||
|
||||
public const KITCHEN_SERVED = 'served';
|
||||
|
||||
/** States the KDS bump button cycles through, in order. */
|
||||
public const KITCHEN_FLOW = [self::KITCHEN_QUEUED, self::KITCHEN_PREPARING, self::KITCHEN_READY, self::KITCHEN_SERVED];
|
||||
|
||||
protected $fillable = [
|
||||
'pos_sale_id',
|
||||
'product_id',
|
||||
@@ -15,6 +28,8 @@ class PosSaleLine extends Model
|
||||
'quantity',
|
||||
'line_total_minor',
|
||||
'position',
|
||||
'kitchen_state',
|
||||
'notes',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class PosTable extends Model
|
||||
{
|
||||
public const STATUS_FREE = 'free';
|
||||
|
||||
public const STATUS_OCCUPIED = 'occupied';
|
||||
|
||||
public const STATUS_BILL_REQUESTED = 'bill_requested';
|
||||
|
||||
protected $fillable = [
|
||||
'owner_ref',
|
||||
'location_id',
|
||||
'area',
|
||||
'label',
|
||||
'seats',
|
||||
'status',
|
||||
'current_sale_id',
|
||||
'position',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'seats' => 'integer',
|
||||
'current_sale_id' => 'integer',
|
||||
'position' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
public function location(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(PosLocation::class, 'location_id');
|
||||
}
|
||||
|
||||
public function currentSale(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(PosSale::class, 'current_sale_id');
|
||||
}
|
||||
|
||||
public function isFree(): bool
|
||||
{
|
||||
return $this->status === self::STATUS_FREE;
|
||||
}
|
||||
|
||||
public function scopeOwned(Builder $query, string $ownerRef): Builder
|
||||
{
|
||||
return $query->where('owner_ref', $ownerRef);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user