From 3ba11e5637eb9b945a2726a54a424a7d68822508 Mon Sep 17 00:00:00 2001 From: Nisse Date: Tue, 3 Sep 2024 15:15:57 -0700 Subject: [PATCH 1/2] wip --- app/Enums/OrderStatus.php | 12 ++ app/Enums/OrderType.php | 12 ++ app/Enums/ShippingType.php | 10 ++ app/Http/Controllers/ContactController.php | 59 +++++++ app/Http/Controllers/CustomerController.php | 57 +++++-- app/Http/Controllers/OrderController.php | 48 ++++++ .../Controllers/PackingSlipController.php | 51 +++++++ .../Controllers/ShippingEntryController.php | 42 +++++ app/Http/Requests/ContactRequest.php | 27 ++++ app/Http/Requests/CustomerRequest.php | 6 +- app/Http/Requests/OrderRequest.php | 32 ++++ app/Http/Requests/PackingSlipRequest.php | 25 +++ app/Http/Requests/ShippingEntryRequest.php | 29 ++++ app/Models/Contact.php | 27 ++++ app/Models/Customer.php | 21 +++ app/Models/Order.php | 58 +++++++ app/Models/PackingSlip.php | 25 +++ app/Models/ShippingEntry.php | 36 +++++ app/Providers/AppServiceProvider.php | 3 +- composer.json | 1 + composer.lock | 144 +++++++++++++++++- config/app.php | 2 +- database/factories/ContactFactory.php | 28 ++++ database/factories/CustomerFactory.php | 10 ++ database/factories/OrderFactory.php | 36 +++++ database/factories/PackingSlipFactory.php | 24 +++ database/factories/ShippingEntryFactory.php | 29 ++++ .../0001_01_01_000000_create_users_table.php | 28 ++-- ...24_09_03_204957_create_customers_table.php | 1 + ...024_09_04_203012_create_contacts_table.php | 29 ++++ ...9_05_215151_create_packing_slips_table.php | 29 ++++ ...6_213725_create_shipping_entries_table.php | 31 ++++ .../2024_09_09_194631_create_orders_table.php | 37 +++++ database/seeders/DatabaseSeeder.php | 76 ++++++++- package-lock.json | 21 ++- package.json | 3 + resources/js/app.js | 1 + resources/sass/app.scss | 6 + .../create.blade.php} | 4 +- .../{customer => customers}/create.blade.php | 0 resources/views/customers/index.blade.php | 144 ++++++++++++++++++ resources/views/customers/show.blade.php | 110 +++++++++++++ resources/views/layouts/app.blade.php | 105 +++++++------ resources/views/orders/create.blade.php | 130 ++++++++++++++++ .../partials/contacts/create-modal.blade.php | 118 ++++++++++++++ .../partials/contacts/delete-modal.blade.php | 31 ++++ .../partials/customers/create-modal.blade.php | 111 ++++++++++++++ .../customers/delete-all-modal.blade.php | 31 ++++ .../customers/delete-single-modal.blade.php | 23 +++ .../partials/customers/edit-modal.blade.php | 110 +++++++++++++ .../customers/show-contacts.blade.php | 52 +++++++ .../customers/show-overview.blade.php | 76 +++++++++ .../customers/show-packing-slips.blade.php | 66 ++++++++ .../customers/show-shipping-info.blade.php | 99 ++++++++++++ .../packing-slips/create-modal.blade.php | 114 ++++++++++++++ .../shipping-entries/create-modal.blade.php | 128 ++++++++++++++++ .../vendor/pagination/bootstrap-4.blade.php | 46 ++++++ .../vendor/pagination/bootstrap-5.blade.php | 88 +++++++++++ .../views/vendor/pagination/default.blade.php | 46 ++++++ .../vendor/pagination/semantic-ui.blade.php | 36 +++++ .../pagination/simple-bootstrap-4.blade.php | 27 ++++ .../pagination/simple-bootstrap-5.blade.php | 29 ++++ .../pagination/simple-default.blade.php | 19 +++ .../pagination/simple-tailwind.blade.php | 25 +++ .../vendor/pagination/tailwind.blade.php | 106 +++++++++++++ routes/web.php | 18 +++ 66 files changed, 2924 insertions(+), 84 deletions(-) create mode 100644 app/Enums/OrderStatus.php create mode 100644 app/Enums/OrderType.php create mode 100644 app/Enums/ShippingType.php create mode 100644 app/Http/Controllers/ContactController.php create mode 100644 app/Http/Controllers/OrderController.php create mode 100644 app/Http/Controllers/PackingSlipController.php create mode 100644 app/Http/Controllers/ShippingEntryController.php create mode 100644 app/Http/Requests/ContactRequest.php create mode 100644 app/Http/Requests/OrderRequest.php create mode 100644 app/Http/Requests/PackingSlipRequest.php create mode 100644 app/Http/Requests/ShippingEntryRequest.php create mode 100644 app/Models/Contact.php create mode 100644 app/Models/Order.php create mode 100644 app/Models/PackingSlip.php create mode 100644 app/Models/ShippingEntry.php create mode 100644 database/factories/ContactFactory.php create mode 100644 database/factories/OrderFactory.php create mode 100644 database/factories/PackingSlipFactory.php create mode 100644 database/factories/ShippingEntryFactory.php create mode 100644 database/migrations/2024_09_04_203012_create_contacts_table.php create mode 100644 database/migrations/2024_09_05_215151_create_packing_slips_table.php create mode 100644 database/migrations/2024_09_06_213725_create_shipping_entries_table.php create mode 100644 database/migrations/2024_09_09_194631_create_orders_table.php rename resources/views/{customer/index.blade.php => contacts/create.blade.php} (84%) rename resources/views/{customer => customers}/create.blade.php (100%) create mode 100644 resources/views/customers/index.blade.php create mode 100644 resources/views/customers/show.blade.php create mode 100644 resources/views/orders/create.blade.php create mode 100644 resources/views/partials/contacts/create-modal.blade.php create mode 100644 resources/views/partials/contacts/delete-modal.blade.php create mode 100644 resources/views/partials/customers/create-modal.blade.php create mode 100644 resources/views/partials/customers/delete-all-modal.blade.php create mode 100644 resources/views/partials/customers/delete-single-modal.blade.php create mode 100644 resources/views/partials/customers/edit-modal.blade.php create mode 100644 resources/views/partials/customers/show-contacts.blade.php create mode 100644 resources/views/partials/customers/show-overview.blade.php create mode 100644 resources/views/partials/customers/show-packing-slips.blade.php create mode 100644 resources/views/partials/customers/show-shipping-info.blade.php create mode 100644 resources/views/partials/packing-slips/create-modal.blade.php create mode 100644 resources/views/partials/shipping-entries/create-modal.blade.php create mode 100644 resources/views/vendor/pagination/bootstrap-4.blade.php create mode 100644 resources/views/vendor/pagination/bootstrap-5.blade.php create mode 100644 resources/views/vendor/pagination/default.blade.php create mode 100644 resources/views/vendor/pagination/semantic-ui.blade.php create mode 100644 resources/views/vendor/pagination/simple-bootstrap-4.blade.php create mode 100644 resources/views/vendor/pagination/simple-bootstrap-5.blade.php create mode 100644 resources/views/vendor/pagination/simple-default.blade.php create mode 100644 resources/views/vendor/pagination/simple-tailwind.blade.php create mode 100644 resources/views/vendor/pagination/tailwind.blade.php diff --git a/app/Enums/OrderStatus.php b/app/Enums/OrderStatus.php new file mode 100644 index 0000000..77ae5cd --- /dev/null +++ b/app/Enums/OrderStatus.php @@ -0,0 +1,12 @@ + Customer::all(), + 'fromCustomer' => $request->get('customer'), + ]); + } + + public function store(ContactRequest $request) + { + $contact = Contact::create($request->validated()); + + return redirect()->route('customers.show', [$contact->customer, 'contacts'])->with('status', 'Contact created successfully'); + } + + public function show($id) + { + } + + public function edit($id) + { + } + + public function update(Request $request, $id) + { + } + + public function requestDestroy(Request $request) + { + $contact = Contact::find($request->get('contact')); + $contact->delete(); + + return redirect()->route('customers.show', [$contact->customer->id, 'contacts'])->with('status', 'Contact deleted successfully'); + } + + public function destroy($id) + { +// $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 86ec68e..0bc5ee0 100644 --- a/app/Http/Controllers/CustomerController.php +++ b/app/Http/Controllers/CustomerController.php @@ -4,42 +4,77 @@ namespace App\Http\Controllers; 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() + public function index(Request $request) { - return view('customer.index'); + return view('customers.index', [ + 'customers' => Customer::all(), + 'tab' => $request->tab, + ]); } public function store(CustomerRequest $request) { - dd($request); + Customer::create($request->validated()); - return Customer::create($request->validated()); + return redirect()->route('customers.index')->with('status', 'Customer created successfully.'); } public function create() { - return view('customer.create'); + return view('customers.create'); } - public function show(Customer $customer) + public function show(Customer $customer, string $tab = null) { -// return $customer; + if (!$tab) { + return redirect()->route('customers.show', [$customer, 'tab' => 'details']); + } + + $orders = $customer->orders(); + $priorities = '"production", "approved", "order"'; + + return view('customers.show', [ + 'tab' => $tab, + 'customer' => $customer, + 'active_orders' => $orders + ->where('status', '!=', 'cancelled') + ->where('status', '!=', 'completed') + ->orderBy('rush', 'desc') + ->orderBy('due_date', 'desc') + ->paginate(10), + 'contacts' => $customer->contacts()->get(), + 'packingSlips' => PackingSlip::where('customer_id', $customer->id)->orderByDesc('date_received')->paginate(15), + 'shippingEntries' => $customer->shippingEntries()->get(), + 'today' => Carbon::today()->format('Y-m-d'), + ]); } public function update(CustomerRequest $request, Customer $customer) { -// $customer->update($request->validated()); + $customer->update($request->validated()); + + return redirect()->route('customers.show', $customer)->with('status', 'Customer updated successfully.'); + } + + public function requestDestroy(Request $request) + { + $customer = Customer::find($request->id); + $customer->delete(); -// return $customer; + return redirect()->route('customers.index')->with('status', 'Customer deleted successfully.'); } public function destroy(Customer $customer) { -// $customer->delete(); + $customer->delete(); -// return response()->json(); + return redirect()->route('customers.index')->with('status', 'Customer deleted successfully.'); } } diff --git a/app/Http/Controllers/OrderController.php b/app/Http/Controllers/OrderController.php new file mode 100644 index 0000000..5148ec7 --- /dev/null +++ b/app/Http/Controllers/OrderController.php @@ -0,0 +1,48 @@ + 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') + ]); + } + + public function store(Request $request) + { + } + + public function show($id) + { + } + + public function edit($id) + { + } + + public function update(Request $request, $id) + { + } + + public function destroy($id) + { + } +} diff --git a/app/Http/Controllers/PackingSlipController.php b/app/Http/Controllers/PackingSlipController.php new file mode 100644 index 0000000..eed83c9 --- /dev/null +++ b/app/Http/Controllers/PackingSlipController.php @@ -0,0 +1,51 @@ +validated()); + + if ($request->get('from_customer')) + { + return redirect()->route('customers.show', [ + Customer::find($request->get('customer_id')), + 'tab' => 'packing' + ]); + } + + return redirect()->back(); //todo: change to packing slips page + } + + public function show($id) + { + } + + public function edit($id) + { + } + + public function update(Request $request, $id) + { + } + + public function destroy($id) + { + } +} diff --git a/app/Http/Controllers/ShippingEntryController.php b/app/Http/Controllers/ShippingEntryController.php new file mode 100644 index 0000000..ad8797b --- /dev/null +++ b/app/Http/Controllers/ShippingEntryController.php @@ -0,0 +1,42 @@ +validated()); + + return redirect()->route('customers.show', [$entry->customer, 'tab' => 'shipping']); + } + + public function show($id) + { + } + + public function edit($id) + { + } + + public function update(Request $request, $id) + { + } + + public function destroy($id) + { + } +} diff --git a/app/Http/Requests/ContactRequest.php b/app/Http/Requests/ContactRequest.php new file mode 100644 index 0000000..ca8daf3 --- /dev/null +++ b/app/Http/Requests/ContactRequest.php @@ -0,0 +1,27 @@ + 'required|exists:customers,id', + 'first_name' => 'string', + 'last_name' => 'string', + 'email' => 'string', + 'phone' => 'string', + 'notes' => 'string' + ]; + } + + public function authorize(): bool + { + return true; + } +} diff --git a/app/Http/Requests/CustomerRequest.php b/app/Http/Requests/CustomerRequest.php index 817f563..d433a8c 100644 --- a/app/Http/Requests/CustomerRequest.php +++ b/app/Http/Requests/CustomerRequest.php @@ -9,7 +9,11 @@ class CustomerRequest extends FormRequest public function rules() { return [ - + 'company_name' => 'required', + 'internal_name' => 'required', + 'shipping_address' => 'required', + 'billing_address' => 'required', + 'phone' => 'required', ]; } diff --git a/app/Http/Requests/OrderRequest.php b/app/Http/Requests/OrderRequest.php new file mode 100644 index 0000000..8da7f60 --- /dev/null +++ b/app/Http/Requests/OrderRequest.php @@ -0,0 +1,32 @@ + ['required', 'exists:customers'], + 'internal_po' => ['required'], + 'customer_po' => ['required'], + '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'], + ]; + } + + public function authorize(): bool + { + return true; + } +} diff --git a/app/Http/Requests/PackingSlipRequest.php b/app/Http/Requests/PackingSlipRequest.php new file mode 100644 index 0000000..043b92c --- /dev/null +++ b/app/Http/Requests/PackingSlipRequest.php @@ -0,0 +1,25 @@ + 'required|date', + 'customer_id' => 'required|exists:customers,id', + 'order_id' => 'string|nullable', + 'amount' => 'required|string', + 'contents' => 'required|string', + 'from_customer' => 'required|bool' + ]; + } + + public function authorize(): bool + { + return true; + } +} diff --git a/app/Http/Requests/ShippingEntryRequest.php b/app/Http/Requests/ShippingEntryRequest.php new file mode 100644 index 0000000..73f81f8 --- /dev/null +++ b/app/Http/Requests/ShippingEntryRequest.php @@ -0,0 +1,29 @@ + ['required'], + 'customer_id' => ['required', 'exists:customers,id'], + 'courier' => ['nullable'], + 'contact' => ['nullable'], + 'account_title' => ['nullable'], + 'account_username' => ['nullable'], + 'account_password' => ['nullable'], + 'info_needed' => ['nullable'], + 'notify' => ['nullable'], + 'notes' => ['nullable'], + ]; + } + + public function authorize(): bool + { + return true; + } +} diff --git a/app/Models/Contact.php b/app/Models/Contact.php new file mode 100644 index 0000000..2ae4319 --- /dev/null +++ b/app/Models/Contact.php @@ -0,0 +1,27 @@ +belongsTo(Customer::class); + } +} diff --git a/app/Models/Customer.php b/app/Models/Customer.php index 5240ff2..9d8b741 100644 --- a/app/Models/Customer.php +++ b/app/Models/Customer.php @@ -4,6 +4,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\SoftDeletes; class Customer extends Model @@ -17,4 +18,24 @@ class Customer extends Model 'billing_address', 'phone', ]; + + public function contacts(): HasMany + { + return $this->hasMany(Contact::class); + } + + public function packingSlips(): HasMany + { + return $this->hasMany(PackingSlip::class); + } + + public function shippingEntries(): HasMany + { + return $this->hasMany(ShippingEntry::class); + } + + public function orders(): HasMany + { + return $this->hasMany(Order::class); + } } diff --git a/app/Models/Order.php b/app/Models/Order.php new file mode 100644 index 0000000..cb8ec44 --- /dev/null +++ b/app/Models/Order.php @@ -0,0 +1,58 @@ +status === OrderStatus::COMPLETED || $this->status === OrderStatus::CANCELLED) { + return false; + } + + return true; + } + + public function customer(): BelongsTo + { + return $this->belongsTo(Customer::class); + } + + protected function serializeDate(DateTimeInterface $date): string + { + return $date->format('Y-m-d'); + } + + protected $casts = [ + 'status' => OrderStatus::class + ]; +} diff --git a/app/Models/PackingSlip.php b/app/Models/PackingSlip.php new file mode 100644 index 0000000..e900bdb --- /dev/null +++ b/app/Models/PackingSlip.php @@ -0,0 +1,25 @@ +belongsTo(Customer::class); + } +} diff --git a/app/Models/ShippingEntry.php b/app/Models/ShippingEntry.php new file mode 100644 index 0000000..cfaade5 --- /dev/null +++ b/app/Models/ShippingEntry.php @@ -0,0 +1,36 @@ + ShippingType::class + ]; + + protected $fillable = [ + 'shipping_type', + 'customer_id', + 'courier', + 'contact', + 'account_title', + 'account_username', + 'account_password', + 'info_needed', + 'notify', + 'notes', + ]; + + public function customer(): BelongsTo + { + return $this->belongsTo(Customer::class); + } +} diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 452e6b6..86b1719 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -2,6 +2,7 @@ namespace App\Providers; +use Illuminate\Pagination\Paginator; use Illuminate\Support\ServiceProvider; class AppServiceProvider extends ServiceProvider @@ -19,6 +20,6 @@ class AppServiceProvider extends ServiceProvider */ public function boot(): void { - // + Paginator::useBootstrapFive(); } } diff --git a/composer.json b/composer.json index 34bffdd..7f6cb1b 100644 --- a/composer.json +++ b/composer.json @@ -6,6 +6,7 @@ "license": "MIT", "require": { "php": "^8.2", + "davidhsianturi/blade-bootstrap-icons": "^1.5", "laravel/framework": "^11.9", "laravel/tinker": "^2.9" }, diff --git a/composer.lock b/composer.lock index 5caf3d0..da623a1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,89 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "73cbed0c4ee4e8f622fc700e5fd9f524", + "content-hash": "ecf358f6808ee41e24a7136c4c0cd543", "packages": [ + { + "name": "blade-ui-kit/blade-icons", + "version": "1.7.1", + "source": { + "type": "git", + "url": "https://github.com/blade-ui-kit/blade-icons.git", + "reference": "8f787baf09d88cdfd6ec4dbaba11ebfa885f0595" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/blade-ui-kit/blade-icons/zipball/8f787baf09d88cdfd6ec4dbaba11ebfa885f0595", + "reference": "8f787baf09d88cdfd6ec4dbaba11ebfa885f0595", + "shasum": "" + }, + "require": { + "illuminate/contracts": "^8.0|^9.0|^10.0|^11.0", + "illuminate/filesystem": "^8.0|^9.0|^10.0|^11.0", + "illuminate/support": "^8.0|^9.0|^10.0|^11.0", + "illuminate/view": "^8.0|^9.0|^10.0|^11.0", + "php": "^7.4|^8.0", + "symfony/console": "^5.3|^6.0|^7.0", + "symfony/finder": "^5.3|^6.0|^7.0" + }, + "require-dev": { + "mockery/mockery": "^1.5.1", + "orchestra/testbench": "^6.0|^7.0|^8.0|^9.0", + "phpunit/phpunit": "^9.0|^10.5|^11.0" + }, + "bin": [ + "bin/blade-icons-generate" + ], + "type": "library", + "extra": { + "laravel": { + "providers": [ + "BladeUI\\Icons\\BladeIconsServiceProvider" + ] + } + }, + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "BladeUI\\Icons\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dries Vints", + "homepage": "https://driesvints.com" + } + ], + "description": "A package to easily make use of icons in your Laravel Blade views.", + "homepage": "https://github.com/blade-ui-kit/blade-icons", + "keywords": [ + "blade", + "icons", + "laravel", + "svg" + ], + "support": { + "issues": "https://github.com/blade-ui-kit/blade-icons/issues", + "source": "https://github.com/blade-ui-kit/blade-icons" + }, + "funding": [ + { + "url": "https://github.com/sponsors/driesvints", + "type": "github" + }, + { + "url": "https://www.paypal.com/paypalme/driesvints", + "type": "paypal" + } + ], + "time": "2024-08-14T14:25:11+00:00" + }, { "name": "brick/math", "version": "0.12.1", @@ -135,6 +216,67 @@ ], "time": "2024-02-09T16:56:22+00:00" }, + { + "name": "davidhsianturi/blade-bootstrap-icons", + "version": "v1.5.0", + "source": { + "type": "git", + "url": "https://github.com/davidhsianturi/blade-bootstrap-icons.git", + "reference": "21de39c9708fd57bc1108b36792e8bdeebf1c67c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/davidhsianturi/blade-bootstrap-icons/zipball/21de39c9708fd57bc1108b36792e8bdeebf1c67c", + "reference": "21de39c9708fd57bc1108b36792e8bdeebf1c67c", + "shasum": "" + }, + "require": { + "blade-ui-kit/blade-icons": "^1.0", + "illuminate/support": "^8.0|^9.0|^10.0|^11.0", + "php": "^7.4|^8.0" + }, + "require-dev": { + "orchestra/testbench": "^6.0|^7.0|^8.0|^9.0", + "phpunit/phpunit": "^9.0|^10.5" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Davidhsianturi\\BladeBootstrapIcons\\BladeBootstrapIconsServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Davidhsianturi\\BladeBootstrapIcons\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "David H. Sianturi", + "email": "davidhsianturi@gmail.com", + "homepage": "https://davidhsianturi.com", + "role": "Developer" + } + ], + "description": "A package to easily make use of Bootstrap Icons in your Laravel Blade views.", + "homepage": "https://github.com/davidhsianturi/blade-bootstrap-icons", + "keywords": [ + "Bootstrap Icons", + "blade", + "laravel" + ], + "support": { + "issues": "https://github.com/davidhsianturi/blade-bootstrap-icons/issues", + "source": "https://github.com/davidhsianturi/blade-bootstrap-icons/tree/v1.5.0" + }, + "time": "2024-05-09T09:20:43+00:00" + }, { "name": "dflydev/dot-access-data", "version": "v3.0.3", diff --git a/config/app.php b/config/app.php index f467267..adb441d 100644 --- a/config/app.php +++ b/config/app.php @@ -82,7 +82,7 @@ return [ 'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'), - 'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'), + 'faker_locale' => env('APP_FAKER_LOCALE', 'en_CA'), /* |-------------------------------------------------------------------------- diff --git a/database/factories/ContactFactory.php b/database/factories/ContactFactory.php new file mode 100644 index 0000000..280be1c --- /dev/null +++ b/database/factories/ContactFactory.php @@ -0,0 +1,28 @@ +faker->firstName(); + $last_name = $this->faker->lastName(); + $email = strtolower($first_name . '.' . $last_name) . '@example.com'; + + return [ + 'first_name' => $first_name, + 'last_name' => $last_name, + 'email' => $email, + 'phone' => $this->faker->phoneNumber(), + 'created_at' => Carbon::now(), + 'updated_at' => Carbon::now(), + ]; + } +} diff --git a/database/factories/CustomerFactory.php b/database/factories/CustomerFactory.php index d112572..ad2e083 100644 --- a/database/factories/CustomerFactory.php +++ b/database/factories/CustomerFactory.php @@ -12,7 +12,17 @@ class CustomerFactory extends Factory public function definition() { + $company_name = $this->faker->company(); + $internal_name = explode(",", $company_name); + $address = $this->faker->address(); + return [ + 'company_name' => $company_name, + 'internal_name' => strtolower($internal_name[0]), + 'shipping_address' => $address, + 'billing_address' => $address, + 'phone' => $this->faker->phoneNumber(), + 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), ]; diff --git a/database/factories/OrderFactory.php b/database/factories/OrderFactory.php new file mode 100644 index 0000000..35d8502 --- /dev/null +++ b/database/factories/OrderFactory.php @@ -0,0 +1,36 @@ +subDays(rand(0, 30)); + + return [ + 'created_at' => Carbon::now(), + 'updated_at' => Carbon::now(), + 'internal_po' => 'TN' . $this->faker->randomNumber(4, true), + 'customer_po' => $this->faker->randomNumber(6, true), + '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(), + 'new_art' => $this->faker->boolean(), + 'digitizing' => $this->faker->boolean(), + 'repeat' => $this->faker->boolean(), + 'purchased_garments' => $this->faker->boolean(), + 'customer_supplied_file' => $this->faker->boolean(), + 'notes' => $this->faker->words(10, true), + ]; + } +} diff --git a/database/factories/PackingSlipFactory.php b/database/factories/PackingSlipFactory.php new file mode 100644 index 0000000..d06a8b1 --- /dev/null +++ b/database/factories/PackingSlipFactory.php @@ -0,0 +1,24 @@ + $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']), + 'created_at' => Carbon::now(), + 'updated_at' => Carbon::now(), + ]; + } +} diff --git a/database/factories/ShippingEntryFactory.php b/database/factories/ShippingEntryFactory.php new file mode 100644 index 0000000..256c22f --- /dev/null +++ b/database/factories/ShippingEntryFactory.php @@ -0,0 +1,29 @@ + Carbon::now(), + 'updated_at' => Carbon::now(), + 'courier' => $this->faker->randomElement(['UPS', 'Purolator', 'FreightCom', 'E-Shipper', 'ACE']), + 'contact' => $this->faker->randomElement(['courier.com', '+1 604 123 4567']), + 'account_title' => $this->faker->word, + 'account_username' => 'username', + 'account_password' => 'password', + '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/0001_01_01_000000_create_users_table.php b/database/migrations/0001_01_01_000000_create_users_table.php index 23a0c31..05fb5d9 100644 --- a/database/migrations/0001_01_01_000000_create_users_table.php +++ b/database/migrations/0001_01_01_000000_create_users_table.php @@ -21,20 +21,20 @@ return new class extends Migration $table->timestamps(); }); -// Schema::create('password_reset_tokens', function (Blueprint $table) { -// $table->string('email')->primary(); -// $table->string('token'); -// $table->timestamp('created_at')->nullable(); -// }); -// -// Schema::create('sessions', function (Blueprint $table) { -// $table->string('id')->primary(); -// $table->foreignId('user_id')->nullable()->index(); -// $table->string('ip_address', 45)->nullable(); -// $table->text('user_agent')->nullable(); -// $table->longText('payload'); -// $table->integer('last_activity')->index(); -// }); + Schema::create('password_reset_tokens', function (Blueprint $table) { + $table->string('email')->primary(); + $table->string('token'); + $table->timestamp('created_at')->nullable(); + }); + + Schema::create('sessions', function (Blueprint $table) { + $table->string('id')->primary(); + $table->foreignId('user_id')->nullable()->index(); + $table->string('ip_address', 45)->nullable(); + $table->text('user_agent')->nullable(); + $table->longText('payload'); + $table->integer('last_activity')->index(); + }); } /** 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 3e94eba..7c97a33 100644 --- a/database/migrations/2024_09_03_204957_create_customers_table.php +++ b/database/migrations/2024_09_03_204957_create_customers_table.php @@ -9,6 +9,7 @@ return new class extends Migration { { Schema::create('customers', function (Blueprint $table) { $table->id(); + $table->string('company_name'); $table->string('internal_name'); $table->string('shipping_address'); diff --git a/database/migrations/2024_09_04_203012_create_contacts_table.php b/database/migrations/2024_09_04_203012_create_contacts_table.php new file mode 100644 index 0000000..aa67579 --- /dev/null +++ b/database/migrations/2024_09_04_203012_create_contacts_table.php @@ -0,0 +1,29 @@ +id(); + $table->foreignId('customer_id')->constrained(); + + $table->string('first_name')->nullable(); + $table->string('last_name')->nullable(); + $table->string('email')->nullable(); + $table->string('phone')->nullable(); + $table->string('notes')->nullable(); + + $table->softDeletes(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('contacts'); + } +}; 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 new file mode 100644 index 0000000..0c5bd11 --- /dev/null +++ b/database/migrations/2024_09_05_215151_create_packing_slips_table.php @@ -0,0 +1,29 @@ +id(); + +// $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'); + $table->string('amount'); + $table->string('contents'); + + $table->softDeletes(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('packing_slips'); + } +}; 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 new file mode 100644 index 0000000..502ee0e --- /dev/null +++ b/database/migrations/2024_09_06_213725_create_shipping_entries_table.php @@ -0,0 +1,31 @@ +id(); + $table->enum('shipping_type', ['Pickup', 'We ship', 'They ship']); + $table->foreignId('customer_id')->constrained('customers'); + $table->string('courier')->nullable(); + $table->string('contact')->nullable(); + $table->string('account_title')->nullable(); + $table->string('account_username')->nullable(); + $table->string('account_password')->nullable(); + $table->string('info_needed')->nullable(); + $table->string('notify')->nullable(); + $table->string('notes')->nullable(); + $table->softDeletes(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('shipping_entries'); + } +}; diff --git a/database/migrations/2024_09_09_194631_create_orders_table.php b/database/migrations/2024_09_09_194631_create_orders_table.php new file mode 100644 index 0000000..c36c202 --- /dev/null +++ b/database/migrations/2024_09_09_194631_create_orders_table.php @@ -0,0 +1,37 @@ +id(); + $table->foreignId('customer_id'); + $table->string('internal_po'); + $table->string('customer_po'); + $table->enum('order_type', OrderType::cases()); + $table->date('order_date'); + $table->date('due_date'); + $table->enum('status', OrderStatus::cases()); + $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->softDeletes(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('orders'); + } +}; diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index d01a0ef..3293b57 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -2,8 +2,16 @@ 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 @@ -13,7 +21,73 @@ class DatabaseSeeder extends Seeder */ public function run(): void { - // User::factory(10)->create(); + 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(); User::factory()->create([ 'name' => 'Test User', diff --git a/package-lock.json b/package-lock.json index 9305a28..74000de 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,9 +1,12 @@ { - "name": "top-notch-website", + "name": "topnotch_website", "lockfileVersion": 3, "requires": true, "packages": { "": { + "dependencies": { + "bootstrap-icons": "^1.11.3" + }, "devDependencies": { "@popperjs/core": "^2.11.6", "axios": "^1.6.4", @@ -712,6 +715,22 @@ "@popperjs/core": "^2.11.8" } }, + "node_modules/bootstrap-icons": { + "version": "1.11.3", + "resolved": "https://registry.npmjs.org/bootstrap-icons/-/bootstrap-icons-1.11.3.tgz", + "integrity": "sha512-+3lpHrCw/it2/7lBL15VR0HEumaBss0+f/Lb6ZvHISn1mlK83jjFpooTLsMWbIjJMDjDjOExMsTxnXSIT4k4ww==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/twbs" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/bootstrap" + } + ], + "license": "MIT" + }, "node_modules/braces": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", diff --git a/package.json b/package.json index 8c7f96d..d36526f 100644 --- a/package.json +++ b/package.json @@ -12,5 +12,8 @@ "laravel-vite-plugin": "^1.0", "sass": "^1.56.1", "vite": "^5.0" + }, + "dependencies": { + "bootstrap-icons": "^1.11.3" } } diff --git a/resources/js/app.js b/resources/js/app.js index e59d6a0..a491cf4 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -1 +1,2 @@ import './bootstrap'; +import 'bootstrap'; diff --git a/resources/sass/app.scss b/resources/sass/app.scss index 1026a0b..275c5d8 100644 --- a/resources/sass/app.scss +++ b/resources/sass/app.scss @@ -5,4 +5,10 @@ @import 'variables'; // Bootstrap +$body-bg: #fff; +$body-color: #111; +$table-striped-bg: #fafafa; + + @import 'bootstrap/scss/bootstrap'; +@import 'bootstrap-icons/font/bootstrap-icons.css'; diff --git a/resources/views/customer/index.blade.php b/resources/views/contacts/create.blade.php similarity index 84% rename from resources/views/customer/index.blade.php rename to resources/views/contacts/create.blade.php index fefaada..3df073b 100644 --- a/resources/views/customer/index.blade.php +++ b/resources/views/contacts/create.blade.php @@ -5,7 +5,7 @@
-
{{ __('Customers') }}
+
Create contact
@if (session('status')) @@ -15,8 +15,6 @@ @endif - Customer -
diff --git a/resources/views/customer/create.blade.php b/resources/views/customers/create.blade.php similarity index 100% rename from resources/views/customer/create.blade.php rename to resources/views/customers/create.blade.php diff --git a/resources/views/customers/index.blade.php b/resources/views/customers/index.blade.php new file mode 100644 index 0000000..a9f0430 --- /dev/null +++ b/resources/views/customers/index.blade.php @@ -0,0 +1,144 @@ +@extends('layouts.app') + +@section('header') +
+ + +
+
+
+

+
+
+ + +
+
+
+ + + +
+
+
+ +
+@endsection() + +@section('content') +
+
+
+
+ + +
+ +
+ + +
+ +
+ + +
+
+
+ +
+
+ @if(sizeof($customers) !== 0) + + + + + + + + + + + + + + + @foreach($customers as $customer) + + + + + + + + + @endforeach + + +
Company NameInternal NameShipping AddressBilling AddressPhoneView
{{$customer->company_name}} {{$customer->internal_name}} {{$customer->shipping_address}} {{$customer->billing_address}} {{$customer->phone}} + + + +
+ + @else() + No customer data. + @endif +
+
+
+ + + @include('partials.customers.create-modal') + + + @include('partials.customers.delete-all-modal') + +@endsection diff --git a/resources/views/customers/show.blade.php b/resources/views/customers/show.blade.php new file mode 100644 index 0000000..2cc702b --- /dev/null +++ b/resources/views/customers/show.blade.php @@ -0,0 +1,110 @@ +@extends('layouts.app') + +@section('header') +
+ + +
+
+
+

{{$customer->company_name}}

+
+
+ + + + +
+@endsection + +@section('content') +
+
+ +
+ + + @include('partials.customers.show-overview') + + + @include('partials.customers.show-shipping-info') + + + @include('partials.customers.show-packing-slips') + + + @include('partials.customers.show-contacts') + +
+
+
+ + + @include('partials.customers.edit-modal') + + + @include('partials.customers.delete-single-modal') + + + @include('partials.contacts.create-modal') + + + @include('partials.contacts.delete-modal') + + + @include('partials.packing-slips.create-modal') + + + @include('partials.shipping-entries.create-modal') + + + @if($errors->any()) + {{ implode('', $errors->all('
:message
')) }} + @endif + +@endsection diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index a6970da..1593400 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -17,64 +17,69 @@ @vite(['resources/sass/app.scss', 'resources/js/app.js']) -
- +
+ + +
+ @yield('header') + @yield('content') +
+
-
- @yield('content') -
- diff --git a/resources/views/orders/create.blade.php b/resources/views/orders/create.blade.php new file mode 100644 index 0000000..5c1db42 --- /dev/null +++ b/resources/views/orders/create.blade.php @@ -0,0 +1,130 @@ +@extends('layouts.app') + +@section('content') +
+
+
+

Create Order

+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+
+ +
+ +
+ + +
+ + + @error('order_date') + + {{ $message }} + + @enderror +
+
+ +
+ + +
+ + + @error('due_date') + + {{ $message }} + + @enderror +
+
+ +
+ +
+ +
+ +
+
+ +
+
+
+@endsection diff --git a/resources/views/partials/contacts/create-modal.blade.php b/resources/views/partials/contacts/create-modal.blade.php new file mode 100644 index 0000000..79f2778 --- /dev/null +++ b/resources/views/partials/contacts/create-modal.blade.php @@ -0,0 +1,118 @@ + \ No newline at end of file diff --git a/resources/views/partials/contacts/delete-modal.blade.php b/resources/views/partials/contacts/delete-modal.blade.php new file mode 100644 index 0000000..132262d --- /dev/null +++ b/resources/views/partials/contacts/delete-modal.blade.php @@ -0,0 +1,31 @@ + \ No newline at end of file diff --git a/resources/views/partials/customers/create-modal.blade.php b/resources/views/partials/customers/create-modal.blade.php new file mode 100644 index 0000000..a71e33e --- /dev/null +++ b/resources/views/partials/customers/create-modal.blade.php @@ -0,0 +1,111 @@ + diff --git a/resources/views/partials/customers/delete-all-modal.blade.php b/resources/views/partials/customers/delete-all-modal.blade.php new file mode 100644 index 0000000..41cc261 --- /dev/null +++ b/resources/views/partials/customers/delete-all-modal.blade.php @@ -0,0 +1,31 @@ + diff --git a/resources/views/partials/customers/delete-single-modal.blade.php b/resources/views/partials/customers/delete-single-modal.blade.php new file mode 100644 index 0000000..0289745 --- /dev/null +++ b/resources/views/partials/customers/delete-single-modal.blade.php @@ -0,0 +1,23 @@ + diff --git a/resources/views/partials/customers/edit-modal.blade.php b/resources/views/partials/customers/edit-modal.blade.php new file mode 100644 index 0000000..60a9a00 --- /dev/null +++ b/resources/views/partials/customers/edit-modal.blade.php @@ -0,0 +1,110 @@ + diff --git a/resources/views/partials/customers/show-contacts.blade.php b/resources/views/partials/customers/show-contacts.blade.php new file mode 100644 index 0000000..60e0ea9 --- /dev/null +++ b/resources/views/partials/customers/show-contacts.blade.php @@ -0,0 +1,52 @@ +
+
+
+
+ {{-- --}} + +
+ + +
+
+
+ + @if(sizeof($contacts) !== 0) +
+
+ + + + + + + + + + + + @foreach ($contacts as $contact) + + + + + + + @endforeach + +
NameEmailPhoneNotes
{{ $contact->first_name . ' ' . $contact->last_name }}{{ $contact->email }}{{ $contact->phone }}{{ $contact->notes }}
+
+
+ @else() + No contacts registered for this customer. + @endif() +
\ No newline at end of file diff --git a/resources/views/partials/customers/show-overview.blade.php b/resources/views/partials/customers/show-overview.blade.php new file mode 100644 index 0000000..ab9d2aa --- /dev/null +++ b/resources/views/partials/customers/show-overview.blade.php @@ -0,0 +1,76 @@ +
+ +
+
+
+
+

Active orders

+
+
+ +
+ +
+ + +
+
+
+
+
+
+ + + + + + + + + + + + + + @foreach($active_orders as $order) + + + + + + + + + + @endforeach + +
Internal POCustomer POOrder DateDue DateStatusRushView
{{$order->internal_po}}{{$order->customer_po}}{{$order->order_date}}{{$order->due_date}}{{$order->status->value}} + @if($order->rush) + + @endif + + + + +
+
+
+ +
+
+
+ {{$active_orders->links()}} +
+
+
+ +
diff --git a/resources/views/partials/customers/show-packing-slips.blade.php b/resources/views/partials/customers/show-packing-slips.blade.php new file mode 100644 index 0000000..396876c --- /dev/null +++ b/resources/views/partials/customers/show-packing-slips.blade.php @@ -0,0 +1,66 @@ +
+
+
+
+ {{-- --}} + + + +
+ + {{--
--}} + +
+ + +
+
+
+
+ +
+
+ + + + + + + + + + + @foreach($packingSlips as $packingSlip) + + + + + + + @endforeach + +
DatePOAmountContents
{{$packingSlip->date_received}}{{$packingSlip->order_id}}{{$packingSlip->amount}}{{$packingSlip->contents}}
+
+
+ +
+
+
+ {{$packingSlips->links()}} +
+
+
+ +
\ No newline at end of file diff --git a/resources/views/partials/customers/show-shipping-info.blade.php b/resources/views/partials/customers/show-shipping-info.blade.php new file mode 100644 index 0000000..29fb846 --- /dev/null +++ b/resources/views/partials/customers/show-shipping-info.blade.php @@ -0,0 +1,99 @@ +
+
+
+
+ + +
+ +
+ + +
+
+
+
+ +
+ @foreach($shippingEntries as $shippingEntry) +
+
+
+ {{$shippingEntry->account_title}} +
+
+ +
+
Shipping Type
+
+
{{$shippingEntry->shipping_type}}
+
+
+ +
+ +
+
Courier
+
+
{{$shippingEntry->courier}}
+
+
+ +
+
Contact
+ +
+ +
+
Login
+
+
+ {{$shippingEntry->account_username}}
+ {{$shippingEntry->account_password}} +
+
+
+ +
+ +
+
Required Info +
+
+
{{$shippingEntry->info_needed}}
+
+
+ +
+
Notify
+ +
+ +
+
Notes
+
+
{{$shippingEntry->notes}}
+
+
+ +
+
+
+ @endforeach +
+
\ No newline at end of file diff --git a/resources/views/partials/packing-slips/create-modal.blade.php b/resources/views/partials/packing-slips/create-modal.blade.php new file mode 100644 index 0000000..7c1a184 --- /dev/null +++ b/resources/views/partials/packing-slips/create-modal.blade.php @@ -0,0 +1,114 @@ + diff --git a/resources/views/partials/shipping-entries/create-modal.blade.php b/resources/views/partials/shipping-entries/create-modal.blade.php new file mode 100644 index 0000000..9454f48 --- /dev/null +++ b/resources/views/partials/shipping-entries/create-modal.blade.php @@ -0,0 +1,128 @@ + + diff --git a/resources/views/vendor/pagination/bootstrap-4.blade.php b/resources/views/vendor/pagination/bootstrap-4.blade.php new file mode 100644 index 0000000..63c6f56 --- /dev/null +++ b/resources/views/vendor/pagination/bootstrap-4.blade.php @@ -0,0 +1,46 @@ +@if ($paginator->hasPages()) + +@endif diff --git a/resources/views/vendor/pagination/bootstrap-5.blade.php b/resources/views/vendor/pagination/bootstrap-5.blade.php new file mode 100644 index 0000000..a1795a4 --- /dev/null +++ b/resources/views/vendor/pagination/bootstrap-5.blade.php @@ -0,0 +1,88 @@ +@if ($paginator->hasPages()) + +@endif diff --git a/resources/views/vendor/pagination/default.blade.php b/resources/views/vendor/pagination/default.blade.php new file mode 100644 index 0000000..0db70b5 --- /dev/null +++ b/resources/views/vendor/pagination/default.blade.php @@ -0,0 +1,46 @@ +@if ($paginator->hasPages()) + +@endif diff --git a/resources/views/vendor/pagination/semantic-ui.blade.php b/resources/views/vendor/pagination/semantic-ui.blade.php new file mode 100644 index 0000000..ef0dbb1 --- /dev/null +++ b/resources/views/vendor/pagination/semantic-ui.blade.php @@ -0,0 +1,36 @@ +@if ($paginator->hasPages()) + +@endif diff --git a/resources/views/vendor/pagination/simple-bootstrap-4.blade.php b/resources/views/vendor/pagination/simple-bootstrap-4.blade.php new file mode 100644 index 0000000..4bb4917 --- /dev/null +++ b/resources/views/vendor/pagination/simple-bootstrap-4.blade.php @@ -0,0 +1,27 @@ +@if ($paginator->hasPages()) + +@endif diff --git a/resources/views/vendor/pagination/simple-bootstrap-5.blade.php b/resources/views/vendor/pagination/simple-bootstrap-5.blade.php new file mode 100644 index 0000000..a89005e --- /dev/null +++ b/resources/views/vendor/pagination/simple-bootstrap-5.blade.php @@ -0,0 +1,29 @@ +@if ($paginator->hasPages()) + +@endif diff --git a/resources/views/vendor/pagination/simple-default.blade.php b/resources/views/vendor/pagination/simple-default.blade.php new file mode 100644 index 0000000..36bdbc1 --- /dev/null +++ b/resources/views/vendor/pagination/simple-default.blade.php @@ -0,0 +1,19 @@ +@if ($paginator->hasPages()) + +@endif diff --git a/resources/views/vendor/pagination/simple-tailwind.blade.php b/resources/views/vendor/pagination/simple-tailwind.blade.php new file mode 100644 index 0000000..ea02400 --- /dev/null +++ b/resources/views/vendor/pagination/simple-tailwind.blade.php @@ -0,0 +1,25 @@ +@if ($paginator->hasPages()) + +@endif diff --git a/resources/views/vendor/pagination/tailwind.blade.php b/resources/views/vendor/pagination/tailwind.blade.php new file mode 100644 index 0000000..aee2ad2 --- /dev/null +++ b/resources/views/vendor/pagination/tailwind.blade.php @@ -0,0 +1,106 @@ +@if ($paginator->hasPages()) + +@endif diff --git a/routes/web.php b/routes/web.php index a69fb68..c3f8633 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,6 +1,11 @@ name('home'); Route::resource('customers', CustomerController::class); + +Route::get('/customers/{customer}/{tab}', [CustomerController::class, 'show'])->name('customers.show'); +Route::get('/customers/', [CustomerController::class, 'index'])->name('customers.index'); +Route::post('/customers/request-destroy', [CustomerController::class, 'requestDestroy'])->name('customers.requestDestroy'); + +Route::resource('contacts', ContactController::class); +Route::post('/contacts/request-destroy', [ContactController::class, 'requestDestroy'])->name('contacts.requestDestroy'); + +Route::resource('packing-slips', PackingSlipController::class); + +Route::resource('shipping-entries', ShippingEntryController::class); + +Route::resource('orders', OrderController::class); \ No newline at end of file From 87f7581acae8798d0df065b922146cc6f8dd2f0b Mon Sep 17 00:00:00 2001 From: Nisse Date: Mon, 9 Sep 2024 15:29:31 -0700 Subject: [PATCH 2/2] basics test --- app/Enums/OrderStatus.php | 7 +- app/Enums/OrderType.php | 8 +- app/Enums/ShippingType.php | 4 +- .../Controllers/Auth/RegisterController.php | 10 +- app/Http/Controllers/ContactController.php | 27 +- app/Http/Controllers/CustomerController.php | 38 +-- app/Http/Controllers/DashboardController.php | 34 ++ app/Http/Controllers/HomeController.php | 28 -- app/Http/Controllers/ManagementController.php | 22 ++ app/Http/Controllers/OrderController.php | 101 +++++- .../Controllers/OrderProductController.php | 25 ++ .../Controllers/PackingSlipController.php | 30 +- .../Controllers/ShippingEntryController.php | 25 +- app/Http/Requests/ContactRequest.php | 10 +- app/Http/Requests/CustomerRequest.php | 8 +- app/Http/Requests/OrderProductRequest.php | 23 ++ app/Http/Requests/OrderRequest.php | 27 +- app/Http/Requests/PackingSlipRequest.php | 10 +- app/Http/Requests/ProductServiceRequest.php | 26 ++ app/Http/Requests/ProductSizeRequest.php | 22 ++ app/Http/Requests/ServiceFileRequest.php | 24 ++ app/Http/Requests/ShippingEntryRequest.php | 16 +- app/Livewire/CreateOrder.php | 42 +++ app/Livewire/CustomerAndContactSelect.php | 41 +++ app/Livewire/OrderProductsCreate.php | 158 +++++++++ app/Livewire/OrdersTable.php | 61 ++++ app/Models/Contact.php | 9 +- app/Models/Customer.php | 2 +- app/Models/Order.php | 70 +++- app/Models/OrderProduct.php | 37 +++ app/Models/PackingSlip.php | 5 +- app/Models/ProductService.php | 33 ++ app/Models/ProductSize.php | 24 ++ app/Models/ServiceFile.php | 28 ++ app/Models/ShippingEntry.php | 4 +- app/Models/User.php | 2 +- composer.json | 5 +- composer.lock | 94 +++++- config/app.php | 2 +- config/auth.php | 10 +- config/cache.php | 36 +-- config/database.php | 126 ++++---- config/filesystems.php | 28 +- config/logging.php | 60 ++-- config/mail.php | 26 +- config/queue.php | 50 +-- config/services.php | 4 +- database/factories/ContactFactory.php | 10 +- database/factories/CustomerFactory.php | 19 +- database/factories/OrderFactory.php | 31 +- database/factories/OrderProductFactory.php | 23 ++ database/factories/PackingSlipFactory.php | 10 +- database/factories/ProductServiceFactory.php | 25 ++ database/factories/ProductSizeFactory.php | 22 ++ database/factories/ServiceFileFactory.php | 25 ++ database/factories/ShippingEntryFactory.php | 17 +- database/factories/UserFactory.php | 8 +- ...24_09_03_204957_create_customers_table.php | 3 +- ...024_09_04_203012_create_contacts_table.php | 3 +- ...9_05_215151_create_packing_slips_table.php | 5 +- ...6_213725_create_shipping_entries_table.php | 3 +- .../2024_09_09_194631_create_orders_table.php | 16 +- ..._10_224439_create_order_products_table.php | 26 ++ ...0_224947_create_product_services_table.php | 28 ++ ...9_10_225029_create_service_files_table.php | 30 ++ ...9_10_230904_create_product_sizes_table.php | 25 ++ database/seeders/CustomerSeeder.php | 92 ++++++ database/seeders/DatabaseSeeder.php | 80 +---- pint.json | 12 + resources/sass/app.scss | 11 + resources/views/customers/index.blade.php | 144 --------- resources/views/customers/show.blade.php | 12 +- resources/views/dashboard.blade.php | 59 ++++ resources/views/home.blade.php | 23 -- resources/views/layouts/app.blade.php | 60 +--- resources/views/layouts/nav.blade.php | 97 ++++++ .../views/livewire/create-order.blade.php | 3 + .../customer-and-contact-select.blade.php | 44 +++ .../livewire/order-products-create.blade.php | 299 ++++++++++++++++++ .../views/livewire/orders-table.blade.php | 111 +++++++ resources/views/management/index.blade.php | 27 ++ .../views/order-products/create.blade.php | 39 +++ resources/views/orders/create.blade.php | 277 ++++++++++------ resources/views/orders/index.blade.php | 91 ++++++ resources/views/orders/show.blade.php | 71 +++++ .../partials/customers/edit-modal.blade.php | 110 ------- .../{ => index}/create-modal.blade.php | 0 .../{ => index}/delete-all-modal.blade.php | 0 .../customers/show-overview.blade.php | 76 ----- .../contacts-tab.blade.php} | 8 +- .../customers/show/overview-tab.blade.php | 6 + .../packing-slips-tab.blade.php} | 10 +- .../shipping-info-tab.blade.php} | 0 .../management/index/customers.blade.php | 76 +++++ .../index/management-tabs.blade.php | 43 +++ .../management/index/packing-slips.blade.php | 5 + .../management/index/service-files.blade.php | 5 + .../vendor/pagination/bootstrap-4.blade.php | 46 --- .../vendor/pagination/bootstrap-5.blade.php | 88 ------ .../views/vendor/pagination/default.blade.php | 46 --- .../vendor/pagination/semantic-ui.blade.php | 36 --- .../pagination/simple-bootstrap-4.blade.php | 27 -- .../pagination/simple-bootstrap-5.blade.php | 29 -- .../pagination/simple-default.blade.php | 19 -- .../pagination/simple-tailwind.blade.php | 25 -- .../vendor/pagination/tailwind.blade.php | 106 ------- routes/web.php | 19 +- 107 files changed, 2676 insertions(+), 1467 deletions(-) create mode 100644 app/Http/Controllers/DashboardController.php delete mode 100644 app/Http/Controllers/HomeController.php create mode 100644 app/Http/Controllers/ManagementController.php create mode 100644 app/Http/Controllers/OrderProductController.php create mode 100644 app/Http/Requests/OrderProductRequest.php create mode 100644 app/Http/Requests/ProductServiceRequest.php create mode 100644 app/Http/Requests/ProductSizeRequest.php create mode 100644 app/Http/Requests/ServiceFileRequest.php create mode 100644 app/Livewire/CreateOrder.php create mode 100644 app/Livewire/CustomerAndContactSelect.php create mode 100644 app/Livewire/OrderProductsCreate.php create mode 100644 app/Livewire/OrdersTable.php create mode 100644 app/Models/OrderProduct.php create mode 100644 app/Models/ProductService.php create mode 100644 app/Models/ProductSize.php create mode 100644 app/Models/ServiceFile.php create mode 100644 database/factories/OrderProductFactory.php create mode 100644 database/factories/ProductServiceFactory.php create mode 100644 database/factories/ProductSizeFactory.php create mode 100644 database/factories/ServiceFileFactory.php create mode 100644 database/migrations/2024_09_10_224439_create_order_products_table.php create mode 100644 database/migrations/2024_09_10_224947_create_product_services_table.php create mode 100644 database/migrations/2024_09_10_225029_create_service_files_table.php create mode 100644 database/migrations/2024_09_10_230904_create_product_sizes_table.php create mode 100644 database/seeders/CustomerSeeder.php create mode 100644 pint.json delete mode 100644 resources/views/customers/index.blade.php create mode 100644 resources/views/dashboard.blade.php delete mode 100644 resources/views/home.blade.php create mode 100644 resources/views/layouts/nav.blade.php create mode 100644 resources/views/livewire/create-order.blade.php create mode 100644 resources/views/livewire/customer-and-contact-select.blade.php create mode 100644 resources/views/livewire/order-products-create.blade.php create mode 100644 resources/views/livewire/orders-table.blade.php create mode 100644 resources/views/management/index.blade.php create mode 100644 resources/views/order-products/create.blade.php create mode 100644 resources/views/orders/index.blade.php create mode 100644 resources/views/orders/show.blade.php delete mode 100644 resources/views/partials/customers/edit-modal.blade.php rename resources/views/partials/customers/{ => index}/create-modal.blade.php (100%) rename resources/views/partials/customers/{ => index}/delete-all-modal.blade.php (100%) delete mode 100644 resources/views/partials/customers/show-overview.blade.php rename resources/views/partials/customers/{show-contacts.blade.php => show/contacts-tab.blade.php} (83%) create mode 100644 resources/views/partials/customers/show/overview-tab.blade.php rename resources/views/partials/customers/{show-packing-slips.blade.php => show/packing-slips-tab.blade.php} (86%) rename resources/views/partials/customers/{show-shipping-info.blade.php => show/shipping-info-tab.blade.php} (100%) create mode 100644 resources/views/partials/management/index/customers.blade.php create mode 100644 resources/views/partials/management/index/management-tabs.blade.php create mode 100644 resources/views/partials/management/index/packing-slips.blade.php create mode 100644 resources/views/partials/management/index/service-files.blade.php delete mode 100644 resources/views/vendor/pagination/bootstrap-4.blade.php delete mode 100644 resources/views/vendor/pagination/bootstrap-5.blade.php delete mode 100644 resources/views/vendor/pagination/default.blade.php delete mode 100644 resources/views/vendor/pagination/semantic-ui.blade.php delete mode 100644 resources/views/vendor/pagination/simple-bootstrap-4.blade.php delete mode 100644 resources/views/vendor/pagination/simple-bootstrap-5.blade.php delete mode 100644 resources/views/vendor/pagination/simple-default.blade.php delete mode 100644 resources/views/vendor/pagination/simple-tailwind.blade.php delete mode 100644 resources/views/vendor/pagination/tailwind.blade.php diff --git a/app/Enums/OrderStatus.php b/app/Enums/OrderStatus.php index 77ae5cd..e1b766a 100644 --- a/app/Enums/OrderStatus.php +++ b/app/Enums/OrderStatus.php @@ -4,9 +4,8 @@ namespace App\Enums; enum OrderStatus: string { - case ORDER = 'Order'; - case APPROVED = 'Approved'; + case APPROVED = 'Approved'; case PRODUCTION = 'Production'; - case COMPLETED = 'Completed'; - case CANCELLED = 'Cancelled'; + case SHIPPED = 'Shipped'; + case INVOICED = 'Invoiced'; } diff --git a/app/Enums/OrderType.php b/app/Enums/OrderType.php index 014d883..4db7a40 100644 --- a/app/Enums/OrderType.php +++ b/app/Enums/OrderType.php @@ -5,8 +5,8 @@ namespace App\Enums; enum OrderType: string { case EMBROIDERY = 'Embroidery'; - case SCREEN = 'Screen printing'; - case DTG = 'Direct-to-garment'; - case VINYL = 'Vinyl'; - case MISC = 'Misc'; + case SCREEN = 'Screen printing'; + case DTG = 'Direct-to-garment'; + case VINYL = 'Vinyl'; + case MISC = 'Misc'; } diff --git a/app/Enums/ShippingType.php b/app/Enums/ShippingType.php index 8b7a155..b7ddfdc 100644 --- a/app/Enums/ShippingType.php +++ b/app/Enums/ShippingType.php @@ -5,6 +5,6 @@ namespace App\Enums; enum ShippingType: string { case THEY_SHIP = 'They ship'; - case WE_SHIP = 'We ship'; - case PICKUP = 'Pickup'; + case WE_SHIP = 'We ship'; + case PICKUP = 'Pickup'; } diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 961ea36..66812f7 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -43,14 +43,13 @@ class RegisterController extends Controller /** * Get a validator for an incoming registration request. * - * @param array $data * @return \Illuminate\Contracts\Validation\Validator */ protected function validator(array $data) { return Validator::make($data, [ - 'name' => ['required', 'string', 'max:255'], - 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], + 'name' => ['required', 'string', 'max:255'], + 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 'password' => ['required', 'string', 'min:8', 'confirmed'], ]); } @@ -58,14 +57,13 @@ class RegisterController extends Controller /** * Create a new user instance after a valid registration. * - * @param array $data * @return \App\Models\User */ protected function create(array $data) { return User::create([ - 'name' => $data['name'], - 'email' => $data['email'], + 'name' => $data['name'], + 'email' => $data['email'], 'password' => Hash::make($data['password']), ]); } diff --git a/app/Http/Controllers/ContactController.php b/app/Http/Controllers/ContactController.php index 4172381..dbafc47 100644 --- a/app/Http/Controllers/ContactController.php +++ b/app/Http/Controllers/ContactController.php @@ -9,15 +9,12 @@ use Illuminate\Http\Request; class ContactController extends Controller { - public function index() - { - - } + public function index() {} public function create(Request $request) { return view('contacts.create', [ - 'customers' => Customer::all(), + 'customers' => Customer::all(), 'fromCustomer' => $request->get('customer'), ]); } @@ -29,17 +26,11 @@ class ContactController extends Controller 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) { @@ -49,11 +40,5 @@ class ContactController extends Controller return redirect()->route('customers.show', [$contact->customer->id, 'contacts'])->with('status', 'Contact deleted successfully'); } - public function destroy($id) - { -// $contact = Contact::findOrFail($id); -// $contact->delete(); -// -// return redirect()->route('customers.show', $contact->customer()->iud)->with('status', 'Contact deleted successfully'); - } + public function destroy($id) {} } diff --git a/app/Http/Controllers/CustomerController.php b/app/Http/Controllers/CustomerController.php index 0bc5ee0..13ebe99 100644 --- a/app/Http/Controllers/CustomerController.php +++ b/app/Http/Controllers/CustomerController.php @@ -5,25 +5,18 @@ namespace App\Http\Controllers; 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,28 +24,19 @@ class CustomerController extends Controller 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']); } - $orders = $customer->orders(); - $priorities = '"production", "approved", "order"'; - return view('customers.show', [ - 'tab' => $tab, - 'customer' => $customer, - 'active_orders' => $orders - ->where('status', '!=', 'cancelled') - ->where('status', '!=', 'completed') - ->orderBy('rush', 'desc') - ->orderBy('due_date', 'desc') - ->paginate(10), - 'contacts' => $customer->contacts()->get(), - 'packingSlips' => PackingSlip::where('customer_id', $customer->id)->orderByDesc('date_received')->paginate(15), + 'tab' => $tab, + 'customer' => $customer, + 'contacts' => $customer->contacts()->get(), + 'packingSlips' => PackingSlip::where('customer_id', $customer->id)->orderByDesc('date_received')->paginate(15), 'shippingEntries' => $customer->shippingEntries()->get(), - 'today' => Carbon::today()->format('Y-m-d'), + 'today' => Carbon::today()->format('Y-m-d'), ]); } @@ -68,13 +52,13 @@ class CustomerController extends Controller $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..14b83d5 --- /dev/null +++ b/app/Http/Controllers/DashboardController.php @@ -0,0 +1,34 @@ +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'), + ]); + } +} 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..1fa53eb --- /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 @@ namespace App\Http\Controllers; 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 @@ use Illuminate\Http\Request; 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 @@ class ShippingEntryController extends Controller 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..c27da6f 100644 --- a/app/Http/Requests/ContactRequest.php +++ b/app/Http/Requests/ContactRequest.php @@ -12,11 +12,11 @@ class ContactRequest extends FormRequest return [ 'customer_id' => 'required|exists:customers,id', - 'first_name' => 'string', - 'last_name' => 'string', - 'email' => 'string', - 'phone' => 'string', - 'notes' => 'string' + 'first_name' => 'string', + 'last_name' => 'string', + 'email' => 'string', + 'phone' => 'string', + 'notes' => 'string', ]; } diff --git a/app/Http/Requests/CustomerRequest.php b/app/Http/Requests/CustomerRequest.php index d433a8c..fbf4a9f 100644 --- a/app/Http/Requests/CustomerRequest.php +++ b/app/Http/Requests/CustomerRequest.php @@ -9,11 +9,11 @@ class CustomerRequest extends FormRequest public function rules() { return [ - 'company_name' => 'required', - 'internal_name' => 'required', + 'company_name' => 'required', + 'internal_name' => 'required', 'shipping_address' => 'required', - 'billing_address' => 'required', - 'phone' => 'required', + 'billing_address' => 'required', + 'phone' => 'required', ]; } diff --git a/app/Http/Requests/OrderProductRequest.php b/app/Http/Requests/OrderProductRequest.php new file mode 100644 index 0000000..6bd0f32 --- /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..01ce8d3 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'], - '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'], + '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' => ['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..b2a1669 100644 --- a/app/Http/Requests/PackingSlipRequest.php +++ b/app/Http/Requests/PackingSlipRequest.php @@ -10,11 +10,11 @@ class PackingSlipRequest extends FormRequest { return [ 'date_received' => 'required|date', - 'customer_id' => 'required|exists:customers,id', - 'order_id' => 'string|nullable', - 'amount' => 'required|string', - 'contents' => 'required|string', - 'from_customer' => 'required|bool' + 'customer_id' => 'required|exists:customers,id', + 'order_id' => 'string|nullable', + 'amount' => 'required|string', + 'contents' => 'required|string', + 'from_customer' => 'required|bool', ]; } diff --git a/app/Http/Requests/ProductServiceRequest.php b/app/Http/Requests/ProductServiceRequest.php new file mode 100644 index 0000000..6b0f49f --- /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..6c5894a --- /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..3e73e6a --- /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/Http/Requests/ShippingEntryRequest.php b/app/Http/Requests/ShippingEntryRequest.php index 73f81f8..d665dba 100644 --- a/app/Http/Requests/ShippingEntryRequest.php +++ b/app/Http/Requests/ShippingEntryRequest.php @@ -9,16 +9,16 @@ class ShippingEntryRequest extends FormRequest public function rules(): array { return [ - 'shipping_type' => ['required'], - 'customer_id' => ['required', 'exists:customers,id'], - 'courier' => ['nullable'], - 'contact' => ['nullable'], - 'account_title' => ['nullable'], + 'shipping_type' => ['required'], + 'customer_id' => ['required', 'exists:customers,id'], + 'courier' => ['nullable'], + 'contact' => ['nullable'], + 'account_title' => ['nullable'], 'account_username' => ['nullable'], 'account_password' => ['nullable'], - 'info_needed' => ['nullable'], - 'notify' => ['nullable'], - 'notes' => ['nullable'], + 'info_needed' => ['nullable'], + 'notify' => ['nullable'], + 'notes' => ['nullable'], ]; } diff --git a/app/Livewire/CreateOrder.php b/app/Livewire/CreateOrder.php new file mode 100644 index 0000000..7d26fa7 --- /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..3367f0d --- /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..897ca36 --- /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 @@ use Illuminate\Database\Eloquent\SoftDeletes; 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 @@ use Illuminate\Database\Eloquent\SoftDeletes; 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..6de9166 100644 --- a/app/Models/Order.php +++ b/app/Models/Order.php @@ -7,19 +7,22 @@ use DateTimeInterface; 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() + { + 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::COMPLETED || $this->status === OrderStatus::CANCELLED) { - return false; + 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 @@ class Order extends Model 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 @@ use Illuminate\Database\Eloquent\SoftDeletes; 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 @@ use Illuminate\Database\Eloquent\SoftDeletes; 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/app/Models/User.php b/app/Models/User.php index def621f..7843cf3 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -41,7 +41,7 @@ class User extends Authenticatable { return [ 'email_verified_at' => 'datetime', - 'password' => 'hashed', + 'password' => 'hashed', ]; } } 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/config/app.php b/config/app.php index adb441d..7d7c724 100644 --- a/config/app.php +++ b/config/app.php @@ -120,7 +120,7 @@ return [ 'maintenance' => [ 'driver' => env('APP_MAINTENANCE_DRIVER', 'file'), - 'store' => env('APP_MAINTENANCE_STORE', 'database'), + 'store' => env('APP_MAINTENANCE_STORE', 'database'), ], ]; diff --git a/config/auth.php b/config/auth.php index 0ba5d5d..0e3454b 100644 --- a/config/auth.php +++ b/config/auth.php @@ -14,7 +14,7 @@ return [ */ 'defaults' => [ - 'guard' => env('AUTH_GUARD', 'web'), + 'guard' => env('AUTH_GUARD', 'web'), 'passwords' => env('AUTH_PASSWORD_BROKER', 'users'), ], @@ -37,7 +37,7 @@ return [ 'guards' => [ 'web' => [ - 'driver' => 'session', + 'driver' => 'session', 'provider' => 'users', ], ], @@ -62,7 +62,7 @@ return [ 'providers' => [ 'users' => [ 'driver' => 'eloquent', - 'model' => env('AUTH_MODEL', App\Models\User::class), + 'model' => env('AUTH_MODEL', App\Models\User::class), ], // 'users' => [ @@ -93,8 +93,8 @@ return [ 'passwords' => [ 'users' => [ 'provider' => 'users', - 'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'), - 'expire' => 60, + 'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'), + 'expire' => 60, 'throttle' => 60, ], ], diff --git a/config/cache.php b/config/cache.php index 925f7d2..068175b 100644 --- a/config/cache.php +++ b/config/cache.php @@ -34,28 +34,28 @@ return [ 'stores' => [ 'array' => [ - 'driver' => 'array', + 'driver' => 'array', 'serialize' => false, ], 'database' => [ - 'driver' => 'database', - 'connection' => env('DB_CACHE_CONNECTION'), - 'table' => env('DB_CACHE_TABLE', 'cache'), + 'driver' => 'database', + 'connection' => env('DB_CACHE_CONNECTION'), + 'table' => env('DB_CACHE_TABLE', 'cache'), 'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'), - 'lock_table' => env('DB_CACHE_LOCK_TABLE'), + 'lock_table' => env('DB_CACHE_LOCK_TABLE'), ], 'file' => [ - 'driver' => 'file', - 'path' => storage_path('framework/cache/data'), + 'driver' => 'file', + 'path' => storage_path('framework/cache/data'), 'lock_path' => storage_path('framework/cache/data'), ], 'memcached' => [ - 'driver' => 'memcached', + 'driver' => 'memcached', 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), - 'sasl' => [ + 'sasl' => [ env('MEMCACHED_USERNAME'), env('MEMCACHED_PASSWORD'), ], @@ -64,25 +64,25 @@ return [ ], 'servers' => [ [ - 'host' => env('MEMCACHED_HOST', '127.0.0.1'), - 'port' => env('MEMCACHED_PORT', 11211), + 'host' => env('MEMCACHED_HOST', '127.0.0.1'), + 'port' => env('MEMCACHED_PORT', 11211), 'weight' => 100, ], ], ], 'redis' => [ - 'driver' => 'redis', - 'connection' => env('REDIS_CACHE_CONNECTION', 'cache'), + 'driver' => 'redis', + 'connection' => env('REDIS_CACHE_CONNECTION', 'cache'), 'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'), ], 'dynamodb' => [ - 'driver' => 'dynamodb', - 'key' => env('AWS_ACCESS_KEY_ID'), - 'secret' => env('AWS_SECRET_ACCESS_KEY'), - 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), - 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), + 'driver' => 'dynamodb', + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), + 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), 'endpoint' => env('DYNAMODB_ENDPOINT'), ], diff --git a/config/database.php b/config/database.php index 125949e..2cb0d30 100644 --- a/config/database.php +++ b/config/database.php @@ -32,81 +32,81 @@ return [ 'connections' => [ 'sqlite' => [ - 'driver' => 'sqlite', - 'url' => env('DB_URL'), - 'database' => env('DB_DATABASE', database_path('database.sqlite')), - 'prefix' => '', + 'driver' => 'sqlite', + 'url' => env('DB_URL'), + 'database' => env('DB_DATABASE', database_path('database.sqlite')), + 'prefix' => '', 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), - 'busy_timeout' => null, - 'journal_mode' => null, - 'synchronous' => null, + 'busy_timeout' => null, + 'journal_mode' => null, + 'synchronous' => null, ], 'mysql' => [ - 'driver' => 'mysql', - 'url' => env('DB_URL'), - 'host' => env('DB_HOST', '127.0.0.1'), - 'port' => env('DB_PORT', '3306'), - 'database' => env('DB_DATABASE', 'laravel'), - 'username' => env('DB_USERNAME', 'root'), - 'password' => env('DB_PASSWORD', ''), - 'unix_socket' => env('DB_SOCKET', ''), - 'charset' => env('DB_CHARSET', 'utf8mb4'), - 'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'), - 'prefix' => '', + 'driver' => 'mysql', + 'url' => env('DB_URL'), + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '3306'), + 'database' => env('DB_DATABASE', 'laravel'), + 'username' => env('DB_USERNAME', 'root'), + 'password' => env('DB_PASSWORD', ''), + 'unix_socket' => env('DB_SOCKET', ''), + 'charset' => env('DB_CHARSET', 'utf8mb4'), + 'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'), + 'prefix' => '', 'prefix_indexes' => true, - 'strict' => true, - 'engine' => null, - 'options' => extension_loaded('pdo_mysql') ? array_filter([ + 'strict' => true, + 'engine' => null, + 'options' => extension_loaded('pdo_mysql') ? array_filter([ PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), ]) : [], ], 'mariadb' => [ - 'driver' => 'mariadb', - 'url' => env('DB_URL'), - 'host' => env('DB_HOST', '127.0.0.1'), - 'port' => env('DB_PORT', '3306'), - 'database' => env('DB_DATABASE', 'laravel'), - 'username' => env('DB_USERNAME', 'root'), - 'password' => env('DB_PASSWORD', ''), - 'unix_socket' => env('DB_SOCKET', ''), - 'charset' => env('DB_CHARSET', 'utf8mb4'), - 'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'), - 'prefix' => '', + 'driver' => 'mariadb', + 'url' => env('DB_URL'), + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '3306'), + 'database' => env('DB_DATABASE', 'laravel'), + 'username' => env('DB_USERNAME', 'root'), + 'password' => env('DB_PASSWORD', ''), + 'unix_socket' => env('DB_SOCKET', ''), + 'charset' => env('DB_CHARSET', 'utf8mb4'), + 'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'), + 'prefix' => '', 'prefix_indexes' => true, - 'strict' => true, - 'engine' => null, - 'options' => extension_loaded('pdo_mysql') ? array_filter([ + 'strict' => true, + 'engine' => null, + 'options' => extension_loaded('pdo_mysql') ? array_filter([ PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), ]) : [], ], 'pgsql' => [ - 'driver' => 'pgsql', - 'url' => env('DB_URL'), - 'host' => env('DB_HOST', '127.0.0.1'), - 'port' => env('DB_PORT', '5432'), - 'database' => env('DB_DATABASE', 'laravel'), - 'username' => env('DB_USERNAME', 'root'), - 'password' => env('DB_PASSWORD', ''), - 'charset' => env('DB_CHARSET', 'utf8'), - 'prefix' => '', + 'driver' => 'pgsql', + 'url' => env('DB_URL'), + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '5432'), + 'database' => env('DB_DATABASE', 'laravel'), + 'username' => env('DB_USERNAME', 'root'), + 'password' => env('DB_PASSWORD', ''), + 'charset' => env('DB_CHARSET', 'utf8'), + 'prefix' => '', 'prefix_indexes' => true, - 'search_path' => 'public', - 'sslmode' => 'prefer', + 'search_path' => 'public', + 'sslmode' => 'prefer', ], 'sqlsrv' => [ - 'driver' => 'sqlsrv', - 'url' => env('DB_URL'), - 'host' => env('DB_HOST', 'localhost'), - 'port' => env('DB_PORT', '1433'), - 'database' => env('DB_DATABASE', 'laravel'), - 'username' => env('DB_USERNAME', 'root'), - 'password' => env('DB_PASSWORD', ''), - 'charset' => env('DB_CHARSET', 'utf8'), - 'prefix' => '', + 'driver' => 'sqlsrv', + 'url' => env('DB_URL'), + 'host' => env('DB_HOST', 'localhost'), + 'port' => env('DB_PORT', '1433'), + 'database' => env('DB_DATABASE', 'laravel'), + 'username' => env('DB_USERNAME', 'root'), + 'password' => env('DB_PASSWORD', ''), + 'charset' => env('DB_CHARSET', 'utf8'), + 'prefix' => '', 'prefix_indexes' => true, // 'encrypt' => env('DB_ENCRYPT', 'yes'), // 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'), @@ -126,7 +126,7 @@ return [ */ 'migrations' => [ - 'table' => 'migrations', + 'table' => 'migrations', 'update_date_on_publish' => true, ], @@ -147,24 +147,24 @@ return [ 'options' => [ 'cluster' => env('REDIS_CLUSTER', 'redis'), - 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), + 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), ], 'default' => [ - 'url' => env('REDIS_URL'), - 'host' => env('REDIS_HOST', '127.0.0.1'), + 'url' => env('REDIS_URL'), + 'host' => env('REDIS_HOST', '127.0.0.1'), 'username' => env('REDIS_USERNAME'), 'password' => env('REDIS_PASSWORD'), - 'port' => env('REDIS_PORT', '6379'), + 'port' => env('REDIS_PORT', '6379'), 'database' => env('REDIS_DB', '0'), ], 'cache' => [ - 'url' => env('REDIS_URL'), - 'host' => env('REDIS_HOST', '127.0.0.1'), + 'url' => env('REDIS_URL'), + 'host' => env('REDIS_HOST', '127.0.0.1'), 'username' => env('REDIS_USERNAME'), 'password' => env('REDIS_PASSWORD'), - 'port' => env('REDIS_PORT', '6379'), + 'port' => env('REDIS_PORT', '6379'), 'database' => env('REDIS_CACHE_DB', '1'), ], diff --git a/config/filesystems.php b/config/filesystems.php index c5f244d..5033bd8 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -32,28 +32,28 @@ return [ 'local' => [ 'driver' => 'local', - 'root' => storage_path('app'), - 'throw' => false, + 'root' => storage_path('app'), + 'throw' => false, ], 'public' => [ - 'driver' => 'local', - 'root' => storage_path('app/public'), - 'url' => env('APP_URL').'/storage', + 'driver' => 'local', + 'root' => storage_path('app/public'), + 'url' => env('APP_URL').'/storage', 'visibility' => 'public', - 'throw' => false, + 'throw' => false, ], 's3' => [ - 'driver' => 's3', - 'key' => env('AWS_ACCESS_KEY_ID'), - 'secret' => env('AWS_SECRET_ACCESS_KEY'), - 'region' => env('AWS_DEFAULT_REGION'), - 'bucket' => env('AWS_BUCKET'), - 'url' => env('AWS_URL'), - 'endpoint' => env('AWS_ENDPOINT'), + 'driver' => 's3', + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'region' => env('AWS_DEFAULT_REGION'), + 'bucket' => env('AWS_BUCKET'), + 'url' => env('AWS_URL'), + 'endpoint' => env('AWS_ENDPOINT'), 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), - 'throw' => false, + 'throw' => false, ], ], diff --git a/config/logging.php b/config/logging.php index 8d94292..22a95b5 100644 --- a/config/logging.php +++ b/config/logging.php @@ -33,7 +33,7 @@ return [ 'deprecations' => [ 'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'), - 'trace' => env('LOG_DEPRECATIONS_TRACE', false), + 'trace' => env('LOG_DEPRECATIONS_TRACE', false), ], /* @@ -53,73 +53,73 @@ return [ 'channels' => [ 'stack' => [ - 'driver' => 'stack', - 'channels' => explode(',', env('LOG_STACK', 'single')), + 'driver' => 'stack', + 'channels' => explode(',', env('LOG_STACK', 'single')), 'ignore_exceptions' => false, ], 'single' => [ - 'driver' => 'single', - 'path' => storage_path('logs/laravel.log'), - 'level' => env('LOG_LEVEL', 'debug'), + 'driver' => 'single', + 'path' => storage_path('logs/laravel.log'), + 'level' => env('LOG_LEVEL', 'debug'), 'replace_placeholders' => true, ], 'daily' => [ - 'driver' => 'daily', - 'path' => storage_path('logs/laravel.log'), - 'level' => env('LOG_LEVEL', 'debug'), - 'days' => env('LOG_DAILY_DAYS', 14), + 'driver' => 'daily', + 'path' => storage_path('logs/laravel.log'), + 'level' => env('LOG_LEVEL', 'debug'), + 'days' => env('LOG_DAILY_DAYS', 14), 'replace_placeholders' => true, ], 'slack' => [ - 'driver' => 'slack', - 'url' => env('LOG_SLACK_WEBHOOK_URL'), - 'username' => env('LOG_SLACK_USERNAME', 'Laravel Log'), - 'emoji' => env('LOG_SLACK_EMOJI', ':boom:'), - 'level' => env('LOG_LEVEL', 'critical'), + 'driver' => 'slack', + 'url' => env('LOG_SLACK_WEBHOOK_URL'), + 'username' => env('LOG_SLACK_USERNAME', 'Laravel Log'), + 'emoji' => env('LOG_SLACK_EMOJI', ':boom:'), + 'level' => env('LOG_LEVEL', 'critical'), 'replace_placeholders' => true, ], 'papertrail' => [ - 'driver' => 'monolog', - 'level' => env('LOG_LEVEL', 'debug'), - 'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class), + 'driver' => 'monolog', + 'level' => env('LOG_LEVEL', 'debug'), + 'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class), 'handler_with' => [ - 'host' => env('PAPERTRAIL_URL'), - 'port' => env('PAPERTRAIL_PORT'), + 'host' => env('PAPERTRAIL_URL'), + 'port' => env('PAPERTRAIL_PORT'), 'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'), ], 'processors' => [PsrLogMessageProcessor::class], ], 'stderr' => [ - 'driver' => 'monolog', - 'level' => env('LOG_LEVEL', 'debug'), - 'handler' => StreamHandler::class, + 'driver' => 'monolog', + 'level' => env('LOG_LEVEL', 'debug'), + 'handler' => StreamHandler::class, 'formatter' => env('LOG_STDERR_FORMATTER'), - 'with' => [ + 'with' => [ 'stream' => 'php://stderr', ], 'processors' => [PsrLogMessageProcessor::class], ], 'syslog' => [ - 'driver' => 'syslog', - 'level' => env('LOG_LEVEL', 'debug'), - 'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER), + 'driver' => 'syslog', + 'level' => env('LOG_LEVEL', 'debug'), + 'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER), 'replace_placeholders' => true, ], 'errorlog' => [ - 'driver' => 'errorlog', - 'level' => env('LOG_LEVEL', 'debug'), + 'driver' => 'errorlog', + 'level' => env('LOG_LEVEL', 'debug'), 'replace_placeholders' => true, ], 'null' => [ - 'driver' => 'monolog', + 'driver' => 'monolog', 'handler' => NullHandler::class, ], diff --git a/config/mail.php b/config/mail.php index df13d3d..3761e96 100644 --- a/config/mail.php +++ b/config/mail.php @@ -38,14 +38,14 @@ return [ 'mailers' => [ 'smtp' => [ - 'transport' => 'smtp', - 'url' => env('MAIL_URL'), - 'host' => env('MAIL_HOST', '127.0.0.1'), - 'port' => env('MAIL_PORT', 2525), - 'encryption' => env('MAIL_ENCRYPTION', 'tls'), - 'username' => env('MAIL_USERNAME'), - 'password' => env('MAIL_PASSWORD'), - 'timeout' => null, + 'transport' => 'smtp', + 'url' => env('MAIL_URL'), + 'host' => env('MAIL_HOST', '127.0.0.1'), + 'port' => env('MAIL_PORT', 2525), + 'encryption' => env('MAIL_ENCRYPTION', 'tls'), + 'username' => env('MAIL_USERNAME'), + 'password' => env('MAIL_PASSWORD'), + 'timeout' => null, 'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url(env('APP_URL', 'http://localhost'), PHP_URL_HOST)), ], @@ -67,12 +67,12 @@ return [ 'sendmail' => [ 'transport' => 'sendmail', - 'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'), + 'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'), ], 'log' => [ 'transport' => 'log', - 'channel' => env('MAIL_LOG_CHANNEL'), + 'channel' => env('MAIL_LOG_CHANNEL'), ], 'array' => [ @@ -81,7 +81,7 @@ return [ 'failover' => [ 'transport' => 'failover', - 'mailers' => [ + 'mailers' => [ 'smtp', 'log', ], @@ -89,7 +89,7 @@ return [ 'roundrobin' => [ 'transport' => 'roundrobin', - 'mailers' => [ + 'mailers' => [ 'ses', 'postmark', ], @@ -110,7 +110,7 @@ return [ 'from' => [ 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), - 'name' => env('MAIL_FROM_NAME', 'Example'), + 'name' => env('MAIL_FROM_NAME', 'Example'), ], ]; diff --git a/config/queue.php b/config/queue.php index 116bd8d..efe91bb 100644 --- a/config/queue.php +++ b/config/queue.php @@ -35,40 +35,40 @@ return [ ], 'database' => [ - 'driver' => 'database', - 'connection' => env('DB_QUEUE_CONNECTION'), - 'table' => env('DB_QUEUE_TABLE', 'jobs'), - 'queue' => env('DB_QUEUE', 'default'), - 'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90), + 'driver' => 'database', + 'connection' => env('DB_QUEUE_CONNECTION'), + 'table' => env('DB_QUEUE_TABLE', 'jobs'), + 'queue' => env('DB_QUEUE', 'default'), + 'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90), 'after_commit' => false, ], 'beanstalkd' => [ - 'driver' => 'beanstalkd', - 'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'), - 'queue' => env('BEANSTALKD_QUEUE', 'default'), - 'retry_after' => (int) env('BEANSTALKD_QUEUE_RETRY_AFTER', 90), - 'block_for' => 0, + 'driver' => 'beanstalkd', + 'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'), + 'queue' => env('BEANSTALKD_QUEUE', 'default'), + 'retry_after' => (int) env('BEANSTALKD_QUEUE_RETRY_AFTER', 90), + 'block_for' => 0, 'after_commit' => false, ], 'sqs' => [ - 'driver' => 'sqs', - 'key' => env('AWS_ACCESS_KEY_ID'), - 'secret' => env('AWS_SECRET_ACCESS_KEY'), - 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), - 'queue' => env('SQS_QUEUE', 'default'), - 'suffix' => env('SQS_SUFFIX'), - 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), + 'driver' => 'sqs', + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), + 'queue' => env('SQS_QUEUE', 'default'), + 'suffix' => env('SQS_SUFFIX'), + 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 'after_commit' => false, ], 'redis' => [ - 'driver' => 'redis', - 'connection' => env('REDIS_QUEUE_CONNECTION', 'default'), - 'queue' => env('REDIS_QUEUE', 'default'), - 'retry_after' => (int) env('REDIS_QUEUE_RETRY_AFTER', 90), - 'block_for' => null, + 'driver' => 'redis', + 'connection' => env('REDIS_QUEUE_CONNECTION', 'default'), + 'queue' => env('REDIS_QUEUE', 'default'), + 'retry_after' => (int) env('REDIS_QUEUE_RETRY_AFTER', 90), + 'block_for' => null, 'after_commit' => false, ], @@ -87,7 +87,7 @@ return [ 'batching' => [ 'database' => env('DB_CONNECTION', 'sqlite'), - 'table' => 'job_batches', + 'table' => 'job_batches', ], /* @@ -104,9 +104,9 @@ return [ */ 'failed' => [ - 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), + 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), 'database' => env('DB_CONNECTION', 'sqlite'), - 'table' => 'failed_jobs', + 'table' => 'failed_jobs', ], ]; diff --git a/config/services.php b/config/services.php index 27a3617..5bb8455 100644 --- a/config/services.php +++ b/config/services.php @@ -19,7 +19,7 @@ return [ ], 'ses' => [ - 'key' => env('AWS_ACCESS_KEY_ID'), + 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), ], @@ -31,7 +31,7 @@ return [ 'slack' => [ 'notifications' => [ 'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'), - 'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'), + 'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'), ], ], diff --git a/database/factories/ContactFactory.php b/database/factories/ContactFactory.php index 280be1c..b5a9e82 100644 --- a/database/factories/ContactFactory.php +++ b/database/factories/ContactFactory.php @@ -13,14 +13,14 @@ class ContactFactory extends Factory public function definition(): array { $first_name = $this->faker->firstName(); - $last_name = $this->faker->lastName(); - $email = strtolower($first_name . '.' . $last_name) . '@example.com'; + $last_name = $this->faker->lastName(); + $email = strtolower($first_name.'.'.$last_name).'@example.com'; return [ 'first_name' => $first_name, - 'last_name' => $last_name, - 'email' => $email, - 'phone' => $this->faker->phoneNumber(), + 'last_name' => $last_name, + 'email' => $email, + 'phone' => $this->faker->phoneNumber(), 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), ]; diff --git a/database/factories/CustomerFactory.php b/database/factories/CustomerFactory.php index ad2e083..105697d 100644 --- a/database/factories/CustomerFactory.php +++ b/database/factories/CustomerFactory.php @@ -12,19 +12,18 @@ class CustomerFactory extends Factory public function definition() { - $company_name = $this->faker->company(); - $internal_name = explode(",", $company_name); - $address = $this->faker->address(); + $company_name = $this->faker->company(); + $internal_name = explode(',', $company_name); + $address = $this->faker->address(); return [ - 'company_name' => $company_name, - 'internal_name' => strtolower($internal_name[0]), + 'company_name' => $company_name, + 'internal_name' => strtolower($internal_name[0]), 'shipping_address' => $address, - 'billing_address' => $address, - 'phone' => $this->faker->phoneNumber(), - - 'created_at' => Carbon::now(), - 'updated_at' => Carbon::now(), + 'billing_address' => $address, + 'phone' => $this->faker->phoneNumber(), + 'created_at' => Carbon::now(), + 'updated_at' => Carbon::now(), ]; } } diff --git a/database/factories/OrderFactory.php b/database/factories/OrderFactory.php index 35d8502..18dfcfb 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,23 +14,24 @@ 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), - 'customer_po' => $this->faker->randomNumber(6, true), - '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(), - 'new_art' => $this->faker->boolean(), - 'digitizing' => $this->faker->boolean(), - 'repeat' => $this->faker->boolean(), - 'purchased_garments' => $this->faker->boolean(), + 'created_at' => Carbon::now(), + 'updated_at' => Carbon::now(), + 'customer_po' => $this->faker->randomNumber(6, true), + 'order_type' => $this->faker->randomElement(OrderType::cases())->value, + 'order_date' => $order_date, + '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(), + 'purchased_garments' => $this->faker->boolean(), 'customer_supplied_file' => $this->faker->boolean(), - 'notes' => $this->faker->words(10, true), + 'notes' => $this->faker->words(10, true), ]; } } diff --git a/database/factories/OrderProductFactory.php b/database/factories/OrderProductFactory.php new file mode 100644 index 0000000..be6d525 --- /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..6e8e020 100644 --- a/database/factories/PackingSlipFactory.php +++ b/database/factories/PackingSlipFactory.php @@ -14,11 +14,11 @@ class PackingSlipFactory extends Factory { 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']), - 'created_at' => Carbon::now(), - 'updated_at' => Carbon::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']), + '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..68538b7 --- /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..ac20cc3 --- /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..6a2dc22 --- /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..6b793d3 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; @@ -14,16 +13,16 @@ class ShippingEntryFactory extends Factory public function definition(): array { return [ - 'created_at' => Carbon::now(), - 'updated_at' => Carbon::now(), - 'courier' => $this->faker->randomElement(['UPS', 'Purolator', 'FreightCom', 'E-Shipper', 'ACE']), - 'contact' => $this->faker->randomElement(['courier.com', '+1 604 123 4567']), - 'account_title' => $this->faker->word, + 'created_at' => Carbon::now(), + 'updated_at' => Carbon::now(), + 'courier' => $this->faker->randomElement(['UPS', 'Purolator', 'FreightCom', 'E-Shipper', 'ACE']), + 'contact' => $this->faker->randomElement(['courier.com', '+1 604 123 4567']), + 'account_title' => $this->faker->word, 'account_username' => 'username', 'account_password' => 'password', - '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']), + '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/factories/UserFactory.php b/database/factories/UserFactory.php index 504a151..26270f8 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -24,11 +24,11 @@ class UserFactory extends Factory public function definition(): array { return [ - 'name' => fake()->name(), - 'email' => fake()->unique()->safeEmail(), + 'name' => fake()->name(), + 'email' => fake()->unique()->safeEmail(), 'email_verified_at' => now(), - 'password' => Hash::make('password'), - 'remember_token' => Str::random(10), + 'password' => Hash::make('password'), + 'remember_token' => Str::random(10), ]; } 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\Migrations\Migration; 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\Migrations\Migration; 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\Migrations\Migration; 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\Migrations\Migration; 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..55f3048 --- /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..54aaa7c 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,76 +13,12 @@ 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', + 'name' => 'Test User', 'email' => 'test@example.com', ]); } diff --git a/pint.json b/pint.json new file mode 100644 index 0000000..106d329 --- /dev/null +++ b/pint.json @@ -0,0 +1,12 @@ +{ + "preset": "laravel", + "rules": { + "binary_operator_spaces": { + "default": "single_space", + "operators": { + "=>": "align_single_space_minimal", + "=": "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') -
- - -
-
-
-

-
-
- - -
-
-
- - - -
-
-
- -
-@endsection() - -@section('content') -
-
-
-
- - -
- -
- - -
- -
- - -
-
-
- -
-
- @if(sizeof($customers) !== 0) - - - - - - - - - - - - - - - @foreach($customers as $customer) - - - - - - - - - @endforeach - - -
Company NameInternal NameShipping AddressBilling AddressPhoneView
{{$customer->company_name}} {{$customer->internal_name}} {{$customer->shipping_address}} {{$customer->billing_address}} {{$customer->phone}} - - - -
- - @else() - No customer data. - @endif -
-
-
- - - @include('partials.customers.create-modal') - - - @include('partials.customers.delete-all-modal') - -@endsection diff --git a/resources/views/customers/show.blade.php b/resources/views/customers/show.blade.php index 2cc702b..6f3f989 100644 --- a/resources/views/customers/show.blade.php +++ b/resources/views/customers/show.blade.php @@ -65,28 +65,24 @@ @section('content')
-
- @include('partials.customers.show-overview') + @include('partials.customers.show.overview-tab') - @include('partials.customers.show-shipping-info') + @include('partials.customers.show.shipping-info-tab') - @include('partials.customers.show-packing-slips') + @include('partials.customers.show.packing-slips-tab') - @include('partials.customers.show-contacts') + @include('partials.customers.show.contacts-tab')
- - @include('partials.customers.edit-modal') - @include('partials.customers.delete-single-modal') diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php new file mode 100644 index 0000000..7ce4fa8 --- /dev/null +++ b/resources/views/dashboard.blade.php @@ -0,0 +1,59 @@ +@extends('layouts.app') + +@section('header') +
+ + +
+
+
+ {{--

Overview

--}} +
+
+ + +
+
+ +
+
+ +
+@endsection + +@section('content') +
+
+
+
+ + +
+
+
+
+@endsection diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php deleted file mode 100644 index 1f34466..0000000 --- a/resources/views/home.blade.php +++ /dev/null @@ -1,23 +0,0 @@ -@extends('layouts.app') - -@section('content') -
-
-
-
-
{{ __('Dashboard') }}
- -
- @if (session('status')) - - @endif - - {{ __('You are logged in!') }} -
-
-
-
-
-@endsection diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 1593400..9ef0aae 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -15,65 +15,12 @@ @vite(['resources/sass/app.scss', 'resources/js/app.js']) + +{{-- @livewireStyles--}}
- + @include('layouts.nav')
@yield('header') @@ -81,5 +28,6 @@
+{{--@livewireScripts--}} diff --git a/resources/views/layouts/nav.blade.php b/resources/views/layouts/nav.blade.php new file mode 100644 index 0000000..8472126 --- /dev/null +++ b/resources/views/layouts/nav.blade.php @@ -0,0 +1,97 @@ + \ No newline at end of file diff --git a/resources/views/livewire/create-order.blade.php b/resources/views/livewire/create-order.blade.php new file mode 100644 index 0000000..b80e6e0 --- /dev/null +++ b/resources/views/livewire/create-order.blade.php @@ -0,0 +1,3 @@ +
+ +
diff --git a/resources/views/livewire/customer-and-contact-select.blade.php b/resources/views/livewire/customer-and-contact-select.blade.php new file mode 100644 index 0000000..5888c11 --- /dev/null +++ b/resources/views/livewire/customer-and-contact-select.blade.php @@ -0,0 +1,44 @@ +
+
+ +
+ + + @error('customer_id') + + {{ $message }} + + @enderror +
+
+ +
+ +
+ @if(isset($contacts)) + + + @error('contact_id') + + {{ $message }} + + @enderror + @endif +
+
+
diff --git a/resources/views/livewire/order-products-create.blade.php b/resources/views/livewire/order-products-create.blade.php new file mode 100644 index 0000000..bcc1a9d --- /dev/null +++ b/resources/views/livewire/order-products-create.blade.php @@ -0,0 +1,299 @@ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + @foreach($productInputs as $key => $value) + + + + + + + + + + + + + + + + + + + + + @endforeach + + +
#SKUProduct NameColorXSSMLXL2XL3XLOSFATotal
{{$loop->index+1}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @if($key > 0) + + @endif +
+ + +
+ + + +
+
+ + +
+
+
#
+
Service
+
Placement
+
Logo Name
+ +
+
+
Setup
+
Width
+
Height
+
Unit
+
Price
+
Total
+
+
+
+
+
+ + + + @foreach($serviceInputs as $key => $value) +
+ + + +
+
+
+
{{$loop->index+1}}
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ @if($key > 0) + + @endif +
+
+
+
+
+
+
+ +
+ +
+ +
+
+
+
+
+ @endforeach + + {{--
--}} +
+ + +
+ {{--
--}} +
+ + diff --git a/resources/views/livewire/orders-table.blade.php b/resources/views/livewire/orders-table.blade.php new file mode 100644 index 0000000..93bb7c4 --- /dev/null +++ b/resources/views/livewire/orders-table.blade.php @@ -0,0 +1,111 @@ +
+ +
+
+
+
+

{{$this->title}}

+
+
+ + + Create entry + +
+ +
+ +
+ +
+
+ + +
+
+ +
+ +
+ + +
+
+
+
+ +
+
+ + + + {{-- @if($this->showCustomerColumn)--}} + + {{-- @endif()--}} + + + + + + + + + + + @foreach($orders as $order) + + + + + + + + + + + + + @endforeach + +
CustomerInternal POCustomer POOrder DateDue DateStatusRushView
{{$order->customer->company_name}} + {{$order->internal_po}}{{$order->customer_po}}{{$order->order_date}} + {{$order->due_date}} + @if($order->due_date < $today && $order->active()) + + @endif {{$order->status->value}} + @if($order->rush) + + @endif + + + + +
+
+
+ +
+
+
+ {{$orders->links()}} +
+
+
+ +
diff --git a/resources/views/management/index.blade.php b/resources/views/management/index.blade.php new file mode 100644 index 0000000..7e0a606 --- /dev/null +++ b/resources/views/management/index.blade.php @@ -0,0 +1,27 @@ +@extends('layouts.app') + +@section('header') + @include('partials.management.index.management-tabs') + +@endsection() + +@section('content') +
+
+ + @include('partials.management.index.customers') + + @include('partials.management.index.packing-slips') + + @include('partials.management.index.service-files') + +
+
+ + + @include('partials.customers.index.create-modal') + + + @include('partials.customers.index.delete-all-modal') + +@endsection diff --git a/resources/views/order-products/create.blade.php b/resources/views/order-products/create.blade.php new file mode 100644 index 0000000..a76e9ad --- /dev/null +++ b/resources/views/order-products/create.blade.php @@ -0,0 +1,39 @@ +@extends('layouts.app') + + +@section('header') +
+ + +
+
+ + +
+
+ +
+
+
+@endsection + +@section('content') +
+
+
+ +
+
+
+ +@endsection diff --git a/resources/views/orders/create.blade.php b/resources/views/orders/create.blade.php index 5c1db42..49ec647 100644 --- a/resources/views/orders/create.blade.php +++ b/resources/views/orders/create.blade.php @@ -1,130 +1,217 @@ @extends('layouts.app') + +@section('header') +
+ + +
+
+ + +
+
+ +
+
+
+@endsection + @section('content') -
-
-
-

Create Order

- -
- -
- -
-
+
-
- -
- -
-
+
+ @csrf -
- -
- -
-
+
+
-
+ -
- -
-
- - -
-
- - -
-
- - +
+ +
+ +
+ + + @error('order_type') + + {{ $message }} + + @enderror
-
- - +
+ +
+ +
+ + + @error('status') + + {{ $message }} + + @enderror
-
-
- - + +
+ +
+ +
+ + + @error('customer_po') + + {{ $message }} + + @enderror
-
- - +
+ +
+ +
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
-
- - +
+
+ + +
+
+ + +
+
+ + +
-
-
+
-
- +
+ -
- +
+ - @error('order_date') - + @error('order_date') + {{ $message }} - @enderror + @enderror +
-
-
- +
+ + +
+ -
- + @error('due_date') + + {{ $message }} + + @enderror +
+
+ +
+ +
+ - @error('due_date') - +
+ + + @error('notes') + {{ $message }} - @enderror + @enderror +
-
+
+ +
+ +
-
- -
- +
+
+
-
-
+
@endsection diff --git a/resources/views/orders/index.blade.php b/resources/views/orders/index.blade.php new file mode 100644 index 0000000..625655d --- /dev/null +++ b/resources/views/orders/index.blade.php @@ -0,0 +1,91 @@ +@extends('layouts.app') + +@section('header') +
+ + +
+
+
+ {{--

Overview

--}} +
+
+ + + +
+@endsection + +@section('content') +
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+@endsection diff --git a/resources/views/orders/show.blade.php b/resources/views/orders/show.blade.php new file mode 100644 index 0000000..964d174 --- /dev/null +++ b/resources/views/orders/show.blade.php @@ -0,0 +1,71 @@ +@extends('layouts.app') + +@section('header') +
+ + +
+
+
+ {{--

Overview

--}} +
+
+ + +
+
+ +
+
+
+@endsection + +@section('content') +
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+@endsection diff --git a/resources/views/partials/customers/edit-modal.blade.php b/resources/views/partials/customers/edit-modal.blade.php deleted file mode 100644 index 60a9a00..0000000 --- a/resources/views/partials/customers/edit-modal.blade.php +++ /dev/null @@ -1,110 +0,0 @@ - diff --git a/resources/views/partials/customers/create-modal.blade.php b/resources/views/partials/customers/index/create-modal.blade.php similarity index 100% rename from resources/views/partials/customers/create-modal.blade.php rename to resources/views/partials/customers/index/create-modal.blade.php diff --git a/resources/views/partials/customers/delete-all-modal.blade.php b/resources/views/partials/customers/index/delete-all-modal.blade.php similarity index 100% rename from resources/views/partials/customers/delete-all-modal.blade.php rename to resources/views/partials/customers/index/delete-all-modal.blade.php diff --git a/resources/views/partials/customers/show-overview.blade.php b/resources/views/partials/customers/show-overview.blade.php deleted file mode 100644 index ab9d2aa..0000000 --- a/resources/views/partials/customers/show-overview.blade.php +++ /dev/null @@ -1,76 +0,0 @@ -
- -
-
-
-
-

Active orders

-
-
- -
- -
- - -
-
-
-
-
-
- - - - - - - - - - - - - - @foreach($active_orders as $order) - - - - - - - - - - @endforeach - -
Internal POCustomer POOrder DateDue DateStatusRushView
{{$order->internal_po}}{{$order->customer_po}}{{$order->order_date}}{{$order->due_date}}{{$order->status->value}} - @if($order->rush) - - @endif - - - - -
-
-
- -
-
-
- {{$active_orders->links()}} -
-
-
- -
diff --git a/resources/views/partials/customers/show-contacts.blade.php b/resources/views/partials/customers/show/contacts-tab.blade.php similarity index 83% rename from resources/views/partials/customers/show-contacts.blade.php rename to resources/views/partials/customers/show/contacts-tab.blade.php index 60e0ea9..14ab6bb 100644 --- a/resources/views/partials/customers/show-contacts.blade.php +++ b/resources/views/partials/customers/show/contacts-tab.blade.php @@ -36,10 +36,10 @@ @foreach ($contacts as $contact) - {{ $contact->first_name . ' ' . $contact->last_name }} - {{ $contact->email }} - {{ $contact->phone }} - {{ $contact->notes }} + {{ $contact->first_name . ' ' . $contact->last_name }} + {{ $contact->email }} + {{ $contact->phone }} + {{ $contact->notes }} @endforeach diff --git a/resources/views/partials/customers/show/overview-tab.blade.php b/resources/views/partials/customers/show/overview-tab.blade.php new file mode 100644 index 0000000..43f14bd --- /dev/null +++ b/resources/views/partials/customers/show/overview-tab.blade.php @@ -0,0 +1,6 @@ +
+ + +
diff --git a/resources/views/partials/customers/show-packing-slips.blade.php b/resources/views/partials/customers/show/packing-slips-tab.blade.php similarity index 86% rename from resources/views/partials/customers/show-packing-slips.blade.php rename to resources/views/partials/customers/show/packing-slips-tab.blade.php index 396876c..4ea63a4 100644 --- a/resources/views/partials/customers/show-packing-slips.blade.php +++ b/resources/views/partials/customers/show/packing-slips-tab.blade.php @@ -31,7 +31,7 @@
-
+
@@ -44,10 +44,10 @@ @foreach($packingSlips as $packingSlip) - - - - + + + + @endforeach diff --git a/resources/views/partials/customers/show-shipping-info.blade.php b/resources/views/partials/customers/show/shipping-info-tab.blade.php similarity index 100% rename from resources/views/partials/customers/show-shipping-info.blade.php rename to resources/views/partials/customers/show/shipping-info-tab.blade.php diff --git a/resources/views/partials/management/index/customers.blade.php b/resources/views/partials/management/index/customers.blade.php new file mode 100644 index 0000000..bfb7b13 --- /dev/null +++ b/resources/views/partials/management/index/customers.blade.php @@ -0,0 +1,76 @@ +
+
+
+
+ + +
+ +
+ + +
+ +
+ + +
+
+
+ +
+
+ @if(sizeof($customers) !== 0) +
{{$packingSlip->date_received}}{{$packingSlip->order_id}}{{$packingSlip->amount}}{{$packingSlip->contents}}{{$packingSlip->date_received}}{{$packingSlip->order_id}}{{$packingSlip->amount}}{{$packingSlip->contents}}
+ + + + + + + + + + + + + + @foreach($customers as $customer) + + + + + + + + + @endforeach + + +
Company NameInternal NameShipping AddressBilling AddressPhoneView
{{$customer->company_name}} {{$customer->internal_name}} {{$customer->shipping_address}} {{$customer->billing_address}} {{$customer->phone}} + + + +
+ + @else() + No customer data. + @endif +
+
+
\ No newline at end of file diff --git a/resources/views/partials/management/index/management-tabs.blade.php b/resources/views/partials/management/index/management-tabs.blade.php new file mode 100644 index 0000000..82d87a7 --- /dev/null +++ b/resources/views/partials/management/index/management-tabs.blade.php @@ -0,0 +1,43 @@ +
+ + +
+
+
+
+
+ + + +
diff --git a/resources/views/partials/management/index/packing-slips.blade.php b/resources/views/partials/management/index/packing-slips.blade.php new file mode 100644 index 0000000..a249f32 --- /dev/null +++ b/resources/views/partials/management/index/packing-slips.blade.php @@ -0,0 +1,5 @@ +
+ + packing slips +
\ No newline at end of file diff --git a/resources/views/partials/management/index/service-files.blade.php b/resources/views/partials/management/index/service-files.blade.php new file mode 100644 index 0000000..c5da197 --- /dev/null +++ b/resources/views/partials/management/index/service-files.blade.php @@ -0,0 +1,5 @@ +
+ + Files +
diff --git a/resources/views/vendor/pagination/bootstrap-4.blade.php b/resources/views/vendor/pagination/bootstrap-4.blade.php deleted file mode 100644 index 63c6f56..0000000 --- a/resources/views/vendor/pagination/bootstrap-4.blade.php +++ /dev/null @@ -1,46 +0,0 @@ -@if ($paginator->hasPages()) - -@endif diff --git a/resources/views/vendor/pagination/bootstrap-5.blade.php b/resources/views/vendor/pagination/bootstrap-5.blade.php deleted file mode 100644 index a1795a4..0000000 --- a/resources/views/vendor/pagination/bootstrap-5.blade.php +++ /dev/null @@ -1,88 +0,0 @@ -@if ($paginator->hasPages()) - -@endif diff --git a/resources/views/vendor/pagination/default.blade.php b/resources/views/vendor/pagination/default.blade.php deleted file mode 100644 index 0db70b5..0000000 --- a/resources/views/vendor/pagination/default.blade.php +++ /dev/null @@ -1,46 +0,0 @@ -@if ($paginator->hasPages()) - -@endif diff --git a/resources/views/vendor/pagination/semantic-ui.blade.php b/resources/views/vendor/pagination/semantic-ui.blade.php deleted file mode 100644 index ef0dbb1..0000000 --- a/resources/views/vendor/pagination/semantic-ui.blade.php +++ /dev/null @@ -1,36 +0,0 @@ -@if ($paginator->hasPages()) - -@endif diff --git a/resources/views/vendor/pagination/simple-bootstrap-4.blade.php b/resources/views/vendor/pagination/simple-bootstrap-4.blade.php deleted file mode 100644 index 4bb4917..0000000 --- a/resources/views/vendor/pagination/simple-bootstrap-4.blade.php +++ /dev/null @@ -1,27 +0,0 @@ -@if ($paginator->hasPages()) - -@endif diff --git a/resources/views/vendor/pagination/simple-bootstrap-5.blade.php b/resources/views/vendor/pagination/simple-bootstrap-5.blade.php deleted file mode 100644 index a89005e..0000000 --- a/resources/views/vendor/pagination/simple-bootstrap-5.blade.php +++ /dev/null @@ -1,29 +0,0 @@ -@if ($paginator->hasPages()) - -@endif diff --git a/resources/views/vendor/pagination/simple-default.blade.php b/resources/views/vendor/pagination/simple-default.blade.php deleted file mode 100644 index 36bdbc1..0000000 --- a/resources/views/vendor/pagination/simple-default.blade.php +++ /dev/null @@ -1,19 +0,0 @@ -@if ($paginator->hasPages()) - -@endif diff --git a/resources/views/vendor/pagination/simple-tailwind.blade.php b/resources/views/vendor/pagination/simple-tailwind.blade.php deleted file mode 100644 index ea02400..0000000 --- a/resources/views/vendor/pagination/simple-tailwind.blade.php +++ /dev/null @@ -1,25 +0,0 @@ -@if ($paginator->hasPages()) - -@endif diff --git a/resources/views/vendor/pagination/tailwind.blade.php b/resources/views/vendor/pagination/tailwind.blade.php deleted file mode 100644 index aee2ad2..0000000 --- a/resources/views/vendor/pagination/tailwind.blade.php +++ /dev/null @@ -1,106 +0,0 @@ -@if ($paginator->hasPages()) - -@endif diff --git a/routes/web.php b/routes/web.php index c3f8633..08cdcb7 100644 --- a/routes/web.php +++ b/routes/web.php @@ -2,26 +2,33 @@ use App\Http\Controllers\ContactController; use App\Http\Controllers\CustomerController; +use App\Http\Controllers\DashboardController; +use App\Http\Controllers\ManagementController; use App\Http\Controllers\OrderController; +use App\Http\Controllers\OrderProductController; use App\Http\Controllers\PackingSlipController; use App\Http\Controllers\ShippingEntryController; -use App\Models\ShippingEntry; use Illuminate\Support\Facades\Route; Route::get('/', function () { - return view('welcome'); + return redirect()->route('dashboard'); }); Auth::routes(); -Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home'); +Route::get('/dashboard', [DashboardController::class, 'index'])->name('dashboard'); -Route::resource('customers', CustomerController::class); +Route::get('/management/{tab?}', [ManagementController::class, 'index'])->name('management.index'); +// Customers +Route::resource('customers', CustomerController::class); Route::get('/customers/{customer}/{tab}', [CustomerController::class, 'show'])->name('customers.show'); -Route::get('/customers/', [CustomerController::class, 'index'])->name('customers.index'); Route::post('/customers/request-destroy', [CustomerController::class, 'requestDestroy'])->name('customers.requestDestroy'); +// OrderProducts +Route::resource('order-products', OrderProductController::class); + +// Contacts Route::resource('contacts', ContactController::class); Route::post('/contacts/request-destroy', [ContactController::class, 'requestDestroy'])->name('contacts.requestDestroy'); @@ -29,4 +36,4 @@ Route::resource('packing-slips', PackingSlipController::class); Route::resource('shipping-entries', ShippingEntryController::class); -Route::resource('orders', OrderController::class); \ No newline at end of file +Route::resource('orders', OrderController::class);