- Duplicate Event (1,2 4 times).

- Updated Calendar on database
This commit is contained in:
Paolo Arena
2019-11-01 19:58:52 +01:00
parent cdfc32c620
commit f30e6afd9e
6 changed files with 102 additions and 36 deletions

View File

@@ -501,14 +501,16 @@ export default class CEventsCalendar extends Vue {
tools.CancelEvent(this, eventparam)
}
public duplicateEvent(eventparam) {
GlobalStore.actions.DuplicateRec({ table: tools.TABEVENTS, id: eventparam._id }).then((rec) => {
rec.dateTimeStart = new Date()
rec.dateTimeEnd = new Date()
CalendarStore.state.eventlist.push(rec)
this.editEvent(rec)
public duplicateEvent(eventparam, numgg, numev: number = 1 ) {
for (let i = 0; i < numev; ++i) {
GlobalStore.actions.DuplicateRec({ table: tools.TABEVENTS, id: eventparam._id }).then((rec) => {
rec.dateTimeStart = tools.addDays(new Date(rec.dateTimeStart), numgg * (i + 1))
rec.dateTimeEnd = tools.addDays(new Date(rec.dateTimeEnd), numgg * (i + 1))
CalendarStore.state.eventlist.push(rec)
this.editEvent(rec)
})
})
}
// tools.ActionRecTable(this, lists.MenuAction.DUPLICATE_RECTABLE, tools.TABEVENTS, eventparam._id, eventparam, 'db.duplicatedrecord')
}

View File

@@ -10,8 +10,23 @@
<q-toolbar-title>
{{ $t('cal.event') }}
</q-toolbar-title>
<q-btn v-if="editable" flat round color="white" icon="fas fa-copy" v-close-popup
@click="duplicateEvent(myevent)"></q-btn>
<q-btn v-if="editable" flat round color="white" icon="fas fa-copy">
<q-menu
transition-show="flip-right"
transition-hide="flip-left">
<q-list style="min-width: 100px">
<q-item clickable @click="duplicateEvent(myevent, 7)">
<q-item-section>Tra 1 Settimana</q-item-section>
</q-item>
<q-item clickable @click="duplicateEvent(myevent, 14)">
<q-item-section>Tra 2 Settimane</q-item-section>
</q-item>
<q-item clickable @click="duplicateEvent(myevent, 7, 4)">
<q-item-section>4 Eventi ogni Settimana</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
<q-btn v-if="editable" flat round color="white" icon="delete" v-close-popup
@click="deleteEvent(myevent)"></q-btn>
<q-btn v-if="editable" flat round color="white" icon="edit" v-close-popup
@@ -523,11 +538,27 @@
</q-chip>
<q-chip v-if="event === myevent && !displayEvent && editable" class="text-center shadow-5 glossy bg-blue chipmodif">
<q-btn v-if="editable" flat round color="white" icon="fas fa-copy"
@click="duplicateEvent(myevent)"></q-btn>
<q-btn v-if="editable" flat round color="white" icon="delete"
<q-btn v-if="editable" flat round color="white" icon="fas fa-copy">
<q-menu
transition-show="flip-right"
transition-hide="flip-left">
<q-list style="min-width: 100px">
<q-item clickable @click="duplicateEvent(myevent, 7)">
<q-item-section>Tra 1 Settimana</q-item-section>
</q-item>
<q-item clickable @click="duplicateEvent(myevent, 14)">
<q-item-section>Tra 2 Settimane</q-item-section>
</q-item>
<q-item clickable @click="duplicateEvent(myevent, 7, 4)">
<q-item-section>4 Eventi ogni Settimana</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
<q-btn v-if="editable" flat round color="white" icon="delete" v-close-popup
@click="deleteEvent(myevent)"></q-btn>
<q-btn v-if="editable" flat round color="white" icon="edit"
<q-btn v-if="editable" flat round color="white" icon="edit" v-close-popup
@click="editEvent(myevent)"></q-btn>
<q-btn flat round color="white" icon="cancel" @click="selectEvent(null)"></q-btn>
</q-chip>

View File

@@ -50,7 +50,7 @@ export default class CGridTableRec extends Vue {
public spinner_visible: boolean = false
public idsel: string = ''
public colsel: IColGridTable = {name: ''}
public colsel: IColGridTable = { name: '' }
public valPrec: string = ''
public separator: 'horizontal'
@@ -118,6 +118,7 @@ export default class CGridTableRec extends Vue {
}
public updatedcol() {
console.log('updatedcol')
if (this.mycolumns) {
this.colVisib = []
this.colExtra = []
@@ -137,6 +138,7 @@ export default class CGridTableRec extends Vue {
}
public onRequest(props) {
console.log('onRequest')
const { page, rowsPerPage, rowsNumber, sortBy, descending } = props.pagination
const filter = this.filter
@@ -314,20 +316,29 @@ export default class CGridTableRec extends Vue {
public mounted() {
this.canEdit = tools.getCookie(tools.CAN_EDIT) === 'true'
this.canEdit = tools.getCookie(tools.CAN_EDIT, this.canEdit) === 'true'
this.tablesel = tools.getCookie('tablesel')
this.tablesel = tools.getCookie('tablesel', this.tablesel)
if (this.tablesel === '') {
if (!!this.tablesList)
this.tablesel = this.tablesList[0].value
else
this.tablesel = this.mytable
}
this.changeTable(false)
}
public refresh() {
if (this.search !== '')
// console.log('this.search', this.search)
if (!!this.search && this.search !== '')
this.filter = this.search
else
this.filter = ''
// console.log('this.filter', this.filter)
this.onRequest({
pagination: this.pagination
})
@@ -409,7 +420,7 @@ export default class CGridTableRec extends Vue {
mytab = this.tablesList.find((rec) => rec.value === this.tablesel)
}
console.log('this.tablesel', this.tablesel)
console.log('this.tablesel', this.tablesel, 'mytab', mytab)
if (mytab) {
this.mytitle = mytab.label
@@ -417,10 +428,17 @@ export default class CGridTableRec extends Vue {
this.mycolumns = [...mytab.columns]
}
this.mycolumns.forEach((rec: IColGridTable) => {
if (rec.label_trans)
rec.label = this.$t(rec.label_trans)
})
console.log('this.mycolumns')
console.log(this.mycolumns)
console.log('this.tablesList:')
console.table(this.tablesList)
if (!!this.mycolumns) {
this.mycolumns.forEach((rec: IColGridTable) => {
if (rec.label_trans)
rec.label = this.$t(rec.label_trans)
})
}
if (mytab) {
this.mytable = mytab.value
@@ -431,7 +449,7 @@ export default class CGridTableRec extends Vue {
this.updatedcol()
if (!!this.mytable) {
const myselcol = tools.getCookie(this.mytable)
const myselcol = tools.getCookie(this.mytable, '')
if (!!myselcol && myselcol.length > 0) {
this.colVisib = myselcol.split('|')
}