- Cataloghi
- Import ed Export Pagine - ObjectID sostituita con ObjectId
This commit is contained in:
@@ -166,11 +166,11 @@
|
||||
{{ myproduct.productInfo.publisher.name }}
|
||||
</div>
|
||||
<div
|
||||
v-if="myproduct.productInfo.date_publishing && complete"
|
||||
v-if="myproduct.productInfo.date_pub && complete"
|
||||
class="book-data-pub"
|
||||
>
|
||||
Data Pubblicazione:
|
||||
{{ tools.getstrDate(myproduct.productInfo.date_publishing) }}
|
||||
{{ tools.getstrDate(myproduct.productInfo.date_pub) }}
|
||||
</div>
|
||||
|
||||
<q-separator class="q-my-sm"></q-separator>
|
||||
|
||||
@@ -578,7 +578,7 @@ export default defineComponent({
|
||||
function isProductNovita() {
|
||||
const monthsAgo = props.scheda.etichette?.novita?.months ?? 6; // Numero di mesi da considerare "recenti"
|
||||
|
||||
const publishingDate = new Date(myproduct.value!.productInfo.date_publishing!);
|
||||
const publishingDate = new Date(myproduct.value!.productInfo.date_pub!);
|
||||
|
||||
// Calcola i millisecondi corrispondenti a X mesi fa
|
||||
const monthsInMilliseconds = monthsAgo * 30 * 24 * 60 * 60 * 1000; // Approssimazione, non tutti i mesi hanno 30 giorni
|
||||
|
||||
@@ -623,7 +623,7 @@
|
||||
table="productinfos"
|
||||
:id="myproduct.productInfo._id"
|
||||
:rec="myproduct.productInfo"
|
||||
mykey="date_publishing"
|
||||
mykey="date_pub"
|
||||
debounce="1000"
|
||||
:save="updateproductmodif()"
|
||||
:type="costanti.FieldType.date"
|
||||
@@ -717,7 +717,7 @@
|
||||
table="productinfos"
|
||||
:id="myproduct.productInfo._id"
|
||||
:rec="myproduct.productInfo"
|
||||
mykey="totaleVenduti"
|
||||
mykey="totVen"
|
||||
debounce="1000"
|
||||
:save="updateproductmodif()"
|
||||
:type="costanti.FieldType.number"
|
||||
@@ -729,7 +729,7 @@
|
||||
table="productinfos"
|
||||
:id="myproduct.productInfo._id"
|
||||
:rec="myproduct.productInfo"
|
||||
mykey="venditeLastM"
|
||||
mykey="vLastM"
|
||||
debounce="1000"
|
||||
:save="updateproductmodif()"
|
||||
:type="costanti.FieldType.number"
|
||||
@@ -741,7 +741,7 @@
|
||||
table="productinfos"
|
||||
:id="myproduct.productInfo._id"
|
||||
:rec="myproduct.productInfo"
|
||||
mykey="venditeLast6M"
|
||||
mykey="vLast6M"
|
||||
debounce="1000"
|
||||
:save="updateproductmodif()"
|
||||
:type="costanti.FieldType.number"
|
||||
|
||||
@@ -8,12 +8,16 @@ import { PropType, defineComponent, onMounted, ref } from 'vue'
|
||||
import { IMyPage } from '@src/model'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CExportPage',
|
||||
name: 'CExportImportPage',
|
||||
props: {
|
||||
idPage: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
esporta: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
nomefile: {
|
||||
type: String,
|
||||
required: true,
|
||||
55
src/components/CExportImportPage/CExportImportPage.vue
Executable file
55
src/components/CExportImportPage/CExportImportPage.vue
Executable file
@@ -0,0 +1,55 @@
|
||||
<template>
|
||||
<div v-if="myrec && myrec.path" style="width: 800px;" class="">
|
||||
<div v-if="esporta">
|
||||
|
||||
<h2>Pagina '{{ myrec.path }}'</h2>
|
||||
<br />
|
||||
|
||||
<div class="column">
|
||||
Esporta:
|
||||
<q-input
|
||||
outlined
|
||||
autofocus
|
||||
v-model="nomefile"
|
||||
label="Nome File"
|
||||
></q-input>
|
||||
|
||||
<q-btn
|
||||
color="primary"
|
||||
:label="esporta ? 'Esporta Pagina' : 'Importa Pagina'"
|
||||
@click="esportaPagina"
|
||||
></q-btn>
|
||||
<CDownloadJsonFile
|
||||
v-if="testoJson"
|
||||
:testoJson="testoJson"
|
||||
:title="`Scarica file ${nomefile}`"
|
||||
:nomefile="nomefile"
|
||||
>
|
||||
</CDownloadJsonFile>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div class="column">
|
||||
Importa file JSON:
|
||||
<input
|
||||
type="file"
|
||||
@change="onFileChange">
|
||||
</input>
|
||||
fileContent: {{fileContent}}
|
||||
<q-btn
|
||||
color="primary"
|
||||
label="Importa file"
|
||||
@click="importaPagina"
|
||||
></q-btn>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">Risultato:<br>
|
||||
{{ ris }}</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./CExportImportPage.ts"></script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './CExportImportPage.scss';
|
||||
</style>
|
||||
1
src/components/CExportImportPage/index.ts
Executable file
1
src/components/CExportImportPage/index.ts
Executable file
@@ -0,0 +1 @@
|
||||
export {default as CExportImportPage} from './CExportImportPage.vue'
|
||||
@@ -1,51 +0,0 @@
|
||||
<template>
|
||||
<div v-if="myrec && myrec.path" style="width: 800px;" class="">
|
||||
<h2>Pagina '{{ myrec.path }}'</h2>
|
||||
<br />
|
||||
|
||||
<div class="column">
|
||||
Esporta:
|
||||
<q-input
|
||||
outlined
|
||||
autofocus
|
||||
v-model="nomefile"
|
||||
label="Nome File"
|
||||
></q-input>
|
||||
|
||||
<q-btn
|
||||
color="primary"
|
||||
label="Esporta Pagina"
|
||||
@click="esportaPagina"
|
||||
></q-btn>
|
||||
<CDownloadJsonFile
|
||||
v-if="testoJson"
|
||||
:testoJson="testoJson"
|
||||
:title="`Scarica file ${nomefile}`"
|
||||
:nomefile="nomefile"
|
||||
>
|
||||
</CDownloadJsonFile>
|
||||
</div>
|
||||
<div class="column">
|
||||
Importa file JSON:
|
||||
<input
|
||||
type="file"
|
||||
@change="onFileChange"
|
||||
outlined
|
||||
></input>
|
||||
fileContent: {{fileContent}}
|
||||
<q-btn
|
||||
color="primary"
|
||||
label="Importa file"
|
||||
@click="importaPagina"
|
||||
></q-btn>
|
||||
</div>
|
||||
<div class="row">Risultato:<br>
|
||||
{{ ris }}</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./CExportPage.ts"></script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './CExportPage.scss';
|
||||
</style>
|
||||
@@ -1 +0,0 @@
|
||||
export {default as CExportPage} from './CExportPage.vue'
|
||||
@@ -50,11 +50,13 @@ export default defineComponent({
|
||||
|
||||
onMounted(mounted)
|
||||
|
||||
function makeClick() {
|
||||
}
|
||||
|
||||
return {
|
||||
tools,
|
||||
getmenuByPath,
|
||||
|
||||
makeClick,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<template>
|
||||
<div :style="{ paddingLeft: `${level * 4}px` }">
|
||||
|
||||
<q-separator v-if="item.isseparator" />
|
||||
<q-expansion-item
|
||||
v-else-if="item.routes2 || item.sottoMenu"
|
||||
v-else-if="item.routes2 || (item.sottoMenu && item.sottoMenu.length > 0)"
|
||||
:content-inset-level="item.level_parent"
|
||||
:header-class="getmymenuclass(item)"
|
||||
:header-inset-level="item.level_parent"
|
||||
@@ -14,45 +15,49 @@
|
||||
item.mainMenu || item.routes2 ? 'fas fa-chevron-down' : 'none'
|
||||
"
|
||||
>
|
||||
<c-menu-item
|
||||
v-for="(childItem, childIndex) in item.routes2 || item.sottoMenu"
|
||||
:key="childIndex"
|
||||
:item="getmenuByPath(childItem)"
|
||||
:tools="tools"
|
||||
:getroute="getroute"
|
||||
:getmymenuclass="getmymenuclass"
|
||||
:getimgiconclass="getimgiconclass"
|
||||
:clBase="clBase"
|
||||
:mainMenu="item.mainMenu"
|
||||
:level="level + 1"
|
||||
/>
|
||||
<router-link :to="getroute(item)" custom>
|
||||
<c-menu-item
|
||||
v-for="(childItem, childIndex) in item.routes2 || (item.sottoMenu && item.sottoMenu.length > 0)"
|
||||
:key="childIndex"
|
||||
:item="getmenuByPath(childItem)"
|
||||
:tools="tools"
|
||||
:getroute="getroute"
|
||||
:getmymenuclass="getmymenuclass"
|
||||
:getimgiconclass="getimgiconclass"
|
||||
:clBase="clBase"
|
||||
:mainMenu="item.mainMenu"
|
||||
:level="level + 1"
|
||||
/>
|
||||
</router-link>
|
||||
</q-expansion-item>
|
||||
<q-item
|
||||
v-else
|
||||
clickable
|
||||
:to="getroute(item)"
|
||||
:content-inset-level="item.level_parent"
|
||||
:header-inset-level="item.level_parent"
|
||||
active-class="my-menu-active"
|
||||
expand-icon="none"
|
||||
>
|
||||
<q-item-section thumbnail>
|
||||
<q-avatar
|
||||
:icon="item.materialIcon"
|
||||
:size="!!item.iconsize ? item.iconsize : '2rem'"
|
||||
:font-size="!!item.iconsize ? item.iconsize : '2rem'"
|
||||
text-color="primary"
|
||||
square
|
||||
rounded
|
||||
>
|
||||
</q-avatar>
|
||||
</q-item-section>
|
||||
<router-link v-else :to="getroute(item)" custom>
|
||||
<q-item
|
||||
clickable
|
||||
:to="getroute(item)"
|
||||
@click="makeClick"
|
||||
:content-inset-level="item.level_parent"
|
||||
:header-inset-level="item.level_parent"
|
||||
active-class="my-menu-active"
|
||||
expand-icon="none"
|
||||
>
|
||||
<q-item-section thumbnail>
|
||||
<q-avatar
|
||||
:icon="item.materialIcon"
|
||||
:size="!!item.iconsize ? item.iconsize : '2rem'"
|
||||
:font-size="!!item.iconsize ? item.iconsize : '2rem'"
|
||||
text-color="primary"
|
||||
square
|
||||
rounded
|
||||
>
|
||||
</q-avatar>
|
||||
</q-item-section>
|
||||
|
||||
<q-item-section>
|
||||
<span :class="item.extraclass">{{ tools.getLabelByItem(item) }}</span>
|
||||
<span v-if="item.subtitle" class="subtitle">{{ item.subtitle }}</span>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item-section>
|
||||
<span :class="item.extraclass">{{ tools.getLabelByItem(item) }}</span>
|
||||
<span v-if="item.subtitle" class="subtitle">{{ item.subtitle }}</span>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</router-link>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ export default defineComponent({
|
||||
CSelectColor, CSelectFontSize, CSelectImage, CImgPoster, CSelectAnimation, CMySlider,
|
||||
CMySize, CBorders, CMyDimensioni, CMyText,
|
||||
},
|
||||
emits: ['saveElem', 'selElemClick', 'toggleSize', 'deleteElem', 'dupPage', 'expPage'],
|
||||
emits: ['saveElem', 'selElemClick', 'toggleSize', 'deleteElem', 'dupPage', 'expPage', 'impPage'],
|
||||
props: {
|
||||
myelem: {
|
||||
type: Object as PropType<IMyElem>,
|
||||
@@ -185,6 +185,9 @@ export default defineComponent({
|
||||
async function exportPage() {
|
||||
emit('expPage', null)
|
||||
}
|
||||
async function importPage() {
|
||||
emit('impPage', null)
|
||||
}
|
||||
async function dupElem(order?: number) {
|
||||
|
||||
const newrec: IMyElem = tools.jsonCopy(props.myelem)
|
||||
@@ -1090,6 +1093,7 @@ export default defineComponent({
|
||||
copyfromTemplate,
|
||||
modifElemAndSchede,
|
||||
exportPage,
|
||||
importPage,
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -57,6 +57,15 @@
|
||||
@click="dupPage()"
|
||||
>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
icon="fas fa-expand-alt"
|
||||
label="Importa"
|
||||
dense
|
||||
size="sm"
|
||||
color="primary"
|
||||
@click="importPage()"
|
||||
>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
icon="fas fa-expand-alt"
|
||||
label="Esporta"
|
||||
|
||||
@@ -10,7 +10,7 @@ import { CMyElem } from '@/components/CMyElem'
|
||||
import { CTitleBanner } from '@/components/CTitleBanner'
|
||||
import { CMyEditElem } from '@/components/CMyEditElem'
|
||||
import { CMyPageElem2 } from '@/components/CMyPageElem2'
|
||||
import { CExportPage } from '@/components/CExportPage'
|
||||
import { CExportImportPage } from '@src/components/CExportImportPage'
|
||||
|
||||
import { CImgTitle } from '../CImgTitle/index'
|
||||
import { CTitle } from '../CTitle/index'
|
||||
@@ -25,7 +25,7 @@ export default defineComponent({
|
||||
name: 'CMyPageElem',
|
||||
components: {
|
||||
LandingFooter, CImgTitle, CTitle, CMyElem,
|
||||
CMyEditElem, CMyPageElem2, CTitleBanner, CExportPage,
|
||||
CMyEditElem, CMyPageElem2, CTitleBanner, CExportImportPage,
|
||||
},
|
||||
props: {
|
||||
title: String,
|
||||
@@ -79,6 +79,7 @@ export default defineComponent({
|
||||
const mywidthEditor = ref(400)
|
||||
|
||||
const showexportPage = ref(false)
|
||||
const showimportPage = ref(false)
|
||||
|
||||
const editOn = computed({
|
||||
get(): boolean {
|
||||
@@ -199,6 +200,7 @@ export default defineComponent({
|
||||
deleteElem,
|
||||
duplicatePage,
|
||||
showexportPage,
|
||||
showimportPage,
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
@toggleSize="toggleSize"
|
||||
@dupPage="duplicatePage"
|
||||
@expPage="showexportPage = !showexportPage"
|
||||
@impPage="showimportPage = !showimportPage"
|
||||
>
|
||||
</CMyEditElem>
|
||||
</q-drawer>
|
||||
@@ -177,7 +178,22 @@
|
||||
</q-toolbar>
|
||||
<q-card-section class="q-pa-xs inset-shadow">
|
||||
<br>
|
||||
<CExportPage :idPage="selElem.idPage" :nomefile="`esporta_${rec.path}.json`"> </CExportPage>
|
||||
<CExportImportPage :idPage="rec._id" :nomefile="`esporta_${rec.path}.json`" :esporta="true"> </CExportImportPage>
|
||||
<br>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
<q-dialog v-model="showimportPage">
|
||||
<q-card class="dialog_card">
|
||||
<q-toolbar class="bg-primary text-white">
|
||||
<q-toolbar-title>
|
||||
Esporta Pagina
|
||||
</q-toolbar-title>
|
||||
<q-btn flat round color="white" icon="close" v-close-popup></q-btn>
|
||||
</q-toolbar>
|
||||
<q-card-section class="q-pa-xs inset-shadow">
|
||||
<br>
|
||||
<CExportImportPage :idPage="rec._id" :nomefile="`esporta_${rec.path}.json`"> </CExportImportPage>
|
||||
<br>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
|
||||
@@ -468,7 +468,7 @@ export default defineComponent({
|
||||
|
||||
try {
|
||||
|
||||
console.log('mounted', 'isFieldDb()', myrow.value, 'sub', props.subfield, 'field', props.field)
|
||||
// console.log('mounted', 'isFieldDb()', myrow.value, 'sub', props.subfield, 'field', props.field)
|
||||
if (isFieldDb() && !props.isrec) {
|
||||
// console.log(' . none...')
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user