- Impostato i Font giusti e la corretta disposizione del testo e dei suoi margini.

- L'immagine del libro, se è piccolo, viene adattato alla dimensione fissa (vedere se va bene).
This commit is contained in:
Surya Paolo
2024-11-24 14:40:29 +01:00
parent 6a6c15b62c
commit e10ff192bf
18 changed files with 392 additions and 123 deletions

View File

@@ -121,6 +121,8 @@ export default defineComponent({
const neworder = ref(<number | undefined>0)
const idSchedaDaCopiare = ref('')
const myel = toRef(props, 'myelem')
const newtype = ref(<any>'')
const visuadd = ref(false)
@@ -199,7 +201,7 @@ export default defineComponent({
}
async function dupElem(order?: number) {
const newrec: IMyElem = { ...props.myelem }
const newrec: IMyElem = tools.jsonCopy(props.myelem)
newrec._id = undefined
newrec.order = getNewOrderByThisElem()
@@ -242,6 +244,12 @@ export default defineComponent({
disableSave.value = false
elemChanged.value = true
}
function modifElemAndSchede() {
modifElem()
myel.value.catalogo!.aggiorna++
}
function mounted() {
neworder.value = props.myelem.order
@@ -438,6 +446,7 @@ export default defineComponent({
_id: objectId(),
idapp: tools.appid()!,
isTemplate: false,
show_separatore: true,
name: 'Scheda Nuova',
dimensioni,
line_height: 100,
@@ -459,7 +468,7 @@ export default defineComponent({
},
font: {
name: 'monospace',
size: 16,
size: '16px',
}
},
productTypes: [],
@@ -486,6 +495,51 @@ export default defineComponent({
modifElem()
}
function copyfromTemplate(indscheda: number) {
// Estrai l'id da copiare e sostituisci tutto con questo
if (!idSchedaDaCopiare.value) {
return false
}
const arrschede: ISchedaSingola[] = globalStore.getMySchede()
if (arrschede.length <= 0) {
return false
}
const myschedatocopy = arrschede.find((recscheda: ISchedaSingola) => recscheda.scheda!._id === idSchedaDaCopiare.value)
const schedadest = myel.value.catalogo!.arrSchede![indscheda]
if (myschedatocopy) {
let newscheda = myschedatocopy.scheda!.name
const msg = 'Sostituisci questa scheda (' + schedadest.scheda?.name + ') con "' + newscheda + '" ?'
$q.dialog({
message: msg,
html: true,
ok: {
label: 'Sostituisci',
push: true,
},
title: '',
cancel: true,
persistent: false,
}).onOk(async () => {
const myschedadest: ISchedaSingola = myel.value.catalogo!.arrSchede![indscheda]
myschedadest.scheda = tools.jsonCopy(myschedatocopy.scheda!)
myschedadest.scheda!._id = objectId()
myschedadest.order = 20
myschedadest.scheda!.name = myschedadest.scheda!.name + '_copia'
myschedadest.scheda!.isTemplate = false
})
}
}
function dupNewScheda(id: string) {
if (!myel.value.catalogo!.arrSchede)
return
@@ -493,14 +547,19 @@ export default defineComponent({
const myfindscheda = myel.value.catalogo!.arrSchede.find((scheda: ISchedaSingola) => scheda._id === id)
if (myfindscheda) {
let myscheda = { ...myfindscheda }
let myscheda = tools.jsonCopy(myfindscheda)
delete myscheda._id
delete myscheda.scheda!._id
myscheda.numSchede = 1
myscheda.order = myscheda.order + 10,
myscheda._id = objectId()
myscheda.scheda!._id = objectId()
myscheda.scheda!.name = myscheda.scheda!.name + '_copia'
myscheda.scheda!.isTemplate = false
const bakscheda = [...myel.value.catalogo!.arrSchede]
myel.value.catalogo!.arrSchede = []
myel.value.catalogo!.arrSchede = [...bakscheda, myscheda]
myel.value.catalogo!.arrSchede.push(myscheda)
modifElem()
}
@@ -514,7 +573,7 @@ export default defineComponent({
const myfindcard = myel.value.listcards[tabCard.value]
if (myfindcard) {
let mycard = { ...myfindcard }
let mycard = tools.jsonCopy(myfindcard)
delete mycard._id
mycard._id = objectId()
@@ -568,10 +627,28 @@ export default defineComponent({
}
function delRecScheda(id: string, myel: IMyElem) {
//
myel.catalogo!.arrSchede = myel.catalogo!.arrSchede!.filter((scheda: ISchedaSingola) => scheda._id !== id)
modifElem()
const myscheda = myel.catalogo!.arrSchede!.find((scheda: ISchedaSingola) => scheda._id === id)
if (myscheda) {
$q.dialog({
message: 'Eliminare la scheda "' + myscheda?.scheda?.name + '" ?',
html: true,
ok: {
label: 'Elimina',
push: true,
},
title: '',
cancel: true,
persistent: false,
}).onOk(async () => {
//
myel.catalogo!.arrSchede = myel.catalogo!.arrSchede!.filter((scheda: ISchedaSingola) => scheda._id !== id)
modifElem()
})
}
}
@@ -678,13 +755,13 @@ export default defineComponent({
}
function SchedeOpt() {
const arrschede = globalStore.getMySchede()
const arrschede: ISchedaSingola[] = globalStore.getMySchede()
let arr: any = []
if (arrschede) {
arrschede.forEach(scheda => {
arr.push({ label: scheda.name, value: scheda._id })
arrschede.forEach((recscheda: ISchedaSingola) => {
arr.push({ label: recscheda.scheda!.name, value: recscheda.scheda!._id })
});
}
@@ -865,6 +942,9 @@ export default defineComponent({
addProdSpeciale,
formatOptions,
fontSizeOptions,
idSchedaDaCopiare,
copyfromTemplate,
modifElemAndSchede,
}
},

View File

@@ -1473,7 +1473,7 @@
>
<q-tab
v-for="(rec, ind) in myel.catalogo.arrSchede"
:key="ind"
:key="rec._id"
:name="ind"
:label="`Scheda ` + (ind + 1)"
icon="fas fa-pencil-alt"
@@ -1484,7 +1484,7 @@
<q-tab-panels v-model="tabScheda" animated>
<q-tab-panel
v-for="(recscheda, ind) in myel.catalogo.arrSchede"
:key="ind"
:key="recscheda._id"
:name="ind"
>
<q-bar v-if="recscheda" class="bg-primary text-white">
@@ -1545,23 +1545,34 @@
>
</q-input>
<!--<q-select
:behavior="
$q.platform.is.ios === true ? 'dialog' : 'menu'
"
v-if="enableEdit"
rounded
outlined
v-model="recscheda._id"
:options="SchedeOpt()"
@update:model-value="modifElem"
dense
label="Scegli Scheda"
style="width: 150px"
emit-value
map-options
>
</q-select>-->
<div class="row">
<q-select
:behavior="
$q.platform.is.ios === true ? 'dialog' : 'menu'
"
v-if="enableEdit"
rounded
outlined
v-model="idSchedaDaCopiare"
:options="SchedeOpt()"
@update:model-value="modifElem"
dense
label="Scegli Scheda"
style="width: 150px"
emit-value
map-options
>
</q-select>
<q-btn
icon="far fa-copy"
label="Copia da Template"
dense
:disable="!idSchedaDaCopiare"
color="primary"
@click="copyfromTemplate(ind)"
>
</q-btn>
</div>
<CMySlider
label="Schede da ripetere"
@@ -1716,7 +1727,7 @@
:min="1"
:max="10"
color="green"
@update:model-value="modifElem"
@update:model-value="modifElemAndSchede"
></CMySlider>
<CMySlider
label="Schede per Colonna"
@@ -1724,7 +1735,7 @@
:min="1"
:max="10"
color="red"
@update:model-value="modifElem"
@update:model-value="modifElemAndSchede"
></CMySlider>
<CMySize
@@ -1732,6 +1743,7 @@
v-model="
recscheda.scheda.dimensioni.scheda_prodotto.size
"
:gap="true"
@update:model-value="modifElem"
></CMySize>
@@ -1877,20 +1889,24 @@
text-color="white"
>
</q-select>
<q-select
v-model="recscheda.scheda.barcode.font.size"
:options="fontSizeOptions"
label="Font Size"
options-dense
dense
emit-value
map-options
style="width: 100px"
<CMySlider
label="Width Linee:"
v-model="recscheda.scheda.barcode.widthlines"
:min="1"
:max="10"
color="green"
@update:model-value="modifElem"
fill-input
text-color="white"
>
</q-select>
></CMySlider>
<CMySlider
label="Font Size:"
v-model="recscheda.scheda.barcode.font.size"
:min="8"
:max="40"
color="green"
addstr="px"
@update:model-value="modifElem"
></CMySlider>
<CMySize
label="Dimensioni:"
v-model="recscheda.scheda.barcode.size"
@@ -1971,7 +1987,13 @@
map-options
>
</q-select>
<div v-if="myel.catalogo.areadistampa.format.length > 1">Ratio: {{myel.catalogo.areadistampa.format[0] / myel.catalogo.areadistampa.format[1]}}</div>
<div v-if="myel.catalogo.areadistampa.format.length > 1">
Ratio:
{{
myel.catalogo.areadistampa.format[0] /
myel.catalogo.areadistampa.format[1]
}}
</div>
<q-select
rounded
style="width: 200px"