From 17ce222d8948c95f4adf134d20a4d568a4c8c714 Mon Sep 17 00:00:00 2001 From: Arthur Monney Date: Tue, 9 Apr 2024 04:51:00 +0200 Subject: [PATCH] Products feature (#245) * Products - Add create and list feature * Products - Add shipping, overview, seo and inventory edit feature * Products - Add related product on edit product tabs * fix code formatting --------- Co-authored-by: mckenziearts --- packages/admin/composer.json | 1 + packages/admin/config/admin.php | 15 + packages/admin/config/components/product.php | 15 +- packages/admin/package.json | 3 + packages/admin/public/shopper.css | 1241 +++++++++++++--- packages/admin/public/shopper.js | 1286 ++++++++++++++++- packages/admin/resources/css/base.css | 48 +- .../resources/css/components/sidebar.css | 16 + .../resources/css/components/treeselect.css | 252 ++++ packages/admin/resources/css/shopper.css | 1 + .../resources/js/components/select-tree.js | 60 + packages/admin/resources/js/index.js | 2 + packages/admin/resources/lang/en/layout.php | 1 + .../resources/lang/en/pages/products.php | 10 +- packages/admin/resources/lang/en/words.php | 2 +- packages/admin/resources/lang/fr/layout.php | 1 + .../resources/lang/fr/pages/products.php | 9 +- packages/admin/resources/lang/fr/words.php | 2 +- .../filament/forms/currency-mask.blade.php | 96 ++ .../filament/forms/quantity.blade.php | 157 ++ .../forms/checkbox-category.blade.php | 17 +- .../views/components/forms/search.blade.php | 2 +- .../views/components/layouts/app.blade.php | 8 +- .../components/layouts/app/header.blade.php | 2 +- .../layouts/app/sidebar/content.blade.php | 17 +- .../views/components/layouts/base.blade.php | 22 +- .../views/components/separator.blade.php | 2 +- .../views/filament/form/select-tree.blade.php | 48 + .../filament/form/text-input-select.blade.php | 89 ++ .../views/filament/wizard-column.blade.php | 290 ++++ .../filament/wizard/step-column.blade.php | 0 .../components/products/forms/edit.blade.php | 14 + .../products/forms/form-attributes.blade.php | 0 .../products/forms/form-variants.blade.php | 0 .../products/forms/inventory.blade.php | 30 + .../components/products/forms/media.blade.php | 14 + .../products/forms/related.blade.php | 111 ++ .../components/products/forms/seo.blade.php | 53 + .../products/forms/shipping.blade.php | 14 + ...de.php => related-products-list.blade.php} | 31 +- .../livewire/pages/category/index.blade.php | 4 + .../livewire/pages/products/create.blade.php | 18 + .../livewire/pages/products/edit.blade.php | 128 ++ .../products/index.blade.php} | 14 +- .../pages/products/variant.blade.php | 0 .../livewire/pages/settings/general.blade.php | 2 +- .../views/livewire/products/create.blade.php | 497 ------- .../views/livewire/products/edit.blade.php | 146 -- .../products/forms/form-edit.blade.php | 267 ---- .../products/forms/form-inventory.blade.php | 218 --- .../products/forms/form-related.blade.php | 60 - .../products/forms/form-seo.blade.php | 66 - .../products/forms/form-shipping.blade.php | 108 -- .../tables/cells/categories/name.blade.php | 12 +- .../tables/cells/products/stock.blade.php | 19 +- .../views/pages/products/create.blade.php | 3 - .../views/pages/products/edit.blade.php | 3 - .../views/pages/products/index.blade.php | 3 - packages/admin/routes/admin/product.php | 9 +- .../admin/src/Components/Form/Quantity.php | 50 + .../admin/src/Components/Form/SelectTree.php | 560 +++++++ .../src/Components/Form/ShippingField.php | 62 + .../src/Components/Form/TextInputSelect.php | 103 ++ .../src/Components/Wizard/StepColumn.php | 11 + .../admin/src/Components/WizardColumn.php | 33 + packages/admin/src/Events/CatalogSidebar.php | 26 +- packages/admin/src/Events/CustomerSidebar.php | 14 +- .../admin/src/Events/DashboardSidebar.php | 6 +- packages/admin/src/Events/SalesSidebar.php | 14 +- .../Livewire/Components/Products/Browse.php | 19 - .../Livewire/Components/Products/Create.php | 166 --- .../src/Livewire/Components/Products/Edit.php | 41 - .../Components/Products/Form/Edit.php | 247 ++-- .../Components/Products/Form/Inventory.php | 210 ++- .../Components/Products/Form/Media.php | 71 + .../Products/Form/RelatedProducts.php | 51 +- .../Livewire/Components/Products/Form/Seo.php | 58 +- .../Components/Products/Form/Shipping.php | 84 +- .../Components/Products/WithAttributes.php | 63 - .../src/Livewire/Modals/DeleteProduct.php | 53 - ...edProducts.php => RelatedProductsList.php} | 16 +- .../src/Livewire/Pages/Category/Index.php | 13 +- .../src/Livewire/Pages/Customers/Index.php | 2 +- .../src/Livewire/Pages/Customers/Show.php | 6 +- .../src/Livewire/Pages/Product/Create.php | 328 +++++ .../admin/src/Livewire/Pages/Product/Edit.php | 51 + .../src/Livewire/Pages/Product/Index.php | 140 ++ .../src/Livewire/Pages/Settings/General.php | 9 +- .../src/Livewire/SlideOvers/CategoryForm.php | 6 +- .../src/Providers/FeatureServiceProvider.php | 1 + packages/admin/src/ShopperServiceProvider.php | 41 + packages/admin/src/Traits/SaveSettings.php | 21 - .../stubs/feature/FeatureServiceProvider.stub | 20 - packages/admin/tailwind.config.js | 3 +- packages/admin/yarn.lock | 38 +- packages/core/config/core.php | 1 + ...020_00_02_000006_create_products_table.php | 2 +- ...03_28_084412_add_metadata-fields_table.php | 1 + packages/core/src/Helpers/Price.php | 12 +- packages/core/src/Models/Category.php | 8 - packages/core/src/Models/InventoryHistory.php | 2 +- packages/core/src/Models/Product.php | 11 +- .../src/Traits/Attributes/WithAddress.php | 41 - .../Traits/Attributes/WithChoicesBrands.php | 19 - .../Attributes/WithChoicesCategories.php | 23 - .../Attributes/WithProductAssociations.php | 14 - .../Traits/Attributes/WithSeoAttributes.php | 30 - .../core/src/Traits/Attributes/WithStock.php | 93 -- .../Traits/Attributes/WithUploadProcess.php | 26 - packages/core/src/Traits/HasMedia.php | 5 + packages/core/src/helpers.php | 27 +- 111 files changed, 5810 insertions(+), 2701 deletions(-) create mode 100644 packages/admin/resources/css/components/treeselect.css create mode 100644 packages/admin/resources/js/components/select-tree.js create mode 100644 packages/admin/resources/views/components/filament/forms/currency-mask.blade.php create mode 100644 packages/admin/resources/views/components/filament/forms/quantity.blade.php create mode 100644 packages/admin/resources/views/filament/form/select-tree.blade.php create mode 100644 packages/admin/resources/views/filament/form/text-input-select.blade.php create mode 100644 packages/admin/resources/views/filament/wizard-column.blade.php create mode 100644 packages/admin/resources/views/filament/wizard/step-column.blade.php create mode 100755 packages/admin/resources/views/livewire/components/products/forms/edit.blade.php rename packages/admin/resources/views/livewire/{ => components}/products/forms/form-attributes.blade.php (100%) rename packages/admin/resources/views/livewire/{ => components}/products/forms/form-variants.blade.php (100%) create mode 100755 packages/admin/resources/views/livewire/components/products/forms/inventory.blade.php create mode 100755 packages/admin/resources/views/livewire/components/products/forms/media.blade.php create mode 100755 packages/admin/resources/views/livewire/components/products/forms/related.blade.php create mode 100755 packages/admin/resources/views/livewire/components/products/forms/seo.blade.php create mode 100755 packages/admin/resources/views/livewire/components/products/forms/shipping.blade.php rename packages/admin/resources/views/livewire/modals/{related-lists.blade.php => related-products-list.blade.php} (57%) create mode 100755 packages/admin/resources/views/livewire/pages/products/create.blade.php create mode 100755 packages/admin/resources/views/livewire/pages/products/edit.blade.php rename packages/admin/resources/views/livewire/{products/browse.blade.php => pages/products/index.blade.php} (98%) rename packages/admin/resources/views/{ => livewire}/pages/products/variant.blade.php (100%) delete mode 100755 packages/admin/resources/views/livewire/products/create.blade.php delete mode 100755 packages/admin/resources/views/livewire/products/edit.blade.php delete mode 100755 packages/admin/resources/views/livewire/products/forms/form-edit.blade.php delete mode 100755 packages/admin/resources/views/livewire/products/forms/form-inventory.blade.php delete mode 100755 packages/admin/resources/views/livewire/products/forms/form-related.blade.php delete mode 100755 packages/admin/resources/views/livewire/products/forms/form-seo.blade.php delete mode 100755 packages/admin/resources/views/livewire/products/forms/form-shipping.blade.php delete mode 100755 packages/admin/resources/views/pages/products/create.blade.php delete mode 100755 packages/admin/resources/views/pages/products/edit.blade.php delete mode 100755 packages/admin/resources/views/pages/products/index.blade.php create mode 100644 packages/admin/src/Components/Form/Quantity.php create mode 100644 packages/admin/src/Components/Form/SelectTree.php create mode 100644 packages/admin/src/Components/Form/ShippingField.php create mode 100644 packages/admin/src/Components/Form/TextInputSelect.php create mode 100644 packages/admin/src/Components/Wizard/StepColumn.php create mode 100644 packages/admin/src/Components/WizardColumn.php delete mode 100755 packages/admin/src/Livewire/Components/Products/Browse.php delete mode 100755 packages/admin/src/Livewire/Components/Products/Create.php delete mode 100755 packages/admin/src/Livewire/Components/Products/Edit.php create mode 100644 packages/admin/src/Livewire/Components/Products/Form/Media.php delete mode 100755 packages/admin/src/Livewire/Components/Products/WithAttributes.php delete mode 100755 packages/admin/src/Livewire/Modals/DeleteProduct.php rename packages/admin/src/Livewire/Modals/{RelatedProducts.php => RelatedProductsList.php} (75%) create mode 100755 packages/admin/src/Livewire/Pages/Product/Create.php create mode 100755 packages/admin/src/Livewire/Pages/Product/Edit.php create mode 100755 packages/admin/src/Livewire/Pages/Product/Index.php delete mode 100644 packages/admin/src/Traits/SaveSettings.php delete mode 100644 packages/admin/stubs/feature/FeatureServiceProvider.stub delete mode 100755 packages/core/src/Traits/Attributes/WithAddress.php delete mode 100755 packages/core/src/Traits/Attributes/WithChoicesBrands.php delete mode 100755 packages/core/src/Traits/Attributes/WithChoicesCategories.php delete mode 100755 packages/core/src/Traits/Attributes/WithProductAssociations.php delete mode 100755 packages/core/src/Traits/Attributes/WithSeoAttributes.php delete mode 100755 packages/core/src/Traits/Attributes/WithStock.php delete mode 100755 packages/core/src/Traits/Attributes/WithUploadProcess.php diff --git a/packages/admin/composer.json b/packages/admin/composer.json index ed7d1e6b7..14972ac27 100755 --- a/packages/admin/composer.json +++ b/packages/admin/composer.json @@ -18,6 +18,7 @@ }, "require": { "php": "^8.2", + "akaunting/laravel-money": "^5.2", "bacon/bacon-qr-code": "^2.0", "danharrin/livewire-rate-limiting": "^0.3|^1.0", "filament/forms": "^3.2", diff --git a/packages/admin/config/admin.php b/packages/admin/config/admin.php index c1df49811..a2727fcc0 100755 --- a/packages/admin/config/admin.php +++ b/packages/admin/config/admin.php @@ -2,6 +2,8 @@ declare(strict_types=1); +use Filament\Support\Colors\Color; + return [ /* @@ -66,6 +68,19 @@ 'bg_color' => 'dbeafe', ], + /* + |-------------------------------------------------------------------------- + | Filament Primary UI color + |-------------------------------------------------------------------------- + | + | By default on some elements filament does not take into account the "primary" + | color, to correct this after changing your primary color in your tailwind file + | you must also change it here. + | + */ + + 'filament-color' => Color::Blue, + /* |-------------------------------------------------------------------------- | Shopper Resource diff --git a/packages/admin/config/components/product.php b/packages/admin/config/components/product.php index b0d4b09e5..1d869eca4 100644 --- a/packages/admin/config/components/product.php +++ b/packages/admin/config/components/product.php @@ -13,7 +13,11 @@ |-------------------------------------------------------------------------- */ - 'pages' => [], + 'pages' => [ + 'product-index' => Livewire\Pages\Product\Index::class, + 'product-create' => Livewire\Pages\Product\Create::class, + 'product-edit' => Livewire\Pages\Product\Edit::class, + ], /* |-------------------------------------------------------------------------- @@ -27,11 +31,9 @@ 'attributes.edit' => Components\Attributes\Edit::class, 'attributes.values' => Components\Attributes\Values::class, - 'products.browse' => Components\Products\Browse::class, - 'products.create' => Components\Products\Create::class, - 'products.edit' => Components\Products\Edit::class, 'products.form.attributes' => Components\Products\Form\Attributes::class, - 'products.form.edit' => Components\Products\Form\Edit::class, + 'products.form.edit' => Components\Products\Form\Edit::class, // Done + 'products.form.media' => Components\Products\Form\Media::class, // Done 'products.form.inventory' => Components\Products\Form\Inventory::class, 'products.form.related-products' => Components\Products\Form\RelatedProducts::class, 'products.form.seo' => Components\Products\Form\Seo::class, @@ -42,9 +44,8 @@ 'modals.add-variant' => Livewire\Modals\AddVariant::class, 'modals.create-value' => Livewire\Modals\CreateValue::class, - 'modals.delete-product' => Livewire\Modals\DeleteProduct::class, 'modals.products-lists' => Livewire\Modals\ProductsLists::class, - 'modals.related-products' => Livewire\Modals\RelatedProducts::class, + 'modals.related-products-list' => Livewire\Modals\RelatedProductsList::class, 'modals.update-value' => Livewire\Modals\UpdateValue::class, 'modals.update-variant-stock' => Livewire\Modals\UpdateVariantStock::class, ], diff --git a/packages/admin/package.json b/packages/admin/package.json index 567822c90..c07cb11a7 100755 --- a/packages/admin/package.json +++ b/packages/admin/package.json @@ -32,5 +32,8 @@ "resolve-url-loader": "^2.3.1", "sortablejs": "^1.15.0", "tailwindcss": "^3.4.1" + }, + "dependencies": { + "treeselectjs": "^0.10.0" } } diff --git a/packages/admin/public/shopper.css b/packages/admin/public/shopper.css index 8e81dacf0..77a5cbdf9 100755 --- a/packages/admin/public/shopper.css +++ b/packages/admin/public/shopper.css @@ -3606,6 +3606,10 @@ html { right: 0.625rem; } +.right-4 { + right: 1rem; +} + .right-6 { right: 1.5rem; } @@ -3642,10 +3646,6 @@ html { top: 1.5rem; } -.top-7 { - top: 1.75rem; -} - .isolate { isolation: isolate; } @@ -3763,11 +3763,6 @@ html { margin-right: -0.25rem; } -.-mx-1\.5 { - margin-left: -0.375rem; - margin-right: -0.375rem; -} - .-mx-2 { margin-left: -0.5rem; margin-right: -0.5rem; @@ -3788,11 +3783,6 @@ html { margin-bottom: -0.25rem; } -.-my-1\.5 { - margin-top: -0.375rem; - margin-bottom: -0.375rem; -} - .-my-2 { margin-top: -0.5rem; margin-bottom: -0.5rem; @@ -3994,10 +3984,6 @@ html { margin-right: 1rem; } -.mr-5 { - margin-right: 1.25rem; -} - .ms-1 { margin-inline-start: 0.25rem; } @@ -4193,6 +4179,10 @@ html { height: 1.75rem; } +.h-70 { + height: 17.5rem; +} + .h-8 { height: 2rem; } @@ -4238,7 +4228,7 @@ html { } .min-h-\(screen-content\) { - min-height: calc(100vh - 9.625rem); + min-height: calc(100vh - 7.185rem); } .min-h-\[theme\(spacing\.48\)\] { @@ -4261,6 +4251,10 @@ html { width: 0px; } +.w-0\.5 { + width: 0.125rem; +} + .w-1 { width: 0.25rem; } @@ -4390,10 +4384,6 @@ html { width: 100vw; } -.w-0\.5 { - width: 0.125rem; -} - .min-w-0 { min-width: 0px; } @@ -4561,10 +4551,6 @@ html { flex: 1 1 0%; } -.flex-auto { - flex: 1 1 auto; -} - .flex-none { flex: none; } @@ -5202,15 +5188,14 @@ html { border-color: rgba(var(--gray-200), var(--tw-divide-opacity)); } -.divide-primary-500 > :not([hidden]) ~ :not([hidden]) { - --tw-divide-opacity: 1; - border-color: rgb(59 130 246 / var(--tw-divide-opacity)); -} - .self-start { align-self: flex-start; } +.self-center { + align-self: center; +} + .self-stretch { align-self: stretch; } @@ -5239,10 +5224,6 @@ html { overflow: visible; } -.overflow-scroll { - overflow: scroll; -} - .overflow-x-auto { overflow-x: auto; } @@ -5301,10 +5282,6 @@ html { border-radius: 0px; } -.rounded-sm { - border-radius: 0.125rem; -} - .rounded-xl { border-radius: 0.75rem; } @@ -5377,6 +5354,14 @@ html { border-bottom-right-radius: 1rem; } +.rounded-ee-lg { + border-end-end-radius: 0.5rem; +} + +.rounded-se-lg { + border-start-end-radius: 0.5rem; +} + .rounded-tl-2xl { border-top-left-radius: 1rem; } @@ -5554,21 +5539,11 @@ html { border-color: rgb(250 204 21 / var(--tw-border-opacity)); } -.border-y-gray-300 { - --tw-border-opacity: 1; - border-top-color: rgba(var(--gray-300), var(--tw-border-opacity)); - border-bottom-color: rgba(var(--gray-300), var(--tw-border-opacity)); -} - .border-t-gray-200 { --tw-border-opacity: 1; border-top-color: rgba(var(--gray-200), var(--tw-border-opacity)); } -.border-opacity-75 { - --tw-border-opacity: 0.75; -} - .\!bg-gray-50 { --tw-bg-opacity: 1 !important; background-color: rgba(var(--gray-50), var(--tw-bg-opacity)) !important; @@ -5654,11 +5629,6 @@ html { background-color: rgba(var(--gray-500), var(--tw-bg-opacity)); } -.bg-gray-600 { - --tw-bg-opacity: 1; - background-color: rgba(var(--gray-600), var(--tw-bg-opacity)); -} - .bg-gray-700 { --tw-bg-opacity: 1; background-color: rgba(var(--gray-700), var(--tw-bg-opacity)); @@ -5683,11 +5653,6 @@ html { background-color: rgb(220 252 231 / var(--tw-bg-opacity)); } -.bg-green-300 { - --tw-bg-opacity: 1; - background-color: rgb(134 239 172 / var(--tw-bg-opacity)); -} - .bg-green-400 { --tw-bg-opacity: 1; background-color: rgb(74 222 128 / var(--tw-bg-opacity)); @@ -5698,6 +5663,11 @@ html { background-color: rgb(240 253 244 / var(--tw-bg-opacity)); } +.bg-green-500 { + --tw-bg-opacity: 1; + background-color: rgb(34 197 94 / var(--tw-bg-opacity)); +} + .bg-green-600 { --tw-bg-opacity: 1; background-color: rgb(22 163 74 / var(--tw-bg-opacity)); @@ -5748,14 +5718,24 @@ html { background-color: rgb(254 226 226 / var(--tw-bg-opacity)); } -.bg-red-300 { +.bg-red-50 { --tw-bg-opacity: 1; - background-color: rgb(252 165 165 / var(--tw-bg-opacity)); + background-color: rgb(254 242 242 / var(--tw-bg-opacity)); } -.bg-red-50 { +.bg-red-500 { --tw-bg-opacity: 1; - background-color: rgb(254 242 242 / var(--tw-bg-opacity)); + background-color: rgb(239 68 68 / var(--tw-bg-opacity)); +} + +.bg-rose-500 { + --tw-bg-opacity: 1; + background-color: rgb(244 63 94 / var(--tw-bg-opacity)); +} + +.bg-success-500 { + --tw-bg-opacity: 1; + background-color: rgb(16 185 129 / var(--tw-bg-opacity)); } .bg-transparent { @@ -5792,14 +5772,14 @@ html { background-color: rgb(254 249 195 / var(--tw-bg-opacity)); } -.bg-yellow-300 { +.bg-yellow-50 { --tw-bg-opacity: 1; - background-color: rgb(253 224 71 / var(--tw-bg-opacity)); + background-color: rgb(254 252 232 / var(--tw-bg-opacity)); } -.bg-yellow-50 { +.bg-yellow-500 { --tw-bg-opacity: 1; - background-color: rgb(254 252 232 / var(--tw-bg-opacity)); + background-color: rgb(234 179 8 / var(--tw-bg-opacity)); } .bg-opacity-10 { @@ -5830,12 +5810,6 @@ html { background-image: linear-gradient(to right, var(--tw-gradient-stops)); } -.from-gray-50 { - --tw-gradient-from: rgba(var(--gray-50), 1) var(--tw-gradient-from-position); - --tw-gradient-to: rgba(var(--gray-50), 0) var(--tw-gradient-to-position); - --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); -} - .from-gray-50\/70 { --tw-gradient-from: rgba(var(--gray-50), 0.7) var(--tw-gradient-from-position); --tw-gradient-to: rgba(var(--gray-50), 0) var(--tw-gradient-to-position); @@ -5866,10 +5840,6 @@ html { --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); } -.to-gray-100 { - --tw-gradient-to: rgba(var(--gray-100), 1) var(--tw-gradient-to-position); -} - .to-primary-100 { --tw-gradient-to: #dbeafe var(--tw-gradient-to-position); } @@ -5894,18 +5864,14 @@ html { fill: #f87171; } -.fill-gray-50 { - fill: rgba(var(--gray-50), 1); -} - -.fill-gray-400 { - fill: rgba(var(--gray-400), 1); -} - .fill-gray-300 { fill: rgba(var(--gray-300), 1); } +.fill-gray-50 { + fill: rgba(var(--gray-50), 1); +} + .stroke-gray-200 { stroke: rgba(var(--gray-200), 1); } @@ -6198,10 +6164,6 @@ html { padding-right: 1.5rem; } -.pr-7 { - padding-right: 1.75rem; -} - .pr-9 { padding-right: 2.25rem; } @@ -6270,6 +6232,10 @@ html { padding-top: 1.5rem; } +.pt-8 { + padding-top: 2rem; +} + .text-left { text-align: left; } @@ -6682,24 +6648,24 @@ html { -moz-osx-font-smoothing: grayscale; } -.placeholder-gray-500::-moz-placeholder { +.placeholder-gray-400::-moz-placeholder { --tw-placeholder-opacity: 1; - color: rgba(var(--gray-500), var(--tw-placeholder-opacity)); + color: rgba(var(--gray-400), var(--tw-placeholder-opacity)); } -.placeholder-gray-500::placeholder { +.placeholder-gray-400::placeholder { --tw-placeholder-opacity: 1; - color: rgba(var(--gray-500), var(--tw-placeholder-opacity)); + color: rgba(var(--gray-400), var(--tw-placeholder-opacity)); } -.placeholder-gray-400::-moz-placeholder { +.placeholder-gray-500::-moz-placeholder { --tw-placeholder-opacity: 1; - color: rgba(var(--gray-400), var(--tw-placeholder-opacity)); + color: rgba(var(--gray-500), var(--tw-placeholder-opacity)); } -.placeholder-gray-400::placeholder { +.placeholder-gray-500::placeholder { --tw-placeholder-opacity: 1; - color: rgba(var(--gray-400), var(--tw-placeholder-opacity)); + color: rgba(var(--gray-500), var(--tw-placeholder-opacity)); } .opacity-0 { @@ -6826,11 +6792,6 @@ html { --tw-ring-color: rgb(220 38 38 / var(--tw-ring-opacity)); } -.ring-gray-100 { - --tw-ring-opacity: 1; - --tw-ring-color: rgba(var(--gray-100), var(--tw-ring-opacity)); -} - .ring-gray-200 { --tw-ring-opacity: 1; --tw-ring-color: rgba(var(--gray-200), var(--tw-ring-opacity)); @@ -7006,47 +6967,47 @@ input[type='number'] { margin: 0; } -::-webkit-scrollbar-track { +*::-webkit-scrollbar-track { background-color: transparent; } -.hide-scroll::-webkit-scrollbar { - display: none; +*::-webkit-scrollbar { + width: 4px; + height: 4px; } -[x-cloak] { - display: none !important; +*::-webkit-scrollbar-thumb { + background-color: rgba(var(--gray-200), 1); + border-radius: 8px; } -.primary-menu .active { - background-color: #1e3a8a; +*::-webkit-scrollbar-thumb:hover { + background-color: rgba(var(--gray-300), 1); } -.primary-menu .active:hover, -.primary-menu .active:focus { - background-color: #1e3a8a; +.dark *::-webkit-scrollbar-thumb { + background-color: rgba(var(--gray-700), 1); } -.scrolling::-webkit-scrollbar { - width: 4px; - height: 4px; +.dark *::-webkit-scrollbar-thumb:hover { + background-color: rgba(var(--gray-900), 1); } -.scrolling::-webkit-scrollbar-thumb { - background-color: rgba(var(--gray-200), 1); - border-radius: 8px; +.hide-scroll::-webkit-scrollbar { + display: none; } -.scrolling::-webkit-scrollbar-thumb:hover { - background-color: rgba(var(--gray-300), 1); +[x-cloak] { + display: none !important; } -.dark .scrolling::-webkit-scrollbar-thumb { - background-color: rgba(var(--gray-700), 1); +.primary-menu .active { + background-color: #1e3a8a; } -.dark .scrolling::-webkit-scrollbar-thumb:hover { - background-color: rgba(var(--gray-900), 1); +.primary-menu .active:hover, +.primary-menu .active:focus { + background-color: #1e3a8a; } .ui-modal > div > div.fixed { @@ -7059,12 +7020,101 @@ input[type='number'] { transition-duration: 150ms; } +.shopper-product-wizard > div { + height: 100%; + flex: 1 1 0%; +} + .sidebar > :not([hidden]) ~ :not([hidden]) { --tw-space-y-reverse: 0; margin-top: calc(1.25rem * calc(1 - var(--tw-space-y-reverse))); margin-bottom: calc(1.25rem * var(--tw-space-y-reverse)); } +.sh-heading { + margin-bottom: 0.5rem; + margin-left: 0.75rem; + font-size: 0.75rem; + font-weight: 500; + text-transform: uppercase; + line-height: 1.25rem; + letter-spacing: 0.05em; + --tw-text-opacity: 1; + color: rgba(var(--gray-500), var(--tw-text-opacity)); +} + +:is(.dark .sh-heading) { + --tw-text-opacity: 1; + color: rgba(var(--gray-400), var(--tw-text-opacity)); +} + +.sh-sidebar-item { + display: flex; + align-items: center; + border-radius: 0.5rem; + padding-top: 0.5rem; + padding-bottom: 0.5rem; + padding-left: 0.75rem; + padding-right: 0.75rem; + font-size: 0.875rem; + line-height: 1.25rem; + font-weight: 500; + transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter; + transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter; + transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter; + transition-duration: 150ms; + transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); +} + +.sh-sidebar-item-active { + --tw-bg-opacity: 1; + background-color: rgb(255 255 255 / var(--tw-bg-opacity)); + --tw-text-opacity: 1; + color: rgb(37 99 235 / var(--tw-text-opacity)); + --tw-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); + --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color); + box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); + --tw-ring-inset: inset; + --tw-ring-opacity: 1; + --tw-ring-color: rgba(var(--gray-200), var(--tw-ring-opacity)); +} + +:is(.dark .sh-sidebar-item-active) { + --tw-bg-opacity: 1; + background-color: rgba(var(--gray-800), var(--tw-bg-opacity)); + --tw-text-opacity: 1; + color: rgb(59 130 246 / var(--tw-text-opacity)); + --tw-ring-opacity: 1; + --tw-ring-color: rgba(var(--gray-700), var(--tw-ring-opacity)); +} + +.sh-sidebar-item-inactive { + --tw-text-opacity: 1; + color: rgba(var(--gray-600), var(--tw-text-opacity)); +} + +.sh-sidebar-item-inactive:hover { + --tw-bg-opacity: 1; + background-color: rgba(var(--gray-100), var(--tw-bg-opacity)); + --tw-text-opacity: 1; + color: rgba(var(--gray-900), var(--tw-text-opacity)); +} + +:is(.dark .sh-sidebar-item-inactive) { + --tw-text-opacity: 1; + color: rgba(var(--gray-300), var(--tw-text-opacity)); +} + +:is(.dark .sh-sidebar-item-inactive:hover) { + --tw-bg-opacity: 1; + background-color: rgba(var(--gray-900), var(--tw-bg-opacity)); + --tw-text-opacity: 1; + color: rgb(255 255 255 / var(--tw-text-opacity)); +} + .item-name { flex: 1 1 0%; overflow: hidden; @@ -8670,56 +8720,775 @@ input[type='number'] { background-color: transparent; } -:is(.dark .dark\:prose-invert) { - --tw-prose-body: var(--tw-prose-invert-body); - --tw-prose-headings: var(--tw-prose-invert-headings); - --tw-prose-lead: var(--tw-prose-invert-lead); - --tw-prose-links: var(--tw-prose-invert-links); - --tw-prose-bold: var(--tw-prose-invert-bold); - --tw-prose-counters: var(--tw-prose-invert-counters); - --tw-prose-bullets: var(--tw-prose-invert-bullets); - --tw-prose-hr: var(--tw-prose-invert-hr); - --tw-prose-quotes: var(--tw-prose-invert-quotes); - --tw-prose-quote-borders: var(--tw-prose-invert-quote-borders); - --tw-prose-captions: var(--tw-prose-invert-captions); - --tw-prose-kbd: var(--tw-prose-invert-kbd); - --tw-prose-kbd-shadows: var(--tw-prose-invert-kbd-shadows); - --tw-prose-code: var(--tw-prose-invert-code); - --tw-prose-pre-code: var(--tw-prose-invert-pre-code); - --tw-prose-pre-bg: var(--tw-prose-invert-pre-bg); - --tw-prose-th-borders: var(--tw-prose-invert-th-borders); - --tw-prose-td-borders: var(--tw-prose-invert-td-borders); +.treeselect-input{ + width:100%; + box-sizing:border-box; + border:1px solid #d7dde4; + border-radius:4px; + display:flex; + align-items:center; + flex-wrap:wrap; + padding:2px 40px 2px 4px; + position:relative; + min-height:37px; + background-color:#fff; + cursor:text } -.placeholder\:text-gray-400::-moz-placeholder { - --tw-text-opacity: 1; - color: rgba(var(--gray-400), var(--tw-text-opacity)); +.treeselect-input--unsearchable{ + cursor:default } -.placeholder\:text-gray-400::placeholder { - --tw-text-opacity: 1; - color: rgba(var(--gray-400), var(--tw-text-opacity)); +.treeselect-input--unsearchable .treeselect-input__edit{ + caret-color:transparent; + cursor:default } -.before\:absolute::before { - content: var(--tw-content); - position: absolute; +.treeselect-input--unsearchable .treeselect-input__edit:focus{ + position:absolute; + z-index:-1; + left:0; + min-width:0; + width:0 } -.before\:inset-y-0::before { - content: var(--tw-content); - top: 0px; - bottom: 0px; +.treeselect-input--value-not-selected .treeselect-input__edit,.treeselect-input--value-not-selected.treeselect-input--unsearchable .treeselect-input__edit:focus{ + z-index:auto; + position:static; + width:100%; + max-width:100% } -.before\:start-0::before { - content: var(--tw-content); - inset-inline-start: 0px; +.treeselect-input--value-not-selected .treeselect-input__tags{ + gap:0 } -.before\:h-full::before { - content: var(--tw-content); - height: 100%; +[dir=rtl] .treeselect-input{ + padding-right:4px; + padding-left:40px +} + +[dir=rtl] .treeselect-input__operators{ + right:unset; + left:2px +} + +.treeselect-input__tags{ + display:inline-flex; + align-items:center; + flex-wrap:wrap; + gap:4px; + max-width:100%; + width:100%; + box-sizing:border-box +} + +.treeselect-input__tags-element{ + display:inline-flex; + align-items:center; + background-color:#d7dde4; + cursor:pointer; + padding:2px 5px; + border-radius:2px; + font-size:14px; + max-width:100%; + box-sizing:border-box +} + +.treeselect-input__tags-element:hover{ + background-color:#c5c7cb +} + +.treeselect-input__tags-element:hover .treeselect-input__tags-cross svg{ + stroke:#eb4c42 +} + +.treeselect-input__tags-name{ + overflow:hidden; + white-space:nowrap; + text-overflow:ellipsis +} + +.treeselect-input__tags-cross{ + display:flex; + margin-left:2px +} + +.treeselect-input__tags-cross svg{ + width:12px; + height:12px +} + +.treeselect-input__tags-count{ + font-size:14px; + overflow:hidden; + white-space:nowrap; + text-overflow:ellipsis +} + +.treeselect-input__edit{ + flex:1; + border:none; + font-size:14px; + text-overflow:ellipsis; + width:100%; + max-width:calc(100% - 45px); + padding:0; + position:absolute; + z-index:-1; + min-width:0 +} + +.treeselect-input__edit:focus{ + outline:none; + min-width:30px; + max-width:100%; + z-index:auto; + position:static +} + +.treeselect-input__operators{ + display:flex; + max-width:40px; + position:absolute; + right:2px +} + +.treeselect-input__clear{ + display:flex; + cursor:pointer +} + +.treeselect-input__clear svg{ + stroke:#c5c7cb; + width:17px; + min-width:17px; + height:20px +} + +.treeselect-input__clear:hover svg{ + stroke:#838790 +} + +.treeselect-input__arrow{ + display:flex; + cursor:pointer +} + +.treeselect-input__arrow svg{ + stroke:#c5c7cb; + width:20px; + min-width:20px; + height:20px +} + +.treeselect-input__arrow:hover svg{ + stroke:#838790 +} + +.treeselect-list{ + width:100%; + box-sizing:border-box; + border:1px solid #d7dde4; + overflow-y:auto; + background-color:#fff; + max-height:300px +} + +.treeselect-list__group-container{ + box-sizing:border-box +} + +.treeselect-list__item{ + display:flex; + align-items:center; + box-sizing:border-box; + cursor:pointer; + height:30px +} + +.treeselect-list__item:focus{ + outline:none +} + +.treeselect-list__item--focused{ + background-color:azure!important +} + +.treeselect-list__item--hidden{ + display:none +} + +.treeselect-list__item-icon{ + display:flex; + align-items:center; + cursor:pointer; + height:20px; + width:20px; + min-width:20px +} + +.treeselect-list__item-icon svg{ + pointer-events:none; + width:100%; + height:100%; + stroke:#c5c7cb +} + +.treeselect-list__item-icon *{ + pointer-events:none +} + +.treeselect-list__item-icon:hover svg{ + stroke:#838790 +} + +.treeselect-list__item-checkbox-container{ + width:20px; + height:20px; + min-width:20px; + border:1px solid #d7dde4; + border-radius:3px; + position:relative; + background-color:#fff; + pointer-events:none; + box-sizing:border-box +} + +.treeselect-list__item-checkbox-container svg{ + position:absolute; + height:100%; + width:100% +} + +.treeselect-list__item-checkbox{ + margin:0; + width:0; + height:0; + pointer-events:none; + position:absolute; + z-index:-1 +} + +.treeselect-list__item-checkbox-icon{ + position:absolute; + height:100%; + width:100%; + left:0; + top:0; + text-align:left +} + +.treeselect-list__item-label{ + width:100%; + overflow:hidden; + text-overflow:ellipsis; + word-break:keep-all; + white-space:nowrap; + font-size:14px; + padding-left:5px; + pointer-events:none; + text-align:left +} + +.treeselect-list__item-label-counter{ + margin-left:3px; + color:#838790; + font-size:13px +} + +.treeselect-list__empty{ + display:flex; + align-items:center; + height:30px; + padding-left:4px +} + +.treeselect-list__empty--hidden{ + display:none +} + +.treeselect-list__empty-icon{ + display:flex; + align-items:center +} + +.treeselect-list__empty-text{ + font-size:14px; + padding-left:5px; + overflow:hidden; + text-overflow:ellipsis; + word-break:keep-all; + white-space:nowrap +} + +.treeselect-list__slot{ + position:sticky; + box-sizing:border-box; + width:100%; + max-width:100%; + bottom:0; + background-color:#fff +} + +.treeselect-list.treeselect-list--single-select .treeselect-list__item-checkbox-container,.treeselect-list.treeselect-list--disabled-branch-node .treeselect-list__item--group .treeselect-list__item-checkbox-container{ + display:none +} + +.treeselect-list__item--checked{ + background-color:#e9f1f1 +} + +.treeselect-list.treeselect-list--single-select .treeselect-list__item--checked{ + background-color:transparent +} + +.treeselect-list.treeselect-list--single-select .treeselect-list__item--single-selected{ + background-color:#e9f1f1 +} + +.treeselect-list__item .treeselect-list__item-checkbox-container svg{ + stroke:transparent +} + +.treeselect-list__item--checked .treeselect-list__item-checkbox-container svg,.treeselect-list__item--partial-checked .treeselect-list__item-checkbox-container svg{ + stroke:#fff +} + +.treeselect-list__item--checked .treeselect-list__item-checkbox-container,.treeselect-list__item--partial-checked .treeselect-list__item-checkbox-container{ + background-color:#52c67e +} + +.treeselect-list__item--disabled .treeselect-list__item-checkbox-container{ + background-color:#e9f1f1 +} + +.treeselect-list__item--disabled .treeselect-list__item-label{ + color:#c5c7cb +} + +[dir=rtl] .treeselect-list__item-checkbox-icon{ + text-align:right +} + +[dir=rtl] .treeselect-list__item-label{ + text-align:right; + padding-right:5px; + padding-left:unset +} + +[dir=rtl] .treeselect-list__item--closed .treeselect-list__item-icon{ + transform:rotate(180deg) +} + +[dir=rtl] .treeselect-list__empty{ + padding-right:4px; + padding-left:unset +} + +[dir=rtl] .treeselect-list__empty-text{ + padding-right:5px; + padding-left:unset +} + +.treeselect{ + width:100%; + position:relative; + box-sizing:border-box +} + +.treeselect--disabled{ + pointer-events:none +} + +.treeselect-list{ + position:absolute; + left:0; + border-radius:4px; + box-sizing:border-box; + z-index:1000 +} + +.treeselect .treeselect-list{ + position:absolute +} + +.treeselect .treeselect-list--static{ + position:static +} + +.treeselect-input--focused{ + border-color:#101010 +} + +.treeselect-input--opened.treeselect-input--top{ + border-top-color:transparent; + border-top-left-radius:0; + border-top-right-radius:0 +} + +.treeselect-input--opened.treeselect-input--bottom{ + border-bottom-color:transparent; + border-bottom-left-radius:0; + border-bottom-right-radius:0 +} + +.treeselect-list--focused{ + border-color:#101010 +} + +.treeselect-list--top,.treeselect-list--top-to-body{ + border-bottom-color:#d7dde4; + border-bottom-left-radius:0; + border-bottom-right-radius:0 +} + +.treeselect-list--bottom,.treeselect-list--bottom-to-body{ + border-top-color:#d7dde4; + border-top-left-radius:0; + border-top-right-radius:0 +} + +.treeselect-list--top{ + left:0; + bottom:100% +} + +.treeselect-list--bottom{ + left:0; + top:100% +} + +.treeselect-input { + border-width: 0px; + background-color: transparent; + padding-left: 0.625rem; + font-size: 1rem; + line-height: 1.5rem; + --tw-text-opacity: 1; + color: rgba(var(--gray-900), var(--tw-text-opacity)); + transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter; + transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter; + transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter; + transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); + transition-duration: 75ms; +} + +@media (min-width: 640px) { + .treeselect-input { + font-size: 0.875rem; + line-height: 1.5rem; + } +} + +.treeselect-input { + /*font-size: 0.875rem; + color: rgba(var(--gray-950), var(--tw-text-opacity)); + transition-duration: 75ms; + border-style: none; + line-height: 1.5rem;*/ + outline: 2px solid transparent; + outline-offset: 2px; + padding-left: 8px; +} + +.dark .treeselect > .treeselect-input { + color: rgb(255 255 255 / var(--tw-text-opacity)) !important; +} + +.treeselect-input--opened.treeselect-input--bottom { + border: inherit; + border-radius: inherit; +} + +.treeselect-input__edit { + background-color: transparent; +} + +.treeselect-input__edit::-moz-placeholder { + --tw-placeholder-opacity: 1; + color: rgba(var(--gray-400), var(--tw-placeholder-opacity)); +} + +.treeselect-input__edit::placeholder { + --tw-placeholder-opacity: 1; + color: rgba(var(--gray-400), var(--tw-placeholder-opacity)); +} + +:is(.dark .treeselect-input__edit)::-moz-placeholder { + --tw-placeholder-opacity: 1; + color: rgba(var(--gray-500), var(--tw-placeholder-opacity)); +} + +:is(.dark .treeselect-input__edit)::placeholder { + --tw-placeholder-opacity: 1; + color: rgba(var(--gray-500), var(--tw-placeholder-opacity)); +} + +.treeselect-input__tags-count { + margin-left: 9px; +} + +.treeselect-list { + font-size: 0.875rem; + line-height: 1.25rem; + margin-top: 0.5rem; + border-radius: 0.5rem; + padding: 0.25rem; + --tw-bg-opacity: 1; + --tw-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), + 0 4px 6px -4px rgba(0, 0, 0, 0.1); + --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), + 0 4px 6px -4px var(--tw-shadow-color); + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 + var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 + calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color); + --tw-ring-color: rgba(var(--gray-950), 0.05); + background-color: rgb(255 255 255 / var(--tw-bg-opacity)); + box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), + var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), + var(--tw-shadow, 0 0 #0000); + border: none; +} + +.treeselect-list__item { + padding: 1.1rem; + border-radius: 0.475rem; +} + +.treeselect-list.treeselect-list--single-select .treeselect-list__item--single-selected { + --tw-bg-opacity: 1; + background-color: rgba(var(--gray-50), var(--tw-bg-opacity)) !important; +} + +.treeselect-list__item:hover, +.treeselect-list__item--focused { + --tw-bg-opacity: 1; + background-color: rgba(var(--gray-50), var(--tw-bg-opacity)) !important; +} + +.treeselect-list.treeselect-list--single-select .treeselect-list__item--single-selected { + font-weight: 500; +} + +.dark .treeselect-list { + --tw-bg-opacity: 1; + --tw-ring-color: hsla(0, 0%, 100%, 0.1); + background-color: rgba(var(--gray-900), var(--tw-bg-opacity)); +} + +.treeselect-input__edit { + border: transparent !important; + --tw-ring-color: none !important; + --tw-ring-shadow: none !important; +} + +.dark .treeselect-list.treeselect-list--single-select .treeselect-list__item--single-selected, +.dark .treeselect-list__item--focused, +.dark .treeselect-list__item:hover, +.dark .treeselect-list.treeselect-list--single-select .treeselect-list__item--single-selected, +.dark .treeselect-list__item--focused, +.dark .treeselect-list__item:hover { + background-color: hsla(0, 0%, 100%, 0.05) !important; +} + +dark .treeselect-list__item--checked, +.treeselect-list__item--checked { + background: transparent; +} + +.treeselect-input__tags-element { + --tw-bg-opacity: 1; + --tw-text-opacity: 1; + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 + var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 + calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color); + --tw-ring-inset: inset; + --tw-ring-color: rgba(var(--primary-600), 0.1); + align-items: center; + background-color: rgba(var(--primary-50), var(--tw-bg-opacity)); + border-radius: 0.375rem; + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), + var(--tw-shadow, 0 0 #0000); + color: rgba(var(--primary-600), var(--tw-text-opacity)); + display: inline-flex; + font-size: 0.75rem; + font-weight: 500; + gap: 0.25rem; + line-height: 1rem; + padding: 0.25rem 0.5rem; + word-break: break-all; +} + +.dark .treeselect-input__tags-element { + --tw-text-opacity: 1; + --tw-ring-color: rgba(var(--primary-400), 0.3); + background-color: rgba(var(--primary-400), 0.1); + color: rgba(var(--primary-400), var(--tw-text-opacity)); +} + +.treeselect-list__item-checkbox-container { + border-radius: 0.25rem; + height: 16px; + min-width: 16px; + width: 16px; +} + +.treeselect-list__item--checked .treeselect-list__item-checkbox-container, +.treeselect-list__item--partial-checked .treeselect-list__item-checkbox-container { + background-color: #2563eb; +} + +.treeselect-list__item-checkbox { + transition-duration: 75ms; + background-color: transparent !important; + border: none; +} + +.treeselect-list__item-checkbox-container { + background-color: #f8f5f5; + border: none; +} + +.dark .treeselect-list__item-checkbox-container { + border: rgb(255 255 255 / var(--tw-text-opacity)); + background-color: hsla(0, 0%, 100%, 0.05); +} + +.treeselect-list__item-checkbox-icon { + height: 80%; + left: 0.1rem; + top: 0.1rem; + width: 80%; +} + +.treeselect-input__tags-element:hover { + background-color: rgba(var(--primary-50), var(--tw-bg-opacity)); +} + +.treeselect-input__tags-element:hover .treeselect-input__tags-cross svg { + stroke: rgba(var(--gray-950), var(--tw-text-opacity)); +} + +.dark +.treeselect-input__tags-element:hover +.treeselect-input__tags-cross +svg { + stroke: rgb(255 255 255 / var(--tw-text-opacity)); +} + +.treeselect-input__tags-element { + color: rgba(var(--primary-600), var(--tw-text-opacity)); +} + +.dark .treeselect-input__tags-element { + color: rgba(var(--primary-400), var(--tw-text-opacity)); +} + +.dark .treeselect-input__tags-cross svg { + stroke-width: 3px; + stroke: rgb(255 255 255 / var(--tw-text-opacity)); + opacity: 0.5; +} + +.dark .treeselect-input__tags-element:hover svg { + opacity: 0.6; +} + +.treeselect-input__clear svg { + opacity: 0.8; +} + +.treeselect-input__tags { + margin-left: 3px; +} + +.treeselect--disabled .treeselect-input__tags-cross { + display: none; +} + +.treeselect--disabled .treeselect-input__arrow { + display: none; +} + +.treeselect-input__arrow { + margin-right: 7px; +} + +.treeselect--disabled .treeselect-input__clear { + display: none; +} + +.treeselect-list__item--disabled { + cursor: not-allowed !important; +} + +.dark .treeselect-list__item--disabled .treeselect-list__item-checkbox-container { + background-color: hsl(0deg 0% 30.77% / 5%); +} + +[dir='rtl'] .treeselect-input__operators { + left: 2px !important; + right: unset; +} + +[dir='rtl'] .treeselect-input { + padding: 2px 4px 2px 40px; +} + +:is(.dark .dark\:prose-invert) { + --tw-prose-body: var(--tw-prose-invert-body); + --tw-prose-headings: var(--tw-prose-invert-headings); + --tw-prose-lead: var(--tw-prose-invert-lead); + --tw-prose-links: var(--tw-prose-invert-links); + --tw-prose-bold: var(--tw-prose-invert-bold); + --tw-prose-counters: var(--tw-prose-invert-counters); + --tw-prose-bullets: var(--tw-prose-invert-bullets); + --tw-prose-hr: var(--tw-prose-invert-hr); + --tw-prose-quotes: var(--tw-prose-invert-quotes); + --tw-prose-quote-borders: var(--tw-prose-invert-quote-borders); + --tw-prose-captions: var(--tw-prose-invert-captions); + --tw-prose-kbd: var(--tw-prose-invert-kbd); + --tw-prose-kbd-shadows: var(--tw-prose-invert-kbd-shadows); + --tw-prose-code: var(--tw-prose-invert-code); + --tw-prose-pre-code: var(--tw-prose-invert-pre-code); + --tw-prose-pre-bg: var(--tw-prose-invert-pre-bg); + --tw-prose-th-borders: var(--tw-prose-invert-th-borders); + --tw-prose-td-borders: var(--tw-prose-invert-td-borders); +} + +.placeholder\:text-gray-400::-moz-placeholder { + --tw-text-opacity: 1; + color: rgba(var(--gray-400), var(--tw-text-opacity)); +} + +.placeholder\:text-gray-400::placeholder { + --tw-text-opacity: 1; + color: rgba(var(--gray-400), var(--tw-text-opacity)); +} + +.before\:absolute::before { + content: var(--tw-content); + position: absolute; +} + +.before\:inset-y-0::before { + content: var(--tw-content); + top: 0px; + bottom: 0px; +} + +.before\:start-0::before { + content: var(--tw-content); + inset-inline-start: 0px; +} + +.before\:h-full::before { + content: var(--tw-content); + height: 100%; } .before\:w-0::before { @@ -8931,10 +9700,6 @@ input[type='number'] { color: rgb(202 138 4 / var(--tw-text-opacity)); } -.hover\:underline:hover { - text-decoration-line: underline; -} - .hover\:opacity-100:hover { opacity: 1; } @@ -9100,10 +9865,6 @@ input[type='number'] { --tw-ring-offset-width: 2px; } -.focus\:ring-offset-primary-50:focus { - --tw-ring-offset-color: #eff6ff; -} - .checked\:focus\:ring-danger-500\/50:focus:checked { --tw-ring-color: rgb(239 68 68 / 0.5); } @@ -9471,6 +10232,10 @@ input[type='number'] { background-color: rgba(var(--gray-900), 0.5); } +:is(.dark .dark\:bg-gray-900\/80) { + background-color: rgba(var(--gray-900), 0.8); +} + :is(.dark .dark\:bg-gray-950) { --tw-bg-opacity: 1; background-color: rgba(var(--gray-950), var(--tw-bg-opacity)); @@ -9513,12 +10278,6 @@ input[type='number'] { --tw-bg-opacity: 0.7; } -:is(.dark .dark\:from-gray-600) { - --tw-gradient-from: rgba(var(--gray-600), 1) var(--tw-gradient-from-position); - --tw-gradient-to: rgba(var(--gray-600), 0) var(--tw-gradient-to-position); - --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); -} - :is(.dark .dark\:from-gray-800\/60) { --tw-gradient-from: rgba(var(--gray-800), 0.6) var(--tw-gradient-from-position); --tw-gradient-to: rgba(var(--gray-800), 0) var(--tw-gradient-to-position); @@ -9537,10 +10296,6 @@ input[type='number'] { --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); } -:is(.dark .dark\:to-gray-700) { - --tw-gradient-to: rgba(var(--gray-700), 1) var(--tw-gradient-to-position); -} - :is(.dark .dark\:to-primary-500) { --tw-gradient-to: #3b82f6 var(--tw-gradient-to-position); } @@ -9553,18 +10308,14 @@ input[type='number'] { fill: currentColor; } -:is(.dark .dark\:fill-gray-900) { - fill: rgba(var(--gray-900), 1); -} - -:is(.dark .dark\:fill-gray-700) { - fill: rgba(var(--gray-700), 1); -} - :is(.dark .dark\:fill-gray-500) { fill: rgba(var(--gray-500), 1); } +:is(.dark .dark\:fill-gray-900) { + fill: rgba(var(--gray-900), 1); +} + :is(.dark .dark\:stroke-gray-900) { stroke: rgba(var(--gray-900), 1); } @@ -9912,11 +10663,27 @@ input[type='number'] { color: rgb(255 255 255 / var(--tw-text-opacity)); } +:is(.dark .dark\:focus\:outline-none:focus) { + outline: 2px solid transparent; + outline-offset: 2px; +} + +:is(.dark .dark\:focus\:ring-1:focus) { + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); +} + :is(.dark .dark\:focus\:ring-danger-500:focus) { --tw-ring-opacity: 1; --tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity)); } +:is(.dark .dark\:focus\:ring-gray-600:focus) { + --tw-ring-opacity: 1; + --tw-ring-color: rgba(var(--gray-600), var(--tw-ring-opacity)); +} + :is(.dark .dark\:focus\:ring-primary-500:focus) { --tw-ring-opacity: 1; --tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity)); @@ -10028,6 +10795,11 @@ input[type='number'] { color: rgba(var(--gray-400), var(--tw-text-opacity)); } +:is(.dark .group:hover .dark\:group-hover\:text-gray-500) { + --tw-text-opacity: 1; + color: rgba(var(--gray-500), var(--tw-text-opacity)); +} + :is(.dark .group:hover .dark\:group-hover\:text-primary-500) { --tw-text-opacity: 1; color: rgb(59 130 246 / var(--tw-text-opacity)); @@ -10064,10 +10836,6 @@ input[type='number'] { grid-column: span 4 / span 4; } - .sm\:col-span-6 { - grid-column: span 6 / span 6; - } - .sm\:col-start-\[--col-start-sm\] { grid-column-start: var(--col-start-sm); } @@ -10331,6 +11099,12 @@ input[type='number'] { row-gap: 1rem; } + .sm\:space-x-2 > :not([hidden]) ~ :not([hidden]) { + --tw-space-x-reverse: 0; + margin-right: calc(0.5rem * var(--tw-space-x-reverse)); + margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse))); + } + .sm\:space-x-4 > :not([hidden]) ~ :not([hidden]) { --tw-space-x-reverse: 0; margin-right: calc(1rem * var(--tw-space-x-reverse)); @@ -10343,12 +11117,6 @@ input[type='number'] { margin-bottom: calc(0px * var(--tw-space-y-reverse)); } - .sm\:space-x-2 > :not([hidden]) ~ :not([hidden]) { - --tw-space-x-reverse: 0; - margin-right: calc(0.5rem * var(--tw-space-x-reverse)); - margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse))); - } - .sm\:truncate { overflow: hidden; text-overflow: ellipsis; @@ -10388,11 +11156,6 @@ input[type='number'] { padding: 1.5rem; } - .sm\:px-0 { - padding-left: 0px; - padding-right: 0px; - } - .sm\:px-5 { padding-left: 1.25rem; padding-right: 1.25rem; @@ -10528,11 +11291,6 @@ input[type='number'] { .sm\:last-of-type\:pe-6:last-of-type { padding-inline-end: 1.5rem; } - - :is(.dark .sm\:dark\:border-gray-700) { - --tw-border-opacity: 1; - border-color: rgba(var(--gray-700), var(--tw-border-opacity)); - } } @media (min-width: 768px) { @@ -10927,10 +11685,6 @@ input[type='number'] { column-gap: 2rem; } - .lg\:gap-y-5 { - row-gap: 1.25rem; - } - .lg\:gap-y-6 { row-gap: 1.5rem; } @@ -10953,10 +11707,6 @@ input[type='number'] { margin-bottom: calc(5rem * var(--tw-space-y-reverse)); } - .lg\:divide-none > :not([hidden]) ~ :not([hidden]) { - border-style: none; - } - .lg\:rounded-bl-2xl { border-bottom-left-radius: 1rem; } @@ -10994,9 +11744,9 @@ input[type='number'] { padding-right: 2rem; } - .lg\:py-0 { - padding-top: 0px; - padding-bottom: 0px; + .lg\:py-10 { + padding-top: 2.5rem; + padding-bottom: 2.5rem; } .lg\:py-12 { @@ -11035,10 +11785,6 @@ input[type='number'] { padding-left: 0.5rem; } - .lg\:pr-4 { - padding-right: 1rem; - } - .lg\:pt-10 { padding-top: 2.5rem; } @@ -11082,12 +11828,8 @@ input[type='number'] { grid-column: var(--col-span-xl); } - .xl\:col-span-2 { - grid-column: span 2 / span 2; - } - - .xl\:col-span-4 { - grid-column: span 4 / span 4; + .xl\:col-span-3 { + grid-column: span 3 / span 3; } .xl\:col-start-\[--col-start-xl\] { @@ -11098,10 +11840,18 @@ input[type='number'] { display: block; } + .xl\:flex { + display: flex; + } + .xl\:table-cell { display: table-cell; } + .xl\:grid { + display: grid; + } + .xl\:inline-grid { display: inline-grid; } @@ -11143,8 +11893,8 @@ input[type='number'] { columns: var(--cols-xl); } - .xl\:grid-cols-6 { - grid-template-columns: repeat(6, minmax(0, 1fr)); + .xl\:grid-cols-4 { + grid-template-columns: repeat(4, minmax(0, 1fr)); } .xl\:grid-cols-\[--cols-xl\] { @@ -11155,6 +11905,10 @@ input[type='number'] { flex-direction: row; } + .xl\:flex-col { + flex-direction: column; + } + .xl\:items-start { align-items: flex-start; } @@ -11174,6 +11928,29 @@ input[type='number'] { .xl\:gap-3 { gap: 0.75rem; } + + .xl\:gap-x-12 { + -moz-column-gap: 3rem; + column-gap: 3rem; + } + + .xl\:border-0 { + border-width: 0px; + } + + .xl\:border-r { + border-right-width: 1px; + } + + .xl\:px-20 { + padding-left: 5rem; + padding-right: 5rem; + } + + .xl\:py-10 { + padding-top: 2.5rem; + padding-bottom: 2.5rem; + } } @media (min-width: 1536px) { diff --git a/packages/admin/public/shopper.js b/packages/admin/public/shopper.js index b8cce50b1..fa505a804 100755 --- a/packages/admin/public/shopper.js +++ b/packages/admin/public/shopper.js @@ -144,6 +144,1269 @@ }; var panel_default = SlideOverPanel; + // node_modules/treeselectjs/dist/treeselectjs.mjs + var ri = Object.defineProperty; + var ci = (l, e, t) => e in l ? ri(l, e, { enumerable: true, configurable: true, writable: true, value: t }) : l[e] = t; + var c = (l, e, t) => (ci(l, typeof e != "symbol" ? e + "" : e, t), t); + var kt = (l, e, t) => { + if (!e.has(l)) + throw TypeError("Cannot " + t); + }; + var n = (l, e, t) => (kt(l, e, "read from private field"), t ? t.call(l) : e.get(l)); + var r = (l, e, t) => { + if (e.has(l)) + throw TypeError("Cannot add the same private member more than once"); + e instanceof WeakSet ? e.add(l) : e.set(l, t); + }; + var m = (l, e, t, s) => (kt(l, e, "write to private field"), s ? s.call(l, t) : e.set(l, t), t); + var o = (l, e, t) => (kt(l, e, "access private method"), t); + var Pt = { + arrowUp: '', + arrowDown: '', + arrowRight: '', + attention: '', + clear: '', + cross: '', + check: '', + partialCheck: '' + }; + var I = (l, e) => { + if (e.innerHTML = "", typeof l == "string") + e.innerHTML = l; + else { + const t = l.cloneNode(true); + e.appendChild(t); + } + }; + var Bt = (l) => { + const e = l ? { ...l } : {}; + return Object.keys(Pt).forEach((t) => { + e[t] || (e[t] = Pt[t]); + }), e; + }; + var hi = (l) => l.reduce((e, { name: t }, s) => (e += t, s < l.length - 1 && (e += ", "), e), ""); + var N; + var E; + var D; + var v; + var ue; + var Ht; + var H; + var W; + var pe; + var Gt; + var me; + var Mt; + var G; + var U; + var O; + var V; + var fe; + var Ft; + var be; + var qt; + var Ce; + var jt; + var ge; + var Rt; + var ke; + var $t; + var we; + var Wt; + var Ee; + var Ut; + var ve; + var zt; + var Le; + var Yt; + var ye; + var Kt; + var xe; + var Xt; + var Se; + var Jt; + var _e; + var Zt; + var Ae; + var Qt; + var Te; + var es; + var Ne; + var ts; + var z; + var wt; + var di = class { + constructor({ + value: e, + showTags: t, + tagsCountText: s, + clearable: i, + isAlwaysOpened: a, + searchable: h, + placeholder: d, + disabled: C, + isSingleSelect: f, + id: b, + ariaLabel: g, + iconElements: k, + inputCallback: w, + searchCallback: y, + openCallback: x, + closeCallback: $, + keydownCallback: ae, + focusCallback: Ct, + blurCallback: gt, + nameChangeCallback: oe + }) { + r(this, ue); + r(this, H); + r(this, pe); + r(this, me); + r(this, G); + r(this, O); + r(this, fe); + r(this, be); + r(this, Ce); + r(this, ge); + r(this, ke); + r(this, we); + r(this, Ee); + r(this, ve); + r(this, Le); + r(this, ye); + r(this, xe); + r(this, Se); + r(this, _e); + r(this, Ae); + r(this, Te); + r(this, Ne); + r(this, z); + c(this, "value"); + c(this, "showTags"); + c(this, "tagsCountText"); + c(this, "clearable"); + c(this, "isAlwaysOpened"); + c(this, "searchable"); + c(this, "placeholder"); + c(this, "disabled"); + c(this, "isSingleSelect"); + c(this, "id"); + c(this, "ariaLabel"); + c(this, "iconElements"); + c(this, "isOpened"); + c(this, "searchText"); + c(this, "srcElement"); + r(this, N, void 0); + r(this, E, void 0); + r(this, D, void 0); + r(this, v, void 0); + c(this, "inputCallback"); + c(this, "searchCallback"); + c(this, "openCallback"); + c(this, "closeCallback"); + c(this, "keydownCallback"); + c(this, "focusCallback"); + c(this, "blurCallback"); + c(this, "nameChangeCallback"); + this.value = e, this.showTags = t, this.tagsCountText = s, this.searchable = h, this.placeholder = d, this.clearable = i, this.isAlwaysOpened = a, this.disabled = C, this.isSingleSelect = f, this.id = b, this.ariaLabel = g, this.iconElements = k, this.isOpened = false, this.searchText = "", m(this, N, o(this, Ce, jt).call(this)), m(this, E, o(this, Le, Yt).call(this)), m(this, D, o(this, Se, Jt).call(this)), m(this, v, null), this.inputCallback = w, this.searchCallback = y, this.openCallback = x, this.closeCallback = $, this.keydownCallback = ae, this.focusCallback = Ct, this.blurCallback = gt, this.nameChangeCallback = oe, this.srcElement = o(this, fe, Ft).call(this, n(this, N), n(this, E), n(this, D)), o(this, ue, Ht).call(this); + } + // Public methods + focus() { + setTimeout(() => n(this, E).focus(), 0); + } + blur() { + this.isOpened && o(this, O, V).call(this), this.clearSearch(), n(this, E).blur(); + } + updateValue(e) { + this.value = e, o(this, H, W).call(this), o(this, G, U).call(this); + } + removeItem(e) { + this.value = this.value.filter((t) => t.id !== e), o(this, z, wt).call(this), o(this, H, W).call(this), o(this, G, U).call(this); + } + clear() { + this.value = [], o(this, z, wt).call(this), o(this, H, W).call(this), this.clearSearch(); + } + openClose() { + o(this, O, V).call(this); + } + clearSearch() { + this.searchText = "", this.searchCallback(""), o(this, G, U).call(this); + } + }; + N = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), ue = /* @__PURE__ */ new WeakSet(), Ht = function() { + o(this, H, W).call(this), o(this, G, U).call(this), o(this, pe, Gt).call(this); + }, H = /* @__PURE__ */ new WeakSet(), W = function() { + if (n(this, N).innerHTML = "", this.showTags) { + n(this, N).append(...o(this, ge, Rt).call(this)); + const e = hi(this.value); + this.nameChangeCallback(e); + } else { + const e = o(this, ve, zt).call(this); + n(this, N).appendChild(e), this.nameChangeCallback(e.innerText); + } + n(this, N).appendChild(n(this, E)); + }, pe = /* @__PURE__ */ new WeakSet(), Gt = function() { + const e = []; + n(this, D).innerHTML = "", this.clearable && e.push(o(this, _e, Zt).call(this)), this.isAlwaysOpened || e.push(o(this, Te, es).call(this, this.isOpened)), e.length && n(this, D).append(...e); + }, me = /* @__PURE__ */ new WeakSet(), Mt = function() { + if (!this.isAlwaysOpened && n(this, v)) { + const e = this.isOpened ? this.iconElements.arrowUp : this.iconElements.arrowDown; + I(e, n(this, v)); + } + }, G = /* @__PURE__ */ new WeakSet(), U = function() { + var e; + (e = this.value) != null && e.length ? (n(this, E).removeAttribute("placeholder"), this.srcElement.classList.remove("treeselect-input--value-not-selected")) : (n(this, E).setAttribute("placeholder", this.placeholder), this.srcElement.classList.add("treeselect-input--value-not-selected")), this.searchable ? this.srcElement.classList.remove("treeselect-input--unsearchable") : this.srcElement.classList.add("treeselect-input--unsearchable"), this.isSingleSelect ? this.srcElement.classList.add("treeselect-input--is-single-select") : this.srcElement.classList.remove("treeselect-input--is-single-select"), n(this, E).value = this.searchText; + }, O = /* @__PURE__ */ new WeakSet(), V = function() { + this.isOpened = !this.isOpened, o(this, me, Mt).call(this), this.isOpened ? this.openCallback() : this.closeCallback(); + }, fe = /* @__PURE__ */ new WeakSet(), Ft = function(e, t, s) { + const i = document.createElement("div"); + return i.classList.add("treeselect-input"), i.setAttribute("tabindex", "-1"), i.addEventListener("mousedown", (a) => o(this, be, qt).call(this, a)), i.addEventListener("focus", () => this.focusCallback(), true), i.addEventListener("blur", () => this.blurCallback(), true), e.appendChild(t), i.append(e, s), i; + }, be = /* @__PURE__ */ new WeakSet(), qt = function(e) { + e.stopPropagation(), this.isOpened || o(this, O, V).call(this), this.focus(); + }, Ce = /* @__PURE__ */ new WeakSet(), jt = function() { + const e = document.createElement("div"); + return e.classList.add("treeselect-input__tags"), e; + }, ge = /* @__PURE__ */ new WeakSet(), Rt = function() { + return this.value.map((e) => { + const t = document.createElement("div"); + t.classList.add("treeselect-input__tags-element"), t.setAttribute("tabindex", "-1"), t.setAttribute("tag-id", e.id.toString()), t.setAttribute("title", e.name); + const s = o(this, we, Wt).call(this, e.name), i = o(this, Ee, Ut).call(this); + return t.addEventListener("mousedown", (a) => o(this, ke, $t).call(this, a, e.id)), t.append(s, i), t; + }); + }, ke = /* @__PURE__ */ new WeakSet(), $t = function(e, t) { + e.preventDefault(), e.stopPropagation(), this.removeItem(t), this.focus(); + }, we = /* @__PURE__ */ new WeakSet(), Wt = function(e) { + const t = document.createElement("span"); + return t.classList.add("treeselect-input__tags-name"), t.textContent = e, t; + }, Ee = /* @__PURE__ */ new WeakSet(), Ut = function() { + const e = document.createElement("span"); + return e.classList.add("treeselect-input__tags-cross"), I(this.iconElements.cross, e), e; + }, ve = /* @__PURE__ */ new WeakSet(), zt = function() { + const e = document.createElement("span"); + if (e.classList.add("treeselect-input__tags-count"), !this.value.length) + return e.textContent = "", e.setAttribute("title", ""), e; + const t = this.value.length === 1 ? this.value[0].name : `${this.value.length} ${this.tagsCountText}`; + return e.textContent = t, e.setAttribute("title", t), e; + }, Le = /* @__PURE__ */ new WeakSet(), Yt = function() { + const e = document.createElement("input"); + return e.classList.add("treeselect-input__edit"), this.id && e.setAttribute("id", this.id), (!this.searchable || this.disabled) && e.setAttribute("readonly", "readonly"), this.disabled && e.setAttribute("tabindex", "-1"), this.ariaLabel.length && e.setAttribute("aria-label", this.ariaLabel), e.addEventListener("keydown", (t) => o(this, ye, Kt).call(this, t)), e.addEventListener("input", (t) => o(this, xe, Xt).call(this, t, e)), e; + }, ye = /* @__PURE__ */ new WeakSet(), Kt = function(e) { + e.stopPropagation(); + const t = e.key; + t === "Backspace" && !this.searchText.length && this.value.length && !this.showTags && this.clear(), t === "Backspace" && !this.searchText.length && this.value.length && this.removeItem(this.value[this.value.length - 1].id), e.code === "Space" && (!this.searchText || !this.searchable) && o(this, O, V).call(this), (t === "Enter" || t === "ArrowDown" || t === "ArrowUp") && e.preventDefault(), this.keydownCallback(e), t !== "Tab" && this.focus(); + }, xe = /* @__PURE__ */ new WeakSet(), Xt = function(e, t) { + e.stopPropagation(); + const s = this.searchText, i = t.value.trim(); + if (s.length === 0 && i.length === 0) { + t.value = ""; + return; + } + if (this.searchable) { + const a = e.target.value; + this.searchCallback(a), this.isOpened || o(this, O, V).call(this); + } else + t.value = ""; + this.searchText = t.value; + }, Se = /* @__PURE__ */ new WeakSet(), Jt = function() { + const e = document.createElement("div"); + return e.classList.add("treeselect-input__operators"), e; + }, _e = /* @__PURE__ */ new WeakSet(), Zt = function() { + const e = document.createElement("span"); + return e.classList.add("treeselect-input__clear"), e.setAttribute("tabindex", "-1"), I(this.iconElements.clear, e), e.addEventListener("mousedown", (t) => o(this, Ae, Qt).call(this, t)), e; + }, Ae = /* @__PURE__ */ new WeakSet(), Qt = function(e) { + e.preventDefault(), e.stopPropagation(), (this.searchText.length || this.value.length) && this.clear(), this.focus(); + }, Te = /* @__PURE__ */ new WeakSet(), es = function(e) { + m(this, v, document.createElement("span")), n(this, v).classList.add("treeselect-input__arrow"); + const t = e ? this.iconElements.arrowUp : this.iconElements.arrowDown; + return I(t, n(this, v)), n(this, v).addEventListener("mousedown", (s) => o(this, Ne, ts).call(this, s)), n(this, v); + }, Ne = /* @__PURE__ */ new WeakSet(), ts = function(e) { + e.stopPropagation(), e.preventDefault(), this.focus(), o(this, O, V).call(this); + }, z = /* @__PURE__ */ new WeakSet(), wt = function() { + this.inputCallback(this.value); + }; + var ss = (l, e, t, s) => { + fi(e); + const i = e.filter((a) => !a.disabled && l.some((h) => h === a.id)); + if (t && i.length) { + i[0].checked = true; + return; + } + i.forEach((a) => { + a.checked = true; + const h = It(a, e, s); + a.checked = h; + }); + }; + var It = ({ id: l, checked: e }, t, s) => { + const i = t.find((h) => h.id === l); + if (!i) + return false; + if (s) + return i.checked = i.disabled ? false : !!e, i.checked; + const a = is(!!e, i, t); + return ls(i, t), a; + }; + var is = (l, e, t) => { + if (!e.isGroup) + return e.checked = e.disabled ? false : !!l, e.isPartialChecked = false, e.checked; + const s = t.filter((d) => d.childOf === e.id); + return !l || e.disabled || e.isPartialChecked ? (e.checked = false, e.isPartialChecked = false, Et(e, s, t), e.checked) : ns(s, t) ? as(s) ? (e.checked = false, e.isPartialChecked = false, e.disabled = true, e.checked) : (e.checked = false, e.isPartialChecked = true, s.forEach((d) => { + is(l, d, t); + }), e.checked) : (e.checked = true, e.isPartialChecked = false, Et(e, s, t), e.checked); + }; + var ls = (l, e) => { + const t = e.find((s) => s.id === l.childOf); + t && (ui(t, e), ls(t, e)); + }; + var ui = (l, e) => { + const t = ft(l, e); + if (as(t)) { + l.checked = false, l.isPartialChecked = false, l.disabled = true; + return; + } + if (pi(t)) { + l.checked = true, l.isPartialChecked = false; + return; + } + if (mi(t)) { + l.checked = false, l.isPartialChecked = true; + return; + } + l.checked = false, l.isPartialChecked = false; + }; + var Et = ({ checked: l, disabled: e }, t, s) => { + t.forEach((i) => { + i.disabled = !!e || !!i.disabled, i.checked = !!l && !i.disabled, i.isPartialChecked = false; + const a = ft(i, s); + Et({ checked: l, disabled: e }, a, s); + }); + }; + var ns = (l, e) => l.some((i) => i.disabled) ? true : l.some((i) => { + if (i.isGroup) { + const a = ft(i, e); + return ns(a, e); + } + return false; + }); + var as = (l) => l.every((e) => !!e.disabled); + var pi = (l) => l.every((e) => !!e.checked); + var mi = (l) => l.some((e) => !!e.checked || !!e.isPartialChecked); + var fi = (l) => { + l.forEach((e) => { + e.checked = false, e.isPartialChecked = false; + }); + }; + var bi = (l, e, t) => { + const s = { level: 0, groupId: "" }, i = os(l, e, s.groupId, s.level); + return gi(i, t); + }; + var os = (l, e, t, s) => l.reduce((i, a) => { + var f; + const h = !!((f = a.children) != null && f.length), d = s >= e && h, C = s > e; + if (i.push({ + id: a.value, + name: a.name, + childOf: t, + isGroup: h, + checked: false, + isPartialChecked: false, + level: s, + isClosed: d, + hidden: C, + disabled: a.disabled ?? false + }), h) { + const b = os(a.children, e, a.value, s + 1); + i.push(...b); + } + return i; + }, []); + var ft = ({ id: l }, e) => e.filter((t) => t.childOf === l); + var Ci = (l) => { + const { ungroupedNodes: e, allGroupedNodes: t, allNodes: s } = l.reduce( + (a, h) => (h.checked && (a.allNodes.push(h), h.isGroup ? a.allGroupedNodes.push(h) : a.ungroupedNodes.push(h)), a), + { + ungroupedNodes: [], + allGroupedNodes: [], + allNodes: [] + } + ), i = s.filter((a) => !t.some(({ id: h }) => h === a.childOf)); + return { ungroupedNodes: e, groupedNodes: i, allNodes: s }; + }; + var gi = (l, e) => (l.filter((s) => !!s.disabled).forEach( + ({ id: s }) => It({ id: s, checked: false }, l, e) + ), l); + var bt = (l, { id: e, isClosed: t }) => { + ft({ id: e }, l).forEach((i) => { + i.hidden = t ?? false, i.isGroup && !i.isClosed && bt(l, { id: i.id, isClosed: t }); + }); + }; + var ki = (l) => { + l.filter((e) => e.isGroup && !e.disabled && (e.checked || e.isPartialChecked)).forEach((e) => { + e.isClosed = false, bt(l, e); + }); + }; + var wi = (l, e) => { + const t = Ei(l, e); + l.forEach((s) => { + t.some(({ id: a }) => a === s.id) ? (s.isGroup && (s.isClosed = false, bt(l, s)), s.hidden = false) : s.hidden = true; + }); + }; + var Ei = (l, e) => l.reduce((t, s) => { + if (s.name.toLowerCase().includes(e.toLowerCase())) { + if (t.push(s), s.isGroup) { + const a = rs(s.id, l); + t.push(...a); + } + if (s.childOf) { + const a = cs(s.childOf, l); + t.push(...a); + } + } + return t; + }, []); + var rs = (l, e) => e.reduce((t, s) => (s.childOf === l && (t.push(s), s.isGroup && t.push(...rs(s.id, e))), t), []); + var cs = (l, e) => e.reduce((t, s) => (s.id === l && (t.push(s), s.childOf && t.push(...cs(s.childOf, e))), t), []); + var vi = (l) => { + const { duplications: e } = l.reduce( + (t, s) => (t.allItems.some((i) => i.toString() === s.id.toString()) && t.duplications.push(s.id), t.allItems.push(s.id), t), + { + duplications: [], + allItems: [] + } + ); + e.length && console.error(`Validation: You have duplicated values: ${e.join(", ")}! You should use unique values.`); + }; + var Li = (l, e, t, s, i, a, h, d, C, f) => { + ss(l, e, i, C), d && h && ki(e), ce(e, t, s, a, f); + }; + var ce = (l, e, t, s, i) => { + l.forEach((a) => { + const h = e.querySelector(`[input-id="${a.id}"]`), d = T(h); + h.checked = a.checked, yi(a, d, s), xi(a, d), Si(a, d), _i(a, d, t), Ai(a, d), Ni(a, d, l, i), Ti(a, h, t); + }), Oi(l, e); + }; + var yi = (l, e, t) => { + l.checked ? e.classList.add("treeselect-list__item--checked") : e.classList.remove("treeselect-list__item--checked"), Array.isArray(t) && t[0] === l.id && !l.disabled ? e.classList.add("treeselect-list__item--single-selected") : e.classList.remove("treeselect-list__item--single-selected"); + }; + var xi = (l, e) => { + l.isPartialChecked ? e.classList.add("treeselect-list__item--partial-checked") : e.classList.remove("treeselect-list__item--partial-checked"); + }; + var Si = (l, e) => { + l.disabled ? e.classList.add("treeselect-list__item--disabled") : e.classList.remove("treeselect-list__item--disabled"); + }; + var _i = (l, e, t) => { + if (l.isGroup) { + const s = e.querySelector(".treeselect-list__item-icon"), i = l.isClosed ? t.arrowRight : t.arrowDown; + I(i, s), l.isClosed ? e.classList.add("treeselect-list__item--closed") : e.classList.remove("treeselect-list__item--closed"); + } + }; + var Ai = (l, e) => { + l.hidden ? e.classList.add("treeselect-list__item--hidden") : e.classList.remove("treeselect-list__item--hidden"); + }; + var Ti = (l, e, t) => { + const i = e.parentNode.querySelector(".treeselect-list__item-checkbox-icon"); + l.checked ? I(t.check, i) : l.isPartialChecked ? I(t.partialCheck, i) : i.innerHTML = ""; + }; + var Ni = (l, e, t, s) => { + const i = l.level === 0, a = 20, h = 5; + if (i) { + const d = t.some((b) => b.isGroup && b.level === l.level), C = !l.isGroup && d ? `${a}px` : `${h}px`, f = l.isGroup ? "0" : C; + s ? e.style.paddingRight = f : e.style.paddingLeft = f; + } else { + const d = l.isGroup ? `${l.level * a}px` : `${l.level * a + a}px`; + s ? e.style.paddingRight = d : e.style.paddingLeft = d; + } + e.setAttribute("level", l.level.toString()), e.setAttribute("group", l.isGroup.toString()); + }; + var Oi = (l, e) => { + const t = l.some((i) => !i.hidden), s = e.querySelector(".treeselect-list__empty"); + t ? s.classList.add("treeselect-list__empty--hidden") : s.classList.remove("treeselect-list__empty--hidden"); + }; + var T = (l) => l.parentNode.parentNode; + var Vt = (l, e) => e.find((t) => t.id.toString() === l); + var Ii = (l) => T(l).querySelector(".treeselect-list__item-icon"); + var Pi = (l, e) => { + e && Object.keys(e).forEach((t) => { + const s = e[t]; + typeof s == "string" && l.setAttribute(t, s); + }); + }; + var M; + var P; + var S; + var Y; + var Oe; + var hs; + var Ie; + var ds; + var Pe; + var us; + var Be; + var ps; + var Ve; + var ms; + var De; + var fs; + var K; + var vt; + var He; + var bs; + var Ge; + var Cs; + var Me; + var gs; + var X; + var Lt; + var Fe; + var ks; + var qe; + var ws; + var je; + var Es; + var Re; + var vs; + var $e; + var Ls; + var We; + var ys; + var Ue; + var xs; + var ze; + var Ss; + var Ye; + var _s; + var Ke; + var As; + var Xe; + var Ts; + var J; + var yt; + var Z; + var xt; + var Je; + var Ns; + var Bi = class { + constructor({ + options: e, + value: t, + openLevel: s, + listSlotHtmlComponent: i, + emptyText: a, + isSingleSelect: h, + iconElements: d, + showCount: C, + disabledBranchNode: f, + expandSelected: b, + isIndependentNodes: g, + rtl: k, + inputCallback: w, + arrowClickCallback: y, + mouseupCallback: x + }) { + r(this, Oe); + r(this, Ie); + r(this, Pe); + r(this, Be); + r(this, Ve); + r(this, De); + r(this, K); + r(this, He); + r(this, Ge); + r(this, Me); + r(this, X); + r(this, Fe); + r(this, qe); + r(this, je); + r(this, Re); + r(this, $e); + r(this, We); + r(this, Ue); + r(this, ze); + r(this, Ye); + r(this, Ke); + r(this, Xe); + r(this, J); + r(this, Z); + r(this, Je); + c(this, "options"); + c(this, "value"); + c(this, "openLevel"); + c(this, "listSlotHtmlComponent"); + c(this, "emptyText"); + c(this, "isSingleSelect"); + c(this, "showCount"); + c(this, "disabledBranchNode"); + c(this, "expandSelected"); + c(this, "isIndependentNodes"); + c(this, "rtl"); + c(this, "iconElements"); + c(this, "searchText"); + c(this, "flattedOptions"); + c(this, "flattedOptionsBeforeSearch"); + c(this, "selectedNodes"); + c(this, "srcElement"); + c(this, "inputCallback"); + c(this, "arrowClickCallback"); + c(this, "mouseupCallback"); + r(this, M, null); + r(this, P, true); + r(this, S, []); + r(this, Y, true); + this.options = e, this.value = t, this.openLevel = s ?? 0, this.listSlotHtmlComponent = i ?? null, this.emptyText = a ?? "No results found...", this.isSingleSelect = h ?? false, this.showCount = C ?? false, this.disabledBranchNode = f ?? false, this.expandSelected = b ?? false, this.isIndependentNodes = g ?? false, this.rtl = k ?? false, this.iconElements = d, this.searchText = "", this.flattedOptions = bi(this.options, this.openLevel, this.isIndependentNodes), this.flattedOptionsBeforeSearch = this.flattedOptions, this.selectedNodes = { nodes: [], groupedNodes: [], allNodes: [] }, this.srcElement = o(this, Pe, us).call(this), this.inputCallback = w, this.arrowClickCallback = y, this.mouseupCallback = x, vi(this.flattedOptions); + } + // Public methods + updateValue(e) { + this.value = e, m(this, S, this.isSingleSelect ? this.value : []), Li( + e, + this.flattedOptions, + this.srcElement, + this.iconElements, + this.isSingleSelect, + n(this, S), + this.expandSelected, + n(this, Y), + this.isIndependentNodes, + this.rtl + ), m(this, Y, false), o(this, Z, xt).call(this); + } + updateSearchValue(e) { + if (e === this.searchText) + return; + const t = this.searchText === "" && e !== ""; + this.searchText = e, t && (this.flattedOptionsBeforeSearch = JSON.parse(JSON.stringify(this.flattedOptions))), this.searchText === "" && (this.flattedOptions = this.flattedOptionsBeforeSearch.map((s) => { + const i = this.flattedOptions.find((a) => a.id === s.id); + return i.isClosed = s.isClosed, i.hidden = s.hidden, i; + }), this.flattedOptionsBeforeSearch = []), this.searchText && wi(this.flattedOptions, e), ce(this.flattedOptions, this.srcElement, this.iconElements, n(this, S), this.rtl), this.focusFirstListElement(); + } + callKeyAction(e) { + m(this, P, false); + const t = this.srcElement.querySelector(".treeselect-list__item--focused"); + if (t == null ? void 0 : t.classList.contains("treeselect-list__item--hidden")) + return; + const i = e.key; + i === "Enter" && t && t.dispatchEvent(new Event("mousedown")), (i === "ArrowLeft" || i === "ArrowRight") && o(this, Oe, hs).call(this, t, e), (i === "ArrowDown" || i === "ArrowUp") && o(this, Ie, ds).call(this, t, i); + } + focusFirstListElement() { + const e = "treeselect-list__item--focused", t = this.srcElement.querySelector(`.${e}`), s = Array.from(this.srcElement.querySelectorAll(".treeselect-list__item-checkbox")).filter( + (a) => window.getComputedStyle(T(a)).display !== "none" + ); + if (!s.length) + return; + t && t.classList.remove(e), T(s[0]).classList.add(e); + } + isLastFocusedElementExist() { + return !!n(this, M); + } + }; + M = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakMap(), Oe = /* @__PURE__ */ new WeakSet(), hs = function(e, t) { + if (!e) + return; + const s = t.key, a = e.querySelector(".treeselect-list__item-checkbox").getAttribute("input-id"), h = Vt(a, this.flattedOptions), d = e.querySelector(".treeselect-list__item-icon"); + s === "ArrowLeft" && !h.isClosed && h.isGroup && (d.dispatchEvent(new Event("mousedown")), t.preventDefault()), s === "ArrowRight" && h.isClosed && h.isGroup && (d.dispatchEvent(new Event("mousedown")), t.preventDefault()); + }, Ie = /* @__PURE__ */ new WeakSet(), ds = function(e, t) { + var i; + const s = Array.from(this.srcElement.querySelectorAll(".treeselect-list__item-checkbox")).filter( + (a) => window.getComputedStyle(T(a)).display !== "none" + ); + if (s.length) + if (!e) + T(s[0]).classList.add("treeselect-list__item--focused"); + else { + const a = s.findIndex( + (x) => T(x).classList.contains("treeselect-list__item--focused") + ); + T(s[a]).classList.remove("treeselect-list__item--focused"); + const d = t === "ArrowDown" ? a + 1 : a - 1, C = t === "ArrowDown" ? 0 : s.length - 1, f = s[d] ?? s[C], b = !s[d], g = T(f); + g.classList.add("treeselect-list__item--focused"); + const k = this.srcElement.getBoundingClientRect(), w = g.getBoundingClientRect(); + if (b && t === "ArrowDown") { + this.srcElement.scroll(0, 0); + return; + } + if (b && t === "ArrowUp") { + this.srcElement.scroll(0, this.srcElement.scrollHeight); + return; + } + const y = ((i = this.listSlotHtmlComponent) == null ? void 0 : i.clientHeight) ?? 0; + if (k.y + k.height < w.y + w.height + y) { + this.srcElement.scroll(0, this.srcElement.scrollTop + w.height); + return; + } + if (k.y > w.y) { + this.srcElement.scroll(0, this.srcElement.scrollTop - w.height); + return; + } + } + }, Pe = /* @__PURE__ */ new WeakSet(), us = function() { + const e = o(this, Be, ps).call(this), t = o(this, K, vt).call(this, this.options); + e.append(...t); + const s = o(this, Ge, Cs).call(this); + e.append(s); + const i = o(this, He, bs).call(this); + return i && e.append(i), e; + }, Be = /* @__PURE__ */ new WeakSet(), ps = function() { + const e = document.createElement("div"); + return e.classList.add("treeselect-list"), this.isSingleSelect && e.classList.add("treeselect-list--single-select"), this.disabledBranchNode && e.classList.add("treeselect-list--disabled-branch-node"), e.addEventListener("mouseout", (t) => o(this, Ve, ms).call(this, t)), e.addEventListener("mousemove", () => o(this, De, fs).call(this)), e.addEventListener("mouseup", () => this.mouseupCallback(), true), e; + }, Ve = /* @__PURE__ */ new WeakSet(), ms = function(e) { + e.stopPropagation(), n(this, M) && n(this, P) && n(this, M).classList.add("treeselect-list__item--focused"); + }, De = /* @__PURE__ */ new WeakSet(), fs = function() { + m(this, P, true); + }, K = /* @__PURE__ */ new WeakSet(), vt = function(e) { + return e.reduce((t, s) => { + var a; + if ((a = s.children) != null && a.length) { + const h = o(this, Me, gs).call(this, s), d = o(this, K, vt).call(this, s.children); + return h.append(...d), t.push(h), t; + } + const i = o(this, X, Lt).call(this, s, false); + return t.push(i), t; + }, []); + }, He = /* @__PURE__ */ new WeakSet(), bs = function() { + if (!this.listSlotHtmlComponent) + return null; + const e = document.createElement("div"); + return e.classList.add("treeselect-list__slot"), e.appendChild(this.listSlotHtmlComponent), e; + }, Ge = /* @__PURE__ */ new WeakSet(), Cs = function() { + const e = document.createElement("div"); + e.classList.add("treeselect-list__empty"), e.setAttribute("title", this.emptyText); + const t = document.createElement("span"); + t.classList.add("treeselect-list__empty-icon"), I(this.iconElements.attention, t); + const s = document.createElement("span"); + return s.classList.add("treeselect-list__empty-text"), s.textContent = this.emptyText, e.append(t, s), e; + }, Me = /* @__PURE__ */ new WeakSet(), gs = function(e) { + const t = document.createElement("div"); + t.setAttribute("group-container-id", e.value.toString()), t.classList.add("treeselect-list__group-container"); + const s = o(this, X, Lt).call(this, e, true); + return t.appendChild(s), t; + }, X = /* @__PURE__ */ new WeakSet(), Lt = function(e, t) { + const s = o(this, Fe, ks).call(this, e); + if (t) { + const h = o(this, $e, Ls).call(this); + s.appendChild(h), s.classList.add("treeselect-list__item--group"); + } + const i = o(this, Ue, xs).call(this, e), a = o(this, ze, Ss).call(this, e, t); + return s.append(i, a), s; + }, Fe = /* @__PURE__ */ new WeakSet(), ks = function(e) { + const t = document.createElement("div"); + return Pi(t, e.htmlAttr), t.setAttribute("tabindex", "-1"), t.setAttribute("title", e.name), t.classList.add("treeselect-list__item"), t.addEventListener("mouseover", () => o(this, qe, ws).call(this, t), true), t.addEventListener("mouseout", () => o(this, je, Es).call(this, t), true), t.addEventListener("mousedown", (s) => o(this, Re, vs).call(this, s, e)), t; + }, qe = /* @__PURE__ */ new WeakSet(), ws = function(e) { + n(this, P) && o(this, J, yt).call(this, true, e); + }, je = /* @__PURE__ */ new WeakSet(), Es = function(e) { + n(this, P) && (o(this, J, yt).call(this, false, e), m(this, M, e)); + }, Re = /* @__PURE__ */ new WeakSet(), vs = function(e, t) { + var a; + if (e.preventDefault(), e.stopPropagation(), (a = this.flattedOptions.find((h) => h.id === t.value)) == null ? void 0 : a.disabled) + return; + const i = e.target.querySelector(".treeselect-list__item-checkbox"); + i.checked = !i.checked, o(this, Ke, As).call(this, i, t); + }, $e = /* @__PURE__ */ new WeakSet(), Ls = function() { + const e = document.createElement("span"); + return e.setAttribute("tabindex", "-1"), e.classList.add("treeselect-list__item-icon"), I(this.iconElements.arrowDown, e), e.addEventListener("mousedown", (t) => o(this, We, ys).call(this, t)), e; + }, We = /* @__PURE__ */ new WeakSet(), ys = function(e) { + e.preventDefault(), e.stopPropagation(), o(this, Xe, Ts).call(this, e); + }, Ue = /* @__PURE__ */ new WeakSet(), xs = function(e) { + const t = document.createElement("div"); + t.classList.add("treeselect-list__item-checkbox-container"); + const s = document.createElement("span"); + s.classList.add("treeselect-list__item-checkbox-icon"), s.innerHTML = ""; + const i = document.createElement("input"); + return i.setAttribute("tabindex", "-1"), i.setAttribute("type", "checkbox"), i.setAttribute("input-id", e.value.toString()), i.classList.add("treeselect-list__item-checkbox"), t.append(s, i), t; + }, ze = /* @__PURE__ */ new WeakSet(), Ss = function(e, t) { + const s = document.createElement("label"); + if (s.textContent = e.name, s.classList.add("treeselect-list__item-label"), t && this.showCount) { + const i = o(this, Ye, _s).call(this, e); + s.appendChild(i); + } + return s; + }, Ye = /* @__PURE__ */ new WeakSet(), _s = function(e) { + const t = document.createElement("span"), s = this.flattedOptions.filter((i) => i.childOf === e.value); + return t.textContent = `(${s.length})`, t.classList.add("treeselect-list__item-label-counter"), t; + }, Ke = /* @__PURE__ */ new WeakSet(), As = function(e, t) { + const s = this.flattedOptions.find((i) => i.id === t.value); + if (s) { + if (s != null && s.isGroup && this.disabledBranchNode) { + const i = Ii(e); + i == null || i.dispatchEvent(new Event("mousedown")); + return; + } + if (this.isSingleSelect) { + const [i] = n(this, S); + if (s.id === i) + return; + m(this, S, [s.id]), ss([s.id], this.flattedOptions, this.isSingleSelect, this.isIndependentNodes); + } else { + s.checked = e.checked; + const i = It(s, this.flattedOptions, this.isIndependentNodes); + e.checked = i; + } + ce(this.flattedOptions, this.srcElement, this.iconElements, n(this, S), this.rtl), o(this, Je, Ns).call(this); + } + }, Xe = /* @__PURE__ */ new WeakSet(), Ts = function(e) { + var a, h; + const t = (h = (a = e.target) == null ? void 0 : a.parentNode) == null ? void 0 : h.querySelector("[input-id]"), s = (t == null ? void 0 : t.getAttribute("input-id")) ?? null, i = Vt(s, this.flattedOptions); + i && (i.isClosed = !i.isClosed, bt(this.flattedOptions, i), ce(this.flattedOptions, this.srcElement, this.iconElements, n(this, S), this.rtl), this.arrowClickCallback(i.id, i.isClosed)); + }, J = /* @__PURE__ */ new WeakSet(), yt = function(e, t) { + const s = "treeselect-list__item--focused"; + if (e) { + const i = Array.from(this.srcElement.querySelectorAll(`.${s}`)); + i.length && i.forEach((a) => a.classList.remove(s)), t.classList.add(s); + } else + t.classList.remove(s); + }, Z = /* @__PURE__ */ new WeakSet(), xt = function() { + const { ungroupedNodes: e, groupedNodes: t, allNodes: s } = Ci(this.flattedOptions); + this.selectedNodes = { nodes: e, groupedNodes: t, allNodes: s }; + }, Je = /* @__PURE__ */ new WeakSet(), Ns = function() { + o(this, Z, xt).call(this), this.inputCallback(this.selectedNodes), this.value = this.selectedNodes.nodes.map((e) => e.id); + }; + var Dt = ({ + parentHtmlContainer: l, + staticList: e, + appendToBody: t, + isSingleSelect: s, + value: i, + direction: a + }) => { + l || console.error("Validation: parentHtmlContainer prop is required!"), e && t && console.error("Validation: You should set staticList to false if you use appendToBody!"), s && Array.isArray(i) && console.error("Validation: if you use isSingleSelect prop, you should pass a single value!"), !s && !Array.isArray(i) && console.error("Validation: you should pass an array as a value!"), a && a !== "auto" && a !== "bottom" && a !== "top" && console.error("Validation: you should pass (auto | top | bottom | undefined) as a value for the direction prop!"); + }; + var re = (l) => l.map((e) => e.id); + var Vi = (l) => l ? Array.isArray(l) ? l : [l] : []; + var Di = (l, e) => { + if (e) { + const [t] = l; + return t ?? null; + } + return l; + }; + var u; + var p; + var F; + var Q; + var q; + var _; + var A; + var L; + var B; + var ee; + var St; + var te; + var _t; + var Ze; + var Os; + var Qe; + var Is; + var et; + var Ps; + var tt; + var Bs; + var st; + var Vs; + var it; + var Ds; + var se; + var At; + var lt; + var Hs; + var nt; + var Gs; + var at; + var Ms; + var ot; + var Fs; + var ie; + var Tt; + var rt; + var qs; + var j; + var he; + var le; + var Nt; + var R; + var de; + var ct; + var js; + var ne; + var Ot; + var ht; + var Rs; + var dt; + var $s; + var ut; + var Ws; + var pt; + var Us; + var mt; + var zs; + var Gi = class { + constructor({ + parentHtmlContainer: e, + value: t, + options: s, + openLevel: i, + appendToBody: a, + alwaysOpen: h, + showTags: d, + tagsCountText: C, + clearable: f, + searchable: b, + placeholder: g, + grouped: k, + isGroupedValue: w, + listSlotHtmlComponent: y, + disabled: x, + emptyText: $, + staticList: ae, + id: Ct, + ariaLabel: gt, + isSingleSelect: oe, + showCount: Ys, + disabledBranchNode: Ks, + direction: Xs, + expandSelected: Js, + saveScrollPosition: Zs, + isIndependentNodes: Qs, + rtl: ei, + iconElements: ti, + inputCallback: si, + openCallback: ii, + closeCallback: li, + nameChangeCallback: ni, + searchCallback: ai, + openCloseGroupCallback: oi + }) { + r(this, ee); + r(this, te); + r(this, Ze); + r(this, Qe); + r(this, et); + r(this, tt); + r(this, st); + r(this, it); + r(this, se); + r(this, lt); + r(this, nt); + r(this, at); + r(this, ot); + r(this, ie); + r(this, rt); + r(this, j); + r(this, le); + r(this, R); + r(this, ct); + r(this, ne); + r(this, ht); + r(this, dt); + r(this, ut); + r(this, pt); + r(this, mt); + c(this, "parentHtmlContainer"); + c(this, "value"); + c(this, "options"); + c(this, "openLevel"); + c(this, "appendToBody"); + c(this, "alwaysOpen"); + c(this, "showTags"); + c(this, "tagsCountText"); + c(this, "clearable"); + c(this, "searchable"); + c(this, "placeholder"); + c(this, "grouped"); + c(this, "isGroupedValue"); + c(this, "listSlotHtmlComponent"); + c(this, "disabled"); + c(this, "emptyText"); + c(this, "staticList"); + c(this, "id"); + c(this, "ariaLabel"); + c(this, "isSingleSelect"); + c(this, "showCount"); + c(this, "disabledBranchNode"); + c(this, "direction"); + c(this, "expandSelected"); + c(this, "saveScrollPosition"); + c(this, "isIndependentNodes"); + c(this, "rtl"); + c(this, "iconElements"); + c(this, "inputCallback"); + c(this, "openCallback"); + c(this, "closeCallback"); + c(this, "nameChangeCallback"); + c(this, "searchCallback"); + c(this, "openCloseGroupCallback"); + c(this, "ungroupedValue"); + c(this, "groupedValue"); + c(this, "allValue"); + c(this, "isListOpened"); + c(this, "selectedName"); + c(this, "srcElement"); + r(this, u, null); + r(this, p, null); + r(this, F, null); + r(this, Q, 0); + r(this, q, 0); + r(this, _, null); + r(this, A, null); + r(this, L, null); + r(this, B, null); + Dt({ + parentHtmlContainer: e, + value: t, + staticList: ae, + appendToBody: a, + isSingleSelect: oe + }), this.parentHtmlContainer = e, this.value = [], this.options = s ?? [], this.openLevel = i ?? 0, this.appendToBody = a ?? false, this.alwaysOpen = !!(h && !x), this.showTags = d ?? true, this.tagsCountText = C ?? "elements selected", this.clearable = f ?? true, this.searchable = b ?? true, this.placeholder = g ?? "Search...", this.grouped = k ?? true, this.isGroupedValue = w ?? false, this.listSlotHtmlComponent = y ?? null, this.disabled = x ?? false, this.emptyText = $ ?? "No results found...", this.staticList = !!(ae && !this.appendToBody), this.id = Ct ?? "", this.ariaLabel = gt ?? "", this.isSingleSelect = oe ?? false, this.showCount = Ys ?? false, this.disabledBranchNode = Ks ?? false, this.direction = Xs ?? "auto", this.expandSelected = Js ?? false, this.saveScrollPosition = Zs ?? true, this.isIndependentNodes = Qs ?? false, this.rtl = ei ?? false, this.iconElements = Bt(ti), this.inputCallback = si, this.openCallback = ii, this.closeCallback = li, this.nameChangeCallback = ni, this.searchCallback = ai, this.openCloseGroupCallback = oi, this.ungroupedValue = [], this.groupedValue = [], this.allValue = [], this.isListOpened = false, this.selectedName = "", this.srcElement = null, o(this, ee, St).call(this, t); + } + mount() { + Dt({ + parentHtmlContainer: this.parentHtmlContainer, + value: this.value, + staticList: this.staticList, + appendToBody: this.appendToBody, + isSingleSelect: this.isSingleSelect + }), this.iconElements = Bt(this.iconElements), o(this, ee, St).call(this, this.value); + } + updateValue(e) { + const t = Vi(e), s = n(this, u); + s && (s.updateValue(t), o(this, se, At).call(this, s == null ? void 0 : s.selectedNodes)); + } + destroy() { + this.srcElement && (o(this, ie, Tt).call(this), this.srcElement.innerHTML = "", this.srcElement = null, o(this, R, de).call(this, true)); + } + focus() { + n(this, p) && n(this, p).focus(); + } + toggleOpenClose() { + n(this, p) && (n(this, p).openClose(), n(this, p).focus()); + } + // Outside Listeners + scrollWindowHandler() { + this.updateListPosition(); + } + focusWindowHandler(e) { + var s, i, a; + ((s = this.srcElement) == null ? void 0 : s.contains(e.target)) || ((i = n(this, u)) == null ? void 0 : i.srcElement.contains(e.target)) || ((a = n(this, p)) == null || a.blur(), o(this, R, de).call(this, false), o(this, j, he).call(this, false)); + } + blurWindowHandler() { + var e; + (e = n(this, p)) == null || e.blur(), o(this, R, de).call(this, false), o(this, j, he).call(this, false); + } + // Update direction of the list. Support appendToBody and standard mode with absolute + updateListPosition() { + var y; + const e = this.srcElement, t = (y = n(this, u)) == null ? void 0 : y.srcElement; + if (!e || !t) + return; + const { height: s } = t.getBoundingClientRect(), { + x: i, + y: a, + height: h, + width: d + } = e.getBoundingClientRect(), C = window.innerHeight, f = a, b = C - a - h; + let g = f > b && f >= s && b < s; + if (this.direction !== "auto" && (g = this.direction === "top"), this.appendToBody) { + (t.style.top !== "0px" || t.style.left !== "0px") && (t.style.top = "0px", t.style.left = "0px"); + const x = i + window.scrollX, $ = g ? a + window.scrollY - s : a + window.scrollY + h; + t.style.transform = `translate(${x}px,${$}px)`, t.style.width = `${d}px`; + } + const k = g ? "top" : "bottom"; + t.getAttribute("direction") !== k && (t.setAttribute("direction", k), o(this, rt, qs).call(this, g, this.appendToBody)); + } + }; + u = /* @__PURE__ */ new WeakMap(), p = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), Q = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), _ = /* @__PURE__ */ new WeakMap(), A = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), B = /* @__PURE__ */ new WeakMap(), ee = /* @__PURE__ */ new WeakSet(), St = function(e) { + var a; + this.destroy(); + const { container: t, list: s, input: i } = o(this, Ze, Os).call(this); + this.srcElement = t, m(this, u, s), m(this, p, i), m(this, _, this.scrollWindowHandler.bind(this)), m(this, A, this.scrollWindowHandler.bind(this)), m(this, L, this.focusWindowHandler.bind(this)), m(this, B, this.blurWindowHandler.bind(this)), this.alwaysOpen && ((a = n(this, p)) == null || a.openClose()), this.disabled ? this.srcElement.classList.add("treeselect--disabled") : this.srcElement.classList.remove("treeselect--disabled"), this.updateValue(e ?? this.value); + }, te = /* @__PURE__ */ new WeakSet(), _t = function({ + groupedNodes: e, + nodes: t, + allNodes: s + }) { + this.ungroupedValue = t ? re(t) : [], this.groupedValue = e ? re(e) : [], this.allValue = s ? re(s) : []; + let i = []; + this.isIndependentNodes || this.isSingleSelect ? i = this.allValue : this.isGroupedValue ? i = this.groupedValue : i = this.ungroupedValue, this.value = Di(i, this.isSingleSelect); + }, Ze = /* @__PURE__ */ new WeakSet(), Os = function() { + const e = this.parentHtmlContainer; + e.classList.add("treeselect"), this.rtl && e.setAttribute("dir", "rtl"); + const t = new Bi({ + value: [], + // updateValue method calls in initMount method to set actual value + options: this.options, + openLevel: this.openLevel, + listSlotHtmlComponent: this.listSlotHtmlComponent, + emptyText: this.emptyText, + isSingleSelect: this.isSingleSelect, + showCount: this.showCount, + disabledBranchNode: this.disabledBranchNode, + expandSelected: this.expandSelected, + isIndependentNodes: this.isIndependentNodes, + rtl: this.rtl, + iconElements: this.iconElements, + inputCallback: (i) => o(this, lt, Hs).call(this, i), + arrowClickCallback: (i, a) => o(this, nt, Gs).call(this, i, a), + mouseupCallback: () => { + var i; + return (i = n(this, p)) == null ? void 0 : i.focus(); + } + }), s = new di({ + value: [], + // updateValue method calls in initMount method to set actual value + showTags: this.showTags, + tagsCountText: this.tagsCountText, + clearable: this.clearable, + isAlwaysOpened: this.alwaysOpen, + searchable: this.searchable, + placeholder: this.placeholder, + disabled: this.disabled, + isSingleSelect: this.isSingleSelect, + id: this.id, + ariaLabel: this.ariaLabel, + iconElements: this.iconElements, + inputCallback: (i) => o(this, Qe, Is).call(this, i), + searchCallback: (i) => o(this, tt, Bs).call(this, i), + openCallback: () => o(this, ot, Fs).call(this), + closeCallback: () => o(this, ie, Tt).call(this), + keydownCallback: (i) => o(this, et, Ps).call(this, i), + focusCallback: () => o(this, st, Vs).call(this), + blurCallback: () => o(this, it, Ds).call(this), + nameChangeCallback: (i) => o(this, at, Ms).call(this, i) + }); + return this.appendToBody && m(this, F, new ResizeObserver(() => this.updateListPosition())), e.append(s.srcElement), { container: e, list: t, input: s }; + }, Qe = /* @__PURE__ */ new WeakSet(), Is = function(e) { + var i, a; + const t = re(e); + (i = n(this, u)) == null || i.updateValue(t); + const s = ((a = n(this, u)) == null ? void 0 : a.selectedNodes) ?? {}; + o(this, te, _t).call(this, s), o(this, ne, Ot).call(this); + }, et = /* @__PURE__ */ new WeakSet(), Ps = function(e) { + var t; + this.isListOpened && ((t = n(this, u)) == null || t.callKeyAction(e)); + }, tt = /* @__PURE__ */ new WeakSet(), Bs = function(e) { + n(this, q) && clearTimeout(n(this, q)), m(this, q, window.setTimeout(() => { + var t; + (t = n(this, u)) == null || t.updateSearchValue(e), this.updateListPosition(); + }, 350)), o(this, pt, Us).call(this, e); + }, st = /* @__PURE__ */ new WeakSet(), Vs = function() { + o(this, j, he).call(this, true), n(this, L) && n(this, L) && n(this, B) && (document.addEventListener("mousedown", n(this, L), true), document.addEventListener("focus", n(this, L), true), window.addEventListener("blur", n(this, B))); + }, it = /* @__PURE__ */ new WeakSet(), Ds = function() { + setTimeout(() => { + var s, i; + const e = (s = n(this, p)) == null ? void 0 : s.srcElement.contains(document.activeElement), t = (i = n(this, u)) == null ? void 0 : i.srcElement.contains(document.activeElement); + !e && !t && this.blurWindowHandler(); + }, 1); + }, se = /* @__PURE__ */ new WeakSet(), At = function(e) { + var s; + if (!e) + return; + let t = []; + this.isIndependentNodes || this.isSingleSelect ? t = e.allNodes : this.grouped ? t = e.groupedNodes : t = e.nodes, (s = n(this, p)) == null || s.updateValue(t), o(this, te, _t).call(this, e); + }, lt = /* @__PURE__ */ new WeakSet(), Hs = function(e) { + var t, s, i; + o(this, se, At).call(this, e), this.isSingleSelect && !this.alwaysOpen && ((t = n(this, p)) == null || t.openClose(), (s = n(this, p)) == null || s.clearSearch()), (i = n(this, p)) == null || i.focus(), o(this, ne, Ot).call(this); + }, nt = /* @__PURE__ */ new WeakSet(), Gs = function(e, t) { + var s; + (s = n(this, p)) == null || s.focus(), this.updateListPosition(), o(this, mt, zs).call(this, e, t); + }, at = /* @__PURE__ */ new WeakSet(), Ms = function(e) { + this.selectedName !== e && (this.selectedName = e, o(this, ht, Rs).call(this)); + }, ot = /* @__PURE__ */ new WeakSet(), Fs = function() { + var e; + this.isListOpened = true, n(this, _) && n(this, A) && (window.addEventListener("scroll", n(this, _), true), window.addEventListener("resize", n(this, A))), !(!n(this, u) || !this.srcElement) && (this.appendToBody ? (document.body.appendChild(n(this, u).srcElement), (e = n(this, F)) == null || e.observe(this.srcElement)) : this.srcElement.appendChild(n(this, u).srcElement), this.updateListPosition(), o(this, le, Nt).call(this, true), o(this, ct, js).call(this), o(this, dt, $s).call(this)); + }, ie = /* @__PURE__ */ new WeakSet(), Tt = function() { + var t; + this.alwaysOpen || (this.isListOpened = false, n(this, _) && n(this, A) && (window.removeEventListener("scroll", n(this, _), true), window.removeEventListener("resize", n(this, A))), !n(this, u) || !this.srcElement) || !(this.appendToBody ? document.body.contains(n(this, u).srcElement) : this.srcElement.contains(n(this, u).srcElement)) || (m(this, Q, n(this, u).srcElement.scrollTop), this.appendToBody ? (document.body.removeChild(n(this, u).srcElement), (t = n(this, F)) == null || t.disconnect()) : this.srcElement.removeChild(n(this, u).srcElement), o(this, le, Nt).call(this, false), o(this, ut, Ws).call(this)); + }, rt = /* @__PURE__ */ new WeakSet(), qs = function(e, t) { + if (!n(this, u) || !n(this, p)) + return; + const s = t ? "treeselect-list--top-to-body" : "treeselect-list--top", i = t ? "treeselect-list--bottom-to-body" : "treeselect-list--bottom"; + e ? (n(this, u).srcElement.classList.add(s), n(this, u).srcElement.classList.remove(i), n(this, p).srcElement.classList.add("treeselect-input--top"), n(this, p).srcElement.classList.remove("treeselect-input--bottom")) : (n(this, u).srcElement.classList.remove(s), n(this, u).srcElement.classList.add(i), n(this, p).srcElement.classList.remove("treeselect-input--top"), n(this, p).srcElement.classList.add("treeselect-input--bottom")); + }, j = /* @__PURE__ */ new WeakSet(), he = function(e) { + !n(this, p) || !n(this, u) || (e ? (n(this, p).srcElement.classList.add("treeselect-input--focused"), n(this, u).srcElement.classList.add("treeselect-list--focused")) : (n(this, p).srcElement.classList.remove("treeselect-input--focused"), n(this, u).srcElement.classList.remove("treeselect-list--focused"))); + }, le = /* @__PURE__ */ new WeakSet(), Nt = function(e) { + var t, s, i, a; + e ? (t = n(this, p)) == null || t.srcElement.classList.add("treeselect-input--opened") : (s = n(this, p)) == null || s.srcElement.classList.remove("treeselect-input--opened"), this.staticList ? (i = n(this, u)) == null || i.srcElement.classList.add("treeselect-list--static") : (a = n(this, u)) == null || a.srcElement.classList.remove("treeselect-list--static"); + }, R = /* @__PURE__ */ new WeakSet(), de = function(e) { + !n(this, _) || !n(this, A) || !n(this, L) || !n(this, B) || ((!this.alwaysOpen || e) && (window.removeEventListener("scroll", n(this, _), true), window.removeEventListener("resize", n(this, A))), document.removeEventListener("mousedown", n(this, L), true), document.removeEventListener("focus", n(this, L), true), window.removeEventListener("blur", n(this, B))); + }, ct = /* @__PURE__ */ new WeakSet(), js = function() { + var t, s, i; + const e = (t = n(this, u)) == null ? void 0 : t.isLastFocusedElementExist(); + this.saveScrollPosition && e ? (s = n(this, u)) == null || s.srcElement.scroll(0, n(this, Q)) : (i = n(this, u)) == null || i.focusFirstListElement(); + }, ne = /* @__PURE__ */ new WeakSet(), Ot = function() { + var e; + (e = this.srcElement) == null || e.dispatchEvent(new CustomEvent("input", { detail: this.value })), this.inputCallback && this.inputCallback(this.value); + }, ht = /* @__PURE__ */ new WeakSet(), Rs = function() { + var e; + (e = this.srcElement) == null || e.dispatchEvent(new CustomEvent("name-change", { detail: this.selectedName })), this.nameChangeCallback && this.nameChangeCallback(this.selectedName); + }, dt = /* @__PURE__ */ new WeakSet(), $s = function() { + var e; + this.alwaysOpen || ((e = this.srcElement) == null || e.dispatchEvent(new CustomEvent("open", { detail: this.value })), this.openCallback && this.openCallback(this.value)); + }, ut = /* @__PURE__ */ new WeakSet(), Ws = function() { + var e; + this.alwaysOpen || ((e = this.srcElement) == null || e.dispatchEvent(new CustomEvent("close", { detail: this.value })), this.closeCallback && this.closeCallback(this.value)); + }, pt = /* @__PURE__ */ new WeakSet(), Us = function(e) { + var s; + const t = (e == null ? void 0 : e.trim()) ?? ""; + (s = this.srcElement) == null || s.dispatchEvent(new CustomEvent("search", { detail: t })), this.searchCallback && this.searchCallback(t); + }, mt = /* @__PURE__ */ new WeakSet(), zs = function(e, t) { + var s; + (s = this.srcElement) == null || s.dispatchEvent(new CustomEvent("open-close-group", { detail: { groupId: e, isClosed: t } })), this.openCloseGroupCallback && this.openCloseGroupCallback(e, t); + }; + + // resources/js/components/select-tree.js + function selectTree({ + state, + name, + options, + searchable, + showCount, + placeholder, + rtl, + disabledBranchNode = true, + disabled = false, + isSingleSelect = true, + showTags = true, + clearable = true, + isIndependentNodes = true, + alwaysOpen = false, + emptyText, + expandSelected = true, + grouped = true, + openLevel = 0, + direction = "auto" + }) { + return { + state, + /** @type Treeselect */ + tree: null, + init() { + this.tree = new Gi({ + id: `tree-${name}-id`, + ariaLabel: `tree-${name}-label`, + parentHtmlContainer: this.$refs.tree, + value: this.state ?? [], + options, + searchable, + showCount, + placeholder, + disabledBranchNode, + disabled, + isSingleSelect, + showTags, + clearable, + isIndependentNodes, + alwaysOpen, + emptyText, + expandSelected, + grouped, + openLevel, + direction, + rtl + }); + this.tree.srcElement.addEventListener("input", (e) => { + this.state = e.detail; + }); + } + }; + } + // node_modules/sortablejs/modular/sortable.esm.js function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); @@ -282,7 +1545,7 @@ } else if (el.webkitMatchesSelector) { return el.webkitMatchesSelector(selector); } - } catch (_) { + } catch (_2) { return false; } } @@ -350,9 +1613,9 @@ } function find(ctx, tagName, iterator) { if (ctx) { - var list = ctx.getElementsByTagName(tagName), i = 0, n = list.length; + var list = ctx.getElementsByTagName(tagName), i = 0, n2 = list.length; if (iterator) { - for (; i < n; i++) { + for (; i < n2; i++) { iterator(list[i], i); } } @@ -527,7 +1790,7 @@ return Math.round(rect1.top) === Math.round(rect2.top) && Math.round(rect1.left) === Math.round(rect2.left) && Math.round(rect1.height) === Math.round(rect2.height) && Math.round(rect1.width) === Math.round(rect2.width); } var _throttleTimeout; - function throttle(callback, ms) { + function throttle(callback, ms2) { return function() { if (!_throttleTimeout) { var args = arguments, _this = this; @@ -538,7 +1801,7 @@ } _throttleTimeout = setTimeout(function() { _throttleTimeout = void 0; - }, ms); + }, ms2); } }; } @@ -710,8 +1973,8 @@ plugin[option2] = defaults[option2]; } } - plugins.forEach(function(p) { - if (p.pluginName === plugin.pluginName) { + plugins.forEach(function(p2) { + if (p2.pluginName === plugin.pluginName) { throw "Sortable: Cannot mount plugin ".concat(plugin.pluginName, " more than once"); } }); @@ -1861,8 +3124,8 @@ * @returns {String[]} */ toArray: function toArray() { - var order = [], el, children = this.el.children, i = 0, n = children.length, options = this.options; - for (; i < n; i++) { + var order = [], el, children = this.el.children, i = 0, n2 = children.length, options = this.options; + for (; i < n2; i++) { el = children[i]; if (closest(el, options.draggable, this.el, false)) { order.push(el.getAttribute(options.dataIdAttr) || _generateId(el)); @@ -2105,7 +3368,7 @@ off, css, find, - is: function is(el, selector) { + is: function is2(el, selector) { return !!closest(el, selector, el, false); }, extend, @@ -2487,6 +3750,7 @@ // resources/js/index.js window.SlideOverPanel = panel_default; + window.selectTree = selectTree; document.addEventListener("alpine:init", () => { const theme = localStorage.getItem("theme") ?? "system"; window.Alpine.store( @@ -2522,4 +3786,4 @@ sortablejs/modular/sortable.esm.js: * @license MIT *) */ -//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vcmVzb3VyY2VzL2pzL2NvbXBvbmVudHMvcGFuZWwuanMiLCAiLi4vbm9kZV9tb2R1bGVzL3NvcnRhYmxlanMvbW9kdWxhci9zb3J0YWJsZS5lc20uanMiLCAiLi4vcmVzb3VyY2VzL2pzL2NvbXBvbmVudHMvc29ydGFibGUuanMiLCAiLi4vcmVzb3VyY2VzL2pzL2luZGV4LmpzIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyJjb25zdCBTbGlkZU92ZXJQYW5lbCA9ICgpID0+IHtcbiAgcmV0dXJuIHtcbiAgICBvcGVuOiBmYWxzZSxcbiAgICBzaG93QWN0aXZlQ29tcG9uZW50OiB0cnVlLFxuICAgIGFjdGl2ZUNvbXBvbmVudDogZmFsc2UsXG4gICAgY29tcG9uZW50SGlzdG9yeTogW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hZ1N0YXJ0ZWQpIHtcbiAgICAgICAgaWYgKGZhbGxiYWNrVG9sZXJhbmNlICYmIE1hdGgubWF4KE1hdGguYWJzKHRvdWNoLmNsaWVudFggLSB0aGlzLl9sYXN0WCksIE1hdGguYWJzKHRvdWNoLmNsaWVudFkgLSB0aGlzLl9sYXN0WSkpIDwgZmFsbGJhY2tUb2xlcmFuY2UpIHtcbiAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cbiAgICAgICAgdGhpcy5fb25EcmFnU3RhcnQoZXZ0LCB0cnVlKTtcbiAgICAgIH1cbiAgICAgIGlmIChnaG9zdEVsKSB7XG4gICAgICAgIGlmIChnaG9zdE1hdHJpeCkge1xuICAgICAgICAgIGdob3N0TWF0cml4LmUgKz0gZHggLSAobGFzdER4IHx8IDApO1xuICAgICAgICAgIGdob3N0TWF0cml4LmYgKz0gZHkgLSAobGFzdER5IHx8IDApO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIGdob3N0TWF0cml4ID0ge1xuICAgICAgICAgICAgYTogMSxcbiAgICAgICAgICAgIGI6IDAsXG4gICAgICAgICAgICBjOiAwLFxuICAgICAgICAgICAgZDogMSxcbiAgICAgICAgICAgIGU6IGR4LFxuICAgICAgICAgICAgZjogZHlcbiAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgICAgIHZhciBjc3NNYXRyaXggPSBcIm1hdHJpeChcIi5jb25jYXQoZ2hvc3RNYXRyaXguYSwgXCIsXCIpLmNvbmNhdChnaG9zdE1hdHJpeC5iLCBcIixcIikuY29uY2F0KGdob3N0TWF0cml4LmMsIFwiLFwiKS5jb25jYXQoZ2hvc3RNYXRyaXguZCwgXCIsXCIpLmNvbmNhdChnaG9zdE1hdHJpeC5lLCBcIixcIikuY29uY2F0KGdob3N0TWF0cml4LmYsIFwiKVwiKTtcbiAgICAgICAgY3NzKGdob3N0RWwsICd3ZWJraXRUcmFuc2Zvcm0nLCBjc3NNYXRyaXgpO1xuICAgICAgICBjc3MoZ2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3N0Q2xhc3MsIGZhbHNlKTtcbiAgICAgICAgfVxuICAgICAgICB0b2dnbGVDbGFzcyhkcmFnRWwsIHRoaXMub3B0aW9ucy5jaG9zZW5DbGFzcywgZmFsc2UpO1xuXG4gICAgICAgIC8vIERyYWcgc3RvcCBldmVudFxuICAgICAgICBfZGlzcGF0Y2hFdmVudCh7XG4gICAgICAgICAgc29ydGFibGU6IHRoaXMsXG4gICAgICAgICAgbmFtZTogJ3VuY2hvb3NlJyxcbiAgICAgICAgICB0b0VsOiBwYXJlbnRFbCxcbiAgICAgICAgICBuZXdJbmRleDogbnVsbCxcbiAgICAgICAgICBuZXdEcmFnZ2FibGVJbmRleDogbnVsbCxcbiAgICAgICAgICBvcmlnaW5hbEV2ZW50OiBldnRcbiAgICAgICAgfSk7XG4gICAgICAgIGlmIChyb290RWwgIT09IHBhcmVudEVsKSB7XG4gICAgICAgICAgaWYgKG5ld0luZGV4ID49IDApIHtcbiAgICAgICAgICAgIC8vIEFkZCBldmVudFxuICAgICAgICAgICAgX2Rpc3BhdGNoRXZlbnQoe1xuICAgICAgICAgICAgICByb290RWw6IHBhcmVudEVsLFxuICAgICAgICAgICAgICBuYW1lOiAnYWRkJyxcbiAgICAgICAgICAgICAgdG9FbDogcGFyZW50RWwsXG4gICAgICAgICAgICAgIGZyb21FbDogcm9vdEVsLFxuICAgICAgICAgICAgICBvcmlnaW5hbEV2ZW50OiBldnRcbiAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICAvLyBSZW1vdmUgZXZlbnRcbiAgICAgICAgICAgIF9kaXNwYXRjaEV2ZW50KHtcbiAgICAgICAgICAgICAgc29ydGFibGU6IHRoaXMsXG4gICAgICAgICAgICAgIG5hbWU6ICdyZW1vdmUnLFxuICAgICAgICAgICAgICB0b0VsOiBwYXJlbnRFbCxcbiAgICAgICAgICAgICAgb3JpZ2luYWxFdmVudDogZXZ0XG4gICAgICAgICAgICB9KTtcblxuICAgICAgICAgICAgLy8gZHJhZyBmcm9tIG9uZSBsaXN0IGFuZCBkcm9wIGludG8gYW5vdGhlclxuICAgICAgICAgICAgX2Rpc3BhdGNoRXZlbnQoe1xuICAgICAgICAgICAgICByb290RWw6IHBhcmVudEVsLFxuICAgICAgICAgICAgICBuYW1lOiAnc29ydCcsXG4gICAgICAgICAgICAgIHRvRWw6IHBhcmVudEVsLFxuICAgICAgICAgICAgICBmcm9tRWw6IHJvb3RFbCxcbiAgICAgICAgICAgICAgb3JpZ2luYWxFdmVudDogZXZ0XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIF9kaXNwYXRjaEV2ZW50KHtcbiAgICAgICAgICAgICAgc29ydGFibGU6IHRoaXMsXG4gICAgICAgICAgICAgIG5hbWU6ICdzb3J0JyxcbiAgICAgICAgICAgICAgdG9FbDogcGFyZW50RWwsXG4gICAgICAgICAgICAgIG9yaWdpbmFsRXZlbnQ6IGV2dFxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgfVxuICAgICAgICAgIHB1dFNvcnRhYmxlICYmIHB1dFNvcnRhYmxlLnNhdmUoKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBpZiAobmV3SW5kZXggIT09IG9sZEluZGV4KSB7XG4gICAgICAgICAgICBpZiAobmV3SW5kZXggPj0gMCkge1xuICAgICAgICAgICAgICAvLyBkcmFnICYgZHJvcCB3aXRoaW4gdGhlIHNhbWUgbGlzdFxuICAgICAgICAgICAgICBfZGlzcGF0Y2hFdmVudCh7XG4gICAgICAgICAgICAgICAgc29ydGFibGU6IHRoaXMsXG4gICAgICAgICAgICAgICAgbmFtZTogJ3VwZGF0ZScsXG4gICAgICAgICAgICAgICAgdG9FbDogcGFyZW50RWwsXG4gICAgICAgICAgICAgICAgb3JpZ2luYWxFdmVudDogZXZ0XG4gICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICBfZGlzcGF0Y2hFdmVudCh7XG4gICAgICAgICAgICAgICAgc29ydGFibGU6IHRoaXMsXG4gICAgICAgICAgICAgICAg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uICAgICAgICAgIGlmICghZm9sZGluZykge1xuICAgICAgICAgICAgcmVtb3ZlTXVsdGlEcmFnRWxlbWVudHMoKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgaWYgKG11bHRpRHJhZ0VsZW1lbnRzLmxlbmd0aCA+IDEpIHtcbiAgICAgICAgICAgIHZhciBjbG9uZXNIaWRkZW5CZWZvcmUgPSBjbG9uZXNIaWRkZW47XG4gICAgICAgICAgICBhY3RpdmVTb3J0YWJsZS5fc2hvd0Nsb25lKHNvcnRhYmxlKTtcblxuICAgICAgICAgICAgLy8gVW5mb2xkIGFuaW1hdGlvbiBmb3IgY2xvbmVzIGlmIHNob3dpbmcgZnJvbSBoaWRkZW5cbiAgICAgICAgICAgIGlmIChhY3RpdmVTb3J0YWJsZS5vcHRpb25zLmFuaW1hdGlvbiAmJiAhY2xvbmVzSGlkZGVuICYmIGNsb25lc0hpZGRlbkJlZm9yZSkge1xuICAgICAgICAgICAgICBtdWx0aURyYWdDbG9uZXMuZm9yRWFjaChmdW5jdGlvbiAoY2xvbmUpIHtcbiAgICAgICAgICAgICAgICBhY3RpdmVTb3J0YWJsZS5hZGRBbmltYXRpb25TdGF0ZSh7XG4gICAgICAgICAgICAgICAgICB0YXJnZXQ6IGNsb25lLFxuICAgICAgICAgICAgICAgICAgcmVjdDogY2xvbmVzRnJvbVJlY3RcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICBjbG9uZS5mcm9tUmVjdCA9IGNsb25lc0Zyb21SZWN0O1xuICAgICAgICAgICAgICAgIGNsb25lLnRoaXNBbmltYXRpb25EdXJhdGlvbiA9IG51bGw7XG4gICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBhY3RpdmVTb3J0YWJsZS5fc2hvd0Nsb25lKHNvcnRhYmxlKTtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuICAgIGRyY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XG4gICAgICAgICAgZGlzcGF0Y2hFdmVudCh7XG4gICAgICAgICAgICBzb3J0YWJsZTogc29ydGFibGUsXG4gICAgICAgICAgICByb290RWw6IHJvb3RFbCxcbiAgICAgICAgICAgIG5hbWU6ICdzZWxlY3QnLFxuICAgICAgICAgICAgdGFyZ2V0RWw6IGRyYWdFbCQxLFxuICAgICAgICAgICAgb3JpZ2luYWxFdmVudDogZXZ0XG4gICAgICAgICAgfSk7XG5cbiAgICAgICAgICAvLyBNb2RpZmllciBhY3RpdmF0ZWQsIHNlbGVjdCBmcm9tIGxhc3QgdG8gZHJhZ0VsXG4gICAgICAgICAgaWYgKGV2dC5zaGlmdEtleSAmJiBsYXN0TXVsdGlEcmFnU2VsZWN0ICYmIHNvcnRhYmxlLmVsLmNvbnRhaW5zKGxhc3RNdWx0aURyYWdTZWxlY3QpKSB7XG4gICAgICAgICAgICB2YXIgbGFzdEluZGV4ID0gaW5kZXgobGFzdE11bHRpRHJhZ1NlbGVjdCksXG4gICAgICAgICAgICAgIGN1cnJlbnRJbmRleCA9IGluZGV4KGRyYWdFbCQxKTtcbiAgICAgICAgICAgIGlmICh+bGFzdEluZGV4ICYmIH5jdXJyZW50SW5kZXggJiYgbGFzdEluZGV4ICE9PSBjdXJyZW50SW5kZXgpIHtcbiAgICAgICAgICAgICAgLy8gTXVzdCBpbmNsdWRlIGxhc3RNdWx0aURyYWdTZWxlY3QgKHNlbGVjdCBpdCksIGluIGNhc2UgbW9kaWZpZWQgc2VsZWN0aW9uIGZyb20gbm8gc2VsZWN0aW9uXG4gICAgICAgICAgICAgIC8vIChidXQgcHJldmlvdXMgc2VsZWN0aW9uIGV4aXN0ZWQpXG4gICAgICAgICAgICAgIHZhciBuLCBpO1xuICAgICAgICAgICAgICBpZiAoY3VycmVudEluZGV4ID4gbGFzdEluZGV4KSB7XG4gICAgICAgICAgICAgICAgaSA9IGxhc3RJbmRleDtcbiAgICAgICAgICAgICAgICBuID0gY3VycmVudEluZGV4O1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGkgPSBjdXJyZW50SW5kZXg7XG4gICAgICAgICAgICAgICAgbiA9IGxhc3RJbmRleCArIDE7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgZm9yICg7IGkgPCBuOyBpKyspIHtcbiAgICAgICAgICAgICAgICBpZiAofm11bHRpRHJhZ0VsZW1lbnRzLmluZGV4T2YoY2hpbGRyZW5baV0pKSBjb250aW51ZTtcbiAgICAgICAgICAgICAgICB0b2dnbGVDbGFzcyhjaGlsZHJlbltpXSwgb3B0aW9ucy5zZWxlY3RlZENsYXNzLCB0cnVlKTtcbiAgICAgICAgICAgICAgICBtdWx0aURyYWdFbGVtZW50cy5wdXNoKGNoaWxkcmVuW2ldKTtcbiAgICAgICAgICAgICAgICBkaXNwYXRjaEV2ZW50KHtcbiAgICAgICAgICAgICAgICAgIHNvcnRhYmxlOiBzb3J0YWJsZSxcbiAgICAgICAgICAgICAgICAgIHJvb3RFbDogcm9vdEVsLFxuICAgICAgICAgICAgICAgICAgbmFtZTogJ3NlbGVjdCcsXG4gICAgICAgICAgICAgICAgICB0YXJnZXRFbDogY2hpbGRyZW5baV0sXG4gICAgICAgICAgICAgICAgICBvcmlnaW5hbEV2ZW50OiBldnRcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBsYXN0TXVsdGlEcmFnU2VsZWN0ID0gZHJhZ0VsJDE7XG4gICAgICAgICAgfVxuICAgICAgICAgIG11bHRpRHJhZ1NvcnRhYmxlID0gdG9Tb3J0YWJsZTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBtdWx0aURyYWdFbGVtZW50cy5zcGxpY2UobXVsdGlEcmFnRWxlbWVudHMuaW5kZXhPZihkcmFnRWwkMSksIDEpO1xuICAgICAgICAgIGxhc3RNdWx0aURyYWdTZWxlY3QgP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ge1xuICAgICAgICAgICAgICBkcmFnRWwkMS5mcm9tUmVjdCA9IGRyYWdSZWN0O1xuICAgICAgICAgICAgICBtdWx0aURyYWdFbGVtZW50cy5mb3JFYWNoKGZ1bmN0aW9uIChtdWx0aURyYWdFbGVtZW50KSB7XG4gICAgICAgICAgICAgICAgbXVsdGlEcmFnRWxlbWVudC50aGlzQW5pbWF0aW9uRHVyYXRpb24gPSBudWxsO1xuICAgICAgICAgICAgICAgIGlmIChtdWx0aURyYWdFbGVtZW50ICE9PSBkcmFnRWwkMSkge1xuICAgICAgICAgICAgICAgICAgdmFyIHJlY3QgPSBmb2xkaW5nID8gZ2V0UmVjdChtdWx0aURyYWdFbGVtZW50KSA6IGRyYWdSZWN0O1xuICAgICAgICAgICAgICAgICAgbXVsdGlEcmFnRWxlbWVudC5mcm9tUmVjdCA9IHJlY3Q7XG5cbiAgICAgICAgICAgICAgICAgIC8vIFByZXBhcmUgdW5mb2xkIGFuaW1hdGlvblxuICAgICAgICAgICAgICAgICAgdG9Tb3J0YWJsZS5hZGRBbmltYXRpb25TdGF0ZSh7XG4gICAgICAgICAgICAgICAgICAgIHRhcmdldDogbXVsdGlEcmFnRWxlbWVudCxcbiAgICAgICAgICAgICAgICAgICAgcmVjdDogcmVjdFxuICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gTXVsdGkgZHJhZyBlbGVtZW50cyBhcmUgbm90IG5lY2Vzc2FyaWx5IHJlbW92ZWQgZnJvbSB0aGUgRE9NIG9uIGRyb3AsIHNvIHRvIHJlaW5zZXJ0XG4gICAgICAgICAgICAvLyBwcm9wZXJseSB0aGV5IG11c3QgYWxsIGJlIHJlbW92ZWRcbiAgICAgICAgICAgIHJlbW92ZU11bHRpRHJhZ0VsZW1lbnRzKCk7XG4gICAgICAgICAgICBtdWx0aURyYWdFbGVtZW50cy5mb3JFYWNoKGZ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gICAgICAgIHZhciBuZXdJbmRleDtcbiAgICAgICAgaWYgKGZvbGRpbmcgJiYgbXVsdGlEcmFnRWxlbWVudCAhPT0gZHJhZ0VsJDEpIHtcbiAgICAgICAgICBuZXdJbmRleCA9IC0xO1xuICAgICAgICB9IGVsc2UgaWYgKGZvbGRpbmcpIHtcbiAgICAgICAgICBuZXdJbmRleCA9IGluZGV4KG11bHRpRHJhZ0VsZW1lbnQsICc6bm90KC4nICsgX3RoaXMzLm9wdGlvbnMuc2VsZWN0ZWRDbGFzcyArICcpJyk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgbmV3SW5kZXggPSBpbmRleChtdWx0aURyYWdFbGVtZW50KTtcbiAgICAgICAgfVxuICAgICAgICBuZXdJbmRpY2llcy5wdXNoKHtcbiAgICAgICAgICBtdWx0aURyYWdFbGVtZW50OiBtdWx0aURyYWdFbGVtZW50LFxuICAgICAgICAgIGluZGV4OiBuZXdJbmRleFxuICAgICAgICB9KTtcbiAgICAgIH0pO1xuICAgICAgcmV0dXJuIHtcbiAgICAgICAgaXRlbXM6IF90b0NvbnN1bWFibGVBcnJheShtdWx0aURyYWdFbGVtZW50cyksXG4gICAgICAgIGNsb25lczogW10uY29uY2F0KG11bHRpRHJhZ0Nsb25lcyksXG4gICAgICAgIG9sZEluZGljaWVzOiBvbGRJbmRpY2llcyxcbiAgICAgICAgbmV3SW5kaWNpZXM6IG5ld0luZGljaWVzXG4gICAgICB9O1xuICAgIH0sXG4gICAgb3B0aW9uTGlzdGVuZXJzOiB7XG4gICAgICBtdWx0aURyYWdLZXk6IGZ1bmN0aW9uIG11bHRpRHJhZ0tleShrZXkpIHtcbiAgICAgICAga2V5ID0ga2V5LnRvTG93ZXJDYXNlKCk7XG4gICAgICAgIGlmIChrZXkgPT09ICdjdHJsJykge1xuICAgICAgICAgIGtleSA9ICdDb250cm9sJztcbiAgICAgICAgfSBlbHNlIGlmIChrZXkubGVuZ3RoID4gMSkge1xuICAgICAgICAgIGtleS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BlbkNsb3NlR3JvdXBDYWxsYmFjazogb2lcbiAgfSkge1xuICAgIHIodGhpcywgZWUpO1xuICAgIHIodGhpcywgdGUpO1xuICAgIHIodGhpcywgWmUpO1xuICAgIHIodGhpcywgUWUpO1xuICAgIHIodGhpcywgZXQpO1xuICAgIHIodGhpcywgdHQpO1xuICAgIHIodGhpcywgc3QpO1xuICAgIHIodGhpcywgaXQpO1xuICAgIHIodGhpcywgc2UpO1xuICAgIHIodGhpcywgbHQpO1xuICAgIHIodGhpcywgbnQpO1xuICAgIHIodGhpcywgYXQpO1xuICAgIHIodGhpcywgb3QpO1xuICAgIHIodGhpcywgaWUpO1xuICAgIHIodGhpcywgcnQpO1xuICAgIHIodGhpcywgaik7XG4gICAgcih0aGlzLCBsZSk7XG4gICAgcih0aGlzLCBSKTtcbiAgICByKHRoaXMsIGN0KTtcbiAgICAvLyBFbWl0c1xuICAgIHIodGhpcywgbmUpO1xuICAgIHIodGhpcywgaHQpO1xuICAgIHIodGhpcywgZHQpO1xuICAgIHIodGhpcywgdXQpO1xuICAgIHIodGhpcywgcHQpO1xuICAgIHIodGhpcywgbXQpO1xuICAgIC8vIFByb3BzXG4gICAgYyh0aGlzLCBcInBhcmVudEh0bWxDb250YWluZXJcIik7XG4gICAgYyh0aGlzLCBcInZhbHVlXCIpO1xuICAgIGModGhpcywgXCJvcHRpb25zXCIpO1xuICAgIGModGhpcywgXCJvcGVuTGV2ZWxcIik7XG4gICAgYyh0aGlzLCBcImFwcGVuZFRvQm9keVwiKTtcbiAgICBjKHRoaXMsIFwiYWx3YXlzT3BlblwiKTtcbiAgICBjKHRoaXMsIFwic2hvd1RhZ3NcIik7XG4gICAgYyh0aGlzLCBcInRhZ3NDb3VudFRleHRcIik7XG4gICAgYyh0aGlzLCBcImNsZWFyYWJsZVwiKTtcbiAgICBjKHRoaXMsIFwic2VhcmNoYWJsZVwiKTtcbiAgICBjKHRoaXMsIFwicGxhY2Vob2xkZXJcIik7XG4gICAgYyh0aGlzLC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CB0aW1lKTtcbiAgICAgICAgICBjbGVhclRpbWVvdXQodGFyZ2V0LmFuaW1hdGlvblJlc2V0VGltZXIpO1xuICAgICAgICAgIHRhcmdldC5hbmltYXRpb25SZXNldFRpbWVyID0gc2V0VGltZW91dChmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICB0YXJnZXQuYW5pbWF0aW9uVGltZSA9IDA7XG4gICAgICAgICAgICB0YXJnZXQucHJldkZyb21SZWN0ID0gbnVsbDtcbiAgICAgICAgICAgIHRhcmdldC5mcm9tUmVjdCA9IG51bGw7XG4gICAgICAgICAgICB0YXJnZXQucHJldlRvUmVjdCA9IG51bGw7XG4gICAgICAgICAgICB0YXJnZXQudGhpc0FuaW1hdGlvbkR1cmF0aW9uID0gbnVsbDtcbiAgICAgICAgICB9LCB0aW1lKTtcbiAgICAgICAgICB0YXJnZXQudGhpc0FuaW1hdGlvbkR1cmF0aW9uID0gdGltZTtcbiAgICAgICAgfVxuICAgICAgfSk7XG4gICAgICBjbGVhclRpbWVvdXQoYW5pbWF0aW9uQ2FsbGJhY2tJZCk7XG4gICAgICBpZiAoIWFuaW1hdGluZykge1xuICAgICAgICBpZiAodHlwZW9mIGNhbGxiYWNrID09PSAnZnVuY3Rpb24nKSBjYWxsYmFjaygpO1xuICAgICAgfSBlbHNlIHtcbiAgICAgICAgYW5pbWF0aW9uQ2FsbGJhY2tJZCA9IHNldFRpbWVvdXQoZnVuY3Rpb24gKCkge1xuICAgICAgICAgIGlmICh0eXBlb2YgY2FsbGJhY2sgPT09ICdmdW5jdGlvbicpIGNhbGxiYWNrKCk7XG4gICAgICAgIH0sIGFuaW1hdGlvblRpbWUpO1xuICAgICAgfVxuICAgICAgYW5pbWF0aW9uU3RhdGVzID0gW107XG4gICAgfSxcbiAgICBhbmltYXRlOiBmdW5jdGlvbiBhbmltYXRlKHRhcmdldCwgY3VycmVudFJlY3QsIHRvUmVjdCwgZHVyYXRpb24pIHtcbiAgICAgIGlmIChkdXJhdGlvbikge1xu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ZSAodGFyZ2V0ICYmIHRhcmdldC5zaGFkb3dSb290KSB7XG4gICAgICAgIHRhcmdldCA9IHRhcmdldC5zaGFkb3dSb290LmVsZW1lbnRGcm9tUG9pbnQodG91Y2hFdnQuY2xpZW50WCwgdG91Y2hFdnQuY2xpZW50WSk7XG4gICAgICAgIGlmICh0YXJnZXQgPT09IHBhcmVudCkgYnJlYWs7XG4gICAgICAgIHBhcmVudCA9IHRhcmdldDtcbiAgICAgIH1cbiAgICAgIGRyYWdFbC5wYXJlbnROb2RlW2V4cGFuZG9dLl9pc091dHNpZGVUaGlzRWwodGFyZ2V0KTtcbiAgICAgIGlmIChwYXJlbnQpIHtcbiAgICAgICAgZG8ge1xuICAgICAgICAgIGlmIChwYXJlbnRbZXhwYW5kb10pIHtcbiAgICAgICAgICAgIHZhciBpbnNlcnRlZCA9IHZvaWQgMDtcbiAgICAgICAgICAgIGluc2VydGVkID0gcGFyZW50W2V4cGFuZG9dLl9vbkRyYWdPdmVyKHtcbiAgICAgICAgICAgICAgY2xpZW50WDogdG91Y2hFdnQuY2xpZW50WCxcbiAgICAgICAgICAgICAgY2xpZW50WTogdG91Y2hFdnQuY2xpZW50WSxcbiAgICAgICAgICAgICAgdGFyZ2V0OiB0YXJnZXQsXG4gICAgICAgICAgICAgIHJvb3RFbDogcGFyZW50XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIGlmIChpbnNlcnRlZCAmJiAhdGhpcy5vcHRpb25zLmRyYWdvdmVyQnViYmxlKSB7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgICB0YXJnZXQgPSBwYXJlbnQ7IC8vIHN0b3JlIGxhc3QgZWxlbWVudFxuICAgICAgICB9XG4gICAgICAgIC8qIGpzaGludCBib3NzOnRydWUgKi8gd2hpbGUgKHBhcmVudCA9IHBhcmVudC5wYXJlbnROb2RlKTtcbiAgICAgIH1cbiAgICAgIF91bmhpZGVHaG9zdEZv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gICAgICAgICAgIGZyb21FbDogcm9vdEVsLFxuICAgICAgICAgICAgICBvcmlnaW5hbEV2ZW50OiBldnRcbiAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICAvLyBSZW1vdmUgZXZlbnRcbiAgICAgICAgICAgIF9kaXNwYXRjaEV2ZW50KHtcbiAgICAgICAgICAgICAgc29ydGFibGU6IHRoaXMsXG4gICAgICAgICAgICAgIG5hbWU6ICdyZW1vdmUnLFxuICAgICAgICAgICAgICB0b0VsOiBwYXJlbnRFbCxcbiAgICAgICAgICAgICAgb3JpZ2luYWxFdmVudDogZXZ0XG4gICAgICAgICAgICB9KTtcblxuICAgICAgICAgICAgLy8gZHJhZyBmcm9tIG9uZSBsaXN0IGFuZCBkcm9wIGludG8gYW5vdGhlclxuICAgICAgICAgICAgX2Rpc3BhdGNoRXZlbnQoe1xuICAgICAgICAgICAgICByb290RWw6IHBhcmVudEVsLFxuICAgICAgICAgICAgICBuYW1lOiAnc29ydCcsXG4gICAgICAgICAgICAgIHRvRWw6IHBhcmVudEVsLFxuICAgICAgICAgICAgICBmcm9tRWw6IHJvb3RFbCxcbiAgICAgICAgICAgICAgb3JpZ2luYWxFdmVudDogZXZ0XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIF9kaXNwYXRjaEV2ZW50KHtcbiAgICAgICAgICAgICAgc29ydGFibGU6IHRoaXMsXG4gICAgICAgICAgICAgIG5hbWU6ICdzb3J0JyxcbiAgICAgICAgICAgICAgdG9FbDogcGFyZW50RWwsXG4gICAgICAgICAgICAgIG9yaWdpbmFsRXZlbnQ6IGV2dFxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgfVxuICAgICAgICAgIHB1dFNvcnRhYmxlICYmIHB1dFNvcnRhYmxlLnNhdmUoKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBpZiAobmV3SW5kZXggIT09IG9sZEluZGV4KSB7XG4gICAgICAgICAgICBpZiAobmV3SW5kZXggPj0gMCkge1xuICAgICAgICAgICAgICAvLyBkcmFnICYgZHJvcCB3aXRoaW4gdGhlIHNhbWUgbGlzdFxuICAgICAgICAgICAgICBfZGlzcGF0Y2hFdmVudCh7XG4gICAgICAgICAgICAgICAgc29ydGFibGU6IHRoaXMsXG4gICAgICAgICAgICAgICAgbmFtZTogJ3VwZGF0ZScsXG4gICAgICAgICAgICAgICAgdG9FbDogcGFyZW50RWwsXG4gICAgICAgICAgICAgICAgb3JpZ2luYWxFdmVudDogZXZ0XG4gICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICBfZGlzcGF0Y2hFdmVudCh7XG4gICAgICAgICAgICAgICAgc29ydGFibGU6IHRoaXMsXG4gICAgICAgICAgICAgICAgbmFtZTogJ3NvcnQnLFxuICAgICAgICAgICAgICAgIHRvRWw6IHBhcmVudEVsLFxuICAgICAgICAgICAgICAgIG9yaWdpbmFsRXZlbnQ6IGV2dFxuICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKFNvcnRhYmxlLmFjdGl2ZSkge1xuICAgICAgICAgIC8qIGpzaGludCBlcW51bGw6dHJ1ZSAqL1xuICAgICAgICAgIGlmIChuZXdJbmRleCA9PSBudWxsIHx8IG5ld0luZGV4ID09PSAtMSkge1xuICAgICAgICAgICAgbmV3SW5kZXggPSBvbGRJbmRleDtcbiAgICAgICAgICAgIG5ld0RyYWdnYWJsZUluZGV4ID0gb2xkRHJhZ2dhYmxlSW5kZXg7XG4gICAgICAgICAgfVxuICAgICAgICAgIF9kaXNwYXRjaEV2ZW50KHtcbiAgICAgICAgICAgIHNvcnRhYmxlOiB0aGlzLFxuICAgICAgICAgICAgbmFtZTogJ2VuZCcsXG4gICAgICAgICAgICB0b0VsOiBwYXJlbnRFbCxcbiAgICAgICAgICAgIG9yaWdpbmFsRXZlbnQ6IGV2dFxuICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgLy8gU2F2ZSBzb3J0aW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IHtcbiAgICAgICAgICAgICAgLy8gTXVzdCBpbmNsdWRlIGxhc3RNdWx0aURyYWdTZWxlY3QgKHNlbGVjdCBpdCksIGluIGNhc2UgbW9kaWZpZWQgc2VsZWN0aW9uIGZyb20gbm8gc2VsZWN0aW9uXG4gICAgICAgICAgICAgIC8vIChidXQgcHJldmlvdXMgc2VsZWN0aW9uIGV4aXN0ZWQpXG4gICAgICAgICAgICAgIHZhciBuLCBpO1xuICAgICAgICAgICAgICBpZiAoY3VycmVudEluZGV4ID4gbGFzdEluZGV4KSB7XG4gICAgICAgICAgICAgICAgaSA9IGxhc3RJbmRleDtcbiAgICAgICAgICAgICAgICBuID0gY3VycmVudEluZGV4O1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGkgPSBjdXJyZW50SW5kZXg7XG4gICAgICAgICAgICAgICAgbiA9IGxhc3RJbmRleCArIDE7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgZm9yICg7IGkgPCBuOyBpKyspIHtcbiAgICAgICAgICAgICAgICBpZiAofm11bHRpRHJhZ0VsZW1lbnRzLmluZGV4T2YoY2hpbGRyZW5baV0pKSBjb250aW51ZTtcbiAgICAgICAgICAgICAgICB0b2dnbGVDbGFzcyhjaGlsZHJlbltpXSwgb3B0aW9ucy5zZWxlY3RlZENsYXNzLCB0cnVlKTtcbiAgICAgICAgICAgICAgICBtdWx0aURyYWdFbGVtZW50cy5wdXNoKGNoaWxkcmVuW2ldKTtcbiAgICAgICAgICAgICAgICBkaXNwYXRjaEV2ZW50KHtcbiAgICAgICAgICAgICAgICAgIHNvcnRhYmxlOiBzb3J0YWJsZSxcbiAgICAgICAgICAgICAgICAgIHJvb3RFbDogcm9vdEVsLFxuICAgICAgICAgICAgICAgICAgbmFtZTogJ3NlbGVjdCcsXG4gICAgICAgICAgICAgICAgICB0YXJnZXRFbDogY2hpbGRyZW5baV0sXG4gICAgICAgICAgICAgICAgICBvcmlnaW5hbEV2ZW50OiBldnRcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBsYXN0TXVsdGlEcmFnU2VsZWN0ID0gZHJhZ0VsJDE7XG4gICAgICAgICAgfVxuICAgICAgICAgIG11bHRpRHJhZ1NvcnRhYmxlID0gdG9Tb3J0YWJsZTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBtdWx0aURyYWdFbGVtZW50cy5zcGxpY2UobXVsdGlEcmFnRWxlbWVudHMuaW5kZXhPZihkcmFnRWwkMSksIDEpO1xuICAgICAgICAgIGxhc3RNdWx0aURyYWdTZWxlY3QgPSBudWxsO1xuICAgICAgICAgIGRpc3BhdGNoRXZlbnQoe1xuICAgICAgICAgICAgc29ydGFibGU6IHNvcnRhYmxlLFxuICAgICAgICAgICAgcm9vdEVsOiByb290RWwsXG4gICAgICAgICAgICBuYW1lOiAnZGVzZWxlY3QnLFxuICAgICAgICAgICAgdGFyZ2V0RWw6IGRyYWdFbCQxLFxuICAgICAgICAgICAgb3JpZ2luYWxFdmVudDogZXZ0XG4gICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgLy8gTXVsdGktZHJhZyBkcm9wXG4gICAgICBpZiAoZHJhZ1N0YXJ0ZWQgJiYgdGhpcy5pc011bHRpRHJhZykge1xuICAgICAgICBmb2xkaW5nID0gZmFsc2U7XG4gICAgICAgIC8vIERvIG5vdCBcInVuZm9sZFwiIGFmdGVyIGFyb3VuZCBkcmFnRWwgaWYgcmV2ZXJ0ZWRcbiAgICAgICAgaWYgKChwYXJlbnRFbFtleHBhbmRvXS5vcHRpb25zLnNvcnQgfHwgcGFyZW50RWwgIT09IHJvb3RFbCkgJiYgbXVsdGlEcmFnRWxlbWVudHMubGVuZ3RoID4gMSkge1xuICAgICAgICAgIHZhciBkcmFnUmVjdCA9IGdldFJlY3QoZHJhZ0VsJDEpLFxuICAgICAgICAgICAgbXVsdGlEcmFnSW5kZXggPSBpbmRleChkcmFnRWwkMSwgJzpub3QoLicgKyB0aGlzLm9wdGlvbnMuc2VsZWN0ZWRDbGFzcyArICcpJyk7XG4gICAgICAgICAgaWYgKCFpbml0aWFsRm9sZGluZyAmJiBvcHRpb25zLmFuaW1hdGlvbikgZHJhZ0VsJDEudGhpc0FuaW1hdGlvbkR1cmF0aW9uID0gbnVsbDtcbiAgICAgICAgICB0b1NvcnRhYmxlLmNhcHR1cmVBbmltYXRpb25TdGF0ZSgpO1xuICAgICAgICAgIGlmICghaW5pdGlhbEZvbGRpbmcpIHtcbiAgICAgICAgICAgIGlmIChvcHRpb25zLmFuaW1hdGlvbikge1xuICAgICAgICAgICAgICBkcmFnRWwkMS5mcm9tUmVjdCA9IGRyYWdSZWN0O1xuICAgICAgICAgICAgICBtdWx0aURyYWdFbGVtZW50cy5mb3JFYWNoKGZ1bmN0aW9uIChtdWx0aURyYWdFbGVtZW50KSB7XG4gICAgICAgICAgICAgICAgbXVsdGlEcmFnRWxlbWVudC50aGlzQW5pbWF0aW9uRHVyYXRpb24gPSBudWxsO1xuICAgICAgICAgICAgICAgIGlmIChtdWx0aURyYWdFbGVtZW50ICE9PSBkcmFnRWwkMSkge1xuICAgICAgICAgICAgICAgICAgdmFyIHJlY3QgPSBmb2xkaW5nID8gZ2V0UmVjdChtdWx0aURyYWdFbGVtZW50KSA6IGRyYWdSZWN0O1xuICAgICAgICAgICAgICAgICAgbXVsdGlEcmFnRWxlbWVudC5mcm9tUmVjdCA9IHJlY3Q7XG5cbiAgICAgICAgICAgICAgICAgIC8vIFByZXBhcmUgdW5mb2xkIGFuaW1hdGlvblxuICAgICAgICAgICAgICAgICAgdG9Tb3J0YWJsZS5hZGRBbmltYXRpb25TdGF0ZSh7XG4gICAgICAgICAgICAgICAgICAgIHRhcmdldDogbXVsdGlEcmFnRWxlbWVudCxcbiAgICAgICAgICAgICAgICAgICAgcmVjdDogcmVjdFxuICAgICAgIC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CBiZSBmaXJlZCBoZXJlIGFzIFNvcnRhYmxlIHdpbGwgbm90LlxuICAgICAgICAgICAgaWYgKG9sZEluZGV4ID09PSBpbmRleChkcmFnRWwkMSkpIHtcbiAgICAgICAgICAgICAgdmFyIHVwZGF0ZSA9IGZhbHNlO1xuICAgICAgICAgICAgICBtdWx0aURyYWdFbGVtZW50cy5mb3JFYWNoKGZ1bmN0aW9uIChtdWx0aURyYWdFbGVtZW50KSB7XG4gICAgICAgICAgICAgICAgaWYgKG11bHRpRHJhZ0VsZW1lbnQuc29ydGFibGVJbmRleCAhPT0gaW5kZXgobXVsdGlEcmFnRWxlbWVudCkpIHtcbiAgICAgICAgICAgICAgICAgIHVwZGF0ZSA9IHRydWU7XG4gICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgaWYgKHVwZGF0ZSkge1xuICAgICAgICAgICAgICAgIGRpc3BhdGNoU29ydGFibGVFdmVudCgndXBkYXRlJyk7XG4gICAgICAgICAgICAgICAgZGlzcGF0Y2hTb3J0YWJsZUV2ZW50KCdzb3J0Jyk7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG5cbiAgICAgICAgICAvLyBNdXN0IGJlIGRvbmUgYWZ0ZXIgY2FwdHVyaW5nIGluZGl2aWR1YWwgcmVjdHMgKHNjcm9sbCBiYXIpXG4gICAgICAgICAgbXVsdGlEcmFnRWxlbWVudHMuZm9yRWFjaChmdW5jdGlvbiAobXVsdGlEcmFnRWxlbWVudCkge1xuICAgICAgICAgICAgdW5zZXRSZWN0KG11bHRpRHJhZ0VsZW1lbnQpO1xuICAgICAgICAgIH0pO1xuICAgICAgICAgIHRvU29ydGFibGUuYW5pbWF0ZUFsbCgpO1xuICAgICAgICB9XG4gICAgICAgIG11bHRpRHJhZ1NvcnRhYmxlID0gdG9Tb3J0YWJsZTtcbiAgICAgIH1cblxuICAgICA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FtdLFxuICAgICAgICBuZXdJbmRpY2llcyA9IFtdO1xuICAgICAgbXVsdGlEcmFnRWxlbWVudHMuZm9yRWFjaChmdW5jdGlvbiAobXVsdGlEcmFnRWxlbWVudCkge1xuICAgICAgICBvbGRJbmRpY2llcy5wdXNoKHtcbiAgICAgICAgICBtdWx0aURyYWdFbGVtZW50OiBtdWx0aURyYWdFbGVtZW50LFxuICAgICAgICAgIGluZGV4OiBtdWx0aURyYWdFbGVtZW50LnNvcnRhYmxlSW5kZXhcbiAgICAgICAgfSk7XG5cbiAgICAgICAgLy8gbXVsdGlEcmFnRWxlbWVudHMgd2lsbCBhbHJlYWR5IGJlIHNvcnRlZCBpZiBmb2xkaW5nXG4gICAgICAgIHZhciBuZXdJbmRleDtcbiAgICAgICAgaWYgKGZvbGRpbmcgJiYgbXVsdGlEcmFnRWxlbWVudCAhPT0gZHJhZ0VsJDEpIHtcbiAgICAgICAgICBuZXdJbmRleCA9IC0xO1xuICAgICAgICB9IGVsc2UgaWYgKGZvbGRpbmcpIHtcbiAgICAgICAgICBuZXdJbmRleCA9IGluZGV4KG11bHRpRHJhZ0VsZW1lbnQsICc6bm90KC4nICsgX3RoaXMzLm9wdGlvbnMuc2VsZWN0ZWRDbGFzcyArICcpJyk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgbmV3SW5kZXggPSBpbmRleChtdWx0aURyYWdFbGVtZW50KTtcbiAgICAgICAgfVxuICAgICAgICBuZXdJbmRpY2llcy5wdXNoKHtcbiAgICAgICAgICBtdWx0aURyYWdFbGVtZW50OiBtdWx0aURyYWdFbGVtZW50LFxuICAgICAgICAgIGluZGV4OiBuZXdJbmRleFxuICAgICAgICB9KTtcbiAgICAgIH0pO1xuICAgICAgcmV0dXJuIHtcbiAgICAgICAgaXRlbXM6IF90b0NvbnN1bWFibGVBcnJheShtdWx0aURyYWdFbGVtZW50cyksXG4gICAgICAgIGNsb25lczogW10uY29uY2F0KG11bHRpRHJhZ0Nsb25lcyksXG4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WVzIjogWyJpZCIsICJvYmoiLCAiXyIsICJuIiwgImluZGV4IiwgIm1zIiwgImdob3N0RWwiLCAib3B0aW9uIiwgInAiLCAiZGVmYXVsdHMiLCAicm9vdEVsIiwgImNsb25lRWwiLCAib2xkSW5kZXgiLCAibmV3SW5kZXgiLCAib2xkRHJhZ2dhYmxlSW5kZXgiLCAibmV3RHJhZ2dhYmxlSW5kZXgiLCAicHV0U29ydGFibGUiLCAicGx1Z2luRXZlbnQiLCAiX2RldGVjdERpcmVjdGlvbiIsICJfZHJhZ0VsSW5Sb3dDb2x1bW4iLCAiX2RldGVjdE5lYXJlc3RFbXB0eVNvcnRhYmxlIiwgIl9wcmVwYXJlR3JvdXAiLCAiZHJhZ0VsIiwgIl9oaWRlR2hvc3RGb3JUYXJnZXQiLCAiX3VuaGlkZUdob3N0Rm9yVGFyZ2V0IiwgIm5lYXJlc3RFbXB0eUluc2VydERldGVjdEV2ZW50IiwgIl9jaGVja091dHNpZGVUYXJnZXRFbCIsICJkcmFnU3RhcnRGbiIsICJ0YXJnZXQiLCAiYWZ0ZXIiLCAibiIsICJlbCIsICJpcyIsICJwbHVnaW5zIiwgImRyb3AiLCAiYXV0b1Njcm9sbCIsICJvblNwaWxsIiwgImluZGV4IiwgImNvbXBvbmVudCIsICJlbCIsICJ0aGVtZSJdCn0K diff --git a/packages/admin/resources/css/base.css b/packages/admin/resources/css/base.css index 39836f354..979dffba4 100755 --- a/packages/admin/resources/css/base.css +++ b/packages/admin/resources/css/base.css @@ -12,48 +12,52 @@ input[type='number'] { margin: 0; } -::-webkit-scrollbar-track { +*::-webkit-scrollbar-track { background-color: transparent; } -.hide-scroll::-webkit-scrollbar { - display: none; -} - -[x-cloak] { - display: none !important; -} - -.primary-menu .active { - background-color: theme('colors.primary.900'); -} -.primary-menu .active:hover, -.primary-menu .active:focus { - background-color: theme('colors.primary.900'); -} - -.scrolling::-webkit-scrollbar { +*::-webkit-scrollbar { width: 4px; height: 4px; } -.scrolling::-webkit-scrollbar-thumb { +*::-webkit-scrollbar-thumb { background-color: theme('colors.gray.200'); border-radius: 8px; } -.scrolling::-webkit-scrollbar-thumb:hover { +*::-webkit-scrollbar-thumb:hover { background-color: theme('colors.gray.300'); } -.dark .scrolling::-webkit-scrollbar-thumb { +.dark *::-webkit-scrollbar-thumb { background-color: theme('colors.gray.700'); } -.dark .scrolling::-webkit-scrollbar-thumb:hover { +.dark *::-webkit-scrollbar-thumb:hover { background-color: theme('colors.gray.900'); } +.hide-scroll::-webkit-scrollbar { + display: none; +} + +[x-cloak] { + display: none !important; +} + +.primary-menu .active { + background-color: theme('colors.primary.900'); +} +.primary-menu .active:hover, +.primary-menu .active:focus { + background-color: theme('colors.primary.900'); +} + .ui-modal > div > div.fixed { @apply z-50 backdrop-blur-sm transition-opacity; } + +.shopper-product-wizard > div { + @apply flex-1 h-full; +} diff --git a/packages/admin/resources/css/components/sidebar.css b/packages/admin/resources/css/components/sidebar.css index 849886c5b..f12bf280c 100755 --- a/packages/admin/resources/css/components/sidebar.css +++ b/packages/admin/resources/css/components/sidebar.css @@ -2,6 +2,22 @@ @apply space-y-5; } +.sh-heading { + @apply text-xs leading-5 text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-2 font-medium ml-3; +} + +.sh-sidebar-item { + @apply flex items-center rounded-lg py-2 px-3 text-sm font-medium transition ease-in-out duration-150; +} + +.sh-sidebar-item-active { + @apply text-primary-600 bg-white ring-1 ring-inset ring-gray-200 shadow-sm dark:text-primary-500 dark:bg-gray-800 dark:ring-gray-700; +} + +.sh-sidebar-item-inactive { + @apply text-gray-600 hover:text-gray-900 hover:bg-gray-100 dark:text-gray-300 dark:hover:text-white dark:hover:bg-gray-900; +} + .item-name { @apply flex-1 truncate; } diff --git a/packages/admin/resources/css/components/treeselect.css b/packages/admin/resources/css/components/treeselect.css new file mode 100644 index 000000000..c34334e2a --- /dev/null +++ b/packages/admin/resources/css/components/treeselect.css @@ -0,0 +1,252 @@ +@import "treeselectjs/dist/treeselectjs.css"; + +.treeselect-input { + @apply text-base text-gray-900 pl-2.5 bg-transparent border-0 transition duration-75 sm:text-sm sm:leading-6; + /*font-size: 0.875rem; + color: rgba(var(--gray-950), var(--tw-text-opacity)); + transition-duration: 75ms; + border-style: none; + line-height: 1.5rem;*/ + outline: 2px solid transparent; + outline-offset: 2px; + padding-left: 8px; +} + +.dark .treeselect > .treeselect-input { + color: rgb(255 255 255 / var(--tw-text-opacity)) !important; +} + +.treeselect-input--opened.treeselect-input--bottom { + border: inherit; + border-radius: inherit; +} + +.treeselect-input__edit { + @apply bg-transparent placeholder-gray-400 dark:placeholder-gray-500; +} + +.treeselect-input__tags-count { + margin-left: 9px; +} + +.treeselect-list { + font-size: 0.875rem; + line-height: 1.25rem; + margin-top: 0.5rem; + border-radius: 0.5rem; + padding: 0.25rem; + --tw-bg-opacity: 1; + --tw-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), + 0 4px 6px -4px rgba(0, 0, 0, 0.1); + --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), + 0 4px 6px -4px var(--tw-shadow-color); + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 + var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 + calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color); + --tw-ring-color: rgba(var(--gray-950), 0.05); + background-color: rgb(255 255 255 / var(--tw-bg-opacity)); + box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), + var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), + var(--tw-shadow, 0 0 #0000); + border: none; +} + +.treeselect-list__item { + padding: 1.1rem; + border-radius: 0.475rem; +} + +.treeselect-list.treeselect-list--single-select .treeselect-list__item--single-selected { + --tw-bg-opacity: 1; + background-color: rgba(var(--gray-50), var(--tw-bg-opacity)) !important; +} + +.treeselect-list__item:hover, +.treeselect-list__item--focused { + --tw-bg-opacity: 1; + background-color: rgba(var(--gray-50), var(--tw-bg-opacity)) !important; +} + +.treeselect-list.treeselect-list--single-select .treeselect-list__item--single-selected { + font-weight: 500; +} + +.dark .treeselect-list { + --tw-bg-opacity: 1; + --tw-ring-color: hsla(0, 0%, 100%, 0.1); + background-color: rgba(var(--gray-900), var(--tw-bg-opacity)); +} + +.dark .treeselect-list { + --tw-bg-opacity: 1; + --tw-ring-color: hsla(0, 0%, 100%, 0.1); + background-color: rgba(var(--gray-900), var(--tw-bg-opacity)); +} + +.treeselect-input__edit { + border: transparent !important; + --tw-ring-color: none !important; + --tw-ring-shadow: none !important; +} + +.dark .treeselect-list.treeselect-list--single-select .treeselect-list__item--single-selected, +.dark .treeselect-list__item--focused, +.dark .treeselect-list__item:hover, +.dark .treeselect-list.treeselect-list--single-select .treeselect-list__item--single-selected, +.dark .treeselect-list__item--focused, +.dark .treeselect-list__item:hover { + background-color: hsla(0, 0%, 100%, 0.05) !important; +} + +dark .treeselect-list__item--checked, +.treeselect-list__item--checked { + background: transparent; +} + +.treeselect-input__tags-element { + --tw-bg-opacity: 1; + --tw-text-opacity: 1; + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 + var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 + calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color); + --tw-ring-inset: inset; + --tw-ring-color: rgba(var(--primary-600), 0.1); + align-items: center; + background-color: rgba(var(--primary-50), var(--tw-bg-opacity)); + border-radius: 0.375rem; + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), + var(--tw-shadow, 0 0 #0000); + color: rgba(var(--primary-600), var(--tw-text-opacity)); + display: inline-flex; + font-size: 0.75rem; + font-weight: 500; + gap: 0.25rem; + line-height: 1rem; + padding: 0.25rem 0.5rem; + word-break: break-all; +} + +.dark .treeselect-input__tags-element { + --tw-text-opacity: 1; + --tw-ring-color: rgba(var(--primary-400), 0.3); + background-color: rgba(var(--primary-400), 0.1); + color: rgba(var(--primary-400), var(--tw-text-opacity)); +} + +.treeselect-list__item-checkbox-container { + border-radius: 0.25rem; + height: 16px; + min-width: 16px; + width: 16px; +} + +.treeselect-list__item--checked .treeselect-list__item-checkbox-container, +.treeselect-list__item--partial-checked .treeselect-list__item-checkbox-container { + background-color: theme('colors.primary.600'); +} + +.treeselect-list__item-checkbox { + transition-duration: 75ms; + background-color: transparent !important; + border: none; +} + +.treeselect-list__item-checkbox-container { + background-color: #f8f5f5; + border: none; +} + +.dark .treeselect-list__item-checkbox-container { + border: rgb(255 255 255 / var(--tw-text-opacity)); +} + +.dark .treeselect-list__item-checkbox-container { + background-color: hsla(0, 0%, 100%, 0.05); +} + +.treeselect-list__item-checkbox-icon { + height: 80%; + left: 0.1rem; + top: 0.1rem; + width: 80%; +} + +.treeselect-input__tags-element:hover { + background-color: rgba(var(--primary-50), var(--tw-bg-opacity)); +} + +.treeselect-input__tags-element:hover .treeselect-input__tags-cross svg { + stroke: rgba(var(--gray-950), var(--tw-text-opacity)); +} + +.dark +.treeselect-input__tags-element:hover +.treeselect-input__tags-cross +svg { + stroke: rgb(255 255 255 / var(--tw-text-opacity)); +} + +.treeselect-input__tags-element { + color: rgba(var(--primary-600), var(--tw-text-opacity)); +} + +.dark .treeselect-input__tags-element { + color: rgba(var(--primary-400), var(--tw-text-opacity)); +} + +.dark .treeselect-input__tags-cross svg { + stroke-width: 3px; +} + +.dark .treeselect-input__tags-cross svg { + stroke: rgb(255 255 255 / var(--tw-text-opacity)); + opacity: 0.5; +} + +.dark .treeselect-input__tags-element:hover svg { + opacity: 0.6; +} + +.treeselect-input__clear svg { + opacity: 0.8; +} + +.treeselect-input__tags { + margin-left: 3px; +} + +.treeselect--disabled .treeselect-input__tags-cross { + display: none; +} + +.treeselect--disabled .treeselect-input__arrow { + display: none; +} + +.treeselect-input__arrow { + margin-right: 7px; +} + +.treeselect--disabled .treeselect-input__clear { + display: none; +} + +.treeselect-list__item--disabled { + cursor: not-allowed !important; +} + +.dark .treeselect-list__item--disabled .treeselect-list__item-checkbox-container { + background-color: hsl(0deg 0% 30.77% / 5%); +} + +[dir='rtl'] .treeselect-input__operators { + left: 2px !important; + right: unset; +} + +[dir='rtl'] .treeselect-input { + padding: 2px 4px 2px 40px; +} diff --git a/packages/admin/resources/css/shopper.css b/packages/admin/resources/css/shopper.css index 5f487114c..76d1d2bf4 100755 --- a/packages/admin/resources/css/shopper.css +++ b/packages/admin/resources/css/shopper.css @@ -6,6 +6,7 @@ @import 'components/sidebar.css'; @import 'components/filament.css'; @import 'components/intl-phone.css'; +@import 'components/treeselect.css'; @layer base { html { diff --git a/packages/admin/resources/js/components/select-tree.js b/packages/admin/resources/js/components/select-tree.js new file mode 100644 index 000000000..1bee2c3b0 --- /dev/null +++ b/packages/admin/resources/js/components/select-tree.js @@ -0,0 +1,60 @@ +import Treeselect from 'treeselectjs' + +export default function selectTree({ + state, + name, + options, + searchable, + showCount, + placeholder, + rtl, + disabledBranchNode = true, + disabled = false, + isSingleSelect = true, + showTags = true, + clearable = true, + isIndependentNodes = true, + alwaysOpen = false, + emptyText, + expandSelected = true, + grouped = true, + openLevel = 0, + direction = 'auto' + }) { + return { + state, + + /** @type Treeselect */ + tree: null, + + init() { + this.tree = new Treeselect({ + id: `tree-${name}-id`, + ariaLabel: `tree-${name}-label`, + parentHtmlContainer: this.$refs.tree, + value: this.state ?? [], + options, + searchable, + showCount, + placeholder, + disabledBranchNode, + disabled, + isSingleSelect, + showTags, + clearable, + isIndependentNodes, + alwaysOpen, + emptyText, + expandSelected, + grouped, + openLevel, + direction, + rtl + }); + + this.tree.srcElement.addEventListener('input', (e) => { + this.state = e.detail; + }); + } + } +} diff --git a/packages/admin/resources/js/index.js b/packages/admin/resources/js/index.js index b4234e32e..ea938420a 100755 --- a/packages/admin/resources/js/index.js +++ b/packages/admin/resources/js/index.js @@ -1,7 +1,9 @@ import SlideOverPanel from './components/panel' +import SelectTree from './components/select-tree' import './components/sortable' window.SlideOverPanel = SlideOverPanel +window.selectTree = SelectTree document.addEventListener('alpine:init', () => { const theme = localStorage.getItem('theme') ?? 'system' diff --git a/packages/admin/resources/lang/en/layout.php b/packages/admin/resources/lang/en/layout.php index 01215b944..3958b8396 100755 --- a/packages/admin/resources/lang/en/layout.php +++ b/packages/admin/resources/lang/en/layout.php @@ -129,6 +129,7 @@ 'radio' => 'Radio', 'colorpicker' => 'Color picker', 'datepicker' => 'Date picker', + 'thumbnail' => 'Thumbnail', ], 'placeholder' => [ diff --git a/packages/admin/resources/lang/en/pages/products.php b/packages/admin/resources/lang/en/pages/products.php index b75c5b33a..be4574e48 100755 --- a/packages/admin/resources/lang/en/pages/products.php +++ b/packages/admin/resources/lang/en/pages/products.php @@ -22,7 +22,7 @@ 'status' => 'Product status', 'visible_help_text' => 'This product will be hidden from all sales channels.', 'availability_description' => 'Specify a publication date so that your product are scheduled on your store.', - 'product_associations' => 'Product associations', + 'product_associations' => 'Associations', 'product_categories' => 'Product categories', 'no_category' => 'No Categories', 'no_category_text' => 'Get started by creating a new category.', @@ -124,7 +124,7 @@ 'seo' => [ 'title' => 'Search Engine Optimization', 'description' => 'Improve your ranking and how your product page will appear in search engines results.', - 'sub_description' => 'Here is a preview of your search engine result, play with it!', + 'sub_description' => 'Here is a preview of what an search engine can display, play with it!', ], 'shipping' => [ @@ -140,7 +140,7 @@ 'add_content' => 'Start by adding a related product to your product.', 'modal' => [ - 'title' => 'Add Similar Products to this product', + 'title' => 'Add Similar Products', 'search' => 'Search product', 'search_placeholder' => 'Search product by name', 'action' => 'Add Selected Products', @@ -152,6 +152,8 @@ 'notifications' => [ 'create' => 'Product successfully added!', 'update' => 'Product successfully updated!', + 'media_update' => 'Product media updated!', + 'replicated' => 'Product replicated!', 'stock_update' => 'Product Stock successfully updated!', 'seo_update' => 'Product SEO successfully updated!', 'shipping_update' => 'Product shipping successfully updated!', @@ -162,4 +164,6 @@ 'remove_related' => 'The product has successfully removed from the related products!', ], + 'images_helpText' => 'Add images to your product.', + 'thumbnail_helpText' => 'Used to represent your product during checkout, social sharing and more.', ]; diff --git a/packages/admin/resources/lang/en/words.php b/packages/admin/resources/lang/en/words.php index 1385b0ac8..428dafe6f 100755 --- a/packages/admin/resources/lang/en/words.php +++ b/packages/admin/resources/lang/en/words.php @@ -123,7 +123,7 @@ 'no_users' => 'No users', 'logout_session' => 'Logout Other Browser Sessions', 'logout_session_confirm' => 'Please enter your password to confirm you would like to logout of your other browser sessions across all of your devices.', - 'reorder' => 'Réorganiser', + 'reorder' => 'Reorder', 'all' => 'All', 'actions' => 'Actions', diff --git a/packages/admin/resources/lang/fr/layout.php b/packages/admin/resources/lang/fr/layout.php index d15e42ea6..56f2804e8 100755 --- a/packages/admin/resources/lang/fr/layout.php +++ b/packages/admin/resources/lang/fr/layout.php @@ -129,6 +129,7 @@ 'radio' => 'Radio', 'colorpicker' => 'Choix de couleurs', 'datepicker' => 'Date', + 'thumbnail' => 'Miniature', ], 'placeholder' => [ diff --git a/packages/admin/resources/lang/fr/pages/products.php b/packages/admin/resources/lang/fr/pages/products.php index a66361286..aa1a96304 100755 --- a/packages/admin/resources/lang/fr/pages/products.php +++ b/packages/admin/resources/lang/fr/pages/products.php @@ -22,7 +22,7 @@ 'status' => 'Statut du produit', 'visible_help_text' => 'Ce produit sera caché de tous les canaux de vente.', 'availability_description' => 'Spécifiez une date de publication pour que vos produits soient programmés sur votre boutique.', - 'product_associations' => 'Associations de produits', + 'product_associations' => 'Catégorisation', 'product_categories' => 'Catégories du produit', 'no_category' => 'Aucune catégorie', 'no_category_text' => 'Commencez par créer une nouvelle catégorie.', @@ -124,7 +124,7 @@ 'seo' => [ 'title' => 'Optimisation des moteurs de recherche', 'description' => 'Améliorez votre classement et la façon dont votre page produit apparaîtra dans les résultats des moteurs de recherche.', - 'sub_description' => 'Voici un aperçu du résultat de votre moteur de recherche, jouez avec !', + 'sub_description' => 'Voici un aperçu imagé du résultat que peut donner un moteur de recherche, jouez avec !', ], 'shipping' => [ @@ -152,6 +152,8 @@ 'notifications' => [ 'create' => 'Produit ajouté avec succès !', 'update' => 'Produit mis à jour avec succès !', + 'media_update' => 'Images du produit mise à jour!', + 'replicated' => 'Produit dupliqué!', 'stock_update' => 'Le stock de produits a été mis à jour avec succès !', 'seo_update' => 'Le référencement du produit a été mis à jour avec succès !', 'shipping_update' => 'L\'expédition du produit a été mise à jour avec succès !', @@ -162,4 +164,7 @@ 'remove_related' => 'Le produit a été supprimé avec succès des produits connexes !', ], + 'images_helpText' => 'Ajouter des images à votre produit.', + 'thumbnail_helpText' => 'Utilisé pour représenter votre produit lors du paiement, du partage social, et plus encore.', + ]; diff --git a/packages/admin/resources/lang/fr/words.php b/packages/admin/resources/lang/fr/words.php index f9806cd1e..dec3a9fe1 100755 --- a/packages/admin/resources/lang/fr/words.php +++ b/packages/admin/resources/lang/fr/words.php @@ -122,7 +122,7 @@ 'no_users' => 'Aucun utilisateur', 'logout_session' => 'Déconnexion des autres sessions du navigateur', 'logout_session_confirm' => 'Please enter your password to confirm you would like to logout of your other browser sessions across all of your devices.', - 'reorder' => 'Reorder', + 'reorder' => 'Réorganiser', 'all' => 'Tous', 'actions' => 'Actions', diff --git a/packages/admin/resources/views/components/filament/forms/currency-mask.blade.php b/packages/admin/resources/views/components/filament/forms/currency-mask.blade.php new file mode 100644 index 000000000..cdaf309f6 --- /dev/null +++ b/packages/admin/resources/views/components/filament/forms/currency-mask.blade.php @@ -0,0 +1,96 @@ +@php + $datalistOptions = $getDatalistOptions(); + $extraAlpineAttributes = $getExtraAlpineAttributes(); + $id = $getId(); + $isConcealed = $isConcealed(); + $isDisabled = $isDisabled(); + $isPrefixInline = $isPrefixInline(); + $isSuffixInline = $isSuffixInline(); + $mask = $getMask(); + $prefixActions = $getPrefixActions(); + $prefixIcon = $getPrefixIcon(); + $prefixLabel = $getPrefixLabel(); + $suffixActions = $getSuffixActions(); + $suffixIcon = $getSuffixIcon(); + $suffixLabel = $getSuffixLabel(); + $statePath = $getStatePath(); + $xmask = "\$money(\$input, '$decimalSeparator', '$thousandSeparator', $precision)"; + $xdata = << this.updateMasked()); + \$el.addEventListener('input', (event) => this.updateInput()); + \$el.addEventListener('blur', (event) => this.updateInput()); + }, + updateMasked() { + if(typeof this.input === 'number') { + \$el.value = this.input?.toString().replaceAll('.', '$decimalSeparator'); + \$el.dispatchEvent(new Event('input')); + } + }, + updateInput() { + this.input = \$el.value?.replaceAll('$thousandSeparator','').replaceAll('$decimalSeparator','.'); + } + } + JS; +@endphp + + + + + + + @if ($datalistOptions) + + @foreach ($datalistOptions as $option) + + @endif + diff --git a/packages/admin/resources/views/components/filament/forms/quantity.blade.php b/packages/admin/resources/views/components/filament/forms/quantity.blade.php new file mode 100644 index 000000000..d03b82bcf --- /dev/null +++ b/packages/admin/resources/views/components/filament/forms/quantity.blade.php @@ -0,0 +1,157 @@ +@php + $getHeading = $getHeading(); + $getStatePath = $getStatePath(); + $getState = $getState(); + + $hasInlineLabel = $hasInlineLabel(); + $extraAlpineAttributes = $getExtraAlpineAttributes(); + $id = $getId(); + $isDisabled = $isDisabled(); + $getMaxValue = $getMaxValue(); + $getMinValue = $getMinValue(); + + $isPrefixInline = $isPrefixInline(); + $isSuffixInline = $isSuffixInline(); + $prefixActions = $getPrefixActions(); + $prefixIcon = $getPrefixIcon(); + $prefixLabel = $getPrefixLabel(); + $suffixActions = $getSuffixActions(); + $suffixIcon = $getSuffixIcon(); + $suffixLabel = $getSuffixLabel(); +@endphp + + + $hasInlineLabel, + ]) + > + {{ $getLabel() }} + + +
+ +
+
+ @if($getHeading !== null) + + @endif + + +
+ + @if($isStacked()) +
+ + +
+ @else +
+ + +
+ @endif + +
+
+ +
+ + +
diff --git a/packages/admin/resources/views/components/forms/checkbox-category.blade.php b/packages/admin/resources/views/components/forms/checkbox-category.blade.php index 782354e18..e84c3b975 100755 --- a/packages/admin/resources/views/components/forms/checkbox-category.blade.php +++ b/packages/admin/resources/views/components/forms/checkbox-category.blade.php @@ -1,16 +1,25 @@
- +
- +
@if($category->children->isNotEmpty()) -
+
@foreach($category->children as $child) - @include('shopper::components.forms.checkbox-category', ['parent' => $category->parent_id ,'category' => $child]) + @include('shopper::components.forms.checkbox-category', [ + 'parent' => $category->parent_id, + 'category' => $child, + 'statePath' => $statePath, + ]) @endforeach
@endif diff --git a/packages/admin/resources/views/components/forms/search.blade.php b/packages/admin/resources/views/components/forms/search.blade.php index efe1e35c1..aea0a8474 100755 --- a/packages/admin/resources/views/components/forms/search.blade.php +++ b/packages/admin/resources/views/components/forms/search.blade.php @@ -6,7 +6,7 @@
-
+
-
-
+
+
@isset($subHeading) {{ $subHeading }} @endisset -
-
twMerge(['class' => 'min-h-(screen-content)']) }}> +
+
twMerge(['class' => 'flex-1 min-h-full']) }}> {{ $slot }}
diff --git a/packages/admin/resources/views/components/layouts/app/header.blade.php b/packages/admin/resources/views/components/layouts/app/header.blade.php index 602bc3bc3..a153e53cd 100755 --- a/packages/admin/resources/views/components/layouts/app/header.blade.php +++ b/packages/admin/resources/views/components/layouts/app/header.blade.php @@ -1,4 +1,4 @@ -
+
diff --git a/packages/admin/resources/views/components/layouts/app/sidebar/content.blade.php b/packages/admin/resources/views/components/layouts/app/sidebar/content.blade.php index e99c2c16d..30d5f97f6 100755 --- a/packages/admin/resources/views/components/layouts/app/sidebar/content.blade.php +++ b/packages/admin/resources/views/components/layouts/app/sidebar/content.blade.php @@ -3,10 +3,10 @@
- + - +

