Order Show page

orders
Nisse Lommerde 2 months ago
parent 7074596cb7
commit 8e80ba9480

@ -5,13 +5,15 @@ namespace App\Http\Controllers;
use App\Http\Requests\ContactRequest;
use App\Models\Contact;
use App\Models\Customer;
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
class ContactController extends Controller
{
public function index() {}
public function index(): void {}
public function create(Request $request)
public function create(Request $request): View
{
return view('contacts.create', [
'customers' => Customer::all(),
@ -19,20 +21,20 @@ class ContactController extends Controller
]);
}
public function store(ContactRequest $request)
public function store(ContactRequest $request): RedirectResponse
{
$contact = Contact::create($request->validated());
return redirect()->route('customers.show', [$contact->customer, 'contacts'])->with('status', 'Contact created successfully');
}
public function show($id) {}
public function show(int $id): void {}
public function edit($id) {}
public function edit(int $id): void {}
public function update(Request $request, $id) {}
public function update(Request $request, int $id): void {}
public function requestDestroy(Request $request)
public function requestDestroy(Request $request): RedirectResponse
{
$contact = Contact::find($request->get('contact'));
$contact->delete();
@ -40,5 +42,5 @@ class ContactController extends Controller
return redirect()->route('customers.show', [$contact->customer->id, 'contacts'])->with('status', 'Contact deleted successfully');
}
public function destroy($id) {}
public function destroy(int $id): void {}
}

@ -5,12 +5,16 @@ namespace App\Http\Controllers;
use App\Http\Requests\CustomerRequest;
use App\Models\Customer;
use App\Models\PackingSlip;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Foundation\Application;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Carbon;
class CustomerController extends Controller
{
public function index() {}
public function index(): void {}
public function store(CustomerRequest $request)
{
@ -19,12 +23,12 @@ class CustomerController extends Controller
return redirect()->route('management.index')->with('status', 'Customer created successfully.');
}
public function create()
public function create(): Factory|View|Application|\Illuminate\View\View
{
return view('customers.create');
}
public function show(Customer $customer, ?string $tab = null)
public function show(Customer $customer, ?string $tab = null): RedirectResponse|View
{
if (! $tab) {
return redirect()->route('customers.show', [$customer, 'tab' => 'details']);
@ -40,14 +44,14 @@ class CustomerController extends Controller
]);
}
public function update(CustomerRequest $request, Customer $customer)
public function update(CustomerRequest $request, Customer $customer): RedirectResponse
{
$customer->update($request->validated());
return redirect()->route('customers.show', $customer)->with('status', 'Customer updated successfully.');
}
public function requestDestroy(Request $request)
public function requestDestroy(Request $request): RedirectResponse
{
$customer = Customer::find($request->id);
$customer->delete();
@ -55,7 +59,7 @@ class CustomerController extends Controller
return redirect()->route('management.index')->with('status', 'Customer deleted successfully.');
}
public function destroy(Customer $customer)
public function destroy(Customer $customer): RedirectResponse
{
$customer->delete();

@ -3,6 +3,7 @@
namespace App\Http\Controllers;
use App\Models\Customer;
use App\Models\ServiceFile;
class ManagementController extends Controller
{
@ -15,8 +16,9 @@ class ManagementController extends Controller
}
return view('management.index', [
'customers' => Customer::all(),
'tab' => $tab,
'customers' => Customer::all(),
'serviceFiles' => ServiceFile::paginate(15),
'tab' => $tab,
]);
}
}

@ -11,8 +11,11 @@ use App\Models\OrderProduct;
use App\Models\ProductService;
use App\Models\ProductSize;
use App\Models\ServiceFile;
use Illuminate\Contracts\View\Factory;
use Illuminate\Foundation\Application;
use Illuminate\Http\Request;
use Illuminate\Support\Carbon;
use Illuminate\View\View;
class OrderController extends Controller
{
@ -80,30 +83,28 @@ class OrderController extends Controller
// Create productServices
for ($i = 0; $i < count($request->get('serviceInputCount')) - 1; $i++) {
$productService = ProductService::create([
'order_id' => $order->id,
'service_type' => $request->get('service_type')[$i],
'placement' => $request->get('placement')[$i],
'setup_amount' => $request->get('setup_amount')[$i],
'amount' => $request->get('amount')[$i],
'amount_price' => $request->get('amount_price')[$i],
$serviceFile = ServiceFile::create([
'code' => $request->get('service_file_name')[$i],
'name' => $request->get('logo_name')[$i],
'width' => $request->get('service_width')[$i],
'height' => $request->get('service_height')[$i],
'setup_number' => $request->get('setup_amount')[$i],
]);
ServiceFile::create([
'product_service_id' => $productService,
'code' => $request->get('service_file_name')[$i],
'name' => $request->get('logo_name')[$i],
'width' => $request->get('service_width')[$i],
'height' => $request->get('service_height')[$i],
'unit' => $request->get('service_setup_unit')[$i],
'setup_number' => $request->get('setup_number')[$i],
ProductService::create([
'order_id' => $order->id,
'service_file_id' => $serviceFile->id,
'service_type' => $request->get('service_type')[$i],
'placement' => $request->get('placement')[$i],
'amount' => $request->get('amount')[$i],
'amount_price' => $request->get('amount_price')[$i],
]);
}
return redirect()->route('order-products.create', ['order' => $order->id]);
return redirect()->route('orders.show', $order);
}
public function show($id)
public function show(int $id): Factory|\Illuminate\Contracts\View\View|Application|View
{
return view('orders.show', [
'order' => Order::find($id),
@ -111,7 +112,7 @@ class OrderController extends Controller
]);
}
public function edit($id) {}
public function edit(int $id) {}
public function update(Request $request, $id) {}

@ -2,24 +2,27 @@
namespace App\Http\Controllers;
use Illuminate\Contracts\View\Factory;
use Illuminate\Foundation\Application;
use Illuminate\Http\Request;
use Illuminate\View\View;
class OrderProductController extends Controller
{
public function index() {}
public function index(): void {}
public function create()
public function create(): Factory|\Illuminate\Contracts\View\View|Application|View
{
return view('order-products.create');
}
public function store(Request $request) {}
public function store(Request $request): void {}
public function show($id) {}
public function show($id): void {}
public function edit($id) {}
public function edit($id): void {}
public function update(Request $request, $id) {}
public function update(Request $request, $id): void {}
public function destroy($id) {}
public function destroy($id): void {}
}

@ -5,15 +5,16 @@ namespace App\Http\Controllers;
use App\Http\Requests\PackingSlipRequest;
use App\Models\Customer;
use App\Models\PackingSlip;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
class PackingSlipController extends Controller
{
public function index() {}
public function index(): void {}
public function create() {}
public function create(): void {}
public function store(PackingSlipRequest $request)
public function store(PackingSlipRequest $request): RedirectResponse
{
PackingSlip::create($request->validated());
@ -27,11 +28,11 @@ class PackingSlipController extends Controller
return redirect()->back(); //todo: change to packing slips page
}
public function show($id) {}
public function show($id): void {}
public function edit($id) {}
public function edit($id): void {}
public function update(Request $request, $id) {}
public function update(Request $request, $id): void {}
public function destroy($id) {}
public function destroy($id): void {}
}

@ -12,6 +12,7 @@ class OrderRequest extends FormRequest
public function rules(): array
{
return [
// Order
'customer_id' => ['required', 'exists:customers,id'],
'contact_id' => ['nullable', 'exists:contacts,id'],
'customer_po' => ['required', 'string'],
@ -26,6 +27,14 @@ class OrderRequest extends FormRequest
'purchased_garments' => ['nullable'],
'customer_supplied_file' => ['nullable'],
'notes' => ['nullable'],
// Order Products
// Product Sizes
// Product Services
// Service Files
];
}

@ -5,6 +5,7 @@ namespace App\Livewire;
use App\Enums\OrderStatus;
use App\Enums\OrderType;
use App\Models\Customer;
use Illuminate\Contracts\View\View;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Carbon;
use Livewire\Component;
@ -17,18 +18,18 @@ class CreateOrder extends Component
public $contacts;
public function mount(Collection $customers)
public function mount(Collection $customers): void
{
$this->customers = $customers;
$this->contacts = $customers->first()->contacts;
}
public function getContacts()
public function getContacts(): void
{
$this->contacts = Customer::find($this->selectedCustomer)->contacts;
}
public function render()
public function render(): View
{
return view('livewire.create-order', [
'contacts' => $this->contacts,

@ -11,17 +11,19 @@ use Livewire\Component;
class OrderProductsCreate extends Component
{
/** @var Collection<string, int> */
public Collection $productInputs;
/** @var Collection<string, int> */
public Collection $serviceInputs;
/**
* @var array<int>
*/
/** @var array<int> */
public array $sizes = [];
/** @var array<int> */
public array $totals = [];
/** @var array<int> */
public array $units = [];
/**

@ -57,6 +57,28 @@ class Order extends Model
return 'TN'.$year.'-'.$po;
}
public function totalProductQuantity(): int
{
$total = 0;
foreach ($this->orderProducts as $product) {
$total += $product->totalQuantity();
}
return $total;
}
public function totalServicePrice(): string
{
$total = 0;
foreach ($this->productServices as $service) {
$total += $service->amount * $service->amount_price;
}
return number_format($total, 2);
}
public function active(): bool
{
if ($this->status == OrderStatus::APPROVED
@ -113,6 +135,14 @@ class Order extends Model
return $this->belongsTo(Customer::class);
}
/**
* @return BelongsTo<Contact, self>
*/
public function contact(): BelongsTo
{
return $this->belongsTo(Contact::class);
}
/**
* @return HasMany<OrderProduct>
*/

@ -22,6 +22,11 @@ class OrderProduct extends Model
'color',
];
public function totalQuantity(): int
{
return array_sum($this->productSizes()->pluck('amount')->toArray());
}
/**
* @return BelongsTo<Order, self>
*/
@ -41,7 +46,7 @@ class OrderProduct extends Model
/**
* @return HasMany<ProductSize>
*/
public function productSize(): HasMany
public function productSizes(): HasMany
{
return $this->hasMany(ProductSize::class);
}

@ -6,7 +6,6 @@ use Database\Factories\ProductServiceFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\SoftDeletes;
class ProductService extends Model
@ -16,9 +15,9 @@ class ProductService extends Model
protected $fillable = [
'order_id',
'service_file_id',
'service_type',
'placement',
'setup_amount',
'amount',
'amount_price',
];
@ -32,10 +31,10 @@ class ProductService extends Model
}
/**
* @return HasOne<ServiceFile>
* @return BelongsTo<ServiceFile, self>
*/
public function serviceFile(): HasOne
public function serviceFile(): BelongsTo
{
return $this->hasOne(ServiceFile::class);
return $this->BelongsTo(ServiceFile::class);
}
}

@ -5,7 +5,7 @@ namespace App\Models;
use Database\Factories\ServiceFileFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
class ServiceFile extends Model
@ -15,19 +15,17 @@ class ServiceFile extends Model
protected $fillable = [
'code',
'product_service_id',
'name',
'width',
'height',
'unit',
'setup_number',
];
/**
* @return BelongsTo<ProductService, self>
* @return HasMany<ProductService>
*/
public function productService(): BelongsTo
public function productService(): HasMany
{
return $this->belongsTo(ProductService::class);
return $this->HasMany(ProductService::class);
}
}

@ -15,9 +15,8 @@ class ProductServiceFactory extends Factory
return [
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
'service_type' => $this->faker->randomElement(['embroidery', 'screen printing', 'dtg', 'vinyl']),
'service_type' => $this->faker->randomElement(['emb', 'scp', 'dtg', 'vinyl']),
'placement' => $this->faker->randomElement(['l/c', 'c/f', 'f/b', 'r/c']),
'setup_amount' => 0,
'amount' => $this->faker->randomNumber(1),
'amount_price' => 0,
];

@ -20,6 +20,7 @@ class ServiceFileFactory extends Factory
'width' => round($this->faker->randomFloat(2, 0, 10), 1),
'height' => round($this->faker->randomFloat(2, 0, 10), 1),
'unit' => 'inch',
'notes' => $this->faker->randomElement(['1) 1149 2) grey 3) white', '1) white', '1) black 2) white']),
];
}
}

@ -11,9 +11,9 @@ return new class extends Migration
Schema::create('product_services', function (Blueprint $table) {
$table->id();
$table->foreignId('order_id');
$table->foreignId('service_file_id');
$table->string('service_type');
$table->string('placement');
$table->string('setup_amount');
$table->string('amount')->nullable();
$table->string('amount_price')->nullable();
$table->softDeletes();

@ -10,14 +10,13 @@ return new class extends Migration
{
Schema::create('service_files', function (Blueprint $table) {
$table->id();
$table->foreignId('product_service_id')->constrained();
$table->string('code');
$table->string('name');
$table->string('placement');
$table->decimal('width')->nullable();
$table->decimal('height')->nullable();
$table->string('unit')->default('inch');
$table->integer('setup_number')->nullable();
$table->string('notes')->nullable();
$table->softDeletes();
$table->timestamps();
});

@ -9,6 +9,7 @@ use App\Models\OrderProduct;
use App\Models\PackingSlip;
use App\Models\ProductService;
use App\Models\ProductSize;
use App\Models\ServiceFile;
use App\Models\ShippingEntry;
use Illuminate\Database\Seeder;
@ -16,16 +17,18 @@ class CustomerSeeder extends Seeder
{
public function run(): void
{
Customer::factory(3)
->has(Contact::factory(5))
->has(PackingSlip::factory(30))
->has(ShippingEntry::factory(2))
->has(Order::factory(10)
->has(OrderProduct::factory(2)
->has(ProductSize::factory(3)))
->has(ProductService::factory(3)))
// ->has(ServiceFile::factory(1))))
->create();
for ($i = 0; $i < 10; $i++) {
Customer::factory()
->has(Contact::factory(rand(1, 5)))
->has(PackingSlip::factory(rand(1, 10)))
->has(ShippingEntry::factory(rand(1, 3)))
->has(Order::factory(rand(2, 10))
->has(OrderProduct::factory(rand(1, 10))
->has(productSize::factory(rand(1, 8))))
->has(ProductService::factory(rand(1, 10))
->for(ServiceFile::factory())))
->create();
}
Customer::factory([
'company_name' => 'Genumark',
@ -86,7 +89,11 @@ class CustomerSeeder extends Seeder
'notify' => 'Jane Wellman',
'notes' => 'Don\'t CC Kathlyn for SOF orders',
]))
->has(Order::factory(10))
->has(Order::factory(10)
->has(OrderProduct::factory(rand(1, 10))
->has(productSize::factory(rand(1, 8))))
->has(ProductService::factory(rand(1, 10))
->for(ServiceFile::factory())))
->create();
}
}

@ -157,135 +157,138 @@
</div>
</div>
<!-- Title -->
<div class="row px-2 border-bottom mt-4">
<div class="row fw-bold">
<div class="col-1 px-1 text-end" style="width: 40px;">#</div>
<div class="col-1 px-1">Service</div>
<div class="col-2 px-1">Placement</div>
<div class="col-3 px-1">Logo Name</div>
<div class="col-5">
<div class="row">
<div class="col px-1">Setup</div>
<div class="col px-1">Width</div>
<div class="col px-1">Height</div>
<div class="col px-1">Unit</div>
<div class="col px-1">Price</div>
<div class="col px-1">Total</div>
<div class="col px-1"></div>
<div class="ms-2">
<!-- Title -->
<div class="row px-2 border-bottom mt-4">
<div class="row fw-bold">
<div class="col-1 px-0 " style="width: 40px;">#</div>
<div class="col-1 px-1">Service</div>
<div class="col-2 px-1">Placement</div>
<div class="col-3 px-1">Logo Name</div>
<div class="col-5">
<div class="row">
<div class="col px-1">Setup</div>
<div class="col px-1">Width</div>
<div class="col px-1">Height</div>
<div class="col px-1">Unit</div>
<div class="col px-1">Price</div>
<div class="col px-1">Total</div>
<div class="col px-1"></div>
</div>
</div>
</div>
</div>
</div>
<!-- Row -->
<!-- Row -->
@foreach($serviceInputs as $key => $value)
<div class="row">
@foreach($serviceInputs as $key => $value)
<div class="row">
<input type="hidden" name="serviceInputCount[]" value="1">
<input type="hidden" name="serviceInputCount[]" value="1">
<div class="@if($loop->index % 2 != 1) bg-body-tertiary @endif border-bottom py-2">
<div class="row mb-1">
<div class="row mb-2">
<div class="col-1 px-1 fw-bold text-end" style="width: 40px;">{{$loop->index+1}}</div>
<div class="col-1 px-1">
<input id="service_name_{{$key}}" type="text"
class="form-control form-control-sm m-0 @error('service_name') is-invalid @enderror"
name="service_type[]" value="{{@old('service_name')}}" placeholder="Service"
wire:change="determineAddServiceProductRow({{$loop->index}})">
</div>
<div class="col-2 px-1">
<input id="placement_{{$key}}" type="text"
class="form-control form-control-sm @error('placement') is-invalid @enderror"
name="placement[]" value="{{@old('placement')}}"
wire:change="determineAddServiceProductRow({{$loop->index}})">
</div>
<div class="col-3 px-1">
<input id="logo_name_{{$key}}" type="text"
class="form-control form-control-sm @error('logo_name') is-invalid @enderror"
name="logo_name[]" value="{{@old('logo_name')}}"
wire:change="determineAddServiceProductRow({{$loop->index}})">
</div>
<div class="col-5">
<div class="row">
<div class="col px-1">
<input id="setup_number_{{$key}}" type="number" min="0"
class="form-control form-control-sm @error('setup_number') is-invalid @enderror"
name="setup_amount[]" value="{{@old('setup_number')}}"
wire:change="determineAddServiceProductRow({{$loop->index}})">
</div>
<div class="col px-1">
<input id="service_width_{{$key}}" type="number" min="0"
class="form-control form-control-sm @error('service_width') is-invalid @enderror"
name="service_width[]" value="{{@old('service_width')}}"
wire:change="determineAddServiceProductRow({{$loop->index}})">
</div>
<div class="col px-1">
<input id="service_height_{{$key}}" type="number" min="0"
class="form-control form-control-sm @error('service_height') is-invalid @enderror"
name="service_height[]" value="{{@old('service_height')}}"
wire:change="determineAddServiceProductRow({{$loop->index}})">
</div>
<div class="col px-1">
<input id="service_setup_unit_{{$key}}" type="number" min="0"
class="form-control form-control-sm @error('service_setup_unit') is-invalid @enderror"
name="amount[]"
value="{{@old('service_setup_unit')}}"
wire:change="determineAddServiceProductRow({{$loop->index}})"
wire:model.live="units.{{$key}}"
>
</div>
<div class="col px-1">
<input id="service_setup_price_{{$key}}" type="text"
class="form-control form-control-sm @error('service_setup_price') is-invalid @enderror"
name="amount_price[]"
value="{{@old('service_setup_price')}}"
wire:change="determineAddServiceProductRow({{$loop->index}})"
wire:model.live="prices.{{$key}}"
>
</div>
<div class="col px-1">
<input id="service_total_{{$key}}" type="number" precision="2"
class="form-control form-control-sm px-1 @error('service_total') is-invalid @enderror"
name="service_total" readonly
wire:model.live="priceTotals.{{$key}}">
</div>
<div class="col px-1 text-end" style="width: 40px;">
@if($key > 0)
<button class="btn btn-sm" type="button"
wire:click="removeServiceInput({{$key}})">
<x-bi-trash3/>
</button>
@endif
<div class="@if($loop->index % 2 != 1) bg-body-tertiary @endif border-bottom py-2">
<div class="row mb-1">
<div class="row mb-2">
<div class="col-1 px-1 fw-bold" style="width: 40px;">{{$loop->index+1}}</div>
<div class="col-1 px-1">
<input id="service_name_{{$key}}" type="text"
class="form-control form-control-sm m-0 @error('service_name') is-invalid @enderror"
name="service_type[]" value="{{@old('service_name')}}" placeholder="Service"
wire:change="determineAddServiceProductRow({{$loop->index}})">
</div>
<div class="col-2 px-1">
<input id="placement_{{$key}}" type="text"
class="form-control form-control-sm @error('placement') is-invalid @enderror"
name="placement[]" value="{{@old('placement')}}"
wire:change="determineAddServiceProductRow({{$loop->index}})">
</div>
<div class="col-3 px-1">
<input id="logo_name_{{$key}}" type="text"
class="form-control form-control-sm @error('logo_name') is-invalid @enderror"
name="logo_name[]" value="{{@old('logo_name')}}"
wire:change="determineAddServiceProductRow({{$loop->index}})">
</div>
<div class="col-5">
<div class="row">
<div class="col px-1">
<input id="setup_amount_{{$key}}" type="number" min="0"
class="form-control form-control-sm @error('setup_amount') is-invalid @enderror"
name="setup_amount[]" value="{{@old('setup_amount')}}"
wire:change="determineAddServiceProductRow({{$loop->index}})">
</div>
<div class="col px-1">
<input id="service_width_{{$key}}" type="number" min="0"
class="form-control form-control-sm @error('service_width') is-invalid @enderror"
name="service_width[]" value="{{@old('service_width')}}"
wire:change="determineAddServiceProductRow({{$loop->index}})">
</div>
<div class="col px-1">
<input id="service_height_{{$key}}" type="number" min="0"
class="form-control form-control-sm @error('service_height') is-invalid @enderror"
name="service_height[]" value="{{@old('service_height')}}"
wire:change="determineAddServiceProductRow({{$loop->index}})">
</div>
<div class="col px-1">
<input id="service_setup_unit_{{$key}}" type="number" min="0"
class="form-control form-control-sm @error('service_setup_unit') is-invalid @enderror"
name="amount[]"
value="{{@old('service_setup_unit')}}"
wire:change="determineAddServiceProductRow({{$loop->index}})"
wire:model.live="units.{{$key}}"
>
</div>
<div class="col px-1">
<input id="service_setup_price_{{$key}}" type="text"
class="form-control form-control-sm @error('service_setup_price') is-invalid @enderror"
name="amount_price[]"
value="{{@old('service_setup_price')}}"
wire:change="determineAddServiceProductRow({{$loop->index}})"
wire:model.live="prices.{{$key}}"
>
</div>
<div class="col px-1">
<input id="service_total_{{$key}}" type="number" precision="2"
class="form-control form-control-sm px-1 @error('service_total') is-invalid @enderror"
name="service_total" readonly
wire:model.live="priceTotals.{{$key}}">
</div>
<div class="col px-1 text-end" style="width: 40px;">
@if($key > 0)
<button class="btn btn-sm" type="button"
wire:click="removeServiceInput({{$key}})">
<x-bi-trash3/>
</button>
@endif
</div>
</div>
</div>
</div>
</div>
<div class="row mx-0 px-0">
<div class="col-1" style="width: 40px;"></div>
<div class="col-1 px-1">
<input id="service_file_name_{{$key}}" type="text"
class="form-control form-control-sm @error('service_file_name') is-invalid @enderror"
name="service_file_name[]" value="{{@old('service_file_name')}}"
placeholder="File"
wire:change="determineAddServiceProductRow({{$loop->index}})">
</div>
<div class="row mx-0 px-0">
<div class="col-1" style="width: 40px;"></div>
<div class="col-1 px-1">
<input id="service_file_name_{{$key}}" type="text"
class="form-control form-control-sm @error('service_file_name') is-invalid @enderror"
name="service_file_name[]" value="{{@old('service_file_name')}}"
placeholder="File"
wire:change="determineAddServiceProductRow({{$loop->index}})">
</div>
<div class="col-9 px-1">
<div class="col-9 px-1">
<textarea name="contents[]" id="contents_{{$key}}" style="resize: none" rows="2"
class="form-control form-control-sm"
placeholder="Thread colors"
wire:change="determineAddServiceProductRow({{$loop->index}})"
>{{ old('contents') }}</textarea>
</div>
</div>
</div>
</div>
</div>
</div>
@endforeach
@endforeach
</div>
{{-- <div class="row">--}}
<div class="d-flex flex-row gap-2 ">

@ -88,8 +88,7 @@
@endif
</td>
<td class="align-top">
<a class="btn btn-sm btn-outline-secondary px-1 py-0 m-0"
href="">
<a class="" href="{{route('orders.show', $order)}}">
<x-bi-arrow-right/>
</a>
</td>

@ -59,8 +59,7 @@
</div>
<div class="row mb-2">
<label for="order_status" class="col-md-4 col-form-label text-md-end">Order
Status</label>
<label for="order_status" class="col-md-4 col-form-label text-md-end">Order Status</label>
<div class="col-md-6">
<select name="status" class="form-select form-select-sm" id="order_status">
@foreach($order_status as $case)
@ -139,7 +138,7 @@
name="purchased_garment">
<label class="form-check-label" for="purchased_garments">
Purchased
garments</label>
garments</label>
</div>
</div>
</div>

@ -13,8 +13,8 @@
<!-- Tabs row -->
<div class="row justify-content-center mb-3">
<div class="col-3 border-bottom"></div>
<div class="col-6 p-0">
<div class="col-2 border-bottom"></div>
<div class="col-8 p-0">
<ul class="nav nav-fill nav-tabs" id="home-tabs" role="tablist">
<li class="nav-item" role="presentation">
@ -25,6 +25,15 @@
Order Details
</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link link-dark {{$tab == 'packing-slips' ? 'active' : ''}}" id="packing-slips-tab"
href="{{route('orders.index', ['tab' => 'packing-slips'])}}" type="button" role="tab"
aria-controls="packing-slips"
aria-selected="{{$tab == 'packing-slips' ? 'true' : 'false'}}">
<x-bi-calendar-range/>
Packing Slips
</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link link-dark {{$tab == 'timeline' ? 'active' : ''}}" id="timeline-tab"
href="{{route('orders.index', ['tab' => 'timeline'])}}" type="button" role="tab"
@ -33,6 +42,23 @@
Timeline
</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link link-dark {{$tab == 'quote' ? 'active' : ''}}" id="quote-tab"
href="{{route('orders.index', ['tab' => 'quote'])}}" type="button" role="tab"
aria-controls="quote" aria-selected="{{$tab == 'quote' ? 'true' : 'false'}}">
<x-bi-calendar-range/>
Quote
</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link link-dark {{$tab == 'invoice' ? 'active' : ''}}" id="invoice-tab"
href="{{route('orders.index', ['tab' => 'invoice'])}}" type="button" role="tab"
aria-controls="invoice" aria-selected="{{$tab == 'invoice' ? 'true' : 'false'}}">
<x-bi-calendar-range/>
Invoice
</a>
</li>
</ul>
</div>
<div class="col border-bottom"></div>
@ -41,28 +67,331 @@
@endsection
@section('content')
<div class="container">
<div class="row justify-content-center my-3">
<div class="tab-content">
<div class="container-fluid" style="max-width: 1800px">
<div class="row justify-content-center my-3 pt-3 ">
<div class="col-11 col-xl-4 border-end">
<div class="tab-pane {{$tab == 'active_orders' ? 'active' : ''}}" id="active_orders" role="tabpanel"
aria-labelledby="active-orders-tab">
<livewire:orders-table order-type="active" :show-customer-column='true' :title="'Active Orders'"/>
<div class="row ">
<label for="company_name" class="col-5 py-0 col-form-label text-md-end">Customer</label>
<div class="col-md-6">
<a class="fw-bold text-body text-decoration-none"
href="{{route('customers.show', [$order->customer, 'details'])}}">{{$order->customer->company_name}}</a>
</div>
</div>
<div class="tab-pane {{$tab == 'finished_orders' ? 'active' : ''}}" id="finished-orders" role="tabpanel"
aria-labelledby="finished-orders-tab">
<livewire:orders-table order-type="finished" :show-customer-column='true' title="Finished Orders"/>
<div class="row">
<label for="contact_name" class="col-5 py-0 col-form-label text-md-end">Contact</label>
<div class="col-md-6">
@if(isset($order->contact))
<input type="text" name="contact_name" id="" class="py-0 form-control-plaintext" readonly
value="{{$order->contact->full_name}}">
@else
<input type="text" name="contact_name" id=""
class="py-0 form-control-plaintext text-secondary"
readonly value="No contact set">
@endif
</div>
</div>
<div class="tab-pane {{$tab == 'all' ? 'active' : ''}}" id="all-orders" role="tabpanel"
aria-labelledby="all-orders-tab">
<livewire:orders-table order-type="all" :show-customer-column='true' title="All Orders"/>
<hr class="border-secondary-subtle px-0">
<div class="row">
<label for="order_type" class="col-5 py-0 col-form-label text-md-end">Order Type</label>
<div class="col-md-6">
<input type="text" name="order_type" id="" class="py-0 form-control-plaintext" readonly
value="{{$order->order_type}}">
</div>
</div>
<div class="row">
<label for="order_status" class="col-5 py-0 col-form-label text-md-end">Order Status</label>
<div class="col-md-6">
<input type="text" name="order_status" id="" class="py-0 form-control-plaintext" readonly
value="{{$order->status}}">
</div>
</div>
<hr class="border-secondary-subtle px-0">
<div class="row ">
<label for="internal_po" class="col-5 py-0 col-form-label text-md-end">Internal PO</label>
<div class="col-md-6">
<code class="fw-bold">{{$order->internal_po}}</code>
</div>
</div>
<div class="row py-0 ">
<label for="customer_po" class="col-5 py-0 col-form-label text-md-end">Customer PO</label>
<div class="col-md-6">
<code>{{$order->customer_po}}</code>
</div>
</div>
<hr class="border-secondary-subtle px-0">
<div class="row mb-2">
<label class="col-5 py-0 col-form-label text-md-end">Attributes</label>
<div class="col">
@if($order->new_art)
<div class="form-check">
<x-bi-check/>
<label class="form-check-label" for="new_art">New art</label>
</div>
@endif
@if($order->rush)
<div class="form-check ">
<x-bi-check/>
<label class="form-check-label" for="new_art">Rush</label>
</div>
@endif
@if($order->digitizing)
<div class="form-check ">
<x-bi-check/>
<label class="form-check-label" for="digitizing">Digitizing</label>
</div>
@endif
@if($order->customer_supplied_file)
<div class="form-check ">
<x-bi-check/>
<label class="form-check-label" for="customer_supplied_file">
Customer Supplied File
</label>
</div>
@endif
@if($order->repeat)
<div class="form-check ">
<x-bi-check/>
<label class="form-check-label" for="repeat">Repeat</label>
</div>
@endif
@if($order->event)
<div class="form-check ">
<x-bi-check/>
<label class="form-check-label" for="event">Event</label>
</div>
@endif
@if($order->purchased_garments)
<div class="form-check ">
<x-bi-check/>
<label class="form-check-label" for="purchased_garments">Purchased Garments</label>
</div>
@endif
</div>
</div>
<hr class="border-secondary-subtle px-0">
<div class="row py-0 ">
<label for="order_date" class="col-5 py-0 col-form-label text-md-end">Order Date</label>
<div class="col-md-6">
<input type="text" name="order_date" id="" class="py-0 form-control-plaintext"
readonly value="{{$order->order_date}}">
</div>
</div>
<div class="row py-0 ">
<label for="due_date" class="col-5 py-0 col-form-label text-md-end">Due Date</label>
<div class="col-md-6">
<input type="text" name="due_date" id="" class="py-0 form-control-plaintext"
readonly value="{{$order->due_date}}">
</div>
</div>
<hr class="border-secondary-subtle px-0">
<div class="row mb-2">
<label for="notes" class="col-5 py-0 col-form-label text-md-end">Notes</label>
<div class="col-6">
{{$order->notes}}
</div>
</div>
</div>
<div class="col-xl-7">
<table class="table table-striped table-hover table-sm mb-1 ms-0">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">SKU</th>
<th scope="col">Product Name</th>
<th scope="col">Color</th>
<th scope="col">XS</th>
<th scope="col">S</th>
<th scope="col">M</th>
<th scope="col">L</th>
<th scope="col">XL</th>
<th scope="col">2XL</th>
<th scope="col">3XL</th>
<th scope="col">OSFA</th>
<th scope="col">Total</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
@foreach($order->orderProducts as $key => $product)
<input type="hidden" name="productInputCount[]" value="1">
<th scope="row" class="align-middle">{{$loop->index+1}}</th>
<td class="col-1">
<!-- SKU -->
{{$product->sku}}
</td>
<td class="col-3">
<!-- product_name -->
{{$product->product_name}}
</td>
<td class="col-1">
<!-- product_color -->
{{$product->color}}
</td>
<td class="" style="width: 55px">
<!-- size_xs -->
{{$product->productSizes()->get()->where('size', 'xs')->first()->amount ?? ''}}
</td>
<td class="" style="width: 55px">
<!-- size_s -->
{{$product->productSizes()->get()->where('size', 's')->first()->amount ?? ''}}
</td>
<td class="" style="width: 55px">
<!-- size_m -->
{{$product->productSizes()->get()->where('size', 'm')->first()->amount ?? ''}}
</td>
<td class="" style="width: 55px">
<!-- size_l -->
{{$product->productSizes()->get()->where('size', 'l')->first()->amount ?? ''}}
</td>
<td class="" style="width: 55px">
<!-- size_xl -->
{{$product->productSizes()->get()->where('size', 'xl')->first()->amount ?? ''}}
</td>
<td class="" style="width: 55px">
<!-- size_2xl -->
{{$product->productSizes()->get()->where('size', '2xl')->first()->amount ?? ''}}
</td>
<td class="" style="width: 55px">
<!-- size_3xl -->
{{$product->productSizes()->get()->where('size', '3xl')->first()->amount ?? ''}}
</td>
<td style="width: 55px">
<!-- size_osfa -->
{{$product->productSizes()->get()->where('size', 'osfa')->first()->amount ?? ''}}
</td>
<td class="col" style="width: 55px">
{{$product->totalQuantity()}}
</td>
<td class="col" style="width: 40px">
</td>
</tr>
@endforeach
</tbody>
</table>
<div class="d-flex gap-2">
<label for="total-quantity" class="text-nowrap col-form-label">Total Quantity:</label>
<input type="number" name="total-quantity" id="" class="form-control-plaintext" readonly
value="{{$order->totalProductQuantity()}}">
</div>
<!-- Product Services -->
<div class="ms-2">
<!-- Title -->
<div class="row px-2 border-bottom mt-4">
<div class="row fw-bold">
<div class="col-1 px-0" style="width: 40px;">#</div>
<div class="col-1 px-1">Service</div>
<div class="col-2 px-1">Placement</div>
<div class="col-3 px-1">Logo Name</div>
<div class="col-5">
<div class="row">
<div class="col px-1">Setup</div>
<div class="col px-1">Width</div>
<div class="col px-1">Height</div>
<div class="col px-1">Unit</div>
<div class="col px-1">Price</div>
<div class="col px-1">Total</div>
</div>
</div>
</div>
</div>
<!-- Row -->
@foreach($order->productServices as $key => $service)
<div class="row">
<div class="@if($loop->index % 2 != 1) bg-body-tertiary @endif border-bottom py-2">
<div class="row mb-1">
<div class="row mb-2">
<div class="col-1 px-1 fw-bold" style="width: 40px;">{{$loop->index+1}}</div>
<div class="col-1 px-2 fw-bold text-uppercase">
<!-- Service type -->
{{$service->service_type}}
</div>
<div class="col-2 px-1 text-uppercase">
{{$service->placement}}
</div>
<div class="col-3 px-1 text-uppercase">
{{$service->serviceFile->name }}
</div>
<div class="col-5">
<div class="row">
<div class="col px-1">
{{$service->serviceFile->setup_number}}
</div>
<div class="col px-1">
{{$service->serviceFile->width}}
</div>
<div class="col px-1">
{{$service->serviceFile->height}}
</div>
<div class="col px-1">
{{$service->amount}}
</div>
<div class="col px-1">
{{$service->amount_price != 0 ? $service->amount_price : ''}}
</div>
<div class="col px-1">
{{$service->amount_price != 0 ? '$' . number_format($service->amount_price*$service->amount, 2) : ''}}
</div>
</div>
</div>
</div>
<div class="row mx-0 px-0">
<div class="col-1" style="width: 40px;"></div>
<div class="col-1 px-1 ps-2">
<code class="fs-6">
{{$service->serviceFile->code}}
</code>
</div>
<div class="col-9 px-1">
{{$service->serviceFile->notes}}
</div>
</div>
</div>
</div>
</div>
@endforeach
</div>
<div class="tab-pane {{$tab == 'invoice' ? 'active' : ''}}" id="invoice-orders" role="tabpanel"
aria-labelledby="invoice-orders-tab">
<livewire:orders-table order-type="invoiced" :show-customer-column='true' title="Invoiced Orders"/>
<div class="d-flex flex-row gap-2 ">
<label for="total-price" class="col-form-label text-nowrap">Total Price:</label>
<input type="text" name="total-price" id="" class="col-1 form-control-plaintext" readonly
value="{{'$'.$order->totalServicePrice()}}">
</div>
</div>

@ -35,7 +35,7 @@
<div class="row mb-3">
<div class="col">
@if(sizeof($customers) !== 0)
<table class="table table-striped table-hover">
<table class="table table-sm table-striped table-hover">
<thead>
<tr class="border-bottom border-black">
<th scope="col">Company Name</th>
@ -57,8 +57,7 @@
<td> {{$customer->billing_address}} </td>
<td class="text-nowrap"> {{$customer->phone}} </td>
<td class="align-top">
<a class="btn btn-sm btn-outline-secondary"
href="{{route('customers.show', [$customer->id, 'tab'=>'details'])}}">
<a class="" href="{{route('customers.show', [$customer->id, 'tab'=>'details'])}}">
<x-bi-arrow-right/>
</a>
</td>

@ -1,5 +1,31 @@
<div class="tab-pane {{$tab == 'files' ? 'active' : ''}}" id="files" role="tabpanel"
aria-labelledby="files-tab">
<div class="row justify-content-center">
<div class="col-8">
<table class="table table-sm table-striped table-hover">
<thead>
<th>Code</th>
<th>Name</th>
<th>Width</th>
<th>Height</th>
<th>Setup Number</th>
</thead>
<tbody>
@foreach($serviceFiles as $file)
<tr>
<td>{{$file->code}}</td>
<td>{{$file->name}}</td>
<td>{{$file->width}}</td>
<td>{{$file->height}}</td>
<td>{{$file->setup_number}}</td>
</tr>
@endforeach
</tbody>
</table>
{{$serviceFiles->links()}}
</div>
</div>
Files
</div>

Loading…
Cancel
Save