75386c354a
Schema: - shop_customers (company_id, name, phone unique-per-tenant, email, password, client_id auto-linked, last_login_at) - online_orders.shop_customer_id nullable FK Auth: - New 'shop' guard (session driver, shop_customers provider) in config/auth.php - ShopCustomer Authenticatable with hashed password cast and BelongsToTenant global scope — login attempts naturally scoped to current tenant subdomain Flow: - ShopAuthController: register / login / logout / account - Register auto-links to existing Client by phone match - /shop/account: order history (only the logged customer's orders) + profile - Checkout prefills name/phone/email from logged customer + sets shop_customer_id (and client_id from auto-link) on the placed order - Layout nav switches between Login/Register and "👤 Name + Ieșire" Tests (8 new): - register creates customer + auto-login - register auto-links existing Client by phone - duplicate phone rejected - login validates credentials - /account requires auth (redirects to /shop/login) - /account lists only the logged customer's orders - checkout attaches shop_customer_id - customers tenant-isolated Full suite: 117 passed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
48 lines
1.9 KiB
PHP
48 lines
1.9 KiB
PHP
@extends('shop.layout')
|
|
@section('title', 'Contul meu')
|
|
@section('content')
|
|
@php
|
|
$currency = $tenant->settings['currency'] ?? 'MDL';
|
|
$statuses = \App\Models\Tenant\OnlineOrder::STATUSES;
|
|
@endphp
|
|
|
|
<h1 style="font-size:22px;margin-bottom:16px;">Salut, {{ $customer->name }}!</h1>
|
|
|
|
<div class="card" style="margin-bottom:16px;">
|
|
<h3 style="font-size:15px;margin-bottom:10px;">Date contact</h3>
|
|
<p class="muted">📞 {{ $customer->phone }}</p>
|
|
@if ($customer->email)<p class="muted">✉️ {{ $customer->email }}</p>@endif
|
|
</div>
|
|
|
|
<h2 style="font-size:18px;margin-bottom:12px;">Comenzile mele ({{ $orders->count() }})</h2>
|
|
|
|
@if ($orders->isEmpty())
|
|
<div class="card" style="text-align:center;padding:32px;">
|
|
<p class="muted">Nu ai nicio comandă încă.</p>
|
|
<a class="btn" href="/shop" style="margin-top:12px;">Vezi catalogul</a>
|
|
</div>
|
|
@else
|
|
<div class="card">
|
|
<table class="cart">
|
|
<thead>
|
|
<tr>
|
|
<th>Nr.</th><th>Data</th><th>Articole</th><th class="r">Total</th><th>Status</th><th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach ($orders as $order)
|
|
<tr>
|
|
<td><strong>#{{ $order->number }}</strong></td>
|
|
<td>{{ $order->created_at->format('d.m.Y') }}</td>
|
|
<td>{{ $order->items()->count() }}</td>
|
|
<td class="r">{{ number_format((float) $order->total, 2) }} {{ $currency }}</td>
|
|
<td><span class="status-pill" style="font-size:11px;">{{ $statuses[$order->status] ?? $order->status }}</span></td>
|
|
<td><a href="{{ $order->trackingUrl() }}" class="muted" style="text-decoration:underline;">Detalii →</a></td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@endif
|
|
@endsection
|