Commit fd2529b3 authored by TTS Kieu Tuan Anh's avatar TTS Kieu Tuan Anh

remove

parent e9fccad2
<template>
<v-card class="mx-auto" height="400" width="256">
<v-navigation-drawer class="deep-purple accent-4" dark permanent>
<v-list>
<v-list-item v-for="item in items" :key="item.title" link>
<v-list-item-icon>
<v-icon>{{ item.icon }}</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>{{ item.title }}</v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list>
<template v-slot:append>
<div class="pa-2">
<v-btn block> Logout </v-btn>
</div>
</template>
</v-navigation-drawer>
</v-card>
</template>
<script>
export default {
name: "navigation",
data() {
return {
items: [
{ title: "Dashboard", icon: "mdi-view-dashboard" },
{ title: "Account", icon: "mdi-account-box" },
{ title: "Admin", icon: "mdi-gavel" },
],
};
},
};
</script>
<template>
<div class="notification is-danger bg-danger">
{{ message }}
</div>
</template>
<style>
.notification {
padding: 11px;
margin: 10px 0px;
}
</style>
<script>
export default {
name: "Notification",
props: ["message"],
};
</script>
......@@ -191,16 +191,12 @@
</template>
<script>
import Nav from "@/components/Nav";
import Navigation from "@/components/Navigation";
import axios from "axios";
import notification from "@/components/Notification";
import { BootstrapVue, BootstrapVueIcons } from 'bootstrap-vue'
export default {
layout: 'admin',
components: { Nav },
components: { Navigation },
components: { notification },
middleware: ["web"],
data: () => {
return {
......
......@@ -22,7 +22,6 @@
v-model="name"
max="255"
min="1"
:state="nameState"
trim
>
</b-form-input>
......@@ -109,7 +108,7 @@
</div>
<template #modal-footer>
<button v-b-modal.modal-close_visit @click="$bvModal.hide('modal-create')" class="btn btn-danger btn-sm m-1">Close</button>
<button @click="getInfo(); createProduct();" v-b-modal.modal-close_visit class="btn btn-success btn-sm m-1">Submit</button>
<button @click="createProduct()" v-b-modal.modal-close_visit class="btn btn-success btn-sm m-1">Submit</button>
</template>
</b-modal>
<!-- modal-show -->
......@@ -132,7 +131,6 @@
size="sm"
disabled
/>
<label>Price :</label>
<input
type="text"
......@@ -213,7 +211,6 @@
{{item.name}}
</option>
</b-form-select>
<label>Price :</label>
<input
type="text"
......@@ -308,7 +305,7 @@
<template v-slot:item.actions="{ item }">
<v-icon small @click="editProduct(item)" :id ="item.id"> mdi-pencil </v-icon>
<v-icon small @click="deleteProduct(item.id,item)" :id ="item.id"> mdi-delete </v-icon>
<v-icon small @click="showProduct(item); " :id ="item.id"> mdi-account-details </v-icon>
<v-icon small @click="showProduct(item)" :id ="item.id"> mdi-account-details </v-icon>
</template>
<template v-slot:no-data>
<v-btn color="primary" @click="initialize"> Reset </v-btn>
......@@ -319,19 +316,14 @@
</template>
<script>
import CreateProductModal from "../../components/CreateProductModal";
import Nav from "@/components/Nav";
import Navigation from "@/components/Navigation";
import axios from "axios";
import notification from "@/components/Notification";
export default {
layout: 'admin',
name: "App",
components: {
CreateProductModal,
Nav,
Navigation,
},
middleware: ["web"],
data: () => {
......@@ -419,7 +411,7 @@ export default {
},
computed: {
formTitle() {
return this.editedIndex === -1 ? "New Item" : "Edit Item";
return this.editedIndex === -1 ? "New Item" : "Edit Item"
},
nameState() {
return this.name.length > 2 ? true : false
......@@ -427,23 +419,23 @@ export default {
},
watch: {
dialog(val) {
val || this.close();
val || this.close()
},
dialogDelete(val) {
val || this.closeDelete();
val || this.closeDelete()
},
},
created() {
this.initialize();
this.getProducts();
this.getCategories();
this.initialize(),
this.getProducts(),
this.getCategories()
},
methods: {
initialize() {
this.products= [];
this.product= [];
this.categories= [];
this.sName= '';
this.products= [],
this.product= [],
this.categories= [],
this.sName= '',
this.sCategoryId= '',
this.sPrice= '',
this.sDescription= '',
......@@ -459,9 +451,9 @@ export default {
];
},
editItem(item) {
this.editedIndex = this.products.indexOf(item);
this.editedItem = Object.assign({}, item);
this.dialog = true;
this.editedIndex = this.products.indexOf(item)
this.editedItem = Object.assign({}, item)
this.dialog = true
},
deleteItem(item) {
this.editedIndex = this.products.indexOf(item);
......@@ -470,20 +462,20 @@ export default {
},
deleteItemConfirm() {
this.products.splice(this.editedIndex, 1);
this.closeDelete();
this.closeDelete()
},
close() {
this.dialog = false;
this.dialog = false
this.$nextTick(() => {
this.editedItem = Object.assign({}, this.defaultItem);
this.editedIndex = -1;
this.editedItem = Object.assign({}, this.defaultItem)
this.editedIndex = -1
});
},
closeDelete() {
this.dialogDelete = false;
this.dialogDelete = false
this.$nextTick(() => {
this.editedItem = Object.assign({}, this.defaultItem);
this.editedIndex = -1;
this.editedIndex = -1
});
},
save() {
......@@ -492,7 +484,7 @@ export default {
} else {
this.products.push(this.editedItem);
}
this.close();
this.close()
},
getCategories() {
axios
......@@ -540,8 +532,8 @@ export default {
this.message = errors.response.data.message;
self.$toast.error('something went wrong while trying create!',{
duration: 3000
});
});
})
})
},
deleteProduct(ID,index) {
const self = this;
......@@ -562,7 +554,7 @@ export default {
}
},
async showProduct(item) {
const ID = item.id;
const ID = item.id
try {
const resp = await fetch(`http://127.0.0.1:8000/api/products/${ID}`, {
method: "GET",
......@@ -598,7 +590,7 @@ export default {
this.eVariants = item.variants
},
updateProduct(ID) {
const self = this;
const self = this
try{
axios
.post(`http://127.0.0.1:8000/api/products/update/${this?.eId}`,{
......@@ -639,19 +631,11 @@ export default {
});
},
remove(index) {
this.variants.splice(index, 1);
this.variants.splice(index, 1)
},
removeVariant(index) {
this.eVariants.splice(index, 1);
this.eVariants.splice(index, 1)
},
getInfo() {
console.log(this.name)
console.log(this.price)
console.log(this.category_id)
console.log(this.stock)
console.log(this.images)
console.log(this.variants)
}
},
};
</script>
......
......@@ -194,17 +194,13 @@
</template>
<script>
import Nav from "@/components/Nav";
import Navigation from "@/components/Navigation";
import axios from "axios";
import notification from "@/components/Notification";
import Toasted from 'vue-toasted';
import { ModalPlugin } from 'bootstrap-vue';
export default {
layout: "admin",
components: { Nav },
components: { Navigation },
components: { notification },
middleware: ["web"],
data: () => {
return {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment