Accomodations ...
This commit is contained in:
65
src/components/CAccomodation/CAccomodation.scss
Executable file
65
src/components/CAccomodation/CAccomodation.scss
Executable file
@@ -0,0 +1,65 @@
|
||||
$heightBtn: 100%;
|
||||
$grayshadow: #555;
|
||||
|
||||
.text-subtitle-gallery {
|
||||
font-size: 1rem;
|
||||
font-weight: 400;
|
||||
line-height: 1.75rem;
|
||||
letter-spacing: .00937em;
|
||||
text-shadow: .1rem .1rem .1rem $grayshadow;
|
||||
}
|
||||
|
||||
@media (max-width: 718px) {
|
||||
// PER VERSIONE MOBILE
|
||||
.text-subtitle-gallery {
|
||||
font-size: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.myimg {
|
||||
border-radius: 10px !important;
|
||||
height: 200px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.myimg-modify {
|
||||
cursor: grab;
|
||||
}
|
||||
|
||||
|
||||
.barwidth{
|
||||
width: 250px !important;
|
||||
}
|
||||
|
||||
|
||||
.q-img {
|
||||
&__image {
|
||||
border-radius: 10px !important;
|
||||
}
|
||||
}
|
||||
|
||||
.my-card-gallery {
|
||||
width: 100%;
|
||||
max-width: 300px;
|
||||
min-width: 200px;
|
||||
padding: 0.5rem 0.5rem;
|
||||
height: 350px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.my-card-gallery-noModif {
|
||||
width: 100%;
|
||||
max-width: 300px;
|
||||
min-width: 200px;
|
||||
padding: 1rem 1rem;
|
||||
height: 220px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.my-card-gallery-view {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
padding: 0.25rem 0.25rem;
|
||||
margin: auto;
|
||||
}
|
||||
179
src/components/CAccomodation/CAccomodation.ts
Executable file
179
src/components/CAccomodation/CAccomodation.ts
Executable file
@@ -0,0 +1,179 @@
|
||||
import { defineComponent, ref, PropType, watch, onMounted, computed } from 'vue'
|
||||
import { useI18n } from '@src/boot/i18n'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { useQuasar } from 'quasar'
|
||||
import { IAccomodation, IGallery, IImgGallery } from 'model'
|
||||
import { CMyPage } from '@/components/CMyPage'
|
||||
import { tools } from '@store/Modules/tools'
|
||||
import { shared_consts } from '@src/common/shared_vuejs'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
import { costanti } from '@costanti'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CAccomodation',
|
||||
props: {
|
||||
edit: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
canModify: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
isInModif: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
title: String,
|
||||
mylist: {
|
||||
type: Object as PropType<IAccomodation[] | string | undefined | null>,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
emits: ['showandsave'],
|
||||
components: { },
|
||||
setup(props, { emit }) {
|
||||
const $q = useQuasar()
|
||||
const { t } = useI18n()
|
||||
const userStore = useUserStore()
|
||||
const globalStore = useGlobalStore()
|
||||
|
||||
const displayGall = ref(false)
|
||||
|
||||
const listobj = ref(<IImgGallery[]>[])
|
||||
const maximizedToggle = ref(true)
|
||||
|
||||
|
||||
function isValid(myobj: any): boolean {
|
||||
return (myobj && typeof myobj !== 'string' && typeof myobj !== 'undefined')
|
||||
}
|
||||
|
||||
const isListImgValid = computed(() => {
|
||||
const arr = getlist()
|
||||
if (arr && tools.isArray(arr)) {
|
||||
return arr.length > 0
|
||||
} else {
|
||||
return !!arr
|
||||
}
|
||||
})
|
||||
|
||||
watch(() => props.mylist, (newval, oldval) => {
|
||||
if (isValid(props.mylist)) {
|
||||
// @ts-ignore
|
||||
listobj.value = props.mylist
|
||||
}
|
||||
})
|
||||
|
||||
function created() {
|
||||
// console.log('created cgallery')
|
||||
if (isValid(props.mylist)) {
|
||||
// @ts-ignore
|
||||
let myarr: any = props.mylist
|
||||
listobj.value = []
|
||||
if (Array.isArray(myarr)) {
|
||||
myarr.forEach((pic: any) => {
|
||||
if (pic.imagefile) {
|
||||
listobj.value.push(pic)
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
listobj.value = [
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function showandsave(value: any) {
|
||||
console.log('EMIT: showandsave')
|
||||
emit('showandsave', value)
|
||||
}
|
||||
|
||||
function getnumimages() {
|
||||
if (listobj.value)
|
||||
return listobj.value.length
|
||||
else
|
||||
return 0
|
||||
}
|
||||
|
||||
function getlist() {
|
||||
if (listobj.value)
|
||||
// return listobj.value.slice().sort((a: any, b: any) => a.order! - b.order!)
|
||||
return listobj.value
|
||||
else
|
||||
return null
|
||||
}
|
||||
|
||||
function getclass() {
|
||||
return (props.edit || displayGall.value) ? (props.isInModif ? 'my-card-gallery' : 'my-card-gallery-noModif') : 'my-card-gallery-view' + ' text-center'
|
||||
}
|
||||
|
||||
function getclimg() {
|
||||
let mycl = (props.edit || displayGall.value) ? 'myimg' : 'myimg-view'
|
||||
if (props.canModify && props.edit)
|
||||
mycl = mycl + ' myimg-modify'
|
||||
return mycl
|
||||
}
|
||||
|
||||
function apri() {
|
||||
displayGall.value = true
|
||||
}
|
||||
|
||||
function deleted(rec: any) {
|
||||
console.log('deleted', rec.imagefile)
|
||||
// console.table(mylistimages)
|
||||
|
||||
if (listobj.value) {
|
||||
const index = listobj.value.findIndex((elem: any) => elem.imagefile === rec.imagefile)
|
||||
if (index > -1) {
|
||||
listobj.value.splice(index, 1)
|
||||
}
|
||||
|
||||
// mylistimages = mylistimages.pop((elem) => elem.imagefile !== rec.imagefile)
|
||||
|
||||
// console.table(mylistimages)
|
||||
|
||||
save()
|
||||
}
|
||||
}
|
||||
|
||||
function deleteRec(rec: any)
|
||||
{
|
||||
deleted(rec)
|
||||
}
|
||||
|
||||
function save() {
|
||||
console.log('CGallery save', listobj.value)
|
||||
if (listobj.value.length > 0) {
|
||||
emit('showandsave', listobj.value)
|
||||
} else {
|
||||
emit('showandsave', [])
|
||||
}
|
||||
}
|
||||
|
||||
function close() {
|
||||
return ''
|
||||
}
|
||||
|
||||
onMounted(created)
|
||||
|
||||
return {
|
||||
getlist,
|
||||
getclass,
|
||||
getclimg,
|
||||
deleteRec,
|
||||
tools,
|
||||
listobj,
|
||||
getnumimages,
|
||||
apri,
|
||||
displayGall,
|
||||
save,
|
||||
maximizedToggle,
|
||||
close,
|
||||
isListImgValid,
|
||||
costanti,
|
||||
shared_consts,
|
||||
}
|
||||
}
|
||||
})
|
||||
30
src/components/CAccomodation/CAccomodation.vue
Executable file
30
src/components/CAccomodation/CAccomodation.vue
Executable file
@@ -0,0 +1,30 @@
|
||||
<template>
|
||||
<!--<div class="q-pa-md items-start " style="display: inline-flex; width: 800px;"> -->
|
||||
1) Accom:
|
||||
<div v-for="(myaccom, index) in getlist()" :key="index">
|
||||
myaccom: {{ myaccom}}
|
||||
|
||||
<CMySelect
|
||||
:label="$t('hosps.accomodation.type')" v-model:value="myaccom.type"
|
||||
optval="value"
|
||||
optlab="label"
|
||||
:options="shared_consts.TypeAccom" :useinput="false">
|
||||
</CMySelect>
|
||||
|
||||
<CMySelect
|
||||
:label="$t('hosps.accomodation.location')" v-model:value="myaccom.location"
|
||||
optval="value"
|
||||
optlab="label"
|
||||
:options="shared_consts.LocationAccom" :useinput="false">
|
||||
</CMySelect>
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./CAccomodation.ts">
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './CAccomodation.scss';
|
||||
</style>
|
||||
1
src/components/CAccomodation/index.ts
Executable file
1
src/components/CAccomodation/index.ts
Executable file
@@ -0,0 +1 @@
|
||||
export {default as CAccomodation} from './CAccomodation.vue'
|
||||
@@ -555,39 +555,28 @@ export default defineComponent({
|
||||
tablesel: 'cities',
|
||||
},
|
||||
{
|
||||
label: 'Data Inizio',
|
||||
table: 'caldate',
|
||||
key: 'dateTimeStart',
|
||||
value: 2,
|
||||
arrvalue: [],
|
||||
label: 'Tipologia',
|
||||
table: toolsext.TABTYPEHOSP,
|
||||
key: 'typeHosp',
|
||||
type: costanti.FieldType.select,
|
||||
value: tools.getCookie(tools.COOK_SEARCH + 'typeHosp', costanti.FILTER_TUTTI),
|
||||
addall: true,
|
||||
arrvalue: [],
|
||||
filter: null,
|
||||
useinput: false,
|
||||
icon: 'flag',
|
||||
},
|
||||
{
|
||||
label: 'Settore',
|
||||
table: toolsext.TABSECTORS,
|
||||
key: 'idSector',
|
||||
value: tools.getCookie(tools.COOK_SEARCH + toolsext.TABSECTORS, 0),
|
||||
arrvalue: [],
|
||||
label: 'Numero Massimo di Ospiti',
|
||||
table: toolsext.TABPEOPLE,
|
||||
key: 'numMaxPeopleHosp',
|
||||
type: costanti.FieldType.select,
|
||||
value: tools.getCookie(tools.COOK_SEARCH + 'numMaxPeopleHosp', costanti.FILTER_TUTTI),
|
||||
addall: true,
|
||||
arrvalue: [],
|
||||
filter: null,
|
||||
addall: true,
|
||||
notinsearch: true,
|
||||
useinput: false,
|
||||
},
|
||||
{
|
||||
label: 'Categoria',
|
||||
table: 'skills',
|
||||
key: 'idSkill',
|
||||
value: tools.getCookie(tools.COOK_SEARCH + 'skills' + '_' + tools.getCookie(tools.COOK_SEARCH + toolsext.TABSECTORS, costanti.FILTER_TUTTI), costanti.FILTER_TUTTI),
|
||||
arrvalue: [],
|
||||
type: costanti.FieldType.select,
|
||||
addall: true,
|
||||
filter: getFilterSkills,
|
||||
showcount: true,
|
||||
useinput: false,
|
||||
icon: 'flag',
|
||||
},
|
||||
{
|
||||
label: 'In cambio di',
|
||||
@@ -1046,29 +1035,20 @@ export default defineComponent({
|
||||
af_objId_tab: 'myId',
|
||||
},
|
||||
lookup2: {
|
||||
lk_tab: 'skills',
|
||||
lk_LF: 'idSkill',
|
||||
lk_tab: 'cities',
|
||||
lk_LF: 'idCity',
|
||||
lk_FF: '_id',
|
||||
lk_as: 'recSkill',
|
||||
lk_as: 'mycities',
|
||||
af_objId_tab: '',
|
||||
lk_proj: {
|
||||
recSkill: 1,
|
||||
sector: 1,
|
||||
idSector: 1,
|
||||
idSkill: 1,
|
||||
// idSubSkill: 1,
|
||||
myskill: 1,
|
||||
idStatusSkill: 1,
|
||||
typeHosp: 1,
|
||||
numMaxPeopleHosp: 1,
|
||||
accomodation: 1,
|
||||
preferences: 1,
|
||||
idContribType: 1,
|
||||
idCity: 1,
|
||||
dateTimeStart: 1,
|
||||
dateTimeEnd: 1,
|
||||
numLevel: 1,
|
||||
adType: 1,
|
||||
photos: 1,
|
||||
note: 1,
|
||||
website: 1,
|
||||
//**ADDFIELD_MYSKILL
|
||||
descr: 1,
|
||||
date_created: 1,
|
||||
date_updated: 1,
|
||||
@@ -1082,20 +1062,6 @@ export default defineComponent({
|
||||
'profile.qualifica': 1,
|
||||
}
|
||||
},
|
||||
lookup3: {
|
||||
lk_tab: toolsext.TABSECTORS,
|
||||
lk_LF: 'recSkill.idSector',
|
||||
lk_FF: '_id',
|
||||
lk_as: 'sector',
|
||||
af_objId_tab: '',
|
||||
},
|
||||
lookup5: {
|
||||
lk_tab: 'cities',
|
||||
lk_LF: 'idCity',
|
||||
lk_FF: '_id',
|
||||
lk_as: 'mycities',
|
||||
af_objId_tab: '',
|
||||
},
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
@@ -1202,7 +1202,7 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
function visuIntestazCol(col: IColGridTable) {
|
||||
if (col.fieldtype === costanti.FieldType.html || col.fieldtype === costanti.FieldType.listimages || col.noshowlabel) {
|
||||
if (col.fieldtype === costanti.FieldType.html || col.fieldtype === costanti.FieldType.listimages || col.fieldtype === costanti.FieldType.listobj || col.noshowlabel) {
|
||||
return false
|
||||
} else {
|
||||
return true
|
||||
|
||||
@@ -12,6 +12,7 @@ import { CMyToggleList } from '../CMyToggleList'
|
||||
import { CMySelect } from '../CMySelect'
|
||||
import { CMyEditor } from '../CMyEditor'
|
||||
import { CGallery } from '../CGallery'
|
||||
import { CAccomodation } from '../CAccomodation'
|
||||
import { tools } from '@store/Modules/tools'
|
||||
import { costanti } from '@costanti'
|
||||
|
||||
@@ -174,7 +175,7 @@ export default defineComponent({
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
components: { CMyChipList, CDateTime, CDate, CMyToggleList, CMySelect, CMyEditor, CGallery, CLabel },
|
||||
components: { CMyChipList, CDateTime, CDate, CMyToggleList, CMySelect, CMyEditor, CGallery, CLabel, CAccomodation },
|
||||
setup(props, { emit }) {
|
||||
const $q = useQuasar()
|
||||
const { t } = useI18n()
|
||||
@@ -671,6 +672,7 @@ export default defineComponent({
|
||||
return (mycol.fieldtype !== costanti.FieldType.html
|
||||
&& mycol.fieldtype !== costanti.FieldType.image
|
||||
&& mycol.fieldtype !== costanti.FieldType.listimages
|
||||
&& mycol.fieldtype !== costanti.FieldType.listobj
|
||||
&& mycol.fieldtype !== costanti.FieldType.number
|
||||
)
|
||||
}
|
||||
|
||||
@@ -179,6 +179,15 @@
|
||||
@showandsave="Savedb">
|
||||
</CGallery>
|
||||
</div>
|
||||
<div v-else-if="col.fieldtype === costanti.FieldType.listobj" style="text-align: center;">
|
||||
<CAccomodation
|
||||
:mylist="myvalue"
|
||||
:isInModif="isInModif"
|
||||
:edit="isviewfield() && isInModif"
|
||||
:canModify="canModify && isInModif"
|
||||
@showandsave="Savedb">
|
||||
</CAccomodation>
|
||||
</div>
|
||||
<div v-else-if="col.fieldtype === costanti.FieldType.image">
|
||||
<div v-if="canEdit">
|
||||
{{ $t('reg.photo') }}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<!--suppress ALL -->
|
||||
<template>
|
||||
<div class="q-py-xs centermydiv cardrec" :style="`max-width: `+ (tools.getwidth($q) - 20) +`px; ` + ($q.screen.lt.sm ? (`min-width: `+ (tools.getwidth($q) - 20) +`px;`) : ``)">
|
||||
|
||||
|
||||
@@ -50,4 +50,5 @@ export * from './CBigBtn'
|
||||
export * from './CMyRecCard'
|
||||
export * from './CMyRecGrpCard'
|
||||
export * from './CPresentazione'
|
||||
export * from './CAccomodation'
|
||||
// export * from './CPreloadImages'
|
||||
|
||||
Reference in New Issue
Block a user