yoco updated to use webhook

This commit is contained in:
twotalesanimation
2025-12-29 14:43:24 +02:00
parent 6de01c13c5
commit 00b8ff77b2
123 changed files with 6959 additions and 12669 deletions
@@ -0,0 +1,749 @@
@extends('layouts.app')
@section('title', 'Request Custom Design - Additional Design')
@section('styles')
<style>
.page-intro {
margin-bottom: var(--spacing-lg);
}
.page-intro h1 {
font-family: 'Abril Fatface', cursive;
font-size: 2.5rem;
color: var(--text-primary);
margin-bottom: 0.5rem;
}
.page-intro p {
color: var(--text-secondary);
font-size: 1.1rem;
}
.form-card {
background: white;
padding: var(--spacing-lg);
border-radius: 20px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
margin-bottom: var(--spacing-lg);
max-width: 700px;
}
.form-section h2 {
font-family: 'Abril Fatface', cursive;
font-size: 1.6rem;
color: var(--text-primary);
/* margin-bottom: var(--spacing-md); */
}
.form-section {
/* margin-bottom: var(--spacing-lg); */
}
.form-section:last-child {
margin-bottom: 0;
}
.form-group {
margin-bottom: var(--spacing-md);
}
.form-group label {
display: block;
font-weight: 600;
color: var(--text-primary);
margin-bottom: 0.5rem;
}
.form-group-hint {
font-size: 0.9rem;
color: var(--text-secondary);
margin-bottom: 0.75rem;
}
.form-row {
display: grid;
grid-template-columns: 1fr 1fr;
gap: var(--spacing-sm);
}
.form-row.full {
grid-template-columns: 1fr;
}
.form-group input,
.form-group textarea,
.form-group select {
width: 100%;
padding: 0.75rem;
border: 1px solid var(--border-color);
border-radius: 4px;
font-size: 1rem;
font-family: inherit;
background-color: white;
box-sizing: border-box;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
outline: none;
border-color: var(--accent-dark);
box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}
.form-group textarea {
resize: vertical;
min-height: 120px;
}
.upload-area {
border: 2px dashed var(--border-color);
border-radius: 8px;
padding: var(--spacing-lg);
text-align: center;
cursor: pointer;
transition: var(--transition);
background-color: var(--bg-primary);
}
.upload-area:hover {
border-color: var(--accent-dark);
background-color: var(--bg-secondary);
}
.upload-area svg {
width: 48px;
height: 48px;
color: var(--text-secondary);
margin: 0 auto var(--spacing-sm);
}
.upload-area p {
margin: 0.25rem 0;
}
.upload-area .hint {
font-size: 0.85rem;
color: var(--text-secondary);
}
.file-item {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.75rem;
background-color: var(--bg-secondary);
border-radius: 4px;
margin-top: 0.5rem;
font-size: 0.9rem;
}
.file-item svg {
width: 18px;
height: 18px;
color: var(--accent-dark);
flex-shrink: 0;
}
.checkbox-group {
padding: var(--spacing-md);
background-color: var(--bg-secondary);
border-radius: 20px;
margin-bottom: var(--spacing-md);
}
.checkbox-option {
display: flex;
gap: var(--spacing-md);
cursor: pointer;
}
.checkbox-option input[type="checkbox"] {
margin-top: 2px;
cursor: pointer;
}
.checkbox-content p {
margin-bottom: 0.5rem;
}
.button-group {
display: flex;
gap: var(--spacing-md);
margin-top: var(--spacing-lg);
}
.button-group .btn {
flex: 1;
}
.btn-cancel {
background-color: var(--bg-secondary) !important;
color: var(--text-primary) !important;
border: 1px solid var(--border-color) !important;
}
.btn-cancel:hover {
background-color: var(--border-color) !important;
color: var(--text-primary) !important;
}
.error-message {
color: #c53030;
font-size: 0.9rem;
margin-top: 0.5rem;
}
.info-box {
background-color: var(--accent-light);
border: 1px solid var(--border-color);
padding: var(--spacing-lg);
border-radius: 20px;
margin-bottom: var(--spacing-lg);
}
.info-box h3 {
font-family: var(--font-sans);
font-size: 1.2rem;
font-weight: 600;
color: var(--text-primary);
margin-bottom: var(--spacing-md);
margin-top: 0;
}
.info-box ul {
list-style-position: inside;
margin: 0;
padding: 0;
}
.info-box li {
margin-bottom: 0.5rem;
}
.form-wrapper {
display: grid;
grid-template-columns: 1fr 450px;
gap: var(--spacing-lg);
margin-bottom: var(--spacing-lg);
}
.cost-summary {
height: fit-content;
position: sticky;
top: 120px;
}
.cost-summary-content {
background: white;
padding: var(--spacing-lg);
border-radius: 20px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
margin-bottom: var(--spacing-md);
}
.cost-summary-content h3 {
font-family: 'Abril Fatface', cursive;
font-size: 1.3rem;
color: var(--text-primary);
margin-bottom: var(--spacing-md);
}
.cost-item {
display: flex;
justify-content: space-between;
padding: var(--spacing-sm) 0;
border-bottom: 1px solid var(--border-color);
font-size: 0.95rem;
}
.cost-item.total {
font-weight: 700;
font-size: 1.1rem;
border-top: 2px solid var(--accent-dark);
border-bottom: none;
margin-top: var(--spacing-md);
padding-top: var(--spacing-md);
color: var(--accent-dark);
}
.cost-label {
color: var(--text-secondary);
}
.cost-value {
font-weight: 600;
color: var(--text-primary);
}
.cost-item.total .cost-value {
color: var(--accent-dark);
}
.design-fee-note {
font-size: 0.85rem;
color: var(--text-secondary);
margin-top: var(--spacing-md);
padding-top: var(--spacing-md);
border-top: 1px solid var(--border-color);
}
.cost-item.disabled {
opacity: 0.5;
color: var(--text-secondary);
}
.cost-item.discount {
color: var(--accent-pink);
}
.cost-item.discount .cost-value {
color: var(--accent-pink);
}
@media (max-width: 768px) {
.form-wrapper {
grid-template-columns: 1fr;
}
.cost-summary-content {
position: static;
}
.form-card {
padding: var(--spacing-md);
}
.form-row {
grid-template-columns: 1fr;
}
.button-group {
flex-direction: column;
}
}
</style>
@endsection
@section('content')
<div class="container" style="padding:20px;">
<div class="page-intro">
<h1>Request Custom Design</h1>
<p>Create a custom wallpaper, mural, or fabric design tailored to your needs</p>
</div>
@if ($errors->any())
<div style="background-color: #f8d7da; border: 1px solid var(--border-color); color: var(--text-primary); padding: var(--spacing-md); border-radius: 8px; margin-bottom: var(--spacing-lg);">
<h4 style="margin-top: 0;">Please correct the following errors:</h4>
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
@if (session('success'))
<div style="background-color: var(--accent-light); border: 1px solid var(--border-color); color: var(--text-primary); padding: var(--spacing-md); border-radius: 8px; margin-bottom: var(--spacing-lg);">
{{ session('success') }}
</div>
@endif
<!-- Info Box -->
<div class="info-box">
<h2>How It Works</h2>
<ul>
<li>Submit your custom order with design specifications and reference images</li>
<li>Pay a 20% non-refundable deposit to commence design work</li>
<li>Our team creates your design and prepares proofs for review</li>
<li>Pay the remaining 80% balance to proceed with printing and shipping</li>
</ul>
</div>
<!-- Form -->
<div class="form-wrapper">
<form action="{{ route('custom-orders.store') }}" method="POST" enctype="multipart/form-data" id="custom-order-form" class="form-card" data-action="{{ route('custom-orders.store') }}">
@csrf
<!-- Order Type & Dimensions -->
<div class="form-section">
<h2>Order Details</h2>
<div class="form-group">
<label for="type">Order Type *</label>
<select id="type" name="type" required>
<option value="">-- Select a type --</option>
<option value="wallpaper" {{ old('type') == 'wallpaper' ? 'selected' : '' }}>Wallpaper (tileable pattern)</option>
<option value="mural" {{ old('type') == 'mural' ? 'selected' : '' }}>Mural (large format)</option>
<option value="fabric" {{ old('type') == 'fabric' ? 'selected' : '' }}>Fabric (linear meter)</option>
</select>
@error('type')
<p class="error-message">{{ $message }}</p>
@enderror
</div>
<div class="form-row">
<div class="form-group">
<label for="width">Width (meters) *</label>
<input type="number" id="width" name="width" step="0.01" min="0.1" value="{{ old('width') }}" required>
@error('width')
<p class="error-message">{{ $message }}</p>
@enderror
</div>
<div class="form-group">
<label for="height">Height (meters) *</label>
<input type="number" id="height" name="height" step="0.01" min="0.1" value="{{ old('height') }}" required>
@error('height')
<p class="error-message">{{ $message }}</p>
@enderror
</div>
</div>
<div class="form-row">
<div class="form-group">
<label for="quantity">Quantity *</label>
<input type="number" id="quantity" name="quantity" value="{{ old('quantity', 1) }}" min="1" required>
@error('quantity')
<p class="error-message">{{ $message }}</p>
@enderror
</div>
<div class="form-group">
<label for="print_stock_id">Print Material *</label>
<select id="print_stock_id" name="print_stock_id" required>
<option value="">-- Select material --</option>
@foreach ($printStocks as $stock)
<option value="{{ $stock->id }}" {{ old('print_stock_id') == $stock->id ? 'selected' : '' }}>
{{ $stock->name }} ({{ $stock->cost_per_meter ? 'R' . number_format($stock->cost_per_meter, 2) . '/m' : 'R' . number_format($stock->cost_per_m2, 2) . '/m²' }})
</option>
@endforeach
</select>
@error('print_stock_id')
<p class="error-message">{{ $message }}</p>
@enderror
</div>
</div>
</div>
<!-- Design Brief -->
<div class="form-section">
<h2>Design Brief</h2>
<div class="form-group form-row full">
<label for="customer_brief">Design Brief (minimum 50 characters) *</label>
<p class="form-group-hint">Tell us about your design concept, colors, style, and any specific requirements</p>
<textarea id="customer_brief" name="customer_brief" placeholder="Describe your custom design vision..." minlength="50" required>{{ old('customer_brief') }}</textarea>
@error('customer_brief')
<p class="error-message">{{ $message }}</p>
@enderror
</div>
<div class="form-group form-row full">
<label for="special_instructions">Special Instructions (optional)</label>
<textarea id="special_instructions" name="special_instructions" placeholder="Any additional notes or requirements...">{{ old('special_instructions') }}</textarea>
@error('special_instructions')
<p class="error-message">{{ $message }}</p>
@enderror
</div>
</div>
<!-- Reference Images -->
<div class="form-section">
<h2>Reference Images</h2>
<div class="form-group form-row full">
<label>Upload Reference Images</label>
<p class="form-group-hint">Upload inspiration images, mood boards, or reference materials for your design</p>
<div class="upload-area" onclick="document.getElementById('reference-images').click()">
<input type="file" id="reference-images" name="reference_images[]" multiple accept="image/*" style="display: none;">
<svg fill="none" stroke="currentColor" viewBox="0 0 48 48">
<path d="M28 8H12a4 4 0 00-4 4v20m32-12v8a4 4 0 01-4 4H12a4 4 0 01-4-4v-4m32-12l-3.172-3.172a4 4 0 00-5.656 0L28 12M12 32l3.172-3.172a4 4 0 015.656 0L32 32" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
</svg>
<p style="margin: 0;">Click to upload or drag and drop</p>
<p class="hint">PNG, JPG, GIF, WebP up to 5MB</p>
</div>
<div id="file-list"></div>
@error('reference_images.*')
<p class="error-message">{{ $message }}</p>
@enderror
</div>
</div>
<!-- Library Agreement -->
<div class="form-section">
<h2>Design Library</h2>
<div class="checkbox-group">
<label class="checkbox-option">
<input type="checkbox" name="library_discount" value="1" {{ old('library_discount') ? 'checked' : '' }}>
<div class="checkbox-content">
<p style="font-weight: 600; margin-bottom: 0.25rem;">Allow us to use your design in our library</p>
<p>If you agree, we'll apply a <strong>20% discount to the design fee</strong>. This means we may offer similar designs to other customers in the future.</p>
</div>
</label>
</div>
</div>
<!-- Submit Buttons -->
<div class="button-group">
<button type="submit" class="btn">Submit Order</button>
<a href="{{ route('my-orders') }}" class="btn btn-cancel">Cancel</a>
</div>
</form>
<!-- Cost Summary Sidebar -->
<div class="cost-summary">
<div class="cost-summary-content">
<h3>Cost Summary</h3>
<div class="cost-item disabled" id="material-cost-item">
<span class="cost-label">Material Cost</span>
<span class="cost-value">-</span>
</div>
<div class="cost-item disabled" id="design-fee-item">
<span class="cost-label">Design Fee</span>
<span class="cost-value">-</span>
</div>
<div class="cost-item disabled" id="discount-item" style="display: none;">
<span class="cost-label">Library Discount</span>
<span class="cost-value">-</span>
</div>
<div class="cost-item total">
<span>Deposit Required (20%)</span>
<span class="cost-value" id="deposit-amount">R0.00</span>
</div>
<div class="design-fee-note">
<strong>Note:</strong> 20% non-refundable deposit covers design work. Pay the remaining 80% after proof approval.
</div>
</div>
<div style="background: var(--accent-light); padding: 1.5rem; border-radius: 20px; margin-bottom: 1rem;">
<p style="margin: 0 0 0.5rem 0; color: black;">Estimated Total:</p>
<div style="font-family: 'Abril Fatface', cursive; font-size: 3rem; font-weight: 400; color: white;">R<span id="total-cost">0.00</span></div>
<small style="color: #fff; display: block; margin-top: 0.5rem;">incl. VAT</small>
</div>
</div>
<!-- Total Cost Display -->
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
console.log('=== CUSTOM ORDER FORM DEBUG ===');
const form = document.getElementById('custom-order-form');
console.log('Form element:', form);
console.log('Form action:', form.action);
console.log('Form method:', form.method);
console.log('Form enctype:', form.enctype);
console.log('Form ID:', form.id);
console.log('Form classes:', form.className);
if (!form) {
console.error('FORM NOT FOUND!');
return;
}
// ===== COST CALCULATION =====
const DESIGN_FEE = 500; // Base design fee in Rands
const DISCOUNT_PERCENTAGE = 0.20; // 20% discount for library usage
// Get form inputs
const typeSelect = document.getElementById('type');
const widthInput = document.getElementById('width');
const heightInput = document.getElementById('height');
const quantityInput = document.getElementById('quantity');
const stockSelect = document.getElementById('print_stock_id');
const libraryCheckbox = document.querySelector('input[name="library_discount"]');
// Get summary elements
const materialCostItem = document.getElementById('material-cost-item');
const designFeeItem = document.getElementById('design-fee-item');
const discountItem = document.getElementById('discount-item');
const depositAmount = document.getElementById('deposit-amount');
// Store print stocks data
const printStocksData = {};
@foreach($printStocks as $stock)
printStocksData[{{ $stock->id }}] = {
name: '{{ $stock->name }}',
width: {{ $stock->width ?? 0.53 }},
costPerMeter: {{ $stock->cost_per_meter ?? 0 }},
costPerM2: {{ $stock->cost_per_m2 ?? 0 }}
};
@endforeach
function calculateCosts() {
const type = typeSelect.value;
const width = parseFloat(widthInput.value) || 0;
const height = parseFloat(heightInput.value) || 0;
const quantity = parseFloat(quantityInput.value) || 1;
const stockId = stockSelect.value;
const hasLibraryDiscount = libraryCheckbox?.checked || false;
if (!type || !stockId || width <= 0 || height <= 0) {
// Show disabled state
materialCostItem.classList.add('disabled');
designFeeItem.classList.add('disabled');
discountItem.style.display = 'none';
depositAmount.textContent = 'R0.00';
document.getElementById('total-cost').textContent = '0.00';
document.getElementById('cost-breakdown').textContent = '';
return;
}
const stock = printStocksData[stockId];
if (!stock) return;
// Calculate material cost based on type
let materialCost = 0;
let breakdown = '';
if (type === 'wallpaper') {
// Wallpaper: Takes into account stock width
// Calculate number of vertical strips needed: ceil(wall_height / stock_width)
// Calculate total length: number_of_strips × wall_width
// Cost = total_length × cost_per_meter × quantity
const stockWidth = stock.width || 0.53; // Default to standard wallpaper width if not specified
const stripsNeeded = Math.ceil(height / stockWidth);
const totalLength = stripsNeeded * width;
materialCost = totalLength * stock.costPerMeter * quantity;
breakdown = `Stock: R${stock.costPerMeter.toFixed(2)}/m × ${totalLength.toFixed(2)}m`;
} else if (type === 'mural') {
// Mural: width × height in m²
// Cost = cost_per_m2 × (width × height) × quantity
const area = width * height;
materialCost = area * stock.costPerM2 * quantity;
breakdown = `Stock: R${stock.costPerM2.toFixed(2)}/m² × ${area.toFixed(2)}m²`;
} else if (type === 'fabric') {
// Fabric: width input = length in linear meters
// Cost = cost_per_meter × length × quantity
materialCost = width * stock.costPerMeter * quantity;
breakdown = `Stock: R${stock.costPerMeter.toFixed(2)}/m × ${width.toFixed(2)}m`;
}
// Calculate design fee
let designFee = DESIGN_FEE;
let discount = 0;
if (hasLibraryDiscount) {
discount = designFee * DISCOUNT_PERCENTAGE;
designFee -= discount;
}
// Total cost
const totalCost = materialCost + designFee;
const depositRequired = totalCost * 0.20; // 20% deposit
const remainingBalance = totalCost * 0.80; // 80% remaining
// Update UI
materialCostItem.classList.remove('disabled');
materialCostItem.innerHTML = `<span class="cost-label">Material Cost</span><span class="cost-value">R${materialCost.toFixed(2)}</span>`;
designFeeItem.classList.remove('disabled');
designFeeItem.innerHTML = `<span class="cost-label">Design Fee</span><span class="cost-value">R${designFee.toFixed(2)}</span>`;
if (hasLibraryDiscount && discount > 0) {
discountItem.style.display = 'flex';
discountItem.classList.add('discount');
discountItem.innerHTML = `<span class="cost-label">Library Discount (20%)</span><span class="cost-value">-R${discount.toFixed(2)}</span>`;
} else {
discountItem.style.display = 'none';
}
depositAmount.textContent = `R${depositRequired.toFixed(2)}`;
document.getElementById('total-cost').textContent = `${totalCost.toFixed(2)}`;
document.getElementById('cost-breakdown').textContent = breakdown;
}
// Add event listeners for cost calculation
if (typeSelect) typeSelect.addEventListener('change', calculateCosts);
if (widthInput) widthInput.addEventListener('input', calculateCosts);
if (heightInput) heightInput.addEventListener('input', calculateCosts);
if (quantityInput) quantityInput.addEventListener('input', calculateCosts);
if (stockSelect) stockSelect.addEventListener('change', calculateCosts);
if (libraryCheckbox) libraryCheckbox.addEventListener('change', calculateCosts);
// Update field labels based on type
function updateFieldLabels() {
const type = typeSelect.value;
const widthLabel = document.querySelector('label[for="width"]');
const heightLabel = document.querySelector('label[for="height"]');
const heightGroup = heightInput?.parentElement;
if (type === 'wallpaper') {
if (widthLabel) widthLabel.innerHTML = 'Wall Width (meters) *';
if (heightLabel) heightLabel.innerHTML = 'Wall Height (meters) *<br><small style="font-weight: normal; color: var(--text-secondary); display: block; margin-top: 0.25rem;">The system will calculate strips needed based on stock width</small>';
if (heightGroup) heightGroup.style.display = 'block';
} else if (type === 'mural') {
if (widthLabel) widthLabel.textContent = 'Width (meters) *';
if (heightGroup) heightGroup.style.display = 'block';
if (heightLabel) heightLabel.textContent = 'Height (meters) *';
} else if (type === 'fabric') {
if (widthLabel) widthLabel.textContent = 'Length (meters) *';
if (heightGroup) heightGroup.style.display = 'none';
}
}
if (typeSelect) {
typeSelect.addEventListener('change', updateFieldLabels);
}
// Initial label update
updateFieldLabels();
// Initial calculation
calculateCosts();
// Handle reference image uploads
const referenceImagesInput = document.getElementById('reference-images');
if (referenceImagesInput) {
referenceImagesInput.addEventListener('change', function() {
const fileList = document.getElementById('file-list');
if (fileList) {
fileList.innerHTML = '';
for (let file of this.files) {
const item = document.createElement('div');
item.className = 'file-item';
item.innerHTML = `<svg fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4z" clip-rule="evenodd"/></svg><span>${file.name}</span>`;
fileList.appendChild(item);
}
}
});
}
// Find the submit button and log when it's clicked
const submitBtn = form.querySelector('button[type="submit"]');
if (submitBtn) {
console.log('Submit button found:', submitBtn);
submitBtn.addEventListener('click', function(e) {
console.log('===== SUBMIT BUTTON CLICKED =====');
console.log('Event:', e);
console.log('Form will submit to:', form.action);
});
}
// Handle form submission - FORCE IT TO SUBMIT
form.addEventListener('submit', function(e) {
console.log('===== FORM SUBMIT EVENT FIRED =====');
console.log('Event type:', e.type);
console.log('Event defaultPrevented:', e.defaultPrevented);
console.log('Action:', form.action);
console.log('Method:', form.method);
console.log('About to submit to:', form.action);
console.log('Checking if global script should skip this form...');
console.log('Form action includes /custom-orders:', form.action.includes('/custom-orders'));
// Don't prevent - let it submit naturally
});
console.log('Event listeners attached successfully');
});
</script>
@endsection
@@ -0,0 +1,150 @@
@extends('layouts.app')
@section('title', 'Deposit Payment Successful')
@section('styles')
<style>
.success-container {
max-width: 600px;
margin: var(--spacing-xl) auto;
padding: var(--spacing-xl);
background-color: var(--accent-light);
border: 2px solid var(--accent-pink);
border-radius: 20px;
text-align: center;
}
.success-icon {
font-size: 4rem;
color: var(--accent-pink);
margin-bottom: var(--spacing-md);
}
.success-title {
font-family: var(--font-serif);
font-size: 2rem;
color: var(--text-primary);
margin-bottom: var(--spacing-md);
}
.success-message {
color: var(--text-secondary);
margin-bottom: var(--spacing-lg);
font-size: 1.1rem;
}
.order-details {
background-color: white;
padding: var(--spacing-lg);
border-radius: 8px;
margin-bottom: var(--spacing-lg);
text-align: left;
}
.detail-row {
display: flex;
justify-content: space-between;
padding: var(--spacing-sm) 0;
border-bottom: 1px solid var(--border-color);
}
.detail-row:last-child {
border-bottom: none;
}
.detail-label {
color: var(--text-secondary);
font-weight: 500;
}
.detail-value {
color: var(--text-primary);
font-weight: 600;
}
.next-steps {
text-align: left;
background-color: white;
padding: var(--spacing-lg);
border-radius: 8px;
margin-bottom: var(--spacing-lg);
}
.next-steps h3 {
color: var(--text-primary);
margin-bottom: var(--spacing-md);
}
.next-steps ol {
color: var(--text-secondary);
padding-left: var(--spacing-lg);
}
.next-steps li {
margin-bottom: var(--spacing-sm);
}
.action-buttons {
display: flex;
gap: var(--spacing-md);
justify-content: center;
flex-wrap: wrap;
}
.action-buttons .btn {
flex: 1;
min-width: 150px;
}
</style>
@endsection
@section('content')
<div class="container">
<div class="success-container">
<div class="success-icon"></div>
<h1 class="success-title">Payment Successful!</h1>
<p class="success-message">
Your deposit payment has been received and processed successfully.
</p>
<div class="order-details">
<div class="detail-row">
<span class="detail-label">Order Number:</span>
<span class="detail-value">{{ $customOrder->order_number }}</span>
</div>
<div class="detail-row">
<span class="detail-label">Order Type:</span>
<span class="detail-value">{{ ucfirst($customOrder->type) }}</span>
</div>
<div class="detail-row">
<span class="detail-label">Deposit Amount:</span>
<span class="detail-value">R{{ number_format($customOrder->deposit_amount, 2) }}</span>
</div>
<div class="detail-row">
<span class="detail-label">Remaining Balance:</span>
<span class="detail-value">R{{ number_format($customOrder->balance_amount, 2) }}</span>
</div>
<div class="detail-row">
<span class="detail-label">Payment Status:</span>
<span class="detail-value"><span class="status-badge paid">Paid</span></span>
</div>
</div>
<div class="next-steps">
<h3>What Happens Next?</h3>
<ol>
<li>Your design requirements have been received</li>
<li>Our design team will review your specifications</li>
<li>You'll receive proof designs for your approval within 3-5 business days</li>
<li>Once you approve the proofs, we'll prepare for printing</li>
<li>The remaining balance (80%) will be due before printing begins</li>
</ol>
</div>
<div class="action-buttons">
<a href="{{ route('custom-orders.show', $customOrder) }}" class="btn">View Order Details</a>
<a href="{{ route('my-orders') }}" class="btn btn--secondary">Back to Orders</a>
</div>
</div>
</div>
@endsection
@@ -0,0 +1,355 @@
@extends('layouts.app')
@section('title', 'My Custom Orders')
@section('styles')
<style>
h1 {
font-family: 'Abril Fatface', cursive;
font-size: 2.5rem;
color: var(--text-primary);
margin-bottom: 0.5rem;
}
h2 {
font-family: 'Abril Fatface', cursive;
font-size: 1.6rem;
color: var(--text-primary);
margin-bottom: var(--spacing-md);
}
.page-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: var(--spacing-lg);
gap: var(--spacing-md);
}
.page-header-content {
flex: 1;
}
.page-header p {
color: var(--text-secondary);
font-size: 1rem;
}
.empty-state {
background-color: var(--bg-secondary);
border-radius: 8px;
padding: var(--spacing-xl);
text-align: center;
margin-bottom: var(--spacing-lg);
}
.empty-state-icon {
font-size: 3rem;
margin-bottom: var(--spacing-md);
}
.empty-state h2 {
margin-bottom: 0.5rem;
}
.empty-state p {
color: var(--text-secondary);
margin-bottom: var(--spacing-lg);
}
.orders-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
gap: var(--spacing-lg);
margin-bottom: var(--spacing-lg);
}
.order-card {
background: white;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
transition: var(--transition);
}
.order-card:hover {
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}
.order-card-header {
padding: var(--spacing-lg);
border-bottom: 1px solid var(--border-color);
display: flex;
justify-content: space-between;
align-items: flex-start;
}
.order-number {
font-family: var(--font-sans);
font-weight: 600;
color: var(--text-primary);
font-size: 1.1rem;
margin-bottom: 0.25rem;
}
.order-date {
color: var(--text-secondary);
font-size: 0.9rem;
}
.order-card-body {
padding: var(--spacing-lg);
}
.order-detail {
margin-bottom: var(--spacing-md);
}
.order-detail:last-child {
margin-bottom: 0;
}
.order-detail-label {
font-weight: 600;
color: var(--text-primary);
font-size: 0.9rem;
text-transform: uppercase;
letter-spacing: 0.5px;
margin-bottom: 0.25rem;
}
.order-detail-value {
color: var(--text-secondary);
font-size: 1rem;
text-transform: capitalize;
}
.order-details-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: var(--spacing-md);
}
.order-card-footer {
padding: var(--spacing-lg);
border-top: 1px solid var(--border-color);
display: flex;
gap: var(--spacing-md);
}
.order-card-footer a {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
text-decoration: none;
}
.progress-indicator {
display: flex;
gap: var(--spacing-sm);
margin-bottom: var(--spacing-md);
}
.progress-step {
flex: 1;
height: 4px;
background-color: var(--border-color);
border-radius: 2px;
overflow: hidden;
}
.progress-step.active {
background-color: var(--accent-dark);
}
.progress-step.completed {
background-color: #4caf50;
}
.status-flow {
display: flex;
align-items: center;
gap: var(--spacing-sm);
font-size: 0.85rem;
color: var(--text-secondary);
margin-bottom: var(--spacing-md);
flex-wrap: wrap;
}
.status-flow-item {
display: flex;
align-items: center;
gap: 0.25rem;
}
.status-flow-arrow {
color: var(--border-color);
margin: 0 0.25rem;
}
.alert {
padding: var(--spacing-md);
border-radius: 8px;
margin-bottom: var(--spacing-lg);
border: 1px solid;
}
.alert-success {
background-color: #e8f5e9;
border-color: #c8e6c9;
color: #2e7d32;
}
@media (max-width: 768px) {
h1 {
font-size: 2rem;
}
.page-header {
flex-direction: column;
}
.orders-grid {
grid-template-columns: 1fr;
}
.order-details-grid {
grid-template-columns: 1fr;
}
.order-card-footer {
flex-direction: column;
}
.order-card-footer a {
display: block;
}
.status-flow {
flex-direction: column;
align-items: flex-start;
}
}
</style>
@endsection
@section('content')
<div class="container" style="margin-top:20px;">
@if (session('success'))
<div class="alert alert-success">
{{ session('success') }}
</div>
@endif
<div class="page-header">
<div class="page-header-content">
<h1>My Custom Orders</h1>
<p>Track and manage your custom printing orders</p>
</div>
<a href="{{ route('custom-orders.create') }}" class="btn">Create New Order</a>
</div>
@if ($customOrders->isEmpty())
<div class="empty-state">
<div class="empty-state-icon">📋</div>
<h2>No Custom Orders Yet</h2>
<p>You haven't created any custom orders yet. Start by designing your unique print today!</p>
<a href="{{ route('custom-orders.create') }}" class="btn">Create Your First Order</a>
</div>
@else
<div class="orders-grid">
@foreach ($customOrders as $order)
<div class="order-card">
<div class="order-card-header">
<div>
<div class="order-number">Order #{{ $order->order_number }}</div>
<div class="order-date">{{ $order->created_at->format('d M Y') }}</div>
</div>
<span class="status-badge {{ $order->status }}">
{{ str_replace('_', ' ', ucfirst($order->status)) }}
</span>
</div>
<div class="order-card-body">
<!-- Progress Indicator -->
<div class="progress-indicator">
@php
$statuses = ['submitted', 'approved', 'in_production', 'proof_ready', 'completed'];
$currentIndex = array_search($order->status, $statuses);
@endphp
@foreach ($statuses as $index => $status)
<div class="progress-step {{ $index <= $currentIndex ? 'completed' : ($index === $currentIndex + 1 ? 'active' : '') }}"></div>
@endforeach
</div>
<!-- Order Details Grid -->
<div class="order-details-grid">
<div class="order-detail">
<div class="order-detail-label">Type</div>
<div class="order-detail-value">{{ ucfirst($order->type) }}</div>
</div>
<div class="order-detail">
<div class="order-detail-label">Status</div>
<div class="order-detail-value">
{{ str_replace('_', ' ', ucfirst($order->status)) }}
</div>
</div>
@if ($order->specifications)
<div class="order-detail">
<div class="order-detail-label">Quantity</div>
<div class="order-detail-value">{{ $order->specifications->quantity }}</div>
</div>
<div class="order-detail">
<div class="order-detail-label">Stock</div>
<div class="order-detail-value">
{{ $order->specifications->printStock ? $order->specifications->printStock->name : 'N/A' }}
</div>
</div>
@endif
</div>
<!-- Payment Status -->
@if ($order->total_cost)
<div class="order-detail">
<div class="order-detail-label">Total Cost</div>
<div class="order-detail-value" style="font-weight: 600; color: var(--accent-dark); font-size: 1.1rem;">
R{{ number_format($order->total_cost, 2) }}
</div>
</div>
@endif
<!-- Status Flow -->
<div class="status-flow">
<div class="status-flow-item">
<span>{{ $order->deposit_status === 'paid' ? '✓' : '○' }}</span>
<span>Deposit</span>
</div>
<div class="status-flow-arrow"></div>
<div class="status-flow-item">
<span>{{ $order->status === 'approved' ? '✓' : '○' }}</span>
<span>Approved</span>
</div>
<div class="status-flow-arrow"></div>
<div class="status-flow-item">
<span>{{ in_array($order->status, ['in_production', 'proof_ready', 'completed']) ? '✓' : '○' }}</span>
<span>Production</span>
</div>
</div>
</div>
<div class="order-card-footer">
<a href="{{ route('custom-orders.show', $order->uuid) }}">View Details</a>
@if ($order->deposit_status === 'unpaid')
<a href="{{ route('custom-orders.show', $order->uuid) }}" class="secondary">Pay Deposit</a>
@endif
</div>
</div>
@endforeach
</div>
@endif
</div>
@endsection
@@ -0,0 +1,431 @@
@extends('layouts.app')
@section('title', 'Order #' . $customOrder->order_number . ' - Custom Order Details')
@section('styles')
<style>
/* Page-specific typography overrides */
h1 {
font-family: 'Abril Fatface', cursive;
font-size: 2.5rem;
color: var(--text-primary);
margin-bottom: 0.5rem;
}
h2 {
font-family: 'Abril Fatface', cursive;
font-size: 1.6rem;
color: var(--text-primary);
margin-bottom: var(--spacing-md);
}
h3 {
font-family: var(--font-sans);
font-size: 1.1rem;
font-weight: 600;
color: var(--text-primary);
margin-bottom: 0.5rem;
}
.page-intro {
margin-bottom: var(--spacing-lg);
}
.page-intro p {
color: var(--text-secondary);
font-size: 1rem;
}
/* Timeline-specific styles */
.card {
padding: var(--spacing-lg);
margin-bottom: var(--spacing-lg);
}
.card:hover {
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.timeline-container {
background: white;
padding: var(--spacing-lg);
border-radius: 20px;
margin-bottom: var(--spacing-lg);
transition: var(--transition);
}
.timeline-container:hover {
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.timeline-title {
font-family: var(--font-serif);
font-size: 1.3rem;
color: var(--text-primary);
margin-bottom: var(--spacing-lg);
text-align: center;
}
.timeline {
display: flex;
align-items: center;
gap: 0;
position: relative;
overflow-x: auto;
padding: var(--spacing-md) 0;
}
.timeline::before {
content: '';
position: absolute;
top: 50%;
left: 0;
right: 0;
height: 2px;
background-color: var(--border-color);
z-index: 1;
transform: translateY(-50%);
}
.timeline-item {
flex: 1;
min-width: 140px;
display: flex;
flex-direction: column;
align-items: center;
position: relative;
z-index: 2;
}
.timeline-circle {
width: 40px;
height: 40px;
border-radius: 50%;
background-color: white;
border: 3px solid var(--border-color);
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s ease;
font-weight: 900;
font-size: 1.2rem;
color: var(--text-primary);
flex-shrink: 0;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
margin: 0;
}
.timeline-item.completed .timeline-circle {
background-color: var(--accent-pink);
border-color: var(--accent-pink);
color: white;
}
.timeline-item.active .timeline-circle {
background-color: var(--accent-light);
border-color: var(--accent-dark);
box-shadow: 0 0 0 4px var(--accent-light);
}
.timeline-label {
text-align: center;
font-size: 0.85rem;
font-weight: 600;
color: var(--text-primary);
line-height: 1.3;
max-width: 120px;
margin-top: 60px;
}
.timeline-item.completed .timeline-label {
color: var(--accent-pink);
}
.timeline-item.active .timeline-label {
color: var(--accent-dark);
font-weight: 700;
}
@media (max-width: 768px) {
.content-grid {
grid-template-columns: 1fr;
}
h1 {
font-size: 1.8rem;
}
.image-gallery {
grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
}
}
</style>
@endsection
@section('content')
<div class="container">
<div class="page-intro">
<h1>Custom Order Details</h1>
<p>Order #{{ $customOrder->order_number }}</p>
</div>
@if (session('success'))
<div class="alert alert-success">
{{ session('success') }}
</div>
@endif
@if (session('info'))
<div class="alert alert-info">
{{ session('info') }}
</div>
@endif
<!-- Timeline -->
<div class="timeline-container">
<h2 class="timeline-title">Order Progress</h2>
<div class="timeline">
@php
$timelineSteps = [
['status' => 'submitted', 'label' => 'Order\nSubmitted', 'completed' => $customOrder->status !== null],
['status' => 'deposit_paid', 'label' => 'Deposit\nPaid', 'completed' => $customOrder->deposit_status === 'paid'],
['status' => 'proof_sent', 'label' => 'Proofs\nSent', 'completed' => $customOrder->proofs()->exists()],
['status' => 'proof_approved', 'label' => 'Proofs\nApproved', 'completed' => $customOrder->proofs()->where('status', 'approved')->exists()],
['status' => 'processing', 'label' => 'Processing', 'completed' => $customOrder->status === 'processing'],
['status' => 'shipped', 'label' => 'Order\nShipped', 'completed' => $customOrder->status === 'completed'],
];
// Determine current step
$currentStep = 0;
if ($customOrder->status === 'completed') $currentStep = 5;
elseif ($customOrder->status === 'processing') $currentStep = 4;
elseif ($customOrder->proofs()->where('status', 'approved')->exists()) $currentStep = 3;
elseif ($customOrder->proofs()->exists()) $currentStep = 2;
elseif ($customOrder->deposit_status === 'paid') $currentStep = 1;
@endphp
@foreach ($timelineSteps as $index => $step)
<div class="timeline-item @if ($index < $currentStep) completed @elseif ($index === $currentStep) active @endif">
<div class="timeline-circle">
@if ($index < $currentStep)
@else
{{ $index + 1 }}
@endif
</div>
<div class="timeline-label">{{ $step['label'] }}</div>
</div>
@endforeach
</div>
</div>
<div class="content-grid">
<!-- Main Content -->
<div>
<!-- Order Status -->
<div class="card">
<h2>Order Status</h2>
<div class="card-section">
<span class="status-badge {{ $customOrder->status }}">
{{ str_replace('_', ' ', ucfirst($customOrder->status)) }}
</span>
<p style="margin-top: var(--spacing-sm); color: var(--text-secondary); font-size: 0.9rem;">
Submitted on {{ $customOrder->created_at->format('d M Y \a\t H:i') }}
</p>
</div>
</div>
<!-- Design Requirements -->
<div class="card">
<h2>Design Requirements</h2>
<div class="card-section">
<h3>Order Type</h3>
<p style="color: var(--text-secondary); text-transform: capitalize;">{{ $customOrder->type }}</p>
</div>
<div class="card-section">
<h3>Dimensions</h3>
@if ($customOrder->specifications)
<dl style="color: var(--text-secondary);">
@if ($customOrder->specifications->length)
<div class="spec-group">
<dt>Length:</dt>
<dd>{{ $customOrder->specifications->length }}m</dd>
</div>
@endif
@if ($customOrder->specifications->width)
<div class="spec-group">
<dt>Width:</dt>
<dd>{{ $customOrder->specifications->width }}m</dd>
</div>
@endif
@if ($customOrder->specifications->height)
<div class="spec-group">
<dt>Height:</dt>
<dd>{{ $customOrder->specifications->height }}m</dd>
</div>
@endif
<div class="spec-group">
<dt>Quantity:</dt>
<dd>{{ $customOrder->specifications->quantity }}</dd>
</div>
</dl>
@endif
</div>
<div class="card-section">
<h3>Print Material</h3>
@if ($customOrder->specifications->printStock)
<p style="color: var(--text-secondary);">{{ $customOrder->specifications->printStock->name }}</p>
@endif
</div>
<div class="card-section">
<h3>Design Brief</h3>
<p style="color: var(--text-secondary);">{{ $customOrder->customer_brief }}</p>
</div>
@if ($customOrder->specifications->special_instructions)
<div class="card-section">
<h3>Special Instructions</h3>
<p style="color: var(--text-secondary);">{{ $customOrder->specifications->special_instructions }}</p>
</div>
@endif
</div>
<!-- Reference Images -->
@if ($customOrder->files->count() > 0)
<div class="card">
<h2>Reference Images</h2>
<div class="image-gallery">
@foreach ($customOrder->files as $file)
<a href="{{ Storage::url($file->file_path) }}" target="_blank" title="{{ $file->original_filename }}">
<img src="{{ Storage::url($file->file_path) }}" alt="{{ $file->original_filename }}">
</a>
@endforeach
</div>
</div>
@endif
<!-- Design Proofs -->
@if ($customOrder->proofs->count() > 0)
<div class="card">
<h2>Design Proofs</h2>
@foreach ($customOrder->proofs as $proof)
<div class="proof-item {{ $proof->status === 'approved' ? 'approved' : '' }}">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--spacing-sm);">
<h3>Proof {{ $loop->iteration }}</h3>
<span class="status-badge {{ $proof->status }}">
{{ ucfirst($proof->status) }}
</span>
</div>
@if ($proof->file_path)
<a href="{{ Storage::url($proof->file_path) }}" target="_blank" style="color: var(--accent-dark); text-decoration: underline; font-size: 0.9rem;">
View Proof File
</a>
@endif
@if ($proof->feedback)
<div style="margin-top: var(--spacing-sm); padding: var(--spacing-sm); background: white; border-radius: 4px; border-left: 3px solid var(--accent-dark);">
<strong style="color: var(--text-primary); font-size: 0.9rem;">Feedback:</strong>
<p style="color: var(--text-secondary); font-size: 0.85rem; margin: var(--spacing-xs) 0 0 0;">{{ $proof->feedback }}</p>
</div>
@endif
</div>
@endforeach
</div>
@endif
</div>
<!-- Sidebar -->
<div>
<!-- Cost & Payment Summary -->
<div class="card">
<h2>Order Summary</h2>
<!-- Cost Summary -->
<div class="payment-section">
<div class="payment-row">
<span>Design Fee:</span>
<span>R{{ number_format($customOrder->design_fee, 2) }}</span>
</div>
@if ($customOrder->material_cost > 0)
<div class="payment-row">
<span>Material Cost:</span>
<span>R{{ number_format($customOrder->material_cost, 2) }}</span>
</div>
@endif
<div class="payment-row total">
<span>Total:</span>
<span>R{{ number_format($customOrder->total_cost, 2) }}</span>
</div>
</div>
<!-- Payment Status -->
<h3 style="margin-top: var(--spacing-lg); margin-bottom: var(--spacing-md);">Payment Status</h3>
<div style="padding: var(--spacing-sm); background-color: var(--accent-light); border-radius: 20px; margin-bottom: var(--spacing-md);">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--spacing-xs);">
<strong>Deposit (20%)</strong>
<span class="status-badge {{ $customOrder->deposit_status }}">{{ ucfirst($customOrder->deposit_status) }}</span>
</div>
<p style="color: var(--text-secondary); margin: 0; font-size: 0.9rem;">R{{ number_format($customOrder->deposit_amount, 2) }}</p>
</div>
<div style="padding: var(--spacing-sm); background-color: var(--accent-light); border-radius: 20px; margin-bottom: var(--spacing-lg);">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--spacing-xs);">
<strong>Balance (80%)</strong>
<span class="status-badge {{ $customOrder->balance_status }}">{{ ucfirst($customOrder->balance_status) }}</span>
</div>
<p style="color: var(--text-secondary); margin: 0; font-size: 0.9rem;">R{{ number_format($customOrder->balance_amount, 2) }}</p>
</div>
<!-- Payment Buttons -->
@if ($customOrder->deposit_status !== 'paid')
<form method="POST" action="{{ route('yoco-custom-deposit') }}">
@csrf
<input type="hidden" name="custom_order_id" value="{{ $customOrder->id }}">
<button type="submit" class="btn">Pay Deposit (R{{ number_format($customOrder->deposit_amount, 2) }})</button>
</form>
@elseif ($customOrder->deposit_status === 'paid' && $customOrder->proofs->where('status', 'approved')->count() > 0 && $customOrder->balance_status !== 'paid')
<button class="btn" onclick="alert('Balance payment coming soon')">Pay Balance (R{{ number_format($customOrder->balance_amount, 2) }})</button>
@endif
</div>
<!-- Terms -->
<div class="terms-box">
<h3 style="color: var(--text-primary); margin-top: 0;">Payment Terms</h3>
<ul>
<li>The 20% deposit is non-refundable</li>
<li>Balance of 80% must be paid before printing begins</li>
@if ($customOrder->library_discount_applied)
<li>Design may be added to our library</li>
@else
<li>Bespoke, exclusive design</li>
@endif
</ul>
</div>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const paymentForm = document.querySelector('form[action*="payment"]');
if (paymentForm) {
console.log('Payment form found:', paymentForm);
console.log('Form action:', paymentForm.action);
paymentForm.addEventListener('submit', function(e) {
console.log('Payment form submitted!');
console.log('Form data:', new FormData(this));
});
} else {
console.log('Payment form NOT found');
console.log('All forms on page:', document.querySelectorAll('form'));
}
});
</script>
@endsection