Commit c8b6574d authored by Le Dinh Trung's avatar Le Dinh Trung

Merge branch 'feature/manage-products' into 'dev'

Feature/manage products

See merge request !6
parents c2d2891c 1203f91e
<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>
......@@ -25,7 +25,7 @@
/>
<label>Parent :</label>
<b-form-select v-model="parent_id">
<option v-for="item in categories" :value="item.id">
<option v-for="item in categories" :value="item.id" v-if="item.parent_id == null">
{{item.name}}
</option>
</b-form-select>
......@@ -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 {
......@@ -358,7 +354,6 @@ export default {
console.log(this.image)
},
deleteCategory(ID,index) {
const self = this
this.editedIndex = this.categories.indexOf(index);
if(confirm("Do you really want to delete?")){
try{
......
This diff is collapsed.
......@@ -183,8 +183,8 @@
</v-toolbar>
</template>
<template v-slot:item.actions="{ item }">
<v-icon small class="mr-2" @click=" editUser(item.id);" :id ="item.id"> mdi-pencil </v-icon>
<v-icon small @click="deleteUser(item.id)" :id ="item.id"> mdi-delete </v-icon>
<v-icon small class="mr-2" @click=" editUser(item);" :id ="item.id"> mdi-pencil </v-icon>
<v-icon small @click="deleteUser(item.id, item)" :id ="item.id"> mdi-delete </v-icon>
</template>
<template v-slot:no-data>
<v-btn color="primary" @click="initialize"> Reset </v-btn>
......@@ -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 {
......@@ -223,7 +219,7 @@ export default {
},
{ text: "id", value: "id" },
{ text: "email", value: "email" },
{ text: "status", value: "status", sortable: false },
{ text: "status", value: "id", sortable: false },
{ text: "created_at", value: "created_at" },
{ text: "updated_at", value: "updated_at" },
{ text: 'Actions', value: 'actions', sortable: false },
......@@ -346,19 +342,25 @@ export default {
});
});
},
deleteUser(userID) {
deleteUser(userID, index) {
this.editedIndex = this.users.indexOf(index);
if(confirm("Do you really want to delete?")){
try{
axios
.delete(`http://127.0.0.1:8000/api/users/${userID}`)
.then(response => {
this.users.splice(this.editedIndex, 1);
})
} catch(error){
console.log(error)
}
}
},
editUser(userID) {
editUser(user) {
this.$bvModal.show('modal-edit');
this.eID = userID;
this.eID = user.id;
this.eEmail = user.email;
this.eName = user.name;
console.log(this?.eID);
},
updateUser(userID) {
......
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