Files
ladill-pos/app/Models/PosSaleLine.php
T
isaaccladandClaude Opus 4.8 d9e4b6e06e
Deploy Ladill POS / deploy (push) Successful in 30s
Add restaurant/café mode: floor, open tabs, and kitchen display (Phase 1)
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>
2026-06-24 08:38:18 +00:00

55 lines
1.3 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
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',
'name',
'unit_price_minor',
'quantity',
'line_total_minor',
'position',
'kitchen_state',
'notes',
];
protected function casts(): array
{
return [
'unit_price_minor' => 'integer',
'quantity' => 'integer',
'line_total_minor' => 'integer',
'position' => 'integer',
];
}
public function sale(): BelongsTo
{
return $this->belongsTo(PosSale::class, 'pos_sale_id');
}
public function product(): BelongsTo
{
return $this->belongsTo(PosProduct::class, 'product_id');
}
}