{{ config('app.name') }} @@ -24,24 +24,23 @@
@can('access_setting') - request()->routeIs('shopper.settings*'), - 'hover:bg-gray-50 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:bg-gray-700 dark:hover:text-white' => ! request()->routeIs('shopper.settings*') + 'sh-sidebar-item', + 'sh-sidebar-item-active' => request()->routeIs('shopper.settings*'), + 'sh-sidebar-item-inactive' => ! request()->routeIs('shopper.settings*') ]) > {{ __('shopper::layout.account_dropdown.settings') }} - + @endcan {{ __('shopper::messages.dashboard.cards.doc_title') }} diff --git a/packages/admin/resources/views/components/layouts/base.blade.php b/packages/admin/resources/views/components/layouts/base.blade.php index 0e0aec453..a3130d2c1 100755 --- a/packages/admin/resources/views/components/layouts/base.blade.php +++ b/packages/admin/resources/views/components/layouts/base.blade.php @@ -1,9 +1,9 @@ @props(['title' => config('app.name')]) - + @@ -48,20 +48,20 @@ class="shopper scroll-smooth js-focus-visible min-h-screen antialiased" @include('shopper::includes._additional-styles') -twMerge(['class' => 'bg-white font-sans dark:bg-gray-950']) }}> +twMerge(['class' => 'bg-white font-sans dark:bg-gray-950']) }}> -{{ $slot }} + {{ $slot }} -@livewire(\Filament\Notifications\Livewire\Notifications::class) -@livewire(\Shopper\Livewire\Components\SlideOverPanel::class) + @livewire(\Filament\Notifications\Livewire\Notifications::class) + @livewire(\Shopper\Livewire\Components\SlideOverPanel::class) -
- @livewire(\LivewireUI\Modal\Modal::class) -
+
+ @livewire(\LivewireUI\Modal\Modal::class) +
-@filamentScripts + @filamentScripts -@include('shopper::includes._additional-scripts') + @include('shopper::includes._additional-scripts') diff --git a/packages/admin/resources/views/components/separator.blade.php b/packages/admin/resources/views/components/separator.blade.php index 649eba115..7e8c0896a 100755 --- a/packages/admin/resources/views/components/separator.blade.php +++ b/packages/admin/resources/views/components/separator.blade.php @@ -1,3 +1,3 @@ -
+
diff --git a/packages/admin/resources/views/filament/form/select-tree.blade.php b/packages/admin/resources/views/filament/form/select-tree.blade.php new file mode 100644 index 000000000..050b8051a --- /dev/null +++ b/packages/admin/resources/views/filament/form/select-tree.blade.php @@ -0,0 +1,48 @@ +@php + $prefixLabel = $getPrefixLabel(); + $suffixLabel = $getSuffixLabel(); + $prefixIcon = $getPrefixIcon(); + $suffixIcon = $getSuffixIcon(); + $prefixActions = $getPrefixActions(); + $suffixActions = $getSuffixActions(); +@endphp + + +
+ +
+
+
+
diff --git a/packages/admin/resources/views/filament/form/text-input-select.blade.php b/packages/admin/resources/views/filament/form/text-input-select.blade.php new file mode 100644 index 000000000..eadb99254 --- /dev/null +++ b/packages/admin/resources/views/filament/form/text-input-select.blade.php @@ -0,0 +1,89 @@ +@php + $datalistOptions = $getDatalistOptions(); + $extraAlpineAttributes = $getExtraAlpineAttributes(); + $id = $getId(); + $isConcealed = $isConcealed(); + $isDisabled = $isDisabled(); + $isPrefixInline = $isPrefixInline(); + $isSuffixInline = $isSuffixInline(); + $mask = $getMask(); + $prefixActions = $getPrefixActions(); + $prefixIcon = $getPrefixIcon(); + $prefixLabel = $getPrefixLabel(); + $suffixActions = $getSuffixActions(); + $suffixIcon = $getSuffixIcon(); + $suffixLabel = $getSuffixLabel(); + $statePath = $getStatePath(); + $hasSelect = $hasSelect(); +@endphp + + + + + @if($hasSelect) + @if($getPosition() === 'prefix') + + {{ $getSelectComponent() }} + + @else + + {{ $getSelectComponent() }} + + @endif + @endif + + + @if ($datalistOptions) + + @foreach ($datalistOptions as $option) + + @endif + diff --git a/packages/admin/resources/views/filament/wizard-column.blade.php b/packages/admin/resources/views/filament/wizard-column.blade.php new file mode 100644 index 000000000..a386e72c5 --- /dev/null +++ b/packages/admin/resources/views/filament/wizard-column.blade.php @@ -0,0 +1,290 @@ +@php + $isContained = $isContained(); + $statePath = $getStatePath(); +@endphp + +
merge([ + 'id' => $getId(), + ], escape: false) + ->merge($getExtraAttributes(), escape: false) + ->merge($getExtraAlpineAttributes(), escape: false) + ->class([ + 'fi-fo-wizard h-full', + 'fi-contained' => $isContained, + ]) + }} +> + + +
+
    $isContained, + 'rounded-xl bg-white shadow-sm ring-1 ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10' => ! $isContained, + ]) + > + @foreach ($getChildComponentContainer()->getComponents() as $step) +
  1. + + + @if (! $loop->last) + + @endif +
  2. + @endforeach +
