chore: initial commit of existing codebase

This commit is contained in:
ghassan committed 2026-05-19 12:40:08 +03:00
commit 11e94889b2
292 files changed
+38586

No files matched your search

@@ -0,0 +1,69 @@
@extends('layouts.app')
@section('title', 'Add BOM Entry')
@section('content')
<div class="mb-6">
<h1 class="page-title">Add BOM Entry</h1>
<p class="page-subtitle"><a href="{{ route('production.bom.index') }}" class="text-blue-600 hover:underline">Bill of Materials</a> / New</p>
</div>
@if($errors->any())
<div class="mb-4 px-4 py-3 bg-red-50 border border-red-200 rounded-lg text-sm text-red-700">
<ul class="list-disc list-inside space-y-1">
@foreach($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<div class="card card-body max-w-xl">
<form action="{{ route('production.bom.store') }}" method="POST">
@csrf
<div class="grid grid-cols-1 gap-5 sm:grid-cols-2">
<div class="sm:col-span-2">
<label class="form-label">Product (Finished Good) <span class="text-red-500">*</span></label>
<select name="product_id" required class="form-select">
<option value="">-- Select Product --</option>
@foreach($products as $product)
<option value="{{ $product->id }}" {{ old('product_id') == $product->id ? 'selected' : '' }}>
{{ $product->item_code }} - {{ $product->item_name }}
</option>
@endforeach
</select>
</div>
<div class="sm:col-span-2">
<label class="form-label">Raw Material <span class="text-red-500">*</span></label>
<select name="raw_material_id" required class="form-select">
<option value="">-- Select Raw Material --</option>
@foreach($rawMaterials as $material)
<option value="{{ $material->id }}" {{ old('raw_material_id') == $material->id ? 'selected' : '' }}>
{{ $material->item_code }} - {{ $material->item_name }}
</option>
@endforeach
</select>
</div>
<div>
<label class="form-label">Quantity Required <span class="text-red-500">*</span></label>
<input type="number" name="quantity_required" value="{{ old('quantity_required') }}" min="0.001" step="0.001" required class="form-input">
</div>
<div>
<label class="form-label">Unit of Measure <span class="text-red-500">*</span></label>
<input type="text" name="unit_of_measure" value="{{ old('unit_of_measure') }}" required
placeholder="e.g. KG, PCS" class="form-input">
</div>
</div>
<div class="mt-6 flex items-center gap-3">
<button type="submit" class="btn-primary">Save BOM Entry</button>
<a href="{{ route('production.bom.index') }}" class="btn-secondary">Cancel</a>
</div>
</form>
</div>
@endsection
@@ -0,0 +1,69 @@
@extends('layouts.app')
@section('title', 'Edit BOM Entry')
@section('content')
<div class="mb-6">
<h1 class="page-title">Edit BOM Entry</h1>
<p class="page-subtitle"><a href="{{ route('production.bom.index') }}" class="text-blue-600 hover:underline">Bill of Materials</a> / Edit</p>
</div>
@if($errors->any())
<div class="mb-4 px-4 py-3 bg-red-50 border border-red-200 rounded-lg text-sm text-red-700">
<ul class="list-disc list-inside space-y-1">
@foreach($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<div class="card card-body max-w-xl">
<form action="{{ route('production.bom.update', $bom) }}" method="POST">
@csrf
@method('PUT')
<div class="grid grid-cols-1 gap-5 sm:grid-cols-2">
<div class="sm:col-span-2">
<label class="form-label">Product (Finished Good) <span class="text-red-500">*</span></label>
<select name="product_id" required class="form-select">
<option value="">-- Select Product --</option>
@foreach($products as $product)
<option value="{{ $product->id }}" {{ old('product_id', $bom->product_id) == $product->id ? 'selected' : '' }}>
{{ $product->item_code }} - {{ $product->item_name }}
</option>
@endforeach
</select>
</div>
<div class="sm:col-span-2">
<label class="form-label">Raw Material <span class="text-red-500">*</span></label>
<select name="raw_material_id" required class="form-select">
<option value="">-- Select Raw Material --</option>
@foreach($rawMaterials as $material)
<option value="{{ $material->id }}" {{ old('raw_material_id', $bom->raw_material_id) == $material->id ? 'selected' : '' }}>
{{ $material->item_code }} - {{ $material->item_name }}
</option>
@endforeach
</select>
</div>
<div>
<label class="form-label">Quantity Required <span class="text-red-500">*</span></label>
<input type="number" name="quantity_required" value="{{ old('quantity_required', $bom->quantity_required) }}" min="0.001" step="0.001" required class="form-input">
</div>
<div>
<label class="form-label">Unit of Measure <span class="text-red-500">*</span></label>
<input type="text" name="unit_of_measure" value="{{ old('unit_of_measure', $bom->unit_of_measure) }}" required class="form-input">
</div>
</div>
<div class="mt-6 flex items-center gap-3">
<button type="submit" class="btn-primary">Update BOM Entry</button>
<a href="{{ route('production.bom.index') }}" class="btn-secondary">Cancel</a>
</div>
</form>
</div>
@endsection
@@ -0,0 +1,65 @@
@extends('layouts.app')
@section('title', 'Bill of Materials')
@section('content')
<div class="page-header">
<div>
<h1 class="page-title">Bill of Materials</h1>
<p class="page-subtitle">Define material requirements for each product</p>
</div>
<a href="{{ route('production.bom.create') }}" class="btn-primary">
+ Add BOM Entry
</a>
</div>
@php $currentProduct = null; @endphp
@forelse($bomEntries as $entry)
@if($currentProduct !== ($entry->product->item_name ?? ''))
@if($currentProduct !== null)
</tbody></table></div>
@endif
@php $currentProduct = $entry->product->item_name ?? ''; @endphp
<div class="table-wrapper overflow-hidden mb-4">
<div class="px-6 py-3 bg-blue-50 border-b border-blue-100 flex items-center justify-between">
<h3 class="font-semibold text-blue-800 text-sm">{{ $currentProduct }}</h3>
<span class="text-xs text-blue-500">{{ $entry->product->item_code ?? '' }}</span>
</div>
<table class="table-base">
<thead>
<tr>
<th>Raw Material</th>
<th class="text-right">Qty Required</th>
<th>UOM</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@endif
<tr>
<td class="text-gray-800">{{ $entry->rawMaterial->item_name ?? '' }}</td>
<td class="text-right text-gray-700">{{ number_format($entry->quantity_required, 2) }}</td>
<td class="text-gray-500">{{ $entry->unit_of_measure }}</td>
<td>
<div class="flex items-center gap-2">
<a href="{{ route('production.bom.edit', $entry) }}" class="btn-secondary btn-sm">Edit</a>
<form action="{{ route('production.bom.destroy', $entry) }}" method="POST"
onsubmit="confirmDelete(this,'Delete this BOM entry?','This bill of materials entry will be permanently removed.'); return false;">
@csrf
@method('DELETE')
<button type="submit" class="btn-danger btn-sm">Delete</button>
</form>
</div>
</td>
</tr>
@empty
<div class="card card-body text-center text-gray-400">
No BOM entries found. <a href="{{ route('production.bom.create') }}" class="text-blue-600 hover:underline">Add the first one</a>.
</div>
@endforelse
@if($currentProduct !== null && $bomEntries->count())
</tbody>
</table>
</div>
@endif
@endsection