fix WhereInput

This commit is contained in:
les
2020-11-04 10:55:30 +01:00
parent ee194e16a5
commit 0ac2edf69d
6 changed files with 34 additions and 29 deletions

View File

@@ -131,9 +131,8 @@ export default {
}, },
openLinkModal () { openLinkModal () {
// this.link = { href: '', label: '' } // this.link = { href: '', label: '' }
// console.error(this.$refs)
this.linkModal = true this.linkModal = true
this.$nextTick( () => this.$refs.linkModalForm.reset() ) this.$nextTick(() => this.$refs.linkModalForm.reset())
}, },
addFooterLink () { addFooterLink () {
const link = Object.assign({}, this.link) const link = Object.assign({}, this.link)
@@ -151,7 +150,6 @@ export default {
editFooterLink (item) { editFooterLink (item) {
this.link = { href: item.href, label: item.label } this.link = { href: item.href, label: item.label }
this.linkModal = true this.linkModal = true
}, },
async uploadLogo (file) { async uploadLogo (file) {
const formData = new FormData() const formData = new FormData()

View File

@@ -40,14 +40,14 @@
"cross-env": "^7.0.2", "cross-env": "^7.0.2",
"date-fns": "^2.16.1", "date-fns": "^2.16.1",
"dayjs": "^1.9.4", "dayjs": "^1.9.4",
"dompurify": "^2.2.0", "dompurify": "^2.2.2",
"email-templates": "^7.1.2", "email-templates": "^7.1.2",
"express": "^4.17.1", "express": "^4.17.1",
"express-oauth-server": "^2.0.0", "express-oauth-server": "^2.0.0",
"fs": "^0.0.1-security", "fs": "^0.0.1-security",
"http-signature": "^1.3.5", "http-signature": "^1.3.5",
"ical.js": "^1.4.0", "ical.js": "^1.4.0",
"ics": "^2.26.0", "ics": "^2.26.1",
"inquirer": "^7.3.3", "inquirer": "^7.3.3",
"jsdom": "^16.4.0", "jsdom": "^16.4.0",
"jsonwebtoken": "^8.5.1", "jsonwebtoken": "^8.5.1",
@@ -61,7 +61,7 @@
"multer": "^1.4.2", "multer": "^1.4.2",
"nuxt": "^2.14.7", "nuxt": "^2.14.7",
"nuxt-express-module": "^0.0.11", "nuxt-express-module": "^0.0.11",
"pg": "^8.4.1", "pg": "^8.4.2",
"sequelize": "^6.3.5", "sequelize": "^6.3.5",
"sequelize-cli": "^6.2.0", "sequelize-cli": "^6.2.0",
"sharp": "^0.26.2", "sharp": "^0.26.2",
@@ -79,9 +79,9 @@
"@nuxtjs/eslint-config": "^4.0.0", "@nuxtjs/eslint-config": "^4.0.0",
"@nuxtjs/vuetify": "^1.11.2", "@nuxtjs/vuetify": "^1.11.2",
"babel-eslint": "^10.1.0", "babel-eslint": "^10.1.0",
"eslint": "^7.12.0", "eslint": "^7.12.1",
"eslint-config-prettier": "^6.14.0", "eslint-config-prettier": "^6.15.0",
"eslint-config-standard": "^15.0.0", "eslint-config-standard": "^16.0.1",
"eslint-loader": "^4.0.2", "eslint-loader": "^4.0.2",
"eslint-plugin-import": "^2.22.1", "eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": ">=11.1.0", "eslint-plugin-node": ">=11.1.0",
@@ -94,8 +94,8 @@
"nodemon": "^2.0.6", "nodemon": "^2.0.6",
"prettier": "^2.1.2", "prettier": "^2.1.2",
"pug-plain-loader": "^1.0.0", "pug-plain-loader": "^1.0.0",
"sass": "^1.27.0", "sass": "^1.28.0",
"sass-loader": "^10.0.4", "sass-loader": "^10.0.5",
"vue-cli-plugin-vuetify": "~2.0.7", "vue-cli-plugin-vuetify": "~2.0.7",
"vuetify-loader": "^1.3.0", "vuetify-loader": "^1.3.0",
"webpack-cli": "^4.1.0" "webpack-cli": "^4.1.0"

View File

@@ -14,6 +14,7 @@
template(v-slot:activator='{ on }') template(v-slot:activator='{ on }')
v-text-field( v-text-field(
:label="$t('event.from')" :label="$t('event.from')"
prepend-icon='mdi-clock'
:rules="[$validators.required('event.from')]" :rules="[$validators.required('event.from')]"
:value='value.start' :value='value.start'
v-on='on' v-on='on'
@@ -40,6 +41,7 @@
min-width="290px") min-width="290px")
template(v-slot:activator='{ on }') template(v-slot:activator='{ on }')
v-text-field( v-text-field(
prepend-icon='mdi-clock'
:label="$t('event.due')" :label="$t('event.due')"
:value='value.end' :value='value.end'
v-on='on' v-on='on'
@@ -61,7 +63,6 @@ export default {
value: { type: Object, default: () => { } } value: { type: Object, default: () => { } }
}, },
data () { data () {
// console.error('sono dentro data ', this.value)
return { return {
// time: { start: this.value.start, end: this.value.end }, // time: { start: this.value.start, end: this.value.end },
time: {}, time: {},

View File

@@ -25,7 +25,6 @@
v-btn(@click='importGeneric' :loading='loading' :disabled='loading' v-btn(@click='importGeneric' :loading='loading' :disabled='loading'
color='primary') {{$t('common.import')}} color='primary') {{$t('common.import')}}
</template> </template>
<script> <script>
import ical from 'ical.js' import ical from 'ical.js'
@@ -51,18 +50,18 @@ export default {
this.importURL() this.importURL()
} }
}, },
async importICS() { importICS () {
const reader = new FileReader() const reader = new FileReader()
reader.readAsText(this.file) reader.readAsText(this.file)
reader.onload = () => { reader.onload = () => {
const data = reader.result const data = reader.result
const event = ical.parse(data) const event = ical.parse(data)
this.event = { this.event = {
title: event.name title: event.name
} }
} }
}, },
async importURL() { async importURL () {
if (!this.URL) { if (!this.URL) {
this.errorMessage = this.$validators.required('common.URL')('') this.errorMessage = this.$validators.required('common.URL')('')
this.error = true this.error = true
@@ -73,7 +72,7 @@ export default {
this.loading = true this.loading = true
try { try {
const ret = await this.$axios.$get('/event/import', { params: { URL: this.URL }}) const ret = await this.$axios.$get('/event/import', { params: { URL: this.URL } })
this.event = ret this.event = ret
// check if contain an h-event // check if contain an h-event
this.$emit('imported', ret) this.$emit('imported', ret)
@@ -87,4 +86,4 @@ export default {
} }
} }
} }
</script> </script>

View File

@@ -6,16 +6,18 @@
:hint="$t('event.where_description')" :hint="$t('event.where_description')"
:hide-no-data="!place._name" :hide-no-data="!place._name"
:search-input.sync="place._name" :search-input.sync="place._name"
prepend-icon='mdi-map-marker'
persistent-hint persistent-hint
:value="value.name" :value="value.name"
:items="places" :items="places"
item-text='name' item-text='name'
@change='selectPlace') @change='selectPlace')
template(v-slot:no-data) template(v-slot:no-data)
v-list-item v-list-item(@click='createPlace')
p Create {{place._name}} v-list-item-content Create {{place._name}}
v-text-field.col-md-6(ref='address' v-text-field.col-md-6(ref='address'
prepend-icon='mdi-map'
:disabled='disableAddress' :disabled='disableAddress'
:rules="[$validators.required('common.address')]" :rules="[$validators.required('common.address')]"
:label="$t('common.address')" :label="$t('common.address')"
@@ -42,21 +44,26 @@ export default {
}, },
methods: { methods: {
selectPlace (p) { selectPlace (p) {
const place = p && this.places.find(place => place.id === p.id) if (typeof p === 'object') {
if (place && place.address) { if (p === null) { return }
this.place.name = p.name this.place.name = p.name
this.place.address = place.address this.place.address = p.address
this.disableAddress = true this.disableAddress = true
} else { } else { // this is a new place
this.place.name = p
this.disableAddress = false this.disableAddress = false
this.$refs.place.blur() this.$refs.place.blur()
this.$refs.address.focus() this.$refs.address.focus()
} }
this.$emit('input', this.place) this.$emit('input', { ...this.place })
}, },
changeAddress (v) { changeAddress (v) {
this.place.address = v this.place.address = v
this.$emit('input', this.place) this.$emit('input', { ...this.place })
},
createPlace (v) {
this.$refs.place.blur()
this.$refs.address.focus()
} }
} }
} }

View File

@@ -24,6 +24,7 @@
:value = 'event.title' :value = 'event.title'
:rules="[$validators.required('common.title')]" :rules="[$validators.required('common.title')]"
:hint="$t('event.what_description')" :hint="$t('event.what_description')"
prepend-icon='mdi-format-title'
:label="$t('common.title')" :label="$t('common.title')"
autofocus autofocus
ref='title') ref='title')
@@ -53,6 +54,7 @@
//- tags //- tags
v-combobox.col-6.mt-3(v-model='event.tags' v-combobox.col-6.mt-3(v-model='event.tags'
prepend-icon="mdi-tag-multiple"
chips small-chips multiple deletable-chips hide-no-data hide-selected persistent-hint chips small-chips multiple deletable-chips hide-no-data hide-selected persistent-hint
:delimiters="[',', ' ']" :delimiters="[',', ' ']"
:items="tags.map(t => t.tag)" :items="tags.map(t => t.tag)"
@@ -169,7 +171,6 @@ export default {
this.loading = true this.loading = true
let start_datetime, end_datetime let start_datetime, end_datetime
const [start_hour, start_minute] = this.time.start.split(':') const [start_hour, start_minute] = this.time.start.split(':')
console.error('TIME: hour', start_hour, this.time)
if (!this.time.end) { if (!this.time.end) {
this.time.end = (Number(start_hour) + 2) + ':' + start_minute this.time.end = (Number(start_hour) + 2) + ':' + start_minute
} }
@@ -183,7 +184,6 @@ export default {
end_datetime = dayjs(this.date.date[1]) end_datetime = dayjs(this.date.date[1])
.set('hour', end_hour).set('minute', end_minute) .set('hour', end_hour).set('minute', end_minute)
} else if (this.date.type === 'normal') { } else if (this.date.type === 'normal') {
console.error('dentro type normal', this.date.type)
start_datetime = dayjs(this.date.date).set('hour', start_hour).set('minute', start_minute) start_datetime = dayjs(this.date.date).set('hour', start_hour).set('minute', start_minute)
end_datetime = dayjs(this.date.date).set('hour', end_hour).set('minute', end_minute) end_datetime = dayjs(this.date.date).set('hour', end_hour).set('minute', end_minute)
if (end_hour < start_hour) { if (end_hour < start_hour) {