diff --git a/src/common/shared_vuejs.ts b/src/common/shared_vuejs.ts index dbe020d..8ca0c13 100644 --- a/src/common/shared_vuejs.ts +++ b/src/common/shared_vuejs.ts @@ -7,7 +7,7 @@ export const shared_consts = { }, fieldsUserToChange() { - return ['username', 'email', 'name', 'surname', 'perm', 'date_reg', 'verified_email'] + return ['username', 'email', 'name', 'surname', 'perm', 'date_reg', 'verified_email', 'img', 'ipaddr'] } } diff --git a/src/components/CEventsCalendar/CEventsCalendar.ts b/src/components/CEventsCalendar/CEventsCalendar.ts index fee862c..92f32d9 100644 --- a/src/components/CEventsCalendar/CEventsCalendar.ts +++ b/src/components/CEventsCalendar/CEventsCalendar.ts @@ -29,6 +29,7 @@ import { static_data } from '@src/db/static_data' import translate from '@src/globalroutines/util' import { lists } from '../../store/Modules/lists' import { GlobalStore } from '../../store/Modules' +import { IMessagePage, IMessage, IIdentity } from '../../model' @Component({ name: 'CEventsCalendar', @@ -58,6 +59,18 @@ export default class CEventsCalendar extends Vue { modified: false } + public formAskForDefault: IMessage = { + dest: { + idapp: process.env.APP_ID, + username: '' + }, + origin: { + idapp: process.env.APP_ID, + username: '' + }, + message: '' + } + public mioalert = false public dateFormatter: any = '' @@ -78,10 +91,16 @@ export default class CEventsCalendar extends Vue { bookedevent: null, state: EState.None } + public askInfopage: IMessagePage = { + show: false, + msg: null, + state: EState.None + } public contextDay = null public eventForm: IEvents = { ...this.formDefault } public bookEventForm = { ...this.formbookEventDefault } + public askInfoForm: IMessage = { ...this.formAskForDefault } public displayEvent = false public myevent = null // public events = [] @@ -355,7 +374,6 @@ export default class CEventsCalendar extends Vue { return this } - public $refs: { calendar: any } @@ -424,7 +442,7 @@ export default class CEventsCalendar extends Vue { } public addBookEventMenu(eventparam) { - if (!UserStore.state.isLogged || !UserStore.state.verified_email) { + if (!UserStore.state.isLogged || !UserStore.state.my.verified_email) { // Visu right Toolbar to make SignIn GlobalStore.state.RightDrawerOpen = true // this.$router.push('/signin') @@ -434,6 +452,7 @@ export default class CEventsCalendar extends Vue { this.myevent = eventparam this.bookEventForm.msgbooking = '' this.bookEventForm.numpeople = 1 + this.bookEventForm.booked = true this.bookEventpage.state = EState.Creating this.displayEvent = false @@ -441,6 +460,28 @@ export default class CEventsCalendar extends Vue { } } + public askForInfoEventMenu(eventparam) { + if (!UserStore.state.isLogged || !UserStore.state.my.verified_email) { + // Visu right Toolbar to make SignIn + GlobalStore.state.RightDrawerOpen = true + // this.$router.push('/signin') + } else { + console.log('askForInfoEventMenu') + this.askInfoForm = { ...this.formAskForDefault } + + this.myevent = eventparam + + this.askInfoForm = { + message: '' + } + + this.askInfopage.state = EState.Creating + + this.displayEvent = false + this.askInfopage.show = true // show dialog + } + } + public clEvent(event: IEvents) { return (this.isAlreadyBooked(event) ? 'text-left bg-light-green-1' : 'text-left') } @@ -460,10 +501,7 @@ export default class CEventsCalendar extends Vue { } public deleteEvent(eventparam) { - const index = this.findEventIndex(eventparam) - if (index >= 0) { - CalendarStore.state.eventlist.splice(index, 1) - } + tools.CancelEvent(this, eventparam) } public findEventIndex(eventparam) { @@ -514,7 +552,7 @@ export default class CEventsCalendar extends Vue { const mydatatosave = { id: myrec._id, - table: 'myevents', + table: tools.TABEVENTS, fieldsvalue: myrec } @@ -557,7 +595,7 @@ export default class CEventsCalendar extends Vue { // ++Save into the Database const mydatatosave = { id: data._id, - table: 'myevents', + table: tools.TABEVENTS, fieldsvalue: data } @@ -565,7 +603,7 @@ export default class CEventsCalendar extends Vue { this.UpdateDbByFields(data, true) } else { const mydataadd = { - table: 'myevents', + table: tools.TABEVENTS, data } @@ -623,7 +661,38 @@ export default class CEventsCalendar extends Vue { } public sendMsg(myevent: IEvents) { - // .. + const self = this + this.askInfopage.show = false + + const data: IMessage = { + source: { + page: '', + event_id: myevent._id, + infoevent: tools.gettextevent(this, myevent) + }, + idapp: process.env.APP_ID, + origin: { + idapp: process.env.APP_ID, + username: UserStore.state.username + }, + dest: { + idapp: process.env.APP_ID, + username: myevent.teacher + }, + read: false, + deleted: false, + message: this.askInfoForm.message, + datemsg: tools.getDateNow() + } + + this.SendMsgEvent(data).then((ris) => { + self.contextDay = null + if (ris) + tools.showPositiveNotif(self.$q, self.$t('cal.sendmsg_sent')) + else + tools.showNegativeNotif(self.$q, self.$t('cal.sendmsg_error')) + }) + } public saveBookEvent(myevent: IEvents) { @@ -638,7 +707,7 @@ export default class CEventsCalendar extends Vue { // self.bookEventForm.booked = self.bookEventForm.bookedcheck const data: IBookedEvent = { - userId: UserStore.state.userId, + userId: UserStore.state.my._id, id_bookedevent: myevent._id, numpeople: self.bookEventForm.numpeople, infoevent: tools.gettextevent(self, myevent), @@ -772,6 +841,10 @@ export default class CEventsCalendar extends Vue { return await CalendarStore.actions.BookEvent(eventparam) } + public async SendMsgEvent(param: IMessage) { + return await UserStore.actions.SendMsgEvent(param) + } + public isAlreadyBooked(eventparam: IEvents) { return CalendarStore.getters.findEventBooked(eventparam, true) } @@ -961,6 +1034,8 @@ export default class CEventsCalendar extends Vue { // check if event is in the past const datenow = tools.addDays(tools.getDateNow(), -1) - return (myevent.dateTimeEnd >= datenow) + // console.log('datenow', datenow, 'end', myevent.dateTimeEnd) + + return (new Date(myevent.dateTimeEnd) >= datenow) } } diff --git a/src/components/CEventsCalendar/CEventsCalendar.vue b/src/components/CEventsCalendar/CEventsCalendar.vue index 463ee3b..84e40f4 100644 --- a/src/components/CEventsCalendar/CEventsCalendar.vue +++ b/src/components/CEventsCalendar/CEventsCalendar.vue @@ -74,23 +74,9 @@
- {{$t('cal.when')}}: - {{ tools.getstrDate(myevent.dateTimeStart)}} - {{ tools.getstrDate(myevent.dateTimeEnd)}} - - - {{$t('cal.hours')}}: - {{ myevent.infoextra }} - - - - - - {{$t('cal.hours')}}: - {{$t('cal.starttime')}} {{ tools.getstrTime(myevent.dateTimeStart) }} - {{ $t('cal.endtime')}}: {{ tools.getstrTime(myevent.dateTimeEnd) }} - - - + {{$t('cal.when')}}: + +

- {{$t('cal.when')}}: - {{func_tools.getDateStr(myevent.dateTimeStart)}} - - {{func_tools.getDateStr(myevent.dateTimeEnd)}}
- - {{$t('cal.hours')}}: - {{ myevent.infoextra }} - - - - - - {{$t('cal.hours')}}: - {{$t('cal.starttime')}} {{ tools.getstrTime(myevent.dateTimeStart) }} - - - {{$t('cal.endtime')}} - - - - {{ tools.getstrTime(myevent.dateTimeEnd) }} - - - - + {{$t('cal.when')}}: + +
@@ -369,7 +335,7 @@ - @@ -380,6 +346,53 @@ + + + + + {{$t('cal.booking')}} + + + + + + + +
+ + + {{myevent.title}} + +
+ {{$t('cal.when')}}: + + +
+
+ + + + + + + +
+
+
+ + + + +
+
+ @@ -547,17 +560,7 @@

- -
- {{func_tools.getDateStr(event.dateTimeStart)}} - {{ event.infoextra }} -
-
-
- {{tools.getstrDateTime(event.dateTimeStart)}} - - {{tools.getstrDateTime(event.dateTimeEnd)}} -
-
+
@@ -649,12 +652,16 @@

- + + - paste event, only allow plain-text, no images. + * + * see: https://stackoverflow.com/a/28213320 + * + * @param {object} evt - array of files + * @author Daniel Thompson-Yvetot + * @license MIT + */ + public pasteCapture(evt) { + // let text, onPasteStripFormattingIEPaste + // evt.preventDefault() + // if (evt.originalEvent && evt.originalEvent.clipboardData.getData) { + // text = evt.originalEvent.clipboardData.getData('text/plain') + // this.$refs.editor_ref.runCmd('insertText', text) + // } + // else if (evt.clipboardData && evt.clipboardData.getData) { + // text = evt.clipboardData.getData('text/plain') + // this.$refs.editor_ref.runCmd('insertText', text) + // } + // else if (window.clipboardData && window.clipboardData.getData) { + // if (!onPasteStripFormattingIEPaste) { + // onPasteStripFormattingIEPaste = true + // this.$refs.editor_ref.runCmd('ms-pasteTextOnly', text) + // } + // onPasteStripFormattingIEPaste = false + // } + } + +} + +/* + +https://developer.mozilla.org/en-US/docs/Web/API/document/execCommand#Commands + +backColor +Changes the document background color. In styleWithCss mode, it affects the background color of the containing block instead. This requires a value string to be passed in as a value argument. Note that Internet Explorer uses this to set the text background color. +bold +Toggles bold on/off for the selection or at the insertion point. Internet Explorer uses the tag instead of . +ClearAuthenticationCache +Clears all authentication credentials from the cache. +contentReadOnly +Makes the content document either read-only or editable. This requires a boolean true/false as the value argument. (Not supported by Internet Explorer.) +copy +Copies the current selection to the clipboard. Conditions of having this behavior enabled vary from one browser to another, and have evolved over time. Check the compatibility table to determine if you can use it in your case. +createLink +Creates an hyperlink from the selection, but only if there is a selection. Requires a URI string as a value argument for the hyperlink's href. The URI must contain at least a single character, which may be whitespace. (Internet Explorer will create a link with a null value.) +cut +Removes the current selection and copies it to the clipboard. When this behavior is enabled varies between browsers, and its conditions have evolved over time. Check the compatibility table for usage details. +decreaseFontSize +Adds a tag around the selection or at the insertion point. (Not supported by Internet Explorer.) +defaultParagraphSeparator +Changes the paragraph separator used when new paragraphs are created in editable text regions. See Differences in markup generation for more details. +delete +Deletes the current selection. +enableAbsolutePositionEditor +Enables or disables the grabber that allows absolutely-positioned elements to be moved around. This is disabled by default in Firefox 63 Beta/Dev Edition (bug 1449564) +enableInlineTableEditing +Enables or disables the table row/column insertion and deletion controls. This is disabled by default in Firefox 63 Beta/Dev Edition (bug 1449564). +enableObjectResizing +Enables or disables the resize handles on images, tables, and absolutely-positioned elements and other resizable objects. This is disabled by default in Firefox 63 Beta/Dev Edition (bug 1449564). +fontName +Changes the font name for the selection or at the insertion point. This requires a font name string (like "Arial") as a value argument. +fontSize +Changes the font size for the selection or at the insertion point. This requires an integer from 1-7 as a value argument. +foreColor +Changes a font color for the selection or at the insertion point. This requires a hexadecimal color value string as a value argument. +formatBlock +Adds an HTML block-level element around the line containing the current selection, replacing the block element containing the line if one exists (in Firefox,
is the exception — it will wrap any containing block element). Requires a tag-name string as a value argument. Virtually all block-level elements can be used. (Internet Explorer and Edge support only heading tags H1–H6, ADDRESS, and PRE, which must be wrapped in angle brackets, such as "

".) +forwardDelete +Deletes the character ahead of the cursor's position, identical to hitting the Delete key on a Windows keyboard. +heading +Adds a heading element around a selection or insertion point line. Requires the tag-name string as a value argument (i.e. "H1", "H6"). (Not supported by Internet Explorer and Safari.) +hiliteColor +Changes the background color for the selection or at the insertion point. Requires a color value string as a value argument. useCSS must be true for this to function. (Not supported by Internet Explorer.) +increaseFontSize +Adds a tag around the selection or at the insertion point. (Not supported by Internet Explorer.) +indent +Indents the line containing the selection or insertion point. In Firefox, if the selection spans multiple lines at different levels of indentation, only the least indented lines in the selection will be indented. +insertBrOnReturn +Controls whether the Enter key inserts a
element, or splits the current block element into two. (Not supported by Internet Explorer.) +insertHorizontalRule +Inserts a
element at the insertion point, or replaces the selection with it. +insertHTML +Inserts an HTML string at the insertion point (deletes selection). Requires a valid HTML string as a value argument. (Not supported by Internet Explorer.) +insertImage +Inserts an image at the insertion point (deletes selection). Requires a URL string for the image's src as a value argument. The requirements for this string are the same as createLink. +insertOrderedList +Creates a numbered ordered list for the selection or at the insertion point. +insertUnorderedList +Creates a bulleted unordered list for the selection or at the insertion point. +insertParagraph +Inserts a paragraph around the selection or the current line. (Internet Explorer inserts a paragraph at the insertion point and deletes the selection.) +insertText +Inserts the given plain text at the insertion point (deletes selection). +italic +Toggles italics on/off for the selection or at the insertion point. (Internet Explorer uses the element instead of .) +justifyCenter +Centers the selection or insertion point. +justifyFull +Justifies the selection or insertion point. +justifyLeft +Justifies the selection or insertion point to the left. +justifyRight +Right-justifies the selection or the insertion point. +outdent +Outdents the line containing the selection or insertion point. +paste +Pastes the clipboard contents at the insertion point (replaces current selection). Disabled for web content. See [1]. +redo +Redoes the previous undo command. +removeFormat +Removes all formatting from the current selection. +selectAll +Selects all of the content of the editable region. +strikeThrough +Toggles strikethrough on/off for the selection or at the insertion point. +subscript +Toggles subscript on/off for the selection or at the insertion point. +superscript +Toggles superscript on/off for the selection or at the insertion point. +underline +Toggles underline on/off for the selection or at the insertion point. +undo +Undoes the last executed command. +unlink +Removes the anchor element from a selected hyperlink. +useCSS +Toggles the use of HTML tags or CSS for the generated markup. Requires a boolean true/false as a value argument. +NOTE: This argument is logically backwards (i.e. use false to use CSS, true to use HTML) and unsupported by Internet Explorer. This has been deprecated in favor of styleWithCSS. +styleWithCSS +Replaces the useCSS command. true modifies/generates style attributes in markup, false generates presentational elements. + + */ diff --git a/src/components/CMyEditor/CMyEditor.vue b/src/components/CMyEditor/CMyEditor.vue new file mode 100644 index 0000000..9be48e3 --- /dev/null +++ b/src/components/CMyEditor/CMyEditor.vue @@ -0,0 +1,36 @@ + + + + + diff --git a/src/components/CMyEditor/index.ts b/src/components/CMyEditor/index.ts new file mode 100644 index 0000000..0d1666a --- /dev/null +++ b/src/components/CMyEditor/index.ts @@ -0,0 +1 @@ +export {default as CMyEditor} from './CMyEditor.vue' diff --git a/src/components/CMySelect/CMySelect.scss b/src/components/CMySelect/CMySelect.scss new file mode 100644 index 0000000..b892863 --- /dev/null +++ b/src/components/CMySelect/CMySelect.scss @@ -0,0 +1,4 @@ +.myflex{ + display: flex; + flex: 1; +} diff --git a/src/components/CMySelect/CMySelect.ts b/src/components/CMySelect/CMySelect.ts new file mode 100644 index 0000000..1edd9ae --- /dev/null +++ b/src/components/CMySelect/CMySelect.ts @@ -0,0 +1,56 @@ +import Vue from 'vue' +import { Component, Prop, Watch } from 'vue-property-decorator' + +import { tools } from '../../store/Modules/tools' +import { toolsext } from '@src/store/Modules/toolsext' +import { IPerson } from '../../model/GlobalStore' + +@Component({ + name: 'CMySelect' +}) + +export default class CMySelect extends Vue { + @Prop({ required: true }) public value + @Prop({ required: true, default: '' }) public label + @Prop({ required: false, default: '' }) public myclass + @Prop({ required: true, default: '' }) public optlab + @Prop({ required: true, default: '' }) public optval + @Prop({ required: false, default: true }) public useinput: boolean + @Prop({ required: false, default: null }) public newvaluefunc + @Prop({ required: false, default: null }) public funcgetvaluebyid + @Prop({ required: true }) public options + + public myvalue = '' + + get tools() { + return tools + } + + public nothing() { + + } + + public changeval(newval) { + console.log('changeval', newval) + // const newvallab = newval[`${this.optval}`] + // this.myvalue = newvallab + this.$emit('update:value', newval) + } + + public mounted() { + const rec = this.options.find((myrec) => myrec[`${this.optval}`] === this.value) + console.log('rec', rec) + if (!this.useinput) { + this.myvalue = this.value + } else { + if (rec) { + if (this.funcgetvaluebyid) + this.myvalue = this.funcgetvaluebyid(rec[`${this.optval}`]) + else + this.myvalue = rec[`${this.optlab}`] + + console.log('this.myvalue', this.myvalue, 'this.optval', this.optval, 'rec', rec[`${this.optval}`]) + } + } + } +} diff --git a/src/components/CMySelect/CMySelect.vue b/src/components/CMySelect/CMySelect.vue new file mode 100644 index 0000000..1014b7a --- /dev/null +++ b/src/components/CMySelect/CMySelect.vue @@ -0,0 +1,46 @@ + + + + + diff --git a/src/components/CMySelect/index.ts b/src/components/CMySelect/index.ts new file mode 100644 index 0000000..b894540 --- /dev/null +++ b/src/components/CMySelect/index.ts @@ -0,0 +1 @@ +export {default as CMySelect} from './CMySelect.vue' diff --git a/src/components/CSignUp/CSignUp.ts b/src/components/CSignUp/CSignUp.ts index 7489a5b..62b5f8a 100644 --- a/src/components/CSignUp/CSignUp.ts +++ b/src/components/CSignUp/CSignUp.ts @@ -4,7 +4,7 @@ import { UserStore } from '@store' import { tools } from '../../store/Modules/tools' import { toolsext } from '@src/store/Modules/toolsext' -import { ISignupOptions, IUserState } from 'model' +import { ISignupOptions, IUserState, IUserFields } from 'model' import { validations, TSignup } from './CSignUp-validate' import { validationMixin } from 'vuelidate' diff --git a/src/components/Header/Header.scss b/src/components/Header/Header.scss index 826bdc7..3f8a534 100644 --- a/src/components/Header/Header.scss +++ b/src/components/Header/Header.scss @@ -211,7 +211,7 @@ canvas { } .toolbar { - min-height: 30px; + min-height: 43px; } .right-itens a, .right-itens button { @@ -296,3 +296,8 @@ canvas { margin-bottom: 5px; } +.roundimg { + border-radius: 50% !important; + color: red; + background-color: red; +} diff --git a/src/components/Header/Header.ts b/src/components/Header/Header.ts index 020f9a2..6921277 100644 --- a/src/components/Header/Header.ts +++ b/src/components/Header/Header.ts @@ -15,8 +15,11 @@ import Quasar, { Screen } from 'quasar' import { static_data } from '../../db/static_data' import globalroutines from '../../globalroutines' +import MixinUsers from '../../mixins/mixin-users' + @Component({ name: 'Header', + mixins: [MixinUsers], components: { drawer, messagePopover, CSignIn @@ -40,10 +43,6 @@ export default class Header extends Vue { public photo = '' public visuimg: boolean = true - get tools() { - return tools - } - get conn_changed() { return GlobalStore.state.stateConnection } @@ -315,28 +314,6 @@ export default class Header extends Vue { }, 100) } - get MenuCollapse() { - return GlobalStore.state.menuCollapse - // return true - } - - get Username() { - return UserStore.state.username - } - get myName() { - return UserStore.state.name - } - get mySurname() { - return UserStore.state.surname - } - get Verificato() { - return UserStore.state.verified_email - } - - get Email() { - return UserStore.state.email - } - public logoutHandler() { UserStore.actions.logout() .then(() => { @@ -359,7 +336,7 @@ export default class Header extends Vue { } get isVerified() { - return UserStore.state.verified_email + return UserStore.state.my.verified_email } public loginOk() { diff --git a/src/components/Header/Header.vue b/src/components/Header/Header.vue index 991deb0..d7012cd 100644 --- a/src/components/Header/Header.vue +++ b/src/components/Header/Header.vue @@ -93,9 +93,7 @@ - - - + + + + @@ -136,7 +137,7 @@
- + diff --git a/src/components/Shen/CTesseraElettronica/CTesseraElettronica.scss b/src/components/Shen/CTesseraElettronica/CTesseraElettronica.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/components/Shen/CTesseraElettronica/CTesseraElettronica.ts b/src/components/Shen/CTesseraElettronica/CTesseraElettronica.ts new file mode 100644 index 0000000..82a0a06 --- /dev/null +++ b/src/components/Shen/CTesseraElettronica/CTesseraElettronica.ts @@ -0,0 +1,32 @@ +import Vue from 'vue' +import { Component, Prop } from 'vue-property-decorator' +import { SingleProject } from '../../projects/SingleProject' +import { CTodo } from '../../todos/CTodo' +import { GlobalStore } from '../../../store/Modules' + +@Component({}) +export default class CTesseraElettronica extends Vue { + public $q + public $t + public $refs: { + frametessera + } + + public mounted() { + // ... + // $('#frametessera').contents().find('#nome').val("PPPP") + } + + get getNome() { + return '' + } + get getFrame() { + + // console.log('getFrame', $('#frametessera')) + return '' + } + + get rightDrawerOpen() { + return GlobalStore.state.RightDrawerOpen + } +} diff --git a/src/components/Shen/CTesseraElettronica/CTesseraElettronica.vue b/src/components/Shen/CTesseraElettronica/CTesseraElettronica.vue new file mode 100644 index 0000000..19bcd98 --- /dev/null +++ b/src/components/Shen/CTesseraElettronica/CTesseraElettronica.vue @@ -0,0 +1,22 @@ + + + + diff --git a/src/components/Shen/CTesseraElettronica/index.ts b/src/components/Shen/CTesseraElettronica/index.ts new file mode 100644 index 0000000..ccfb91b --- /dev/null +++ b/src/components/Shen/CTesseraElettronica/index.ts @@ -0,0 +1 @@ +export {default as CTesseraElettronica} from './CTesseraElettronica.vue' diff --git a/src/components/projects/SingleProject/SingleProject.ts b/src/components/projects/SingleProject/SingleProject.ts index 5adc9e4..b39585c 100644 --- a/src/components/projects/SingleProject/SingleProject.ts +++ b/src/components/projects/SingleProject/SingleProject.ts @@ -293,7 +293,7 @@ export default class SingleProject extends Vue { } get isMyProject() { - return this.itemproject.userId === UserStore.state.userId + return this.itemproject.userId === UserStore.state.my._id } get tipoProj() { diff --git a/src/globalroutines/indexdb.ts b/src/globalroutines/indexdb.ts index 1fa1fca..2d36551 100644 --- a/src/globalroutines/indexdb.ts +++ b/src/globalroutines/indexdb.ts @@ -15,7 +15,7 @@ function saveConfigIndexDb(context) { _id: costanti.CONFIG_ID_CFG, lang: toolsext.getLocale(), token: UserStore.state.x_auth_token, - userId: UserStore.state.userId + userId: UserStore.state.my._id } writeConfigIndexDb('config', data) diff --git a/src/layouts/toolbar/messagePopover/messagePopover.ts b/src/layouts/toolbar/messagePopover/messagePopover.ts index a70bce7..7a103ef 100644 --- a/src/layouts/toolbar/messagePopover/messagePopover.ts +++ b/src/layouts/toolbar/messagePopover/messagePopover.ts @@ -1,35 +1,46 @@ import Vue from 'vue' import { Component, Prop } from 'vue-property-decorator' -import { GlobalStore } from '@store' -import { IPost } from '../../../model/index' +import { GlobalStore, CalendarStore } from '@store' +import { ICalendarState, IMessage, IPost, IUserState } from '../../../model/index' import './messagePopover.scss' import { tools } from '@src/store/Modules/tools' import { toolsext } from '@src/store/Modules/toolsext' +import { ITodo, ITodosState } from '../../../model' +import { Getter } from 'vuex-class' +import { UserStore } from '../../../store/Modules' + +import MixinUsers from '../../../mixins/mixin-users' + +const namespace = 'MessageModule' @Component({ + mixins: [MixinUsers] }) export default class MessagePopover extends Vue { - posts: IPost[] = [] + + @Getter('getlasts_messages', { namespace }) + public lasts_messages: (state: IUserState) => IMessage[] public created() { - if (GlobalStore.state.posts.length < 1) { - this.requestPosts() - } + // if (GlobalStore.state.posts.length < 1) { + // this.requestPosts() + // } } - get filteredPosts() { - if (this.posts.length >= 1) - return this.posts.slice(0, 5) - else - return [] + public clickChat(msg: IMessage){ + this.$router.replace('/messages/' + msg.dest.username) } + get getNumNotifUnread() { + + return 0 + } public randomDate(): Date { - let myval = Math.floor(Math.random() * 10000000000) - return new Date(tools.getTimestampsNow() - myval) + const myval = Math.floor(Math.random() * 10000000000) + return tools.getstrDateTime(new Date(tools.getTimestampsNow() - myval)) } public randomAvatarUrl() { @@ -63,10 +74,10 @@ export default class MessagePopover extends Vue { */ } - public requestPosts() { - // console.log('requestPosts...') - let prova = [{ title: 'primo' }, { title: 'Secondo' }] - this.posts.push(...prova) - - } + // public requestPosts() { + // // console.log('requestPosts...') + // let prova = [{ title: 'primo' }, { title: 'Secondo' }] + // this.posts.push(...prova) + // + // } } diff --git a/src/layouts/toolbar/messagePopover/messagePopover.vue b/src/layouts/toolbar/messagePopover/messagePopover.vue index 93581e1..04a9d45 100644 --- a/src/layouts/toolbar/messagePopover/messagePopover.vue +++ b/src/layouts/toolbar/messagePopover/messagePopover.vue @@ -1,25 +1,48 @@ + +