+ +
+
+ @foreach ($getChildComponentContainer()->getComponents() as $step) + {{ $step }} + @endforeach +
+
$isContained, + 'mt-6' => ! $isContained, + ]) + > + + {{ $getAction('previous') }} + + + + {{ $getCancelAction() }} + + + + {{ $getAction('next') }} + + + + {{ $getSubmitAction() }} + +
+
+
+ +
diff --git a/packages/admin/resources/views/filament/wizard/step-column.blade.php b/packages/admin/resources/views/filament/wizard/step-column.blade.php new file mode 100644 index 000000000..e69de29bb diff --git a/packages/admin/resources/views/livewire/components/products/forms/edit.blade.php b/packages/admin/resources/views/livewire/components/products/forms/edit.blade.php new file mode 100755 index 000000000..c6fc47bd7 --- /dev/null +++ b/packages/admin/resources/views/livewire/components/products/forms/edit.blade.php @@ -0,0 +1,14 @@ + +
+ {{ $this->form }} + +
+
+ + + {{ __('shopper::layout.forms.actions.update') }} + +
+
+
+
diff --git a/packages/admin/resources/views/livewire/products/forms/form-attributes.blade.php b/packages/admin/resources/views/livewire/components/products/forms/form-attributes.blade.php similarity index 100% rename from packages/admin/resources/views/livewire/products/forms/form-attributes.blade.php rename to packages/admin/resources/views/livewire/components/products/forms/form-attributes.blade.php diff --git a/packages/admin/resources/views/livewire/products/forms/form-variants.blade.php b/packages/admin/resources/views/livewire/components/products/forms/form-variants.blade.php similarity index 100% rename from packages/admin/resources/views/livewire/products/forms/form-variants.blade.php rename to packages/admin/resources/views/livewire/components/products/forms/form-variants.blade.php diff --git a/packages/admin/resources/views/livewire/components/products/forms/inventory.blade.php b/packages/admin/resources/views/livewire/components/products/forms/inventory.blade.php new file mode 100755 index 000000000..f10b00ea8 --- /dev/null +++ b/packages/admin/resources/views/livewire/components/products/forms/inventory.blade.php @@ -0,0 +1,30 @@ + +
+ {{ $this->form }} + +
+
+ + + {{ __('shopper::layout.forms.actions.update') }} + +
+
+
+ + + +
+
+ + {{ __('shopper::pages/products.inventory.stock_title') }} + + + {{ __('shopper::pages/products.inventory.stock_description') }} + +
+
+ {{ $this->table }} +
+
+
diff --git a/packages/admin/resources/views/livewire/components/products/forms/media.blade.php b/packages/admin/resources/views/livewire/components/products/forms/media.blade.php new file mode 100755 index 000000000..c6fc47bd7 --- /dev/null +++ b/packages/admin/resources/views/livewire/components/products/forms/media.blade.php @@ -0,0 +1,14 @@ + +
+ {{ $this->form }} + +
+
+ + + {{ __('shopper::layout.forms.actions.update') }} + +
+
+
+
diff --git a/packages/admin/resources/views/livewire/components/products/forms/related.blade.php b/packages/admin/resources/views/livewire/components/products/forms/related.blade.php new file mode 100755 index 000000000..f9c6b2e5f --- /dev/null +++ b/packages/admin/resources/views/livewire/components/products/forms/related.blade.php @@ -0,0 +1,111 @@ + +
+
+

