diff --git a/.github/workflows/tests-mysql.yml b/.github/workflows/tests-mysql.yml index 310414cda6..63fcb8e3e2 100644 --- a/.github/workflows/tests-mysql.yml +++ b/.github/workflows/tests-mysql.yml @@ -77,3 +77,7 @@ jobs: DB_PORT: ${{ job.services.mysql.ports[3306] }} DB_USERNAME: root run: php artisan test + + - name: Test failure + if: ${{ failure() }} + run: docker exec "$PROJECT_NAME-php-fpm" cat storage/logs/laravel.log diff --git a/.github/workflows/tests-postgres.yml b/.github/workflows/tests-postgres.yml index ae48277be3..3cc5244c5e 100644 --- a/.github/workflows/tests-postgres.yml +++ b/.github/workflows/tests-postgres.yml @@ -75,3 +75,7 @@ jobs: DB_USERNAME: snipeit DB_PASSWORD: password run: php artisan test + + - name: Test failure + if: ${{ failure() }} + run: docker exec "$PROJECT_NAME-php-fpm" cat storage/logs/laravel.log diff --git a/.github/workflows/tests-sqlite.yml b/.github/workflows/tests-sqlite.yml index 8bf0115169..011d19d783 100644 --- a/.github/workflows/tests-sqlite.yml +++ b/.github/workflows/tests-sqlite.yml @@ -59,3 +59,7 @@ jobs: env: DB_CONNECTION: sqlite_testing run: php artisan test + + - name: Test failure + if: ${{ failure() }} + run: docker exec "$PROJECT_NAME-php-fpm" cat storage/logs/laravel.log diff --git a/app/Http/Controllers/Api/ComponentsController.php b/app/Http/Controllers/Api/ComponentsController.php index 561e13c9cd..8ee5b80e83 100644 --- a/app/Http/Controllers/Api/ComponentsController.php +++ b/app/Http/Controllers/Api/ComponentsController.php @@ -38,6 +38,7 @@ class ComponentsController extends Controller 'name', 'min_amt', 'order_number', + 'model_number', 'serial', 'purchase_date', 'purchase_cost', @@ -47,7 +48,7 @@ class ComponentsController extends Controller ]; $components = Component::select('components.*') - ->with('company', 'location', 'category', 'assets', 'supplier', 'adminuser'); + ->with('company', 'location', 'category', 'assets', 'supplier', 'adminuser', 'manufacturer'); if ($request->filled('search')) { $components = $components->TextSearch($request->input('search')); @@ -69,6 +70,14 @@ class ComponentsController extends Controller $components->where('supplier_id', '=', $request->input('supplier_id')); } + if ($request->filled('manufacturer_id')) { + $components->where('manufacturer_id', '=', $request->input('manufacturer_id')); + } + + if ($request->filled('model_number')) { + $components->where('model_number', '=', $request->input('model_number')); + } + if ($request->filled('location_id')) { $components->where('location_id', '=', $request->input('location_id')); } @@ -98,6 +107,9 @@ class ComponentsController extends Controller case 'supplier': $components = $components->OrderSupplier($order); break; + case 'manufacturer': + $components = $components->OrderManufacturer($order); + break; case 'created_by': $components = $components->OrderByCreatedBy($order); break; diff --git a/app/Http/Controllers/Api/ConsumablesController.php b/app/Http/Controllers/Api/ConsumablesController.php index 8e7f321720..7ff676c7be 100644 --- a/app/Http/Controllers/Api/ConsumablesController.php +++ b/app/Http/Controllers/Api/ConsumablesController.php @@ -258,6 +258,8 @@ class ConsumablesController extends Controller $this->authorize('checkout', $consumable); + $consumable->checkout_qty = $request->input('checkout_qty', 1); + // Make sure there is at least one available to checkout if ($consumable->numRemaining() <= 0) { return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/consumables/message.checkout.unavailable'))); @@ -268,6 +270,12 @@ class ConsumablesController extends Controller return response()->json(Helper::formatStandardApiResponse('error', null, trans('general.invalid_item_category_single', ['type' => trans('general.consumable')]))); } + // Make sure there is at least one available to checkout + if ($consumable->numRemaining() <= 0 || $consumable->checkout_qty > $consumable->numRemaining()) { + return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/consumables/message.checkout.unavailable', ['requested' => $consumable->checkout_qty, 'remaining' => $consumable->numRemaining() ]))); + } + + // Check if the user exists - @TODO: this should probably be handled via validation, not here?? if (!$user = User::find($request->input('assigned_to'))) { @@ -278,7 +286,8 @@ class ConsumablesController extends Controller // Update the consumable data $consumable->assigned_to = $request->input('assigned_to'); - $consumable->users()->attach($consumable->id, + for ($i = 0; $i < $consumable->checkout_qty; $i++) { + $consumable->users()->attach($consumable->id, [ 'consumable_id' => $consumable->id, 'created_by' => $user->id, @@ -286,6 +295,8 @@ class ConsumablesController extends Controller 'note' => $request->input('note'), ] ); + } + event(new CheckoutableCheckedOut($consumable, $user, auth()->user(), $request->input('note'))); diff --git a/app/Http/Controllers/Api/ManufacturersController.php b/app/Http/Controllers/Api/ManufacturersController.php index f111ef6c83..f716fbbf7f 100644 --- a/app/Http/Controllers/Api/ManufacturersController.php +++ b/app/Http/Controllers/Api/ManufacturersController.php @@ -60,7 +60,8 @@ class ManufacturersController extends Controller ->withCount('assets as assets_count') ->withCount('licenses as licenses_count') ->withCount('consumables as consumables_count') - ->withCount('accessories as accessories_count'); + ->withCount('accessories as accessories_count') + ->withCount('components as components_count'); if ($request->input('deleted') == 'true') { $manufacturers->onlyTrashed(); diff --git a/app/Http/Controllers/Assets/AssetsController.php b/app/Http/Controllers/Assets/AssetsController.php index 50a758ac37..52eb751a89 100755 --- a/app/Http/Controllers/Assets/AssetsController.php +++ b/app/Http/Controllers/Assets/AssetsController.php @@ -111,8 +111,10 @@ class AssetsController extends Controller $settings = Setting::getSettings(); - $success = false; + $successes = []; + $failures = []; $serials = $request->input('serials'); + $asset = null; for ($a = 1; $a <= count($asset_tags); $a++) { $asset = new Asset(); @@ -199,20 +201,35 @@ class AssetsController extends Controller $asset->checkOut($target, auth()->user(), date('Y-m-d H:i:s'), $request->input('expected_checkin', null), 'Checked out on asset creation', $request->get('name'), $location); } - $success = true; - + $successes[] = " $asset->id]) . "' style='color: white;'>" . e($asset->asset_tag) . ""; + + } else { + $failures[] = join(",", $asset->getErrors()->all()); } } session()->put(['redirect_option' => $request->get('redirect_option'), 'checkout_to_type' => $request->get('checkout_to_type')]); - if ($success) { + if ($successes) { + if ($failures) { + //some succeeded, some failed + return redirect()->to(Helper::getRedirectOption($request, $asset->id, 'Assets')) //FIXME - not tested + ->with('success-unescaped', trans_choice('admin/hardware/message.create.multi_success_linked', $successes, ['links' => join(", ", $successes)])) + ->with('warning', trans_choice('admin/hardware/message.create.partial_failure', $failures, ['failures' => join("; ", $failures)])); + } else { + if (count($successes) == 1) { + //the most common case, keeping it so we don't have to make every use of that translation string be trans_choice'ed + //and re-translated + return redirect()->to(Helper::getRedirectOption($request, $asset->id, 'Assets')) + ->with('success-unescaped', trans('admin/hardware/message.create.success_linked', ['link' => route('hardware.show', ['hardware' => $asset->id]), 'id', 'tag' => e($asset->asset_tag)])); + } else { + //multi-success + return redirect()->to(Helper::getRedirectOption($request, $asset->id, 'Assets')) + ->with('success-unescaped', trans_choice('admin/hardware/message.create.multi_success_linked', $successes, ['links' => join(", ", $successes)])); + } + } - return redirect()->to(Helper::getRedirectOption($request, $asset->id, 'Assets')) - ->with('success-unescaped', trans('admin/hardware/message.create.success_linked', ['link' => route('hardware.show', ['hardware' => $asset->id]), 'id', 'tag' => e($asset->asset_tag)])); - - } return redirect()->back()->withInput()->withErrors($asset->getErrors()); diff --git a/app/Http/Controllers/Components/ComponentsController.php b/app/Http/Controllers/Components/ComponentsController.php index 430984767e..c4d9bcec36 100644 --- a/app/Http/Controllers/Components/ComponentsController.php +++ b/app/Http/Controllers/Components/ComponentsController.php @@ -73,6 +73,8 @@ class ComponentsController extends Controller $component->name = $request->input('name'); $component->category_id = $request->input('category_id'); $component->supplier_id = $request->input('supplier_id'); + $component->manufacturer_id = $request->input('manufacturer_id'); + $component->model_number = $request->input('model_number'); $component->location_id = $request->input('location_id'); $component->company_id = Company::getIdForCurrentUser($request->input('company_id')); $component->order_number = $request->input('order_number', null); @@ -150,6 +152,8 @@ class ComponentsController extends Controller $component->name = $request->input('name'); $component->category_id = $request->input('category_id'); $component->supplier_id = $request->input('supplier_id'); + $component->manufacturer_id = $request->input('manufacturer_id'); + $component->model_number = $request->input('model_number'); $component->location_id = $request->input('location_id'); $component->company_id = Company::getIdForCurrentUser($request->input('company_id')); $component->order_number = $request->input('order_number'); diff --git a/app/Http/Controllers/Consumables/ConsumableCheckoutController.php b/app/Http/Controllers/Consumables/ConsumableCheckoutController.php index 3bf202733a..e08da41229 100644 --- a/app/Http/Controllers/Consumables/ConsumableCheckoutController.php +++ b/app/Http/Controllers/Consumables/ConsumableCheckoutController.php @@ -70,7 +70,7 @@ class ConsumableCheckoutController extends Controller $this->authorize('checkout', $consumable); // If the quantity is not present in the request or is not a positive integer, set it to 1 - $quantity = $request->input('qty'); + $quantity = $request->input('checkout_qty'); if (!isset($quantity) || !ctype_digit((string)$quantity) || $quantity <= 0) { $quantity = 1; } @@ -92,7 +92,7 @@ class ConsumableCheckoutController extends Controller // Update the consumable data $consumable->assigned_to = e($request->input('assigned_to')); - for($i = 0; $i < $quantity; $i++){ + for ($i = 0; $i < $quantity; $i++){ $consumable->users()->attach($consumable->id, [ 'consumable_id' => $consumable->id, 'created_by' => $admin_user->id, @@ -100,6 +100,8 @@ class ConsumableCheckoutController extends Controller 'note' => $request->input('note'), ]); } + + $consumable->checkout_qty = $quantity; event(new CheckoutableCheckedOut($consumable, $user, auth()->user(), $request->input('note'))); $request->request->add(['checkout_to_type' => 'user']); diff --git a/app/Http/Transformers/ComponentsTransformer.php b/app/Http/Transformers/ComponentsTransformer.php index 70572c9494..f98edd6e3f 100644 --- a/app/Http/Transformers/ComponentsTransformer.php +++ b/app/Http/Transformers/ComponentsTransformer.php @@ -38,6 +38,8 @@ class ComponentsTransformer 'name' => e($component->category->name), ] : null, 'supplier' => ($component->supplier) ? ['id' => $component->supplier->id, 'name'=> e($component->supplier->name)] : null, + 'manufacturer' => ($component->manufacturer) ? ['id' => $component->manufacturer->id, 'name'=> e($component->manufacturer->name)] : null, + 'model_number' => ($component->model_number) ? e($component->model_number) : null, 'order_number' => e($component->order_number), 'purchase_date' => Helper::getFormattedDateObject($component->purchase_date, 'date'), 'purchase_cost' => Helper::formatCurrencyOutput($component->purchase_cost), diff --git a/app/Http/Transformers/ManufacturersTransformer.php b/app/Http/Transformers/ManufacturersTransformer.php index e08aaa7436..d6954c1d24 100644 --- a/app/Http/Transformers/ManufacturersTransformer.php +++ b/app/Http/Transformers/ManufacturersTransformer.php @@ -36,6 +36,7 @@ class ManufacturersTransformer 'licenses_count' => (int) $manufacturer->licenses_count, 'consumables_count' => (int) $manufacturer->consumables_count, 'accessories_count' => (int) $manufacturer->accessories_count, + 'components_count' => (int) $manufacturer->components_count, 'created_by' => ($manufacturer->adminuser) ? [ 'id' => (int) $manufacturer->adminuser->id, 'name'=> e($manufacturer->adminuser->present()->fullName()), diff --git a/app/Models/Component.php b/app/Models/Component.php index 761c76f097..fb77bf0824 100644 --- a/app/Models/Component.php +++ b/app/Models/Component.php @@ -38,6 +38,7 @@ class Component extends SnipeModel 'min_amt' => 'integer|min:0|nullable', 'purchase_date' => 'date_format:Y-m-d|nullable', 'purchase_cost' => 'numeric|nullable|gte:0|max:9999999999999', + 'manufacturer_id' => 'integer|exists:manufacturers,id|nullable', ]; /** @@ -60,6 +61,8 @@ class Component extends SnipeModel 'company_id', 'supplier_id', 'location_id', + 'manufacturer_id', + 'model_number', 'name', 'purchase_cost', 'purchase_date', @@ -77,7 +80,15 @@ class Component extends SnipeModel * * @var array */ - protected $searchableAttributes = ['name', 'order_number', 'serial', 'purchase_cost', 'purchase_date', 'notes']; + protected $searchableAttributes = [ + 'name', + 'order_number', + 'serial', + 'purchase_cost', + 'purchase_date', + 'notes', + 'model_number', + ]; /** * The relations and their attributes that should be included when searching the model. @@ -89,6 +100,7 @@ class Component extends SnipeModel 'company' => ['name'], 'location' => ['name'], 'supplier' => ['name'], + 'manufacturer' => ['name'], ]; @@ -183,6 +195,19 @@ class Component extends SnipeModel return $this->belongsTo(\App\Models\Supplier::class, 'supplier_id'); } + + /** + * Establishes the item -> manufacturer relationship + * + * @author [A. Gianotto] [] + * @since [v3.0] + * @return \Illuminate\Database\Eloquent\Relations\Relation + */ + public function manufacturer() + { + return $this->belongsTo(\App\Models\Manufacturer::class, 'manufacturer_id'); + } + /** * Establishes the component -> action logs relationship * @@ -311,6 +336,19 @@ class Component extends SnipeModel return $query->leftJoin('suppliers', 'components.supplier_id', '=', 'suppliers.id')->orderBy('suppliers.name', $order); } + /** + * Query builder scope to order on manufacturer + * + * @param \Illuminate\Database\Query\Builder $query Query builder instance + * @param text $order Order + * + * @return \Illuminate\Database\Query\Builder Modified query builder + */ + public function scopeOrderManufacturer($query, $order) + { + return $query->leftJoin('manufacturers', 'components.manufacturer_id', '=', 'manufacturers.id')->orderBy('manufacturers.name', $order); + } + public function scopeOrderByCreatedBy($query, $order) { return $query->leftJoin('users as admin_sort', 'components.created_by', '=', 'admin_sort.id')->select('components.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order); diff --git a/app/Models/Manufacturer.php b/app/Models/Manufacturer.php index 6e72b3a2bb..1b31f496d3 100755 --- a/app/Models/Manufacturer.php +++ b/app/Models/Manufacturer.php @@ -78,6 +78,7 @@ class Manufacturer extends SnipeModel && (($this->licenses_count ?? $this->licenses()->count()) === 0) && (($this->consumables_count ?? $this->consumables()->count()) === 0) && (($this->accessories_count ?? $this->accessories()->count()) === 0) + && (($this->components_count ?? $this->components()->count()) === 0) && ($this->deleted_at == ''); } @@ -106,6 +107,10 @@ class Manufacturer extends SnipeModel return $this->hasMany(\App\Models\Consumable::class, 'manufacturer_id'); } + public function components() + { + return $this->hasMany(\App\Models\Component::class, 'manufacturer_id'); + } public function adminuser() { diff --git a/app/Notifications/CheckoutConsumableNotification.php b/app/Notifications/CheckoutConsumableNotification.php index 6746795f2c..c974134fe6 100644 --- a/app/Notifications/CheckoutConsumableNotification.php +++ b/app/Notifications/CheckoutConsumableNotification.php @@ -38,6 +38,7 @@ class CheckoutConsumableNotification extends Notification $this->note = $note; $this->target = $checkedOutTo; $this->acceptance = $acceptance; + $this->qty = $consumable->checkout_qty; $this->settings = Setting::getSettings(); } @@ -173,7 +174,6 @@ class CheckoutConsumableNotification extends Notification */ public function toMail() { - Log::debug($this->item->getImageUrl()); $eula = $this->item->getEula(); $req_accept = $this->item->requireAcceptance(); @@ -188,6 +188,7 @@ class CheckoutConsumableNotification extends Notification 'eula' => $eula, 'req_accept' => $req_accept, 'accept_url' => $accept_url, + 'qty' => $this->qty, ]) ->subject(trans('mail.Confirm_consumable_delivery')); } diff --git a/app/Presenters/ActionlogPresenter.php b/app/Presenters/ActionlogPresenter.php index 37a1adbc28..9251ce6347 100644 --- a/app/Presenters/ActionlogPresenter.php +++ b/app/Presenters/ActionlogPresenter.php @@ -42,27 +42,27 @@ class ActionlogPresenter extends Presenter // User related icons if ($this->itemType() == 'user') { - if ($this->actionType()=='2fa reset') { + if ($this->action_type == '2fa reset') { return 'fa-solid fa-mobile-screen'; } - if ($this->actionType()=='create new') { + if ($this->action_type == 'create new') { return 'fa-solid fa-user-plus'; } - if ($this->actionType()=='merged') { + if ($this->action_type == 'merged') { return 'fa-solid fa-people-arrows'; } - if ($this->actionType()=='delete') { + if ($this->action_type == 'delete') { return 'fa-solid fa-user-minus'; } - if ($this->actionType()=='delete') { + if ($this->action_type == 'delete') { return 'fa-solid fa-user-minus'; } - if ($this->actionType()=='update') { + if ($this->action_type == 'update') { return 'fa-solid fa-user-pen'; } @@ -70,31 +70,31 @@ class ActionlogPresenter extends Presenter } // Everything else - if ($this->actionType()=='create new') { + if ($this->action_type == 'create new') { return 'fa-solid fa-plus'; } - if ($this->actionType()=='delete') { + if ($this->action_type == 'delete') { return 'fa-solid fa-trash'; } - if ($this->actionType()=='update') { + if ($this->action_type == 'update') { return 'fa-solid fa-pen'; } - if ($this->actionType()=='restore') { + if ($this->action_type == 'restore') { return 'fa-solid fa-trash-arrow-up'; } - if ($this->actionType()=='upload') { + if ($this->action_type == 'upload') { return 'fas fa-paperclip'; } - if ($this->actionType()=='checkout') { + if ($this->action_type == 'checkout') { return 'fa-solid fa-rotate-left'; } - if ($this->actionType()=='checkin from') { + if ($this->action_type == 'checkin from') { return 'fa-solid fa-rotate-right'; } diff --git a/app/Presenters/ComponentPresenter.php b/app/Presenters/ComponentPresenter.php index f32bb56d57..39a177592d 100644 --- a/app/Presenters/ComponentPresenter.php +++ b/app/Presenters/ComponentPresenter.php @@ -66,8 +66,20 @@ class ComponentPresenter extends Presenter 'title' => trans('general.supplier'), 'visible' => false, 'formatter' => 'suppliersLinkObjFormatter', - ], - [ + ], [ + 'field' => 'model_number', + 'searchable' => true, + 'sortable' => true, + 'title' => trans('admin/models/table.modelnumber'), + ], [ + 'field' => 'manufacturer', + 'searchable' => true, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('general.manufacturer'), + 'visible' => false, + 'formatter' => 'manufacturersLinkObjFormatter', + ], [ 'field' => 'qty', 'searchable' => false, 'sortable' => true, diff --git a/app/Presenters/ManufacturerPresenter.php b/app/Presenters/ManufacturerPresenter.php index ea29974f34..dfefec2998 100644 --- a/app/Presenters/ManufacturerPresenter.php +++ b/app/Presenters/ManufacturerPresenter.php @@ -124,8 +124,15 @@ class ManufacturerPresenter extends Presenter 'title' => trans('general.accessories'), 'visible' => true, 'class' => 'css-accessory', - ], - [ + ], [ + 'field' => 'components_count', + 'searchable' => false, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('general.components'), + 'visible' => true, + 'class' => 'css-component', + ], [ 'field' => 'created_by', 'searchable' => false, 'sortable' => true, diff --git a/composer.lock b/composer.lock index 0631fc275e..5850996b11 100644 --- a/composer.lock +++ b/composer.lock @@ -4461,16 +4461,16 @@ }, { "name": "livewire/livewire", - "version": "v3.5.9", + "version": "v3.5.12", "source": { "type": "git", "url": "https://github.com/livewire/livewire.git", - "reference": "d04a229058afa76116d0e39209943a8ea3a7f888" + "reference": "3c8d1f9d7d9098aaea663093ae168f2d5d2ae73d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/livewire/livewire/zipball/d04a229058afa76116d0e39209943a8ea3a7f888", - "reference": "d04a229058afa76116d0e39209943a8ea3a7f888", + "url": "https://api.github.com/repos/livewire/livewire/zipball/3c8d1f9d7d9098aaea663093ae168f2d5d2ae73d", + "reference": "3c8d1f9d7d9098aaea663093ae168f2d5d2ae73d", "shasum": "" }, "require": { @@ -4525,7 +4525,7 @@ "description": "A front-end framework for Laravel.", "support": { "issues": "https://github.com/livewire/livewire/issues", - "source": "https://github.com/livewire/livewire/tree/v3.5.9" + "source": "https://github.com/livewire/livewire/tree/v3.5.12" }, "funding": [ { @@ -4533,7 +4533,7 @@ "type": "github" } ], - "time": "2024-10-01T12:40:06+00:00" + "time": "2024-10-15T19:35:06+00:00" }, { "name": "masterminds/html5", @@ -16504,5 +16504,5 @@ "ext-pdo": "*" }, "platform-dev": [], - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.3.0" } diff --git a/database/factories/ComponentFactory.php b/database/factories/ComponentFactory.php index 51942fc694..786e780895 100644 --- a/database/factories/ComponentFactory.php +++ b/database/factories/ComponentFactory.php @@ -7,6 +7,7 @@ use App\Models\Asset; use App\Models\Category; use App\Models\Company; use App\Models\Component; +use App\Models\Manufacturer; use App\Models\Consumable; use App\Models\Location; use App\Models\User; @@ -30,6 +31,7 @@ class ComponentFactory extends Factory */ public function definition() { + return [ 'name' => $this->faker->text(20), 'category_id' => Category::factory(), @@ -42,12 +44,14 @@ class ComponentFactory extends Factory 'min_amt' => $this->faker->numberBetween($min = 1, $max = 2), 'company_id' => Company::factory(), 'supplier_id' => Supplier::factory(), + 'model_number' => $this->faker->numberBetween(1000000, 50000000), ]; } public function ramCrucial4() { - return $this->state(function () { + $manufacturer = Manufacturer::where('name', 'Crucial')->first() ?? Manufacturer::factory()->create(['name' => 'Crucial']); + return $this->state(function () use ($manufacturer) { return [ 'name' => 'Crucial 4GB DDR3L-1600 SODIMM', 'category_id' => function () { @@ -55,6 +59,7 @@ class ComponentFactory extends Factory }, 'qty' => 10, 'min_amt' => 2, + 'manufacturer_id' => $manufacturer->id, 'location_id' => Location::factory(), ]; }); @@ -62,7 +67,8 @@ class ComponentFactory extends Factory public function ramCrucial8() { - return $this->state(function () { + $manufacturer = Manufacturer::where('name', 'Crucial')->first() ?? Manufacturer::factory()->create(['name' => 'Crucial']); + return $this->state(function () use ($manufacturer) { return [ 'name' => 'Crucial 8GB DDR3L-1600 SODIMM Memory for Mac', 'category_id' => function () { @@ -70,13 +76,15 @@ class ComponentFactory extends Factory }, 'qty' => 10, 'min_amt' => 2, + 'manufacturer_id' => $manufacturer->id, ]; }); } public function ssdCrucial120() { - return $this->state(function () { + $manufacturer = Manufacturer::where('name', 'Crucial')->first() ?? Manufacturer::factory()->create(['name' => 'Crucial']); + return $this->state(function () use ($manufacturer) { return [ 'name' => 'Crucial BX300 120GB SATA Internal SSD', 'category_id' => function () { @@ -84,13 +92,15 @@ class ComponentFactory extends Factory }, 'qty' => 10, 'min_amt' => 2, + 'manufacturer_id' => $manufacturer->id, ]; }); } public function ssdCrucial240() { - return $this->state(function () { + $manufacturer = Manufacturer::where('name', 'Crucial')->first() ?? Manufacturer::factory()->create(['name' => 'Crucial']); + return $this->state(function () use ($manufacturer) { return [ 'name' => 'Crucial BX300 240GB SATA Internal SSD', 'category_id' => function () { @@ -98,6 +108,7 @@ class ComponentFactory extends Factory }, 'qty' => 10, 'min_amt' => 2, + 'manufacturer_id' => $manufacturer->id, ]; }); } diff --git a/database/migrations/2024_10_23_162301_add_manufacturer_id_model_number_to_consumables.php b/database/migrations/2024_10_23_162301_add_manufacturer_id_model_number_to_consumables.php new file mode 100644 index 0000000000..0180ac0edd --- /dev/null +++ b/database/migrations/2024_10_23_162301_add_manufacturer_id_model_number_to_consumables.php @@ -0,0 +1,30 @@ +integer('manufacturer_id')->after('purchase_cost')->nullable()->default(null); + $table->string('model_number')->after('purchase_cost')->nullable()->default(null); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('components', function (Blueprint $table) { + $table->dropColumn('manufacturer_id'); + $table->dropColumn('model_number'); + }); + } +}; diff --git a/public/vendor/livewire/livewire.esm.js b/public/vendor/livewire/livewire.esm.js index ae4bb2cb78..2d7ef4791c 100644 --- a/public/vendor/livewire/livewire.esm.js +++ b/public/vendor/livewire/livewire.esm.js @@ -2557,7 +2557,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); } } function bindInputValue(el, value) { - if (el.type === "radio") { + if (isRadio(el)) { if (el.attributes.value === void 0) { el.value = value; } @@ -2568,7 +2568,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); el.checked = checkedAttrLooseCompare(el.value, value); } } - } else if (el.type === "checkbox") { + } else if (isCheckbox(el)) { if (Number.isInteger(value)) { el.value = value; } else if (!Array.isArray(value) && typeof value !== "boolean" && ![null, void 0].includes(value)) { @@ -2707,6 +2707,12 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); } return attr; } + function isCheckbox(el) { + return el.type === "checkbox" || el.localName === "ui-checkbox" || el.localName === "ui-switch"; + } + function isRadio(el) { + return el.type === "radio" || el.localName === "ui-radio"; + } function debounce2(func, wait) { var timeout; return function() { @@ -2860,7 +2866,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); get raw() { return raw; }, - version: "3.14.1", + version: "3.14.3", flushAndStopDeferringMutations, dontAutoEvaluateFunctions, disableEffectScheduling, @@ -3296,7 +3302,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); setValue(getInputValue(el, modifiers, e, getValue())); }); if (modifiers.includes("fill")) { - if ([void 0, null, ""].includes(getValue()) || el.type === "checkbox" && Array.isArray(getValue()) || el.tagName.toLowerCase() === "select" && el.multiple) { + if ([void 0, null, ""].includes(getValue()) || isCheckbox(el) && Array.isArray(getValue()) || el.tagName.toLowerCase() === "select" && el.multiple) { setValue(getInputValue(el, modifiers, { target: el }, getValue())); } } @@ -3336,7 +3342,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); return mutateDom(() => { if (event instanceof CustomEvent && event.detail !== void 0) return event.detail !== null && event.detail !== void 0 ? event.detail : event.target.value; - else if (el.type === "checkbox") { + else if (isCheckbox(el)) { if (Array.isArray(currentValue)) { let newValue = null; if (modifiers.includes("number")) { @@ -3367,7 +3373,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); }); } else { let newValue; - if (el.type === "radio") { + if (isRadio(el)) { if (event.target.checked) { newValue = event.target.value; } else { @@ -6820,8 +6826,6 @@ var require_module_cjs8 = __commonJS({ let toAttributes = Array.from(to.attributes); for (let i = domAttributes.length - 1; i >= 0; i--) { let name = domAttributes[i].name; - if (name === "style") - continue; if (!to.hasAttribute(name)) { from2.removeAttribute(name); } @@ -6829,8 +6833,6 @@ var require_module_cjs8 = __commonJS({ for (let i = toAttributes.length - 1; i >= 0; i--) { let name = toAttributes[i].name; let value = toAttributes[i].value; - if (name === "style") - continue; if (from2.getAttribute(name) !== value) { from2.setAttribute(name, value); } @@ -9015,6 +9017,44 @@ function injectStyles() { document.head.appendChild(style); } +// js/plugins/navigate/popover.js +function packUpPersistedPopovers(persistedEl) { + persistedEl.querySelectorAll(":popover-open").forEach((el) => { + el.setAttribute("data-navigate-popover-open", ""); + let animations = el.getAnimations(); + el._pausedAnimations = animations.map((animation) => ({ + keyframes: animation.effect.getKeyframes(), + options: { + duration: animation.effect.getTiming().duration, + easing: animation.effect.getTiming().easing, + fill: animation.effect.getTiming().fill, + iterations: animation.effect.getTiming().iterations + }, + currentTime: animation.currentTime, + playState: animation.playState + })); + animations.forEach((i) => i.pause()); + }); +} +function unPackPersistedPopovers(persistedEl) { + persistedEl.querySelectorAll("[data-navigate-popover-open]").forEach((el) => { + el.removeAttribute("data-navigate-popover-open"); + queueMicrotask(() => { + if (!el.isConnected) + return; + el.showPopover(); + el.getAnimations().forEach((i) => i.finish()); + if (el._pausedAnimations) { + el._pausedAnimations.forEach(({ keyframes, options, currentTime, now, playState }) => { + let animation = el.animate(keyframes, options); + animation.currentTime = currentTime; + }); + delete el._pausedAnimations; + } + }); + }); +} + // js/plugins/navigate/page.js var oldBodyScriptTagHashes = []; var attributesExemptFromScriptTagHashing = [ @@ -9153,7 +9193,7 @@ var autofocus = false; function navigate_default(Alpine19) { Alpine19.navigate = (url) => { let destination = createUrlObjectFromString(url); - let prevented = fireEventForOtherLibariesToHookInto("alpine:navigate", { + let prevented = fireEventForOtherLibrariesToHookInto("alpine:navigate", { url: destination, history: false, cached: false @@ -9184,7 +9224,7 @@ function navigate_default(Alpine19) { storeThePrefetchedHtmlForWhenALinkIsClicked(html, destination, finalDestination); }); whenItIsReleased(() => { - let prevented = fireEventForOtherLibariesToHookInto("alpine:navigate", { + let prevented = fireEventForOtherLibrariesToHookInto("alpine:navigate", { url: destination, history: false, cached: false @@ -9198,7 +9238,7 @@ function navigate_default(Alpine19) { function navigateTo(destination, shouldPushToHistoryState = true) { showProgressBar && showAndStartProgressBar(); fetchHtmlOrUsePrefetchedHtml(destination, (html, finalDestination) => { - fireEventForOtherLibariesToHookInto("alpine:navigating"); + fireEventForOtherLibrariesToHookInto("alpine:navigating"); restoreScroll && storeScrollInformationInHtmlBeforeNavigatingAway(); showProgressBar && finishAndHideProgressBar(); cleanupAlpineElementsOnThePageThatArentInsideAPersistedElement(); @@ -9206,6 +9246,7 @@ function navigate_default(Alpine19) { preventAlpineFromPickingUpDomChanges(Alpine19, (andAfterAllThis) => { enablePersist && storePersistantElementsForLater((persistedEl) => { packUpPersistedTeleports(persistedEl); + packUpPersistedPopovers(persistedEl); }); if (shouldPushToHistoryState) { updateUrlAndStoreLatestHtmlForFutureBackButtons(html, finalDestination); @@ -9216,6 +9257,7 @@ function navigate_default(Alpine19) { removeAnyLeftOverStaleTeleportTargets(document.body); enablePersist && putPersistantElementsBack((persistedEl, newStub) => { unPackPersistedTeleports(persistedEl); + unPackPersistedPopovers(persistedEl); }); restoreScrollPositionOrScrollToTop(); afterNewScriptsAreDoneLoading(() => { @@ -9224,7 +9266,7 @@ function navigate_default(Alpine19) { autofocus && autofocusElementsWithTheAutofocusAttribute(); }); nowInitializeAlpineOnTheNewPage(Alpine19); - fireEventForOtherLibariesToHookInto("alpine:navigated"); + fireEventForOtherLibrariesToHookInto("alpine:navigated"); }); }); }); @@ -9234,7 +9276,7 @@ function navigate_default(Alpine19) { whenTheBackOrForwardButtonIsClicked((ifThePageBeingVisitedHasntBeenCached) => { ifThePageBeingVisitedHasntBeenCached((url) => { let destination = createUrlObjectFromString(url); - let prevented = fireEventForOtherLibariesToHookInto("alpine:navigate", { + let prevented = fireEventForOtherLibrariesToHookInto("alpine:navigate", { url: destination, history: true, cached: false @@ -9246,7 +9288,7 @@ function navigate_default(Alpine19) { }); }, (html, url, currentPageUrl, currentPageKey) => { let destination = createUrlObjectFromString(url); - let prevented = fireEventForOtherLibariesToHookInto("alpine:navigate", { + let prevented = fireEventForOtherLibrariesToHookInto("alpine:navigate", { url: destination, history: true, cached: true @@ -9254,29 +9296,31 @@ function navigate_default(Alpine19) { if (prevented) return; storeScrollInformationInHtmlBeforeNavigatingAway(); - fireEventForOtherLibariesToHookInto("alpine:navigating"); + fireEventForOtherLibrariesToHookInto("alpine:navigating"); updateCurrentPageHtmlInSnapshotCacheForLaterBackButtonClicks(currentPageUrl, currentPageKey); preventAlpineFromPickingUpDomChanges(Alpine19, (andAfterAllThis) => { enablePersist && storePersistantElementsForLater((persistedEl) => { packUpPersistedTeleports(persistedEl); + packUpPersistedPopovers(persistedEl); }); swapCurrentPageWithNewHtml(html, () => { removeAnyLeftOverStaleProgressBars(); removeAnyLeftOverStaleTeleportTargets(document.body); enablePersist && putPersistantElementsBack((persistedEl, newStub) => { unPackPersistedTeleports(persistedEl); + unPackPersistedPopovers(persistedEl); }); restoreScrollPositionOrScrollToTop(); andAfterAllThis(() => { autofocus && autofocusElementsWithTheAutofocusAttribute(); nowInitializeAlpineOnTheNewPage(Alpine19); - fireEventForOtherLibariesToHookInto("alpine:navigated"); + fireEventForOtherLibrariesToHookInto("alpine:navigated"); }); }); }); }); setTimeout(() => { - fireEventForOtherLibariesToHookInto("alpine:navigated"); + fireEventForOtherLibrariesToHookInto("alpine:navigated"); }); } function fetchHtmlOrUsePrefetchedHtml(fromDestination, callback) { @@ -9293,7 +9337,7 @@ function preventAlpineFromPickingUpDomChanges(Alpine19, callback) { }); }); } -function fireEventForOtherLibariesToHookInto(name, detail) { +function fireEventForOtherLibrariesToHookInto(name, detail) { let event = new CustomEvent(name, { cancelable: true, bubbles: true, @@ -9809,6 +9853,7 @@ function morph2(component, el, html) { }, lookahead: false }); + trigger("morphed", { el, component }); } function isntElement(el) { return typeof el.hasAttribute !== "function"; @@ -10878,3 +10923,4 @@ focus-trap/dist/focus-trap.js: * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE *) */ +//# sourceMappingURL=livewire.esm.js.map diff --git a/public/vendor/livewire/livewire.js b/public/vendor/livewire/livewire.js index 687180f6b1..670591055f 100644 --- a/public/vendor/livewire/livewire.js +++ b/public/vendor/livewire/livewire.js @@ -1975,7 +1975,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); } } function bindInputValue(el, value) { - if (el.type === "radio") { + if (isRadio(el)) { if (el.attributes.value === void 0) { el.value = value; } @@ -1986,7 +1986,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); el.checked = checkedAttrLooseCompare(el.value, value); } } - } else if (el.type === "checkbox") { + } else if (isCheckbox(el)) { if (Number.isInteger(value)) { el.value = value; } else if (!Array.isArray(value) && typeof value !== "boolean" && ![null, void 0].includes(value)) { @@ -2125,6 +2125,12 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); } return attr; } + function isCheckbox(el) { + return el.type === "checkbox" || el.localName === "ui-checkbox" || el.localName === "ui-switch"; + } + function isRadio(el) { + return el.type === "radio" || el.localName === "ui-radio"; + } function debounce(func, wait) { var timeout; return function() { @@ -2278,7 +2284,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); get raw() { return raw; }, - version: "3.14.1", + version: "3.14.3", flushAndStopDeferringMutations, dontAutoEvaluateFunctions, disableEffectScheduling, @@ -3361,7 +3367,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); setValue(getInputValue(el, modifiers, e, getValue())); }); if (modifiers.includes("fill")) { - if ([void 0, null, ""].includes(getValue()) || el.type === "checkbox" && Array.isArray(getValue()) || el.tagName.toLowerCase() === "select" && el.multiple) { + if ([void 0, null, ""].includes(getValue()) || isCheckbox(el) && Array.isArray(getValue()) || el.tagName.toLowerCase() === "select" && el.multiple) { setValue(getInputValue(el, modifiers, { target: el }, getValue())); } } @@ -3401,7 +3407,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); return mutateDom(() => { if (event instanceof CustomEvent && event.detail !== void 0) return event.detail !== null && event.detail !== void 0 ? event.detail : event.target.value; - else if (el.type === "checkbox") { + else if (isCheckbox(el)) { if (Array.isArray(currentValue)) { let newValue = null; if (modifiers.includes("number")) { @@ -3432,7 +3438,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); }); } else { let newValue; - if (el.type === "radio") { + if (isRadio(el)) { if (event.target.checked) { newValue = event.target.value; } else { @@ -4971,11 +4977,11 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); var checked = getCheckedRadio(radioSet, node.form); return !checked || checked === node; }; - var isRadio = function isRadio2(node) { + var isRadio2 = function isRadio22(node) { return isInput(node) && node.type === "radio"; }; var isNonTabbableRadio = function isNonTabbableRadio2(node) { - return isRadio(node) && !isTabbableRadio(node); + return isRadio2(node) && !isTabbableRadio(node); }; var isZeroArea = function isZeroArea2(node) { var _node$getBoundingClie = node.getBoundingClientRect(), width = _node$getBoundingClie.width, height = _node$getBoundingClie.height; @@ -7625,6 +7631,44 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); document.head.appendChild(style); } + // js/plugins/navigate/popover.js + function packUpPersistedPopovers(persistedEl) { + persistedEl.querySelectorAll(":popover-open").forEach((el) => { + el.setAttribute("data-navigate-popover-open", ""); + let animations = el.getAnimations(); + el._pausedAnimations = animations.map((animation) => ({ + keyframes: animation.effect.getKeyframes(), + options: { + duration: animation.effect.getTiming().duration, + easing: animation.effect.getTiming().easing, + fill: animation.effect.getTiming().fill, + iterations: animation.effect.getTiming().iterations + }, + currentTime: animation.currentTime, + playState: animation.playState + })); + animations.forEach((i) => i.pause()); + }); + } + function unPackPersistedPopovers(persistedEl) { + persistedEl.querySelectorAll("[data-navigate-popover-open]").forEach((el) => { + el.removeAttribute("data-navigate-popover-open"); + queueMicrotask(() => { + if (!el.isConnected) + return; + el.showPopover(); + el.getAnimations().forEach((i) => i.finish()); + if (el._pausedAnimations) { + el._pausedAnimations.forEach(({ keyframes, options, currentTime, now, playState }) => { + let animation = el.animate(keyframes, options); + animation.currentTime = currentTime; + }); + delete el._pausedAnimations; + } + }); + }); + } + // js/plugins/navigate/page.js var oldBodyScriptTagHashes = []; var attributesExemptFromScriptTagHashing = [ @@ -7763,7 +7807,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); function navigate_default(Alpine3) { Alpine3.navigate = (url) => { let destination = createUrlObjectFromString(url); - let prevented = fireEventForOtherLibariesToHookInto("alpine:navigate", { + let prevented = fireEventForOtherLibrariesToHookInto("alpine:navigate", { url: destination, history: false, cached: false @@ -7794,7 +7838,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); storeThePrefetchedHtmlForWhenALinkIsClicked(html, destination, finalDestination); }); whenItIsReleased(() => { - let prevented = fireEventForOtherLibariesToHookInto("alpine:navigate", { + let prevented = fireEventForOtherLibrariesToHookInto("alpine:navigate", { url: destination, history: false, cached: false @@ -7808,7 +7852,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); function navigateTo(destination, shouldPushToHistoryState = true) { showProgressBar && showAndStartProgressBar(); fetchHtmlOrUsePrefetchedHtml(destination, (html, finalDestination) => { - fireEventForOtherLibariesToHookInto("alpine:navigating"); + fireEventForOtherLibrariesToHookInto("alpine:navigating"); restoreScroll && storeScrollInformationInHtmlBeforeNavigatingAway(); showProgressBar && finishAndHideProgressBar(); cleanupAlpineElementsOnThePageThatArentInsideAPersistedElement(); @@ -7816,6 +7860,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); preventAlpineFromPickingUpDomChanges(Alpine3, (andAfterAllThis) => { enablePersist && storePersistantElementsForLater((persistedEl) => { packUpPersistedTeleports(persistedEl); + packUpPersistedPopovers(persistedEl); }); if (shouldPushToHistoryState) { updateUrlAndStoreLatestHtmlForFutureBackButtons(html, finalDestination); @@ -7826,6 +7871,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); removeAnyLeftOverStaleTeleportTargets(document.body); enablePersist && putPersistantElementsBack((persistedEl, newStub) => { unPackPersistedTeleports(persistedEl); + unPackPersistedPopovers(persistedEl); }); restoreScrollPositionOrScrollToTop(); afterNewScriptsAreDoneLoading(() => { @@ -7834,7 +7880,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); autofocus && autofocusElementsWithTheAutofocusAttribute(); }); nowInitializeAlpineOnTheNewPage(Alpine3); - fireEventForOtherLibariesToHookInto("alpine:navigated"); + fireEventForOtherLibrariesToHookInto("alpine:navigated"); }); }); }); @@ -7844,7 +7890,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); whenTheBackOrForwardButtonIsClicked((ifThePageBeingVisitedHasntBeenCached) => { ifThePageBeingVisitedHasntBeenCached((url) => { let destination = createUrlObjectFromString(url); - let prevented = fireEventForOtherLibariesToHookInto("alpine:navigate", { + let prevented = fireEventForOtherLibrariesToHookInto("alpine:navigate", { url: destination, history: true, cached: false @@ -7856,7 +7902,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); }); }, (html, url, currentPageUrl, currentPageKey) => { let destination = createUrlObjectFromString(url); - let prevented = fireEventForOtherLibariesToHookInto("alpine:navigate", { + let prevented = fireEventForOtherLibrariesToHookInto("alpine:navigate", { url: destination, history: true, cached: true @@ -7864,29 +7910,31 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); if (prevented) return; storeScrollInformationInHtmlBeforeNavigatingAway(); - fireEventForOtherLibariesToHookInto("alpine:navigating"); + fireEventForOtherLibrariesToHookInto("alpine:navigating"); updateCurrentPageHtmlInSnapshotCacheForLaterBackButtonClicks(currentPageUrl, currentPageKey); preventAlpineFromPickingUpDomChanges(Alpine3, (andAfterAllThis) => { enablePersist && storePersistantElementsForLater((persistedEl) => { packUpPersistedTeleports(persistedEl); + packUpPersistedPopovers(persistedEl); }); swapCurrentPageWithNewHtml(html, () => { removeAnyLeftOverStaleProgressBars(); removeAnyLeftOverStaleTeleportTargets(document.body); enablePersist && putPersistantElementsBack((persistedEl, newStub) => { unPackPersistedTeleports(persistedEl); + unPackPersistedPopovers(persistedEl); }); restoreScrollPositionOrScrollToTop(); andAfterAllThis(() => { autofocus && autofocusElementsWithTheAutofocusAttribute(); nowInitializeAlpineOnTheNewPage(Alpine3); - fireEventForOtherLibariesToHookInto("alpine:navigated"); + fireEventForOtherLibrariesToHookInto("alpine:navigated"); }); }); }); }); setTimeout(() => { - fireEventForOtherLibariesToHookInto("alpine:navigated"); + fireEventForOtherLibrariesToHookInto("alpine:navigated"); }); } function fetchHtmlOrUsePrefetchedHtml(fromDestination, callback) { @@ -7903,7 +7951,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); }); }); } - function fireEventForOtherLibariesToHookInto(name, detail) { + function fireEventForOtherLibrariesToHookInto(name, detail) { let event = new CustomEvent(name, { cancelable: true, bubbles: true, @@ -8212,8 +8260,6 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); let toAttributes = Array.from(to.attributes); for (let i = domAttributes.length - 1; i >= 0; i--) { let name = domAttributes[i].name; - if (name === "style") - continue; if (!to.hasAttribute(name)) { from2.removeAttribute(name); } @@ -8221,8 +8267,6 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); for (let i = toAttributes.length - 1; i >= 0; i--) { let name = toAttributes[i].name; let value = toAttributes[i].value; - if (name === "style") - continue; if (from2.getAttribute(name) !== value) { from2.setAttribute(name, value); } @@ -8914,6 +8958,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); }, lookahead: false }); + trigger2("morphed", { el, component }); } function isntElement(el) { return typeof el.hasAttribute !== "function"; diff --git a/public/vendor/livewire/livewire.min.js b/public/vendor/livewire/livewire.min.js index 90a91971d8..32197b3ebf 100644 --- a/public/vendor/livewire/livewire.min.js +++ b/public/vendor/livewire/livewire.min.js @@ -1,14 +1,14 @@ -(()=>{var nl=Object.create;var ii=Object.defineProperty;var il=Object.getOwnPropertyDescriptor;var ol=Object.getOwnPropertyNames;var sl=Object.getPrototypeOf,al=Object.prototype.hasOwnProperty;var ll=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var ul=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ol(t))!al.call(e,i)&&i!==r&&ii(e,i,{get:()=>t[i],enumerable:!(n=il(t,i))||n.enumerable});return e};var cl=(e,t,r)=>(r=e!=null?nl(sl(e)):{},ul(t||!e||!e.__esModule?ii(r,"default",{value:e,enumerable:!0}):r,e));var da=ll((Hn,fa)=>{(function(e,t){typeof define=="function"&&define.amd?define(t):typeof Hn=="object"?fa.exports=t():e.NProgress=t()})(Hn,function(){var e={};e.version="0.2.0";var t=e.settings={minimum:.08,easing:"ease",positionUsing:"",speed:200,trickle:!0,trickleRate:.02,trickleSpeed:800,showSpinner:!0,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'
'};e.configure=function(c){var d,m;for(d in c)m=c[d],m!==void 0&&c.hasOwnProperty(d)&&(t[d]=m);return this},e.status=null,e.set=function(c){var d=e.isStarted();c=r(c,t.minimum,1),e.status=c===1?null:c;var m=e.render(!d),b=m.querySelector(t.barSelector),g=t.speed,y=t.easing;return m.offsetWidth,o(function(v){t.positionUsing===""&&(t.positionUsing=e.getPositioningCSS()),s(b,i(c,g,y)),c===1?(s(m,{transition:"none",opacity:1}),m.offsetWidth,setTimeout(function(){s(m,{transition:"all "+g+"ms linear",opacity:0}),setTimeout(function(){e.remove(),v()},g)},g)):setTimeout(v,g)}),this},e.isStarted=function(){return typeof e.status=="number"},e.start=function(){e.status||e.set(0);var c=function(){setTimeout(function(){!e.status||(e.trickle(),c())},t.trickleSpeed)};return t.trickle&&c(),this},e.done=function(c){return!c&&!e.status?this:e.inc(.3+.5*Math.random()).set(1)},e.inc=function(c){var d=e.status;return d?(typeof c!="number"&&(c=(1-d)*r(Math.random()*d,.1,.95)),d=r(d+c,0,.994),e.set(d)):e.start()},e.trickle=function(){return e.inc(Math.random()*t.trickleRate)},function(){var c=0,d=0;e.promise=function(m){return!m||m.state()==="resolved"?this:(d===0&&e.start(),c++,d++,m.always(function(){d--,d===0?(c=0,e.done()):e.set((c-d)/c)}),this)}}(),e.render=function(c){if(e.isRendered())return document.getElementById("nprogress");l(document.documentElement,"nprogress-busy");var d=document.createElement("div");d.id="nprogress",d.innerHTML=t.template;var m=d.querySelector(t.barSelector),b=c?"-100":n(e.status||0),g=document.querySelector(t.parent),y;return s(m,{transition:"all 0 linear",transform:"translate3d("+b+"%,0,0)"}),t.showSpinner||(y=d.querySelector(t.spinnerSelector),y&&p(y)),g!=document.body&&l(g,"nprogress-custom-parent"),g.appendChild(d),d},e.remove=function(){u(document.documentElement,"nprogress-busy"),u(document.querySelector(t.parent),"nprogress-custom-parent");var c=document.getElementById("nprogress");c&&p(c)},e.isRendered=function(){return!!document.getElementById("nprogress")},e.getPositioningCSS=function(){var c=document.body.style,d="WebkitTransform"in c?"Webkit":"MozTransform"in c?"Moz":"msTransform"in c?"ms":"OTransform"in c?"O":"";return d+"Perspective"in c?"translate3d":d+"Transform"in c?"translate":"margin"};function r(c,d,m){return cm?m:c}function n(c){return(-1+c)*100}function i(c,d,m){var b;return t.positionUsing==="translate3d"?b={transform:"translate3d("+n(c)+"%,0,0)"}:t.positionUsing==="translate"?b={transform:"translate("+n(c)+"%,0)"}:b={"margin-left":n(c)+"%"},b.transition="all "+d+"ms "+m,b}var o=function(){var c=[];function d(){var m=c.shift();m&&m(d)}return function(m){c.push(m),c.length==1&&d()}}(),s=function(){var c=["Webkit","O","Moz","ms"],d={};function m(v){return v.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,function(_,T){return T.toUpperCase()})}function b(v){var _=document.body.style;if(v in _)return v;for(var T=c.length,A=v.charAt(0).toUpperCase()+v.slice(1),w;T--;)if(w=c[T]+A,w in _)return w;return v}function g(v){return v=m(v),d[v]||(d[v]=b(v))}function y(v,_,T){_=g(_),v.style[_]=T}return function(v,_){var T=arguments,A,w;if(T.length==2)for(A in _)w=_[A],w!==void 0&&_.hasOwnProperty(A)&&y(v,A,w);else y(v,T[1],T[2])}}();function a(c,d){var m=typeof c=="string"?c:f(c);return m.indexOf(" "+d+" ")>=0}function l(c,d){var m=f(c),b=m+d;a(m,d)||(c.className=b.substring(1))}function u(c,d){var m=f(c),b;!a(c,d)||(b=m.replace(" "+d+" "," "),c.className=b.substring(1,b.length-1))}function f(c){return(" "+(c.className||"")+" ").replace(/\s+/gi," ")}function p(c){c&&c.parentNode&&c.parentNode.removeChild(c)}return e})});var yt=class{constructor(){this.arrays={}}add(t,r){this.arrays[t]||(this.arrays[t]=[]),this.arrays[t].push(r)}remove(t){this.arrays[t]&&delete this.arrays[t]}get(t){return this.arrays[t]||[]}each(t,r){return this.get(t).forEach(r)}},Fe=class{constructor(){this.arrays=new WeakMap}add(t,r){this.arrays.has(t)||this.arrays.set(t,[]),this.arrays.get(t).push(r)}remove(t){this.arrays.has(t)&&this.arrays.delete(t,[])}get(t){return this.arrays.has(t)?this.arrays.get(t):[]}each(t,r){return this.get(t).forEach(r)}};function xt(e,t,r={},n=!0){e.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:n,composed:!0,cancelable:!0}))}function _t(e,t,r){return e.addEventListener(t,r),()=>e.removeEventListener(t,r)}function St(e){return typeof e=="object"&&e!==null}function oi(e){return St(e)&&!br(e)}function br(e){return Array.isArray(e)}function wr(e){return typeof e=="function"}function si(e){return typeof e!="object"||e===null}function ce(e){return JSON.parse(JSON.stringify(e))}function W(e,t){return t===""?e:t.split(".").reduce((r,n)=>{if(r!==void 0)return r[n]},e)}function we(e,t,r){let n=t.split(".");if(n.length===1)return e[t]=r;let i=n.shift(),o=n.join(".");e[i]===void 0&&(e[i]={}),we(e[i],o,r)}function Ze(e,t,r={},n=""){if(e===t)return r;if(typeof e!=typeof t||oi(e)&&br(t)||br(e)&&oi(t)||si(e)||si(t))return r[n]=t,r;let i=Object.keys(e);return Object.entries(t).forEach(([o,s])=>{r={...r,...Ze(e[o],t[o],r,n===""?o:`${n}.${o}`)},i=i.filter(a=>a!==o)}),i.forEach(o=>{r[`${n}.${o}`]="__rm__"}),r}function ye(e){let t=ai(e)?e[0]:e,r=ai(e)?e[1]:void 0;return St(t)&&Object.entries(t).forEach(([n,i])=>{t[n]=ye(i)}),t}function ai(e){return Array.isArray(e)&&e.length===2&&typeof e[1]=="object"&&Object.keys(e[1]).includes("s")}function Et(){if(document.querySelector('meta[name="csrf-token"]'))return document.querySelector('meta[name="csrf-token"]').getAttribute("content");if(document.querySelector("[data-csrf]"))return document.querySelector("[data-csrf]").getAttribute("data-csrf");if(window.livewireScriptConfig.csrf??!1)return window.livewireScriptConfig.csrf;throw"Livewire: No CSRF token detected"}var Ie;function li(){if(Ie)return Ie;if(window.livewireScriptConfig&&(window.livewireScriptConfig.nonce??!1))return Ie=window.livewireScriptConfig.nonce,Ie;let e=document.querySelector("style[data-livewire-style][nonce]");return e?(Ie=e.nonce,Ie):null}function ui(){return document.querySelector("[data-update-uri]")?.getAttribute("data-update-uri")??window.livewireScriptConfig.uri??null}function At(e){return!!e.match(/