- Import emails from a list to a DB

- Create Template Emails
- Options Email
This commit is contained in:
Paolo Arena
2019-12-04 02:05:08 +01:00
parent 8268a09897
commit 6f2e4f891e
8 changed files with 314 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
.colmodif {
cursor: pointer;
}
.colmodif:hover {
background-color: #a8f0ff;
cursor: pointer;
}
.colsel {
background-color: #81b8ff;
}
.cldisable{
color: gray !important;
}

View File

@@ -0,0 +1,101 @@
import { Component, Prop, Watch } from 'vue-property-decorator'
import { tools } from '../../store/Modules/tools'
import { toolsext } from '@src/store/Modules/toolsext'
import { QEditor } from 'quasar'
import { CMyEditor } from '../CMyEditor'
import MixinBase from '../../mixins/mixin-base'
import { fieldsTable } from '../../store/Modules/fieldsTable'
import { IColGridTable } from '../../model'
import { CMySelect } from '../CMySelect'
@Component({
name: 'CMyFieldDb',
components: { CMyEditor, CMySelect }
})
export default class CMyFieldDb extends MixinBase {
@Prop({ required: true }) public title
@Prop({ required: true }) public mykey: string
@Prop({ required: true }) public type: number
@Prop({ required: false, default: false }) public serv: boolean
@Prop({ required: false, default: false }) public disable: boolean
@Prop({ required: false, default: '' }) public jointable: string
public $t
public myvalue = ''
public col: IColGridTable = { name: 'test' }
public canEdit: boolean = true
public created() {
this.myvalue = this.getValDb(this.mykey, this.serv)
this.col.jointable = this.jointable
this.col.fieldtype = this.type
this.col.label = this.title
// console.log('created', this.myvalue)
}
public visuValByType(val) {
if (this.col.fieldtype === tools.FieldType.date) {
if (val === undefined) {
return '[]'
} else {
return tools.getstrDateTime(val)
}
} else if (this.col.fieldtype === tools.FieldType.boolean) {
return (val) ? this.$t('dialog.yes') : this.$t('dialog.no')
} else if (this.col.fieldtype === tools.FieldType.binary) {
if (val === undefined)
return '[---]'
else
return fieldsTable.getArrStrByValueBinary(this, this.col, val)
} else if (this.col.fieldtype === tools.FieldType.select) {
if (val === undefined)
return '[---]'
else
return fieldsTable.getValueByTable(this.col, val)
} else if (this.col.fieldtype === tools.FieldType.multiselect) {
if (val === undefined)
return '[---]'
else
return fieldsTable.getMultiValueByTable(this.col, val)
} else if (this.col.fieldtype === tools.FieldType.password) {
if (val === undefined)
return '[---]'
else
return '***************'
} else {
if (val === undefined)
return '-'
else if (val === '') {
return '-'
} else {
let mystr = tools.firstchars(val, 5000)
if (val) {
if (val.length > 5000)
mystr += '...'
} else {
return val
}
return mystr
}
}
}
get mycl() {
if (this.disable) {
return 'cldisable'
}
}
get myvalprinted() {
return this.visuValByType(this.myvalue)
}
public savefield(value, initialval) {
this.myvalue = value
this.setValDb(this.mykey, this.myvalue, this.type, this.serv)
}
}

View File