+ {{ __('shopper::pages/products.related.title') }} +

+

+ {{ __('shopper::pages/products.related.description') }} +

+
+ @if($relatedProducts->isNotEmpty()) +
+ + {{ __('shopper::layout.account_dropdown.add_product') }} + +
+ @endif +
+ + + @if($relatedProducts->isNotEmpty()) +
+ @foreach($relatedProducts as $relatedProduct) +
+
+
+ {{ $relatedProduct->name }} Thumbnail +
+
+ + + +
+
+
+
+

+ {{ $relatedProduct->name }} +

+

+ {{ $relatedProduct->getPriceAmount()?->formatted }} +

+
+
+
$relatedProduct->is_visible, + 'bg-rose-500' => ! $relatedProduct->is_visible, + ]) + >
+
+
+
+ @endforeach +
+ @else +
+
+
+

+ {{ __('shopper::pages/products.related.empty') }} +

+

+ {{ __('shopper::pages/products.related.add_content') }} +

+
+ + +
+
+ @endif +
+
diff --git a/packages/admin/resources/views/livewire/components/products/forms/seo.blade.php b/packages/admin/resources/views/livewire/components/products/forms/seo.blade.php new file mode 100755 index 000000000..b9a211f25 --- /dev/null +++ b/packages/admin/resources/views/livewire/components/products/forms/seo.blade.php @@ -0,0 +1,53 @@ + +
+

