diff --git a/src/components/AddProduct/Main.vue b/src/components/AddProduct/Main.vue index 0eee5cf..1d5c35f 100644 --- a/src/components/AddProduct/Main.vue +++ b/src/components/AddProduct/Main.vue @@ -7,36 +7,37 @@ backText="products" link="products" icon="WMi-left-open" - title="add a product" + :title="`${productId ? 'edit' : 'add'} a product`" subTitle="what we perpared for people" /> - - -
-
- + + + +
+
+ +
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- -
- please upload or drag & Drop
- product images here + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+ please upload or drag & Drop
+ product images here +
-
- - - - -
- -
- - + + + + +
+ +
+ + + + +
-
+
@@ -253,7 +257,7 @@ export default { computed: { ...mapGetters("productCategories", ["getProductCategories"]), ...mapGetters("products", ["getProduct"]), - ProductId() { + productId() { return this.$route.params.id; }, child() { @@ -271,21 +275,25 @@ export default { ...mapActions("products", ["addProduct", "updateProduct", "loadProduct"]), async submit() { try { - if (this.fileForm.media !== this.fileForm.media) { - let repository = new FileRepository(); - await repository.store(this.fileForm); - } - if (this.ProductId) { - this.updateProduct(this.form); - } else { - this.addProduct(this.form); + let valid = this.$refs.form.validate(); + console.log(valid); + if (valid) { + if (this.fileForm.media !== this.fileForm.media) { + let repository = new FileRepository(); + await repository.store(this.fileForm); + } + if (this.productId) { + this.updateProduct(this.form); + } else { + this.addProduct(this.form); + } } } catch (e) { return e; } }, async load() { - await this.loadProduct(this.ProductId); + await this.loadProduct(this.productId); this.form = this.getProduct; // this.changeProductCategories(); }, @@ -296,7 +304,7 @@ export default { }, async created() { await this.loadProductCategories(); - if (this.ProductId) { + if (this.productId) { this.load(); } }, diff --git a/src/components/Admin/Main.vue b/src/components/Admin/Main.vue index 5a26067..1ee5cf9 100644 --- a/src/components/Admin/Main.vue +++ b/src/components/Admin/Main.vue @@ -29,7 +29,7 @@
-
+
@@ -50,13 +50,13 @@ >
diff --git a/src/components/Global/Button/RectangleButton.vue b/src/components/Global/Button/RectangleButton.vue index 9a2d6fd..d44c1aa 100644 --- a/src/components/Global/Button/RectangleButton.vue +++ b/src/components/Global/Button/RectangleButton.vue @@ -6,6 +6,7 @@ x-small :width="width" :class="`color-${color} ${bgColor}`" + :type="type" >