From ad1dea1fc61f1aad674b480959cdafb276b398e5 Mon Sep 17 00:00:00 2001 From: Arthur Monney Date: Tue, 6 Jul 2021 10:03:06 +0100 Subject: [PATCH 1/6] :arrow_up: Upgrade tailwind --- package.json | 4 ++-- tailwind.config.js | 4 ++-- webpack.mix.js | 3 --- yarn.lock | 59 ++++++++++++++++++++++++++++++++++++++-------- 4 files changed, 53 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 2397cdeb7..e432400d6 100644 --- a/package.json +++ b/package.json @@ -17,8 +17,8 @@ "laravel-mix": "^6.0.19", "lodash": "^4.17.13", "popper.js": "^1.16.0", - "postcss": "^8.3.0", - "tailwindcss": "^2.2.2" + "postcss": "^8.3.5", + "tailwindcss": "^2.2.4" }, "devDependencies": { "resolve-url-loader": "^2.3.1", diff --git a/tailwind.config.js b/tailwind.config.js index 8f7e8ae90..0dd9f2dd5 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,9 +1,10 @@ const defaultTheme = require('tailwindcss/defaultTheme'); module.exports = { + mode: 'jit', darkMode: 'class', purge: [ - './resources/assets/js/**/*.js', + './resources/js/**/*.js', './resources/views/**/*.php', './resources/lang/**/*.php', './src/**/*.php', @@ -11,7 +12,6 @@ module.exports = { ], theme: { extend: { - colors: {}, inset: { '-0.5': '-0.125rem', }, diff --git a/webpack.mix.js b/webpack.mix.js index 77d9effff..5d5a48f49 100644 --- a/webpack.mix.js +++ b/webpack.mix.js @@ -31,9 +31,6 @@ mix.setPublicPath('public') extensions: ['*', '.js', '.jsx'], alias: { '@': path.resolve('./resources/js'), - '@components': path.resolve('./resources/js/src/components'), - '@hooks': path.resolve('./resources/js/src/hooks'), - '@pages': path.resolve('./resources/js/src/pages'), '@utils': path.resolve('./resources/js/src/utils'), }, } diff --git a/yarn.lock b/yarn.lock index 049d244cc..9102007ee 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1487,6 +1487,14 @@ anymatch@~3.1.1: normalize-path "^3.0.0" picomatch "^2.0.4" +anymatch@~3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.2.tgz#c0557c096af32f106198f4f4e2a383537e378716" + integrity sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg== + dependencies: + normalize-path "^3.0.0" + picomatch "^2.0.4" + arg@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/arg/-/arg-5.0.0.tgz#a20e2bb5710e82950a516b3f933fee5ed478be90" @@ -2024,6 +2032,21 @@ chokidar@^2.1.2: optionalDependencies: fsevents "^1.2.7" +chokidar@^3.5.2: + version "3.5.2" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.2.tgz#dba3976fcadb016f66fd365021d91600d01c1e75" + integrity sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ== + dependencies: + anymatch "~3.1.2" + braces "~3.0.2" + glob-parent "~5.1.2" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.6.0" + optionalDependencies: + fsevents "~2.3.2" + chrome-trace-event@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.2.tgz#234090ee97c7d4ad1a2c4beae27505deffc608a4" @@ -3306,7 +3329,7 @@ fsevents@^1.2.7: bindings "^1.5.0" nan "^2.12.1" -fsevents@~2.3.1: +fsevents@~2.3.1, fsevents@~2.3.2: version "2.3.2" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== @@ -3344,7 +3367,7 @@ glob-parent@^3.1.0: is-glob "^3.1.0" path-dirname "^1.0.0" -glob-parent@^5.1.0: +glob-parent@^5.1.0, glob-parent@~5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== @@ -5314,7 +5337,7 @@ postcss-load-config@^3.0.0: cosmiconfig "^7.0.0" import-cwd "^3.0.0" -postcss-load-config@^3.0.1: +postcss-load-config@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/postcss-load-config/-/postcss-load-config-3.1.0.tgz#d39c47091c4aec37f50272373a6a648ef5e97829" integrity sha512-ipM8Ds01ZUophjDTQYSVP70slFSYg3T0/zyfII5vzhN6V57YSxMgG5syXuwi5VtS8wSf3iL30v0uBdoIVx4Q0g== @@ -5625,7 +5648,7 @@ postcss@^7.0.27: source-map "^0.6.1" supports-color "^6.1.0" -postcss@^8.1.6, postcss@^8.2.1, postcss@^8.2.15, postcss@^8.3.0: +postcss@^8.1.6, postcss@^8.2.1, postcss@^8.2.15: version "8.3.0" resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.3.0.tgz#b1a713f6172ca427e3f05ef1303de8b65683325f" integrity sha512-+ogXpdAjWGa+fdYY5BQ96V/6tAo+TdSSIMP5huJBIygdWwKtVoB5JWZ7yUd4xZ8r+8Kvvx4nyg/PQ071H4UtcQ== @@ -5634,6 +5657,15 @@ postcss@^8.1.6, postcss@^8.2.1, postcss@^8.2.15, postcss@^8.3.0: nanoid "^3.1.23" source-map-js "^0.6.2" +postcss@^8.3.5: + version "8.3.5" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.3.5.tgz#982216b113412bc20a86289e91eb994952a5b709" + integrity sha512-NxTuJocUhYGsMiMFHDUkmjSKT3EdH4/WbGF6GCi1NDGk+vbcUTun4fpbOqaPtD8IIsztA2ilZm2DhYCuyN58gA== + dependencies: + colorette "^1.2.2" + nanoid "^3.1.23" + source-map-js "^0.6.2" + pretty-hrtime@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz#b7e3ea42435a4c9b2759d99e0f201eb195802ee1" @@ -5802,6 +5834,13 @@ readdirp@~3.5.0: dependencies: picomatch "^2.2.1" +readdirp@~3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" + integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA== + dependencies: + picomatch "^2.2.1" + rechoir@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.7.0.tgz#32650fd52c21ab252aa5d65b19310441c7e03aca" @@ -6570,16 +6609,16 @@ svgo@^1.0.0: unquote "~1.1.1" util.promisify "~1.0.0" -tailwindcss@^2.2.2: - version "2.2.2" - resolved "https://registry.yarnpkg.com/tailwindcss/-/tailwindcss-2.2.2.tgz#28a99c87b5a6b2bf6298a77d88dc0590e84fa8ee" - integrity sha512-OzFWhlnfrO3JXZKHQiqZcb0Wwl3oJSmQ7PvT2jdIgCjV5iUoAyql9bb9ZLCSBI5TYXmawujXAoNxXVfP5Auy/Q== +tailwindcss@^2.2.4: + version "2.2.4" + resolved "https://registry.yarnpkg.com/tailwindcss/-/tailwindcss-2.2.4.tgz#6a2e259b1e26125aeaa7cdc479963fd217c308b0" + integrity sha512-OdBCPgazNNsknSP+JfrPzkay9aqKjhKtFhbhgxHgvEFdHy/GuRPo2SCJ4w1SFTN8H6FPI4m6qD/Jj20NWY1GkA== dependencies: "@fullhuman/postcss-purgecss" "^4.0.3" arg "^5.0.0" bytes "^3.0.0" chalk "^4.1.1" - chokidar "^3.5.1" + chokidar "^3.5.2" color "^3.1.3" cosmiconfig "^7.0.0" detective "^5.2.0" @@ -6597,7 +6636,7 @@ tailwindcss@^2.2.2: normalize-path "^3.0.0" object-hash "^2.2.0" postcss-js "^3.0.3" - postcss-load-config "^3.0.1" + postcss-load-config "^3.1.0" postcss-nested "5.0.5" postcss-selector-parser "^6.0.6" postcss-value-parser "^4.1.0" From 19bd8d79cf99d9496f65965097eca04d1c490477 Mon Sep 17 00:00:00 2001 From: Arthur Monney Date: Tue, 6 Jul 2021 11:26:22 +0100 Subject: [PATCH 2/6] :lipstick: Register a new blade component named configuration-step --- resources/views/components/configuration-step.blade.php | 0 src/Providers/ComponentServiceProvider.php | 1 + 2 files changed, 1 insertion(+) create mode 100644 resources/views/components/configuration-step.blade.php diff --git a/resources/views/components/configuration-step.blade.php b/resources/views/components/configuration-step.blade.php new file mode 100644 index 000000000..e69de29bb diff --git a/src/Providers/ComponentServiceProvider.php b/src/Providers/ComponentServiceProvider.php index 0058680b6..d20970b85 100644 --- a/src/Providers/ComponentServiceProvider.php +++ b/src/Providers/ComponentServiceProvider.php @@ -41,6 +41,7 @@ public function registerBladeComponents() $this->registerComponent('button'); $this->registerComponent('breadcrumb'); $this->registerComponent('breadcrumb-link'); + $this->registerComponent('configuration-step'); $this->registerComponent('confirm-modal'); $this->registerComponent('confirms-password'); $this->registerComponent('datetime-picker'); From e34a80af09c2a88926a32597e2b31b5bb0d3f5c9 Mon Sep 17 00:00:00 2001 From: Arthur Monney Date: Tue, 6 Jul 2021 11:26:57 +0100 Subject: [PATCH 3/6] :construction: wip enable shopper config setting feature --- resources/js/shopper.js | 2 + resources/js/src/utils/helpers.js | 2 +- .../components/configuration-step.blade.php | 70 +++++++++++ .../views/pages/settings/initialize.blade.php | 116 +++++++++++++++--- src/Http/Controllers/SettingController.php | 11 -- 5 files changed, 171 insertions(+), 30 deletions(-) diff --git a/resources/js/shopper.js b/resources/js/shopper.js index 19710c61b..c5c4d186d 100644 --- a/resources/js/shopper.js +++ b/resources/js/shopper.js @@ -37,3 +37,5 @@ for (let i = 0; i < darkModeToggles.length; i++) { } }; } + +window.scrollToPosition = (selector) => document.querySelector(selector).scrollIntoView({behavior: 'smooth', block: 'end'}); diff --git a/resources/js/src/utils/helpers.js b/resources/js/src/utils/helpers.js index bcc12f076..9887d92b2 100644 --- a/resources/js/src/utils/helpers.js +++ b/resources/js/src/utils/helpers.js @@ -11,4 +11,4 @@ * * @param {string} selector */ -export const scrollToPosition = (selector) => document.querySelector(selector).scrollIntoView({ behavior: 'smooth', block: 'end'}); +export let scrollToPosition = (selector) => document.querySelector(selector).scrollIntoView({ behavior: 'smooth', block: 'end'}); diff --git a/resources/views/components/configuration-step.blade.php b/resources/views/components/configuration-step.blade.php index e69de29bb..3dfe4ed0c 100644 --- a/resources/views/components/configuration-step.blade.php +++ b/resources/views/components/configuration-step.blade.php @@ -0,0 +1,70 @@ + diff --git a/resources/views/pages/settings/initialize.blade.php b/resources/views/pages/settings/initialize.blade.php index 15b53db11..0e9255739 100644 --- a/resources/views/pages/settings/initialize.blade.php +++ b/resources/views/pages/settings/initialize.blade.php @@ -18,45 +18,50 @@ + + @bukStyles(true) + + + - + -
- -
- - -
-
- @csrf -
- {{ __('Step 1 of 3') }} -

{{ __('Shop configuration') }}

- -
- {{ __('Step 1 - Shop information') }} -

{{ __('Tell us about your Shop') }}

-

- {{ __('This information will be useful if you want users of your site to directly contact you by email or by your phone number.') }} -

-
-
- - - -
-
-
- - {{ __('Store name') }} * - -
-
-
- - - -
- -
-
-
- -
- - {{ __('Email address') }} * - -
-
-
- - - - -
- -
-
-
- -
- - {{ __('Country') }} * - -
-
- -
-
-
-
-
- -
-
+
@@ -194,6 +125,8 @@ class="mt-1 inline-flex items-center w-full px-4 py-2 text-base font-medium text @bukScripts(true) + + diff --git a/routes/api.php b/routes/api.php deleted file mode 100644 index 258bf6ba9..000000000 --- a/routes/api.php +++ /dev/null @@ -1,27 +0,0 @@ -group(function () { - Route::put('/general', [SettingController::class, 'general']); -}); \ No newline at end of file diff --git a/src/Events/Products/ProductCreated.php b/src/Events/Products/ProductCreated.php index dba08f506..6fc146311 100644 --- a/src/Events/Products/ProductCreated.php +++ b/src/Events/Products/ProductCreated.php @@ -8,26 +8,10 @@ class ProductCreated { use SerializesModels; - /** - * Product Model. - * - * @var \Illuminate\Database\Eloquent\Model - */ public $product; - /** - * Quantity to set to the product. - * - * @var array - */ - public $quantity; + public array $quantity; - /** - * Create a new event instance. - * - * @param \Illuminate\Database\Eloquent\Model $product - * @param array $quantity - */ public function __construct($product, array $quantity) { $this->product = $product; diff --git a/src/Events/StoreCreated.php b/src/Events/StoreCreated.php deleted file mode 100644 index 961741668..000000000 --- a/src/Events/StoreCreated.php +++ /dev/null @@ -1,27 +0,0 @@ -isDefaultInventory = $isDefaultInventory; - } -} diff --git a/src/Http/Controllers/Api/Settings/CountryController.php b/src/Http/Controllers/Api/Settings/CountryController.php deleted file mode 100644 index f619c2eef..000000000 --- a/src/Http/Controllers/Api/Settings/CountryController.php +++ /dev/null @@ -1,20 +0,0 @@ -orderBy('name')->get()); - } -} diff --git a/src/Http/Controllers/Api/Settings/CurrencyController.php b/src/Http/Controllers/Api/Settings/CurrencyController.php deleted file mode 100644 index 3c9ad4405..000000000 --- a/src/Http/Controllers/Api/Settings/CurrencyController.php +++ /dev/null @@ -1,31 +0,0 @@ -where('code', $code)->first()); - } -} diff --git a/src/Http/Controllers/Api/Settings/SettingController.php b/src/Http/Controllers/Api/Settings/SettingController.php deleted file mode 100644 index ecc95792a..000000000 --- a/src/Http/Controllers/Api/Settings/SettingController.php +++ /dev/null @@ -1,69 +0,0 @@ -all(), [ - 'shop_name' => 'required|max:100', - 'shop_email' => 'required|email', - 'shop_about' => 'nullable|string', - 'shop_country_id' => 'required', - 'shop_currency_id' => 'required', - 'shop_street_address' => 'required|string', - 'shop_zipcode' => 'required|numeric', - 'shop_city' => 'required|string', - 'shop_phone_number' => 'nullable', - 'shop_lng' => 'nullable|numeric', - 'shop_lat' => 'nullable|numeric', - 'shop_facebook_link' => 'nullable|string', - 'shop_instagram_link' => 'nullable|string', - 'shop_twitter_link' => 'nullable|string', - ]); - - if ($validator->fails()) { - return response()->json([ - 'status' => 'error', - 'errors' => $validator->messages()->get('*'), - 'data' => $request->all(), - ], 400); - } - - foreach ($request->except(['shop_logo', 'is_default_inventory']) as $key => $value) { - Setting::query()->updateOrCreate(['key' => $key], [ - 'value' => $value, - 'locked' => true, - 'display_name' => Setting::lockedAttributesDisplayName($key), - ]); - } - - if ($request->input('shop_logo') && $request->input('shop_logo') !== "null") { - Setting::query()->create([ - 'key' => 'shop_logo', - 'value' => $request->input('shop_logo')->store('/', config('shopper.system.storage.disks.uploads')), - 'display_name' => Setting::lockedAttributesDisplayName('shop_logo'), - ]); - } - - event(new StoreCreated(boolval($request->input('is_default_inventory')))); - - return response()->json([ - 'status' => 'success', - 'message' => __("Store successfully created, you can now access to your dashboard to manage everything."), - ]); - } -} diff --git a/src/Http/Livewire/Initialization.php b/src/Http/Livewire/Initialization.php new file mode 100644 index 000000000..afaecb568 --- /dev/null +++ b/src/Http/Livewire/Initialization.php @@ -0,0 +1,174 @@ + 'required|max:100', + 'shop_email' => 'required|email', + 'logo' => 'nullable|image|max:1024', + 'shop_country_id' => 'required', + 'shop_street_address' => 'required|string', + 'shop_zipcode' => 'required', + 'shop_city' => 'required', + ]; + + public function mount() + { + $defaultCurrency = Currency::where('code', shopper_currency())->first(); + $this->shop_currency_id = (int) $defaultCurrency->id; + } + + public function stepOneState(): bool + { + if ($this->shop_email && $this->shop_name && $this->shop_country_id) { + return true; + } + + return false; + } + + public function stepTwoState(): bool + { + if (! empty($this->shop_street_address) && ! empty($this->shop_city) && ! empty($this->shop_zipcode)) { + return true; + } + + return false; + } + + public function stepTreeState(): bool + { + if ($this->shop_facebook_link || $this->shop_instagram_link || $this->shop_twitter_link) { + return true; + } + + return false; + } + + public function updatedShopCountryId($value) + { + $country = Country::find($value); + $countryCurrency = array_slice($country->currencies, 0, 1); + + foreach ($countryCurrency as $code => $name) { + if ($currency = Currency::where('code', $code)->first()) { + $this->shop_currency_id = $currency->id; + } + } + } + + public function store() + { + $this->validate(); + + $keys = [ + 'shop_name', + 'shop_email', + 'shop_about', + 'shop_country_id', + 'shop_currency_id', + 'shop_street_address', + 'shop_zipcode', + 'shop_city', + 'shop_phone_number', + 'shop_facebook_link', + 'shop_instagram_link', + 'shop_twitter_link', + ]; + + foreach ($keys as $key) { + Setting::query()->updateOrCreate(['key' => $key], [ + 'value' => $this->{$key}, + 'display_name' => Setting::lockedAttributesDisplayName($key), + 'locked' => true, + ]); + } + + if ($this->logo) { + Setting::query()->updateOrCreate(['key' => 'shop_logo'], [ + 'value' => $this->logo->store('/', config('shopper.system.storage.disks.uploads')), + 'display_name' => Setting::lockedAttributesDisplayName('shop_logo'), + 'locked' => true, + ]); + } + + $this->storeHasSetup(); + + session()->flash('success', __('Store successfully setup, you can now manage everything.')); + + $this->redirectRoute('shopper.dashboard'); + } + + protected function messages(): array + { + return [ + 'shop_country_id.required' => __('The country is required'), + 'shop_name.required' => __('The store name is required') + ]; + } + + public function storeHasSetup() + { + (new InventoryRepository)->create([ + 'name' => $this->shop_name, + 'code' => str_slug($this->shop_name), + 'email' => $this->shop_email, + 'street_address' => $this->shop_street_address, + 'zipcode' => $this->shop_zipcode, + 'city' => $this->shop_city, + 'phone_number' => $this->shop_phone_number, + 'country_id' => $this->shop_country_id, + 'lng' => $this->shop_lng, + 'lat' => $this->shop_lat, + 'is_default' => $this->isDefault, + ]); + + (new ChannelRepository)->create([ + 'name' => $name = __('Web Store'), + 'slug' => str_slug($name), + 'url' => env('APP_URL'), + 'is_default' => true, + ]); + } + + public function render() + { + return view('shopper::livewire.initialization', [ + 'countries' => Country::select('name', 'id')->orderBy('name')->get(), + 'currencies' => Currency::select('name', 'code', 'id')->orderBy('name')->get(), + ]); + } +} diff --git a/src/Http/Livewire/Settings/General.php b/src/Http/Livewire/Settings/General.php index 7728e84e7..90530d488 100644 --- a/src/Http/Livewire/Settings/General.php +++ b/src/Http/Livewire/Settings/General.php @@ -51,12 +51,6 @@ public function mount() $this->shop_twitter_link = ($twitter = Setting::query()->where('key', 'shop_twitter_link')->first()) ? $twitter->value: ''; } - /** - * Change currency when country value updated. - * - * @param string $value - * @return void - */ public function updatedShopCountryId($value) { $country = Country::query()->find($value); diff --git a/src/Http/Livewire/Settings/Inventories/Create.php b/src/Http/Livewire/Settings/Inventories/Create.php index 84de2cb92..d987b45a8 100644 --- a/src/Http/Livewire/Settings/Inventories/Create.php +++ b/src/Http/Livewire/Settings/Inventories/Create.php @@ -9,75 +9,30 @@ class Create extends AbstractBaseComponent { - /** - * Inventory default name. - * - * @var string - */ - public $name; + public string $name = ''; - /** - * Inventory description. - * - * @var string - */ - public $description; + public ?string $description = null; - /** - * Inventory email. - * - * @var string - */ - public $email; + public string $email = ''; - /** - * City where a locate th inventory. - * - * @var string - */ - public $city; + public string $city = ''; - /** - * Street address to locate inventory on a map. - * - * @var string - */ - public $street_address; + public string $street_address = ''; - /** - * Street address secondary. - * - * @var string - */ - public $street_address_plus; + public ?string $street_address_plus = null; - /** - * Zipcode. - * - * @var string - */ - public $zipcode; + public ?string $zipcode = null; - /** - * Phone number. - * - * @var string - */ - public $phone_number; + public ?string $phone_number = null; - /** - * Country who inventory is localize. - * - * @var integer - */ - public $country_id; + public ?int $country_id = null; /** * Define if the inventory is the default. * * @var bool */ - public $isDefault = false; + public bool $isDefault = false; /** * Store/Update a entry to the storage. @@ -103,15 +58,11 @@ public function store() ]); session()->flash('success', __('Inventory Successfully Added.')); + $this->redirectRoute('shopper.settings.inventories.index'); } - /** - * Component validation rules. - * - * @return string[] - */ - protected function rules() + protected function rules(): array { return [ 'email' => 'required|email|unique:'.shopper_table('inventories'), @@ -124,15 +75,10 @@ protected function rules() ]; } - /** - * Render the component. - * - * @return \Illuminate\View\View - */ public function render() { return view('shopper::livewire.settings.inventories.create', [ - 'countries' => Country::query()->orderBy('name')->get(), + 'countries' => Country::select('name', 'id')->orderBy('name')->get(), ]); } } diff --git a/src/Http/Middleware/HasConfiguration.php b/src/Http/Middleware/HasConfiguration.php index 93afadf6c..903a9fa91 100644 --- a/src/Http/Middleware/HasConfiguration.php +++ b/src/Http/Middleware/HasConfiguration.php @@ -3,6 +3,7 @@ namespace Shopper\Framework\Http\Middleware; use Closure; +use Illuminate\Http\Request; use Shopper\Framework\Models\System\Setting; class HasConfiguration @@ -14,7 +15,7 @@ class HasConfiguration * @param \Closure $next * @return mixed */ - public function handle($request, Closure $next) + public function handle(Request $request, Closure $next) { if (Setting::query()->where('key', 'shop_email')->exists()) { if ($request->ajax() || $request->wantsJson()) { diff --git a/src/Http/Resources/Country.php b/src/Http/Resources/Country.php deleted file mode 100644 index e2b012192..000000000 --- a/src/Http/Resources/Country.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->id, - 'name' => $this->name, - 'flag' => $this->flag, - 'currencies' => $this->currencies, - ]; - } -} diff --git a/src/Http/Resources/Currency.php b/src/Http/Resources/Currency.php deleted file mode 100644 index cf5ed128e..000000000 --- a/src/Http/Resources/Currency.php +++ /dev/null @@ -1,25 +0,0 @@ - $this->id, - 'name' => $this->name, - 'code' => $this->code, - 'symbol' => $this->symbol, - 'exchange_rate' => $this->exchange_rate, - ]; - } -} diff --git a/src/Listeners/ChannelSubscriber.php b/src/Listeners/ChannelSubscriber.php deleted file mode 100644 index 5047c385b..000000000 --- a/src/Listeners/ChannelSubscriber.php +++ /dev/null @@ -1,40 +0,0 @@ -repository = $repository; - } - - /** - * Handle the event. - * - * @param StoreCreated $event - * @return void - */ - public function handle(StoreCreated $event) - { - $this->repository->create([ - 'name' => $name = __('Web Store'), - 'slug' => str_slug($name), - 'url' => env('APP_URL'), - 'is_default' => true, - ]); - } -} diff --git a/src/Listeners/InventorySubscriber.php b/src/Listeners/InventorySubscriber.php deleted file mode 100644 index fd996e0e7..000000000 --- a/src/Listeners/InventorySubscriber.php +++ /dev/null @@ -1,48 +0,0 @@ -repository = $repository; - } - - /** - * Handle the event. - * - * @param StoreCreated $event - * @return void - */ - public function handle(StoreCreated $event) - { - $this->repository->create([ - 'name' => $name = Setting::query()->where('key', 'shop_name')->first()->value, - 'code' => str_slug($name), - 'email' => Setting::query()->where('key', 'shop_email')->first()->value, - 'street_address' => Setting::query()->where('key', 'shop_street_address')->first()->value, - 'zipcode' => Setting::query()->where('key', 'shop_zipcode')->first()->value, - 'city' => Setting::query()->where('key', 'shop_city')->first()->value, - 'phone_number' => ($phone = Setting::query()->where('key', 'shop_phone_number')->first()) ? $phone->value: null, - 'country_id' => ($country = Setting::query()->where('key', 'shop_country_id')->first()) ? $country->value: null, - 'longitude' => ($lng = Setting::query()->where('key', 'shop_lng')->first()) ? $lng->value: null, - 'latitude' => ($lat = Setting::query()->where('key', 'shop_lat')->first()) ? $lat->value: null, - 'is_default' => $event->isDefaultInventory, - ]); - } -} diff --git a/src/Providers/ComponentServiceProvider.php b/src/Providers/ComponentServiceProvider.php index d20970b85..0058680b6 100644 --- a/src/Providers/ComponentServiceProvider.php +++ b/src/Providers/ComponentServiceProvider.php @@ -41,7 +41,6 @@ public function registerBladeComponents() $this->registerComponent('button'); $this->registerComponent('breadcrumb'); $this->registerComponent('breadcrumb-link'); - $this->registerComponent('configuration-step'); $this->registerComponent('confirm-modal'); $this->registerComponent('confirms-password'); $this->registerComponent('datetime-picker'); diff --git a/src/Providers/EventServiceProvider.php b/src/Providers/EventServiceProvider.php index 8edb1667d..2bb3b00cc 100644 --- a/src/Providers/EventServiceProvider.php +++ b/src/Providers/EventServiceProvider.php @@ -6,10 +6,7 @@ use Shopper\Framework\Events\Products\ProductCreated; use Shopper\Framework\Events\Products\ProductRemoved; use Shopper\Framework\Events\Products\ProductUpdated; -use Shopper\Framework\Events\StoreCreated; -use Shopper\Framework\Listeners\ChannelSubscriber; use Shopper\Framework\Listeners\Products\CreateProductSubscriber; -use Shopper\Framework\Listeners\InventorySubscriber; class EventServiceProvider extends ServiceProvider { @@ -19,21 +16,12 @@ class EventServiceProvider extends ServiceProvider * @var array */ protected $listen = [ - StoreCreated::class => [ - ChannelSubscriber::class, - InventorySubscriber::class - ], - ProductCreated::class => [ CreateProductSubscriber::class, ], - ProductUpdated::class => [ - - ], - - ProductRemoved::class => [ + ProductUpdated::class => [], - ], + ProductRemoved::class => [], ]; } diff --git a/src/Providers/RouteServiceProvider.php b/src/Providers/RouteServiceProvider.php index 827439595..cad55a328 100644 --- a/src/Providers/RouteServiceProvider.php +++ b/src/Providers/RouteServiceProvider.php @@ -38,8 +38,6 @@ public function map() $this->mapBackendRoutes(); - $this->mapApiRoutes(); - $this->mapCustomBackendRoute(); } @@ -88,19 +86,4 @@ public function mapCustomBackendRoute() ->group(config('shopper.routes.custom_file')); } } - - /** - * Define the "api" routes for the application. - * These routes all receive session state, CSRF protection, etc. - * - * @return void - */ - protected function mapApiRoutes() - { - Route::middleware('api') - ->prefix('api') - ->as('shopper.api.') - ->namespace($this->namespace . '\Api') - ->group(realpath(SHOPPER_PATH . '/routes/api.php')); - } } From 828125a6fbd32934e51c521df75a4b102a20614d Mon Sep 17 00:00:00 2001 From: Arthur Monney Date: Wed, 7 Jul 2021 13:10:18 +0100 Subject: [PATCH 6/6] :bento: update assets --- public/css/shopper.css | 187 +++++++++++++++++++-------------------- public/mix-manifest.json | 2 +- 2 files changed, 92 insertions(+), 97 deletions(-) diff --git a/public/css/shopper.css b/public/css/shopper.css index 388ace1fb..c0b1697db 100644 --- a/public/css/shopper.css +++ b/public/css/shopper.css @@ -1621,14 +1621,6 @@ input[type=number] { bottom: 0px; } -.top-4{ - top: 1rem; -} - -.right-4{ - right: 1rem; -} - .left-4{ left: 1rem; } @@ -1665,6 +1657,14 @@ input[type=number] { top: 4rem; } +.top-4{ + top: 1rem; +} + +.right-4{ + right: 1rem; +} + .z-50{ z-index: 50; } @@ -1874,10 +1874,6 @@ input[type=number] { margin-top: 0.375rem; } -.ml-5{ - margin-left: 1.25rem; -} - .ml-auto{ margin-left: auto; } @@ -1886,6 +1882,10 @@ input[type=number] { margin-bottom: 0.5rem; } +.ml-5{ + margin-left: 1.25rem; +} + .mb-8{ margin-bottom: 2rem; } @@ -2046,10 +2046,6 @@ input[type=number] { height: 100%; } -.h-8{ - height: 2rem; -} - .h-40{ height: 10rem; } @@ -2058,6 +2054,10 @@ input[type=number] { height: 8rem; } +.h-8{ + height: 2rem; +} + .h-2\.5{ height: 0.625rem; } @@ -2106,6 +2106,10 @@ input[type=number] { height: 11rem; } +.h-95{ + height: 23.75rem; +} + .max-h-96{ max-height: 24rem; } @@ -2484,14 +2488,14 @@ input[type=number] { justify-content: space-between; } -.gap-4{ - gap: 1rem; -} - .gap-6{ gap: 1.5rem; } +.gap-4{ + gap: 1rem; +} + .gap-1{ gap: 0.25rem; } @@ -2528,6 +2532,12 @@ input[type=number] { margin-bottom: calc(0.25rem * var(--tw-space-y-reverse)); } +.space-y-6 > :not([hidden]) ~ :not([hidden]){ + --tw-space-y-reverse: 0; + margin-top: calc(1.5rem * calc(1 - var(--tw-space-y-reverse))); + margin-bottom: calc(1.5rem * var(--tw-space-y-reverse)); +} + .space-y-8 > :not([hidden]) ~ :not([hidden]){ --tw-space-y-reverse: 0; margin-top: calc(2rem * calc(1 - var(--tw-space-y-reverse))); @@ -2540,12 +2550,6 @@ input[type=number] { margin-left: calc(0.75rem * calc(1 - var(--tw-space-x-reverse))); } -.space-y-6 > :not([hidden]) ~ :not([hidden]){ - --tw-space-y-reverse: 0; - margin-top: calc(1.5rem * calc(1 - var(--tw-space-y-reverse))); - margin-bottom: calc(1.5rem * var(--tw-space-y-reverse)); -} - .space-x-6 > :not([hidden]) ~ :not([hidden]){ --tw-space-x-reverse: 0; margin-right: calc(1.5rem * var(--tw-space-x-reverse)); @@ -2779,11 +2783,6 @@ input[type=number] { border-color: rgba(37, 99, 235, var(--tw-border-opacity)); } -.border-red-300{ - --tw-border-opacity: 1; - border-color: rgba(252, 165, 165, var(--tw-border-opacity)); -} - .border-red-600{ --tw-border-opacity: 1; border-color: rgba(220, 38, 38, var(--tw-border-opacity)); @@ -2814,6 +2813,11 @@ input[type=number] { border-color: rgba(243, 244, 246, var(--tw-border-opacity)); } +.border-red-300{ + --tw-border-opacity: 1; + border-color: rgba(252, 165, 165, var(--tw-border-opacity)); +} + .border-blue-500{ --tw-border-opacity: 1; border-color: rgba(59, 130, 246, var(--tw-border-opacity)); @@ -3252,16 +3256,12 @@ input[type=number] { padding-left: 2.25rem; } -.pt-8{ - padding-top: 2rem; -} - .pl-10{ padding-left: 2.5rem; } -.pr-10{ - padding-right: 2.5rem; +.pt-8{ + padding-top: 2rem; } .pb-6{ @@ -3272,6 +3272,10 @@ input[type=number] { padding-bottom: 2.5rem; } +.pr-10{ + padding-right: 2.5rem; +} + .pl-16{ padding-left: 4rem; } @@ -3443,14 +3447,14 @@ input[type=number] { line-height: 1rem; } -.leading-7{ - line-height: 1.75rem; -} - .leading-8{ line-height: 2rem; } +.leading-7{ + line-height: 1.75rem; +} + .leading-normal{ line-height: 1.5; } @@ -3543,16 +3547,6 @@ input[type=number] { color: rgba(209, 213, 219, var(--tw-text-opacity)); } -.text-green-500{ - --tw-text-opacity: 1; - color: rgba(16, 185, 129, var(--tw-text-opacity)); -} - -.text-red-900{ - --tw-text-opacity: 1; - color: rgba(127, 29, 29, var(--tw-text-opacity)); -} - .text-blue-800{ --tw-text-opacity: 1; color: rgba(30, 64, 175, var(--tw-text-opacity)); @@ -3568,6 +3562,11 @@ input[type=number] { color: rgba(29, 78, 216, var(--tw-text-opacity)); } +.text-green-500{ + --tw-text-opacity: 1; + color: rgba(16, 185, 129, var(--tw-text-opacity)); +} + .text-green-800{ --tw-text-opacity: 1; color: rgba(6, 95, 70, var(--tw-text-opacity)); @@ -3603,6 +3602,11 @@ input[type=number] { color: rgba(31, 41, 55, var(--tw-text-opacity)); } +.text-red-900{ + --tw-text-opacity: 1; + color: rgba(127, 29, 29, var(--tw-text-opacity)); +} + .text-yellow-800{ --tw-text-opacity: 1; color: rgba(146, 64, 14, var(--tw-text-opacity)); @@ -3992,10 +3996,6 @@ input[type=number] { .hover\:opacity-100:hover{ opacity: 1; } -.hover\:shadow-lg:hover{ - --tw-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); - box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); -} .hover\:shadow-md:hover{ --tw-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); @@ -4014,6 +4014,10 @@ input[type=number] { .focus\:border-transparent:focus{ border-color: transparent; } +.focus\:border-blue-700:focus{ + --tw-border-opacity: 1; + border-color: rgba(29, 78, 216, var(--tw-border-opacity)); +} .focus\:border-red-300:focus{ --tw-border-opacity: 1; border-color: rgba(252, 165, 165, var(--tw-border-opacity)); @@ -4022,10 +4026,6 @@ input[type=number] { --tw-border-opacity: 1; border-color: rgba(147, 197, 253, var(--tw-border-opacity)); } -.focus\:border-blue-700:focus{ - --tw-border-opacity: 1; - border-color: rgba(29, 78, 216, var(--tw-border-opacity)); -} .focus\:border-indigo-500:focus{ --tw-border-opacity: 1; border-color: rgba(99, 102, 241, var(--tw-border-opacity)); @@ -4174,10 +4174,6 @@ input[type=number] { .focus\:ring-offset-blue-800:focus{ --tw-ring-offset-color: #1e40af; } -.active\:bg-gray-50:active{ - --tw-bg-opacity: 1; - background-color: rgba(249, 250, 251, var(--tw-bg-opacity)); -} .active\:bg-blue-700:active{ --tw-bg-opacity: 1; background-color: rgba(29, 78, 216, var(--tw-bg-opacity)); @@ -4198,10 +4194,6 @@ input[type=number] { --tw-bg-opacity: 1; background-color: rgba(4, 120, 87, var(--tw-bg-opacity)); } -.active\:text-gray-800:active{ - --tw-text-opacity: 1; - color: rgba(31, 41, 55, var(--tw-text-opacity)); -} .active\:text-gray-700:active{ --tw-text-opacity: 1; color: rgba(55, 65, 81, var(--tw-text-opacity)); @@ -4339,6 +4331,14 @@ input[type=number] { --tw-text-opacity: 1; color: rgba(248, 113, 113, var(--tw-text-opacity)); } +.dark .dark\:text-blue-500{ + --tw-text-opacity: 1; + color: rgba(59, 130, 246, var(--tw-text-opacity)); +} +.dark .dark\:text-gray-700{ + --tw-text-opacity: 1; + color: rgba(55, 65, 81, var(--tw-text-opacity)); +} .dark .dark\:text-blue-600{ --tw-text-opacity: 1; color: rgba(37, 99, 235, var(--tw-text-opacity)); @@ -4347,10 +4347,6 @@ input[type=number] { --tw-text-opacity: 1; color: rgba(96, 165, 250, var(--tw-text-opacity)); } -.dark .dark\:text-blue-500{ - --tw-text-opacity: 1; - color: rgba(59, 130, 246, var(--tw-text-opacity)); -} .dark .dark\:text-green-500{ --tw-text-opacity: 1; color: rgba(16, 185, 129, var(--tw-text-opacity)); @@ -4367,10 +4363,6 @@ input[type=number] { --tw-text-opacity: 1; color: rgba(52, 211, 153, var(--tw-text-opacity)); } -.dark .dark\:text-gray-700{ - --tw-text-opacity: 1; - color: rgba(55, 65, 81, var(--tw-text-opacity)); -} .dark .dark\:placeholder-gray-400::-moz-placeholder{ --tw-placeholder-opacity: 1; color: rgba(156, 163, 175, var(--tw-placeholder-opacity)); @@ -4392,14 +4384,14 @@ input[type=number] { .dark .dark\:ease-out{ transition-timing-function: cubic-bezier(0, 0, 0.2, 1); } -.dark .dark\:hover\:border-gray-700:hover{ - --tw-border-opacity: 1; - border-color: rgba(55, 65, 81, var(--tw-border-opacity)); -} .dark .dark\:hover\:border-blue-500:hover{ --tw-border-opacity: 1; border-color: rgba(59, 130, 246, var(--tw-border-opacity)); } +.dark .dark\:hover\:border-gray-700:hover{ + --tw-border-opacity: 1; + border-color: rgba(55, 65, 81, var(--tw-border-opacity)); +} .dark .dark\:hover\:border-gray-600:hover{ --tw-border-opacity: 1; border-color: rgba(75, 85, 99, var(--tw-border-opacity)); @@ -4460,14 +4452,14 @@ input[type=number] { --tw-border-opacity: 1; border-color: rgba(29, 78, 216, var(--tw-border-opacity)); } -.dark .dark\:focus\:border-blue-600:focus{ - --tw-border-opacity: 1; - border-color: rgba(37, 99, 235, var(--tw-border-opacity)); -} .dark .dark\:focus\:border-gray-700:focus{ --tw-border-opacity: 1; border-color: rgba(55, 65, 81, var(--tw-border-opacity)); } +.dark .dark\:focus\:border-blue-600:focus{ + --tw-border-opacity: 1; + border-color: rgba(37, 99, 235, var(--tw-border-opacity)); +} .dark .dark\:focus\:bg-gray-800:focus{ --tw-bg-opacity: 1; background-color: rgba(31, 41, 55, var(--tw-bg-opacity)); @@ -4498,14 +4490,14 @@ input[type=number] { .dark .dark\:focus\:ring-offset-gray-800:focus{ --tw-ring-offset-color: #1f2937; } -.dark .group:hover .dark\:group-hover\:bg-gray-800{ - --tw-bg-opacity: 1; - background-color: rgba(31, 41, 55, var(--tw-bg-opacity)); -} .dark .group:hover .dark\:group-hover\:bg-gray-700{ --tw-bg-opacity: 1; background-color: rgba(55, 65, 81, var(--tw-bg-opacity)); } +.dark .group:hover .dark\:group-hover\:bg-gray-800{ + --tw-bg-opacity: 1; + background-color: rgba(31, 41, 55, var(--tw-bg-opacity)); +} .dark .group:hover .dark\:group-hover\:text-gray-300{ --tw-text-opacity: 1; color: rgba(209, 213, 219, var(--tw-text-opacity)); @@ -4717,12 +4709,12 @@ input[type=number] { .sm\:justify-between{ justify-content: space-between; } - .sm\:gap-6{ - gap: 1.5rem; - } .sm\:gap-4{ gap: 1rem; } + .sm\:gap-6{ + gap: 1.5rem; + } .sm\:gap-5{ gap: 1.25rem; } @@ -5061,15 +5053,15 @@ input[type=number] { margin-left: -2rem; margin-right: -2rem; } + .lg\:mt-0{ + margin-top: 0px; + } .lg\:mt-8{ margin-top: 2rem; } .lg\:mt-10{ margin-top: 2.5rem; } - .lg\:mt-0{ - margin-top: 0px; - } .lg\:ml-4{ margin-left: 1rem; } @@ -5109,18 +5101,21 @@ input[type=number] { .lg\:grid-cols-3{ grid-template-columns: repeat(3, minmax(0, 1fr)); } + .lg\:grid-cols-4{ + grid-template-columns: repeat(4, minmax(0, 1fr)); + } .lg\:flex-row{ flex-direction: row; } .lg\:items-center{ align-items: center; } - .lg\:gap-8{ - gap: 2rem; - } .lg\:gap-6{ gap: 1.5rem; } + .lg\:gap-5{ + gap: 1.25rem; + } .lg\:space-y-0 > :not([hidden]) ~ :not([hidden]){ --tw-space-y-reverse: 0; margin-top: calc(0px * calc(1 - var(--tw-space-y-reverse))); diff --git a/public/mix-manifest.json b/public/mix-manifest.json index 7f5eaf7f9..a55cf15f1 100644 --- a/public/mix-manifest.json +++ b/public/mix-manifest.json @@ -1,4 +1,4 @@ { "/js/shopper.js": "/js/shopper.js?id=db76dd8fb9b515fd97c5", - "/css/shopper.css": "/css/shopper.css?id=8843a5d38e7aa2ad7af2" + "/css/shopper.css": "/css/shopper.css?id=83e17090f16f37c575bb" }