From 7f6598238e289eea477a9f2f77380c8b4c52c78e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=8Carodej?= Date: Thu, 25 Nov 2021 14:19:04 +0100 Subject: [PATCH] create plan page refactoring --- public/mix-manifest.json | 65 +++- resources/js/helpers/functionHelpers.js | 16 + resources/js/store/modules/app.js | 11 + resources/js/views/Admin/Plans/PlanCreate.vue | 315 +++++++++--------- .../Admin/Plans/PlanTabs/PlanSettings.vue | 10 +- .../Controllers/StorePlansController.php | 5 - 6 files changed, 255 insertions(+), 167 deletions(-) diff --git a/public/mix-manifest.json b/public/mix-manifest.json index 6ebaac0c..eb1363c2 100644 --- a/public/mix-manifest.json +++ b/public/mix-manifest.json @@ -55,9 +55,9 @@ "/chunks/page-edit.js": "/chunks/page-edit.js?id=d116a63e3c59bc0a5133", "/chunks/pages.js": "/chunks/pages.js?id=57cb88433843d50803cc", "/chunks/plan.js": "/chunks/plan.js?id=483129eff79a17ac0385", - "/chunks/plan-create.js": "/chunks/plan-create.js?id=c1ad8299871917f21f8e", + "/chunks/plan-create.js": "/chunks/plan-create.js?id=356baaa5a3526092427f", "/chunks/plan-delete.js": "/chunks/plan-delete.js?id=0bb61dfb1adac4b941ec", - "/chunks/plan-settings.js": "/chunks/plan-settings.js?id=d05adc407c271c7ece76", + "/chunks/plan-settings.js": "/chunks/plan-settings.js?id=a76effa1bd41a19581c9", "/chunks/plan-subscribers.js": "/chunks/plan-subscribers.js?id=cee121363af5d208dcf7", "/chunks/plans.js": "/chunks/plans.js?id=a03911a6f6001380f11b", "/chunks/platform.js": "/chunks/platform.js?id=dc3c6677ab43d4475b66", @@ -427,5 +427,64 @@ "/chunks/subscriptions.25ea8acd465eae4c377e.hot-update.js": "/chunks/subscriptions.25ea8acd465eae4c377e.hot-update.js", "/chunks/subscriptions.8ce5c6a4da6e1894d8ee.hot-update.js": "/chunks/subscriptions.8ce5c6a4da6e1894d8ee.hot-update.js", "/js/main.8d3eade3e32203b853d9.hot-update.js": "/js/main.8d3eade3e32203b853d9.hot-update.js", - "/chunks/subscriptions.8d3eade3e32203b853d9.hot-update.js": "/chunks/subscriptions.8d3eade3e32203b853d9.hot-update.js" + "/chunks/subscriptions.8d3eade3e32203b853d9.hot-update.js": "/chunks/subscriptions.8d3eade3e32203b853d9.hot-update.js", + "/chunks/plan-create.c8a1b6cc4bbc8012a287.hot-update.js": "/chunks/plan-create.c8a1b6cc4bbc8012a287.hot-update.js", + "/chunks/plan-create.e93e4ce22566d560bf4a.hot-update.js": "/chunks/plan-create.e93e4ce22566d560bf4a.hot-update.js", + "/chunks/plan-create.9cbbcff6554726fca9f4.hot-update.js": "/chunks/plan-create.9cbbcff6554726fca9f4.hot-update.js", + "/chunks/plan-create.6de9c8b3607901be20e7.hot-update.js": "/chunks/plan-create.6de9c8b3607901be20e7.hot-update.js", + "/chunks/plan-create.42ca2e7ff725262d256b.hot-update.js": "/chunks/plan-create.42ca2e7ff725262d256b.hot-update.js", + "/chunks/plan-create.e65915f676d55dd55942.hot-update.js": "/chunks/plan-create.e65915f676d55dd55942.hot-update.js", + "/chunks/plan-create.b264ee984ce759295056.hot-update.js": "/chunks/plan-create.b264ee984ce759295056.hot-update.js", + "/chunks/plan-create.ebb143110a73b215d106.hot-update.js": "/chunks/plan-create.ebb143110a73b215d106.hot-update.js", + "/chunks/plan-create.43c5c333f453f16ab943.hot-update.js": "/chunks/plan-create.43c5c333f453f16ab943.hot-update.js", + "/chunks/plan-create.332eda01d463b92a7e21.hot-update.js": "/chunks/plan-create.332eda01d463b92a7e21.hot-update.js", + "/chunks/plan-create.78f142c79c4425fd6ead.hot-update.js": "/chunks/plan-create.78f142c79c4425fd6ead.hot-update.js", + "/chunks/plan-create.5152585867444d6763ae.hot-update.js": "/chunks/plan-create.5152585867444d6763ae.hot-update.js", + "/chunks/plan-create.9ec8dc96a51cd86ed6cb.hot-update.js": "/chunks/plan-create.9ec8dc96a51cd86ed6cb.hot-update.js", + "/chunks/plan-create.1595f4e2bfdd03e8f2b9.hot-update.js": "/chunks/plan-create.1595f4e2bfdd03e8f2b9.hot-update.js", + "/chunks/plan-create.46cf4b10fa48605a8d4b.hot-update.js": "/chunks/plan-create.46cf4b10fa48605a8d4b.hot-update.js", + "/chunks/plan-create.b7dd4fd87decc82d8810.hot-update.js": "/chunks/plan-create.b7dd4fd87decc82d8810.hot-update.js", + "/chunks/plan-create.acd7df2a7fb570d72409.hot-update.js": "/chunks/plan-create.acd7df2a7fb570d72409.hot-update.js", + "/chunks/plan-create.7c76268dc96c929e8c9b.hot-update.js": "/chunks/plan-create.7c76268dc96c929e8c9b.hot-update.js", + "/chunks/plan-create.7f0bfa511465f11f3c34.hot-update.js": "/chunks/plan-create.7f0bfa511465f11f3c34.hot-update.js", + "/chunks/plan-create.fc29f9dd795f4f2c3454.hot-update.js": "/chunks/plan-create.fc29f9dd795f4f2c3454.hot-update.js", + "/chunks/plan-create.be3862f379a5f291e8c6.hot-update.js": "/chunks/plan-create.be3862f379a5f291e8c6.hot-update.js", + "/chunks/plan-create.15319506d3a164f99431.hot-update.js": "/chunks/plan-create.15319506d3a164f99431.hot-update.js", + "/chunks/plan-create.55a984e0f8b5e8406b17.hot-update.js": "/chunks/plan-create.55a984e0f8b5e8406b17.hot-update.js", + "/chunks/plan-create.33b9f58415e7404cb14e.hot-update.js": "/chunks/plan-create.33b9f58415e7404cb14e.hot-update.js", + "/chunks/plan-create.a8436772c7c8ac9beecf.hot-update.js": "/chunks/plan-create.a8436772c7c8ac9beecf.hot-update.js", + "/chunks/plan-create.d88765a4950d9898f6d9.hot-update.js": "/chunks/plan-create.d88765a4950d9898f6d9.hot-update.js", + "/chunks/plan-create.40dbebe5dc91eae5f7af.hot-update.js": "/chunks/plan-create.40dbebe5dc91eae5f7af.hot-update.js", + "/chunks/plan-create.3dd88ec3459677ea073e.hot-update.js": "/chunks/plan-create.3dd88ec3459677ea073e.hot-update.js", + "/chunks/plan-create.362d54160e5daba25a0f.hot-update.js": "/chunks/plan-create.362d54160e5daba25a0f.hot-update.js", + "/chunks/plan-create.897ac9ace89e32b28056.hot-update.js": "/chunks/plan-create.897ac9ace89e32b28056.hot-update.js", + "/chunks/plan-create.ae20f9f134d0ab9e71b2.hot-update.js": "/chunks/plan-create.ae20f9f134d0ab9e71b2.hot-update.js", + "/chunks/plan-create.53221c657462a224f085.hot-update.js": "/chunks/plan-create.53221c657462a224f085.hot-update.js", + "/chunks/plan-create.66a187d979dd712001e8.hot-update.js": "/chunks/plan-create.66a187d979dd712001e8.hot-update.js", + "/chunks/plan-create.fee89e531a840d2fc7ce.hot-update.js": "/chunks/plan-create.fee89e531a840d2fc7ce.hot-update.js", + "/js/main.41b1f1edb0b6a60b2b4b.hot-update.js": "/js/main.41b1f1edb0b6a60b2b4b.hot-update.js", + "/chunks/plan-create.6ecb5b31b8320042225d.hot-update.js": "/chunks/plan-create.6ecb5b31b8320042225d.hot-update.js", + "/chunks/plan-create.10175274588db9492215.hot-update.js": "/chunks/plan-create.10175274588db9492215.hot-update.js", + "/chunks/plan-create.0ba1efc4954d64d82927.hot-update.js": "/chunks/plan-create.0ba1efc4954d64d82927.hot-update.js", + "/chunks/plan-create.ee7c846ba10512495042.hot-update.js": "/chunks/plan-create.ee7c846ba10512495042.hot-update.js", + "/chunks/plan-create.464dec7d2b1a20e48088.hot-update.js": "/chunks/plan-create.464dec7d2b1a20e48088.hot-update.js", + "/chunks/plan-create.f6aea5862e8f553966a6.hot-update.js": "/chunks/plan-create.f6aea5862e8f553966a6.hot-update.js", + "/chunks/plan-create.85971684acc1d8711c33.hot-update.js": "/chunks/plan-create.85971684acc1d8711c33.hot-update.js", + "/chunks/plan-create.76a73fed548eed336d05.hot-update.js": "/chunks/plan-create.76a73fed548eed336d05.hot-update.js", + "/chunks/plan-create.d4cbd302ac338d5e442f.hot-update.js": "/chunks/plan-create.d4cbd302ac338d5e442f.hot-update.js", + "/chunks/plan-create.76276d97bc81b9a20e3b.hot-update.js": "/chunks/plan-create.76276d97bc81b9a20e3b.hot-update.js", + "/chunks/plan-create.e6cccdfcb666fb9adbb5.hot-update.js": "/chunks/plan-create.e6cccdfcb666fb9adbb5.hot-update.js", + "/js/main.6b2170fcadb2927f399d.hot-update.js": "/js/main.6b2170fcadb2927f399d.hot-update.js", + "/js/main.e7e84aa4aa6d213c861e.hot-update.js": "/js/main.e7e84aa4aa6d213c861e.hot-update.js", + "/chunks/plan-settings.8198dff8e2b753b56fc9.hot-update.js": "/chunks/plan-settings.8198dff8e2b753b56fc9.hot-update.js", + "/js/main.739ab5364a95dc1828c0.hot-update.js": "/js/main.739ab5364a95dc1828c0.hot-update.js", + "/js/main.1dbf463022c37e8abbb1.hot-update.js": "/js/main.1dbf463022c37e8abbb1.hot-update.js", + "/chunks/plan-settings.6e731202f78b0ff2fc43.hot-update.js": "/chunks/plan-settings.6e731202f78b0ff2fc43.hot-update.js", + "/chunks/plan-settings.054bc973fbddae38ae65.hot-update.js": "/chunks/plan-settings.054bc973fbddae38ae65.hot-update.js", + "/chunks/plan-settings.694f37c5569dff000d0e.hot-update.js": "/chunks/plan-settings.694f37c5569dff000d0e.hot-update.js", + "/chunks/plan-settings.f1c56ae4bfeda0475c1c.hot-update.js": "/chunks/plan-settings.f1c56ae4bfeda0475c1c.hot-update.js", + "/js/main.bd857d3176a2a454e300.hot-update.js": "/js/main.bd857d3176a2a454e300.hot-update.js", + "/chunks/plan-settings.df3f955f56f5a1b309c3.hot-update.js": "/chunks/plan-settings.df3f955f56f5a1b309c3.hot-update.js", + "/chunks/plan-settings.f60d9630351de71c009e.hot-update.js": "/chunks/plan-settings.f60d9630351de71c009e.hot-update.js", + "/chunks/plan-settings.08cf008f99dc2668eefa.hot-update.js": "/chunks/plan-settings.08cf008f99dc2668eefa.hot-update.js" } diff --git a/resources/js/helpers/functionHelpers.js b/resources/js/helpers/functionHelpers.js index 19ebfccf..1561b77c 100644 --- a/resources/js/helpers/functionHelpers.js +++ b/resources/js/helpers/functionHelpers.js @@ -20,6 +20,22 @@ const FunctionHelpers = { }) }, 150) + Vue.prototype.$updateInput = debounce(function (route, name, value, allowEmpty = false) { + + if ((value === '' || value === ' ' || typeof value === 'object') && !allowEmpty) return + + axios.post(this.$store.getters.api + route, { + [name]: value, + _method: 'patch' + }) + .catch(() => { + events.$emit('alert:open', { + title: this.$t('popup_error.title'), + message: this.$t('popup_error.message'), + }) + }) + }, 150) + Vue.prototype.$updateImage = function (route, name, image) { // Create form diff --git a/resources/js/store/modules/app.js b/resources/js/store/modules/app.js index 098e8b04..33e61f58 100644 --- a/resources/js/store/modules/app.js +++ b/resources/js/store/modules/app.js @@ -302,6 +302,16 @@ const defaultState = { value: 168, }, ], + intervalList: [ + { + label: 'Monthly', + value: 'month', + }, + { + label: 'Annually', + value: 'year', + }, + ], currencyList: [ { label: 'USD - United States Dollar', @@ -1063,6 +1073,7 @@ const getters = { expirationList: state => state.expirationList, requestedPlan: state => state.requestedPlan, currencyList: state => state.currencyList, + intervalList: state => state.intervalList, countries: state => state.countries, timezones: state => state.timezones, api: state => state.config.api, diff --git a/resources/js/views/Admin/Plans/PlanCreate.vue b/resources/js/views/Admin/Plans/PlanCreate.vue index 891e5ed2..5cff9f9d 100644 --- a/resources/js/views/Admin/Plans/PlanCreate.vue +++ b/resources/js/views/Admin/Plans/PlanCreate.vue @@ -1,180 +1,187 @@ - - diff --git a/resources/js/views/Admin/Plans/PlanTabs/PlanSettings.vue b/resources/js/views/Admin/Plans/PlanTabs/PlanSettings.vue index 27794679..fd61234c 100644 --- a/resources/js/views/Admin/Plans/PlanTabs/PlanSettings.vue +++ b/resources/js/views/Admin/Plans/PlanTabs/PlanSettings.vue @@ -7,17 +7,17 @@ - + - + - + @@ -31,12 +31,12 @@ - + - + diff --git a/src/Domain/SetupWizard/Controllers/StorePlansController.php b/src/Domain/SetupWizard/Controllers/StorePlansController.php index f9b1d928..15894f42 100644 --- a/src/Domain/SetupWizard/Controllers/StorePlansController.php +++ b/src/Domain/SetupWizard/Controllers/StorePlansController.php @@ -3,7 +3,6 @@ namespace Domain\SetupWizard\Controllers; use Illuminate\Http\Response; use App\Http\Controllers\Controller; -use Domain\Subscriptions\Services\StripeService; use Domain\SetupWizard\Requests\StoreStripePlansRequest; /** @@ -11,10 +10,6 @@ use Domain\SetupWizard\Requests\StoreStripePlansRequest; */ class StorePlansController extends Controller { - public function __construct( - public StripeService $stripe, - ) { - } public function __invoke( StoreStripePlansRequest $request