- ordinamento tabella titoli
- migliorata la lista degli argomenti
This commit is contained in:
@@ -257,7 +257,7 @@
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
|
||||
<q-item
|
||||
<!--<q-item
|
||||
v-if="
|
||||
tools.isManager() && !optcatalogo.generazionePDFInCorso && (editOn || options.show_edit_book)
|
||||
"
|
||||
@@ -276,6 +276,7 @@
|
||||
<q-item-label>Vedi Numero di Pagine (Da GM)</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
-->
|
||||
|
||||
<q-item
|
||||
v-if="
|
||||
|
||||
@@ -1576,6 +1576,15 @@
|
||||
icon="fas fa-play-circle"
|
||||
>
|
||||
<div class="column">
|
||||
<q-toggle
|
||||
v-model="myel.catalogo.showListaArgomenti"
|
||||
color="positive"
|
||||
icon="fas fa-file-pdf"
|
||||
label="Mostra Lista Argomenti"
|
||||
@update:model-value="modifElem"
|
||||
>
|
||||
</q-toggle>
|
||||
|
||||
<q-toggle
|
||||
v-model="myel.catalogo.pdf"
|
||||
color="positive"
|
||||
|
||||
@@ -72,6 +72,10 @@ export default defineComponent({
|
||||
|
||||
const modifOn = ref(false)
|
||||
|
||||
const sortAttribute = ref('')
|
||||
const sortDirection = ref(1)
|
||||
|
||||
|
||||
const optionscatalogo = ref(<any>{maxlength: 0})
|
||||
|
||||
const editOn = computed({
|
||||
@@ -255,6 +259,37 @@ export default defineComponent({
|
||||
|
||||
}
|
||||
|
||||
const sortTable = (sortAttributeToSort: string) => {
|
||||
|
||||
if (!props.optcatalogo.showListaArgomenti)
|
||||
return false
|
||||
|
||||
if (sortAttributeToSort) {
|
||||
if (sortAttribute.value === sortAttributeToSort) {
|
||||
sortDirection.value = -sortDirection.value
|
||||
} else {
|
||||
sortAttribute.value = sortAttributeToSort
|
||||
sortDirection.value = 1
|
||||
}
|
||||
internalProducts.value = internalProducts.value.sort((a: any, b: any) => {
|
||||
const aVal = a.productInfo?.[sortAttributeToSort] ?? ''
|
||||
const bVal = b.productInfo?.[sortAttributeToSort] ?? ''
|
||||
if (aVal instanceof Date && bVal instanceof Date) {
|
||||
return sortDirection.value === 1 ? aVal.getTime() - bVal.getTime() : bVal.getTime() - aVal.getTime()
|
||||
}
|
||||
if (typeof aVal === 'number' && typeof bVal === 'number') {
|
||||
return sortDirection.value === 1 ? aVal - bVal : bVal - aVal
|
||||
}
|
||||
if (typeof aVal === 'string' && typeof bVal === 'string') {
|
||||
return sortDirection.value === 1 ? aVal.localeCompare(bVal) : bVal.localeCompare(aVal)
|
||||
}
|
||||
return sortDirection.value === 1 ? String(aVal).localeCompare(String(bVal)) : String(bVal).localeCompare(String(aVal))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
onMounted(mounted)
|
||||
|
||||
return {
|
||||
@@ -287,6 +322,9 @@ export default defineComponent({
|
||||
optionscatalogo,
|
||||
t,
|
||||
products,
|
||||
sortTable,
|
||||
sortAttribute,
|
||||
sortDirection,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -25,8 +25,21 @@
|
||||
<th
|
||||
v-if="isColumnVisible(col.name)"
|
||||
:key="col.name"
|
||||
@click="sortTable(col.name)"
|
||||
>
|
||||
{{ col.label }}
|
||||
<q-icon
|
||||
v-if="(sortAttribute === col.name) && optcatalogo.showListaArgomenti"
|
||||
:name="sortDirection === 1 ? 'arrow_drop_up' : 'arrow_drop_down'"
|
||||
size="16px"
|
||||
class="q-ml-xs"
|
||||
/>
|
||||
<q-icon
|
||||
v-else-if="optcatalogo.showListaArgomenti"
|
||||
name="arrow_drop_up"
|
||||
size="16px"
|
||||
class="q-ml-xs"
|
||||
/>
|
||||
</th>
|
||||
</template>
|
||||
</tr>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { PropType } from 'vue';
|
||||
import { defineComponent, onMounted, ref, watch, computed} from 'vue'
|
||||
import { defineComponent, onMounted, ref, watch, computed } from 'vue'
|
||||
import { tools } from '@tools'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { useRouter } from 'vue-router'
|
||||
@@ -23,6 +23,7 @@ import type {
|
||||
|
||||
|
||||
import { fieldsTable } from '@store/Modules/fieldsTable'
|
||||
import Products from 'app/src/rootgen/admin/products/products.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CSearchProduct',
|
||||
@@ -37,7 +38,7 @@ export default defineComponent({
|
||||
idprodtoshow: {
|
||||
type: String,
|
||||
required: false,
|
||||
default : '',
|
||||
default: '',
|
||||
},
|
||||
empty: {
|
||||
type: Boolean,
|
||||
@@ -47,7 +48,7 @@ export default defineComponent({
|
||||
nameLinkTemplate: {
|
||||
type: String,
|
||||
required: false,
|
||||
default : '',
|
||||
default: '',
|
||||
},
|
||||
visu: {
|
||||
type: Number,
|
||||
@@ -245,7 +246,7 @@ export default defineComponent({
|
||||
router.push(path)
|
||||
}
|
||||
|
||||
function collabel (rec: any) {
|
||||
function collabel(rec: any) {
|
||||
// console.log('Record:', rec)
|
||||
let label = ''
|
||||
if (rec && rec.productInfo) {
|
||||
@@ -254,79 +255,81 @@ export default defineComponent({
|
||||
if (!productStore.isPubblicatoById(rec.productInfo.idStatoProdotto))
|
||||
label += ' (' + productStore.getDescrStatiProdottoByIdStatoProdotto(rec.productInfo.idStatoProdotto || '') + ')'
|
||||
}
|
||||
|
||||
// console.log('Computed label:', label)
|
||||
}
|
||||
return label
|
||||
if (productStore.isEsaurito(rec)) {
|
||||
label += ' (Attualmente non disponibile)'
|
||||
}
|
||||
// console.log('Computed label:', label)
|
||||
}
|
||||
return label
|
||||
}
|
||||
|
||||
function insertProd() {
|
||||
// console.log('insertProd')
|
||||
emit('insert', myproduct.value)
|
||||
// console.log('insertProd')
|
||||
emit('insert', myproduct.value)
|
||||
}
|
||||
|
||||
function clickClose() {
|
||||
searchList.value[0].value = ''
|
||||
myproduct.value = null
|
||||
emit('close')
|
||||
}
|
||||
function clickClose() {
|
||||
searchList.value[0].value = ''
|
||||
myproduct.value = null
|
||||
emit('close')
|
||||
}
|
||||
|
||||
function updateproductmodif(element: IProduct) {
|
||||
console.log('CSEARCHPRODUCT: updateproductmodif')
|
||||
emit('updateproductmodif', element)
|
||||
}
|
||||
function updateproductmodif(element: IProduct) {
|
||||
console.log('CSEARCHPRODUCT: updateproductmodif')
|
||||
emit('updateproductmodif', element)
|
||||
}
|
||||
|
||||
async function searchOnGM(mystr: string) {
|
||||
// refreshSingleBookFromGM({usaDBGMLocale: false})
|
||||
const options = {
|
||||
async function searchOnGM(mystr: string) {
|
||||
// refreshSingleBookFromGM({usaDBGMLocale: false})
|
||||
const options = {
|
||||
|
||||
}
|
||||
const ris = await globalStore.updateAllBookFromGM_T_Web_Articoli({ sku: '', isbn: mystr, ...options })
|
||||
if (ris) {
|
||||
}
|
||||
const ris = await globalStore.updateAllBookFromGM_T_Web_Articoli({ sku: '', isbn: mystr, ...options })
|
||||
if (ris) {
|
||||
|
||||
const id = getSearchId()
|
||||
loadProduct(id)
|
||||
updateproductmodif(myproduct.value)
|
||||
const id = getSearchId()
|
||||
loadProduct(id)
|
||||
updateproductmodif(myproduct.value)
|
||||
|
||||
// await updateproduct(false)
|
||||
tools.showPositiveNotif($q, t('dbgm.updateLocalDb_OK'))
|
||||
// updatefromgm.value = false
|
||||
}
|
||||
// await updateproduct(false)
|
||||
tools.showPositiveNotif($q, t('dbgm.updateLocalDb_OK'))
|
||||
// updatefromgm.value = false
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(mounted)
|
||||
onMounted(mounted)
|
||||
|
||||
return {
|
||||
userStore,
|
||||
costanti,
|
||||
tools,
|
||||
toolsext,
|
||||
search,
|
||||
shared_consts,
|
||||
productStore,
|
||||
t,
|
||||
loadpage,
|
||||
refreshpage,
|
||||
show_hide,
|
||||
searchList,
|
||||
fieldsTable,
|
||||
mycolumns,
|
||||
naviga,
|
||||
myproduct,
|
||||
optcatalogo,
|
||||
idPage,
|
||||
selauthor,
|
||||
valoriopt,
|
||||
labelcombo,
|
||||
searchText,
|
||||
insertProd,
|
||||
focus,
|
||||
clickClose,
|
||||
saveSearch,
|
||||
updateproductmodif,
|
||||
searchOnGM,
|
||||
}
|
||||
return {
|
||||
userStore,
|
||||
costanti,
|
||||
tools,
|
||||
toolsext,
|
||||
search,
|
||||
shared_consts,
|
||||
productStore,
|
||||
t,
|
||||
loadpage,
|
||||
refreshpage,
|
||||
show_hide,
|
||||
searchList,
|
||||
fieldsTable,
|
||||
mycolumns,
|
||||
naviga,
|
||||
myproduct,
|
||||
optcatalogo,
|
||||
idPage,
|
||||
selauthor,
|
||||
valoriopt,
|
||||
labelcombo,
|
||||
searchText,
|
||||
insertProd,
|
||||
focus,
|
||||
clickClose,
|
||||
saveSearch,
|
||||
updateproductmodif,
|
||||
searchOnGM,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user