- Import emails from a list to a DB

- Create Template Emails
- Options Email
This commit is contained in:
Paolo Arena
2019-12-04 02:04:54 +01:00
parent 895df43074
commit 8268a09897
20 changed files with 619 additions and 165 deletions

View File

@@ -61,7 +61,7 @@ export default class CDateTime extends Vue {
public changevalueDate() {
if (this.valueDate)
this.myvalue = tools.getstrYYMMDDDateTime(this.valueDate)
console.log('changevalueDate myvalue', this.myvalue)
// console.log('changevalueDate myvalue', this.myvalue)
}
@Watch('value')
public changevalue() {
@@ -72,7 +72,7 @@ export default class CDateTime extends Vue {
public savetoclose() {
this.saveit = true
this.showDateTimeScroller = false
this.$emit('savetoclose', this.myvalue, this.valueprec)
// this.$emit('savetoclose', this.myvalue, this.valueprec)
}
get scrollerPopupStyle280() {

View File

@@ -12,13 +12,14 @@ import { lists } from '../../store/Modules/lists'
import { IParamsQuery } from '../../model/GlobalStore'
import { fieldsTable } from '../../store/Modules/fieldsTable'
import { CMyPopupEdit } from '../CMyPopupEdit'
import { CTitleBanner } from '../CTitleBanner'
@Component({
components: { CMyPopupEdit }
components: { CMyPopupEdit, CTitleBanner }
})
export default class CGridTableRec extends Vue {
@Prop({ required: false }) public prop_mytable: string
@Prop({ required: true }) public prop_mytitle: string
@Prop({ required: false }) public prop_mytable: string
@Prop({ required: false, default: null }) public prop_mycolumns: any[]
@Prop({ required: false, default: '' }) public prop_colkey: string
@Prop({ required: false, default: '' }) public nodataLabel: string
@@ -52,7 +53,7 @@ export default class CGridTableRec extends Vue {
public valPrec: string = ''
public separator: 'horizontal'
public filter = undefined
public myfilter = undefined
public rowsel: any
public dark: boolean = true
public canEdit: boolean = false
@@ -62,6 +63,11 @@ export default class CGridTableRec extends Vue {
public colVisib: any[] = []
public colExtra: any[] = []
public rowclicksel: any = null
public colclicksel: any = null
public selected: any = []
get lists() {
return lists
}
@@ -96,16 +102,36 @@ export default class CGridTableRec extends Vue {
}
public SaveValdb(newVal, valinitial) {
// console.log('SaveValdb', newVal)
// console.log('SaveValue', newVal, 'rowsel', this.rowsel)
this.colsel = this.colclicksel
// console.log('this.colsel', this.colsel)
this.SaveValue(newVal, valinitial)
this.colsel = null
}
public showandsel(row, col, newval, valinitial) {
// console.log('showandsel', row, col, newval)
this.rowsel = row
this.colsel = col
this.idsel = row._id
this.SaveValue(newval, valinitial)
}
public SaveValue(newVal, valinitial) {
// console.log('SaveValue', newVal, 'rowsel', this.rowsel)
// Update value in table memory
if (this.colsel.subfield !== '') {
if (this.rowsel[this.colsel.field] === undefined)
this.rowsel[this.colsel.field] = {}
this.rowsel[this.colsel.field][this.colsel.subfield] = newVal
} else {
this.rowsel[this.colsel.field] = newVal
if (this.colsel) {
// Update value in table memory
if (this.colsel.subfield !== '') {
if (this.rowsel[this.colsel.field] === undefined)
this.rowsel[this.colsel.field] = {}
this.rowsel[this.colsel.field][this.colsel.subfield] = newVal
} else {
this.rowsel[this.colsel.field] = newVal
}
}
const mydata = {
@@ -140,7 +166,7 @@ export default class CGridTableRec extends Vue {
}
public updatedcol() {
console.log('updatedcol')
// console.log('updatedcol')
if (this.mycolumns) {
this.colVisib = []
this.colExtra = []
@@ -160,9 +186,9 @@ export default class CGridTableRec extends Vue {
}
public onRequest(props) {
console.log('onRequest', 'filter = ' , this.filter)
console.log('onRequest', 'myfilter = ', this.myfilter)
const { page, rowsPerPage, rowsNumber, sortBy, descending } = props.pagination
const filter = this.filter
const myfilter = this.myfilter
if (!this.mytable)
return
@@ -185,9 +211,9 @@ export default class CGridTableRec extends Vue {
this.serverData = []
// fetch data from "server"
this.fetchFromServer(startRow, endRow, filter, sortBy, descending).then((ris) => {
this.fetchFromServer(startRow, endRow, myfilter, sortBy, descending).then((ris) => {
this.pagination.rowsNumber = this.getRowsNumberCount(filter)
this.pagination.rowsNumber = this.getRowsNumberCount(myfilter)
// clear out existing data and add new
if (this.returnedData === []) {
@@ -215,7 +241,7 @@ export default class CGridTableRec extends Vue {
// emulate ajax call
// SELECT * FROM ... WHERE...LIMIT...
public async fetchFromServer(startRow, endRow, filter, sortBy, descending) {
public async fetchFromServer(startRow, endRow, myfilter, sortBy, descending) {
let myobj = null
if (sortBy) {
@@ -230,7 +256,7 @@ export default class CGridTableRec extends Vue {
table: this.mytable,
startRow,
endRow,
filter,
filter: myfilter,
sortBy: myobj,
descending
}
@@ -247,15 +273,15 @@ export default class CGridTableRec extends Vue {
return true
// if (!filter) {
// if (!myfilter) {
// data = this.original.slice(startRow, startRow + count)
// }
// else {
// let found = 0
// for (let index = startRow, items = 0; index < this.original.length && items < count; ++index) {
// let row = this.original[index]
// // match filter?
// if (!row['name'].includes(filter)) {
// // match myfilter?
// if (!row['name'].includes(myfilter)) {
// // get a different row, until one is found
// continue
// }
@@ -285,14 +311,14 @@ export default class CGridTableRec extends Vue {
}
// emulate 'SELECT count(*) FROM ...WHERE...'
public getRowsNumberCount(filter) {
public getRowsNumberCount(myfilter) {
// if (!filter) {
// if (!myfilter) {
// return this.original.length
// }
// let count = 0
// this.original.forEach((treat) => {
// if (treat['name'].includes(filter)) {
// if (treat['name'].includes(myfilter)) {
// ++count
// }
// })
@@ -337,9 +363,11 @@ export default class CGridTableRec extends Vue {
public mounted() {
this.canEdit = tools.getCookie(tools.CAN_EDIT, this.canEdit) === 'true'
if (!!this.tablesList) {
this.canEdit = tools.getCookie(tools.CAN_EDIT, this.canEdit) === 'true'
this.tablesel = tools.getCookie('tablesel', this.tablesel)
}
this.tablesel = tools.getCookie('tablesel', this.tablesel)
if (this.tablesel === '') {
if (!!this.tablesList)
this.tablesel = this.tablesList[0].value
@@ -357,11 +385,11 @@ export default class CGridTableRec extends Vue {
console.log('refresh')
// console.log('this.search', this.search)
if (!!this.search && this.search !== '')
this.filter = this.search
this.myfilter = this.search
else
this.filter = undefined
this.myfilter = undefined
// console.log('this.filter', this.filter)
// console.log('this.myfilter', this.myfilter)
this.refresh_table()
}
@@ -411,7 +439,9 @@ export default class CGridTableRec extends Vue {
if (this.tablesel === undefined || this.tablesel === '')
return
console.log('changeTable mysel=', mysel, 'tablesel', this.tablesel)
// console.log('changeTable mysel=', mysel, 'tablesel', this.tablesel)
// console.log('this.tablesList=')
// console.table(this.tablesList)
let mytab = null
if (this.tablesList) {
@@ -457,6 +487,11 @@ export default class CGridTableRec extends Vue {
const myselcol = tools.getCookie(this.mytable, '')
if (!!myselcol && myselcol.length > 0) {
this.colVisib = myselcol.split('|')
} else {
this.mycolumns.forEach((elem) => {
if (elem.field !== tools.NOFIELD)
this.colVisib.push(elem.field + elem.subfield)
})
}
}
@@ -479,4 +514,21 @@ export default class CGridTableRec extends Vue {
tools.setCookie(tools.CAN_EDIT, newval)
}
public clickrowcol(row, col) {
if (!this.canEdit) {
if (this.rowclicksel) {
this.rowclicksel = null
} else {
this.rowclicksel = row
this.colclicksel = col
}
}
}
public getclrow(myrow) {
if (this.rowclicksel === myrow)
return 'colsel'
else
return ''
}
}

View File

@@ -4,7 +4,7 @@
<q-table
:data="serverData"
:columns="mycolumns"
:filter="filter"
:filter="myfilter"
:pagination.sync="pagination"
:row-key="colkey"
:loading="loading"
@@ -35,7 +35,8 @@
<!--<p style="color:red"> Rows: {{ getrows }}</p>-->
<q-input v-model="search" filled dense type="search" debounce="500" hint="Search" v-on:keyup.enter="doSearch">
<q-input v-model="search" filled dense type="search" debounce="500" hint="Search"
v-on:keyup.enter="doSearch">
<template v-slot:after>
<q-btn v-if="mytable" label="" color="primary" @click="refresh" icon="search"></q-btn>
</template>
@@ -91,16 +92,20 @@
</template>
<q-tr v-if="mytable" slot="body" slot-scope="props" :props="props">
<q-td v-for="col in mycolumns" :key="col.name" :props="props" v-if="colVisib.includes(col.field + col.subfield)">
<CMyPopupEdit :canEdit="canEdit"
:col="col"
:row.sync="props.row"
:field="col.field"
:subfield="col.subfield"
@save="SaveValue"
@show="selItem(props.row, col)">
<q-td v-for="col in mycolumns" :key="col.name" :props="props"
v-if="colVisib.includes(col.field + col.subfield)" @click="clickrowcol(props.row, col)">
<div :class="getclrow(props.row)">
<CMyPopupEdit :canEdit="canEdit"
:col="col"
:row.sync="props.row"
:field="col.field"
:subfield="col.subfield"
@save="SaveValue"
@show="selItem(props.row, col)"
@showandsave="showandsel">
</CMyPopupEdit>
</CMyPopupEdit>
</div>
</q-td>
<q-td v-for="col in mycolumns" :key="col.name" :props="props" v-if="colExtra.includes(col.name)">
<div v-if="col.action && visCol(col)">
@@ -119,6 +124,38 @@
-->
<!---->
</q-table>
<div v-if="rowclicksel">
<CTitleBanner title="Record:"></CTitleBanner>
<div class="q-ma-xs q-pa-xs text-center rounded-borders q-list--bordered"
v-for="mycol in mycolumns" :key="mycol.name"
v-if="colVisib.includes(mycol.field + mycol.subfield)">
<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">{{mycol.label}}</div>
</template>
</q-field>
</div>
<div class="q-ma-sm q-pa-sm colmodif col-grow rounded-borders " style="border: 1px solid #bbb"
@click="colclicksel = mycol">
<CMyPopupEdit :canEdit="true"
:col="mycol"
:showall="true"
:row="rowclicksel"
:field="mycol.field"
:subfield="mycol.subfield"
@save="SaveValdb"
@show="selItem(rowclicksel, mycol)"
@showandsave="showandsel">
</CMyPopupEdit>
</div>
</div>
</div>
</div>
</div>
</template>
<script lang="ts" src="./CGridTableRec.ts">

View File

@@ -5,14 +5,17 @@ import { tools } from '../../store/Modules/tools'
import { toolsext } from '@src/store/Modules/toolsext'
import { QEditor } from 'quasar'
import { CTitleBanner } from '../CTitleBanner'
@Component({
name: 'CMyEditor'
name: 'CMyEditor',
components: { CTitleBanner }
})
export default class CMyEditor extends Vue {
public $q
public editor = null
@Prop({ required: false, default: '' }) public title
@Prop({ required: true }) public value
@Prop({ required: false, default: '' }) public myclass

View File

@@ -1,5 +1,6 @@
<template>
<div>
<CTitleBanner :title="title"></CTitleBanner>
<form
autocorrect="off"
autocapitalize="off"
@@ -19,9 +20,11 @@
toolbar-toggle-color="yellow-8"
toolbar-bg="primary"
:toolbar="toolbarcomp"
debounce="500"
:fonts="myfonts"
@input="changeval"
@paste.native="evt => pasteCapture(evt)"
@keyup.enter.stop
v-model="myvalue">
</q-editor>
</form>

View File

@@ -9,10 +9,11 @@ import { CMyChipList } from '../CMyChipList'
import { CDateTime } from '../CDateTime'
import { CMyToggleList } from '../CMyToggleList'
import { CMySelect } from '../CMySelect'
import { CMyEditor } from '../CMyEditor'
@Component({
name: 'CMyPopupEdit',
components: {CMyChipList, CDateTime, CMyToggleList, CMySelect}
components: {CMyChipList, CDateTime, CMyToggleList, CMySelect, CMyEditor}
})
export default class CMyPopupEdit extends Vue {
@@ -21,6 +22,7 @@ export default class CMyPopupEdit extends Vue {
@Prop({ required: false, default: false }) public canEdit
@Prop({ required: false, default: '' }) public field
@Prop({ required: false, default: '' }) public subfield
@Prop({ required: false, default: false }) public showall
public myvalue = ''
@@ -75,6 +77,13 @@ export default class CMyPopupEdit extends Vue {
this.$emit('save', newVal, valinitial)
}
public Savedb(newVal, valinitial) {
// console.log('Savedb', newVal)
this.$emit('showandsave', this.row, this.col, newVal, valinitial)
}
public visuValByType(val, col: IColGridTable, row) {
if (col === undefined || row === undefined)
return
@@ -118,7 +127,12 @@ export default class CMyPopupEdit extends Vue {
else if (val === '') {
return '[]'
} else {
let mystr = tools.firstchars(val, tools.MAX_CHARACTERS)
let mystr = ''
if (this.showall) {
return val
} else {
mystr = tools.firstchars(val, tools.MAX_CHARACTERS)
}
if (val) {
if (val.length > tools.MAX_CHARACTERS)
mystr += '...'
@@ -132,7 +146,7 @@ export default class CMyPopupEdit extends Vue {
public getclassCol(col) {
if (col) {
let mycl = (col.disable || !this.canEdit) ? '' : 'colmodif'
let mycl = (col.disable) ? '' : 'colmodif'
mycl += (col.fieldtype === tools.FieldType.date) ? ' coldate flex flex-container' : ''
return mycl

View File

@@ -32,6 +32,10 @@
:optlab="db_fieldsTable.getLabelByTable(col.jointable)"
:opticon="db_fieldsTable.getIconByTable(col.jointable)"></CMyChipList>
</div>
<div v-else-if="col.fieldtype === tools.FieldType.boolean">
<q-toggle dark color="green" v-model="myvalue" :label="col.title"
@input="Savedb"></q-toggle>
</div>
<div v-else>
{{ visuValByType(myvalue, col, row) }}
</div>
@@ -65,6 +69,15 @@
<div v-else-if="col.fieldtype === tools.FieldType.string">
<q-input v-model="myvalue"
autogrow
@keyup.enter.stop
autofocus>
</q-input>
</div>
<div v-else-if="col.fieldtype === tools.FieldType.password">
<q-input v-model="myvalue"
type="password"
@keyup.enter.stop
autofocus>
</q-input>
@@ -84,10 +97,13 @@
</CMyToggleList>
</div>
<div v-else-if="col.fieldtype === tools.FieldType.html">
<q-input v-model="myvalue"
autofocus
@keyup.enter.stop
type="textarea"></q-input>
<CMyEditor :value.sync="myvalue" :title="col.title" @keyup.enter.stop>
</CMyEditor>
<!--<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"

View File

@@ -1,5 +1,5 @@
<template>
<div>
<div class="text-center">
<div v-if="useinput">
<q-select
rounded
@@ -33,6 +33,7 @@
:label="label"
emit-value
map-options
input-class="text-center"
style="min-width: 170px; max-width: 400px;"
>

View File

@@ -36,29 +36,29 @@ export default class Footer extends Vue {
}
get TelegramSupport() {
return GlobalStore.getters.getValueSettingsByKey('TELEGRAM_SUPPORT')
return GlobalStore.getters.getValueSettingsByKey('TELEGRAM_SUPPORT', false)
}
get Whatsapp_Cell() {
return GlobalStore.getters.getValueSettingsByKey('WHATSAPP_CELL')
return GlobalStore.getters.getValueSettingsByKey('WHATSAPP_CELL', false)
}
get Telegram_UsernameHttp() {
return tools.getHttpForTelegram(GlobalStore.getters.getValueSettingsByKey('TELEGRAM_USERNAME'))
return tools.getHttpForTelegram(GlobalStore.getters.getValueSettingsByKey('TELEGRAM_USERNAME', false))
}
get FBPage() {
const fb = GlobalStore.getters.getValueSettingsByKey('URL_FACEBOOK')
const fb = GlobalStore.getters.getValueSettingsByKey('URL_FACEBOOK', false)
return fb
}
get InstagramPage() {
return GlobalStore.getters.getValueSettingsByKey('URL_INSTAGRAM')
return GlobalStore.getters.getValueSettingsByKey('URL_INSTAGRAM', false)
}
get TwitterPage() {
return GlobalStore.getters.getValueSettingsByKey('URL_TWITTER')
return GlobalStore.getters.getValueSettingsByKey('URL_TWITTER', false)
}
get static_data() {

View File

@@ -7,8 +7,8 @@
<!--</span>-->
<CFacebookFrame myclass="text-center" :fbimage="getValDb('FBPAGE_IMG')"
:urlfbpage="getValDb('FBPAGE_FRAME')" title="getValDb('FBPAGE_TITLE')">
<CFacebookFrame myclass="text-center" :fbimage="getValDb('FBPAGE_IMG', false)"
:urlfbpage="getValDb('FBPAGE_FRAME')" :title="getValDb('FBPAGE_TITLE', false)">
</CFacebookFrame>
@@ -45,9 +45,9 @@
</div>
<div class="text-center">
<span v-html="getValDb('MAP_TITLE')"></span>
<span v-html="getValDb('MAP_TITLE', false)"></span>
<br>
<a :href="getValDb('URLMAP')" target="_blank" class="footer_link">Apri Mappa</a>
<a :href="getValDb('URLMAP', false)" target="_blank" class="footer_link">Apri Mappa</a>
</div>
<!--<div class="q-mt-xs copyrights">-->
@@ -63,12 +63,12 @@
<div class="mycontacts_text">
<i v-if="getValDb('MAIN_EMAIL')" aria-hidden="true"
<i v-if="getValDb('MAIN_EMAIL', false)" aria-hidden="true"
class="q-icon fas fa-envelope q-mx-sm"></i>
<a :href="`mailto:` + getValDb('MAIN_EMAIL')" class="links">{{ getValDb('MAIN_EMAIL')
<a :href="`mailto:` + getValDb('MAIN_EMAIL', false)" class="links">{{ getValDb('MAIN_EMAIL')
}}</a><br>
<div style="margin-bottom: 20px;"></div>
<div v-for="rec in getarrValDb('CONTACTS_EMAIL_CELL')"
<div v-for="rec in getarrValDb('CONTACTS_EMAIL_CELL', false)"
class="mycontacts_text margin_buttons_footer"
style="margin-bottom: 0px;">
<div>
@@ -102,8 +102,8 @@
</div>
</div>
<span v-if="getValDb('CALL_WORKING_DAYS')"><br>orari per chiamate:<br>
<span v-html="getValDb('CALL_WORKING_DAYS')"></span></span>
<span v-if="getValDb('CALL_WORKING_DAYS', false)"><br>orari per chiamate:<br>
<span v-html="getValDb('CALL_WORKING_DAYS', false)"></span></span>
</div>
</div>

View File

@@ -8,12 +8,13 @@ import Quasar, { Screen } from 'quasar'
import { Prop } from 'vue-property-decorator'
import { Api } from '../../store'
import { serv_constants } from '../../store/Modules/serv_constants'
import MixinBase from '../../mixins/mixin-base'
@Component({
name: 'FormNewsletter'
})
export default class FormNewsletter extends Vue {
export default class FormNewsletter extends MixinBase {
public $t
public $q
public name: string = null
@@ -24,10 +25,6 @@ export default class FormNewsletter extends Vue {
@Prop() public idwebsite: string
@Prop() public locale: string
get tools() {
return tools
}
public async onSubmit() {
if (this.accept !== true) {
@@ -44,14 +41,16 @@ export default class FormNewsletter extends Vue {
firstName: this.name,
lastName: this.surname,
idwebsite: this.idwebsite,
locale: this.locale
locale: this.locale,
settomailchimp: this.getValDb('MAILCHIMP_ON', true, false)
}
console.log(usertosend)
return await Api.SendReq('/signup_news', 'POST', usertosend, false)
return await Api.SendReq('/news/signup', 'POST', usertosend, false)
.then((res) => {
if (res.data.result === serv_constants.RIS_SUBSCRIBED_OK) {
console.log('res', res)
if (res.data.code === serv_constants.RIS_SUBSCRIBED_OK) {
this.$q.notify({
color: 'green-4',
textColor: 'white',
@@ -59,7 +58,7 @@ export default class FormNewsletter extends Vue {
// message: this.$t('newsletter.submitted')
message: res.data.msg
})
} else if (res.data.result === serv_constants.RIS_SUBSCRIBED_ALREADYEXIST) {
} else if (res.data.code === serv_constants.RIS_SUBSCRIBED_ALREADYEXIST) {
this.$q.notify({
color: 'orange-4',
textColor: 'white',

View File

@@ -14,6 +14,7 @@ export * from './CMyPopupEdit'
export * from './CMyToggleList'
export * from './CMyChipList'
export * from './CMyEditor'
export * from './CMyFieldDb'
export * from './CMyTeacher'
export * from './CImgText'
export * from './CImgTitle'
@@ -32,3 +33,4 @@ export * from './CFacebookFrame'
export * from './Shen/CTesseraElettronica'
export * from './CGoogleMap'
export * from './COpenStreetMap'
export * from './CTitleBanner'