diff --git a/app/Enums/OrderStatus.php b/app/Enums/OrderStatus.php index 77ae5cd..0086032 100644 --- a/app/Enums/OrderStatus.php +++ b/app/Enums/OrderStatus.php @@ -4,9 +4,8 @@ enum OrderStatus: string { - case ORDER = 'Order'; case APPROVED = 'Approved'; case PRODUCTION = 'Production'; - case COMPLETED = 'Completed'; - case CANCELLED = 'Cancelled'; + case SHIPPED = 'Shipped'; + case INVOICED = 'Invoiced'; } diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 961ea36..75ecdb1 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -43,7 +43,6 @@ public function __construct() /** * Get a validator for an incoming registration request. * - * @param array $data * @return \Illuminate\Contracts\Validation\Validator */ protected function validator(array $data) @@ -58,7 +57,6 @@ protected function validator(array $data) /** * Create a new user instance after a valid registration. * - * @param array $data * @return \App\Models\User */ protected function create(array $data) diff --git a/app/Http/Controllers/ContactController.php b/app/Http/Controllers/ContactController.php index 4172381..47e3708 100644 --- a/app/Http/Controllers/ContactController.php +++ b/app/Http/Controllers/ContactController.php @@ -9,10 +9,7 @@ class ContactController extends Controller { - public function index() - { - - } + public function index() {} public function create(Request $request) { @@ -29,17 +26,11 @@ public function store(ContactRequest $request) return redirect()->route('customers.show', [$contact->customer, 'contacts'])->with('status', 'Contact created successfully'); } - public function show($id) - { - } + public function show($id) {} - public function edit($id) - { - } + public function edit($id) {} - public function update(Request $request, $id) - { - } + public function update(Request $request, $id) {} public function requestDestroy(Request $request) { @@ -51,9 +42,9 @@ public function requestDestroy(Request $request) public function destroy($id) { -// $contact = Contact::findOrFail($id); -// $contact->delete(); -// -// return redirect()->route('customers.show', $contact->customer()->iud)->with('status', 'Contact deleted successfully'); + // $contact = Contact::findOrFail($id); + // $contact->delete(); + // + // return redirect()->route('customers.show', $contact->customer()->iud)->with('status', 'Contact deleted successfully'); } } diff --git a/app/Http/Controllers/CustomerController.php b/app/Http/Controllers/CustomerController.php index 0bc5ee0..36caed1 100644 --- a/app/Http/Controllers/CustomerController.php +++ b/app/Http/Controllers/CustomerController.php @@ -5,25 +5,18 @@ use App\Http\Requests\CustomerRequest; use App\Models\Customer; use App\Models\PackingSlip; -use App\Models\ShippingEntry; use Illuminate\Http\Request; use Illuminate\Support\Carbon; class CustomerController extends Controller { - public function index(Request $request) - { - return view('customers.index', [ - 'customers' => Customer::all(), - 'tab' => $request->tab, - ]); - } + public function index() {} public function store(CustomerRequest $request) { Customer::create($request->validated()); - return redirect()->route('customers.index')->with('status', 'Customer created successfully.'); + return redirect()->route('management.index')->with('status', 'Customer created successfully.'); } public function create() @@ -31,9 +24,9 @@ public function create() return view('customers.create'); } - public function show(Customer $customer, string $tab = null) + public function show(Customer $customer, ?string $tab = null) { - if (!$tab) { + if (! $tab) { return redirect()->route('customers.show', [$customer, 'tab' => 'details']); } @@ -68,13 +61,13 @@ public function requestDestroy(Request $request) $customer = Customer::find($request->id); $customer->delete(); - return redirect()->route('customers.index')->with('status', 'Customer deleted successfully.'); + return redirect()->route('management.index')->with('status', 'Customer deleted successfully.'); } public function destroy(Customer $customer) { $customer->delete(); - return redirect()->route('customers.index')->with('status', 'Customer deleted successfully.'); + return redirect()->route('management.index')->with('status', 'Customer deleted successfully.'); } } diff --git a/app/Http/Controllers/DashboardController.php b/app/Http/Controllers/DashboardController.php new file mode 100644 index 0000000..c99d73f --- /dev/null +++ b/app/Http/Controllers/DashboardController.php @@ -0,0 +1,41 @@ +middleware('auth'); + } + + /** + * Show the application dashboard. + */ + public function index(Request $request) + { + if (! $request->get('tab')) { + return redirect()->route('dashboard', ['tab' => 'active_orders']); + } + + return view('dashboard', [ + 'today' => Carbon::today(), + 'tab' => $request->get('tab'), + 'active_orders' => Order::where('status', '!=', 'cancelled') + ->where('status', '!=', 'completed') + ->orderByDesc('rush') + ->orderBy('due_date') + ->paginate(15) + ->withQueryString(), + ]); + } +} diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php deleted file mode 100644 index 7cbc2c3..0000000 --- a/app/Http/Controllers/HomeController.php +++ /dev/null @@ -1,28 +0,0 @@ -middleware('auth'); - } - - /** - * Show the application dashboard. - * - * @return \Illuminate\Contracts\Support\Renderable - */ - public function index() - { - return view('home'); - } -} diff --git a/app/Http/Controllers/ManagementController.php b/app/Http/Controllers/ManagementController.php new file mode 100644 index 0000000..2a55294 --- /dev/null +++ b/app/Http/Controllers/ManagementController.php @@ -0,0 +1,22 @@ +route('management.index', ['tab' => $this->defaultTab]); + } + + return view('management.index', [ + 'customers' => Customer::all(), + 'tab' => $tab, + ]); + } +} diff --git a/app/Http/Controllers/OrderController.php b/app/Http/Controllers/OrderController.php index 5148ec7..2aebeba 100644 --- a/app/Http/Controllers/OrderController.php +++ b/app/Http/Controllers/OrderController.php @@ -4,45 +4,116 @@ use App\Enums\OrderStatus; use App\Enums\OrderType; +use App\Http\Requests\OrderRequest; use App\Models\Customer; +use App\Models\Order; +use App\Models\OrderProduct; +use App\Models\ProductService; +use App\Models\ProductSize; +use App\Models\ServiceFile; use Illuminate\Http\Request; use Illuminate\Support\Carbon; class OrderController extends Controller { - public function index() + public function index(Request $request) { + if (! $request->get('tab')) { + return redirect()->route('orders.index', ['tab' => 'all']); + } + return view('orders.index', [ + 'tab' => $request->get('tab'), + ]); } public function create() { return view('orders.create', [ - 'order_types' => OrderType::cases(), + 'order_types' => OrderType::cases(), 'order_status' => OrderStatus::cases(), - 'customers' => Customer::all(), - 'today' => Carbon::today()->format('Y-m-d'), - 'due_default' => Carbon::today()->addDay(10)->format('Y-m-d') + 'customers' => Customer::all(), + 'today' => Carbon::today()->format('Y-m-d'), + 'due_default' => Carbon::today()->addDay(10)->format('Y-m-d'), ]); } - public function store(Request $request) + public function store(OrderRequest $request) { + // Create order + $order = Order::create($request->safe()->only([ + 'customer_id', + 'contact_id', + 'order_type', + 'status', + 'customer_po', + 'order_date', + 'due_date', + 'rush', + 'new_art', + 'digitizing', + 'repeat', + 'purchased_garments', + 'customer_supplied_file', + 'notes', + ])); + + // Create orderProducts + for ($i = 0; $i < count($request->get('productInputCount')) - 1; $i++) { + + $orderProduct = OrderProduct::create([ + 'order_id' => $order->id, + 'sku' => $request->get('sku')[$i], + 'product_name' => $request->get('product_name')[$i], + 'color' => $request->get('product_color')[$i], + ]); + + // Create productSizes + foreach (['xs', 's', 'm', 'l', 'xl', '2xl', '3xl', 'osfa'] as $size) { + ProductSize::create([ + 'order_product_id' => $orderProduct->id, + 'amount' => $request->get('size_'.$size)[$i], + 'size' => $size, + ]); + } + } + + // 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::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], + ]); + } + + return redirect()->route('order-products.create', ['order' => $order->id]); } public function show($id) { + return view('orders.show', [ + 'order' => Order::find($id), + 'tab' => 'details', + ]); } - public function edit($id) - { - } + public function edit($id) {} - public function update(Request $request, $id) - { - } + public function update(Request $request, $id) {} - public function destroy($id) - { - } + public function destroy($id) {} } diff --git a/app/Http/Controllers/OrderProductController.php b/app/Http/Controllers/OrderProductController.php new file mode 100644 index 0000000..e283cb6 --- /dev/null +++ b/app/Http/Controllers/OrderProductController.php @@ -0,0 +1,25 @@ +validated()); - if ($request->get('from_customer')) - { + if ($request->get('from_customer')) { return redirect()->route('customers.show', [ Customer::find($request->get('customer_id')), - 'tab' => 'packing' + 'tab' => 'packing', ]); } return redirect()->back(); //todo: change to packing slips page } - public function show($id) - { - } + public function show($id) {} - public function edit($id) - { - } + public function edit($id) {} - public function update(Request $request, $id) - { - } + public function update(Request $request, $id) {} - public function destroy($id) - { - } + public function destroy($id) {} } diff --git a/app/Http/Controllers/ShippingEntryController.php b/app/Http/Controllers/ShippingEntryController.php index ad8797b..9b638dc 100644 --- a/app/Http/Controllers/ShippingEntryController.php +++ b/app/Http/Controllers/ShippingEntryController.php @@ -8,14 +8,9 @@ class ShippingEntryController extends Controller { - public function index() - { + public function index() {} - } - - public function create() - { - } + public function create() {} public function store(ShippingEntryRequest $request) { @@ -24,19 +19,11 @@ public function store(ShippingEntryRequest $request) return redirect()->route('customers.show', [$entry->customer, 'tab' => 'shipping']); } - public function show($id) - { - } + public function show($id) {} - public function edit($id) - { - } + public function edit($id) {} - public function update(Request $request, $id) - { - } + public function update(Request $request, $id) {} - public function destroy($id) - { - } + public function destroy($id) {} } diff --git a/app/Http/Requests/ContactRequest.php b/app/Http/Requests/ContactRequest.php index ca8daf3..fdd3222 100644 --- a/app/Http/Requests/ContactRequest.php +++ b/app/Http/Requests/ContactRequest.php @@ -16,7 +16,7 @@ public function rules(): array 'last_name' => 'string', 'email' => 'string', 'phone' => 'string', - 'notes' => 'string' + 'notes' => 'string', ]; } diff --git a/app/Http/Requests/OrderProductRequest.php b/app/Http/Requests/OrderProductRequest.php new file mode 100644 index 0000000..2382143 --- /dev/null +++ b/app/Http/Requests/OrderProductRequest.php @@ -0,0 +1,23 @@ + ['required', 'exists:orders'], + 'sku' => ['string', 'nullable'], + 'product_name' => ['required'], + 'color' => ['string', 'nullable'], + ]; + } + + public function authorize(): bool + { + return true; + } +} diff --git a/app/Http/Requests/OrderRequest.php b/app/Http/Requests/OrderRequest.php index 8da7f60..70458b3 100644 --- a/app/Http/Requests/OrderRequest.php +++ b/app/Http/Requests/OrderRequest.php @@ -9,19 +9,20 @@ class OrderRequest extends FormRequest public function rules(): array { return [ - 'customer_id' => ['required', 'exists:customers'], - 'internal_po' => ['required'], - 'customer_po' => ['required'], + 'customer_id' => ['required', 'exists:customers,id'], + 'contact_id' => ['nullable', 'exists:contacts,id'], + 'customer_po' => ['required', 'string'], + 'order_type' => ['required', 'string'], 'order_date' => ['required', 'date'], 'due_date' => ['required', 'date'], 'status' => ['required'], - 'rush' => ['boolean'], - 'new_art' => ['boolean'], - 'digitizing' => ['boolean'], - 'repeat' => ['boolean'], - 'purchased_garments' => ['boolean'], - 'customer_supplied_file' => ['boolean'], - 'notes' => ['required'], + 'rush' => ['nullable'], + 'new_art' => ['nullable'], + 'digitizing' => ['nullable'], + 'repeat' => ['nullable'], + 'purchased_garments' => ['nullable'], + 'customer_supplied_file' => ['nullable'], + 'notes' => ['nullable'], ]; } diff --git a/app/Http/Requests/PackingSlipRequest.php b/app/Http/Requests/PackingSlipRequest.php index 043b92c..61a84a3 100644 --- a/app/Http/Requests/PackingSlipRequest.php +++ b/app/Http/Requests/PackingSlipRequest.php @@ -14,7 +14,7 @@ public function rules(): array 'order_id' => 'string|nullable', 'amount' => 'required|string', 'contents' => 'required|string', - 'from_customer' => 'required|bool' + 'from_customer' => 'required|bool', ]; } diff --git a/app/Http/Requests/ProductServiceRequest.php b/app/Http/Requests/ProductServiceRequest.php new file mode 100644 index 0000000..0b743db --- /dev/null +++ b/app/Http/Requests/ProductServiceRequest.php @@ -0,0 +1,26 @@ + ['required', 'exists:order_products'], + 'service_file_id' => ['nullable', 'exists:service_files'], + 'service_type' => ['required'], + 'placement' => ['required'], + 'setup_amount' => ['required'], + 'amount' => ['nullable'], + 'amount_price' => ['nullable'], + ]; + } + + public function authorize(): bool + { + return true; + } +} diff --git a/app/Http/Requests/ProductSizeRequest.php b/app/Http/Requests/ProductSizeRequest.php new file mode 100644 index 0000000..272716f --- /dev/null +++ b/app/Http/Requests/ProductSizeRequest.php @@ -0,0 +1,22 @@ + ['required', 'exists:order_products'], + 'size' => ['required'], + 'amount' => ['required'], + ]; + } + + public function authorize(): bool + { + return true; + } +} diff --git a/app/Http/Requests/ServiceFileRequest.php b/app/Http/Requests/ServiceFileRequest.php new file mode 100644 index 0000000..f66ae36 --- /dev/null +++ b/app/Http/Requests/ServiceFileRequest.php @@ -0,0 +1,24 @@ + ['required'], + 'name' => ['required'], + 'width' => ['required', 'numeric'], + 'height' => ['required', 'numeric'], + 'unit' => ['required'], + ]; + } + + public function authorize(): bool + { + return true; + } +} diff --git a/app/Livewire/Counter.php b/app/Livewire/Counter.php new file mode 100644 index 0000000..b4ee99c --- /dev/null +++ b/app/Livewire/Counter.php @@ -0,0 +1,25 @@ +count++; + } + + public function decrement() + { + $this->count--; + } + + public function render() + { + return view('livewire.counter'); + } +} diff --git a/app/Livewire/CreateOrder.php b/app/Livewire/CreateOrder.php new file mode 100644 index 0000000..6c585dc --- /dev/null +++ b/app/Livewire/CreateOrder.php @@ -0,0 +1,42 @@ +customers = $customers; + $this->contacts = $customers->first()->contacts; + } + + public function getContacts() + { + $this->contacts = Customer::find($this->selectedCustomer)->contacts; + } + + public function render() + { + return view('livewire.create-order', [ + 'contacts' => $this->contacts, + 'order_types' => OrderType::cases(), + 'order_status' => OrderStatus::cases(), + 'customers' => $this->customers, + 'today' => Carbon::today()->format('Y-m-d'), + 'due_default' => Carbon::today()->addDay(10)->format('Y-m-d'), + ]); + } +} diff --git a/app/Livewire/CustomerAndContactSelect.php b/app/Livewire/CustomerAndContactSelect.php new file mode 100644 index 0000000..14c801a --- /dev/null +++ b/app/Livewire/CustomerAndContactSelect.php @@ -0,0 +1,41 @@ +customers = $customers; + + if (isset($this->selectedCustomer)) { + $this->contacts = Customer::find($this->selectedCustomer)->contacts; + } else { + $this->contacts = $customers->first()->contacts; + } + + } + + public function updateContactList() + { + $this->contacts = Customer::find($this->selectedCustomer)->contacts; + } + + public function render() + { + return view('livewire.customer-and-contact-select', [ + 'customers' => $this->customers, + 'contacts' => $this->contacts, + ]); + } +} diff --git a/app/Livewire/OrderProductsCreate.php b/app/Livewire/OrderProductsCreate.php new file mode 100644 index 0000000..89867a6 --- /dev/null +++ b/app/Livewire/OrderProductsCreate.php @@ -0,0 +1,158 @@ +sizes as $index => $size) { + $this->totals[$index] = array_sum($size); + } + } catch (Exception $e) { + } + + try { + foreach ($this->units as $index => $unit) { + $this->priceTotals[$index] = $unit * $this->prices[$index]; + } + } catch (Exception $e) { + } + + $this->totalQuantity = array_sum($this->totals); + + $this->totalPrice = '$'.number_format(round(array_sum($this->priceTotals), 2), 2); + + } + + public function addProductInput() + { + $index = $this->productInputs->count(); + $this->productInputs->push([ + $index => [ + 'sku' => '', + 'product_name' => '', + 'product_color' => '', + 'size_xs' => '', + 'size_s' => '', + 'size_m' => '', + 'size_l' => '', + 'size_xl' => '', + 'size_2xl' => '', + 'size_3xl' => '', + 'size_osfa' => '', + 'product_total' => '', + ], + ]); + } + + public function determineAddProductRow($index) + { + if ($index == $this->productInputs->count() - 1) { + $this->addProductInput(); + } + } + + public function determineAddServiceProductRow($index) + { + if ($index == $this->serviceInputs->count() - 1) { + $this->addServiceInput(); + } + } + + public function removeProductInput($key) + { + if ($this->productInputs->count() > 1) { + $this->productInputs->pull($key); + } + } + + public function addServiceInput() + { + $this->serviceInputs->push([ + $this->serviceInputs->count() => [ + 'service_name' => '', + 'product_name' => '', + 'product_color' => '', + 'logo_name' => '', + 'setup_number' => '', + 'service_width' => '', + 'service_height' => '', + 'service_setup_unit' => '', + 'service_setup_price' => '', + 'service_total' => '', + ], + ]); + } + + public function removeServiceInput($key) + { + if ($this->serviceInputs->count() > 1) { + $this->serviceInputs->pull($key); + } + } + + public function mount() + { + $this->fill([ + 'productInputs' => collect([ + [ + 'sku' => '', + 'product_name' => '', + 'product_color' => '', + 'size_xs' => '', + 'size_s' => '', + 'size_m' => '', + 'size_l' => '', + 'size_xl' => '', + 'size_2xl' => '', + 'size_3xl' => '', + 'size_osfa' => '', + 'product_total' => '0', + ], + ]), + 'serviceInputs' => collect([ + [ + 'sku' => '', + 'product_name' => '', + 'product_color' => '', + 'logo_name' => '', + 'setup_number' => '', + 'service_width' => '', + 'service_height' => '', + 'service_setup_unit' => '', + 'service_setup_price' => '', + 'service_total' => '', + ], + ]), + ]); + } + + public function render() + { + return view('livewire.order-products-create'); + } +} diff --git a/app/Livewire/OrdersTable.php b/app/Livewire/OrdersTable.php new file mode 100644 index 0000000..6e80d1e --- /dev/null +++ b/app/Livewire/OrdersTable.php @@ -0,0 +1,61 @@ +today = Carbon::today(); + $this->showCustomerColumn = $showCustomerColumn; + $this->orderType = $orderType; + $this->title = $title; + $this->customer_id = $customer_id ?? ''; + } + + public function render() + { + return view('livewire.orders-table', [ + 'orders' => Order::with('customer') + ->when($this->customer_id != null, fn ($q) => $q->where('customer_id', $this->customer_id)) + ->when($this->orderType === 'active', fn ($q) => $q->active()) + ->when($this->orderType === 'invoiced', fn ($q) => $q->invoiced()) + ->when($this->orderType === 'finished', fn ($q) => $q->finished()) + ->when($this->search !== '', function ($query) { + $query->whereHas('customer', function ($query) { + $query->where('company_name', 'like', '%'.$this->search.'%'); + })->orWhere('customer_po', 'like', '%'.$this->search.'%') + ->orWhere('internal_po', 'like', '%'.$this->search.'%') + ->orWhere('order_date', 'like', '%'.$this->search.'%') + ->orWhere('due_date', 'like', '%'.$this->search.'%') + ->orWhere('status', 'like', '%'.$this->search.'%'); + }) + ->orderByDesc('rush') + ->orderBy('due_date') + ->paginate(15) + ->withQueryString(), + 'today' => $this->today, + ]); + } +} diff --git a/app/Models/Contact.php b/app/Models/Contact.php index 2ae4319..cc17114 100644 --- a/app/Models/Contact.php +++ b/app/Models/Contact.php @@ -9,7 +9,7 @@ class Contact extends Model { - use SoftDeletes, HasFactory; + use HasFactory, SoftDeletes; protected $fillable = [ 'customer_id', @@ -20,8 +20,13 @@ class Contact extends Model 'notes', ]; + public function getFullNameAttribute(): string + { + return $this->first_name.' '.$this->last_name; + } + public function customer(): BelongsTo { - return $this->belongsTo(Customer::class); + return $this->belongsTo(Customer::class); } } diff --git a/app/Models/Customer.php b/app/Models/Customer.php index 9d8b741..8b256eb 100644 --- a/app/Models/Customer.php +++ b/app/Models/Customer.php @@ -9,7 +9,7 @@ class Customer extends Model { - use SoftDeletes, HasFactory; + use HasFactory, SoftDeletes; protected $fillable = [ 'company_name', diff --git a/app/Models/Order.php b/app/Models/Order.php index cb8ec44..e429a4a 100644 --- a/app/Models/Order.php +++ b/app/Models/Order.php @@ -7,19 +7,22 @@ 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 Order extends Model { - use SoftDeletes, HasFactory; + use HasFactory, SoftDeletes; protected $fillable = [ 'customer_id', + 'contact_id', 'internal_po', 'customer_po', 'order_date', - 'due_date', + 'order_type', 'status', + 'due_date', 'rush', 'new_art', 'digitizing', @@ -30,16 +33,57 @@ class Order extends Model ]; protected $appends = [ - 'active_status' + 'active', ]; - public function getActiveStatus(): bool + public static function boot() { - if ($this->status === OrderStatus::COMPLETED || $this->status === OrderStatus::CANCELLED) { - return false; + parent::boot(); + + static::created(function ($model) { + $model->attributes['internal_po'] = $model->generateInternalPo($model->id); + $model->save(); + }); + } + + public function generateInternalPo($id): string + { + $po = str_pad($id, 4, '0', STR_PAD_LEFT); + $year = date('y'); + + return 'TN'.$year.'-'.$po; + } + + public function active(): bool + { + if ($this->status == OrderStatus::APPROVED + || $this->status == OrderStatus::PRODUCTION) { + return true; } - return true; + return false; + } + + public function scopeActive($query) + { + return $query->where('status', 'approved') + ->orWhere('status', 'production'); + } + + public function scopeFinished($query) + { + return $query->where('status', 'shipped') + ->orWhere('status', 'completed'); + } + + public function scopeInvoiced($query) + { + return $query->where('status', 'invoiced'); + } + + public function scopeRush($query) + { + return $query->where('rush', true); } public function customer(): BelongsTo @@ -47,12 +91,22 @@ public function customer(): BelongsTo return $this->belongsTo(Customer::class); } + public function orderProducts(): HasMany + { + return $this->hasMany(OrderProduct::class); + } + + public function productServices(): HasMany + { + return $this->hasMany(ProductService::class); + } + protected function serializeDate(DateTimeInterface $date): string { return $date->format('Y-m-d'); } protected $casts = [ - 'status' => OrderStatus::class + 'status' => OrderStatus::class, ]; } diff --git a/app/Models/OrderProduct.php b/app/Models/OrderProduct.php new file mode 100644 index 0000000..76e7b12 --- /dev/null +++ b/app/Models/OrderProduct.php @@ -0,0 +1,37 @@ +belongsTo(Order::class); + } + + public function serviceFile(): HasOne + { + return $this->hasOne(ServiceFile::class); + } + + public function productSize(): HasMany + { + return $this->hasMany(ProductSize::class); + } +} diff --git a/app/Models/PackingSlip.php b/app/Models/PackingSlip.php index e900bdb..57c63d8 100644 --- a/app/Models/PackingSlip.php +++ b/app/Models/PackingSlip.php @@ -9,7 +9,7 @@ class PackingSlip extends Model { - use SoftDeletes, HasFactory; + use HasFactory, SoftDeletes; protected $fillable = [ 'order_id', @@ -19,7 +19,8 @@ class PackingSlip extends Model 'contents', ]; - public function customer(): BelongsTo { + public function customer(): BelongsTo + { return $this->belongsTo(Customer::class); } } diff --git a/app/Models/ProductService.php b/app/Models/ProductService.php new file mode 100644 index 0000000..f4929b8 --- /dev/null +++ b/app/Models/ProductService.php @@ -0,0 +1,33 @@ +belongsTo(Order::class); + } + + public function serviceFile(): HasOne + { + return $this->hasOne(ServiceFile::class); + } +} diff --git a/app/Models/ProductSize.php b/app/Models/ProductSize.php new file mode 100644 index 0000000..573dc09 --- /dev/null +++ b/app/Models/ProductSize.php @@ -0,0 +1,24 @@ +belongsTo(OrderProduct::class); + } +} diff --git a/app/Models/ServiceFile.php b/app/Models/ServiceFile.php new file mode 100644 index 0000000..0f08cd1 --- /dev/null +++ b/app/Models/ServiceFile.php @@ -0,0 +1,28 @@ +belongsTo(ProductService::class); + } +} diff --git a/app/Models/ShippingEntry.php b/app/Models/ShippingEntry.php index cfaade5..b2b9a15 100644 --- a/app/Models/ShippingEntry.php +++ b/app/Models/ShippingEntry.php @@ -10,10 +10,10 @@ class ShippingEntry extends Model { - use SoftDeletes, HasFactory; + use HasFactory, SoftDeletes; protected $casts = [ - 'shipping_type' => ShippingType::class + 'shipping_type' => ShippingType::class, ]; protected $fillable = [ diff --git a/composer.json b/composer.json index 7f6cb1b..aa935b1 100644 --- a/composer.json +++ b/composer.json @@ -8,11 +8,12 @@ "php": "^8.2", "davidhsianturi/blade-bootstrap-icons": "^1.5", "laravel/framework": "^11.9", - "laravel/tinker": "^2.9" + "laravel/tinker": "^2.9", + "livewire/livewire": "^3.5" }, "require-dev": { "fakerphp/faker": "^1.23", - "laravel/pint": "^1.13", + "laravel/pint": "^1.17", "laravel/sail": "^1.26", "laravel/ui": "^4.5", "mockery/mockery": "^1.6", diff --git a/composer.lock b/composer.lock index da623a1..ac99d9e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ecf358f6808ee41e24a7136c4c0cd543", + "content-hash": "ffc721fe90178089f9fb639d3d24a0b4", "packages": [ { "name": "blade-ui-kit/blade-icons", @@ -1959,6 +1959,82 @@ ], "time": "2024-01-28T23:22:08+00:00" }, + { + "name": "livewire/livewire", + "version": "v3.5.6", + "source": { + "type": "git", + "url": "https://github.com/livewire/livewire.git", + "reference": "597a2808d8d3001cc3ed5ce89a6ebab00f83b80f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/livewire/livewire/zipball/597a2808d8d3001cc3ed5ce89a6ebab00f83b80f", + "reference": "597a2808d8d3001cc3ed5ce89a6ebab00f83b80f", + "shasum": "" + }, + "require": { + "illuminate/database": "^10.0|^11.0", + "illuminate/routing": "^10.0|^11.0", + "illuminate/support": "^10.0|^11.0", + "illuminate/validation": "^10.0|^11.0", + "laravel/prompts": "^0.1.24", + "league/mime-type-detection": "^1.9", + "php": "^8.1", + "symfony/console": "^6.0|^7.0", + "symfony/http-kernel": "^6.2|^7.0" + }, + "require-dev": { + "calebporzio/sushi": "^2.1", + "laravel/framework": "^10.15.0|^11.0", + "mockery/mockery": "^1.3.1", + "orchestra/testbench": "^8.21.0|^9.0", + "orchestra/testbench-dusk": "^8.24|^9.1", + "phpunit/phpunit": "^10.4", + "psy/psysh": "^0.11.22|^0.12" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Livewire\\LivewireServiceProvider" + ], + "aliases": { + "Livewire": "Livewire\\Livewire" + } + } + }, + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "Livewire\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Caleb Porzio", + "email": "calebporzio@gmail.com" + } + ], + "description": "A front-end framework for Laravel.", + "support": { + "issues": "https://github.com/livewire/livewire/issues", + "source": "https://github.com/livewire/livewire/tree/v3.5.6" + }, + "funding": [ + { + "url": "https://github.com/livewire", + "type": "github" + } + ], + "time": "2024-08-19T11:52:18+00:00" + }, { "name": "monolog/monolog", "version": "3.7.0", @@ -6009,16 +6085,16 @@ }, { "name": "laravel/pint", - "version": "v1.17.2", + "version": "v1.17.3", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "e8a88130a25e3f9d4d5785e6a1afca98268ab110" + "reference": "9d77be916e145864f10788bb94531d03e1f7b482" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/e8a88130a25e3f9d4d5785e6a1afca98268ab110", - "reference": "e8a88130a25e3f9d4d5785e6a1afca98268ab110", + "url": "https://api.github.com/repos/laravel/pint/zipball/9d77be916e145864f10788bb94531d03e1f7b482", + "reference": "9d77be916e145864f10788bb94531d03e1f7b482", "shasum": "" }, "require": { @@ -6029,13 +6105,13 @@ "php": "^8.1.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.61.1", - "illuminate/view": "^10.48.18", + "friendsofphp/php-cs-fixer": "^3.64.0", + "illuminate/view": "^10.48.20", "larastan/larastan": "^2.9.8", "laravel-zero/framework": "^10.4.0", "mockery/mockery": "^1.6.12", "nunomaduro/termwind": "^1.15.1", - "pestphp/pest": "^2.35.0" + "pestphp/pest": "^2.35.1" }, "bin": [ "builds/pint" @@ -6071,7 +6147,7 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2024-08-06T15:11:54+00:00" + "time": "2024-09-03T15:00:28+00:00" }, { "name": "laravel/sail", diff --git a/database/factories/ContactFactory.php b/database/factories/ContactFactory.php index 280be1c..da6a06d 100644 --- a/database/factories/ContactFactory.php +++ b/database/factories/ContactFactory.php @@ -14,7 +14,7 @@ public function definition(): array { $first_name = $this->faker->firstName(); $last_name = $this->faker->lastName(); - $email = strtolower($first_name . '.' . $last_name) . '@example.com'; + $email = strtolower($first_name.'.'.$last_name).'@example.com'; return [ 'first_name' => $first_name, diff --git a/database/factories/CustomerFactory.php b/database/factories/CustomerFactory.php index ad2e083..4ef543a 100644 --- a/database/factories/CustomerFactory.php +++ b/database/factories/CustomerFactory.php @@ -13,7 +13,7 @@ class CustomerFactory extends Factory public function definition() { $company_name = $this->faker->company(); - $internal_name = explode(",", $company_name); + $internal_name = explode(',', $company_name); $address = $this->faker->address(); return [ diff --git a/database/factories/OrderFactory.php b/database/factories/OrderFactory.php index 35d8502..1bd4b8b 100644 --- a/database/factories/OrderFactory.php +++ b/database/factories/OrderFactory.php @@ -3,7 +3,7 @@ namespace Database\Factories; use App\Enums\OrderStatus; -use App\Models\Customer; +use App\Enums\OrderType; use App\Models\Order; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Carbon; @@ -14,17 +14,19 @@ class OrderFactory extends Factory public function definition(): array { - $order_date = Carbon::today()->subDays(rand(0, 30)); + $order_date = Carbon::today()->subDays(rand(0, 10)); + $due_date = $order_date->copy()->addDays(rand(9, 15)); return [ 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), - 'internal_po' => 'TN' . $this->faker->randomNumber(4, true), + // 'internal_po' => $this->faker->randomNumber(4, true), 'customer_po' => $this->faker->randomNumber(6, true), + 'order_type' => $this->faker->randomElement(OrderType::cases())->value, 'order_date' => $order_date, - 'due_date' => $order_date->addDays(rand(8, 12)), - 'status' => $this->faker->randomELement(OrderStatus::cases())->value, //todo: setup order status enum - 'rush' => $this->faker->boolean(), + 'due_date' => $due_date, + 'status' => $this->faker->randomELement(OrderStatus::cases())->value, + 'rush' => $this->faker->boolean(10), 'new_art' => $this->faker->boolean(), 'digitizing' => $this->faker->boolean(), 'repeat' => $this->faker->boolean(), diff --git a/database/factories/OrderProductFactory.php b/database/factories/OrderProductFactory.php new file mode 100644 index 0000000..2093ead --- /dev/null +++ b/database/factories/OrderProductFactory.php @@ -0,0 +1,23 @@ + Carbon::now(), + 'updated_at' => Carbon::now(), + 'sku' => $this->faker->randomElement([$this->faker->randomNumber(4, true), null]), + 'product_name' => $this->faker->randomElement(['shirts', 'hats', 'jackets', 'pants', 'tote bags', 'backpacks']), + 'color' => $this->faker->randomElement(['black', 'white', 'navy', 'red', 'gold', 'charcoal']), + ]; + } +} diff --git a/database/factories/PackingSlipFactory.php b/database/factories/PackingSlipFactory.php index d06a8b1..aacfcc9 100644 --- a/database/factories/PackingSlipFactory.php +++ b/database/factories/PackingSlipFactory.php @@ -15,8 +15,8 @@ public function definition(): array return [ 'date_received' => $this->faker->dateTimeBetween('-1 month', 'now'), 'order_id' => $this->faker->randomNumber(6), - 'amount' => $this->faker->numberBetween(2, 5) . ' boxes', - 'contents' => $this->faker->numberBetween(2, 60) . ' ' . $this->faker->randomElement(['t-shirts', 'caps', 'jackets', 'pants', 'sweaters']), + 'amount' => $this->faker->numberBetween(2, 5).' boxes', + 'contents' => $this->faker->numberBetween(2, 60).' '.$this->faker->randomElement(['t-shirts', 'caps', 'jackets', 'pants', 'sweaters']), 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), ]; diff --git a/database/factories/ProductServiceFactory.php b/database/factories/ProductServiceFactory.php new file mode 100644 index 0000000..b09efeb --- /dev/null +++ b/database/factories/ProductServiceFactory.php @@ -0,0 +1,25 @@ + Carbon::now(), + 'updated_at' => Carbon::now(), + 'service_type' => $this->faker->randomElement(['embroidery', 'screen printing', '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, + ]; + } +} diff --git a/database/factories/ProductSizeFactory.php b/database/factories/ProductSizeFactory.php new file mode 100644 index 0000000..5ed26f2 --- /dev/null +++ b/database/factories/ProductSizeFactory.php @@ -0,0 +1,22 @@ + Carbon::now(), + 'updated_at' => Carbon::now(), + 'size' => $this->faker->randomElement(['xs', 's', 'm', 'l', 'xl', '2xl', '3xl']), + 'amount' => $this->faker->randomNumber(2, false), + ]; + } +} diff --git a/database/factories/ServiceFileFactory.php b/database/factories/ServiceFileFactory.php new file mode 100644 index 0000000..8bfc381 --- /dev/null +++ b/database/factories/ServiceFileFactory.php @@ -0,0 +1,25 @@ + Carbon::now(), + 'updated_at' => Carbon::now(), + 'code' => $this->faker->randomElement(['A', 'B']).$this->faker->randomNumber(4, true), + 'name' => $this->faker->word(), + 'width' => round($this->faker->randomFloat(2, 0, 10), 1), + 'height' => round($this->faker->randomFloat(2, 0, 10), 1), + 'unit' => 'inch', + ]; + } +} diff --git a/database/factories/ShippingEntryFactory.php b/database/factories/ShippingEntryFactory.php index 256c22f..6305716 100644 --- a/database/factories/ShippingEntryFactory.php +++ b/database/factories/ShippingEntryFactory.php @@ -2,7 +2,6 @@ namespace Database\Factories; -use App\Models\Customer; use App\Models\ShippingEntry; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Carbon; @@ -21,7 +20,7 @@ public function definition(): array 'account_title' => $this->faker->word, 'account_username' => 'username', 'account_password' => 'password', - 'info_needed' => $this->faker->words(3,true), + 'info_needed' => $this->faker->words(3, true), 'notify' => 'someone@account.com', 'notes' => $this->faker->randomElement(['', '', '', 'Some really long text to simulate a note being put here']), ]; diff --git a/database/migrations/2024_09_03_204957_create_customers_table.php b/database/migrations/2024_09_03_204957_create_customers_table.php index 7c97a33..4e73e32 100644 --- a/database/migrations/2024_09_03_204957_create_customers_table.php +++ b/database/migrations/2024_09_03_204957_create_customers_table.php @@ -4,7 +4,8 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration { +return new class extends Migration +{ public function up() { Schema::create('customers', function (Blueprint $table) { diff --git a/database/migrations/2024_09_04_203012_create_contacts_table.php b/database/migrations/2024_09_04_203012_create_contacts_table.php index aa67579..70a9840 100644 --- a/database/migrations/2024_09_04_203012_create_contacts_table.php +++ b/database/migrations/2024_09_04_203012_create_contacts_table.php @@ -4,7 +4,8 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration { +return new class extends Migration +{ public function up(): void { Schema::create('contacts', function (Blueprint $table) { diff --git a/database/migrations/2024_09_05_215151_create_packing_slips_table.php b/database/migrations/2024_09_05_215151_create_packing_slips_table.php index 0c5bd11..16f5d04 100644 --- a/database/migrations/2024_09_05_215151_create_packing_slips_table.php +++ b/database/migrations/2024_09_05_215151_create_packing_slips_table.php @@ -4,13 +4,14 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration { +return new class extends Migration +{ public function up(): void { Schema::create('packing_slips', function (Blueprint $table) { $table->id(); -// $table->foreignId('order_id')->nullable()->constrained(); + // $table->foreignId('order_id')->nullable()->constrained(); $table->string('order_id')->nullable(); //todo: replace this once orders are actually in da system $table->foreignId('customer_id')->nullable()->constrained(); $table->date('date_received'); diff --git a/database/migrations/2024_09_06_213725_create_shipping_entries_table.php b/database/migrations/2024_09_06_213725_create_shipping_entries_table.php index 502ee0e..81cb84f 100644 --- a/database/migrations/2024_09_06_213725_create_shipping_entries_table.php +++ b/database/migrations/2024_09_06_213725_create_shipping_entries_table.php @@ -4,7 +4,8 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration { +return new class extends Migration +{ public function up(): void { Schema::create('shipping_entries', function (Blueprint $table) { diff --git a/database/migrations/2024_09_09_194631_create_orders_table.php b/database/migrations/2024_09_09_194631_create_orders_table.php index c36c202..5d1078a 100644 --- a/database/migrations/2024_09_09_194631_create_orders_table.php +++ b/database/migrations/2024_09_09_194631_create_orders_table.php @@ -1,30 +1,30 @@ id(); - $table->foreignId('customer_id'); - $table->string('internal_po'); + $table->foreignId('customer_id')->constrained(); + $table->foreignId('contact_id')->nullable()->constrained(); + $table->string('internal_po')->nullable(); $table->string('customer_po'); - $table->enum('order_type', OrderType::cases()); + $table->string('order_type'); $table->date('order_date'); $table->date('due_date'); - $table->enum('status', OrderStatus::cases()); + $table->string('status'); $table->boolean('rush')->default(0); $table->boolean('new_art')->default(0); $table->boolean('digitizing')->default(0); $table->boolean('repeat')->default(0); $table->boolean('purchased_garments')->default(0); $table->boolean('customer_supplied_file')->default(0); - $table->longText('notes'); + $table->longText('notes')->nullable(); $table->softDeletes(); $table->timestamps(); }); diff --git a/database/migrations/2024_09_10_224439_create_order_products_table.php b/database/migrations/2024_09_10_224439_create_order_products_table.php new file mode 100644 index 0000000..4e1ccd6 --- /dev/null +++ b/database/migrations/2024_09_10_224439_create_order_products_table.php @@ -0,0 +1,26 @@ +id(); + $table->foreignId('order_id')->constrained(); + $table->string('sku')->nullable(); + $table->string('product_name'); + $table->string('color')->nullable(); + $table->softDeletes(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('order_products'); + } +}; diff --git a/database/migrations/2024_09_10_224947_create_product_services_table.php b/database/migrations/2024_09_10_224947_create_product_services_table.php new file mode 100644 index 0000000..b176300 --- /dev/null +++ b/database/migrations/2024_09_10_224947_create_product_services_table.php @@ -0,0 +1,28 @@ +id(); + $table->foreignId('order_id'); + $table->string('service_type'); + $table->string('placement'); + $table->string('setup_amount'); + $table->string('amount')->nullable(); + $table->string('amount_price')->nullable(); + $table->softDeletes(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('product_services'); + } +}; diff --git a/database/migrations/2024_09_10_225029_create_service_files_table.php b/database/migrations/2024_09_10_225029_create_service_files_table.php new file mode 100644 index 0000000..91c3bca --- /dev/null +++ b/database/migrations/2024_09_10_225029_create_service_files_table.php @@ -0,0 +1,30 @@ +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->softDeletes(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('service_files'); + } +}; diff --git a/database/migrations/2024_09_10_230904_create_product_sizes_table.php b/database/migrations/2024_09_10_230904_create_product_sizes_table.php new file mode 100644 index 0000000..a665947 --- /dev/null +++ b/database/migrations/2024_09_10_230904_create_product_sizes_table.php @@ -0,0 +1,25 @@ +id(); + $table->foreignId('order_product_id'); + $table->string('size'); + $table->string('amount'); + $table->softDeletes(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('product_sizes'); + } +}; diff --git a/database/seeders/CustomerSeeder.php b/database/seeders/CustomerSeeder.php new file mode 100644 index 0000000..2a5ad0b --- /dev/null +++ b/database/seeders/CustomerSeeder.php @@ -0,0 +1,92 @@ +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(); + + Customer::factory([ + 'company_name' => 'Genumark', + 'internal_name' => 'genumark', + 'shipping_address' => '', + 'billing_address' => '', + ]) + ->has(Contact::factory([ + 'first_name' => 'Tammy', + 'last_name' => 'Bookbinder', + 'email' => 'tbookbinder@genumark.com', + 'phone' => '+1 778 229 5668', + ])) + ->has(Contact::factory([ + 'first_name' => 'Kathlyn', + 'last_name' => 'Wood', + 'email' => 'kwood@genumark.com', + 'phone' => '+1 604 294 2376', + 'notes' => 'Always CC, unless SOF order', + ])) + ->has(Contact::factory([ + 'first_name' => 'Jane', + 'last_name' => 'Wellman', + 'email' => 'jwellman@genumark.com', + 'phone' => '+1 604 742 5584', + 'notes' => 'Deals with SOF orders', + ])) + ->has(Contact::factory([ + 'first_name' => 'Trisha', + 'last_name' => 'Miller', + 'email' => 'tmiller@genumark.com', + 'phone' => '+1 604 802 8486', + ])) + ->has(Contact::factory([ + 'first_name' => 'Brenda', + 'last_name' => 'Kuepfer', + 'email' => 'bkuepfer@genumark.com', + 'phone' => '+1 604 305 5002', + ])) + ->has(PackingSlip::factory(20)) + ->has(ShippingEntry::factory([ + 'account_title' => 'Genumark', + 'courier' => 'UPS CampusShip', + 'contact' => 'https://www.ups.com/lasso/login', + 'account_username' => 'GenumarkTopNotch', + 'account_password' => 'TopNotch@13579', + 'info_needed' => 'Put PO on box', + 'notify' => 'Various reps, CC Kathlyn Wood', + 'notes' => 'For Save On Foods orders, see Genumark SOF', + ])) + ->has(ShippingEntry::factory([ + 'account_title' => 'Genumark Save-On-Foods', + 'courier' => 'UPS CampusShip', + 'contact' => 'https://www.ups.com/lasso/login', + 'account_username' => 'GenumarkTopNotch', + 'account_password' => 'TopNotch@13579', + 'info_needed' => 'Put PO on box', + 'notify' => 'Jane Wellman', + 'notes' => 'Don\'t CC Kathlyn for SOF orders', + ])) + ->has(Order::factory(10)) + ->create(); + } +} diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 3293b57..efd1468 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -2,16 +2,8 @@ namespace Database\Seeders; -use App\Models\Contact; -use App\Models\Customer; -use App\Models\Order; -use App\Models\PackingSlip; -use App\Models\ShippingEntry; use App\Models\User; - // use Illuminate\Database\Console\Seeds\WithoutModelEvents; -use Database\Factories\ShippingEntryFactory; -use http\Client; use Illuminate\Database\Seeder; class DatabaseSeeder extends Seeder @@ -21,73 +13,9 @@ class DatabaseSeeder extends Seeder */ public function run(): void { - Customer::factory(9) - ->has(Contact::factory(5)) - ->has(PackingSlip::factory(30)) - ->has(ShippingEntry::factory(2)) - ->create(); - - Customer::factory([ - 'company_name' => 'Genumark', - 'internal_name' => 'genumark', - 'shipping_address' => '', - 'billing_address' => '', - ]) - ->has(Contact::factory([ - 'first_name' => 'Tammy', - 'last_name' => 'Bookbinder', - 'email' => 'tbookbinder@genumark.com', - 'phone' => '+1 778 229 5668' - ])) - ->has(Contact::factory([ - 'first_name' => 'Kathlyn', - 'last_name' => 'Wood', - 'email' => 'kwood@genumark.com', - 'phone' => '+1 604 294 2376', - 'notes' => 'Always CC, unless SOF order' - ])) - ->has(Contact::factory([ - 'first_name' => 'Jane', - 'last_name' => 'Wellman', - 'email' => 'jwellman@genumark.com', - 'phone' => '+1 604 742 5584', - 'notes' => 'Deals with SOF orders' - ])) - ->has(Contact::factory([ - 'first_name' => 'Trisha', - 'last_name' => 'Miller', - 'email' => 'tmiller@genumark.com', - 'phone' => '+1 604 802 8486' - ])) - ->has(Contact::factory([ - 'first_name' => 'Brenda', - 'last_name' => 'Kuepfer', - 'email' => 'bkuepfer@genumark.com', - 'phone' => '+1 604 305 5002' - ])) - ->has(PackingSlip::factory(20)) - ->has(ShippingEntry::factory([ - 'account_title' => 'Genumark', - 'courier' => 'UPS CampusShip', - 'contact' => 'https://www.ups.com/lasso/login', - 'account_username' => 'GenumarkTopNotch', - 'account_password' => 'TopNotch@13579', - 'info_needed' => 'Put PO on box', - 'notify' => 'Various reps, CC Kathlyn Wood', - 'notes' => 'For Save On Foods orders, see Genumark SOF' - ])) - ->has(ShippingEntry::factory([ - 'account_title' => 'Genumark Save-On-Foods', - 'courier' => 'UPS CampusShip', - 'contact' => 'https://www.ups.com/lasso/login', - 'account_username' => 'GenumarkTopNotch', - 'account_password' => 'TopNotch@13579', - 'info_needed' => 'Put PO on box', - 'notify' => 'Jane Wellman', - 'notes' => 'Don\'t CC Kathlyn for SOF orders' - ])) - ->has(Order::factory(10)) - ->create(); + $this->call([ + CustomerSeeder::class, + ]); User::factory()->create([ 'name' => 'Test User', diff --git a/pint.json b/pint.json new file mode 100644 index 0000000..1ec298a --- /dev/null +++ b/pint.json @@ -0,0 +1,11 @@ +{ + "preset": "laravel", + "rules": { + "binary_operator_spaces": { + "default": "single_space", + "operators": { + "=>": "align_single_space_minimal" + } + } + } +} \ No newline at end of file diff --git a/resources/sass/app.scss b/resources/sass/app.scss index 275c5d8..953440b 100644 --- a/resources/sass/app.scss +++ b/resources/sass/app.scss @@ -12,3 +12,14 @@ $table-striped-bg: #fafafa; @import 'bootstrap/scss/bootstrap'; @import 'bootstrap-icons/font/bootstrap-icons.css'; + +input::-webkit-outer-spin-button, +input::-webkit-inner-spin-button { + display: none; + -webkit-appearance: none; + margin: 0; /* <-- Apparently some margin are still there even though it's hidden */ +} + +input[type=number] { + -moz-appearance: textfield; /* Firefox */ +} diff --git a/resources/views/customers/index.blade.php b/resources/views/customers/index.blade.php deleted file mode 100644 index a9f0430..0000000 --- a/resources/views/customers/index.blade.php +++ /dev/null @@ -1,144 +0,0 @@ -@extends('layouts.app') - -@section('header') -
Company Name | -Internal Name | -Shipping Address | -Billing Address | -Phone | -View | -
---|---|---|---|---|---|
{{$customer->company_name}} | -{{$customer->internal_name}} |
- {{$customer->shipping_address}} | -{{$customer->billing_address}} | -{{$customer->phone}} | -
-
- |
-