Restaurant mode Phase 2: menu depth — categories, stations, modifiers, courses
Deploy Ladill POS / deploy (push) Successful in 35s

Builds on Phase 1 with the menu structure restaurants need:
- Menu setup page (restaurant mode): categories, kitchen stations, and modifier
  groups with options (price deltas).
- Products gain category, kitchen station, default course, and attached modifier
  groups (managed on the product form).
- Ordering: the ticket groups the catalog by category and, when a product has
  modifier groups, opens a picker (respects min/max select) for options + notes +
  course before adding. Effective price = base + modifier deltas (resolved
  server-side; client prices are never trusted).
- Fire-by-course: send the whole tab or just one course to the kitchen.
- KDS: filter by station; each item shows its station, course, modifiers and notes.

Schema additive (pos_categories, pos_stations, pos_modifier_groups, pos_modifiers,
product↔group pivot, pos_sale_line_modifiers; category/station/course columns on
products and lines). PosRestaurantTest covers modifiers, course and station routing;
suite green (11 passed).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
isaacclad
2026-06-24 19:58:57 +00:00
co-authored by Claude Opus 4.8
parent d9e4b6e06e
commit 50b170b0af
21 changed files with 940 additions and 38 deletions
@@ -0,0 +1,91 @@
<?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
{
Schema::create('pos_categories', function (Blueprint $table) {
$table->id();
$table->string('owner_ref')->index();
$table->string('name');
$table->unsignedInteger('position')->default(0);
$table->timestamps();
});
Schema::create('pos_stations', function (Blueprint $table) {
$table->id();
$table->string('owner_ref')->index();
$table->string('name');
$table->unsignedInteger('position')->default(0);
$table->timestamps();
});
Schema::create('pos_modifier_groups', function (Blueprint $table) {
$table->id();
$table->string('owner_ref')->index();
$table->string('name');
$table->unsignedSmallInteger('min_select')->default(0);
$table->unsignedSmallInteger('max_select')->nullable(); // null = unlimited
$table->unsignedInteger('position')->default(0);
$table->timestamps();
});
Schema::create('pos_modifiers', function (Blueprint $table) {
$table->id();
$table->foreignId('modifier_group_id')->constrained('pos_modifier_groups')->cascadeOnDelete();
$table->string('owner_ref')->index();
$table->string('name');
$table->integer('price_delta_minor')->default(0); // signed: add-ons positive, omissions negative
$table->unsignedInteger('position')->default(0);
$table->timestamps();
});
Schema::create('pos_product_modifier_group', function (Blueprint $table) {
$table->id();
$table->foreignId('product_id')->constrained('pos_products')->cascadeOnDelete();
$table->foreignId('modifier_group_id')->constrained('pos_modifier_groups')->cascadeOnDelete();
$table->unique(['product_id', 'modifier_group_id']);
});
Schema::create('pos_sale_line_modifiers', function (Blueprint $table) {
$table->id();
$table->foreignId('pos_sale_line_id')->constrained('pos_sale_lines')->cascadeOnDelete();
$table->unsignedBigInteger('modifier_id')->nullable(); // snapshot reference, plain
$table->string('name');
$table->integer('price_delta_minor')->default(0);
$table->timestamps();
});
// Plain columns (no ALTER-time FK — SQLite compat); resolved in app logic.
Schema::table('pos_products', function (Blueprint $table) {
$table->unsignedBigInteger('category_id')->nullable()->after('location_id')->index();
$table->unsignedBigInteger('station_id')->nullable()->after('category_id')->index();
$table->string('course')->nullable()->after('station_id');
});
Schema::table('pos_sale_lines', function (Blueprint $table) {
$table->unsignedBigInteger('station_id')->nullable()->after('product_id')->index();
$table->string('course')->nullable()->after('notes');
});
}
public function down(): void
{
Schema::table('pos_sale_lines', function (Blueprint $table) {
$table->dropColumn(['station_id', 'course']);
});
Schema::table('pos_products', function (Blueprint $table) {
$table->dropColumn(['category_id', 'station_id', 'course']);
});
Schema::dropIfExists('pos_sale_line_modifiers');
Schema::dropIfExists('pos_product_modifier_group');
Schema::dropIfExists('pos_modifiers');
Schema::dropIfExists('pos_modifier_groups');
Schema::dropIfExists('pos_stations');
Schema::dropIfExists('pos_categories');
}
};