+ {{ __('shopper::pages/products.seo.title') }} +

+

+ {{ __('shopper::pages/products.seo.description') }} +

+
+
+
+ {{ $this->form }} + +
+
+ + + {{ __('shopper::layout.forms.actions.update') }} + +
+
+
+ +
+

+ {{ __('shopper::pages/products.seo.sub_description') }} +

+
+
+
+
+
+
+
+ +
+
+
+

+ {{ $data['seo_title'] }} +

+ + {{ config('app.url') }}/{your-custom-prefix}/{{ $data['slug'] }} + +

+ {{ $data['seo_description'] }} +

+
+
+
+
+
+
diff --git a/packages/admin/resources/views/livewire/components/products/forms/shipping.blade.php b/packages/admin/resources/views/livewire/components/products/forms/shipping.blade.php new file mode 100755 index 000000000..cb9ba3480 --- /dev/null +++ b/packages/admin/resources/views/livewire/components/products/forms/shipping.blade.php @@ -0,0 +1,14 @@ + +
+ {{ $this->form }} + +
+
+ + + {{ __('shopper::layout.forms.actions.update') }} + +
+
+
+
diff --git a/packages/admin/resources/views/livewire/modals/related-lists.blade.php b/packages/admin/resources/views/livewire/modals/related-products-list.blade.php similarity index 57% rename from packages/admin/resources/views/livewire/modals/related-lists.blade.php rename to packages/admin/resources/views/livewire/modals/related-products-list.blade.php index ee427dbbd..dc143ac55 100755 --- a/packages/admin/resources/views/livewire/modals/related-lists.blade.php +++ b/packages/admin/resources/views/livewire/modals/related-products-list.blade.php @@ -20,8 +20,12 @@ @empty
- -

