Commit 0a773156 authored by TTS Kieu Tuan Anh's avatar TTS Kieu Tuan Anh

Merge branch 'feature/manage-categories' of...

Merge branch 'feature/manage-categories' of https://gitlab.kiaisoft.com/kiaisoft.anh.tran2/kiaisoft_tuananh_nuxt into feature/manage-products
parents 0255b1f3 5d98f35a
<template> <template>
<svg class="nuxt-logo" viewBox="0 0 45 30" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg
<path d="M24.7203 29.704H41.1008C41.6211 29.7041 42.1322 29.5669 42.5828 29.3061C43.0334 29.0454 43.4075 28.6704 43.6675 28.2188C43.9275 27.7672 44.0643 27.2549 44.0641 26.7335C44.0639 26.2121 43.9266 25.6999 43.6662 25.2485L32.6655 6.15312C32.4055 5.70162 32.0315 5.32667 31.581 5.06598C31.1305 4.8053 30.6195 4.66805 30.0994 4.66805C29.5792 4.66805 29.0682 4.8053 28.6177 5.06598C28.1672 5.32667 27.7932 5.70162 27.5332 6.15312L24.7203 11.039L19.2208 1.48485C18.9606 1.03338 18.5864 0.658493 18.1358 0.397853C17.6852 0.137213 17.1741 0 16.6538 0C16.1336 0 15.6225 0.137213 15.1719 0.397853C14.7213 0.658493 14.3471 1.03338 14.0868 1.48485L0.397874 25.2485C0.137452 25.6999 0.000226653 26.2121 2.8053e-07 26.7335C-0.000226092 27.2549 0.136554 27.7672 0.396584 28.2188C0.656614 28.6704 1.03072 29.0454 1.48129 29.3061C1.93185 29.5669 2.44298 29.7041 2.96326 29.704H13.2456C17.3195 29.704 20.3239 27.9106 22.3912 24.4118L27.4102 15.7008L30.0986 11.039L38.1667 25.0422H27.4102L24.7203 29.704ZM13.0779 25.0374L5.9022 25.0358L16.6586 6.36589L22.0257 15.7008L18.4322 21.9401C17.0593 24.2103 15.4996 25.0374 13.0779 25.0374Z" fill="#00DC82" /> class="nuxt-logo"
viewBox="0 0 45 30"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M24.7203 29.704H41.1008C41.6211 29.7041 42.1322 29.5669 42.5828 29.3061C43.0334 29.0454 43.4075 28.6704 43.6675 28.2188C43.9275 27.7672 44.0643 27.2549 44.0641 26.7335C44.0639 26.2121 43.9266 25.6999 43.6662 25.2485L32.6655 6.15312C32.4055 5.70162 32.0315 5.32667 31.581 5.06598C31.1305 4.8053 30.6195 4.66805 30.0994 4.66805C29.5792 4.66805 29.0682 4.8053 28.6177 5.06598C28.1672 5.32667 27.7932 5.70162 27.5332 6.15312L24.7203 11.039L19.2208 1.48485C18.9606 1.03338 18.5864 0.658493 18.1358 0.397853C17.6852 0.137213 17.1741 0 16.6538 0C16.1336 0 15.6225 0.137213 15.1719 0.397853C14.7213 0.658493 14.3471 1.03338 14.0868 1.48485L0.397874 25.2485C0.137452 25.6999 0.000226653 26.2121 2.8053e-07 26.7335C-0.000226092 27.2549 0.136554 27.7672 0.396584 28.2188C0.656614 28.6704 1.03072 29.0454 1.48129 29.3061C1.93185 29.5669 2.44298 29.7041 2.96326 29.704H13.2456C17.3195 29.704 20.3239 27.9106 22.3912 24.4118L27.4102 15.7008L30.0986 11.039L38.1667 25.0422H27.4102L24.7203 29.704ZM13.0779 25.0374L5.9022 25.0358L16.6586 6.36589L22.0257 15.7008L18.4322 21.9401C17.0593 24.2103 15.4996 25.0374 13.0779 25.0374Z"
fill="#00DC82"
/>
</svg> </svg>
</template> </template>
......
<template> <template>
<v-card <v-card class="mx-auto" height="400" width="256">
class="mx-auto" <v-navigation-drawer class="deep-purple accent-4" dark permanent>
height="400"
width="256"
>
<v-navigation-drawer
class="deep-purple accent-4"
dark
permanent
>
<v-list> <v-list>
<v-list-item <v-list-item v-for="item in items" :key="item.title" link>
v-for="item in items"
:key="item.title"
link
>
<v-list-item-icon> <v-list-item-icon>
<v-icon>{{ item.icon }}</v-icon> <v-icon>{{ item.icon }}</v-icon>
</v-list-item-icon> </v-list-item-icon>
...@@ -27,27 +15,24 @@ ...@@ -27,27 +15,24 @@
<template v-slot:append> <template v-slot:append>
<div class="pa-2"> <div class="pa-2">
<v-btn block> <v-btn block> Logout </v-btn>
Logout
</v-btn>
</div> </div>
</template> </template>
</v-navigation-drawer> </v-navigation-drawer>
</v-card> </v-card>
</template>
</template> <script>
export default {
<script>
export default {
name: "navigation", name: "navigation",
data () { data() {
return { return {
items: [ items: [
{ title: 'Dashboard', icon: 'mdi-view-dashboard' }, { title: "Dashboard", icon: "mdi-view-dashboard" },
{ title: 'Account', icon: 'mdi-account-box' }, { title: "Account", icon: "mdi-account-box" },
{ title: 'Admin', icon: 'mdi-gavel' }, { title: "Admin", icon: "mdi-gavel" },
], ],
} };
}, },
} };
</script> </script>
...@@ -11,36 +11,39 @@ ...@@ -11,36 +11,39 @@
> >
<div class="px-3 py-2"> <div class="px-3 py-2">
<b-form-group label="Backdrop variant" label-for="backdrop-variant"> <b-form-group label="Backdrop variant" label-for="backdrop-variant">
<b-form-select id="backdrop-variant" v-model="variant" :options="variants"></b-form-select> <b-form-select
id="backdrop-variant"
v-model="variant"
:options="variants"
></b-form-select>
</b-form-group> </b-form-group>
</div> </div>
</b-sidebar> </b-sidebar>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: "sidebar", name: "sidebar",
}; };
</script> </script>
<script> <script>
export default { export default {
data() { data() {
return { return {
variant: 'dark', variant: "dark",
variants: [ variants: [
'transparent', "transparent",
'white', "white",
'light', "light",
'dark', "dark",
'primary', "primary",
'secondary', "secondary",
'success', "success",
'danger', "danger",
'warning', "warning",
'info', "info",
] ],
} };
} },
} };
</script> </script>
\ No newline at end of file
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
placeholder="Parent ID" placeholder="Parent ID"
v-model="parent_id" v-model="parent_id"
/> />
<label>Ordering :</label> <label>Ordering :</label>
<input <input
type="text" type="text"
...@@ -47,7 +46,6 @@ ...@@ -47,7 +46,6 @@
placeholder="Choose a image or drop it here..." placeholder="Choose a image or drop it here..."
drop-placeholder="Drop file here..." drop-placeholder="Drop file here..."
></b-form-file> ></b-form-file>
</form> </form>
</p> </p>
<template #modal-footer> <template #modal-footer>
...@@ -75,7 +73,6 @@ ...@@ -75,7 +73,6 @@
placeholder="Parent ID" placeholder="Parent ID"
v-model="eParent_id" v-model="eParent_id"
/> />
<label>Ordering :</label> <label>Ordering :</label>
<input <input
type="text" type="text"
...@@ -91,7 +88,6 @@ ...@@ -91,7 +88,6 @@
placeholder="Choose a image or drop it here..." placeholder="Choose a image or drop it here..."
drop-placeholder="Drop file here..." drop-placeholder="Drop file here..."
></b-form-file> ></b-form-file>
</form> </form>
</p> </p>
<template #modal-footer> <template #modal-footer>
...@@ -100,7 +96,6 @@ ...@@ -100,7 +96,6 @@
</template> </template>
</b-modal> </b-modal>
<div> <div>
<v-data-table <v-data-table
:headers="headers" :headers="headers"
:items="categories" :items="categories"
...@@ -119,7 +114,6 @@ ...@@ -119,7 +114,6 @@
<v-card-title> <v-card-title>
<span class="text-h5">{{ formTitle }}</span> <span class="text-h5">{{ formTitle }}</span>
</v-card-title> </v-card-title>
<v-card-text> <v-card-text>
<v-container> <v-container>
<v-row> <v-row>
...@@ -156,7 +150,6 @@ ...@@ -156,7 +150,6 @@
</v-row> </v-row>
</v-container> </v-container>
</v-card-text> </v-card-text>
<v-card-actions> <v-card-actions>
<v-spacer></v-spacer> <v-spacer></v-spacer>
<v-btn color="blue darken-1" text @click="close"> <v-btn color="blue darken-1" text @click="close">
...@@ -194,13 +187,7 @@ ...@@ -194,13 +187,7 @@
</template> </template>
</v-data-table> </v-data-table>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import Nav from "@/components/Nav"; import Nav from "@/components/Nav";
...@@ -215,7 +202,6 @@ export default { ...@@ -215,7 +202,6 @@ export default {
components: { Navigation }, components: { Navigation },
components: { notification }, components: { notification },
middleware: ["web"], middleware: ["web"],
data: () => { data: () => {
return { return {
parent_id:'', parent_id:'',
...@@ -255,7 +241,6 @@ export default { ...@@ -255,7 +241,6 @@ export default {
status: "", status: "",
created_at: "", created_at: "",
updated_at: "", updated_at: "",
}, },
defaultItem: { defaultItem: {
name: "", name: "",
...@@ -369,10 +354,8 @@ export default { ...@@ -369,10 +354,8 @@ export default {
this.image = file; this.image = file;
console.log(file) console.log(file)
console.log(this.image) console.log(this.image)
}, },
deleteCategory(ID,index) { deleteCategory(ID,index) {
const self = this;
this.editedIndex = this.categories.indexOf(index); this.editedIndex = this.categories.indexOf(index);
if(confirm("Do you really want to delete?")){ if(confirm("Do you really want to delete?")){
try{ try{
...@@ -380,7 +363,7 @@ export default { ...@@ -380,7 +363,7 @@ export default {
.delete(`http://127.0.0.1:8000/api/categories/${ID}`) .delete(`http://127.0.0.1:8000/api/categories/${ID}`)
.then(response => { .then(response => {
this.categories.splice(this.editedIndex, 1); this.categories.splice(this.editedIndex, 1);
self.$toast.success('Deleted successfully!',{ self.$toast.success('Category deleted successfully!',{
duration: 3000 duration: 3000
}); });
}) })
...@@ -388,7 +371,6 @@ export default { ...@@ -388,7 +371,6 @@ export default {
console.log(error) console.log(error)
} }
} }
}, },
getID(item) { getID(item) {
console.log(this.categories.indexOf(item)) console.log(this.categories.indexOf(item))
...@@ -426,9 +408,6 @@ export default { ...@@ -426,9 +408,6 @@ export default {
console.log(error) console.log(error)
} }
} }
}, },
}; };
</script> </script>
\ No newline at end of file
<template> <template>
<div> <div>
<div> <div>
<h1 style="text-align: center">HOME</h1> <h1 style="text-align: center">HOME</h1>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { onMounted } from "vue"; import { onMounted } from "vue";
import axios from "axios"; import axios from "axios";
import VueAxios from "vue-axios"; import VueAxios from "vue-axios";
import Nav from "@/components/Nav"; import Nav from "@/components/Nav";
export default { export default {
layout: "admin", layout: "admin",
components: { Nav }, components: { Nav },
middleware: ['web'], middleware: ['web'],
}; };
</script> </script>
<style></style> <style></style>
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
v-model="email" v-model="email"
required required
/> />
<label>Password :</label> <label>Password :</label>
<input <input
type="password" type="password"
...@@ -43,7 +42,6 @@ ...@@ -43,7 +42,6 @@
v-model="password" v-model="password"
required required
/> />
</form> </form>
</p> </p>
<template #modal-footer> <template #modal-footer>
...@@ -73,7 +71,6 @@ ...@@ -73,7 +71,6 @@
v-model="eEmail" v-model="eEmail"
required required
/> />
<label>Password :</label> <label>Password :</label>
<input <input
type="password" type="password"
...@@ -194,7 +191,6 @@ ...@@ -194,7 +191,6 @@
</template> </template>
</v-data-table> </v-data-table>
</div> </div>
</template> </template>
<script> <script>
import Nav from "@/components/Nav"; import Nav from "@/components/Nav";
...@@ -210,7 +206,6 @@ export default { ...@@ -210,7 +206,6 @@ export default {
components: { Navigation }, components: { Navigation },
components: { notification }, components: { notification },
middleware: ["web"], middleware: ["web"],
data: () => { data: () => {
return { return {
email:'', email:'',
...@@ -350,7 +345,6 @@ export default { ...@@ -350,7 +345,6 @@ export default {
duration: 3000 duration: 3000
}); });
}); });
}, },
deleteUser(userID, index) { deleteUser(userID, index) {
this.editedIndex = this.users.indexOf(index); this.editedIndex = this.users.indexOf(index);
...@@ -365,9 +359,7 @@ export default { ...@@ -365,9 +359,7 @@ export default {
console.log(error) console.log(error)
} }
} }
}, },
editUser(userID) { editUser(userID) {
this.$bvModal.show('modal-edit'); this.$bvModal.show('modal-edit');
this.eID = userID; this.eID = userID;
...@@ -395,8 +387,6 @@ export default { ...@@ -395,8 +387,6 @@ export default {
console.log(error) console.log(error)
} }
} }
}, },
}; };
</script> </script>
...@@ -118,21 +118,17 @@ export default { ...@@ -118,21 +118,17 @@ export default {
this.$router.push("/"); this.$router.push("/");
} }
}, },
checkForm: function (e) { checkForm: function (e) {
if (this.name && this.age) { if (this.name && this.age) {
return true; return true;
} }
this.errors = []; this.errors = [];
if (!this.name) { if (!this.name) {
this.errors.push("Name required."); this.errors.push("Name required.");
} }
if (!this.age) { if (!this.age) {
this.errors.push("Age required."); this.errors.push("Age required.");
} }
e.preventDefault(); e.preventDefault();
}, },
}, },
......
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