@@ -0,0 +1,147 @@
<template>
<div class="text-center">
<div class="row items-center justify-center q-gutter-md q-ma-xs">
<div class="q-ma-xs">
<q-field rounded outlined bg-color="orange-3" dense>
<template v-slot:control>
<div class="self-center full-width no-outline" tabindex="0">{{title}}</div>
</template>
</q-field>
</div>
<div class="q-ma-sm q-pa-sm colmodif col-grow rounded-borders " style="border: 1px solid #bbb">
<div v-if="type === tools.FieldType.date">
<CDateTime
:label="col.label"
class="cursor-pointer"
:value.sync="myvalue"
:readonly="false"
:dense="true"
:canEdit="canEdit"
>
</CDateTime>
</div>
<div v-else :class="mycl">
<div v-if="type === tools.FieldType.binary">
<CMyChipList
:type="tools.FieldType.binary"
: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-if="type === tools.FieldType.multiselect">
<CMyChipList
:type="tools.FieldType.multiselect"
: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>
<div v-else-if="type === tools.FieldType.html">
<div v-html="myvalprinted">
</div>
</div>
<div v-else-if="type === tools.FieldType.boolean">
<q-toggle dark color="green" v-model="myvalue" :label="col.title"
@input="savefield"></q-toggle>
</div>
<div v-else>
{{ myvalprinted }}
</div>
<q-popup-edit
v-if="canEdit && type !== tools.FieldType.boolean"
v-model="myvalue"
:disable="col.disable"
:title="col.title"
@save="savefield"
buttons
>
<div v-if="type === tools.FieldType.boolean">
<q-checkbox v-model="myvalue" :label="col.title">
</q-checkbox>
{{ visuValByType(myvalue) }}
</div>
<div v-else-if="type === tools.FieldType.string">
<q-input v-model="myvalue"
autogrow
@keyup.enter.stop
autofocus>
</q-input>
</div>
<div v-else-if="type === tools.FieldType.password">
<q-input v-model="myvalue"
type="password"
@keyup.enter.stop
autofocus>
</q-input>
</div>
<div v-else-if="type === tools.FieldType.number">
<q-input v-model="myvalue" type="number"
autofocus>
</q-input>
</div>
<div v-else-if="type === 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="type === tools.FieldType.html">
<CMyEditor :value.sync="myvalue" :title="title" @keyup.enter.stop>
</CMyEditor>
</div>
<div v-else-if="type === 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>
<div v-else-if="type === tools.FieldType.multiselect">
<q-select
v-model="myvalue"
rounded
outlined
multiple
dense
options-dense
:display-value="db_fieldsTable.getTitleByTable(col.jointable)"
emit-value
map-options
:options="db_fieldsTable.getTableJoinByName(col.jointable)"
:option-label="db_fieldsTable.getLabelByTable(col.jointable)"
:option-value="db_fieldsTable.getKeyByTable(col.jointable)"
style="min-width: 150px"
>
</q-select>
</div>
</q-popup-edit>
</div>
</div>
</div>
</div>
</template>
<script lang="ts" src="./CMyFieldDb.ts">
</script>
<style lang="scss" scoped>
@import './CMyFieldDb.scss';
</style>

View File

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

View File

@@ -0,0 +1,31 @@
import Vue from 'vue'
import { Component, Prop } from 'vue-property-decorator'
import { GlobalStore, UserStore } from '@store'
import VueScrollReveal from 'vue-scroll-reveal'
import { tools } from '@src/store/Modules/tools'
import { toolsext } from '@src/store/Modules/toolsext'
import { Screen } from 'quasar'
// Vue.use(VueScrollReveal, {
// class: 'v-scroll-reveal', // A CSS class applied to elements with the v-scroll-reveal directive; useful for animation overrides.
// duration: 1200,
// scale: 0.95,
// distance: '10px',
// rotate: {
// x: 0,
// y: 0,
// z: 0
// }
// // mobile: true
// })
@Component({
name: 'CTitleBanner'
})
export default class CTitleBanner extends Vue {
@Prop({ required: true}) public title: string
@Prop({ required: false, default: 'bg-primary' }) public bgcolor: string
@Prop({ required: false, default: 'primary' }) public color: string
}

View File

@@ -0,0 +1,16 @@
<template>
<div>
<q-banner
class="q-my-md"
rounded dense :class="bgcolor+` text-white`"
:color="color+` q-title`" style="text-align: center;">
<span class="mybanner">{{title}}</span>
</q-banner>
</div>
</template>
<script lang="ts" src="./CTitleBanner.ts">
</script>
<style lang="scss" scoped>
@import './CTitleBanner.scss';
</style>

View File

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