Many fixes n stuff

This commit is contained in:
mcarquigny
2025-03-20 16:47:26 +01:00
parent 12086a4c88
commit 56a251b929
5 changed files with 106 additions and 68 deletions

View File

@ -3,19 +3,18 @@
<q-chip class="float-right text-white" color="secondary">{{item.ref}}</q-chip>
<q-chip v-if="item.deleted" class="float-right q-mr-md" color="red">Supprimé</q-chip>
<h2 class="q-ma-none" :class="{'text-faded': !item.name}">{{item.name || '---- -- ----'}}</h2>
<h4 class="q-ma-none q-pb-md text-light">{{item.type}}</h4>
<h4 class="q-ma-none q-pb-md text-grey">{{item.type}}</h4>
<div class="q-py-md">
<q-input v-model="item.name"
:disable="item.deleted"
type="text"
standout
outlined color="secondary"
stack-label label="Nom" class="q-mb-md"
@input="changed = true"/>
@update:model-value="changed = true"/>
<q-input v-model="item.owner"
:disable="item.deleted"
color="secondary"
standout stack-label label="Propriétaire" class="q-mb-md"
outlined color="secondary" stack-label label="Propriétaire" class="q-mb-md"
@input="changed = true"/>
<q-field borderless stack-label label="Etat cosmétique" class="q-mb-md">
<q-btn-toggle
@ -41,6 +40,7 @@
:disable="item.deleted"
v-model="item.working"
:toggle-color="item.working ? 'green' : 'red'"
text-color="black"
:options="[
{label: '✔', value: true},
{label: '?', value: null},
@ -55,6 +55,7 @@
:disable="item.deleted"
v-model="item.available"
:toggle-color="item.available ? 'green' : 'red'"
text-color="black"
:options="[
{label: '✔', value: true},
{label: '✘', value: false}
@ -67,6 +68,7 @@
no-caps
v-model="item.deleted"
:toggle-color="item.deleted ? 'green' : 'red'"
text-color="black"
:options="[
{label: 'Oui', value: true},
{label: 'Non', value: false}
@ -81,7 +83,7 @@
type="textarea"
:max-height="100"
rows="4"
standout stack-label label="Commentaire" class="q-mb-md"
outlined color="secondary" stack-label label="Commentaire" class="q-mb-md"
inverted
/>
<q-btn :disabled="!changed || originalItem.deleted"
@ -139,8 +141,8 @@
</q-timeline-entry>
<q-timeline-entry
v-for="event in history.slice().reverse()"
:key="event.timestamp"
:subtitle="getDate(event.timestamp)"
:key="event.created"
:subtitle="getDate(event.created)"
:title="event.user"
side="left"
>
@ -216,10 +218,7 @@ export default {
}
},
created: function () {
let item = this.stock.find(item => {
return (item) ? item.ref === this.itemRef : false
}) || []
this.item = { ...item }
this.loadItem()
},
mounted () {
this.username = this.$q.localStorage.getItem('username')
@ -250,13 +249,15 @@ export default {
timestamp: this.pendingHistoryDate
}
}).then(response => {
// this.$speech(`ooo history desu, arigato !`)
this.showHistoryForm = false
this.pendingHistory = null
this.pendingHistoryDate = null
this.hasFile = false
this.$refs.uploader.reset()
this.$q.loading.hide()
this.$store.dispatch('core/loadAppData').then(_ => {
this.loadItem()
this.showHistoryForm = false
this.pendingHistory = null
this.pendingHistoryDate = null
this.hasFile = false
this.$refs.uploader.reset()
this.$q.loading.hide()
})
})
},
removeHistory (data) {
@ -265,11 +266,16 @@ export default {
message: "Il est possible que tu sois Meth, nous sommes donc légalement obligés de te demander : es-tu absolument sur d'être certain de vouloir effectuer cette action irréversible ?",
ok: 'Supprimer',
cancel: 'Annuler'
}).then(() => {
}).onOk(() => {
this.$store.dispatch('core/removeFromCollection', {
collection: 'history',
data
}).then(_ => this.$q.notify('Supprimé !'))
}).then(_ => {
this.$store.dispatch('core/loadAppData').then(_ => {
this.loadItem()
this.$q.notify('Supprimé !')
})
})
})
},
updateItem () {
@ -282,12 +288,13 @@ export default {
// this.$speech(`sugoï, domo arigato senpai !`)
this.$q.notify({
message: 'Enregistré !',
color: 'grey',
avatar: '~assets/gyoza_logo_nobg.png',
color: 'secondary',
avatar: '/gyoza_logo_nobg.png',
timeout: 2000
})
this.changed = false
this.$store.dispatch('core/loadAppData').then(_ => {
this.loadItem()
this.$q.loading.hide()
})
})
@ -299,6 +306,12 @@ export default {
},
getImageUrl (history, image) {
return this.$pb.files.getURL(history, image, { thumb: '300x300f' })
},
loadItem () {
let item = this.stock.find(item => {
return (item) ? item.ref === this.itemRef : false
}) || []
this.item = { ...item }
}
}
}