|
@ -1,10 +1,12 @@ |
|
|
<template> |
|
|
<template> |
|
|
<q-page class="q-pa-md"> |
|
|
<q-page class="q-pa-md"> |
|
|
<q-btn @click="generateQRCode" class="float-right" icon="qr_code"></q-btn> |
|
|
<q-btn @click="generateQRCode" class="float-right" icon="qr_code"></q-btn> |
|
|
<q-chip class="float-right text-white" color="secondary">{{item.ref}}</q-chip> |
|
|
<div class="q-ma-none text-h3 text-weight-bolder row" :class="{'text-faded': !item.name}"> |
|
|
<q-chip v-if="item.deleted" class="float-right q-mr-md" color="red">Supprimé</q-chip> |
|
|
<span class="q-mr-md">{{ item.name || '---- -- ----' }}</span> |
|
|
<h2 class="q-ma-none text-weight-medium" :class="{'text-faded': !item.name}">{{item.name || '---- -- ----'}}</h2> |
|
|
<q-chip square size="lg" class="text-white q-mr-md" color="secondary">{{item.ref}}</q-chip> |
|
|
<h4 class="q-ma-none q-pb-md text-grey">{{item.type}}</h4> |
|
|
<q-chip square size="lg" v-if="item.deleted" color="red">Supprimé</q-chip> |
|
|
|
|
|
</div> |
|
|
|
|
|
<h5 class="q-ma-none q-pb-md text-grey">{{item.type}}</h5> |
|
|
|
|
|
|
|
|
<q-dialog v-model="showQr"> |
|
|
<q-dialog v-model="showQr"> |
|
|
<q-card style="width: 500px"> |
|
|
<q-card style="width: 500px"> |
|
@ -23,7 +25,14 @@ |
|
|
</q-card> |
|
|
</q-card> |
|
|
</q-dialog> |
|
|
</q-dialog> |
|
|
|
|
|
|
|
|
<div class="q-py-md"> |
|
|
<div class="row q-col-gutter-xl"> |
|
|
|
|
|
<div class="col-12 col-lg-6"> |
|
|
|
|
|
<div class="row"> |
|
|
|
|
|
<div class="col"> |
|
|
|
|
|
<h4 class="q-ma-none q-pb-md text-light">Informations</h4> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div> |
|
|
<q-input v-model="item.name" |
|
|
<q-input v-model="item.name" |
|
|
:disable="item.deleted" |
|
|
:disable="item.deleted" |
|
|
type="text" |
|
|
type="text" |
|
@ -116,27 +125,51 @@ |
|
|
:flat="!changed" |
|
|
:flat="!changed" |
|
|
>Enregistrer</q-btn> |
|
|
>Enregistrer</q-btn> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
</div> |
|
|
<br/> |
|
|
<div class="col-12 col-lg-6"> |
|
|
<br/> |
|
|
<div class="row"> |
|
|
|
|
|
<div class="col"> |
|
|
<h4 class="q-ma-none q-pb-md text-light">Historique</h4> |
|
|
<h4 class="q-ma-none q-pb-md text-light">Historique</h4> |
|
|
<q-timeline color="secondary"> |
|
|
</div> |
|
|
<!--<q-timeline-entry heading>--> |
|
|
<div class="col text-right"> |
|
|
<!--Historique--> |
|
|
<q-btn outline icon="add" label="ajouter une entrée" color="primary" @click="openHistoryForm()"></q-btn> |
|
|
<!--</q-timeline-entry>--> |
|
|
</div> |
|
|
<q-timeline-entry |
|
|
</div> |
|
|
title="Ajouter une entrée" |
|
|
|
|
|
side="left" |
|
|
<q-list bordered separator class="rounded-borders"> |
|
|
icon="add" |
|
|
<q-item clickable |
|
|
color="primary" |
|
|
v-for="event in history" |
|
|
@click="openHistoryForm()" |
|
|
:key="event.id" |
|
|
style="cursor:pointer" |
|
|
@click="showHistory = true;selectedHistory = event" |
|
|
> |
|
|
> |
|
|
<q-slide-transition> |
|
|
<q-item-section top thumbnail class="q-ml-none" style="margin:-8px 0 -8px -16px"> |
|
|
<div v-show="showHistoryForm"> |
|
|
<img |
|
|
|
|
|
:src="getImageUrl(event, event.image_file, true)" |
|
|
|
|
|
alt="photo" |
|
|
|
|
|
v-if="event.image_file" |
|
|
|
|
|
/> |
|
|
|
|
|
</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 caption><span class="text-capitalize">{{ event.user }}</span></q-item-label> |
|
|
|
|
|
</q-item-section> |
|
|
|
|
|
<q-item-section side top> |
|
|
|
|
|
<q-item-label caption>{{ getDate(event.created) }}</q-item-label> |
|
|
|
|
|
</q-item-section> |
|
|
|
|
|
</q-item> |
|
|
|
|
|
</q-list> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<q-dialog v-model="showHistoryForm"> |
|
|
|
|
|
<q-card> |
|
|
|
|
|
<q-card-section> |
|
|
|
|
|
<div class="text-h6">Ajouter une entrée</div> |
|
|
|
|
|
</q-card-section> |
|
|
|
|
|
<q-card-section> |
|
|
<q-input |
|
|
<q-input |
|
|
v-model="pendingHistory" |
|
|
v-model="pendingHistory" |
|
|
|
|
|
autofocus |
|
|
type="textarea" |
|
|
type="textarea" |
|
|
label="Description" |
|
|
label="Description" |
|
|
:max-height="100" |
|
|
:max-height="100" |
|
@ -144,10 +177,6 @@ |
|
|
invertedd |
|
|
invertedd |
|
|
color="secondary" |
|
|
color="secondary" |
|
|
/> |
|
|
/> |
|
|
<!-- <q-input label="Date"--> |
|
|
|
|
|
<!-- v-model="pendingHistoryDate"--> |
|
|
|
|
|
<!-- type="datetime"--> |
|
|
|
|
|
<!-- format24h />--> |
|
|
|
|
|
<br/> |
|
|
<br/> |
|
|
<q-uploader |
|
|
<q-uploader |
|
|
:accept="'.jpg,.png'" |
|
|
:accept="'.jpg,.png'" |
|
@ -158,48 +187,40 @@ |
|
|
no-thumbnails |
|
|
no-thumbnails |
|
|
hide-upload-btn |
|
|
hide-upload-btn |
|
|
flat |
|
|
flat |
|
|
|
|
|
bordered |
|
|
color="secondary" |
|
|
color="secondary" |
|
|
/> |
|
|
/> |
|
|
<br/> |
|
|
<br/> |
|
|
<q-btn flat color="faded" @click.stop="showHistoryForm = false">Annuler</q-btn> |
|
|
</q-card-section> |
|
|
|
|
|
<q-separator></q-separator> |
|
|
|
|
|
<q-card-actions align="right"> |
|
|
|
|
|
<q-btn flat color="grey" @click.stop="showHistoryForm = false">Annuler</q-btn> |
|
|
<q-btn flat color="primary" @click.stop="addHistory()">Ok</q-btn> |
|
|
<q-btn flat color="primary" @click.stop="addHistory()">Ok</q-btn> |
|
|
</div> |
|
|
</q-card-actions> |
|
|
</q-slide-transition> |
|
|
</q-card> |
|
|
</q-timeline-entry> |
|
|
</q-dialog> |
|
|
<q-timeline-entry |
|
|
|
|
|
v-for="event in history.slice().reverse()" |
|
|
<q-dialog v-model="showHistory"> |
|
|
:key="event.id" |
|
|
<q-card> |
|
|
:subtitle="getDate(event.date)" |
|
|
<img :src="getImageUrl(selectedHistory, selectedHistory.image_file)" |
|
|
:title="event.user" |
|
|
|
|
|
side="left" |
|
|
|
|
|
> |
|
|
|
|
|
<div> |
|
|
|
|
|
<q-icon name="format_quote" |
|
|
|
|
|
color="light" |
|
|
|
|
|
size="2rem" |
|
|
|
|
|
/> |
|
|
|
|
|
{{ event.text }} |
|
|
|
|
|
<q-icon name="format_quote" |
|
|
|
|
|
color="light" |
|
|
|
|
|
size="2rem" |
|
|
|
|
|
/> |
|
|
|
|
|
</div> |
|
|
|
|
|
<q-img :src="getImageUrl(event, event.image_file)" |
|
|
|
|
|
alt="photo" |
|
|
alt="photo" |
|
|
v-if="event.image_file" |
|
|
v-if="selectedHistory.image_file" |
|
|
class="q-py-md" |
|
|
|
|
|
style="max-height:300px;max-width:300px" |
|
|
|
|
|
:fit="'contain'" |
|
|
|
|
|
/> |
|
|
|
|
|
<br/> |
|
|
|
|
|
<q-btn flat |
|
|
|
|
|
:disable="item.deleted" |
|
|
|
|
|
icon="delete" |
|
|
|
|
|
label="Supprimer cette entrée" |
|
|
|
|
|
@click="removeHistory(event)" |
|
|
|
|
|
/> |
|
|
/> |
|
|
</q-timeline-entry> |
|
|
<q-card-section> |
|
|
</q-timeline> |
|
|
<div v-html="selectedHistory.text.split('\n').join('</br>')"></div> |
|
|
|
|
|
<div class="text-caption text-grey"> |
|
|
|
|
|
<span class="text-capitalize">{{ selectedHistory.user }}</span> |
|
|
|
|
|
<q-separator vertical /> |
|
|
|
|
|
<span>{{ getDate(selectedHistory.created) }}</span> |
|
|
|
|
|
</div> |
|
|
|
|
|
</q-card-section> |
|
|
|
|
|
<q-card-actions align="right"> |
|
|
|
|
|
<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-card-actions> |
|
|
|
|
|
</q-card> |
|
|
|
|
|
</q-dialog> |
|
|
|
|
|
|
|
|
</q-page> |
|
|
</q-page> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
@ -220,7 +241,9 @@ export default { |
|
|
username: null, |
|
|
username: null, |
|
|
qrCodeDataUrl: null, |
|
|
qrCodeDataUrl: null, |
|
|
showQr: false, |
|
|
showQr: false, |
|
|
item: {} |
|
|
item: {}, |
|
|
|
|
|
showHistory: false, |
|
|
|
|
|
selectedHistory: null, |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
computed: { |
|
|
computed: { |
|
@ -341,8 +364,8 @@ export default { |
|
|
console.error('Error compressing image:', error) |
|
|
console.error('Error compressing image:', error) |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
getImageUrl (history, image) { |
|
|
getImageUrl (history, image, thumb = false) { |
|
|
return this.$pb.files.getURL(history, image, { thumb: '300x300f' }) |
|
|
return this.$pb.files.getURL(history, image, { thumb: thumb ? '300x300f' : null }) |
|
|
}, |
|
|
}, |
|
|
loadItem () { |
|
|
loadItem () { |
|
|
let item = this.stock.find(item => { |
|
|
let item = this.stock.find(item => { |
|
|