|
@ -4,6 +4,7 @@ |
|
|
<div class="q-ma-none text-h3 text-weight-bolder row" :class="{'text-faded': !item.name}"> |
|
|
<div class="q-ma-none text-h3 text-weight-bolder row" :class="{'text-faded': !item.name}"> |
|
|
<span class="q-mr-md">{{ item.name || '---- -- ----' }}</span> |
|
|
<span class="q-mr-md">{{ item.name || '---- -- ----' }}</span> |
|
|
<q-chip square size="lg" class="text-white q-mr-md" color="secondary">{{item.ref}}</q-chip> |
|
|
<q-chip square size="lg" class="text-white q-mr-md" color="secondary">{{item.ref}}</q-chip> |
|
|
|
|
|
<q-chip square outline size="lg" class="q-mr-md" color="secondary">{{item.short_id}}</q-chip> |
|
|
<q-chip square size="lg" v-if="item.deleted" color="red">Supprimé</q-chip> |
|
|
<q-chip square size="lg" v-if="item.deleted" color="red">Supprimé</q-chip> |
|
|
</div> |
|
|
</div> |
|
|
<h5 class="q-ma-none q-pb-md text-grey">{{item.type}}</h5> |
|
|
<h5 class="q-ma-none q-pb-md text-grey">{{item.type}}</h5> |
|
@ -151,7 +152,17 @@ |
|
|
</q-item-section> |
|
|
</q-item-section> |
|
|
<q-item-section> |
|
|
<q-item-section> |
|
|
<q-item-label lines="3" v-html="event.text.split('\n').join('</br>')"></q-item-label> |
|
|
<q-item-label lines="3" v-html="event.text.split('\n').join('</br>')"></q-item-label> |
|
|
<q-item-label caption><span class="text-capitalize">{{ event.user }}</span></q-item-label> |
|
|
<q-item-label caption> |
|
|
|
|
|
<q-icon name="task" class="q-mr-sm" size="xs" |
|
|
|
|
|
v-if="event.type === 'issue'" |
|
|
|
|
|
:color="event.solved_at ? 'green' : 'grey'" |
|
|
|
|
|
/> |
|
|
|
|
|
<span class="text-capitalize">{{ event.user }}</span> |
|
|
|
|
|
<template v-if="event.solved_at"> |
|
|
|
|
|
<q-icon name="arrow_right" size="sm"/> |
|
|
|
|
|
fait par <span class="text-capitalize">{{ event.solved_by }}</span> le {{getDate(event.solved_at)}} |
|
|
|
|
|
</template> |
|
|
|
|
|
</q-item-label> |
|
|
</q-item-section> |
|
|
</q-item-section> |
|
|
<q-item-section side top> |
|
|
<q-item-section side top> |
|
|
<q-item-label caption>{{ getDate(event.created) }}</q-item-label> |
|
|
<q-item-label caption>{{ getDate(event.created) }}</q-item-label> |
|
@ -178,6 +189,11 @@ |
|
|
color="secondary" |
|
|
color="secondary" |
|
|
/> |
|
|
/> |
|
|
<br/> |
|
|
<br/> |
|
|
|
|
|
<q-btn-group outline spread> |
|
|
|
|
|
<q-btn :outline="pendingHistoryType !== 'comment'" color="secondary" label="Info" icon="info" @click="pendingHistoryType = 'comment'"/> |
|
|
|
|
|
<q-btn :outline="pendingHistoryType !== 'issue'" color="secondary" label="Tâche" icon="task" @click="pendingHistoryType = 'issue'"/> |
|
|
|
|
|
</q-btn-group> |
|
|
|
|
|
<br/> |
|
|
<q-uploader |
|
|
<q-uploader |
|
|
:accept="'.jpg,.png'" |
|
|
:accept="'.jpg,.png'" |
|
|
:factory="uploadFile" |
|
|
:factory="uploadFile" |
|
@ -214,6 +230,10 @@ |
|
|
<span>{{ getDate(selectedHistory.created) }}</span> |
|
|
<span>{{ getDate(selectedHistory.created) }}</span> |
|
|
</div> |
|
|
</div> |
|
|
</q-card-section> |
|
|
</q-card-section> |
|
|
|
|
|
<q-card-section> |
|
|
|
|
|
<q-btn outline color="secondary" label="Marquer comme terminé" @click="setTaskDone(selectedHistory)"></q-btn> |
|
|
|
|
|
</q-card-section> |
|
|
|
|
|
<q-separator/> |
|
|
<q-card-actions align="right"> |
|
|
<q-card-actions align="right"> |
|
|
<q-btn flat color="red" @click.stop="removeHistory(selectedHistory)">Supprimer</q-btn> |
|
|
<q-btn flat color="red" @click.stop="removeHistory(selectedHistory)">Supprimer</q-btn> |
|
|
<q-btn flat color="grey" @click.stop="showHistory = false;selectedHistory = null">Fermer</q-btn> |
|
|
<q-btn flat color="grey" @click.stop="showHistory = false;selectedHistory = null">Fermer</q-btn> |
|
@ -231,11 +251,12 @@ import QRCode from 'qrcode' |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
name: 'StockItem', |
|
|
name: 'StockItem', |
|
|
props: ['itemRef'], |
|
|
props: ['itemRef', 'shortId'], |
|
|
data () { |
|
|
data () { |
|
|
return { |
|
|
return { |
|
|
showHistoryForm: false, |
|
|
showHistoryForm: false, |
|
|
pendingHistory: null, |
|
|
pendingHistory: null, |
|
|
|
|
|
pendingHistoryType: 'comment', |
|
|
changed: false, |
|
|
changed: false, |
|
|
hasFile: false, |
|
|
hasFile: false, |
|
|
username: null, |
|
|
username: null, |
|
@ -272,7 +293,20 @@ export default { |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
created: function () { |
|
|
created: function () { |
|
|
|
|
|
if (this.shortId) { |
|
|
|
|
|
let itemRef = this.stock.find(item => { |
|
|
|
|
|
return item.short_id === parseInt(this.shortId) |
|
|
|
|
|
})?.ref |
|
|
|
|
|
console.log('Redirecting to item with ref:', itemRef) |
|
|
|
|
|
if (itemRef) this.$router.push(`/item/${itemRef}`) |
|
|
|
|
|
} |
|
|
this.loadItem() |
|
|
this.loadItem() |
|
|
|
|
|
this.$watch( |
|
|
|
|
|
() => this.itemRef, |
|
|
|
|
|
(newId, oldId) => { |
|
|
|
|
|
this.loadItem() |
|
|
|
|
|
} |
|
|
|
|
|
) |
|
|
}, |
|
|
}, |
|
|
mounted () { |
|
|
mounted () { |
|
|
this.username = this.$q.localStorage.getItem('username') |
|
|
this.username = this.$q.localStorage.getItem('username') |
|
@ -296,6 +330,7 @@ export default { |
|
|
data: { |
|
|
data: { |
|
|
ref: this.itemRef, |
|
|
ref: this.itemRef, |
|
|
text: this.pendingHistory, |
|
|
text: this.pendingHistory, |
|
|
|
|
|
type: this.pendingHistoryType, |
|
|
user: this.$store.state.core.username, |
|
|
user: this.$store.state.core.username, |
|
|
image_file: file, |
|
|
image_file: file, |
|
|
date: date.toISOString() |
|
|
date: date.toISOString() |
|
@ -351,6 +386,17 @@ export default { |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
setTaskDone (history) { |
|
|
|
|
|
this.$store.dispatch('core/updateItem', { |
|
|
|
|
|
collection: 'history', |
|
|
|
|
|
itemId: history.id, |
|
|
|
|
|
data: { |
|
|
|
|
|
...history, |
|
|
|
|
|
solved_at: new Date().toISOString(), |
|
|
|
|
|
solved_by: this.username |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
async uploadFile (file) { |
|
|
async uploadFile (file) { |
|
|
// Resize and compress the image before uploading |
|
|
// Resize and compress the image before uploading |
|
|
const options = { |
|
|
const options = { |
|
|