Step 1: Creating page Messages: userlist last messages + a page for all the messages received and sent.

- Added CMyEditor and CMySelect to the git committ.
This commit is contained in:
Paolo Arena
2019-10-26 02:21:14 +02:00
parent 33a239698c
commit 878ae96813
31 changed files with 802 additions and 115 deletions

View File

@@ -22,13 +22,14 @@ import QDateTimeScroller from '@quasar/quasar-app-extension-qscroller/src/compon
import { CTodo } from '@src/components/todos/CTodo'
import { SingleProject } from '@src/components/projects/SingleProject'
import { IEvents } from '@src/model'
import { IBookedEvent, IBookedEventPage, IMessagePage, EState, IMessage, IDest, IOrigin } from '@src/model/Calendar'
import { IBookedEvent, IBookedEventPage, EState } from '@src/model/Calendar'
import { costanti } from '@src/store/Modules/costanti'
import router from '@router'
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',
@@ -64,7 +65,8 @@ export default class CEventsCalendar extends Vue {
username: ''
},
origin: {
userId: ''
idapp: process.env.APP_ID,
username: ''
},
message: ''
}
@@ -663,13 +665,16 @@ export default class CEventsCalendar extends Vue {
this.askInfopage.show = false
const data: IMessage = {
idapp: process.env.APP_ID,
origin: {
userId: UserStore.state.my._id,
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

View File

@@ -0,0 +1,4 @@
.myflex{
display: flex;
flex: 1;
}

View File

@@ -0,0 +1,240 @@
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 { QEditor } from 'quasar'
@Component({
name: 'CMyEditor'
})
export default class CMyEditor extends Vue {
public $q
public editor = null
@Prop({ required: true }) public value
@Prop({ required: false, default: '' }) public myclass
public myvalue = ''
public mycolor = ''
public myfonts = {
arial: 'Arial',
arial_black: 'Arial Black',
comic_sans: 'Comic Sans MS',
courier_new: 'Courier New',
impact: 'Impact',
lucida_grande: 'Lucida Grande',
times_new_roman: 'Times New Roman',
verdana: 'Verdana'
}
public toolbarcomp = [
['left', 'center', 'right', 'justify'],
['bold', 'italic', 'underline', 'strike'],
[
{
label: this.$q.lang.editor.formatting,
icon: this.$q.iconSet.editor.formatting,
list: 'no-icons',
options: [
'p',
'h4',
'h5',
'h6',
'code'
]
},
{
label: this.$q.lang.editor.fontSize,
icon: this.$q.iconSet.editor.fontSize,
fixedLabel: true,
fixedIcon: true,
list: 'no-icons',
options: [
'size-1',
'size-2',
'size-3',
'size-4',
'size-5',
'size-6',
'size-7'
]
},
{
label: this.$q.lang.editor.defaultFont,
icon: this.$q.iconSet.editor.font,
fixedIcon: true,
list: 'no-icons',
options: [
'default_font',
'arial',
'arial_black',
'comic_sans',
'courier_new',
'impact',
'lucida_grande',
'times_new_roman',
'verdana'
]
},
'removeFormat'
],
['quote', 'unordered', 'ordered', 'outdent', 'indent'],
['undo', 'redo', 'viewsource'],
]
get tools() {
return tools
}
public changeval(newval) {
// console.log('changeval', newval)
this.$emit('update:value', newval)
}
public mounted() {
this.myvalue = this.value
this.editor = this.$refs.editor_ref
}
public setcolor() {
document.execCommand('foreColor', false, this.mycolor)
}
/**
* Capture the <CTL-V> 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 <color> 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 <strong> tag instead of <b>.
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 <small> 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, <blockquote> 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 H1H6, ADDRESS, and PRE, which must be wrapped in angle brackets, such as "<H1>".)
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 <big> 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 <br> element, or splits the current block element into two. (Not supported by Internet Explorer.)
insertHorizontalRule
Inserts a <hr> 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 <em> element instead of <i>.)
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.
*/

View File

@@ -0,0 +1,36 @@
<template>
<div>
<form
autocorrect="off"
autocapitalize="off"
autocomplete="off"
spellcheck="false">
<q-btn rounded size="sm" color="primary">
<q-icon name="colorize" class="cursor-pointer">
<q-popup-proxy>
<q-color v-model="mycolor" @change="setcolor"></q-color>
</q-popup-proxy>
</q-icon>
</q-btn>
<q-editor
ref="editor_ref"
toolbar-text-color="white"
toolbar-toggle-color="yellow-8"
toolbar-bg="primary"
:toolbar="toolbarcomp"
:fonts="myfonts"
@input="changeval"
@paste.native="evt => pasteCapture(evt)"
v-model="myvalue">
</q-editor>
</form>
</div>
</template>
<script lang="ts" src="./CMyEditor.ts">
</script>
<style lang="scss" scoped>
@import './CMyEditor.scss';
</style>

View File

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

View File

@@ -0,0 +1,4 @@
.myflex{
display: flex;
flex: 1;
}

View File

@@ -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}`])
}
}
}
}

View File

@@ -0,0 +1,46 @@
<template>
<div>
<div v-if="useinput">
<q-select
:input-class="myclass"
filled
v-model="myvalue"
:use-input="useinput"
input-debounce="0"
@new-value="newvaluefunc"
new-value-mode="add-unique"
:options="options"
:option-value="optval"
:option-label="optlab"
@input="changeval"
:label="label"
dense
>
</q-select>
</div>
<div v-else>
<q-select
:input-class="myclass"
filled
v-model="myvalue"
:options="options"
:option-value="optval"
:option-label="optlab"
@input="changeval"
:label="label"
emit-value
map-options
style="min-width: 170px; max-width: 400px;"
>
</q-select>
</div>
</div>
</template>
<script lang="ts" src="./CMySelect.ts">
</script>
<style lang="scss" scoped>
@import './CMySelect.scss';
</style>

View File

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

View File

@@ -43,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
}

View File

@@ -108,7 +108,7 @@
<q-btn class="q-mx-xs" v-if="static_data.functionality.SHOW_USER_MENU && isLogged" round dense flat
@click="rightDrawerOpen = !rightDrawerOpen">
<q-avatar size="30px">
<img :src="`statics/`+ getMyImg">
<img :src="getMyImg">
</q-avatar>
</q-btn>
@@ -137,7 +137,7 @@
<div class="absolute-top bg-transparent text-black center_img" style="margin-top: 10px;">
<q-avatar class="q-mb-sm center_img">
<img :src="`../../statics/` + getMyImg">
<img :src="`../../` + getMyImg">
</q-avatar>
<q-btn class="absolute-top-right" style="margin-right: 10px; color: white;"
dense flat round icon="close" @click="rightDrawerOpen = !rightDrawerOpen">

View File

@@ -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
}
}

View File

@@ -0,0 +1,22 @@
<template>
<q-card class="q-ma-xs" bordered>
<q-card-section>
<div class="text-h6 bg-deep-purple-8 text-white text-center">Per accedere alla Tessera:
</div>
</q-card-section>
<q-separator inset/>
<q-card-section>
<iframe v-if="rightDrawerOpen" id="frametessera" ref="frametessera"
src="https://www.conceptstudio.it/website/csenravenna/electro/"
style="border: 0; width: 100%; max-width: 360px; min-height: 500px;"></iframe>
</q-card-section>
<!--Elisa GHZLSE78A65G388B-->
</q-card>
</template>
<script lang="ts" src="./CTesseraElettronica.ts">
</script>
<style lang="scss" scoped>
@import './CTesseraElettronica.scss';
</style>

View File

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