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 @@
Company Name | +Internal Name | +Shipping Address | +Billing Address | +Phone | +View | +
---|---|---|---|---|---|
{{$customer->company_name}} | +{{$customer->internal_name}} |
+ {{$customer->shipping_address}} | +{{$customer->billing_address}} | +{{$customer->phone}} | +
+
+ |
+