- Add Button Whatsapp Chat

- Fixed 'Ask Info' and 'Book' if the email arrived...
- Added "Settings" table: URL_FACEBOOK, TELEGRAM_SUPPORT, URL_INSTAGRAM, WHATSAPP_CELL, INT_CODE, MAIN_EMAIL, CONTACTS_EMAIL_CELL, CALL_WORKING_DAYS, EVENTS_CAL, MSG_REPLY_AFTER_BOOKING.
-
This commit is contained in:
Paolo Arena
2019-11-05 23:53:18 +01:00
parent b27f7e3cbf
commit 571e948d39
16 changed files with 467 additions and 16 deletions

View File

@@ -0,0 +1,138 @@
import Vue from 'vue'
import { Component, Prop } from 'vue-property-decorator'
import { tools } from '../../store/Modules/tools'
import { toolsext } from '@src/store/Modules/toolsext'
import { IColGridTable } from '../../model'
import { fieldsTable } from '../../store/Modules/fieldsTable'
import { CMyChipList } from '../CMyChipList'
import { CDateTime } from '../CDateTime'
import { CMyToggleList } from '../CMyToggleList'
import { CMySelect } from '../CMySelect'
@Component({
name: 'CMyPopupEdit',
components: {CMyChipList, CDateTime, CMyToggleList, CMySelect}
})
export default class CMyPopupEdit extends Vue {
@Prop({ required: true }) public row
@Prop({ required: true }) public col
@Prop({ required: false, default: false }) public canEdit
@Prop({ required: false, default: '' }) public field
@Prop({ required: false, default: '' }) public subfield
public myvalue = ''
get tools() {
return tools
}
get db_fieldsTable() {
return fieldsTable
}
public changeval(newval) {
this.$emit('update:row', newval)
}
public mounted() {
if ((this.subfield !== '') && (this.subfield !== '')) {
if (this.row[this.field] === undefined) {
this.row[this.field] = {}
this.myvalue = ''
} else {
this.myvalue = this.row[this.field][this.subfield]
}
} else {
if (this.field !== '')
this.myvalue = this.row[this.field]
else
this.myvalue = this.row
}
}
public OpenEdit() {
console.log('OpenEdit')
this.$emit('show')
}
public SaveValueInt(newVal, valinitial) {
console.log('SaveValueInt', newVal)
// Update value in table memory
if (this.subfield !== '') {
if (this.row[this.field] === undefined)
this.row[this.field] = {}
this.row[this.field][this.subfield] = newVal
} else {
if (this.field !== '')
this.row[this.field] = newVal
else
this.row = newVal
}
this.$emit('save', newVal, valinitial)
}
public visuValByType(val, col: IColGridTable, row) {
if (col === undefined || row === undefined)
return
// let val = ''
// if (col.subfield !== '') {
// if (row[col.field] === undefined)
// row[col.field] = {}
//
// val = row[col.field][col.subfield]
// } else {
// val = row[col.field]
// }
//
if (col.fieldtype === tools.FieldType.date) {
if (val === undefined) {
return '[]'
} else {
return tools.getstrDateTime(val)
}
} else if (col.fieldtype === tools.FieldType.boolean) {
return (val) ? this.$t('dialog.yes') : this.$t('dialog.no')
} else if (col.fieldtype === tools.FieldType.binary) {
if (val === undefined)
return '[---]'
else
return fieldsTable.getArrStrByValueBinary(this, col, val)
} else if (col.fieldtype === tools.FieldType.select) {
if (val === undefined)
return '[---]'
else
return fieldsTable.getValueByTable(col, val)
} else {
if (val === undefined)
return '[]'
else if (val === '') {
return '[]'
} else {
let mystr = tools.firstchars(val, tools.MAX_CHARACTERS)
if (val) {
if (val.length > tools.MAX_CHARACTERS)
mystr += '...'
} else {
return val
}
return mystr
}
}
}
public getclassCol(col) {
if (col) {
let mycl = (col.disable || !this.canEdit) ? '' : 'colmodif'
mycl += (col.fieldtype === tools.FieldType.date) ? ' coldate flex flex-container' : ''
return mycl
} else {
return ''
}
}
}

View File

@@ -0,0 +1,103 @@
<template>
<div :class="getclassCol(col)">
<div v-if="col.fieldtype === tools.FieldType.date">
<CDateTime
:label="col.label"
class="cursor-pointer"
:valueDate="myvalue"
:readonly="false"
:dense="true"
:canEdit="canEdit"
@savetoclose="SaveValueInt"
@show="OpenEdit">
</CDateTime>
</div>
<div v-else>
<div v-if="col.fieldtype === tools.FieldType.binary">
<CMyChipList
:value="myvalue"
:options="db_fieldsTable.getTableJoinByName(col.jointable)"
:optval="db_fieldsTable.getKeyByTable(col.jointable)"
:optlab="db_fieldsTable.getLabelByTable(col.jointable)"
:opticon="db_fieldsTable.getIconByTable(col.jointable)"></CMyChipList>
</div>
<!-- Show Value -->
<div v-else>
{{ visuValByType(myvalue, col, row) }}
</div>
<!--<q-select v-model="myvalue"-->
<!--rounded-->
<!--outlined-->
<!--dense-->
<!--:options="db_fieldsTable.getTableJoinByName(col.jointable)"-->
<!--:display-value="db_fieldsTable.getLabelByTable(col.jointable)"-->
<!--emit-value-->
<!--@input="SaveValueInt"-->
<!--&gt;-->
<!--</q-select>-->
<!-- Edit Value -->
<q-popup-edit
v-if="canEdit"
v-model="myvalue"
:disable="col.disable"
:title="col.title"
buttons
@save="SaveValueInt"
@show="OpenEdit">
<div v-if="col.fieldtype === tools.FieldType.boolean">
<q-checkbox v-model="myvalue" :label="col.title">
</q-checkbox>
{{ visuValByType(myvalue, col, row) }}
</div>
<div v-else-if="col.fieldtype === tools.FieldType.string">
<q-input v-model="myvalue"
autogrow
autofocus>
</q-input>
</div>
<div v-else-if="col.fieldtype === tools.FieldType.number">
<q-input v-model="myvalue" type="number"
autofocus>
</q-input>
</div>
<div v-else-if="col.fieldtype === tools.FieldType.binary">
<CMyToggleList :label="col.title"
:options="db_fieldsTable.getTableJoinByName(col.jointable)"
:value.sync="myvalue"
:optval="db_fieldsTable.getKeyByTable(col.jointable)"
:optlab="db_fieldsTable.getLabelByTable(col.jointable)">
</CMyToggleList>
</div>
<div v-else-if="col.fieldtype === tools.FieldType.html">
<q-input v-model="myvalue"
autofocus
@keyup.enter.stop
type="textarea"></q-input>
</div>
<div v-else-if="col.fieldtype === tools.FieldType.select">
<CMySelect :label="col.title"
:value.sync="myvalue"
:optval="db_fieldsTable.getKeyByTable(col.jointable)"
:optlab="db_fieldsTable.getLabelByTable(col.jointable)"
:options="db_fieldsTable.getTableJoinByName(col.jointable)"
:useinput="false">
</CMySelect>
</div>
</q-popup-edit>
</div>
</div>
</template>
<script lang="ts" src="./CMyPopupEdit.ts">
</script>
<style lang="scss" scoped>
@import './CMyPopupEdit.scss';
</style>

View File

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