By Chason ArthurRevision 114.009Updated

03 / Vue + TypeScript + Laravel

Build a quote.
Check the rules.

Explore a service catalog, request a quote, review it, and turn it into a synthetic order. Trace every decision through the workflow.

Build it step by step with Chason Arthur ↗

Loading the portal. If it does not open, reload with JavaScript enabled or read the tutorial and source below.

Computer tutorial script and chapter outline

Chapter: {{ currentChapter.title }} {{ currentChapter.objective }} Navigation only; workflow state is unchanged.

Temporary recording scene. Your first original synthetic session is held only in this tab’s memory. Saved table, category and appearance preferences are unchanged. Restore below; reloading discards both sessions.

  1. 01Catalog
  2. 02Quote
  3. 03Review
  4. 04Synthetic order

{{ busy ? 'Working in the local fixture…' : status }}

01 / Select

Service catalog

Six synthetic products. Select a SKU in the table or use the selector. Table layout, sorting and search are browser preferences.

{{ selected.category }}

{{ selected.name }}

{{ money(selected.priceCents) }} per unit · {{ selected.stock }} synthetic units in this selection snapshot

Decision trail

Every transition has a reason.

PAGE-MEMORY FIXTURE

No workflow events yet. Request a quote to start the trail.

  1. {{ event.event.replaceAll('_',' ') }}{{ event.entityId }}

Evidence / implementation boundaries

Review the pricing and approval code.

01

Compiled Vue + TypeScript

One route loads its own bundled Vue runtime. DataTables owns the catalog DOM; Vue owns the surrounding cart and workflow.

Read the TypeScript
02

Protected Laravel API

Tenant-scoped lookup, server role policy, integer-cent pricing, transactions, stock locks, idempotency keys and audit history. Disabled by default; no demo login is published.

Read the transaction service
03

Measured, with limits

Executed SQLite and MySQL tests, raw before/after plans, and a warm single-client query comparison. Hosted CI passed; persistent identity and production concurrency remain separate.

Read test and benchmark evidence

This project demonstrates implementation. It does not establish years of experience, a degree, people management, client references, production scale or completed procurement scope.

Lab discussion / Vue Dealer Portal

What would you try next?

Ask about the code, compare an approach, or describe an edge case. Reader comments are reviewed before publication.

All lab discussions

Reader comments

Open the discussion to read and add reader comments.

Read or write a comment →

Code walkthrough

Follow the implementation in code.

These short excerpts connect the lab’s behavior to its implementation. Each example links to the full tutorial step for its context, tradeoffs and checkpoint. Names and dependencies belong to that source; the excerpts are not standalone programs.

Example 01 · Tutorial excerpt

Keep money, identity and history explicit.

Define a catalog-to-quote-to-order contract before adding buttons. Complete Step 1 and read src/domain.ts and the migration. The catalog has six invented products; dealers and user identities are synthetic. Fixture dealer IDs D001/D002 connect to the Lab's synthetic network by identifier, not to real businesses.

interface CartItem { sku: string; quantity: number }
interface QuoteLine extends CartItem { unitPriceCents: number }
interface Quote {
  id: string; items: QuoteLine[]; subtotalCents: number;
  status: 'pending' | 'approved' | 'converted'; expiresAt: number;
}

Read the full tutorial step

Example 02 · Tutorial excerpt

Retry an existing decision before evaluating a new one

Define a catalog-to-quote-to-order contract before adding buttons. Complete Step 1 and read src/domain.ts and the migration. The catalog has six invented products; dealers and user identities are synthetic. Fixture dealer IDs D001/D002 connect to the Lab's synthetic network by identifier, not to real businesses.

const sorted = items.map(({sku,quantity}) => ({sku,quantity}))
  .sort((a,b) => a.sku.localeCompare(b.sku));
const previous = this.quoteRequests.get(key);
// Existing key: compare canonical body; return original decision.
// New key: now check current stock before creating a quote.

Read the full tutorial step

Example 03 · Tutorial excerpt

Let Vue and DataTables own different surfaces.

Render a usable catalog with persistent table preferences and an accessible product selector. Complete the data contract. Know which component owns each DOM subtree.

// Vue owns the surrounding workflow; the shared table owns this host.
table = await typedTable({
  element: '#catalog-table', tableId: 'dealer-catalog',
  columns: [{key: 'sku', title: 'SKU'}, /* stable named columns */],
  data: rows(), onSelect: selectProduct
});
// Update the table through its API; never Vue v-for inside its tbody.
table.replace(rows());
// Bootstrap/restore discloses selection without changing the saved page.
table.select(selected.value.sku, {reveal:false});

Read the full tutorial step

Example 04 · Tutorial excerpt

Authorize the action where the record lives.

Protect the server independently of the displayed role. Complete the contract and interface ownership. The browser role selector is conspicuously simulated and is never an authentication credential.

// Controller: tenant scope before lookup, then server-side policy.
$quote = Quote::where('dealer_id', $request->user()->dealer_id)
    ->whereKey($id)->firstOrFail();
Gate::authorize('approve', $quote);

// Schema: bounded items, allowed fields, whole quantities.
'items' => ['required', 'array', 'min:1', 'max:10'],
'items.*' => ['required', 'array:sku,quantity'],
'items.*.quantity' => ['required', 'integer', 'min:1', 'max:100'],

Read the full tutorial step

Example 05 · Tutorial excerpt

Commit one complete decision.

Make retries safe and prevent a partial order. Complete server authorization. Use one database for quote, stock, order and audit records.

return DB::transaction(function () use ($actor, $quote, $key) {
    $locked = Quote::whereKey($quote->id)->lockForUpdate()->firstOrFail();
    // Return an existing same-key result before changing stock.
    // Require approved + unexpired; lock products in stable SKU order.
    // Re-check stock, decrement, create order, convert quote, append audit.
    return [$order, true];
}, 3);

Read the full tutorial step