+

{{ __('shopper::pages/products.related.modal.no_results') }}

@@ -32,18 +36,19 @@ @if($this->products->isNotEmpty()) - - - - {{ __('shopper::pages/collections.modal.action') }} - - + + + {{ __('shopper::pages/collections.modal.action') }} + @endif - - - {{ __('shopper::layout.forms.actions.cancel') }} - - + + {{ __('shopper::layout.forms.actions.cancel') }} + diff --git a/packages/admin/resources/views/livewire/pages/category/index.blade.php b/packages/admin/resources/views/livewire/pages/category/index.blade.php index 5614155ce..73b35f096 100644 --- a/packages/admin/resources/views/livewire/pages/category/index.blade.php +++ b/packages/admin/resources/views/livewire/pages/category/index.blade.php @@ -1,3 +1,7 @@ +@php + $total = $this->table->getQuery()->count(); +@endphp + diff --git a/packages/admin/resources/views/livewire/pages/products/create.blade.php b/packages/admin/resources/views/livewire/pages/products/create.blade.php new file mode 100755 index 000000000..454bf49f7 --- /dev/null +++ b/packages/admin/resources/views/livewire/pages/products/create.blade.php @@ -0,0 +1,18 @@ +
+ + + + + + + + + {{ __('shopper::words.actions_label.add_new', ['name' => __('shopper::words.product')]) }} + + + + +
+ {{ $this->form }} +
+
diff --git a/packages/admin/resources/views/livewire/pages/products/edit.blade.php b/packages/admin/resources/views/livewire/pages/products/edit.blade.php new file mode 100755 index 000000000..b5410eafb --- /dev/null +++ b/packages/admin/resources/views/livewire/pages/products/edit.blade.php @@ -0,0 +1,128 @@ +
+ + + + + + + +
+
+
+ + + + {{ $product->name }} + + + {{ $this->deleteAction }} + + + + + + + {{ __('shopper::words.overview') }} + + + + {{ __('shopper::words.media') }} + + + + {{ __('shopper::words.variants') }} + + + + {{ __('shopper::words.attributes') }} + + + + {{ __('shopper::words.location') }} + + + + {{ __('shopper::words.shipping') }} + + + + {{ __('shopper::words.seo') }} + + + + {{ __('shopper::pages/products.related_products') }} + + +
+
+ +
+
+ +
+
+ +
+
+ Variants + {{----}} +
+
+ Attributes + {{----}} +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+ + +
diff --git a/packages/admin/resources/views/livewire/products/browse.blade.php b/packages/admin/resources/views/livewire/pages/products/index.blade.php similarity index 98% rename from packages/admin/resources/views/livewire/products/browse.blade.php rename to packages/admin/resources/views/livewire/pages/products/index.blade.php index 53283e647..7bfb38e79 100755 --- a/packages/admin/resources/views/livewire/products/browse.blade.php +++ b/packages/admin/resources/views/livewire/pages/products/index.blade.php @@ -7,13 +7,9 @@ @if($total > 0) @can('add_products') -
- - - {{ __('shopper::words.actions_label.add_new', ['name' => strtolower(__('shopper::words.product'))]) }} - - -
+ + {{ __('shopper::words.actions_label.add_new', ['name' => __('shopper::words.product')]) }} + @endcan @endif
@@ -253,8 +249,8 @@ class="lg:pb-0"
@else -
- +
+ {{ $this->table }}
@endif diff --git a/packages/admin/resources/views/pages/products/variant.blade.php b/packages/admin/resources/views/livewire/pages/products/variant.blade.php similarity index 100% rename from packages/admin/resources/views/pages/products/variant.blade.php rename to packages/admin/resources/views/livewire/pages/products/variant.blade.php diff --git a/packages/admin/resources/views/livewire/pages/settings/general.blade.php b/packages/admin/resources/views/livewire/pages/settings/general.blade.php index c3acfb240..7ed45fd58 100755 --- a/packages/admin/resources/views/livewire/pages/settings/general.blade.php +++ b/packages/admin/resources/views/livewire/pages/settings/general.blade.php @@ -4,7 +4,7 @@ - + {{ __('shopper::pages/settings.settings.title') }} diff --git a/packages/admin/resources/views/livewire/products/create.blade.php b/packages/admin/resources/views/livewire/products/create.blade.php deleted file mode 100755 index 00c3750c1..000000000 --- a/packages/admin/resources/views/livewire/products/create.blade.php +++ /dev/null @@ -1,497 +0,0 @@ - - - - - - - - - {{ __('shopper::words.actions_label.add_new', ['name' => __('shopper::words.product')]) }} - - - -
-
-
-
- - - -
-
- - - -
-
-
-

- {{ __('shopper::words.media') }} -

-
- -
-
-
-
-

- {{ __('shopper::words.pricing') }} -

-
- -
-
-
-

- {{ __('shopper::pages/products.about_pricing_content') }} -

-
-
-
- -
-
-
-
-
-
-
-
-
- -
-
- -
-
-
-
- -
-
-
-
-
-
-
-

- {{ __('shopper::words.shipping') }} -

-
-
-
- -
-
- -

- {{ __('shopper::pages/products.product_can_returned_help_text') }} -

-
-
-
-
- -
-
- -

- {{ __('shopper::pages/products.product_shipped_help_text') }} -

-
-
-
-
- @if($requireShipping) -
-

- {{ __('shopper::words.weight_dimension') }} -

-

- {{ __('shopper::pages/products.weight_dimension_help_text') }} -

-
- - -
- - - - -
-
- - -
- - - - -
-
- - -
- - - - -
-
- - -
- - - - -
-
-
-
- @endif -
- - -
-
- -
-
- -
-
- - - {{ __('shopper::layout.forms.actions.save') }} - -
-
- diff --git a/packages/admin/resources/views/livewire/products/edit.blade.php b/packages/admin/resources/views/livewire/products/edit.blade.php deleted file mode 100755 index afaef635d..000000000 --- a/packages/admin/resources/views/livewire/products/edit.blade.php +++ /dev/null @@ -1,146 +0,0 @@ -
- - - - - - - -
-
- -
-
-

- {{ $product->name }} -

-
-
- -
-
-
-
-
- - - -
- - -
-
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
-
diff --git a/packages/admin/resources/views/livewire/products/forms/form-edit.blade.php b/packages/admin/resources/views/livewire/products/forms/form-edit.blade.php deleted file mode 100755 index 7e33309e3..000000000 --- a/packages/admin/resources/views/livewire/products/forms/form-edit.blade.php +++ /dev/null @@ -1,267 +0,0 @@ - -
-
-
-
- - - -
-
- - - -
-
-
-

- {{ __('shopper::words.media') }} -

-
- - @error('files.*') -

- {{ $message }} -

- @enderror -
-
-
-
-

- {{ __('shopper::words.pricing') }} -

-
- -
-
-
-

- {{ __('shopper::pages/products.about_pricing_content') }} -

-
-
-
- -
-
-
-
-
-
-
-
-
- -
-
- -
-
-
-
- -
-
-
-
-
-
- -
-
- -
-
- - - {{ __('shopper::layout.forms.actions.update') }} - -
-
-
diff --git a/packages/admin/resources/views/livewire/products/forms/form-inventory.blade.php b/packages/admin/resources/views/livewire/products/forms/form-inventory.blade.php deleted file mode 100755 index bdabc3862..000000000 --- a/packages/admin/resources/views/livewire/products/forms/form-inventory.blade.php +++ /dev/null @@ -1,218 +0,0 @@ - -
-
-

- {{ __('shopper::pages/products.inventory.title') }} -

-

- {{ __('shopper::pages/products.inventory.description') }} -

-
- -
-
- - - -
- - - - @if($barcodeImage) -
- {!! $barcodeImage !!} -
- @endif -
- - - -
-
-
- - - {{ __('shopper::layout.forms.actions.update') }} - -
-
-
- - - -
-
-

- {{ __('shopper::pages/products.inventory.stock_title') }} -

-

- {{ __('shopper::pages/products.inventory.stock_description') }} -

-
-
- - - @if($inventories->count() > 1) -
- - - - - - @foreach($inventories as $inventory) - - @endforeach - - -
- {{ __('shopper::pages/products.quantity_available') }} - -
-
- @endif -
-
- - {{ __('shopper::pages/products.current_qty_inventory') }} - - -
-
-
-
-

- {{ $realStock }} -

-
-
-
- -
- - -
-
-
-
- - - {{ __('shopper::layout.forms.actions.update') }} - - @if($histories->isNotEmpty()) -
- - - {{ __('shopper::layout.forms.actions.export') }} - -
- @endif -
-
- @error('value') -

- {{ __('shopper::layout.forms.validation.integer') }} -

- @enderror -
-
- @if($histories->isEmpty()) -
- - - -

- {{ __('shopper::pages/products.inventory.empty') }} -

-
- @else -
-
-
- - - - - {{ __('shopper::words.date') }} - - - {{ __('shopper::words.event') }} - - - {{ __('shopper::words.location') }} - - - {{ __('shopper::words.adjustment') }} - - - {{ __('shopper::pages/products.inventory.movement') }} - - - - - @foreach($histories as $inventoryHistory) - - - - - - - - @endforeach - -
- {{ $inventoryHistory->created_at->diffForHumans() }} - - {{ __($inventoryHistory->event) }} - - {{ $inventoryHistory->inventory->name }} - $inventoryHistory->old_quantity > 0, - 'text-red-500' => $inventoryHistory->old_quantity <= 0, - ])> - {{ $inventoryHistory->adjustment }} - $inventoryHistory->quantity > 0, - 'text-red-500' => $inventoryHistory->quantity <= 0, - ])> - {{ $inventoryHistory->quantity }} -
-
-
-
-
- {{ $histories->links('shopper::livewire.wire-mobile-pagination-links') }} -
- -
-
- @endif -
-
diff --git a/packages/admin/resources/views/livewire/products/forms/form-related.blade.php b/packages/admin/resources/views/livewire/products/forms/form-related.blade.php deleted file mode 100755 index 6641ea8dd..000000000 --- a/packages/admin/resources/views/livewire/products/forms/form-related.blade.php +++ /dev/null @@ -1,60 +0,0 @@ - -
-
-

- {{ __('shopper::pages/products.related.title') }} -

-

- {{ __('shopper::pages/products.related.description') }} -

-
- @if($relatedProducts->isNotEmpty()) -
- - {{ __('shopper::layout.account_dropdown.add_product') }} - -
- @endif -
- -
- -
- @forelse($relatedProducts as $relatedProduct) -
- {{ $relatedProduct->name }} -
-

- - {{ $relatedProduct->name }} - -

-

- {{ $relatedProduct->getPriceAmount()?->formatted }} -

- -
-
- @empty -
- -

- {{ __('shopper::pages/products.related.empty') }} -

-

- {{ __('shopper::pages/products.related.add_content') }} -

-
- - - {{ __('shopper::words.actions_label.add_new', ['name' => strtolower(__('shopper::words.product'))]) }} - -
-
- @endforelse -
- -
- diff --git a/packages/admin/resources/views/livewire/products/forms/form-seo.blade.php b/packages/admin/resources/views/livewire/products/forms/form-seo.blade.php deleted file mode 100755 index 756a211ac..000000000 --- a/packages/admin/resources/views/livewire/products/forms/form-seo.blade.php +++ /dev/null @@ -1,66 +0,0 @@ - -
-

- {{ __('shopper::pages/products.seo.title') }} -

-

- {{ __('shopper::pages/products.seo.description') }} -

-

- {{ __('shopper::pages/products.seo.sub_description') }} -

-
-
-
-
- - - -
-
- - - {{ __('shopper::components.seo.characters') }} - -
-
- -
-
-
- - - -
-
-
-
- - - {{ __('shopper::layout.forms.actions.update') }} - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

{{ $seoTitle }}

- {{ config('app.url') }}/{your-custom-prefix}/{{ $slug }} -

{{ str_limit($seoDescription, 160) }}

-
-
-
-
-
-
-
diff --git a/packages/admin/resources/views/livewire/products/forms/form-shipping.blade.php b/packages/admin/resources/views/livewire/products/forms/form-shipping.blade.php deleted file mode 100755 index c631ba0c7..000000000 --- a/packages/admin/resources/views/livewire/products/forms/form-shipping.blade.php +++ /dev/null @@ -1,108 +0,0 @@ - -
-
-
-

- {{ __('shopper::words.shipping') }} -

-

- {{ __('shopper::pages/products.shipping.description') }} -

-
-
-
-
-
-
- -
-
- -

- {{ __('shopper::pages/products.product_can_returned_help_text') }} -

-
-
-
-
- -
-
- -

- {{ __('shopper::pages/products.product_shipped_help_text') }} -

-
-
-
-
-
- - @if($requireShipping) - - -
-
-
-
-

- {{ __('shopper::pages/products.shipping.package_dimension') }} -

-

- {{ __('shopper::pages/products.shipping.package_dimension_description') }} -

