From 171b99c34d4ca5fb5596f98063868ffb762419d9 Mon Sep 17 00:00:00 2001 From: Paolo Arena Date: Thu, 5 May 2022 23:56:23 +0200 Subject: [PATCH] Accomodations ... --- package.json | 79 +- src/common/debounce.ts | 4 +- src/common/shared_vuejs.ts | 110 + .../CAccomodation/CAccomodation.scss | 65 + src/components/CAccomodation/CAccomodation.ts | 179 + .../CAccomodation/CAccomodation.vue | 30 + src/components/CAccomodation/index.ts | 1 + src/components/CFinder/CFinder.ts | 74 +- src/components/CGridTableRec/CGridTableRec.ts | 2 +- src/components/CMyPopupEdit/CMyPopupEdit.ts | 4 +- src/components/CMyPopupEdit/CMyPopupEdit.vue | 9 + src/components/CMyRecCard/CMyRecCard.vue | 1 + src/components/index.ts | 1 + src/db/static_data.ts | 2 +- src/model/GlobalStore.ts | 20 +- src/statics/lang/it.js | 10 +- src/store/Modules/costanti.ts | 9 +- src/store/Modules/fieldsTable.ts | 171 +- src/store/Modules/tools.ts | 15 +- src/store/Modules/toolsext.ts | 5 + src/store/globalStore.ts | 4 + yarn.lock | 3868 ++++++++--------- 22 files changed, 2321 insertions(+), 2342 deletions(-) create mode 100755 src/components/CAccomodation/CAccomodation.scss create mode 100755 src/components/CAccomodation/CAccomodation.ts create mode 100755 src/components/CAccomodation/CAccomodation.vue create mode 100755 src/components/CAccomodation/index.ts diff --git a/package.json b/package.json index 2730c6c4..1e62fce8 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "riso", - "version": "0.2.10", + "version": "0.3.15", "description": "Riso", "productName": "Riso", "author": "Paolo Arena", @@ -22,43 +22,44 @@ "generate-sw": "workbox generateSW workbox-config.js" }, "dependencies": { - "@quasar/extras": "^1.12.5", + "@quasar/extras": "^1.13.6", "@quasar/quasar-ui-qcalendar": "^4.0.0-beta.13", - "@vue/compat": "^3.2.31", - "@vue/compiler-sfc": "^3.2.31", - "@vue/eslint-config-standard": "5.1.2", - "@vuelidate/core": "^2.0.0-alpha.34", - "@vuelidate/validators": "^2.0.0-alpha.26", - "acorn": "^8.7.0", - "autoprefixer": "^10.4.2", + "@vue-leaflet/vue-leaflet": "^0.6.1", + "@vue/compat": "^3.2.33", + "@vue/compiler-sfc": "^3.2.33", + "@vue/eslint-config-standard": "6.1.0", + "@vuelidate/core": "^2.0.0-alpha.41", + "@vuelidate/validators": "^2.0.0-alpha.29", + "acorn": "^8.7.1", + "autoprefixer": "^10.4.7", "axios": "^0.26.0", "bcryptjs": "^2.4.3", "chart.js": "^3.7.1", - "core-js": "^3.21.0", + "core-js": "^3.22.4", "crypto": "^1.0.1", "date-fns": "^2.28.0", - "dotenv": "^10.0.0", - "echarts": "^5.3.0", + "dotenv": "^16.0.0", + "echarts": "^5.3.2", "eslint-plugin-quasar": "^1.1.0", "eslint-plugin-standard": "^5.0.0", - "graphql": "^16.3.0", + "graphql": "^16.4.0", "graphql-tag": "^2.12.6", - "gsap": "^3.9.1", + "gsap": "^3.10.4", "jquery": "^3.6.0", "js-cookie": "^3.0.1", "localforage": "^1.10.0", "lodash": "^4.17.21", "normalize.css": "^8.0.1", - "npm": "^8.5.1", + "npm": "^8.9.0", "nprogress": "^0.2.0", - "pinia": "^2.0.11", + "pinia": "^2.0.14", "prerender-spa-plugin": "^3.4.0", - "quasar": "^2.5.5", + "quasar": "^2.6.6", "quasar-extras": "^2.0.9", "register-service-worker": "^1.7.2", - "vee-validate": "^4.5.8", - "vue": "^3.2.31", - "vue-chart-3": "^3.1.2", + "vee-validate": "^4.5.11", + "vue": "^3.2.33", + "vue-chart-3": "^3.1.8", "vue-class-component": "^8.0.0-rc.1", "vue-country-code": "^1.1.3", "vue-echarts": "^6.0.2", @@ -66,7 +67,7 @@ "vue-idb": "^0.2.0", "vue-loader": "^17.0.0", "vue-property-decorator": "^10.0.0-rc.3", - "vue-router": "^4.0.12", + "vue-router": "^4.0.15", "vue-scroll-reveal": "^1.0.11", "vue-svgicon": "^4.0.0-alpha.3", "vue2-dragula": "^2.5.5", @@ -78,42 +79,42 @@ "@types/bcryptjs": "^2.4.2", "@types/dotenv": "^8.2.0", "@types/googlemaps": "^3.43.3", - "@types/jest": "^27.4.0", - "@types/js-cookie": "^3.0.1", - "@types/node": "17.0.19", + "@types/jest": "^27.5.0", + "@types/js-cookie": "^3.0.2", + "@types/node": "17.0.31", "@types/nprogress": "^0.2.0", "@types/vue-tel-input": "^2.1.2", "@types/vuelidate": "^0.7.15", - "@typescript-eslint/eslint-plugin": "^5.12.0", - "@typescript-eslint/parser": "^5.12.0", - "eslint": "^8.9.0", - "eslint-config-prettier": "^8.3.0", - "eslint-plugin-import": "^2.25.4", + "@typescript-eslint/eslint-plugin": "^5.22.0", + "@typescript-eslint/parser": "^5.22.0", + "eslint": "^8.14.0", + "eslint-config-prettier": "^8.5.0", + "eslint-plugin-import": "^2.26.0", "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^6.0.0", - "eslint-plugin-vue": "^8.4.1", + "eslint-plugin-vue": "^8.7.1", "file-loader": "^6.2.0", "html-webpack-plugin": "^5.5.0", - "http-proxy-middleware": "^2.0.3", - "jest": "^27.5.1", + "http-proxy-middleware": "^2.0.6", + "jest": "^28.0.3", "json-loader": "^0.5.7", - "node-sass": "6.0.1", - "npm-check-updates": "^12.4.0", + "node-sass": "7.0.1", + "npm-check-updates": "^12.5.11", "optimize-css-assets-webpack-plugin": "^6.0.1", - "postcss": "^8.4.6", + "postcss": "^8.4.13", "postcss-loader": "^6.2.1", "sass-loader": "^12.6.0", "strip-ansi": "=7.0.1", - "ts-jest": "^27.1.3", - "ts-loader": "^9.2.6", + "ts-jest": "^28.0.1", + "ts-loader": "^9.3.0", "tslint": "^6.1.3", "tslint-config-standard": "^9.0.0", "tslint-loader": "^3.5.4", - "typescript": "^4.5.4", + "typescript": "^4.6.4", "vue-cli-plugin-element-ui": "^1.1.4", "vueify": "^9.4.1", "webpack": "^5.0.0", - "workbox-webpack-plugin": "^6.4.2" + "workbox-webpack-plugin": "^6.5.3" }, "browser": { "crypto": false diff --git a/src/common/debounce.ts b/src/common/debounce.ts index 3535e1bc..5128c0b7 100755 --- a/src/common/debounce.ts +++ b/src/common/debounce.ts @@ -39,7 +39,7 @@ export function Debounce(func: Function, wait?: number, immediate?: boolean) { } } - return function a2() { + /*return function a2() { // @ts-ignore context = this // @ts-ignore @@ -55,5 +55,5 @@ export function Debounce(func: Function, wait?: number, immediate?: boolean) { } return result - } + }*/ } diff --git a/src/common/shared_vuejs.ts b/src/common/shared_vuejs.ts index d2839e37..3d05aa3f 100755 --- a/src/common/shared_vuejs.ts +++ b/src/common/shared_vuejs.ts @@ -195,6 +195,116 @@ export const shared_consts = { }, ], + TypeHosps: [ + { + value: 1, + label: 'Scambio Casa', + }, + { + value: 2, + label: 'Ospitalità', + } + ], + + TypeAccom: [ + { + value: 1, + label: 'Letto matrimoniale', + }, + { + value: 2, + label: 'Letto singolo', + }, + { + value: 3, + label: 'Divano-letto', + }, + ], + + LocationAccom: [ + { + value: 1, + label: 'Camera Privata', + }, + { + value: 2, + label: 'Camera Condivisa', + }, + { + value: 3, + label: 'Soggiorno', + }, + ], + + + + People: [ + { + value: 0, + label: 'Nessuna', + }, + { + value: 1, + label: '1', + }, + { + value: 2, + label: '2', + }, + { + value: 3, + label: '3', + }, + { + value: 4, + label: '4', + }, + { + value: 5, + label: '5', + }, + { + value: 6, + label: '6', + }, + { + value: 7, + label: '7', + }, + { + value: 8, + label: '8', + }, + { + value: 9, + label: '9', + }, + { + value: 10, + label: '10', + }, + { + value: 11, + label: '11', + }, + { + value: 12, + label: '12', + }, + { + value: 13, + label: '13', + }, + { + value: 14, + label: '14', + }, + { + value: 15, + label: '15', + }, + ], + Regions: [ { value: 'ABR', diff --git a/src/components/CAccomodation/CAccomodation.scss b/src/components/CAccomodation/CAccomodation.scss new file mode 100755 index 00000000..0e7557e9 --- /dev/null +++ b/src/components/CAccomodation/CAccomodation.scss @@ -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; +} diff --git a/src/components/CAccomodation/CAccomodation.ts b/src/components/CAccomodation/CAccomodation.ts new file mode 100755 index 00000000..c495514e --- /dev/null +++ b/src/components/CAccomodation/CAccomodation.ts @@ -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, + 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([]) + 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, + } + } +}) diff --git a/src/components/CAccomodation/CAccomodation.vue b/src/components/CAccomodation/CAccomodation.vue new file mode 100755 index 00000000..5ed35a60 --- /dev/null +++ b/src/components/CAccomodation/CAccomodation.vue @@ -0,0 +1,30 @@ + + + + + diff --git a/src/components/CAccomodation/index.ts b/src/components/CAccomodation/index.ts new file mode 100755 index 00000000..4aadb62d --- /dev/null +++ b/src/components/CAccomodation/index.ts @@ -0,0 +1 @@ +export {default as CAccomodation} from './CAccomodation.vue' diff --git a/src/components/CFinder/CFinder.ts b/src/components/CFinder/CFinder.ts index a2828450..e60f56cc 100755 --- a/src/components/CFinder/CFinder.ts +++ b/src/components/CFinder/CFinder.ts @@ -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 { diff --git a/src/components/CGridTableRec/CGridTableRec.ts b/src/components/CGridTableRec/CGridTableRec.ts index b9cc3df6..9fc87e62 100755 --- a/src/components/CGridTableRec/CGridTableRec.ts +++ b/src/components/CGridTableRec/CGridTableRec.ts @@ -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 diff --git a/src/components/CMyPopupEdit/CMyPopupEdit.ts b/src/components/CMyPopupEdit/CMyPopupEdit.ts index af9d15b8..b1915fac 100755 --- a/src/components/CMyPopupEdit/CMyPopupEdit.ts +++ b/src/components/CMyPopupEdit/CMyPopupEdit.ts @@ -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 ) } diff --git a/src/components/CMyPopupEdit/CMyPopupEdit.vue b/src/components/CMyPopupEdit/CMyPopupEdit.vue index 8d447f79..7786c4b8 100755 --- a/src/components/CMyPopupEdit/CMyPopupEdit.vue +++ b/src/components/CMyPopupEdit/CMyPopupEdit.vue @@ -179,6 +179,15 @@ @showandsave="Savedb"> +
+ + +
{{ $t('reg.photo') }} diff --git a/src/components/CMyRecCard/CMyRecCard.vue b/src/components/CMyRecCard/CMyRecCard.vue index bf9ac615..dc09397c 100755 --- a/src/components/CMyRecCard/CMyRecCard.vue +++ b/src/components/CMyRecCard/CMyRecCard.vue @@ -1,3 +1,4 @@ +