- edit campi prodotti

- edit ordini
This commit is contained in:
Surya Paolo
2024-01-13 00:29:02 +01:00
parent 89e8575aae
commit 3ffa2893e5
23 changed files with 749 additions and 65 deletions

View File

@@ -0,0 +1,24 @@
.colmodif {
cursor: pointer;
}
.colmodif:hover {
background-color: #a8f0ff;
cursor: pointer;
}
.colsel {
background-color: #81b8ff;
}
.cldisable{
color: gray !important;
}
.clinput{
@media (max-width: 500px) {
display: flex;
flex-grow: 1;
}
}

View File

@@ -0,0 +1,194 @@
import { defineComponent, onMounted, PropType, ref, watch } from 'vue'
import { useQuasar } from 'quasar'
import { useI18n } from '@/boot/i18n'
import { useGlobalStore } from '@store/globalStore'
import { fieldsTable } from '@store/Modules/fieldsTable'
import { tools } from '@store/Modules/tools'
import { costanti } from '@costanti'
import { CMyPopupEdit } from '@/components/CMyPopupEdit'
import { IColGridTable, IOperators, ISpecialField } from 'model'
import MixinBase from '@/mixins/mixin-base'
export default defineComponent({
name: 'CMyValueDb',
emits: ['save'],
props: {
title: {
type: String,
required: true,
},
hint: {
type: String,
required: false,
default: '',
},
mykey: {
type: String,
required: true,
},
mysubkey: {
type: String,
required: false,
default: '',
},
specialField: {
type: Object as PropType<ISpecialField>,
required: false,
default: null,
},
filter: {
type: [String, Function],
required: false,
default: null,
},
indrec: {
type: Number,
required: false,
default: -1,
},
maxlength: {
type: Number,
required: false,
default: 0,
},
minlength: {
type: Number,
required: false,
default: 0,
},
mysubsubkey: {
type: String,
required: false,
default: '',
},
type: {
type: Number,
required: true,
},
serv: {
type: Boolean,
required: false,
default: false,
},
canModify: {
type: Boolean,
required: false,
default: true,
},
disable: {
type: Boolean,
required: false,
default: false,
},
jointable: {
type: String,
required: false,
default: '',
},
table: {
type: String,
required: false,
default: 'settings',
},
myimg: {
type: String,
required: false,
default: '',
},
rec: {
type: Object,
required: false,
default: null,
},
mycol: {
type: Object as PropType<IColGridTable> | undefined,
required: false,
default: () => {
return { }
},
},
id: {
type: String,
required: false,
default: '',
},
idmain: {
type: String,
required: false,
default: '',
},
tablesel: {
type: String,
required: false,
default: '',
},
pickup: {
type: Boolean,
required: false,
default: false,
},
},
components: { CMyPopupEdit },
setup(props, { emit }) {
const $q = useQuasar()
const { t } = useI18n()
const globalStore = useGlobalStore()
const col = ref(<IColGridTable>{
name: 'test', fieldtype: 0, showWhen: costanti.showWhen.NewRec + costanti.showWhen.InEdit + costanti.showWhen.InView, visible: true, maxlength: props.maxlength, minlength: props.minlength
})
const row = ref({})
const { setValDb, getValDb } = MixinBase()
function showandsel(row: any, col: any, newval: any, valinitial: any) {
console.log('showandsel CMyFieldDb', row, col, newval)
if (newval !== valinitial) {
setValDb($q, props.mykey, newval, props.type, props.serv, props.table, props.mysubkey, props.id, props.indrec, props.mysubsubkey, props.specialField)
}
}
function save(newval: any) {
emit('save', newval)
}
function withBorder() {
if (col.value)
return col.value.fieldtype !== costanti.FieldType.onlydate && col.value.fieldtype !== costanti.FieldType.date
else
return false
}
function mounted() {
if (props.rec) {
row.value = props.rec
}
if (props.mycol && props.mycol.name !== '') {
col.value = props.mycol
} else {
// console.log('Tab = ', props.table, 'key=', props.mykey, 'mycolProp', props.mycol)
col.value = fieldsTable.getColByTable(props.table, props.mykey)
}
// console.log('COL = ', col.value, 'MyCol passed', props.mycol)
}
onMounted(mounted)
return {
tools,
costanti,
fieldsTable,
globalStore,
col,
row,
showandsel,
withBorder,
save,
}
},
})

View File

@@ -0,0 +1,78 @@
<template>
<div class="text-center">
<div class="row items-center justify-center q-gutter-xs q-ma-xs">
<div :class="` `" :style="withBorder() ? `` : ``">
<div v-if="title && type === costanti.FieldType.string" class="q-ma-xs">
<q-field
rounded
outlined
:bg-color="$q.dark.isActive ? '' : 'blue-4'"
dense
style="min-width: 110px"
>
<template v-slot:control>
<div class="centermydiv">
<div v-if="myimg" class="text-center">
<q-img
:src="myimg"
class="text-center"
style="height: 50px; width: 50px"
:alt="title"
>
</q-img>
</div>
<div
class="self-center full-width no-outline text-center"
tabindex="0"
>
{{ title }}
</div>
</div>
</template>
</q-field>
</div>
<CMyPopupEdit
debounce="1000"
:fielddb="true"
v-bind="$attrs"
:rec="rec"
:isrec="!!rec"
:table="table"
:hint="title"
:title="title"
:field="mykey"
:filter="filter"
:subfield="mysubkey"
:specialField="specialField"
:mysubsubkey="mysubsubkey"
:indrec="indrec"
:type="type"
:serv="serv"
:disable="disable"
:jointable="jointable"
:myimg="myimg"
:canModify="canModify"
:canEdit="true"
:id="id"
:idmain="idmain"
:mycol="col ? col : {}"
:tablesel="tablesel"
:pickup="pickup"
v-model:row="row"
minuteinterval="1"
@showandsave="showandsel"
@save="save"
>
</CMyPopupEdit>
</div>
</div>
</div>
</template>
<script lang="ts" src="./CMyValueDb.ts">
</script>
<style lang="scss" scoped>
@import './CMyValueDb.scss';
</style>

View File

@@ -0,0 +1 @@
export {default as CMyValueDb} from './CMyValueDb.vue'