From ebc08ce2d6e3c9aa2ddd0034785fed945d339b51 Mon Sep 17 00:00:00 2001 From: Thomas Mack Date: Sun, 3 Apr 2022 13:53:17 +0200 Subject: [PATCH] change id to key, save description --- src/App.vue | 22 ++- src/components/camera/CameraReadDetail.vue | 24 +++- .../parts/InventoryItemCollectionInfo.vue | 136 ++++++++++++++---- .../camera/parts/InventoryItemDescription.vue | 66 ++++++--- 4 files changed, 198 insertions(+), 50 deletions(-) diff --git a/src/App.vue b/src/App.vue index b4559c8..9bf7398 100644 --- a/src/App.vue +++ b/src/App.vue @@ -83,7 +83,6 @@ export default class App extends Vue {} } .billi-bg-transparent { - background-color: white; background-color: rgb(255 255 255 / 40%); } @@ -143,14 +142,16 @@ export default class App extends Vue {} .billi-box-header { padding:0.5rem; + border-radius: 0.5rem 0 0 0; grid-area: header; } .billi-box-icon { - padding-right: 0.5rem; + padding: 0.5rem; grid-area: icon; + border-radius: 0 0.5rem 0 0; align-self: center; - justify-self: end; + justify-self: stretch; } .billi-box-icon svg { @@ -158,7 +159,22 @@ export default class App extends Vue {} width: 2rem; } .billi-box-content { + padding: 1rem; grid-area: billi-ct } +.billi-box-content textarea { + width:100%; + +} + +.billi-row-50-50 { + display:grid; + grid-template-columns: 50% 50%; +} + +.billi-label { + font-weight: bold; +} + diff --git a/src/components/camera/CameraReadDetail.vue b/src/components/camera/CameraReadDetail.vue index 9e85eb7..fe9f03c 100644 --- a/src/components/camera/CameraReadDetail.vue +++ b/src/components/camera/CameraReadDetail.vue @@ -3,7 +3,7 @@ enter-active-class="animate__animated animate__fadeIn" mode="out-in" appear> - + @@ -17,10 +17,11 @@
+ - - + +
@@ -47,6 +48,12 @@ export default { type:Camera, required: true } + }, + data() { + return { + globalEdit: false, + newCamera: {}, + } }, computed: { ...mapGetters(["activeItem","getIconName"]), @@ -56,6 +63,17 @@ export default { editCamera() { this.$store.dispatch("setCameraEditState", {cameraId:this.activeCamera.id, edit:true}) }, + toggleEdit() { + this.globalEdit = !this.globalEdit; + if (this.globalEdit) { + this.newCamera = this.item; + } + }, + handleChangeEvent(value) { + console.log("handleChangedDescription" , value) + this.newCamera[value.field] = value.value.trim(); + console.log("newCamera", this.newCamera); + } } } diff --git a/src/components/camera/parts/InventoryItemCollectionInfo.vue b/src/components/camera/parts/InventoryItemCollectionInfo.vue index 5a16876..79f8377 100644 --- a/src/components/camera/parts/InventoryItemCollectionInfo.vue +++ b/src/components/camera/parts/InventoryItemCollectionInfo.vue @@ -1,59 +1,119 @@ diff --git a/src/components/camera/parts/InventoryItemDescription.vue b/src/components/camera/parts/InventoryItemDescription.vue index d6f3c57..9441bb6 100644 --- a/src/components/camera/parts/InventoryItemDescription.vue +++ b/src/components/camera/parts/InventoryItemDescription.vue @@ -1,27 +1,31 @@ @@ -34,18 +38,28 @@ export default { item: { type: InventoryItem, required: true - + }, + emits: { + changedDescription: (payload) => { + if(payload.field && payload.value) return true; + else return false; + } + }, + globalEdit: { + type: Boolean, + required: false, + default: false } }, data() { return { edit: false, - newItem: {id:"",description:"", work_done:""}, + newItem: {id:"",description:this.item.description, work_done:this.item.work_done}, } }, computed: { isEdit() { - return this.edit; + return this.edit || this.globalEdit; }, getIconName() { if (!this.edit) return "pen" @@ -60,9 +74,25 @@ export default { this.newItem.description = this.item.description; this.newItem.work_done = this.item.work_done; } else { - this.$store.dispatch("storeInventoryDescription", {key:this.newItem.key, description:this.newItem.description}); + + if(this.newItem.description.trim() != this.item.description) { + this.$store.dispatch("storeInventoryDescription", { + key: this.newItem.key, + description: this.newItem.description.trim() + }); + } } + }, + changeHandler(field) { + console.log("changeHanlder", field); + if(field === "description") { + console.log("changeHandler emitting"); + this.$emit("changedDescription", {field:'description', value: this.newItem.description}); + } else if(field === "work_done") { + console.log("changeHandler emitting"); + this.$emit("changedDescription", {field:'work_done', value: this.newItem.work_done}); + } } } }