- Создание нового компьютера
+
+ Создание нового компьютера
+
+
+
- Создать
+ Создать
diff --git a/resources/views/ComputersList.vue b/resources/views/ComputersList.vue
index 713bc51..505b337 100644
--- a/resources/views/ComputersList.vue
+++ b/resources/views/ComputersList.vue
@@ -4,7 +4,7 @@ import { useUserStore } from '../store/auth.js';
import {useComputersStore} from "../store/computers.js";
import CreateForm from './Computers/CreateForm.vue';
export default {
- name: "About",
+ name: "ComputersList",
components: {CreateForm},
data() {
return {
@@ -13,9 +13,12 @@ export default {
computerList: [],
createDialogShow: false,
editDialogShow: false,
+ deleteDialogShow: false,
fetching: false,
authenticated: false,
- editLoading: false
+ editLoading: false,
+ deleteLoading: false,
+ computerToDeleteId: null
};
},
methods: {
@@ -27,6 +30,19 @@ export default {
},
showEditDialog(){
this.editDialogShow = true;
+ },
+ showDeleteDialog(id){
+ this.deleteDialogShow = true;
+ this.computerToDeleteId = id;
+ },
+ hideDeleteDialog(){
+ this.deleteDialogShow = false;
+ },
+ deleteComputer(){
+ this.deleteLoading = true;
+ this.computersStore.delete(this.computerToDeleteId).then(()=>{
+ this.deleteLoading = false;
+ })
}
},
mounted() {
@@ -35,13 +51,19 @@ export default {
this.fetching = true;
this.authenticated = newStore.user !== null && newStore.user !== undefined;
this.computersStore.setToken(this.userStore.token);
- if (this.userStore.user['id']){
+ if (this.userStore.user !== null){
this.computersStore.getComputerList(this.userStore.user['id']).then(()=>{
this.computerList = this.computersStore.computers;
this.fetching = false;
})
}
});
+ watch(this.computersStore, (newStore)=>{
+ this.fetching = true;
+ this.computerList = this.computersStore.computers;
+ this.fetching = false;
+ this.hideDeleteDialog();
+ })
}
}
@@ -56,15 +78,19 @@ export default {
{{ computer['name'] }}
CPU: {{ computer['cpu'] }}
+ RAM: {{ computer['ram'] }}
Motherboard: {{ computer['motherboard'] }}
GPU: {{ computer['gpu'] }}
Дополнительная информация: {{ computer['additional_info'] }}
-
@@ -73,9 +99,21 @@ export default {
-
+
+
+
+
+ Вы уверены?
+ Это действие удалит компьютер и все действия связанные с ним
+
+ Да
+ Нет
+
+
+
+