-
-
-
-
- - -
- - - - -
-
- - -
- - - - -
-
- - -
- - - - -
-
- - -
- - - - -
-
-
-
-
-
- @endif - -
-
- - - {{ __('shopper::layout.forms.actions.update') }} - -
-
-
diff --git a/packages/admin/resources/views/livewire/tables/cells/categories/name.blade.php b/packages/admin/resources/views/livewire/tables/cells/categories/name.blade.php index 90ce8f489..da9a943ab 100755 --- a/packages/admin/resources/views/livewire/tables/cells/categories/name.blade.php +++ b/packages/admin/resources/views/livewire/tables/cells/categories/name.blade.php @@ -1,10 +1,8 @@ - @if($category) - {{ $category->name }} - @if($category->parent_id) - - {{ __('shopper::pages/categories.parent', ['parent' => $category->parent_name]) }} - - @endif + {{ $category->name }} + @if($category->parent) + + {{ __('shopper::pages/categories.parent', ['parent' => $category->parent->name]) }} + @endif diff --git a/packages/admin/resources/views/livewire/tables/cells/products/stock.blade.php b/packages/admin/resources/views/livewire/tables/cells/products/stock.blade.php index 69b782a7e..3122aa14b 100755 --- a/packages/admin/resources/views/livewire/tables/cells/products/stock.blade.php +++ b/packages/admin/resources/views/livewire/tables/cells/products/stock.blade.php @@ -1,16 +1,13 @@ +@php + $product = $getRecord(); +@endphp +
- @if($row->variations_count > 0) - - {{ __('in stock for :count variant(s)', ['count' => $row->variations_count]) }} + @if($product->variants_count > 0) + + {{ __('in stock for :count variant(s)', ['count' => $product->variants_count]) }} @else - $row->stock < 10, - 'bg-green-100 text-green-800' => $row->stock >= 10, - ]) - > - {{ $row->stock }} - + {{ __('in stock') }} @endif
diff --git a/packages/admin/resources/views/pages/products/create.blade.php b/packages/admin/resources/views/pages/products/create.blade.php deleted file mode 100755 index d49527d2d..000000000 --- a/packages/admin/resources/views/pages/products/create.blade.php +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/packages/admin/resources/views/pages/products/edit.blade.php b/packages/admin/resources/views/pages/products/edit.blade.php deleted file mode 100755 index 54f15c5c2..000000000 --- a/packages/admin/resources/views/pages/products/edit.blade.php +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/packages/admin/resources/views/pages/products/index.blade.php b/packages/admin/resources/views/pages/products/index.blade.php deleted file mode 100755 index 49082d547..000000000 --- a/packages/admin/resources/views/pages/products/index.blade.php +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/packages/admin/routes/admin/product.php b/packages/admin/routes/admin/product.php index da974f2fc..1f08f5b55 100644 --- a/packages/admin/routes/admin/product.php +++ b/packages/admin/routes/admin/product.php @@ -7,13 +7,14 @@ use Shopper\Http\Controllers\Ecommerce; Route::as('products.')->group(function (): void { - Route::get('/', config('shopper.components.product.page.product-index'))->name('index'); - Route::get('/create', config('shopper.components.product.page.product-create'))->name('create'); + Route::get('/', config('shopper.components.product.pages.product-index'))->name('index'); + Route::get('/create', config('shopper.components.product.pages.product-create'))->name('create'); + Route::get('/{product}/edit', config('shopper.components.product.pages.product-edit'))->name('edit'); Route::get('/{product}/variants/{id}', [Ecommerce\ProductController::class, 'variant']) ->name('variant'); }); Route::prefix('attributes')->as('attributes.')->group(function (): void { - Route::get('/', config('shopper.components.product.page.attribute-index'))->name('index'); + Route::get('/', config('shopper.components.product.pages.attribute-index'))->name('index'); }); -Route::resource('attributes', AttributeController::class)->except('destroy', 'store', 'update'); +// Route::resource('attributes', AttributeController::class)->except('destroy', 'store', 'update'); diff --git a/packages/admin/src/Components/Form/Quantity.php b/packages/admin/src/Components/Form/Quantity.php new file mode 100644 index 000000000..6d069c19e --- /dev/null +++ b/packages/admin/src/Components/Form/Quantity.php @@ -0,0 +1,50 @@ +numeric(); + } + + public function heading(?string $heading): static + { + $this->heading = $heading; + + return $this; + } + + public function getHeading(): ?string + { + return $this->heading; + } + + public function stacked(bool $stacked = true): static + { + $this->stacked = $stacked; + + return $this; + } + + public function isStacked(): bool + { + return $this->stacked; + } +} diff --git a/packages/admin/src/Components/Form/SelectTree.php b/packages/admin/src/Components/Form/SelectTree.php new file mode 100644 index 000000000..c49df5f77 --- /dev/null +++ b/packages/admin/src/Components/Form/SelectTree.php @@ -0,0 +1,560 @@ +loadStateFromRelationshipsUsing(static function (self $component): void { + // Get the current relationship associated with the component. + $relationship = $component->getRelationship(); + + // Check if the relationship is a BelongsToMany relationship. + if ($relationship instanceof BelongsToMany) { + // Retrieve related model instances and extract their IDs into an array. + $state = $relationship->getResults() + ->pluck($relationship->getRelatedKeyName()) + ->toArray(); + + // Set the component's state with the extracted IDs. + $component->state($state); + } + }); + + // Save relationships using a callback function. + $this->saveRelationshipsUsing(static function (self $component, $state): void { + // Check if the component's relationship is a BelongsToMany relationship. + if ($component->getRelationship() instanceof BelongsToMany) { + // Wrap the state in a collection and convert it to an array if it's not set. + $state = Arr::wrap($state ?? []); + + $pivotData = $component->getPivotData(); + + // Sync the relationship with the provided state (IDs). + if ($pivotData === []) { + $component->getRelationship()->sync($state ?? []); + + return; + } + + // Sync the relationship with the provided state (IDs) plus pivot data. + $component->getRelationship()->syncWithPivotValues($state ?? [], $pivotData); + } + }); + + $this->createOptionUsing(static function (SelectTree $component, array $data, Form $form) { + $record = $component->getRelationship()->getRelated(); + $record->fill($data); + $record->save(); + + $form->model($record)->saveRelationships(); + + return $component->getCustomKey($record); + }); + + $this->suffixActions([ + static fn (SelectTree $component): ?Action => $component->getCreateOptionAction(), + ]); + } + + private function buildTree(): Collection + { + // Start with two separate query builders + $nullParentQuery = $this->getRelationship()->getRelated()->query()->where($this->getParentAttribute(), $this->getParentNullValue()); + $nonNullParentQuery = $this->getRelationship()->getRelated()->query()->whereNot($this->getParentAttribute(), $this->getParentNullValue()); + + // If we're not at the root level and a modification callback is provided, apply it to null query + if ($this->modifyQueryUsing) { + $nullParentQuery = $this->evaluate($this->modifyQueryUsing, ['query' => $nullParentQuery]); + } + + if ($this->withTrashed) { + $nullParentQuery->withTrashed($this->withTrashed); + $nonNullParentQuery->withTrashed($this->withTrashed); + } + + $nullParentResults = $nullParentQuery->get(); + $nonNullParentResults = $nonNullParentQuery->get(); + + // Combine the results from both queries + $combinedResults = $nullParentResults->concat($nonNullParentResults); + + return $this->buildTreeFromResults($combinedResults); + } + + private function buildTreeFromResults($results, $parent = null): Collection + { + // Assign the parent's null value to the $parent variable if it's not null + if ($parent === null || $parent === $this->getParentNullValue()) { + $parent = $this->getParentNullValue() ?? $parent; + } + + // Create a collection to store the tree + $tree = collect(); + + // Create a mapping of results by their parent IDs for faster lookup + $resultMap = []; + + // Group results by their parent IDs + foreach ($results as $result) { + $parentId = $result->{$this->getParentAttribute()}; + if (! isset($resultMap[$parentId])) { + $resultMap[$parentId] = []; + } + $resultMap[$parentId][] = $result; + } + + // Define disabled options + $disabledOptions = $this->getDisabledOptions(); + + // Define hidden options + $hiddenOptions = $this->getHiddenOptions(); + + // Recursively build the tree starting from the root (null parent) + $rootResults = $resultMap[$parent] ?? []; + foreach ($rootResults as $result) { + // Build a node and add it to the tree + $node = $this->buildNode($result, $resultMap, $disabledOptions, $hiddenOptions); + $tree->push($node); + } + + return $tree; + } + + private function buildNode($result, $resultMap, $disabledOptions, $hiddenOptions): array + { + $key = $this->getCustomKey($result); + + // Create a node with 'name' and 'value' attributes + $node = [ + 'name' => $result->{$this->getTitleAttribute()}, + 'value' => $key, + 'parent' => $result->{$this->getParentAttribute()}, + 'disabled' => in_array($key, $disabledOptions), + 'hidden' => in_array($key, $hiddenOptions), + ]; + + // Check if the result has children + if (isset($resultMap[$key])) { + $children = collect(); + // Recursively build child nodes + foreach ($resultMap[$key] as $child) { + // don't add the hidden ones + if (in_array($this->getCustomKey($child), $hiddenOptions)) { + continue; + } + $childNode = $this->buildNode($child, $resultMap, $disabledOptions, $hiddenOptions); + $children->push($childNode); + } + // Add children to the node + $node['children'] = $children->toArray(); + } + + return $node; + } + + public function relationship(string $relationship, string $titleAttribute, string $parentAttribute, ?Closure $modifyQueryUsing = null): self + { + $this->relationship = $relationship; + $this->titleAttribute = $titleAttribute; + $this->parentAttribute = $parentAttribute; + $this->modifyQueryUsing = $modifyQueryUsing; + + return $this; + } + + public function withCount(bool $withCount = true): static + { + $this->withCount = $withCount; + + return $this; + } + + public function withTrashed(bool $withTrashed = true): static + { + $this->withTrashed = $withTrashed; + + return $this; + } + + public function direction(string $direction): static + { + $this->direction = $direction; + + return $this; + } + + public function parentNullValue(int | string | null $parentNullValue = null): static + { + $this->parentNullValue = $parentNullValue; + + return $this; + } + + public function getRelationship(): BelongsToMany | BelongsTo + { + return $this->getModelInstance()->{$this->evaluate($this->relationship)}(); + } + + public function getTitleAttribute(): string + { + return $this->evaluate($this->titleAttribute); + } + + public function getParentAttribute(): string + { + return $this->evaluate($this->parentAttribute); + } + + public function getParentNullValue(): null | int | string + { + return $this->evaluate($this->parentNullValue); + } + + public function clearable(bool $clearable = true): static + { + $this->clearable = $clearable; + + return $this; + } + + public function grouped(bool $grouped = true): static + { + $this->grouped = $grouped; + + return $this; + } + + public function defaultOpenLevel(Closure | int $defaultOpenLevel = 0): static + { + $this->defaultOpenLevel = $defaultOpenLevel; + + return $this; + } + + public function expandSelected(bool $expandSelected = true): static + { + $this->expandSelected = $expandSelected; + + return $this; + } + + public function emptyLabel(string $emptyLabel): static + { + $this->emptyLabel = $emptyLabel; + + return $this; + } + + public function independent(bool $independent = true): static + { + $this->independent = $independent; + + return $this; + } + + public function withKey(string $customKey): static + { + $this->customKey = $customKey; + + return $this; + } + + public function disabledOptions(Closure | array $disabledOptions): static + { + $this->disabledOptions = $disabledOptions; + + return $this; + } + + public function hiddenOptions(Closure | array $hiddenOptions): static + { + $this->hiddenOptions = $hiddenOptions; + + return $this; + } + + public function alwaysOpen(bool $alwaysOpen = true): static + { + $this->alwaysOpen = $alwaysOpen; + + return $this; + } + + public function enableBranchNode(bool $enableBranchNode = true): static + { + $this->enableBranchNode = $enableBranchNode; + + return $this; + } + + public function getTree(): Collection | array + { + return $this->evaluate($this->buildTree()); + } + + public function getExpandSelected(): bool + { + return $this->evaluate($this->expandSelected); + } + + public function getGrouped(): bool + { + return $this->evaluate($this->grouped); + } + + public function getWithTrashed(): bool + { + return $this->evaluate($this->withTrashed); + } + + public function getIndependent(): bool + { + return $this->evaluate($this->independent); + } + + public function getCustomKey($record) + { + return is_null($this->customKey) ? $record->getKey() : $record->{$this->customKey}; + } + + public function getWithCount(): bool + { + return $this->evaluate($this->withCount); + } + + public function getMultiple(): bool + { + return $this->evaluate($this->getRelationship() instanceof BelongsToMany); + } + + public function getClearable(): bool + { + return $this->evaluate($this->clearable); + } + + public function getAlwaysOpen(): bool + { + return $this->evaluate($this->alwaysOpen); + } + + public function getEnableBranchNode(): bool + { + return $this->evaluate($this->enableBranchNode); + } + + public function getDefaultOpenLevel(): int + { + return $this->evaluate($this->defaultOpenLevel); + } + + public function getEmptyLabel(): string + { + return $this->emptyLabel ? $this->evaluate($this->emptyLabel) : __('No results found'); + } + + public function getDirection(): string + { + return $this->evaluate($this->direction); + } + + public function getDisabledOptions(): array + { + return $this->evaluate($this->disabledOptions); + } + + public function getHiddenOptions(): array + { + return $this->evaluate($this->hiddenOptions); + } + + public function getCreateOptionActionForm(Form $form): array | Form | null + { + return $this->evaluate($this->createOptionActionForm, ['form' => $form]); + } + + public function hasCreateOptionActionFormSchema(): bool + { + return (bool) $this->createOptionActionForm; + } + + public function getCreateOptionModalHeading(): ?string + { + return $this->evaluate($this->createOptionModalHeading); + } + + public function createOptionForm(array | Closure | null $schema): static + { + $this->createOptionActionForm = $schema; + + return $this; + } + + public function getCreateOptionActionName(): string + { + return 'createOption'; + } + + public function getCreateOptionUsing(): ?Closure + { + return $this->createOptionUsing; + } + + public function createOptionUsing(Closure $callback): static + { + $this->createOptionUsing = $callback; + + return $this; + } + + public function getCreateOptionAction(): ?Action + { + if ($this->isDisabled()) { + return null; + } + + if (! $this->hasCreateOptionActionFormSchema()) { + return null; + } + + $action = Action::make($this->getCreateOptionActionName()) + ->form(function (SelectTree $component, Form $form): array | Form | null { + return $component->getCreateOptionActionForm($form->model( + $component->getRelationship() ? $component->getRelationship()->getModel()::class : null, + )); + }) + ->action(static function (Action $action, array $arguments, SelectTree $component, array $data, ComponentContainer $form): void { + if (! $component->getCreateOptionUsing()) { + throw new Exception("Select field [{$component->getStatePath()}] must have a [createOptionUsing()] closure set."); + } + + $createdOptionKey = $component->evaluate($component->getCreateOptionUsing(), [ + 'data' => $data, + 'form' => $form, + ]); + + $state = $component->getMultiple() + ? [ + ...$component->getState() ?? [], + $createdOptionKey, + ] + : $createdOptionKey; + + $component->state($state); + $component->callAfterStateUpdated(); + + if (! ($arguments['another'] ?? false)) { + return; + } + + $action->callAfter(); + + $form->fill(); + + $action->halt(); + }) + ->color('gray') + ->icon(FilamentIcon::resolve('forms::components.select.actions.create-option') ?? 'heroicon-m-plus') + ->iconButton() + ->modalHeading($this->getCreateOptionModalHeading() ?? __('filament-forms::components.select.actions.create_option.modal.heading')) + ->modalSubmitActionLabel(__('filament-forms::components.select.actions.create_option.modal.actions.create.label')) + ->extraModalFooterActions(fn (Action $action, SelectTree $component): array => $component->getMultiple() ? [ + $action->makeModalSubmitAction('createAnother', arguments: ['another' => true]) + ->label(__('filament-forms::components.select.actions.create_option.modal.actions.create_another.label')), + ] : []); + + if ($this->modifyManageOptionActionsUsing) { + $action = $this->evaluate($this->modifyManageOptionActionsUsing, [ + 'action' => $action, + ]) ?? $action; + } + + if ($this->modifyCreateOptionActionUsing) { + $action = $this->evaluate($this->modifyCreateOptionActionUsing, [ + 'action' => $action, + ]) ?? $action; + } + + return $action; + } +} diff --git a/packages/admin/src/Components/Form/ShippingField.php b/packages/admin/src/Components/Form/ShippingField.php new file mode 100644 index 000000000..d2114f5ab --- /dev/null +++ b/packages/admin/src/Components/Form/ShippingField.php @@ -0,0 +1,62 @@ +label(__('shopper::layout.forms.label.width')) + ->numeric() + ->select( + fn () => Forms\Components\Select::make('width_unit') + ->selectablePlaceholder(false) + ->native(false) + ->options(Length::toArray()) + ->default(Length::CM) + ), + + TextInputSelect::make('height_value') + ->label(__('shopper::layout.forms.label.height')) + ->numeric() + ->select( + fn () => Forms\Components\Select::make('height_unit') + ->selectablePlaceholder(false) + ->native(false) + ->options(Length::toArray()) + ->default(Length::CM) + ), + + TextInputSelect::make('weight_value') + ->label(__('shopper::layout.forms.label.weight')) + ->numeric() + ->select( + fn () => Forms\Components\Select::make('weight_unit') + ->selectablePlaceholder(false) + ->native(false) + ->options(Weight::toArray()) + ->default(Weight::KG) + ), + + TextInputSelect::make('volume_value') + ->label(__('shopper::layout.forms.label.volume')) + ->numeric() + ->select( + fn () => Forms\Components\Select::make('volume_unit') + ->selectablePlaceholder(false) + ->native(false) + ->options(Volume::toArray()) + ->default(Volume::ML) + ), + ]; + } +} diff --git a/packages/admin/src/Components/Form/TextInputSelect.php b/packages/admin/src/Components/Form/TextInputSelect.php new file mode 100644 index 000000000..9208f72e8 --- /dev/null +++ b/packages/admin/src/Components/Form/TextInputSelect.php @@ -0,0 +1,103 @@ +selectComponentClosure = fn () => $closure; + + return $this; + } + $this->selectComponentClosure = $closure; + + return $this; + } + + public function position(string $position = 'suffix'): TextInputSelect + { + $this->position = $position; + + return $this; + } + + public function hasSelect(): bool + { + return $this->selectComponentClosure !== null; + } + + public function dehydrateValidationAttributes(array &$attributes): void + { + $attributes[$this->getStatePath()] = $this->getValidationAttribute(); + $attributes[$this->getSelectComponent()->getComponents()[0]->getStatePath()] = $this->evaluate($this->selectComponent->validationAttribute) ?? $this->evaluate($this->selectComponent->getLabel()); + } + + public function dehydrateValidationRules(array &$rules): void + { + $statePath = $this->getStatePath(); + + if (count($componentRules = $this->getValidationRules())) { + $rules[$statePath] = $componentRules; + } + + $statePathSelect = $this->getSelectComponent()->getComponents()[0]->getStatePath(); + + if (count($selectComponentRules = $this->selectComponent->getValidationRules())) { + $rules[$statePathSelect] = $selectComponentRules; + } + } + + public function hydrateState(?array &$hydratedDefaultState, bool $andCallHydrationHooks = true): void + { + parent::hydrateState($hydratedDefaultState, $andCallHydrationHooks); + if ($this->hasSelect()) { + $this->getSelectComponent()->hydrateState($hydratedDefaultState, $andCallHydrationHooks); + } + } + + public function getPosition(): string + { + return $this->position; + } + + public function getSelectComponent(): ComponentContainer + { + $evaluated = $this->evaluate($this->selectComponentClosure); + + if (! $evaluated instanceof Select) { + throw new RuntimeException('Passed component must be of type Select'); + } + + $this->selectComponent = $evaluated->hiddenLabel() + ->extraAttributes(array_merge($evaluated->getExtraAttributes(), [ + 'style' => 'border: none !important; background: transparent;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);', + ])); + $path = explode('.', $this->getStatePath()); + unset($path[count($path) - 1]); + + return ComponentContainer::make($this->getLivewire()) + ->statePath(implode('.', $path)) + ->components([$this->selectComponent]); + } +} diff --git a/packages/admin/src/Components/Wizard/StepColumn.php b/packages/admin/src/Components/Wizard/StepColumn.php new file mode 100644 index 000000000..e43047304 --- /dev/null +++ b/packages/admin/src/Components/Wizard/StepColumn.php @@ -0,0 +1,11 @@ +getNextActionName()) + ->label(__('filament-forms::components.wizard.actions.next_step.label')) + ->iconPosition(IconPosition::After) + ->livewireClickHandlerEnabled(false) + ->livewireTarget('dispatchFormEvent') + ->color('primary') + ->button(); + + if ($this->modifyNextActionUsing) { + $action = $this->evaluate($this->modifyNextActionUsing, [ + 'action' => $action, + ]) ?? $action; + } + + return $action; + } +} diff --git a/packages/admin/src/Events/CatalogSidebar.php b/packages/admin/src/Events/CatalogSidebar.php index c934f3f21..cb2964ab5 100755 --- a/packages/admin/src/Events/CatalogSidebar.php +++ b/packages/admin/src/Events/CatalogSidebar.php @@ -18,15 +18,15 @@ public function extendWith(Menu $menu): Menu $group->weight(2); $group->setAuthorized(); $group->setGroupItemsClass('space-y-1'); - $group->setHeadingClass('menu-heading text-xs leading-5 text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-2 font-medium ml-3'); + $group->setHeadingClass('sh-heading'); if (Feature::enabled('product')) { $group->item(__('shopper::layout.sidebar.products'), function (Item $item): void { $item->weight(1); $item->setAuthorized($this->user->hasPermissionTo('browse_products')); - $item->setItemClass('group flex items-center rounded-lg py-2 px-3 text-sm font-medium'); - $item->setActiveClass('text-primary-600 bg-gray-100 dark:bg-gray-700/50'); - $item->setInactiveClass('text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white hover:bg-gray-50 dark:hover:bg-gray-900'); + $item->setItemClass('sh-sidebar-item group'); + $item->setActiveClass('sh-sidebar-item-active'); + $item->setInactiveClass('sh-sidebar-item-inactive'); $item->useSpa(); $item->route('shopper.products.index'); $item->setIcon( @@ -53,9 +53,9 @@ public function extendWith(Menu $menu): Menu $group->item(__('shopper::layout.sidebar.categories'), function (Item $item): void { $item->weight(2); $item->setAuthorized($this->user->hasPermissionTo('browse_categories')); - $item->setItemClass('group flex items-center rounded-lg py-2 px-3 text-sm font-medium'); - $item->setActiveClass('text-primary-600 bg-gray-100 dark:bg-gray-700/50'); - $item->setInactiveClass('text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white hover:bg-gray-50 dark:hover:bg-gray-900'); + $item->setItemClass('sh-sidebar-item group'); + $item->setActiveClass('sh-sidebar-item-active'); + $item->setInactiveClass('sh-sidebar-item-inactive'); $item->useSpa(); $item->route('shopper.categories.index'); $item->setIcon( @@ -72,9 +72,9 @@ public function extendWith(Menu $menu): Menu $group->item(__('shopper::layout.sidebar.collections'), function (Item $item): void { $item->weight(3); $item->setAuthorized($this->user->hasPermissionTo('browse_collections')); - $item->setItemClass('group flex items-center rounded-lg py-2 px-3 text-sm font-medium'); - $item->setActiveClass('text-primary-600 bg-gray-100 dark:bg-gray-700/50'); - $item->setInactiveClass('text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white hover:bg-gray-50 dark:hover:bg-gray-900'); + $item->setItemClass('sh-sidebar-item group'); + $item->setActiveClass('sh-sidebar-item-active'); + $item->setInactiveClass('sh-sidebar-item-inactive'); $item->useSpa(); $item->route('shopper.collections.index'); $item->setIcon( @@ -91,9 +91,9 @@ public function extendWith(Menu $menu): Menu $group->item(__('shopper::layout.sidebar.brands'), function (Item $item): void { $item->weight(4); $item->setAuthorized($this->user->hasPermissionTo('browse_brands')); - $item->setItemClass('group flex items-center rounded-lg py-2 px-3 text-sm font-medium'); - $item->setActiveClass('text-primary-600 bg-gray-100 dark:bg-gray-700/50'); - $item->setInactiveClass('text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white hover:bg-gray-50 dark:hover:bg-gray-900'); + $item->setItemClass('sh-sidebar-item group'); + $item->setActiveClass('sh-sidebar-item-active'); + $item->setInactiveClass('sh-sidebar-item-inactive'); $item->useSpa(); $item->route('shopper.brands.index'); $item->setIcon( diff --git a/packages/admin/src/Events/CustomerSidebar.php b/packages/admin/src/Events/CustomerSidebar.php index 0219433fd..9f5e415a5 100755 --- a/packages/admin/src/Events/CustomerSidebar.php +++ b/packages/admin/src/Events/CustomerSidebar.php @@ -18,15 +18,15 @@ public function extendWith(Menu $menu): Menu $group->weight(3); $group->setAuthorized(); $group->setGroupItemsClass('space-y-1'); - $group->setHeadingClass('menu-heading text-xs leading-5 text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-2 font-medium ml-3'); + $group->setHeadingClass('sh-heading'); if (Feature::enabled('customer')) { $group->item(__('shopper::layout.sidebar.customers'), function (Item $item): void { $item->weight(1); $item->setAuthorized($this->user->hasPermissionTo('browse_customers')); - $item->setItemClass('group flex items-center rounded-lg py-2 px-3 text-sm font-medium'); - $item->setActiveClass('text-primary-600 bg-gray-100 dark:bg-gray-700/50'); - $item->setInactiveClass('text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white hover:bg-gray-50 dark:hover:bg-gray-900'); + $item->setItemClass('sh-sidebar-item group'); + $item->setActiveClass('sh-sidebar-item-active'); + $item->setInactiveClass('sh-sidebar-item-inactive'); $item->route('shopper.customers.index'); $item->useSpa(); $item->setIcon( @@ -43,9 +43,9 @@ public function extendWith(Menu $menu): Menu $group->item(__('shopper::layout.sidebar.reviews'), function (Item $item): void { $item->weight(2); $item->setAuthorized($this->user->hasPermissionTo('browse_products')); - $item->setItemClass('group flex items-center rounded-lg py-2 px-3 text-sm font-medium'); - $item->setActiveClass('text-primary-600 bg-gray-100 dark:bg-gray-700/50'); - $item->setInactiveClass('text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white hover:bg-gray-50 dark:hover:bg-gray-900'); + $item->setItemClass('sh-sidebar-item group'); + $item->setActiveClass('sh-sidebar-item-active'); + $item->setInactiveClass('sh-sidebar-item-inactive'); $item->route('shopper.reviews.index'); $item->useSpa(); $item->setIcon( diff --git a/packages/admin/src/Events/DashboardSidebar.php b/packages/admin/src/Events/DashboardSidebar.php index 65ea3a1a1..9456fae78 100755 --- a/packages/admin/src/Events/DashboardSidebar.php +++ b/packages/admin/src/Events/DashboardSidebar.php @@ -19,9 +19,9 @@ public function extendWith(Menu $menu): Menu $group->item(__('shopper::layout.sidebar.dashboard'), function (Item $item): void { $item->weight(1); - $item->setItemClass('group flex items-center rounded-lg py-2 px-3 text-sm font-medium'); - $item->setActiveClass('text-primary-600 bg-gray-100 dark:bg-gray-700/50'); - $item->setInactiveClass('text-gray-600 dark:text-gray-300 hover:text-gray-900 hover:bg-gray-50 dark:hover:text-white dark:hover:bg-gray-900'); + $item->setItemClass('sh-sidebar-item group'); + $item->setActiveClass('sh-sidebar-item-active'); + $item->setInactiveClass('sh-sidebar-item-inactive'); $item->useSpa(); $item->route('shopper.dashboard'); $item->setIcon( diff --git a/packages/admin/src/Events/SalesSidebar.php b/packages/admin/src/Events/SalesSidebar.php index e11a3d3cd..b165ed3c4 100755 --- a/packages/admin/src/Events/SalesSidebar.php +++ b/packages/admin/src/Events/SalesSidebar.php @@ -22,15 +22,15 @@ public function extendWith(Menu $menu): Menu $group->weight(3); $group->setAuthorized(); $group->setGroupItemsClass('space-y-1'); - $group->setHeadingClass('menu-heading text-xs leading-5 text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-2 font-medium ml-3'); + $group->setHeadingClass('sh-heading'); if (Feature::enabled('order')) { $group->item(__('shopper::layout.sidebar.orders'), function (Item $item) use ($count): void { $item->weight(1); $item->setAuthorized($this->user->hasPermissionTo('browse_orders')); - $item->setItemClass('group flex items-center rounded-lg py-2 px-3 text-sm font-medium'); - $item->setActiveClass('text-primary-500 bg-gray-100 dark:bg-gray-700/50'); - $item->setInactiveClass('text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white hover:bg-gray-50 dark:hover:bg-gray-900'); + $item->setItemClass('sh-sidebar-item group'); + $item->setActiveClass('sh-sidebar-item-active'); + $item->setInactiveClass('sh-sidebar-item-inactive'); if ($count > 0) { $item->badge($count, 'inline-flex items-center rounded-full bg-yellow-50 px-2 py-1 text-xs font-medium text-yellow-800 ring-1 ring-inset ring-yellow-600/20'); @@ -52,9 +52,9 @@ public function extendWith(Menu $menu): Menu $group->item(__('shopper::layout.sidebar.discounts'), function (Item $item): void { $item->weight(2); $item->setAuthorized($this->user->hasPermissionTo('browse_discounts')); - $item->setItemClass('group flex items-center rounded-lg py-2 px-3 text-sm font-medium'); - $item->setActiveClass('text-primary-500 bg-gray-100 dark:bg-gray-700/50'); - $item->setInactiveClass('text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white hover:bg-gray-50 dark:hover:bg-gray-900'); + $item->setItemClass('sh-sidebar-item group'); + $item->setActiveClass('sh-sidebar-item-active'); + $item->setInactiveClass('sh-sidebar-item-inactive'); $item->useSpa(); $item->route('shopper.discounts.index'); $item->setIcon( diff --git a/packages/admin/src/Livewire/Components/Products/Browse.php b/packages/admin/src/Livewire/Components/Products/Browse.php deleted file mode 100755 index 819c54258..000000000 --- a/packages/admin/src/Livewire/Components/Products/Browse.php +++ /dev/null @@ -1,19 +0,0 @@ - (new ProductRepository())->count(), - ]); - } -} diff --git a/packages/admin/src/Livewire/Components/Products/Create.php b/packages/admin/src/Livewire/Components/Products/Create.php deleted file mode 100755 index 3e183449d..000000000 --- a/packages/admin/src/Livewire/Components/Products/Create.php +++ /dev/null @@ -1,166 +0,0 @@ - 'name', - 'description' => 'description', - ]; - - protected $listeners = [ - 'productAdded', - 'trix:valueUpdated' => 'onTrixValueUpdate', - 'shopper:filesUpdated' => 'onFilesUpdated', - ]; - - public function mount(): void - { - $this->defaultChannel = (new ChannelRepository()) - ->where('is_default', true) - ->first(); - } - - public function onTrixValueUpdate(string $value): void - { - $this->description = $value; - } - - public function onFilesUpdated(array $files): void - { - $this->files = $files; - } - - public function rules(): array - { - return [ - 'name' => 'bail|required', - 'sku' => 'nullable|unique:' . shopper_table('products'), - 'barcode' => 'nullable|unique:' . shopper_table('products'), - 'brand_id' => 'nullable|integer|exists:' . shopper_table('brands') . ',id', - ]; - } - - public function store(): void - { - $this->validate($this->rules()); - - /** @var Product $product */ - $product = (new ProductRepository())->create([ - 'name' => $this->name, - 'slug' => $this->name, - 'sku' => $this->sku, - 'barcode' => $this->barcode, - 'description' => $this->description, - 'security_stock' => $this->securityStock, - 'is_visible' => $this->isVisible, - 'old_price_amount' => $this->old_price_amount, - 'price_amount' => $this->price_amount, - 'cost_amount' => $this->cost_amount, - 'type' => $this->type, - 'require_shipping' => $this->requireShipping, - 'backorder' => $this->backorder, - 'published_at' => $this->publishedAt ?? now(), - 'seo_title' => $this->seoTitle, - 'seo_description' => str_limit($this->seoDescription, 157), - 'weight_value' => $this->weightValue ?? null, - 'weight_unit' => $this->weightUnit, - 'height_value' => $this->heightValue ?? null, - 'height_unit' => $this->heightUnit, - 'width_value' => $this->widthValue ?? null, - 'width_unit' => $this->widthUnit, - 'volume_value' => $this->volumeValue ?? null, - 'volume_unit' => $this->volumeUnit, - 'brand_id' => $this->brand_id ?? null, - ]); - - if (collect($this->files)->isNotEmpty()) { - collect($this->files)->each( - fn ($file) => $product->addMedia($file)->toMediaCollection(config('shopper.core.storage.collection_name')) - ); - } - - if (collect($this->category_ids)->isNotEmpty()) { - $product->categories()->attach($this->category_ids); - } - - if (collect($this->collection_ids)->isNotEmpty()) { - $product->collections()->attach($this->collection_ids); - } - - $product->channels()->attach($this->defaultChannel->id); - - if ($this->quantity && count($this->quantity) > 0) { - foreach ($this->quantity as $inventory => $value) { - $product->mutateStock( - inventoryId: $inventory, - quantity: (int) $value, - arguments: [ - 'event' => __('shopper::pages/products.inventory.initial'), - 'old_quantity' => $value, - ] - ); - } - } - - session()->flash('success', __('shopper::pages/products.notifications.create')); - - $this->redirectRoute('shopper.products.index'); - } - - public function render(): View - { - return view('shopper::livewire.products.create', [ - 'brands' => (new BrandRepository()) - ->makeModel() - ->scopes('enabled') - ->select('name', 'id') - ->get(), - 'categories' => (new CategoryRepository()) - ->makeModel() - ->scopes('enabled') - ->tree() - ->orderBy('name') - ->get() - ->toTree(), - 'collections' => (new CollectionRepository()) - ->with('media') - ->get(['name', 'id']), - 'inventories' => Inventory::query()->get(['name', 'id']), - 'currency' => shopper_currency(), - 'barcodeImage' => $this->barcode - ? DNS1DFacade::getBarcodeHTML($this->barcode, config('shopper.core.barcode_type')) // @phpstan-ignore-line - : null, - ]); - } -} diff --git a/packages/admin/src/Livewire/Components/Products/Edit.php b/packages/admin/src/Livewire/Components/Products/Edit.php deleted file mode 100755 index 5be578f6b..000000000 --- a/packages/admin/src/Livewire/Components/Products/Edit.php +++ /dev/null @@ -1,41 +0,0 @@ -product = $product; - $this->inventories = $inventories = Inventory::all(); - $this->inventory = $inventories->firstWhere('is_default', true)->id ?? $inventories->first()?->id; - } - - public function productHasUpdated(int $id): void - { - $this->product = (new ProductRepository())->getById($id); - } - - public function render(): View - { - return view('shopper::livewire.products.edit', [ - 'currency' => shopper_currency(), - ]); - } -} diff --git a/packages/admin/src/Livewire/Components/Products/Form/Edit.php b/packages/admin/src/Livewire/Components/Products/Form/Edit.php index c85b28cca..2b442c52b 100755 --- a/packages/admin/src/Livewire/Components/Products/Form/Edit.php +++ b/packages/admin/src/Livewire/Components/Products/Form/Edit.php @@ -4,117 +4,169 @@ namespace Shopper\Livewire\Components\Products\Form; +use Filament\Forms; +use Filament\Forms\Concerns\InteractsWithForms; +use Filament\Forms\Contracts\HasForms; +use Filament\Forms\Form; use Filament\Notifications\Notification; use Illuminate\Contracts\View\View; -use Livewire\WithFileUploads; +use Illuminate\Database\Eloquent\Builder; +use Illuminate\Support\Arr; +use Illuminate\Support\Str; +use Livewire\Component; +use Shopper\Components; use Shopper\Core\Events\Products\Updated; -use Shopper\Core\Exceptions\GeneralException; -use Shopper\Core\Repositories\Store\BrandRepository; -use Shopper\Core\Repositories\Store\CategoryRepository; -use Shopper\Core\Repositories\Store\CollectionRepository; -use Shopper\Core\Traits\Attributes\WithChoicesBrands; -use Shopper\Core\Traits\Attributes\WithSeoAttributes; -use Shopper\Core\Traits\Attributes\WithUploadProcess; -use Shopper\Livewire\AbstractBaseComponent; -use Shopper\Livewire\Components\Products\WithAttributes; - -class Edit extends AbstractBaseComponent +use Shopper\Feature; + +class Edit extends Component implements HasForms { - use WithAttributes; - use WithChoicesBrands; - use WithFileUploads; - use WithSeoAttributes; - use WithUploadProcess; + use InteractsWithForms; public $product; - public int $productId; - - public string $currency; - - public array $category_ids = []; - - public array $collection_ids = []; - - public $images = []; - - protected $listeners = [ - 'trix:valueUpdated' => 'onTrixValueUpdate', - 'mediaDeleted', - ]; - - public function mount($product, string $currency): void - { - $this->product = $product; - $this->productId = $product->id; - $this->name = $product->name; - $this->sku = $product->sku; - $this->brand_id = $product->brand_id; - $this->description = $product->description; - $this->isVisible = $product->is_visible; - $this->price_amount = $product->price_amount; - $this->old_price_amount = $product->old_price_amount; - $this->cost_amount = $product->cost_amount; - $this->publishedAt = $product->published_at?->format('Y-m-d H:m'); - $this->publishedAtFormatted = $product->published_at?->toRfc7231String(); - $this->collection_ids = $product->collections->pluck('id')->toArray(); - $this->category_ids = $product->categories->pluck('id')->toArray(); - $this->selectedBrand = $product->brand_id ? [$product->brand_id] : []; - $this->currency = $currency; - $this->images = $product->getMedia(config('shopper.core.storage.collection_name')); - } + public ?array $data = []; - public function onTrixValueUpdate(string $value): void + public function mount($product): void { - $this->description = $value; - } + $this->product = $product->load([ + 'brand', + 'categories', + 'collections', + ]); - public function mediaDeleted(): void - { - $this->images = $this->product->getMedia(config('shopper.core.storage.collection_name')); + $this->form->fill($this->product->toArray()); } - public function rules(): array + public function form(Form $form): Form { - return [ - 'name' => 'required', - 'files.*' => 'nullable|image|max:5120', - 'brand_id' => 'nullable|integer|exists:' . shopper_table('brands') . ',id', - ]; + return $form + ->schema([ + Forms\Components\Grid::make() + ->schema([ + Forms\Components\Grid::make() + ->schema([ + Forms\Components\TextInput::make('name') + ->label(__('shopper::layout.forms.label.name')) + ->required() + ->maxLength(255) + ->live(onBlur: true) + ->afterStateUpdated(function ($state, Forms\Set $set): void { + $set('slug', Str::slug($state)); + }), + Forms\Components\TextInput::make('slug') + ->label(__('shopper::layout.forms.label.slug')) + ->disabled() + ->dehydrated() + ->required() + ->maxLength(255) + ->unique(config('shopper.models.product'), 'slug', ignoreRecord: true), + + Forms\Components\RichEditor::make('description') + ->label(__('shopper::layout.forms.label.description')) + ->columnSpan('full'), + ]), + + Components\Separator::make() + ->columnSpan('full'), + + Forms\Components\Grid::make() + ->schema([ + Forms\Components\TextInput::make('price_amount') + ->label(__('shopper::layout.forms.label.price_amount')) + ->numeric() + ->rules(['regex:/^\d{1,6}(\.\d{0,2})?$/']) + ->suffix(shopper_currency()) + ->currencyMask(thousandSeparator: ',', decimalSeparator: '.', precision: 2), + + Forms\Components\TextInput::make('old_price_amount') + ->label(__('shopper::layout.forms.label.compare_price')) + ->numeric() + ->rules(['regex:/^\d{1,6}(\.\d{0,2})?$/']) + ->suffix(shopper_currency()) + ->currencyMask(thousandSeparator: ',', decimalSeparator: '.', precision: 2), + + Forms\Components\TextInput::make('cost_amount') + ->label(__('shopper::layout.forms.label.cost_per_item')) + ->helperText(__('shopper::pages/products.cost_per_items_help_text')) + ->numeric() + ->rules(['regex:/^\d{1,6}(\.\d{0,2})?$/']) + ->suffix(shopper_currency()) + ->currencyMask(thousandSeparator: ',', decimalSeparator: '.', precision: 2), + ]), + ]) + ->columnSpan(['lg' => 2]), + + Forms\Components\Group::make() + ->schema([ + Forms\Components\Section::make('Status') + ->schema([ + Forms\Components\Toggle::make('is_visible') + ->label(__('shopper::layout.forms.label.visible')) + ->helperText(__('shopper::pages/products.visible_help_text')) + ->onColor('success') + ->default(true), + + Forms\Components\DateTimePicker::make('published_at') + ->label(__('shopper::layout.forms.label.availability')) + ->native(false) + ->default(now()) + ->helperText(__('shopper::pages/products.availability_description')) + ->required(), + ]), + + Forms\Components\Section::make(__('shopper::pages/products.product_associations')) + ->schema([ + Forms\Components\Select::make('brand_id') + ->label(__('shopper::layout.forms.label.brand')) + ->relationship('brand', 'name', fn (Builder $query) => $query->where('is_enabled', true)) + ->searchable() + ->visible(Feature::enabled('brand')), + + Forms\Components\Select::make('collections') + ->label(__('shopper::layout.sidebar.collections')) + ->relationship('collections', 'name', fn (Builder $query) => $query->where('is_enabled', true)) + ->searchable() + ->multiple() + ->visible(Feature::enabled('collection')), + + Components\Form\SelectTree::make('categories') + ->label(__('shopper::layout.sidebar.categories')) + ->relationship( + relationship: 'categories', + titleAttribute: 'name', + parentAttribute: 'parent_id' + ) + ->searchable() + ->independent(false) + ->enableBranchNode() + ->visible(Feature::enabled('category')), + ]) + ->visible( + Feature::enabled('brand') + || Feature::enabled('category') + || Feature::enabled('collection') + ), + ]) + ->columnSpan(['lg' => 1]), + ]) + ->columns(3) + ->statePath('data') + ->model($this->product); } public function store(): void { - $this->validate($this->rules()); - - $this->product->update([ - 'name' => $this->name, - 'slug' => $this->name, - 'description' => $this->description, - 'is_visible' => $this->isVisible, - 'old_price_amount' => $this->old_price_amount, - 'price_amount' => $this->price_amount, - 'cost_amount' => $this->cost_amount, - 'published_at' => $this->publishedAt, - 'brand_id' => $this->brand_id, - ]); + $data = $this->form->getState(); - if (collect($this->files)->isNotEmpty()) { - collect($this->files)->each( - fn ($file) => $this->product->addMedia($file->getRealPath()) - ->toMediaCollection(config('shopper.core.storage.collection_name')) - ); - } + $this->product->update(Arr::except($data, ['categories'])); - if (collect($this->category_ids)->isNotEmpty()) { - $this->product->categories()->sync($this->category_ids); + if (collect($data['categories'])->isNotEmpty()) { + $this->product->categories()->sync($data['categories']); } - $this->product->collections()->sync($this->collection_ids); - event(new Updated($this->product)); - $this->emit('productHasUpdated', $this->productId); + $this->dispatch('productHasUpdated'); Notification::make() ->body(__('shopper::pages/products.notifications.update')) @@ -122,25 +174,8 @@ public function store(): void ->send(); } - /** - * @throws GeneralException - */ public function render(): View { - return view('shopper::livewire.products.forms.form-edit', [ - 'brands' => (new BrandRepository()) - ->makeModel() - ->scopes('enabled') - ->select('name', 'id') - ->get(), - 'categories' => (new CategoryRepository()) - ->makeModel() - ->scopes('enabled') - ->tree() - ->orderBy('name') - ->get() - ->toTree(), - 'collections' => (new CollectionRepository())->get(['name', 'id']), - ]); + return view('shopper::livewire.components.products.forms.edit'); } } diff --git a/packages/admin/src/Livewire/Components/Products/Form/Inventory.php b/packages/admin/src/Livewire/Components/Products/Form/Inventory.php index 72f190317..d6a3921bb 100755 --- a/packages/admin/src/Livewire/Components/Products/Form/Inventory.php +++ b/packages/admin/src/Livewire/Components/Products/Form/Inventory.php @@ -4,41 +4,197 @@ namespace Shopper\Livewire\Components\Products\Form; +use Filament\Forms; +use Filament\Forms\Concerns\InteractsWithForms; +use Filament\Forms\Contracts\HasForms; +use Filament\Forms\Form; use Filament\Notifications\Notification; +use Filament\Support\Enums\MaxWidth; +use Filament\Tables; +use Filament\Tables\Concerns\InteractsWithTable; +use Filament\Tables\Contracts\HasTable; +use Filament\Tables\Table; use Illuminate\Contracts\View\View; use Illuminate\Validation\Rule; +use Livewire\Attributes\On; use Livewire\Component; -use Livewire\WithPagination; -use Milon\Barcode\Facades\DNS1DFacade; +use Shopper\Components; use Shopper\Core\Models\InventoryHistory; use Shopper\Core\Traits\Attributes\WithStock; -use Shopper\Livewire\Components\Products\WithAttributes; -class Inventory extends Component +class Inventory extends Component implements HasForms, HasTable { - use WithAttributes; - use WithPagination; - use WithStock; + use InteractsWithForms; + use InteractsWithTable; + // use WithStock; public $product; - public $inventories; + public ?array $data = []; - public function mount($product, $inventories, $defaultInventory): void + public function mount($product): void { - $this->inventories = $inventories; - $this->inventory = $defaultInventory; $this->product = $product; + + $this->form->fill($this->product->toArray()); + /*$this->inventories = $inventories; + $this->inventory = $defaultInventory; $this->stock = $product->stock; - $this->realStock = $product->stock; - $this->sku = $product->sku; - $this->barcode = $product->barcode; - $this->securityStock = $product->security_stock; + $this->realStock = $product->stock;*/ } - public function paginationView(): string + public function form(Form $form): Form { - return 'shopper::livewire.wire-pagination-links'; + return $form + ->schema([ + Components\Section::make(__('shopper::pages/products.inventory.title')) + ->description(__('shopper::pages/products.inventory.description')) + ->aside() + ->compact() + ->schema([ + Forms\Components\Grid::make() + ->schema([ + Forms\Components\TextInput::make('sku') + ->label(__('shopper::layout.forms.label.sku')) + ->unique(config('shopper.models.product'), 'sku', ignoreRecord: true) + ->maxLength(255), + + Forms\Components\TextInput::make('barcode') + ->label(__('shopper::layout.forms.label.barcode')) + ->unique(config('shopper.models.product'), 'barcode', ignoreRecord: true) + ->maxLength(255), + + Forms\Components\TextInput::make('security_stock') + ->label(__('shopper::layout.forms.label.safety_stock')) + ->helperText(__('shopper::pages/products.safety_security_help_text')) + ->numeric() + ->default(0) + ->rules(['integer', 'min:0']), + ]), + ]), + ]) + ->statePath('data') + ->model($this->product); + } + + public function table(Table $table): Table + { + return $table + ->query( + InventoryHistory::with(['inventory', 'stockable']) + ->where('stockable_id', $this->product->id) + ->where('stockable_type', 'product') + ->orderByDesc('created_at') + ) + ->columns([ + Tables\Columns\TextColumn::make('created_at') + ->label(__('shopper::words.date')) + ->since() + ->sortable(), + + Tables\Columns\TextColumn::make('event') + ->label(__('shopper::words.event')), + + Tables\Columns\TextColumn::make('inventory.name') + ->label(__('shopper::words.location')), + + Tables\Columns\TextColumn::make('adjustment') + ->label(__('shopper::words.adjustment')) + ->color(function (InventoryHistory $record) { + if ($record->old_quantity > 0) { + return 'success'; + } + + if ($record->old_quantity <= 0) { + return 'danger'; + } + + return 'gray'; + }) + ->alignRight(), + + Tables\Columns\TextColumn::make('quantity') + ->label(__('shopper::pages/products.inventory.movement')) + ->color(fn (InventoryHistory $record) => $record->quantity <= 0 ? 'danger' : 'gray') + ->alignRight() + ->summarize([ + Tables\Columns\Summarizers\Sum::make() + ->label(__('shopper::words.total')) + ->numeric(), + ]), + ]) + ->emptyStateIcon('untitledui-file-05') + ->emptyStateDescription(__('shopper::pages/products.inventory.empty')) + ->headerActions([ + Tables\Actions\Action::make('stock') + ->label('Add stock') + ->icon('untitledui-package') + ->modal() + ->color('gray') + ->modalWidth(MaxWidth::ExtraLarge) + ->form([ + Forms\Components\Select::make('inventory') + ->label(__('shopper::pages/products.inventory_name')) + ->relationship('inventory', 'name') + ->native(false) + ->required(), + + Forms\Components\TextInput::make('quantity') + ->label(__('shopper::layout.forms.label.quantity')) + ->placeholder('-10 or -5 or 50, etc') + ->numeric() + ->required(), + ]) + ->action(function (array $data): void { + $inventoryId = (int) $data['inventory']; + $quantity = (int) $data['quantity']; + $currentStock = InventoryHistory::query() + ->where('inventory_id', $inventoryId) + ->where('stockable_id', $this->product->id) + ->where('stockable_type', 'product') + ->get() + ->sum('quantity'); + + $realTimeStock = $currentStock + $quantity; + + if ($realTimeStock >= $currentStock) { + $this->product->mutateStock( + $inventoryId, + $quantity, + [ + 'event' => __('shopper::pages/products.inventory.add'), + 'old_quantity' => $quantity, + ] + ); + } else { + $this->product->decreaseStock( + $inventoryId, + $quantity, + [ + 'event' => __('shopper::pages/products.inventory.remove'), + 'old_quantity' => $quantity, + ] + ); + } + + Notification::make() + ->title(__('Stock successfully Updated')) + ->success() + ->send(); + + $this->dispatch('updateInventory'); + }), + ]) + ->filters([ + Tables\Filters\SelectFilter::make('inventory') + ->relationship('inventory', 'name') + ->native(false), + ]) + ->groups([ + Tables\Grouping\Group::make('inventory.name') + ->label(__('shopper::words.location')) + ->collapsible(), + ]); } public function store(): void @@ -54,34 +210,24 @@ public function store(): void ], ]); + $this->product->update($this->form->getState()); $this->product->update([ 'sku' => $this->sku ?? null, 'barcode' => $this->barcode ?? null, 'security_stock' => $this->securityStock ?? null, ]); + $this->dispatch('productHasUpdated'); + Notification::make() ->body(__('shopper::pages/products.notifications.stock_update')) ->success() ->send(); } + #[On('updateInventory')] public function render(): View { - return view('shopper::livewire.products.forms.form-inventory', [ - 'currentStock' => InventoryHistory::query() - ->where('inventory_id', $this->inventory) - ->where('stockable_id', $this->product->id) - ->get() - ->sum('quantity'), - 'histories' => InventoryHistory::query() - ->where('inventory_id', $this->inventory) - ->where('stockable_id', $this->product->id) - ->orderByDesc('created_at') - ->paginate(5), - 'barcodeImage' => $this->barcode - ? DNS1DFacade::getBarcodeHTML($this->barcode, config('shopper.core.barcode_type')) // @phpstan-ignore-line - : null, - ]); + return view('shopper::livewire.components.products.forms.inventory'); } } diff --git a/packages/admin/src/Livewire/Components/Products/Form/Media.php b/packages/admin/src/Livewire/Components/Products/Form/Media.php new file mode 100644 index 000000000..99c26f852 --- /dev/null +++ b/packages/admin/src/Livewire/Components/Products/Form/Media.php @@ -0,0 +1,71 @@ +product = $product; + + $this->form->fill($this->product->toArray()); + } + + public function form(Form $form): Form + { + return $form + ->schema([ + Forms\Components\SpatieMediaLibraryFileUpload::make('media') + ->collection(config('shopper.core.storage.collection_name')) + ->label(__('shopper::words.images')) + ->helperText(__('shopper::pages/products.images_helpText')) + ->multiple() + ->columnSpan(['lg' => 2]), + + Forms\Components\SpatieMediaLibraryFileUpload::make('thumbnail') + ->collection(config('shopper.core.storage.thumbnail_collection')) + ->label(__('shopper::layout.forms.label.thumbnail')) + ->helperText(__('shopper::pages/products.thumbnail_helpText')) + ->image() + ->maxSize(1024) + ->imageEditor() + ->columnSpan(['lg' => 1]), + ]) + ->columns(3) + ->statePath('data') + ->model($this->product); + } + + public function store(): void + { + $this->product->update($this->form->getState()); + + $this->dispatch('productHasUpdated'); + + Notification::make() + ->body(__('shopper::pages/products.notifications.media_update')) + ->success() + ->send(); + } + + public function render(): View + { + return view('shopper::livewire.components.products.forms.media'); + } +} diff --git a/packages/admin/src/Livewire/Components/Products/Form/RelatedProducts.php b/packages/admin/src/Livewire/Components/Products/Form/RelatedProducts.php index 25a4a88af..a61500ba2 100755 --- a/packages/admin/src/Livewire/Components/Products/Form/RelatedProducts.php +++ b/packages/admin/src/Livewire/Components/Products/Form/RelatedProducts.php @@ -4,46 +4,57 @@ namespace Shopper\Livewire\Components\Products\Form; +use Filament\Actions\Action; +use Filament\Actions\Concerns\InteractsWithActions; +use Filament\Actions\Contracts\HasActions; +use Filament\Forms\Concerns\InteractsWithForms; +use Filament\Forms\Contracts\HasForms; use Filament\Notifications\Notification; use Illuminate\Contracts\View\View; +use Livewire\Attributes\Computed; +use Livewire\Attributes\On; use Livewire\Component; -class RelatedProducts extends Component +class RelatedProducts extends Component implements HasActions, HasForms { - public $product; - - public $relatedProducts; + use InteractsWithActions; + use InteractsWithForms; - protected $listeners = [ - 'onProductsAddInRelated' => 'render', - ]; + public $product; public function mount($product): void { $this->product = $product; - $this->relatedProducts = $product->relatedProducts; } - public function remove(int $id): void + public function removeAction(): Action { - $this->product->relatedProducts()->detach($id); - $this->relatedProducts = $this->product->relatedProducts; - - $this->emitSelf('onProductsAddInRelated'); - - Notification::make() - ->body(__('shopper::pages/products.notifications.remove_related')) - ->success() - ->send(); + return Action::make('remove') + ->label(__('shopper::layout.forms.actions.remove')) + ->icon('untitledui-trash-03') + ->action(function (array $arguments): void { + $this->product->relatedProducts()->detach($arguments['id']); + + $this->dispatch('productHasUpdated'); + + Notification::make() + ->title(__('shopper::pages/products.notifications.remove_related')) + ->success() + ->send(); + }); } - public function getProductsIdsProperty(): array + #[Computed] + public function productsIds(): array { return array_merge($this->product->relatedProducts->modelKeys(), [$this->product->id]); } + #[On('productHasUpdated')] public function render(): View { - return view('shopper::livewire.products.forms.form-related'); + return view('shopper::livewire.components.products.forms.related', [ + 'relatedProducts' => $this->product->relatedProducts, + ]); } } diff --git a/packages/admin/src/Livewire/Components/Products/Form/Seo.php b/packages/admin/src/Livewire/Components/Products/Form/Seo.php index f28006900..581e99534 100755 --- a/packages/admin/src/Livewire/Components/Products/Form/Seo.php +++ b/packages/admin/src/Livewire/Components/Products/Form/Seo.php @@ -4,53 +4,49 @@ namespace Shopper\Livewire\Components\Products\Form; +use Filament\Forms; +use Filament\Forms\Concerns\InteractsWithForms; +use Filament\Forms\Contracts\HasForms; +use Filament\Forms\Form; use Filament\Notifications\Notification; use Illuminate\Contracts\View\View; -use Illuminate\Validation\Rule; use Livewire\Component; -use Shopper\Core\Repositories\Store\ProductRepository; -use Shopper\Core\Traits\Attributes\WithSeoAttributes; +use Shopper\Components; -class Seo extends Component +class Seo extends Component implements HasForms { - use WithSeoAttributes; + use InteractsWithForms; public $product; - public int $productId; - - public string $slug; - - public $seoAttributes = [ - 'name' => 'name', - 'description' => 'description', - ]; + public ?array $data = []; public function mount($product): void { $this->product = $product; - $this->productId = $product->id; - $this->slug = $product->slug; - $this->seoTitle = $product->seo_title; - $this->seoDescription = $product->seo_description; + + $this->form->fill($this->product->toArray()); } - public function store(): void + public function form(Form $form): Form { - $this->validate([ - 'slug' => [ - 'required', - Rule::unique(shopper_table('products'), 'sku')->ignore($this->productId), - ], - ]); + return $form + ->schema([ + Forms\Components\Group::make() + ->schema(Components\Form\SeoField::make()), + + Forms\Components\KeyValue::make('metadata') + ->reorderable(), + ]) + ->statePath('data') + ->model($this->product); + } - (new ProductRepository())->getById($this->productId)->update([ - 'slug' => str_slug($this->slug), - 'seo_title' => $this->seoTitle, - 'seo_description' => str_limit($this->seoDescription, 157), - ]); + public function store(): void + { + $this->product->update($this->form->getState()); - $this->emit('productHasUpdated', $this->productId); + $this->dispatch('productHasUpdated'); Notification::make() ->body(__('shopper::pages/products.notifications.seo_update')) @@ -60,6 +56,6 @@ public function store(): void public function render(): View { - return view('shopper::livewire.products.forms.form-seo'); + return view('shopper::livewire.components.products.forms.seo'); } } diff --git a/packages/admin/src/Livewire/Components/Products/Form/Shipping.php b/packages/admin/src/Livewire/Components/Products/Form/Shipping.php index 83d902ac4..3297fd5a4 100755 --- a/packages/admin/src/Livewire/Components/Products/Form/Shipping.php +++ b/packages/admin/src/Livewire/Components/Products/Form/Shipping.php @@ -4,52 +4,74 @@ namespace Shopper\Livewire\Components\Products\Form; +use Filament\Forms; +use Filament\Forms\Concerns\InteractsWithForms; +use Filament\Forms\Contracts\HasForms; +use Filament\Forms\Form; use Filament\Notifications\Notification; use Illuminate\Contracts\View\View; use Livewire\Component; -use Shopper\Core\Repositories\Store\ProductRepository; -use Shopper\Livewire\Components\Products\WithAttributes; +use Shopper\Components; -class Shipping extends Component +class Shipping extends Component implements HasForms { - use WithAttributes; + use InteractsWithForms; public $product; - public int $productId; + public ?array $data = []; public function mount($product): void { $this->product = $product; - $this->productId = $product->id; - $this->requireShipping = $product->require_shipping; - $this->backorder = $product->backorder; - $this->weightValue = floatval($product->weight_value); - $this->weightUnit = $product->weight_unit; - $this->heightValue = floatval($product->height_value); - $this->heightUnit = $product->height_unit; - $this->widthValue = floatval($product->width_value); - $this->widthUnit = $product->width_unit; - $this->volumeValue = floatval($product->volume_value); - $this->volumeUnit = $product->volume_unit; + + $this->form->fill($this->product->toArray()); + } + + public function form(Form $form): Form + { + return $form + ->schema([ + Components\Section::make(__('shopper::words.shipping')) + ->description(__('shopper::pages/products.shipping.description')) + ->aside() + ->compact() + ->schema([ + Forms\Components\Checkbox::make('backorder') + ->label(__('shopper::pages/products.product_can_returned')) + ->helperText(__('shopper::pages/products.product_can_returned_help_text')), + + Forms\Components\Checkbox::make('require_shipping') + ->label(__('shopper::pages/products.product_shipped')) + ->helperText(__('shopper::pages/products.product_shipped_help_text')) + ->default(true) + ->live(), + ]), + + Forms\Components\Group::make() + ->schema([ + Components\Separator::make(), + + Components\Section::make(__('shopper::pages/products.shipping.package_dimension')) + ->description(__('shopper::pages/products.shipping.package_dimension_description')) + ->aside() + ->compact() + ->schema([ + Forms\Components\Grid::make() + ->schema(Components\Form\ShippingField::make()), + ]), + ]) + ->visible(fn (Forms\Get $get): bool => $get('require_shipping')), + ]) + ->statePath('data') + ->model($this->product); } public function store(): void { - (new ProductRepository())->getById($this->productId)->update([ - 'require_shipping' => $this->requireShipping, - 'backorder' => $this->backorder, - 'weight_value' => $this->weightValue ?? null, - 'weight_unit' => $this->weightUnit ?? null, - 'height_value' => $this->heightValue ?? null, - 'height_unit' => $this->heightUnit ?? null, - 'width_value' => $this->widthValue ?? null, - 'width_unit' => $this->widthUnit ?? null, - 'volume_value' => $this->volumeValue ?? null, - 'volume_unit' => $this->volumeUnit ?? null, - ]); - - $this->emit('productHasUpdated', $this->productId); + $this->product->update($this->form->getState()); + + $this->dispatch('productHasUpdated'); Notification::make() ->body(__('shopper::pages/products.notifications.shipping_update')) @@ -59,6 +81,6 @@ public function store(): void public function render(): View { - return view('shopper::livewire.products.forms.form-shipping'); + return view('shopper::livewire.components.products.forms.shipping'); } } diff --git a/packages/admin/src/Livewire/Components/Products/WithAttributes.php b/packages/admin/src/Livewire/Components/Products/WithAttributes.php deleted file mode 100755 index 99d9bbfa5..000000000 --- a/packages/admin/src/Livewire/Components/Products/WithAttributes.php +++ /dev/null @@ -1,63 +0,0 @@ -publishedAtFormatted = Carbon::createFromFormat('Y-m-d H:i', $value)->toRfc7231String(); - } - } -} diff --git a/packages/admin/src/Livewire/Modals/DeleteProduct.php b/packages/admin/src/Livewire/Modals/DeleteProduct.php deleted file mode 100755 index 01a215778..000000000 --- a/packages/admin/src/Livewire/Modals/DeleteProduct.php +++ /dev/null @@ -1,53 +0,0 @@ -productId = $id; - $this->type = $type; - $this->route = $route; - } - - public function delete(): void - { - $product = (new ProductRepository())->getById($this->productId); - - event(new ProductDeleted($product)); - - session()->flash('success', __('shopper::notifications.products.remove', ['item' => $this->type])); - - if ($this->type === 'product') { - $product->delete(); - $this->redirectRoute('shopper.products.index'); - } else { - $product->forceDelete(); - $this->redirect($this->route); - } - } - - public static function modalMaxWidth(): string - { - return 'lg'; - } - - public function render(): View - { - return view('shopper::livewire.modals.delete-product'); - } -} diff --git a/packages/admin/src/Livewire/Modals/RelatedProducts.php b/packages/admin/src/Livewire/Modals/RelatedProductsList.php similarity index 75% rename from packages/admin/src/Livewire/Modals/RelatedProducts.php rename to packages/admin/src/Livewire/Modals/RelatedProductsList.php index 187f92c4c..6ec47a008 100755 --- a/packages/admin/src/Livewire/Modals/RelatedProducts.php +++ b/packages/admin/src/Livewire/Modals/RelatedProductsList.php @@ -9,25 +9,25 @@ use LivewireUI\Modal\ModalComponent; use Shopper\Core\Repositories\Store\ProductRepository; -class RelatedProducts extends ModalComponent +class RelatedProductsList extends ModalComponent { public $product; public string $search = ''; - public array $exceptProductIds; + public array $exceptProductIds = []; public array $selectedProducts = []; - public function mount(int $id, array $exceptProductIds = []): void + public function mount(int $productId, array $ids = []): void { - $this->product = (new ProductRepository())->getById($id); - $this->exceptProductIds = $exceptProductIds; + $this->product = (new ProductRepository())->getById($productId); + $this->exceptProductIds = $ids; } public static function modalMaxWidth(): string { - return '2xl'; + return '3xl'; } public function getProductsProperty() @@ -44,7 +44,7 @@ public function addSelectedProducts(): void $currentProducts = $this->product->relatedProducts->pluck('id')->toArray(); $this->product->relatedProducts()->sync(array_merge($this->selectedProducts, $currentProducts)); - $this->emit('onProductsAddInRelated'); + $this->dispatch('productHasUpdated'); Notification::make() ->title(__('shopper::layout.status.added')) @@ -57,6 +57,6 @@ public function addSelectedProducts(): void public function render(): View { - return view('shopper::livewire.modals.related-lists'); + return view('shopper::livewire.modals.related-products-list'); } } diff --git a/packages/admin/src/Livewire/Pages/Category/Index.php b/packages/admin/src/Livewire/Pages/Category/Index.php index fe7492364..30f72ea36 100755 --- a/packages/admin/src/Livewire/Pages/Category/Index.php +++ b/packages/admin/src/Livewire/Pages/Category/Index.php @@ -31,7 +31,12 @@ public function mount(): void public function table(Table $table): Table { return $table - ->query((new CategoryRepository())->makeModel()->newQuery()) + ->query( + (new CategoryRepository()) + ->makeModel() + ->with('parent:id,name') + ->newQuery() + ) ->columns([ Tables\Columns\SpatieMediaLibraryImageColumn::make('image') ->collection(config('shopper.core.storage.collection_name')) @@ -60,7 +65,6 @@ public function table(Table $table): Table ->date() ->sortable(), ]) - ->reorderable('position') ->filters([ Tables\Filters\TernaryFilter::make('is_enabled'), ]) @@ -148,8 +152,7 @@ public function table(Table $table): Table #[On('category-save')] public function render(): View { - return view('shopper::livewire.pages.category.index', [ - 'total' => (new CategoryRepository())->count(), - ])->title(__('shopper::layout.sidebar.categories')); + return view('shopper::livewire.pages.category.index') + ->title(__('shopper::layout.sidebar.categories')); } } diff --git a/packages/admin/src/Livewire/Pages/Customers/Index.php b/packages/admin/src/Livewire/Pages/Customers/Index.php index cb62830f1..a36e4ed2f 100755 --- a/packages/admin/src/Livewire/Pages/Customers/Index.php +++ b/packages/admin/src/Livewire/Pages/Customers/Index.php @@ -33,7 +33,7 @@ public function table(Table $table): Table return $table ->query( (new UserRepository()) - ->with('roles') + ->with(['roles', 'addresses']) ->makeModel() ->scopes('customers') ->newQuery() diff --git a/packages/admin/src/Livewire/Pages/Customers/Show.php b/packages/admin/src/Livewire/Pages/Customers/Show.php index 7d5b83c0f..4a6699e86 100755 --- a/packages/admin/src/Livewire/Pages/Customers/Show.php +++ b/packages/admin/src/Livewire/Pages/Customers/Show.php @@ -24,10 +24,10 @@ class Show extends AbstractPageComponent implements HasActions, HasForms public function deleteAction(): Action { - return Action::make('delete') - ->label(__('shopper::layout.forms.actions.delete')) + return Action::make(__('shopper::layout.forms.actions.delete')) ->requiresConfirmation() - ->icon('untitledui-trash') + ->icon('untitledui-trash-03') + ->modalIcon('untitledui-trash-03') ->color('danger') ->action(function (): void { $this->customer->delete(); diff --git a/packages/admin/src/Livewire/Pages/Product/Create.php b/packages/admin/src/Livewire/Pages/Product/Create.php new file mode 100755 index 000000000..046bd45dd --- /dev/null +++ b/packages/admin/src/Livewire/Pages/Product/Create.php @@ -0,0 +1,328 @@ +authorize('add_products'); + + $this->form->fill(); + + $this->defaultChannel = (new ChannelRepository()) + ->where('is_default', true) + ->first(); + } + + public function form(Form $form): Form + { + return $form + ->schema([ + Components\WizardColumn::make([ + Components\Wizard\StepColumn::make(__('shopper::words.general')) + ->icon('untitledui-file-02') + ->schema([ + Components\Section::make() + ->schema([ + Forms\Components\TextInput::make('name') + ->label(__('shopper::layout.forms.label.name')) + ->required() + ->maxLength(255) + ->live(onBlur: true) + ->afterStateUpdated(function ($state, Forms\Set $set): void { + $set('slug', Str::slug($state)); + }), + Forms\Components\TextInput::make('slug') + ->label(__('shopper::layout.forms.label.slug')) + ->disabled() + ->dehydrated() + ->required() + ->maxLength(255) + ->unique(config('shopper.models.product'), 'slug'), + + Forms\Components\RichEditor::make('description') + ->label(__('shopper::layout.forms.label.description')) + ->columnSpan('full'), + ]) + ->compact() + ->columns(), + + Components\Separator::make(), + + Forms\Components\Grid::make() + ->schema([ + Forms\Components\Toggle::make('is_visible') + ->label(__('shopper::layout.forms.label.visible')) + ->helperText(__('shopper::pages/products.visible_help_text')) + ->onColor('success') + ->default(true), + + Forms\Components\DateTimePicker::make('published_at') + ->label(__('shopper::layout.forms.label.availability')) + ->native(false) + ->default(now()) + ->helperText(__('shopper::pages/products.availability_description')) + ->required(), + ]), + ]), + + Components\Wizard\StepColumn::make(__('shopper::words.pricing')) + ->icon('untitledui-coins-stacked-02') + ->schema([ + Forms\Components\TextInput::make('price_amount') + ->label(__('shopper::layout.forms.label.price_amount')) + ->numeric() + ->rules(['regex:/^\d{1,6}(\.\d{0,2})?$/']) + ->suffix(shopper_currency()) + ->currencyMask(thousandSeparator: ',', decimalSeparator: '.', precision: 2), + + Forms\Components\TextInput::make('old_price_amount') + ->label(__('shopper::layout.forms.label.compare_price')) + ->numeric() + ->rules(['regex:/^\d{1,6}(\.\d{0,2})?$/']) + ->suffix(shopper_currency()) + ->currencyMask(thousandSeparator: ',', decimalSeparator: '.', precision: 2), + + Forms\Components\TextInput::make('cost_amount') + ->label(__('shopper::layout.forms.label.cost_per_item')) + ->helperText(__('shopper::pages/products.cost_per_items_help_text')) + ->numeric() + ->rules(['regex:/^\d{1,6}(\.\d{0,2})?$/']) + ->suffix(shopper_currency()) + ->currencyMask(thousandSeparator: ',', decimalSeparator: '.', precision: 2), + ]) + ->columns(), + + Components\Wizard\StepColumn::make(__('shopper::words.media')) + ->icon('untitledui-image') + ->schema([ + Forms\Components\SpatieMediaLibraryFileUpload::make('media') + ->collection(config('shopper.core.storage.collection_name')) + ->label(__('shopper::words.images')) + ->helperText(__('shopper::pages/products.images_helpText')) + ->multiple() + ->columnSpan(['lg' => 3]), + + Forms\Components\SpatieMediaLibraryFileUpload::make('thumbnail') + ->collection(config('shopper.core.storage.thumbnail_collection')) + ->label(__('shopper::layout.forms.label.thumbnail')) + ->helperText(__('shopper::pages/products.thumbnail_helpText')) + ->image() + ->maxSize(1024) + ->imageEditor() + ->columnSpan(['lg' => 2]), + ]) + ->columns(5), + + Components\Wizard\StepColumn::make(__('shopper::pages/products.product_associations')) + ->icon('untitledui-git-branch') + ->schema([ + Forms\Components\Select::make('brand_id') + ->label(__('shopper::layout.forms.label.brand')) + ->relationship('brand', 'name', fn (Builder $query) => $query->where('is_enabled', true)) + ->searchable() + ->visible(Feature::enabled('brand')), + + Forms\Components\Select::make('collections') + ->label(__('shopper::layout.sidebar.collections')) + ->relationship('collections', 'name', fn (Builder $query) => $query->where('is_enabled', true)) + ->searchable() + ->multiple() + ->visible(Feature::enabled('collection')), + + Components\Form\SelectTree::make('categories') + ->relationship( + relationship: 'categories', + titleAttribute: 'name', + parentAttribute: 'parent_id' + ) + ->independent(false) + ->enableBranchNode() + ->searchable() + ->visible(Feature::enabled('category')), + ]) + ->columns() + ->visible( + Feature::enabled('brand') + || Feature::enabled('category') + || Feature::enabled('collection') + ), + + Components\Wizard\StepColumn::make(__('shopper::words.location')) + ->icon('untitledui-package') + ->schema([ + Forms\Components\Placeholder::make('stock') + ->label('Stock & Inventory') + ->content(new HtmlString(Blade::render(<<<'BLADE' +

