Add restaurant/café mode: floor, open tabs, and kitchen display (Phase 1)
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:
isaacclad
2026-06-24 08:38:18 +00:00
co-authored by Claude Opus 4.8
parent e9a0c92308
commit d9e4b6e06e
19 changed files with 1299 additions and 1 deletions
@@ -0,0 +1,66 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
// Floor plan tables for dine-in service. current_sale_id is a plain
// column (not an FK) to avoid a circular constraint with pos_sales.
Schema::create('pos_tables', function (Blueprint $table) {
$table->id();
$table->string('owner_ref')->index();
$table->foreignId('location_id')->nullable()->constrained('pos_locations')->nullOnDelete();
$table->string('area')->nullable();
$table->string('label');
$table->unsignedSmallInteger('seats')->default(2);
$table->string('status')->default('free'); // free | occupied | bill_requested
$table->unsignedBigInteger('current_sale_id')->nullable();
$table->unsignedInteger('position')->default(0);
$table->timestamps();
$table->index(['owner_ref', 'status']);
});
Schema::table('pos_locations', function (Blueprint $table) {
$table->string('service_style')->default('retail')->after('currency'); // retail | restaurant
});
Schema::table('pos_sales', function (Blueprint $table) {
$table->string('order_type')->default('counter')->after('payment_method'); // counter | dine_in | takeaway
// Plain column (no ALTER-time FK — SQLite can't add one); the table is freed in app logic.
$table->unsignedBigInteger('table_id')->nullable()->after('location_id')->index();
$table->string('kitchen_status')->default('none')->after('order_type'); // none | active | served
$table->unsignedSmallInteger('covers')->nullable()->after('kitchen_status');
$table->text('notes')->nullable()->after('covers');
$table->timestamp('opened_at')->nullable()->after('paid_at');
$table->timestamp('kitchen_sent_at')->nullable()->after('opened_at');
$table->timestamp('closed_at')->nullable()->after('kitchen_sent_at');
});
Schema::table('pos_sale_lines', function (Blueprint $table) {
$table->string('kitchen_state')->default('new')->after('position'); // new | queued | preparing | ready | served
$table->string('notes')->nullable()->after('kitchen_state');
});
}
public function down(): void
{
Schema::table('pos_sale_lines', function (Blueprint $table) {
$table->dropColumn(['kitchen_state', 'notes']);
});
Schema::table('pos_sales', function (Blueprint $table) {
$table->dropColumn(['order_type', 'table_id', 'kitchen_status', 'covers', 'notes', 'opened_at', 'kitchen_sent_at', 'closed_at']);
});
Schema::table('pos_locations', function (Blueprint $table) {
$table->dropColumn('service_style');
});
Schema::dropIfExists('pos_tables');
}
};