+ {{ __('Configure the inventory and stock for this product') }} +

+ BLADE))), + + Forms\Components\Grid::make() + ->schema([ + Forms\Components\TextInput::make('sku') + ->label(__('shopper::layout.forms.label.sku')) + ->unique(config('shopper.models.product'), 'sku') + ->maxLength(255), + + Forms\Components\TextInput::make('barcode') + ->label(__('shopper::layout.forms.label.barcode')) + ->unique(config('shopper.models.product'), 'barcode') + ->maxLength(255), + + Forms\Components\TextInput::make('quantity') + ->label(__('shopper::layout.forms.label.quantity')) + ->numeric() + ->rules(['integer', 'min:1']), + + Forms\Components\TextInput::make('security_stock') + ->label(__('shopper::layout.forms.label.safety_stock')) + ->helperText(__('shopper::pages/products.safety_security_help_text')) + ->numeric() + ->default(0) + ->rules(['integer', 'min:0']), + ]) + ->columns(), + ]), + + Components\Wizard\StepColumn::make(__('shopper::words.shipping')) + ->icon('untitledui-plane') + ->schema([ + Forms\Components\Grid::make() + ->schema([ + Forms\Components\Checkbox::make('backorder') + ->label(__('shopper::pages/products.product_can_returned')) + ->helperText(__('shopper::pages/products.product_can_returned_help_text')), + + Forms\Components\Checkbox::make('require_shipping') + ->label(__('shopper::pages/products.product_shipped')) + ->helperText(__('shopper::pages/products.product_shipped_help_text')) + ->default(true) + ->live(), + ]), + + Components\Separator::make(), + + Forms\Components\Group::make() + ->schema([ + Forms\Components\Placeholder::make('shipping') + ->label(__('shopper::words.weight_dimension')) + ->content(new HtmlString(Blade::render(<<<'BLADE' +

+ {{ __('shopper::pages/products.weight_dimension_help_text') }} +

+ BLADE))), + + Forms\Components\Grid::make() + ->schema(Components\Form\ShippingField::make()), + ]) + ->visible(fn (Forms\Get $get): bool => $get('require_shipping')), + ]), + + Components\Wizard\StepColumn::make('Seo & Metadata') + ->icon('untitledui-monitor-02') + ->schema([ + Forms\Components\Placeholder::make(__('shopper::pages/products.seo.title')) + ->content(__('shopper::pages/products.seo.description')) + ->content(new HtmlString(Blade::render(<<<'BLADE' +

+ {{ __('shopper::pages/products.seo.description') }} +

+ BLADE))), + + Forms\Components\Group::make() + ->schema(Components\Form\SeoField::make()), + + Components\Separator::make(), + + Forms\Components\KeyValue::make('metadata') + ->reorderable(), + ]), + ]) + ->submitAction(new HtmlString(Blade::render(<<<'BLADE' + + + {{ __('shopper::layout.forms.actions.save') }} + + BLADE))) + ->persistStepInQueryString(), + ]) + ->statePath('data') + ->model(config('shopper.models.product')); + } + + public function store(): void + { + $data = $this->form->getState(); + + /** @var Product $product */ + $product = (new ProductRepository())->create( + Arr::except($data, ['quantity', 'categories']) + ); + $this->form->model($product)->saveRelationships(); + + $product->channels()->attach($this->defaultChannel->id); + + if ($data['categories'] && count($data['categories']) > 0) { + $product->categories()->sync($data['categories']); + } + + $quantity = $data['quantity']; + + /** @var Inventory $inventory */ + $inventory = Inventory::default()->first(); + + if ($inventory && $quantity && $quantity > 0) { + $product->mutateStock( + inventoryId: $inventory->id, + quantity: (int) $quantity, + arguments: [ + 'event' => __('shopper::pages/products.inventory.initial'), + 'old_quantity' => $quantity, + ] + ); + } + + Notification::make() + ->title(__('shopper::pages/products.notifications.create')) + ->success() + ->send(); + + $this->redirectRoute(name: 'shopper.products.index', navigate: true); + } + + public function render(): View + { + return view('shopper::livewire.pages.products.create') + ->title(__('shopper::words.actions_label.add_new', ['name' => __('shopper::words.product')])); + } +} diff --git a/packages/admin/src/Livewire/Pages/Product/Edit.php b/packages/admin/src/Livewire/Pages/Product/Edit.php new file mode 100755 index 000000000..9d7ab663a --- /dev/null +++ b/packages/admin/src/Livewire/Pages/Product/Edit.php @@ -0,0 +1,51 @@ +requiresConfirmation() + ->icon('untitledui-trash-03') + ->modalIcon('untitledui-trash-03') + ->color('danger') + ->button() + ->action(function (): void { + $this->product->delete(); + + Notification::make() + ->title(__('shopper::components.tables.messages.delete', ['name' => __('shopper::words.product')])) + ->success() + ->send(); + + $this->redirectRoute(name: 'shopper.products.index', navigate: true); + }); + } + + #[On('productHasUpdated')] + public function render(): View + { + return view('shopper::livewire.pages.products.edit') + ->title(__('shopper::words.actions_label.edit', ['name' => $this->product->name])); + } +} diff --git a/packages/admin/src/Livewire/Pages/Product/Index.php b/packages/admin/src/Livewire/Pages/Product/Index.php new file mode 100755 index 000000000..4688dce94 --- /dev/null +++ b/packages/admin/src/Livewire/Pages/Product/Index.php @@ -0,0 +1,140 @@ +authorize('browse_products'); + } + + public function table(Table $table): Table + { + return $table + ->query( + (new ProductRepository()) + ->with(['brand', 'variants']) + ->makeModel() + ->newQuery() + ->withCount(['variants']) + ->where('parent_id', null) + ) + ->columns([ + Tables\Columns\SpatieMediaLibraryImageColumn::make('thumbnail') + ->label(__('shopper::layout.forms.label.thumbnail')) + ->collection(config('shopper.core.storage.thumbnail_collection')) + ->defaultImageUrl(config('shopper.media.fallback_url')), + + Tables\Columns\TextColumn::make('name') + ->label(__('shopper::layout.forms.label.name')) + ->searchable() + ->toggleable() + ->sortable(), + + Tables\Columns\TextColumn::make('price_amount') + ->label(__('shopper::layout.forms.label.price')) + ->money(shopper_currency()) + ->sortable(), + + Tables\Columns\IconColumn::make('is_visible') + ->label(__('shopper::layout.forms.label.availability')) + ->sortable() + ->toggleable(), + + Tables\Columns\TextColumn::make('brand.name') + ->label(__('shopper::layout.forms.label.brand')) + ->searchable() + ->toggleable() + ->sortable(), + + Tables\Columns\ViewColumn::make('stock') + ->label(__('shopper::layout.tables.stock')) + ->toggleable() + ->view('shopper::livewire.tables.cells.products.stock') + ->toggledHiddenByDefault(), + + Tables\Columns\TextColumn::make('sku') + ->label(__('shopper::layout.tables.sku')) + ->searchable() + ->sortable() + ->toggleable() + ->toggledHiddenByDefault(), + + Tables\Columns\TextColumn::make('published_at') + ->label(__('shopper::layout.forms.label.published_at')) + ->searchable() + ->dateTime() + ->toggleable() + ->sortable(), + ]) + ->actions([ + Tables\Actions\ActionGroup::make([ + Tables\Actions\Action::make('edit') + ->label(__('shopper::layout.forms.actions.edit')) + ->icon('untitledui-edit-04') + ->url( + fn (Product $record): string => route( + name: 'shopper.products.edit', + parameters: ['product' => $record] + ), + ), + Tables\Actions\ReplicateAction::make() + ->icon('untitledui-copy-dashed') + ->excludeAttributes(['variants_count', 'slug']) + ->successNotificationTitle(__('shopper::pages/products.notifications.replicated')), + Tables\Actions\Action::make(__('shopper::layout.forms.actions.delete')) + ->icon('untitledui-trash-03') + ->color('danger') + ->requiresConfirmation() + ->action(fn (Product $record) => $record->delete()), + ]) + ->tooltip('Actions'), + ]) + ->filters([ + QueryBuilder::make() + ->constraints([ + TextConstraint::make('name'), + NumberConstraint::make('price_amount') + ->icon('untitledui-bank-note'), + BooleanConstraint::make('is_visible') + ->label(__('shopper::layout.forms.label.availability')), + BooleanConstraint::make('backorder'), + DateConstraint::make('published_at'), + ]) + ->constraintPickerColumns(), + ]) + ->deferFilters() + ->filtersFormWidth(MaxWidth::Large); + } + + public function render(): View + { + return view('shopper::livewire.pages.products.index', [ + 'total' => (new ProductRepository())->count(), + ]) + ->title(__('shopper::layout.sidebar.products')); + } +} diff --git a/packages/admin/src/Livewire/Pages/Settings/General.php b/packages/admin/src/Livewire/Pages/Settings/General.php index 1f18e9567..8a16dfed5 100755 --- a/packages/admin/src/Livewire/Pages/Settings/General.php +++ b/packages/admin/src/Livewire/Pages/Settings/General.php @@ -10,6 +10,7 @@ use Filament\Forms\Form; use Filament\Notifications\Notification; use Illuminate\Contracts\View\View; +use Illuminate\Support\Facades\Cache; use Livewire\Attributes\Layout; use Livewire\Component; use Shopper\Components\Section; @@ -47,7 +48,11 @@ public function mount(): void ->select('value', 'key') ->get(); - $this->form->fill($settings->mapWithKeys(fn (Setting $item) => [$item['key'] => $item['value']])->toArray()); + $this->form->fill( + $settings->mapWithKeys( + fn (Setting $item) => [$item['key'] => $item['value']] + )->toArray() + ); } public function form(Form $form): Form @@ -187,6 +192,8 @@ public function store(): void $this->createUpdateSetting(key: $key, value: $this->form->getState()[$key]); } + Cache::forget('shopper-setting-currency_id'); + Notification::make() ->title(__('shopper::notifications.store_info')) ->success() diff --git a/packages/admin/src/Livewire/SlideOvers/CategoryForm.php b/packages/admin/src/Livewire/SlideOvers/CategoryForm.php index f3624848e..927c7804b 100644 --- a/packages/admin/src/Livewire/SlideOvers/CategoryForm.php +++ b/packages/admin/src/Livewire/SlideOvers/CategoryForm.php @@ -56,7 +56,11 @@ public function form(Form $form): Form Components\Select::make('parent_id') ->label(__('shopper::layout.forms.label.parent')) ->relationship('parent', 'name', fn (Builder $query) => $query->where('is_enabled', true)) - ->getOptionLabelFromRecordUsing(fn (Model $model) => $model->parent ? "{$model->parent->name} / {$model->name}" : $model->name) + ->getOptionLabelFromRecordUsing( + fn (Model $model) => $model->parent + ? "{$model->parent->name} / {$model->name}" + : $model->name + ) ->searchable() ->placeholder(__('shopper::pages/categories.empty_parent')), Components\Toggle::make('is_enabled') diff --git a/packages/admin/src/Providers/FeatureServiceProvider.php b/packages/admin/src/Providers/FeatureServiceProvider.php index d75dd98bf..ceb1de88b 100644 --- a/packages/admin/src/Providers/FeatureServiceProvider.php +++ b/packages/admin/src/Providers/FeatureServiceProvider.php @@ -16,6 +16,7 @@ final class FeatureServiceProvider extends ServiceProvider 'brand', 'category', 'customer', + 'product', ]; protected string $root = __DIR__ . '/../..'; diff --git a/packages/admin/src/ShopperServiceProvider.php b/packages/admin/src/ShopperServiceProvider.php index 983ee0e11..2ec5b55d6 100755 --- a/packages/admin/src/ShopperServiceProvider.php +++ b/packages/admin/src/ShopperServiceProvider.php @@ -4,6 +4,12 @@ namespace Shopper; +use Akaunting\Money; +use Closure; +use Filament\Forms\Components\TextInput; +use Filament\Support\Facades\FilamentColor; +use Filament\Tables\Columns\Column; +use Filament\Tables\Columns\TextColumn; use Illuminate\Database\Eloquent\Relations\Relation; use Livewire\Livewire; use PragmaRX\Google2FA\Google2FA; @@ -70,6 +76,10 @@ public function packageBooted(): void $this->bootModelRelationName(); + FilamentColor::register([ + 'primary' => config('shopper.admin.filament-color'), + ]); + Shopper::serving(function (): void { Shopper::setServingStatus(); }); @@ -96,6 +106,37 @@ public function packageRegistered(): void $this->loadViewsFrom($this->root . '/resources/views', 'shopper'); } + public function bootingPackage(): void + { + TextColumn::macro('currency', function (string | Closure | null $currency = null, bool $shouldConvert = false): TextColumn { + /*** @var TextColumn $this */ + $this->formatStateUsing(static function (Column $column, $state) use ($currency, $shouldConvert): ?string { + if (blank($state)) { + return null; + } + + if (blank($currency)) { + $currency = shopper_currency(); + } + + return (new Money\Money( + amount: $state, + currency: (new Money\Currency(mb_strtoupper($column->evaluate($currency)))), + convert: $shouldConvert, + ))->format(); + }); + + return $this; + }); + + TextInput::macro('currencyMask', function ($thousandSeparator = ',', $decimalSeparator = '.', $precision = 2): TextInput { + $this->view = 'shopper::components.filament.forms.currency-mask'; + $this->viewData(compact('thousandSeparator', 'decimalSeparator', 'precision')); + + return $this; + }); + } + protected function bootModelRelationName(): void { Relation::morphMap([ diff --git a/packages/admin/src/Traits/SaveSettings.php b/packages/admin/src/Traits/SaveSettings.php deleted file mode 100644 index be1428d77..000000000 --- a/packages/admin/src/Traits/SaveSettings.php +++ /dev/null @@ -1,21 +0,0 @@ -updateOrCreate(['key' => $key], [ - 'value' => $this->{$key}, - 'display_name' => Setting::lockedAttributesDisplayName($key), - 'locked' => true, - ]); - } - } -} diff --git a/packages/admin/stubs/feature/FeatureServiceProvider.stub b/packages/admin/stubs/feature/FeatureServiceProvider.stub deleted file mode 100644 index 42def3c5c..000000000 --- a/packages/admin/stubs/feature/FeatureServiceProvider.stub +++ /dev/null @@ -1,20 +0,0 @@ - [ 'collection_name' => 'uploads', + 'thumbnail_collection' => 'thumbnail', 'disk_name' => 'public', ], diff --git a/packages/core/database/migrations/2020_00_02_000006_create_products_table.php b/packages/core/database/migrations/2020_00_02_000006_create_products_table.php index 076ab84ab..9c6c82083 100755 --- a/packages/core/database/migrations/2020_00_02_000006_create_products_table.php +++ b/packages/core/database/migrations/2020_00_02_000006_create_products_table.php @@ -18,7 +18,7 @@ public function up(): void $table->string('sku')->unique()->nullable(); $table->string('barcode')->unique()->nullable(); $table->longText('description')->nullable(); - $table->integer('security_stock')->default(0); + $table->integer('security_stock')->nullable()->default(0); $table->boolean('featured')->default(false); $table->boolean('is_visible')->default(false); $table->integer('old_price_amount')->nullable(); diff --git a/packages/core/database/migrations/2024_03_28_084412_add_metadata-fields_table.php b/packages/core/database/migrations/2024_03_28_084412_add_metadata-fields_table.php index 39cf87dd1..684dbf7c4 100644 --- a/packages/core/database/migrations/2024_03_28_084412_add_metadata-fields_table.php +++ b/packages/core/database/migrations/2024_03_28_084412_add_metadata-fields_table.php @@ -15,6 +15,7 @@ 'carriers', 'collections', 'discounts', + 'orders', 'products', 'payment_methods', ]; diff --git a/packages/core/src/Helpers/Price.php b/packages/core/src/Helpers/Price.php index 14e586fa2..bb5c046aa 100755 --- a/packages/core/src/Helpers/Price.php +++ b/packages/core/src/Helpers/Price.php @@ -4,26 +4,22 @@ namespace Shopper\Core\Helpers; -use Shopper\Core\Traits\HasPrice; - -class Price +final class Price { - use HasPrice; - public int | float $value; public string $formatted; public string $currency; - public function __construct(int $cent) + public function __construct(int | float $cent) { $this->value = $cent * 100; $this->currency = shopper_currency(); - $this->formatted = $this->formattedPrice($this->value); + $this->formatted = shopper_money_format(amount: $this->value); } - public static function from(int $cent): self + public static function from(int | float $cent): self { return new self($cent); } diff --git a/packages/core/src/Models/Category.php b/packages/core/src/Models/Category.php index 7ec60537f..2cbddce25 100755 --- a/packages/core/src/Models/Category.php +++ b/packages/core/src/Models/Category.php @@ -6,7 +6,6 @@ use Illuminate\Database\Eloquent\Attributes\ObservedBy; use Illuminate\Database\Eloquent\Builder; -use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\MorphToMany; @@ -44,13 +43,6 @@ public function getTable(): string return shopper_table('categories'); } - protected function parentName(): ?Attribute - { - return Attribute::make( - get: fn () => $this->parent?->name, - ); - } - public function getCustomPaths(): array { return [ diff --git a/packages/core/src/Models/InventoryHistory.php b/packages/core/src/Models/InventoryHistory.php index 5d4b19810..2a8c11990 100755 --- a/packages/core/src/Models/InventoryHistory.php +++ b/packages/core/src/Models/InventoryHistory.php @@ -13,7 +13,7 @@ /** * @property-read int $id * @property int $quantity - * @property int $old_quantity + * @property int|null $old_quantity * @property string|null $event * @property string|null $description * @property int $user_id diff --git a/packages/core/src/Models/Product.php b/packages/core/src/Models/Product.php index df44b41a8..3ca3a5ac2 100755 --- a/packages/core/src/Models/Product.php +++ b/packages/core/src/Models/Product.php @@ -50,6 +50,7 @@ class Product extends Model implements ReviewRateable, SpatieHasMedia 'require_shipping' => 'boolean', 'backorder' => 'boolean', 'published_at' => 'datetime', + 'metadata' => 'array', ]; public function getTable(): string @@ -114,13 +115,13 @@ public function getCostAmount(): ?Price return Price::from($this->cost_amount); } - public function variationsStock(): Attribute + public function variantsStock(): Attribute { $stock = 0; - if ($this->variations->isNotEmpty()) { - foreach ($this->variations as $variation) { - $stock += $variation->stock; // @phpstan-ignore-line + if ($this->variants->isNotEmpty()) { + foreach ($this->variants as $variant) { + $stock += $variant->stock; // @phpstan-ignore-line } } @@ -135,7 +136,7 @@ public function scopePublish(Builder $query): Builder ->where('is_visible', true); } - public function variations(): HasMany + public function variants(): HasMany { return $this->hasMany(config('shopper.models.product'), 'parent_id'); } diff --git a/packages/core/src/Traits/Attributes/WithAddress.php b/packages/core/src/Traits/Attributes/WithAddress.php deleted file mode 100755 index ec22a8fd3..000000000 --- a/packages/core/src/Traits/Attributes/WithAddress.php +++ /dev/null @@ -1,41 +0,0 @@ - 'required', - 'address_last_name' => 'required', - 'street_address' => 'required', - 'country_id' => 'required', - 'zipcode' => 'required', - 'city' => 'required', - 'address_phone_number' => ['nullable', new Phone()], - ]; - } -} diff --git a/packages/core/src/Traits/Attributes/WithChoicesBrands.php b/packages/core/src/Traits/Attributes/WithChoicesBrands.php deleted file mode 100755 index 89f5068da..000000000 --- a/packages/core/src/Traits/Attributes/WithChoicesBrands.php +++ /dev/null @@ -1,19 +0,0 @@ - 0 && $choice['value'] !== '0') { - $this->brand_id = (int) $choice['value']; - } else { - $this->brand_id = null; - } - } -} diff --git a/packages/core/src/Traits/Attributes/WithChoicesCategories.php b/packages/core/src/Traits/Attributes/WithChoicesCategories.php deleted file mode 100755 index 95b4178f9..000000000 --- a/packages/core/src/Traits/Attributes/WithChoicesCategories.php +++ /dev/null @@ -1,23 +0,0 @@ - 0 && $choice['value'] !== '0') { - $this->parent_id = (int) $choice['value']; - $this->parent = (new CategoryRepository())->getById($this->parent_id); - } else { - $this->parent_id = null; - $this->parent = null; - } - } -} diff --git a/packages/core/src/Traits/Attributes/WithProductAssociations.php b/packages/core/src/Traits/Attributes/WithProductAssociations.php deleted file mode 100755 index a0a20aafa..000000000 --- a/packages/core/src/Traits/Attributes/WithProductAssociations.php +++ /dev/null @@ -1,14 +0,0 @@ -updateSeo = true; - $this->seoTitle = $this->isUpdate() - ? $this->seoTitle - : $this->{$this->seoAttributes['name']}; - $this->seoDescription = $this->isUpdate() - ? str_limit(strip_tags(nl2br($this->seoDescription ?? '')), 157) - : str_limit(strip_tags(nl2br($this->{$this->seoAttributes['description']} ?? '')), 157); - } -} diff --git a/packages/core/src/Traits/Attributes/WithStock.php b/packages/core/src/Traits/Attributes/WithStock.php deleted file mode 100755 index f47495624..000000000 --- a/packages/core/src/Traits/Attributes/WithStock.php +++ /dev/null @@ -1,93 +0,0 @@ -value = $value; - $this->realStock = $this->stock + $this->value; - } - - public function incrementStock(): void - { - $this->validate(['value' => 'required|integer']); - - $this->value++; - $this->realStock = $this->stock + $this->value; - } - - public function decrementStock(): void - { - if ($this->realStock === 0) { - return; - } - - $this->validate(['value' => 'required|integer']); - - $this->value--; - $this->realStock = $this->stock + $this->value; - } - - public function updateCurrentStock(): void - { - if ($this->value === 0) { - return; - } - - $this->validate(['value' => 'required|integer']); - - if ($this->realStock >= $this->stock) { - $this->product->mutateStock( - $this->inventory, - $this->value, - [ - 'event' => __('shopper::pages/products.inventory.add'), - 'old_quantity' => $this->value, - ] - ); - } else { - $this->product->decreaseStock( - $this->inventory, - $this->value, - [ - 'event' => __('shopper::pages/products.inventory.remove'), - 'old_quantity' => $this->value, - ] - ); - } - - $this->value = 0; - $this->realStock = $this->stock = $this->product->stock; - - Notification::make() - ->title(__('shopper::layout.status.updated')) - ->body(__('Stock successfully Updated')) - ->success() - ->send(); - } - - public function export(): BinaryFileResponse | Response - { - return (new ProductInventoryExport()) - ->forProduct($this->product->id) - ->download('product-stock-movements.xlsx', Excel::XLSX); - } -} diff --git a/packages/core/src/Traits/Attributes/WithUploadProcess.php b/packages/core/src/Traits/Attributes/WithUploadProcess.php deleted file mode 100755 index 81a8c6f34..000000000 --- a/packages/core/src/Traits/Attributes/WithUploadProcess.php +++ /dev/null @@ -1,26 +0,0 @@ -find($id)->delete(); - - $this->emitSelf('mediaDeleted'); - - Notification::make() - ->title(__('Removed')) - ->body(__('Media removed from the storage.')) - ->success() - ->send(); - } -} diff --git a/packages/core/src/Traits/HasMedia.php b/packages/core/src/Traits/HasMedia.php index fbdc1d5bc..4ed6cffff 100755 --- a/packages/core/src/Traits/HasMedia.php +++ b/packages/core/src/Traits/HasMedia.php @@ -18,6 +18,11 @@ public function registerMediaCollections(): void ->useDisk(config('shopper.core.storage.disk_name')) ->acceptsMimeTypes(config('shopper.media.accepts_mime_types')) ->useFallbackUrl(url(config('shopper.media.fallback_url'))); + + $this->addMediaCollection(config('shopper.core.storage.thumbnail_collection')) + ->useDisk(config('shopper.core.storage.disk_name')) + ->acceptsMimeTypes(config('shopper.media.accepts_mime_types')) + ->useFallbackUrl(url(config('shopper.media.fallback_url'))); } public function registerMediaConversions(?Media $media = null): void diff --git a/packages/core/src/helpers.php b/packages/core/src/helpers.php index 138fb9b51..948773995 100755 --- a/packages/core/src/helpers.php +++ b/packages/core/src/helpers.php @@ -2,13 +2,10 @@ declare(strict_types=1); +use Akaunting\Money; use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Storage; -use Money\Currencies\ISOCurrencies; -use Money\Currency; -use Money\Formatter\IntlMoneyFormatter; -use Money\Money; -use Shopper\Core\Models\Currency as ModelCurrency; +use Shopper\Core\Models\Currency; use Shopper\Core\Models\Order; use Shopper\Core\Models\Setting; @@ -58,13 +55,13 @@ function shopper_asset(string $file): string if (! function_exists('shopper_currency')) { function shopper_currency(): string { - $settingCurrency = shopper_setting('shop_currency_id'); + $settingCurrency = shopper_setting('currency_id'); if ($settingCurrency) { $currency = Cache::remember( 'shopper-currency', now()->addHour(), - fn () => ModelCurrency::query()->find($settingCurrency) + fn () => Currency::query()->find($settingCurrency) ); return $currency ? $currency->code : 'USD'; // @phpstan-ignore-line @@ -75,21 +72,15 @@ function shopper_currency(): string } if (! function_exists('shopper_money_format')) { - function shopper_money_format(int | string $amount, ?string $currency = null): string + function shopper_money_format(int | float $amount, ?string $currency = null, bool $convert = false): string { - $money = new Money( + $money = new Money\Money( amount: $amount, - currency: new Currency($currency ?? shopper_currency()) + currency: new Money\Currency($currency ?? shopper_currency()), + convert: $convert ); - $numberFormatter = new \NumberFormatter(app()->getLocale(), \NumberFormatter::CURRENCY); - - $moneyFormatter = new IntlMoneyFormatter( - formatter: $numberFormatter, - currencies: new ISOCurrencies() - ); - - return $moneyFormatter->format($money); + return $money->formatLocale(app()->getLocale()); } }