0
1
Fork 0

Config prettier and eslint for src folder

This commit is contained in:
William Buezas 2024-07-16 21:17:22 -03:00
parent 6458d8db5e
commit 47c6fe02ec
42 changed files with 2564 additions and 2249 deletions

View File

@ -7,15 +7,14 @@ module.exports = {
parserOptions: { parserOptions: {
parser: '@babel/eslint-parser', parser: '@babel/eslint-parser',
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
sourceType: 'module' // Allows for the use of imports sourceType: 'module', // Allows for the use of imports
}, },
env: { env: {
browser: true, browser: true,
'vue/setup-compiler-macros': true 'vue/setup-compiler-macros': true,
}, },
// Rules order is important, please avoid shuffling them
extends: [ extends: [
// Base ESLint recommended rules // Base ESLint recommended rules
// 'eslint:recommended', // 'eslint:recommended',
@ -31,12 +30,9 @@ module.exports = {
], ],
plugins: [
// https://eslint.vuejs.org/user-guide/#why-doesn-t-it-work-on-vue-files
// required to lint *.vue files
'vue',
],
plugins: ['vue', 'prettier'],
globals: { globals: {
ga: 'readonly', // Google Analytics ga: 'readonly', // Google Analytics
@ -48,12 +44,11 @@ module.exports = {
__QUASAR_SSR_PWA__: 'readonly', __QUASAR_SSR_PWA__: 'readonly',
process: 'readonly', process: 'readonly',
Capacitor: 'readonly', Capacitor: 'readonly',
chrome: 'readonly' chrome: 'readonly',
}, },
// add your custom rules here // add your custom rules here
rules: { rules: {
// allow async-await // allow async-await
'generator-star-spacing': 'off', 'generator-star-spacing': 'off',
// allow paren-less arrow functions // allow paren-less arrow functions
@ -72,8 +67,20 @@ module.exports = {
'import/no-extraneous-dependencies': 'off', 'import/no-extraneous-dependencies': 'off',
'prefer-promise-reject-errors': 'off', 'prefer-promise-reject-errors': 'off',
semi: 'off',
// allow debugger during development only // allow debugger during development only
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
} },
} overrides: [
{
extends: [
'plugin:vue/vue3-essential',
],
files: ['src/**/*.{js,vue,scss}'], // Aplica ESLint solo a archivos .js y .vue dentro de src
rules: {
semi: 'off',
indent: ['error', 4, { SwitchCase: 1 }],
},
},
],
};

9
.prettierrc.js Normal file
View File

@ -0,0 +1,9 @@
module.exports = {
printWidth: 80,
tabWidth: 4,
useTabs: false,
singleQuote: true,
trailingComma: 'all',
bracketSpacing: true,
arrowParens: 'avoid',
};

589
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -17,12 +17,14 @@
"assets-webpack-plugin": "^7.1.1", "assets-webpack-plugin": "^7.1.1",
"babel-loader": "^9.1.0", "babel-loader": "^9.1.0",
"bundle-loader": "^0.5.6", "bundle-loader": "^0.5.6",
"eslint": "^8.10.0", "eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard": "^17.0.0", "eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.19.1", "eslint-plugin-import": "^2.19.1",
"eslint-plugin-n": "^15.0.0", "eslint-plugin-n": "^15.0.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-promise": "^6.0.0", "eslint-plugin-promise": "^6.0.0",
"eslint-plugin-vue": "^9.0.0", "eslint-plugin-vue": "^9.27.0",
"eslint-webpack-plugin": "^3.1.1", "eslint-webpack-plugin": "^3.1.1",
"file-loader": "^6.2.0", "file-loader": "^6.2.0",
"fs-extra": "^10.1.0", "fs-extra": "^10.1.0",

View File

@ -1,4 +1,3 @@
export default async ({ app }) => { export default async ({ app }) => {
/* /*
window.addEventListener('error', window.addEventListener('error',

View File

@ -28,7 +28,7 @@ a.link {
} }
.q-card { .q-card {
border-radius: 7px; border-radius: 7px;
box-shadow: 0 0 3px rgba(0, 0, 0, .1); box-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
} }
.q-page-sticky.fixed-bottom-right { .q-page-sticky.fixed-bottom-right {
margin: 18px; margin: 18px;

View File

@ -12,17 +12,17 @@
// to match your app's branding. // to match your app's branding.
// Tip: Use the "Theme Builder" on Quasar's documentation website. // Tip: Use the "Theme Builder" on Quasar's documentation website.
$primary : #1A1A1A; $primary: #1a1a1a;
$secondary : #26A69A; $secondary: #26a69a;
$accent: #8cc63f; $accent: #8cc63f;
$dark : #1D1D1D; $dark: #1d1d1d;
$dark-page: #121212; $dark-page: #121212;
$positive : #21BA45; $positive: #21ba45;
$negative : #C10015; $negative: #c10015;
$info : #31CCEC; $info: #31ccec;
$warning : #F2C037; $warning: #f2c037;
// Width // Width

View File

@ -1,4 +1,3 @@
%margin-auto { %margin-auto {
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;

View File

@ -22,15 +22,7 @@ export default {
'Friday', 'Friday',
'Saturday' 'Saturday'
], ],
daysShort: [ daysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
'Sun',
'Mon',
'Tue',
'Wed',
'Thu',
'Fri',
'Sat'
],
months: [ months: [
'January', 'January',
'February', 'February',

View File

@ -22,15 +22,7 @@ export default {
'Viernes', 'Viernes',
'Sábado' 'Sábado'
], ],
daysShort: [ daysShort: ['Do', 'Lu', 'Mi', 'Mi', 'Ju', 'Vi', 'Sa'],
'Do',
'Lu',
'Mi',
'Mi',
'Ju',
'Vi',
'Sa'
],
months: [ months: [
'Enero', 'Enero',
'Febrero', 'Febrero',

View File

@ -57,8 +57,10 @@ export class Connection extends JsonConnection {
}) })
for (let j = 0; j < rows.length; j++) { for (let j = 0; j < rows.length; j++) {
const row = data[j] = {} const row = (data[j] = {})
for (let k = 0; k < columns.length; k++) { row[columns[k].name] = rows[j][k] } for (let k = 0; k < columns.length; k++) {
row[columns[k].name] = rows[j][k]
}
} }
for (let j = 0; j < columns.length; j++) { for (let j = 0; j < columns.length; j++) {
@ -74,14 +76,20 @@ export class Connection extends JsonConnection {
} }
if (castFunc !== null) { if (castFunc !== null) {
if (col.def != null) { col.def = castFunc(col.def) } if (col.def != null) {
col.def = castFunc(col.def)
}
for (let k = 0; k < data.length; k++) { for (let k = 0; k < data.length; k++) {
if (data[k][col.name] != null) { data[k][col.name] = castFunc(data[k][col.name]) } if (data[k][col.name] != null) {
data[k][col.name] = castFunc(data[k][col.name])
} }
} }
} }
} else { results.push(json[i]) } }
} else {
results.push(json[i])
}
} }
} }
} catch (e) { } catch (e) {
@ -100,7 +108,7 @@ export class Connection extends JsonConnection {
* @return {ResultSet} The result * @return {ResultSet} The result
*/ */
async execQuery (query, params) { async execQuery (query, params) {
const sql = query.replace(/#\w+/g, key => { const sql = query.replace(/#\w+/g, (key) => {
const value = params[key.substring(1)] const value = params[key.substring(1)]
return value ? this.renderValue(value) : key return value ? this.renderValue(value) : key
}) })
@ -128,7 +136,7 @@ export class Connection extends JsonConnection {
case 'number': case 'number':
return v return v
case 'boolean': case 'boolean':
return (v) ? 'TRUE' : 'FALSE' return v ? 'TRUE' : 'FALSE'
case 'string': case 'string':
return "'" + v.replace(this.regexp, this.replaceFunc) + "'" return "'" + v.replace(this.regexp, this.replaceFunc) + "'"
default: default:
@ -136,8 +144,12 @@ export class Connection extends JsonConnection {
if (!isNaN(v.getTime())) { if (!isNaN(v.getTime())) {
const unixTime = parseInt(fixTz(v).getTime() / 1000) const unixTime = parseInt(fixTz(v).getTime() / 1000)
return 'DATE(FROM_UNIXTIME(' + unixTime + '))' return 'DATE(FROM_UNIXTIME(' + unixTime + '))'
} else { return '0000-00-00' } } else {
} else { return 'NULL' } return '0000-00-00'
}
} else {
return 'NULL'
}
} }
} }
@ -151,16 +163,14 @@ export class Connection extends JsonConnection {
// TODO: Read time zone from db configuration // TODO: Read time zone from db configuration
const tz = { timeZone: 'Europe/Madrid' } const tz = { timeZone: 'Europe/Madrid' }
const isLocal = Intl const isLocal = Intl.DateTimeFormat().resolvedOptions().timeZone === tz.timeZone
.DateTimeFormat()
.resolvedOptions()
.timeZone === tz.timeZone
function fixTz (date) { function fixTz (date) {
if (isLocal) return date if (isLocal) return date
const localDate = new Date(date.toLocaleString('en-US', tz)) const localDate = new Date(date.toLocaleString('en-US', tz))
const hasTime = localDate.getHours() || const hasTime =
localDate.getHours() ||
localDate.getMinutes() || localDate.getMinutes() ||
localDate.getSeconds() || localDate.getSeconds() ||
localDate.getMilliseconds() localDate.getMilliseconds()

View File

@ -1,4 +1,3 @@
import { Result } from './result' import { Result } from './result'
/** /**
@ -26,10 +25,13 @@ export class ResultSet {
} }
fetch () { fetch () {
if (this.error) { throw this.error } if (this.error) {
throw this.error
}
if (this.results !== null && if (this.results !== null && this.results.length > 0) {
this.results.length > 0) { return this.results.shift() } return this.results.shift()
}
return null return null
} }
@ -61,9 +63,13 @@ export class ResultSet {
fetchObject () { fetchObject () {
const result = this.fetch() const result = this.fetch()
if (result !== null && if (
result !== null &&
result.data instanceof Array && result.data instanceof Array &&
result.data.length > 0) { return result.data[0] } result.data.length > 0
) {
return result.data[0]
}
return null return null
} }
@ -76,8 +82,7 @@ export class ResultSet {
fetchData () { fetchData () {
const result = this.fetch() const result = this.fetch()
if (result !== null && if (result !== null && result.data instanceof Array) {
result.data instanceof Array) {
return result.data return result.data
} }
@ -92,7 +97,9 @@ export class ResultSet {
fetchValue () { fetchValue () {
const row = this.fetchRow() const row = this.fetchRow()
if (row instanceof Array && row.length > 0) { return row[0] } if (row instanceof Array && row.length > 0) {
return row[0]
}
return null return null
} }
@ -105,9 +112,11 @@ export class ResultSet {
fetchRow () { fetchRow () {
const result = this.fetch() const result = this.fetch()
if (result !== null && if (
result !== null &&
result.data instanceof Array && result.data instanceof Array &&
result.data.length > 0) { result.data.length > 0
) {
const object = result.data[0] const object = result.data[0]
const row = new Array(result.columns.length) const row = new Array(result.columns.length)
for (let i = 0; i < row.length; i++) { for (let i = 0; i < row.length; i++) {

View File

@ -19,7 +19,9 @@ export class Result {
col.index = i col.index = i
this.columnMap[col.name] = col this.columnMap[col.name] = col
} }
} else { this.columnMap = null } } else {
this.columnMap = null
}
} }
/** /**
@ -54,7 +56,9 @@ export class Result {
next () { next () {
this.row++ this.row++
if (this.row >= this.data.length) { return false } if (this.row >= this.data.length) {
return false
}
return true return true
} }

View File

@ -1,4 +1,3 @@
import { VnObject } from './object' import { VnObject } from './object'
import { JsonException } from './json-exception' import { JsonException } from './json-exception'
@ -34,7 +33,9 @@ export class JsonConnection extends VnObject {
const elements = form.elements const elements = form.elements
for (let i = 0; i < elements.length; i++) { for (let i = 0; i < elements.length; i++) {
if (elements[i].name) { params[elements[i].name] = elements[i].value } if (elements[i].name) {
params[elements[i].name] = elements[i].value
}
} }
return this.sendWithUrl('POST', form.action, params) return this.sendWithUrl('POST', form.action, params)
@ -93,32 +94,39 @@ export class JsonConnection extends VnObject {
} }
const promise = new Promise((resolve, reject) => { const promise = new Promise((resolve, reject) => {
request.onreadystatechange = request.onreadystatechange = () =>
() => this._onStateChange(request, resolve, reject) this._onStateChange(request, resolve, reject)
}) })
request.send(config.data) request.send(config.data)
this._requestsCount++ this._requestsCount++
if (this._requestsCount === 1) { this.emit('loading-changed', true) } if (this._requestsCount === 1) {
this.emit('loading-changed', true)
}
return promise return promise
} }
_onStateChange (request, resolve, reject) { _onStateChange (request, resolve, reject) {
if (request.readyState !== 4) { return } if (request.readyState !== 4) {
return
}
this._requestsCount-- this._requestsCount--
if (this._requestsCount === 0) { this.emit('loading-changed', false) } if (this._requestsCount === 0) {
this.emit('loading-changed', false)
}
let data = null let data = null
let error = null let error = null
try { try {
if (request.status === 0) { if (request.status === 0) {
const err = new JsonException() const err = new JsonException()
err.message = 'The server does not respond, please check your Internet connection' err.message =
'The server does not respond, please check your Internet connection'
err.statusCode = request.status err.statusCode = request.status
throw err throw err
} }
@ -144,8 +152,12 @@ export class JsonConnection extends VnObject {
let json let json
let jsData let jsData
if (request.responseText) { json = JSON.parse(request.responseText) } if (request.responseText) {
if (json) { jsData = json.data || json } json = JSON.parse(request.responseText)
}
if (json) {
jsData = json.data || json
}
if (request.status >= 200 && request.status < 300) { if (request.status >= 200 && request.status < 300) {
data = jsData data = jsData
@ -181,6 +193,8 @@ export class JsonConnection extends VnObject {
if (error) { if (error) {
this.emit('error', error) this.emit('error', error)
reject(error) reject(error)
} else { resolve(data) } } else {
resolve(data)
}
} }
} }

View File

@ -1,4 +1,3 @@
/** /**
* The main base class. Manages the signal system. Objects based on this class * The main base class. Manages the signal system. Objects based on this class
* can be instantiated declaratively using XML. * can be instantiated declaratively using XML.
@ -45,7 +44,9 @@ export class VnObject {
* @param {Object} props Properties * @param {Object} props Properties
*/ */
setProperties (props) { setProperties (props) {
for (const prop in props) { this[prop] = props[prop] } for (const prop in props) {
this[prop] = props[prop]
}
} }
/** /**
@ -62,7 +63,9 @@ export class VnObject {
unref () { unref () {
this._refCount-- this._refCount--
if (this._refCount === 0) { this._destroy() } if (this._refCount === 0) {
this._destroy()
}
} }
/** /**
@ -91,14 +94,16 @@ export class VnObject {
*/ */
on (id, callback, instance) { on (id, callback, instance) {
if (!(callback instanceof Function)) { if (!(callback instanceof Function)) {
console.warn('Vn.Object: Invalid callback for signal \'%s\'', id) console.warn("Vn.Object: Invalid callback for signal '%s'", id)
return return
} }
this._signalInit() this._signalInit()
let callbacks = this._thisArg.signals[id] let callbacks = this._thisArg.signals[id]
if (!callbacks) { callbacks = this._thisArg.signals[id] = [] } if (!callbacks) {
callbacks = this._thisArg.signals[id] = []
}
callbacks.push({ callbacks.push({
blocked: false, blocked: false,
@ -115,15 +120,23 @@ export class VnObject {
* @param {boolean} block %true for lock the signal, %false for unlock * @param {boolean} block %true for lock the signal, %false for unlock
*/ */
blockSignal (id, callback, block, instance) { blockSignal (id, callback, block, instance) {
if (!this._thisArg) { return } if (!this._thisArg) {
return
}
const callbacks = this._thisArg.signals[id] const callbacks = this._thisArg.signals[id]
if (!callbacks) { return } if (!callbacks) {
return
}
for (let i = 0; i < callbacks.length; i++) { for (let i = 0; i < callbacks.length; i++) {
if (callbacks[i].callback === callback && if (
callbacks[i].instance === instance) { callbacks[i].blocked = block } callbacks[i].callback === callback &&
callbacks[i].instance === instance
) {
callbacks[i].blocked = block
}
} }
} }
@ -133,19 +146,27 @@ export class VnObject {
* @param {string} id The signal identifier * @param {string} id The signal identifier
*/ */
emit (id) { emit (id) {
if (!this._thisArg) { return } if (!this._thisArg) {
return
}
const callbacks = this._thisArg.signals[id] const callbacks = this._thisArg.signals[id]
if (!callbacks) { return } if (!callbacks) {
return
}
const callbackArgs = [] const callbackArgs = []
callbackArgs.push(this) callbackArgs.push(this)
for (let i = 1; i < arguments.length; i++) { callbackArgs.push(arguments[i]) } for (let i = 1; i < arguments.length; i++) {
callbackArgs.push(arguments[i])
}
for (let i = 0; i < callbacks.length; i++) { for (let i = 0; i < callbacks.length; i++) {
if (!callbacks[i].blocked) { callbacks[i].callback.apply(callbacks[i].instance, callbackArgs) } if (!callbacks[i].blocked) {
callbacks[i].callback.apply(callbacks[i].instance, callbackArgs)
}
} }
} }
@ -157,14 +178,20 @@ export class VnObject {
* @param {Object} instance The instance * @param {Object} instance The instance
*/ */
disconnect (id, callback, instance) { disconnect (id, callback, instance) {
if (!this._thisArg) { return } if (!this._thisArg) {
return
}
const callbacks = this._thisArg.signals[id] const callbacks = this._thisArg.signals[id]
if (callbacks) { if (callbacks) {
for (let i = callbacks.length; i--;) { for (let i = callbacks.length; i--;) {
if (callbacks[i].callback === callback && if (
callbacks[i].instance === instance) { callbacks.splice(i, 1) } callbacks[i].callback === callback &&
callbacks[i].instance === instance
) {
callbacks.splice(i, 1)
}
} }
} }
} }
@ -175,7 +202,9 @@ export class VnObject {
* @param {Object} instance The instance * @param {Object} instance The instance
*/ */
disconnectByInstance (instance) { disconnectByInstance (instance) {
if (!this._thisArg) { return } if (!this._thisArg) {
return
}
const signals = this._thisArg.signals const signals = this._thisArg.signals
@ -184,7 +213,9 @@ export class VnObject {
if (callbacks) { if (callbacks) {
for (let i = callbacks.length; i--;) { for (let i = callbacks.length; i--;) {
if (callbacks[i].instance === instance) { callbacks.splice(i, 1) } if (callbacks[i].instance === instance) {
callbacks.splice(i, 1)
}
} }
} }
} }
@ -196,11 +227,15 @@ export class VnObject {
* but should always call the parent method. * but should always call the parent method.
*/ */
_destroy () { _destroy () {
if (!this._thisArg) { return } if (!this._thisArg) {
return
}
const links = this._thisArg.links const links = this._thisArg.links
for (const key in links) { this._unlink(links[key]) } for (const key in links) {
this._unlink(links[key])
}
this._thisArg = null this._thisArg = null
} }
@ -219,15 +254,21 @@ export class VnObject {
const newObject = prop[key] const newObject = prop[key]
const oldObject = this[key] const oldObject = this[key]
if (oldObject) { this._unlink(oldObject) } if (oldObject) {
this._unlink(oldObject)
}
this[key] = newObject this[key] = newObject
if (newObject) { if (newObject) {
links[key] = newObject.ref() links[key] = newObject.ref()
for (const signal in handlers) { newObject.on(signal, handlers[signal], this) } for (const signal in handlers) {
} else if (oldObject) { links[key] = undefined } newObject.on(signal, handlers[signal], this)
}
} else if (oldObject) {
links[key] = undefined
}
} }
} }

View File

@ -1,5 +1,8 @@
<template> <template>
<q-layout id="bg" class="fullscreen row justify-center items-center layout-view scroll"> <q-layout
id="bg"
class="fullscreen row justify-center items-center layout-view scroll"
>
<div class="column q-pa-md row items-center justify-center"> <div class="column q-pa-md row items-center justify-center">
<router-view v-slot="{ Component }"> <router-view v-slot="{ Component }">
<transition> <transition>

View File

@ -8,38 +8,34 @@
round round
icon="menu" icon="menu"
aria-label="Menu" aria-label="Menu"
@click="toggleLeftDrawer"/> @click="toggleLeftDrawer"
/>
<q-toolbar-title> <q-toolbar-title>
{{ $app.title }} {{ $app.title }}
<div <div v-if="$app.subtitle" class="subtitle text-caption">
v-if="$app.subtitle"
class="subtitle text-caption">
{{ $app.subtitle }} {{ $app.subtitle }}
</div> </div>
</q-toolbar-title> </q-toolbar-title>
<div id="actions" ref="actions"> <div id="actions" ref="actions"></div>
</div>
<q-btn <q-btn
v-if="$app.useRightDrawer" v-if="$app.useRightDrawer"
@click="$app.rightDrawerOpen = !$app.rightDrawerOpen" @click="$app.rightDrawerOpen = !$app.rightDrawerOpen"
aria-label="Menu" aria-label="Menu"
flat flat
dense dense
round> round
>
<q-icon name="menu" /> <q-icon name="menu" />
</q-btn> </q-btn>
</q-toolbar> </q-toolbar>
</q-header> </q-header>
<q-drawer <q-drawer v-model="leftDrawerOpen" :width="250" show-if-above>
v-model="leftDrawerOpen"
:width="250"
show-if-above>
<q-toolbar class="logo"> <q-toolbar class="logo">
<img src="statics/logo-dark.svg"> <img src="statics/logo-dark.svg" />
</q-toolbar> </q-toolbar>
<div class="user-info"> <div class="user-info">
<div> <div>
<span id="user-name">{{(user.nickname)}}</span> <span id="user-name">{{ user.nickname }}</span>
<q-btn flat icon="logout" alt="_Exit" @click="logout()" /> <q-btn flat icon="logout" alt="_Exit" @click="logout()" />
</div> </div>
<div id="supplant" class="supplant"> <div id="supplant" class="supplant">
@ -47,12 +43,8 @@
<q-btn flat icon="logout" alt="_Exit" /> <q-btn flat icon="logout" alt="_Exit" />
</div> </div>
</div> </div>
<q-list <q-list v-for="item in essentialLinks" :key="item.id">
v-for="item in essentialLinks" <q-item v-if="!item.childs" :to="`/${item.path}`">
:key="item.id">
<q-item
v-if="!item.childs"
:to="`/${item.path}`">
<q-item-section> <q-item-section>
<q-item-label>{{ item.description }}</q-item-label> <q-item-label>{{ item.description }}</q-item-label>
</q-item-section> </q-item-section>
@ -60,13 +52,15 @@
<q-expansion-item <q-expansion-item
v-if="item.childs" v-if="item.childs"
:label="item.description" :label="item.description"
expand-separator> expand-separator
>
<q-list> <q-list>
<q-item <q-item
v-for="subitem in item.childs" v-for="subitem in item.childs"
:key="subitem.id" :key="subitem.id"
:to="`/${subitem.path}`" :to="`/${subitem.path}`"
class="q-pl-lg"> class="q-pl-lg"
>
<q-item-section> <q-item-section>
<q-item-label>{{ subitem.description }}</q-item-label> <q-item-label>{{ subitem.description }}</q-item-label>
</q-item-section> </q-item-section>
@ -134,7 +128,7 @@
</style> </style>
<style lang="scss"> <style lang="scss">
@import "src/css/responsive"; @import 'src/css/responsive';
.q-drawer { .q-drawer {
.q-item { .q-item {
@ -215,7 +209,9 @@ export default defineComponent({
const parentSection = sectionMap.get(parent) const parentSection = sectionMap.get(parent)
if (!parentSection) continue if (!parentSection) continue
let childs = parentSection.childs let childs = parentSection.childs
if (!childs) { childs = parentSection.childs = [] } if (!childs) {
childs = parentSection.childs = []
}
childs.push(section) childs.push(section)
} else { } else {
sectionTree.push(section) sectionTree.push(section)

View File

@ -1,4 +1,3 @@
import { date as qdate, format } from 'quasar' import { date as qdate, format } from 'quasar'
const { pad } = format const { pad } = format
@ -61,7 +60,7 @@ export function elapsedTime (val) {
if (!(val instanceof Date)) { if (!(val instanceof Date)) {
val = new Date(val) val = new Date(val)
} }
const now = (new Date()).getTime() const now = new Date().getTime()
val = Math.floor((now - val.getTime()) / 1000) val = Math.floor((now - val.getTime()) / 1000)
const hours = Math.floor(val / 3600) const hours = Math.floor(val / 3600)

View File

@ -1,13 +1,9 @@
<template> <template>
<div style="padding: 0;"> <div style="padding: 0">
<div class="q-pa-sm row items-start"> <div class="q-pa-sm row items-start">
<div <div class="new-card q-pa-sm" v-for="myNew in news" :key="myNew.id">
class="new-card q-pa-sm"
v-for="myNew in news"
:key="myNew.id">
<q-card> <q-card>
<q-img :src="`${$app.imageUrl}/news/full/${myNew.image}`"> <q-img :src="`${$app.imageUrl}/news/full/${myNew.image}`"> </q-img>
</q-img>
<q-card-section> <q-card-section>
<div class="text-h5">{{ myNew.title }}</div> <div class="text-h5">{{ myNew.title }}</div>
</q-card-section> </q-card-section>

View File

@ -8,12 +8,10 @@
rounded rounded
dark dark
dense dense
standout> standout
>
<template v-slot:prepend> <template v-slot:prepend>
<q-icon <q-icon v-if="search === ''" name="search" />
v-if="search === ''"
name="search"
/>
<q-icon <q-icon
v-else v-else
name="clear" name="clear"
@ -27,13 +25,11 @@
:label="$t(viewMode == 'list' ? 'listView' : 'gridView')" :label="$t(viewMode == 'list' ? 'listView' : 'gridView')"
@click="onViewModeClick()" @click="onViewModeClick()"
rounded rounded
no-caps/> no-caps
/>
</Teleport> </Teleport>
<div style="padding-bottom: 5em;"> <div style="padding-bottom: 5em">
<q-drawer <q-drawer v-model="$app.rightDrawerOpen" side="right" :width="250">
v-model="$app.rightDrawerOpen"
side="right"
:width="250">
<div class="q-pa-md"> <div class="q-pa-md">
<div class="basket-info"> <div class="basket-info">
<p>{{ date(new Date()) }}</p> <p>{{ date(new Date()) }}</p>
@ -41,10 +37,7 @@
{{ $t('warehouse') }} {{ $t('warehouse') }}
{{ 'Algemesi' }} {{ 'Algemesi' }}
</p> </p>
<q-btn <q-btn flat rounded no-caps>
flat
rounded
no-caps>
{{ $t('modify') }} {{ $t('modify') }}
</q-btn> </q-btn>
</div> </div>
@ -53,7 +46,7 @@
{{ $t('category') }} {{ $t('category') }}
<q-icon <q-icon
v-if="category" v-if="category"
style="font-size: 1.3em;" style="font-size: 1.3em"
name="cancel" name="cancel"
class="cursor-pointer" class="cursor-pointer"
:title="$t('deleteFilter')" :title="$t('deleteFilter')"
@ -69,13 +62,13 @@
:class="{ active: category == cat.id }" :class="{ active: category == cat.id }"
:key="cat.id" :key="cat.id"
:title="cat.name" :title="cat.name"
:to="{params: {category: cat.id, type: null}}"> :to="{ params: { category: cat.id, type: null } }"
<img :src="`statics/category/${cat.code}.svg`"> >
<img :src="`statics/category/${cat.code}.svg`" />
</q-btn> </q-btn>
</div> </div>
</div> </div>
<div class="q-mt-md" <div class="q-mt-md" v-if="category || search">
v-if="category || search">
<div class="q-mb-xs text-grey-7"> <div class="q-mb-xs text-grey-7">
{{ $t('filterBy') }} {{ $t('filterBy') }}
</div> </div>
@ -98,16 +91,13 @@
/> />
</div> </div>
</div> </div>
<div class="q-pa-md" <div class="q-pa-md" v-if="typeId || search">
v-if="typeId || search"> <div class="q-mb-md" v-for="tag in tags" :key="tag.uid">
<div class="q-mb-md"
v-for="tag in tags"
:key="tag.uid">
<div class="q-mb-xs text-caption text-grey-7"> <div class="q-mb-xs text-caption text-grey-7">
{{ tag.name }} {{ tag.name }}
<q-icon <q-icon
v-if="tag.hasFilter" v-if="tag.hasFilter"
style="font-size: 1.3em;" style="font-size: 1.3em"
name="cancel" name="cancel"
:title="$t('deleteFilter')" :title="$t('deleteFilter')"
class="cursor-pointer" class="cursor-pointer"
@ -117,7 +107,8 @@
<div v-if="!tag.useRange"> <div v-if="!tag.useRange">
<div <div
v-for="value in tag.values.slice(0, tag.showCount)" v-for="value in tag.values.slice(0, tag.showCount)"
:key="value"> :key="value"
>
<q-checkbox <q-checkbox
v-model="tag.filter" v-model="tag.filter"
:dense="true" :dense="true"
@ -129,7 +120,8 @@
<div v-if="tag.values.length > tag.showCount"> <div v-if="tag.values.length > tag.showCount">
<span <span
class="cursor-pointer text-blue" class="cursor-pointer text-blue"
@click="tag.showCount = Infinity"> @click="tag.showCount = Infinity"
>
<q-icon name="keyboard_arrow_down" /> <q-icon name="keyboard_arrow_down" />
{{ $t('viewMore') }} {{ $t('viewMore') }}
</span> </span>
@ -137,7 +129,8 @@
<div v-if="tag.showCount == Infinity"> <div v-if="tag.showCount == Infinity">
<span <span
class="cursor-pointer text-blue" class="cursor-pointer text-blue"
@click="tag.showCount = tag.initialCount"> @click="tag.showCount = tag.initialCount"
>
<q-icon name="keyboard_arrow_up" /> <q-icon name="keyboard_arrow_up" />
{{ $t('viewLess') }} {{ $t('viewLess') }}
</span> </span>
@ -166,44 +159,45 @@
@load="onLoad" @load="onLoad"
scroll-taget="html" scroll-taget="html"
:offset="800" :offset="800"
:disable="disableScroll"> :disable="disableScroll"
>
<div class="q-pa-md row justify-center q-gutter-md"> <div class="q-pa-md row justify-center q-gutter-md">
<q-spinner <q-spinner v-if="isLoading" color="primary" size="50px"> </q-spinner>
v-if="isLoading"
color="primary"
size="50px">
</q-spinner>
<div <div
v-if="items && !items.length" v-if="items && !items.length"
class="text-subtitle1 text-grey-7 q-pa-md"> class="text-subtitle1 text-grey-7 q-pa-md"
>
{{ $t('noItemsFound') }} {{ $t('noItemsFound') }}
</div> </div>
<div <div
v-if="!items && !isLoading" v-if="!items && !isLoading"
class="text-subtitle1 text-grey-7 q-pa-md"> class="text-subtitle1 text-grey-7 q-pa-md"
>
{{ $t('pleaseSetFilter') }} {{ $t('pleaseSetFilter') }}
</div> </div>
<q-card <q-card class="my-card" v-for="item in items" :key="item.id">
class="my-card"
v-for="item in items"
:key="item.id">
<img :src="`${$imageBase}/catalog/200x200/${item.image}`" /> <img :src="`${$imageBase}/catalog/200x200/${item.image}`" />
<q-card-section> <q-card-section>
<div class="name text-subtitle1"> <div class="name text-subtitle1">
{{ item.longName }} {{ item.longName }}
</div> </div>
<div class="sub-name text-uppercase text-subtitle1 text-grey-7 ellipsize q-pt-xs"> <div
class="sub-name text-uppercase text-subtitle1 text-grey-7 ellipsize q-pt-xs"
>
{{ item.subName }} {{ item.subName }}
</div> </div>
<div class="tags q-pt-xs"> <div class="tags q-pt-xs">
<div v-for="tag in item.tags" :key="tag.tagFk"> <div v-for="tag in item.tags" :key="tag.tagFk">
<span class="text-grey-7">{{tag.tag.name}}</span> {{tag.value}} <span class="text-grey-7">{{ tag.tag.name }}</span>
{{ tag.value }}
</div> </div>
</div> </div>
</q-card-section> </q-card-section>
<q-card-actions class="actions justify-between"> <q-card-actions class="actions justify-between">
<div class="q-pl-sm"> <div class="q-pl-sm">
<span class="available bg-green text-white">{{item.available}}</span> <span class="available bg-green text-white">{{
item.available
}}</span>
{{ $t('from') }} {{ $t('from') }}
<span class="price">{{ currency(item.buy?.price3) }}</span> <span class="price">{{ currency(item.buy?.price3) }}</span>
</div> </div>
@ -211,7 +205,8 @@
icon="add_shopping_cart" icon="add_shopping_cart"
:title="$t('buy')" :title="$t('buy')"
@click="showItem(item)" @click="showItem(item)"
flat> flat
>
</q-btn> </q-btn>
</q-card-actions> </q-card-actions>
</q-card> </q-card>
@ -223,10 +218,11 @@
</template> </template>
</q-infinite-scroll> </q-infinite-scroll>
<q-dialog v-model="showItemDialog"> <q-dialog v-model="showItemDialog">
<q-card style="width: 25em;"> <q-card style="width: 25em">
<q-img <q-img
:src="`${$imageBase}/catalog/200x200/${item.image}`" :src="`${$imageBase}/catalog/200x200/${item.image}`"
:ratio="5/3"> :ratio="5 / 3"
>
<div class="absolute-bottom text-center q-pa-xs"> <div class="absolute-bottom text-center q-pa-xs">
<div class="text-subtitle1"> <div class="text-subtitle1">
{{ item.longName }} {{ item.longName }}
@ -237,24 +233,19 @@
<div class="text-uppercase text-subtitle1 text-grey-7 ellipsize"> <div class="text-uppercase text-subtitle1 text-grey-7 ellipsize">
{{ item.subName }} {{ item.subName }}
</div> </div>
<div class="text-grey-7"> <div class="text-grey-7">#{{ item.id }}</div>
#{{item.id}}
</div>
</q-card-section> </q-card-section>
<q-card-section> <q-card-section>
<div v-for="tag in item.tags" :key="tag.tagFk"> <div v-for="tag in item.tags" :key="tag.tagFk">
<span class="text-grey-7">{{tag.tag.name}}</span> {{tag.value}} <span class="text-grey-7">{{ tag.tag.name }}</span>
{{ tag.value }}
</div> </div>
</q-card-section> </q-card-section>
<q-card-actions align="right"> <q-card-actions align="right">
<q-btn <q-btn @click="showItemDialog = false" flat>
@click="showItemDialog = false"
flat>
{{ $t('cancel') }} {{ $t('cancel') }}
</q-btn> </q-btn>
<q-btn <q-btn @click="showItemDialog = false" flat>
@click="showItemDialog = false"
flat>
{{ $t('accept') }} {{ $t('accept') }}
</q-btn> </q-btn>
</q-card-actions> </q-card-actions>
@ -266,7 +257,8 @@
to="/ecomerce/basket" to="/ecomerce/basket"
icon="shopping_cart" icon="shopping_cart"
color="accent" color="accent"
:title="$t('shoppingCart')"/> :title="$t('shoppingCart')"
/>
</q-page-sticky> </q-page-sticky>
</div> </div>
</template> </template>
@ -284,7 +276,7 @@
& > p { & > p {
margin: 0; margin: 0;
padding: .4em 0; padding: 0.4em 0;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
@ -298,7 +290,7 @@
width: 55px; width: 55px;
&.active { &.active {
background: rgba(0, 0, 0, .08); background: rgba(0, 0, 0, 0.08);
} }
& > img { & > img {
height: 40px; height: 40px;
@ -311,8 +303,8 @@
overflow: hidden; overflow: hidden;
} }
.available { .available {
padding: .15em; padding: 0.15em;
border-radius: .2em; border-radius: 0.2em;
font-size: 1.3em; font-size: 1.3em;
} }
.price { .price {
@ -323,7 +315,8 @@
max-width: 17.5em; max-width: 17.5em;
height: 32.5em; height: 32.5em;
overflow: hidden; overflow: hidden;
.name, .sub-name { .name,
.sub-name {
line-height: 1.3em; line-height: 1.3em;
} }
.ellipsize { .ellipsize {
@ -376,22 +369,28 @@ export default {
{ {
label: this.$t('relevancy'), label: this.$t('relevancy'),
value: 'relevancy DESC, longName' value: 'relevancy DESC, longName'
}, { },
{
label: this.$t('name'), label: this.$t('name'),
value: 'longName' value: 'longName'
}, { },
{
label: this.$t('siceAsc'), label: this.$t('siceAsc'),
value: 'size ASC' value: 'size ASC'
}, { },
{
label: this.$t('sizeDesc'), label: this.$t('sizeDesc'),
value: 'size DESC' value: 'size DESC'
}, { },
{
label: this.$t('priceAsc'), label: this.$t('priceAsc'),
value: 'price ASC' value: 'price ASC'
}, { },
{
label: this.$t('priceDesc'), label: this.$t('priceDesc'),
value: 'price DESC' value: 'price DESC'
}, { },
{
label: this.$t('available'), label: this.$t('available'),
value: 'available' value: 'available'
} }
@ -482,12 +481,13 @@ export default {
let subtitle let subtitle
if (this.category) { if (this.category) {
const category = this.categories.find(i => i.id === this.category) || {} const category =
this.categories.find((i) => i.id === this.category) || {}
title = category.name title = category.name
} }
if (this.typeId) { if (this.typeId) {
this.type = this.orgTypes.find(i => i.id === this.typeId) this.type = this.orgTypes.find((i) => i.id === this.typeId)
subtitle = title subtitle = title
title = this.type && this.type.name title = this.type && this.type.name
} else { } else {
@ -558,9 +558,10 @@ export default {
params, params,
cancelToken: this.source.token cancelToken: this.source.token
} }
return this.$axios.get('Items/catalog', config) return this.$axios
.then(res => this.onItemsGet(res)) .get('Items/catalog', config)
.catch(err => this.onItemsError(err)) .then((res) => this.onItemsGet(res))
.catch((err) => this.onItemsError(err))
.finally(() => (this.cancel = null)) .finally(() => (this.cancel = null))
}, },
onItemsError (err) { onItemsError (err) {
@ -574,12 +575,9 @@ export default {
if (tag.filter) { if (tag.filter) {
tag.hasFilter = true tag.hasFilter = true
tag.useRange = tag.useRange = tag.filter.max || tag.filter.min
tag.filter.max ||
tag.filter.min
} else { } else {
tag.useRange = tag.isQuantitative && tag.useRange = tag.isQuantitative && tag.values.length > this.maxTags
tag.values.length > this.maxTags
this.resetTagFilter(tag) this.resetTagFilter(tag)
} }
@ -624,12 +622,15 @@ export default {
}, },
filterType (val, update) { filterType (val, update) {
if (val === '') { if (val === '') {
update(() => { this.types = this.orgTypes }) update(() => {
this.types = this.orgTypes
})
} else { } else {
update(() => { update(() => {
const needle = val.toLowerCase() const needle = val.toLowerCase()
this.types = this.orgTypes.filter(type => this.types = this.orgTypes.filter(
type.name.toLowerCase().indexOf(needle) > -1) (type) => type.name.toLowerCase().indexOf(needle) > -1
)
}) })
} }
}, },
@ -643,8 +644,9 @@ export default {
addressFk: conf.addressFk, addressFk: conf.addressFk,
agencyModeFk: conf.agencyModeFk agencyModeFk: conf.agencyModeFk
} }
this.$axios.get(`Items/${item.id}/calcCatalog`, { params }) this.$axios
.then(res => (this.lots = res.data)) .get(`Items/${item.id}/calcCatalog`, { params })
.then((res) => (this.lots = res.data))
} }
} }
} }

View File

@ -7,12 +7,14 @@
dark dark
standout standout
dense dense
rounded /> rounded
/>
</Teleport> </Teleport>
<div class="vn-w-sm"> <div class="vn-w-sm">
<div <div
v-if="!invoices?.length" v-if="!invoices?.length"
class="text-subtitle1 text-center text-grey-7 q-pa-md"> class="text-subtitle1 text-center text-grey-7 q-pa-md"
>
{{ $t('noInvoicesFound') }} {{ $t('noInvoicesFound') }}
</div> </div>
<q-card v-if="invoices?.length"> <q-card v-if="invoices?.length">
@ -22,7 +24,8 @@
:rows="invoices" :rows="invoices"
row-key="id" row-key="id"
hide-header hide-header
hide-bottom> hide-bottom
>
<template v-slot:body="props"> <template v-slot:body="props">
<q-tr :props="props"> <q-tr :props="props">
<q-td key="ref" :props="props"> <q-td key="ref" :props="props">
@ -42,13 +45,15 @@
:href="invoiceUrl(props.row.id)" :href="invoiceUrl(props.row.id)"
target="_blank" target="_blank"
flat flat
round/> round
/>
<q-icon <q-icon
v-else v-else
name="warning" name="warning"
:title="$t('notDownloadable')" :title="$t('notDownloadable')"
color="warning" color="warning"
size="24px"/> size="24px"
/>
</q-td> </q-td>
</q-tr> </q-tr>
</template> </template>
@ -63,7 +68,7 @@ import { date, currency } from 'src/lib/filters.js'
export default { export default {
name: 'OrdersPendingIndex', name: 'OrdersPendingIndex',
data () { data () {
const curYear = (new Date()).getFullYear() const curYear = new Date().getFullYear()
const years = [] const years = []
for (let year = curYear - 5; year <= curYear; year++) { for (let year = curYear - 5; year <= curYear; year++) {
@ -116,11 +121,14 @@ export default {
}, },
invoiceUrl (id) { invoiceUrl (id) {
return '?' + new URLSearchParams({ return (
'?' +
new URLSearchParams({
srv: 'rest:dms/invoice', srv: 'rest:dms/invoice',
invoice: id, invoice: id,
access_token: this.$user.token access_token: this.$user.token
}).toString() }).toString()
)
} }
} }
} }

View File

@ -2,34 +2,31 @@
<Teleport :to="$actions"> <Teleport :to="$actions">
<div class="balance"> <div class="balance">
<span class="label">{{ $t('balance') }}</span> <span class="label">{{ $t('balance') }}</span>
<span <span class="amount" :class="{ negative: debt < 0 }">
class="amount"
:class="{negative: debt < 0}">
{{ currency(debt || 0) }} {{ currency(debt || 0) }}
</span> </span>
<q-icon <q-icon name="info" :title="$t('paymentInfo')" class="info" size="24px" />
name="info"
:title="$t('paymentInfo')"
class="info"
size="24px"/>
</div> </div>
<q-btn <q-btn
icon="payments" icon="payments"
:label="$t('makePayment')" :label="$t('makePayment')"
@click="onPayClick()" @click="onPayClick()"
rounded rounded
no-caps/> no-caps
/>
<q-btn <q-btn
to="/ecomerce/basket" to="/ecomerce/basket"
icon="shopping_cart" icon="shopping_cart"
:label="$t('shoppingCart')" :label="$t('shoppingCart')"
rounded rounded
no-caps/> no-caps
/>
</Teleport> </Teleport>
<div class="vn-w-sm"> <div class="vn-w-sm">
<div <div
v-if="!orders?.length" v-if="!orders?.length"
class="text-subtitle1 text-center text-grey-7 q-pa-md"> class="text-subtitle1 text-center text-grey-7 q-pa-md"
>
{{ $t('noOrdersFound') }} {{ $t('noOrdersFound') }}
</div> </div>
<q-card v-if="orders?.length"> <q-card v-if="orders?.length">
@ -39,7 +36,8 @@
:key="order.id" :key="order.id"
:to="`ticket/${order.id}`" :to="`ticket/${order.id}`"
clickable clickable
v-ripple> v-ripple
>
<q-item-section> <q-item-section>
<q-item-label> <q-item-label>
{{ date(order.landed, 'ddd, MMMM Do') }} {{ date(order.landed, 'ddd, MMMM Do') }}
@ -48,9 +46,7 @@
<q-item-label caption>{{ order.nickname }}</q-item-label> <q-item-label caption>{{ order.nickname }}</q-item-label>
<q-item-label caption>{{ order.agency }}</q-item-label> <q-item-label caption>{{ order.agency }}</q-item-label>
</q-item-section> </q-item-section>
<q-item-section side top> <q-item-section side top> {{ order.total }} </q-item-section>
{{order.total}}
</q-item-section>
</q-item> </q-item>
</q-list> </q-list>
</q-card> </q-card>
@ -60,7 +56,8 @@
icon="add_shopping_cart" icon="add_shopping_cart"
color="accent" color="accent"
to="/ecomerce/catalog" to="/ecomerce/catalog"
:title="$t('startOrder')"/> :title="$t('startOrder')"
/>
</q-page-sticky> </q-page-sticky>
</div> </div>
</template> </template>
@ -107,12 +104,8 @@ export default {
async mounted () { async mounted () {
await this.tpv.check(this.$route) await this.tpv.check(this.$route)
this.orders = await this.$jApi.query( this.orders = await this.$jApi.query('CALL myTicket_list(NULL, NULL)')
'CALL myTicket_list(NULL, NULL)' this.debt = await this.$jApi.getValue('SELECT -myClient_getDebt(NULL)')
)
this.debt = await this.$jApi.getValue(
'SELECT -myClient_getDebt(NULL)'
)
}, },
methods: { methods: {

View File

@ -5,7 +5,8 @@
:label="$t('printDeliveryNote')" :label="$t('printDeliveryNote')"
@click="onPrintClick()" @click="onPrintClick()"
rounded rounded
no-caps/> no-caps
/>
</Teleport> </Teleport>
<div> <div>
<q-card class="vn-w-sm"> <q-card class="vn-w-sm">
@ -14,22 +15,31 @@
</q-card-section> </q-card-section>
<q-card-section> <q-card-section>
<div class="text-h6">{{ $t('shippingInformation') }}</div> <div class="text-h6">{{ $t('shippingInformation') }}</div>
<div>{{$t('preparation')}} {{date(ticket.shipped, 'ddd, MMMM Do')}}</div> <div>
<div>{{$t('delivery')}} {{date(ticket.shipped, 'ddd, MMMM Do')}}</div> {{ $t('preparation') }} {{ date(ticket.shipped, 'ddd, MMMM Do') }}
<div>{{$t(ticket.method != 'PICKUP' ? 'agency' : 'warehouse')}} {{ticket.agency}}</div> </div>
<div>
{{ $t('delivery') }} {{ date(ticket.shipped, 'ddd, MMMM Do') }}
</div>
<div>
{{ $t(ticket.method != 'PICKUP' ? 'agency' : 'warehouse') }}
{{ ticket.agency }}
</div>
</q-card-section> </q-card-section>
<q-card-section> <q-card-section>
<div class="text-h6">{{ $t('deliveryAddress') }}</div> <div class="text-h6">{{ $t('deliveryAddress') }}</div>
<div>{{ ticket.nickname }}</div> <div>{{ ticket.nickname }}</div>
<div>{{ ticket.street }}</div> <div>{{ ticket.street }}</div>
<div>{{ticket.postalCode}} {{ticket.city}} ({{ticket.province}})</div> <div>
{{ ticket.postalCode }} {{ ticket.city }} ({{ ticket.province }})
</div>
</q-card-section> </q-card-section>
<q-separator inset /> <q-separator inset />
<q-list v-for="row in rows" :key="row.itemFk"> <q-list v-for="row in rows" :key="row.itemFk">
<q-item> <q-item>
<q-item-section avatar> <q-item-section avatar>
<q-avatar size="68px"> <q-avatar size="68px">
<img :src="`${$app.imageUrl}/catalog/200x200/${row.image}`"> <img :src="`${$app.imageUrl}/catalog/200x200/${row.image}`" />
</q-avatar> </q-avatar>
</q-item-section> </q-item-section>
<q-item-section> <q-item-section>
@ -87,10 +97,7 @@ export default {
'CALL myTicket_get(#ticket)', 'CALL myTicket_get(#ticket)',
params params
) )
this.rows = await this.$jApi.query( this.rows = await this.$jApi.query('CALL myTicket_getRows(#ticket)', params)
'CALL myTicket_getRows(#ticket)',
params
)
this.services = await this.$jApi.query( this.services = await this.$jApi.query(
'CALL myTicket_getServices(#ticket)', 'CALL myTicket_getServices(#ticket)',
params params
@ -120,7 +127,9 @@ export default {
recipientId: this.$user.id, recipientId: this.$user.id,
type: 'deliveryNote' type: 'deliveryNote'
}) })
window.open(`/api/Tickets/${this.ticket.id}/delivery-note-pdf?${params.toString()}`) window.open(
`/api/Tickets/${this.ticket.id}/delivery-note-pdf?${params.toString()}`
)
} }
} }
} }

View File

@ -1,13 +1,11 @@
<template> <template>
<div class="fullscreen bg-accent text-white text-center q-pa-md flex flex-center"> <div
class="fullscreen bg-accent text-white text-center q-pa-md flex flex-center"
>
<div> <div>
<div style="font-size: 30vh"> <div style="font-size: 30vh">404</div>
404
</div>
<div class="text-h2" style="opacity:.4"> <div class="text-h2" style="opacity: 0.4">Oops. Nothing here...</div>
Oops. Nothing here...
</div>
<q-btn <q-btn
class="q-mt-xl" class="q-mt-xl"

View File

@ -4,7 +4,7 @@
alt="Quasar logo" alt="Quasar logo"
src="~assets/quasar-logo-vertical.svg" src="~assets/quasar-logo-vertical.svg"
style="width: 200px; height: 200px" style="width: 200px; height: 200px"
> />
</q-page> </q-page>
</template> </template>

View File

@ -2,25 +2,18 @@
<div class="main"> <div class="main">
<div class="header"> <div class="header">
<router-link to="/" class="block"> <router-link to="/" class="block">
<img <img src="statics/logo.svg" alt="Verdnatura" class="block" />
src="statics/logo.svg"
alt="Verdnatura"
class="block"
/>
</router-link> </router-link>
</div> </div>
<q-form @submit="onLogin" class="q-gutter-y-md"> <q-form @submit="onLogin" class="q-gutter-y-md">
<div class="q-gutter-y-sm"> <div class="q-gutter-y-sm">
<q-input <q-input v-model="email" :label="$t('user')" autofocus />
v-model="email"
:label="$t('user')"
autofocus
/>
<q-input <q-input
v-model="password" v-model="password"
ref="password" ref="password"
:label="$t('password')" :label="$t('password')"
:type="showPwd ? 'password' : 'text'"> :type="showPwd ? 'password' : 'text'"
>
<template v-slot:append> <template v-slot:append>
<q-icon <q-icon
:name="showPwd ? 'visibility_off' : 'visibility'" :name="showPwd ? 'visibility_off' : 'visibility'"
@ -71,9 +64,7 @@
{{ $t('signUp') }} {{ $t('signUp') }}
</a> </a>
</p> </p>
<p class="contact"> <p class="contact">{{ $t('loginPhone') }} · {{ $t('loginMail') }}</p>
{{$t('loginPhone')}} · {{$t('loginMail')}}
</p>
</div> </div>
</div> </div>
</template> </template>
@ -106,13 +97,13 @@ a {
height: 50px; height: 50px;
} }
.password-forgotten { .password-forgotten {
font-size: .8rem; font-size: 0.8rem;
} }
.footer { .footer {
margin-bottom: $login-margin-top; margin-bottom: $login-margin-top;
margin-top: $login-margin-between; margin-top: $login-margin-between;
text-align: center; text-align: center;
font-size: .8rem; font-size: 0.8rem;
.contact { .contact {
margin-top: 15px; margin-top: 15px;

View File

@ -4,7 +4,7 @@
<q-icon <q-icon
name="contact_support" name="contact_support"
class="block q-mx-auto text-accent" class="block q-mx-auto text-accent"
style="font-size: 120px;" style="font-size: 120px"
/> />
</div> </div>
<div> <div>
@ -20,7 +20,7 @@
<q-input <q-input
v-model="email" v-model="email"
:label="$t('user')" :label="$t('user')"
:rules="[ val => !!val || $t('inputEmail')]" :rules="[(val) => !!val || $t('inputEmail')]"
autofocus autofocus
/> />
<div class="q-mt-lg"> <div class="q-mt-lg">
@ -56,7 +56,7 @@
} }
a { a {
color: inherit; color: inherit;
font-size: .8rem; font-size: 0.8rem;
} }
</style> </style>

View File

@ -4,7 +4,7 @@
<q-icon <q-icon
name="check" name="check"
class="block q-mx-auto text-accent" class="block q-mx-auto text-accent"
style="font-size: 120px;" style="font-size: 120px"
/> />
</q-card-section> </q-card-section>
<q-card-section> <q-card-section>
@ -19,7 +19,8 @@
:type="showPwd ? 'password' : 'text'" :type="showPwd ? 'password' : 'text'"
autofocus autofocus
hint="" hint=""
filled> filled
>
<template v-slot:append> <template v-slot:append>
<q-icon <q-icon
:name="showPwd ? 'visibility_off' : 'visibility'" :name="showPwd ? 'visibility_off' : 'visibility'"
@ -32,9 +33,10 @@
v-model="repeatPassword" v-model="repeatPassword"
:label="$t('repeatPassword')" :label="$t('repeatPassword')"
:type="showRpPwd ? 'password' : 'text'" :type="showRpPwd ? 'password' : 'text'"
:rules="[value => value == password || $t('repeatPasswordError')]" :rules="[(value) => value == password || $t('repeatPasswordError')]"
hint="" hint=""
filled> filled
>
<template v-slot:append> <template v-slot:append>
<q-icon <q-icon
:name="showRpPwd ? 'visibility_off' : 'visibility'" :name="showRpPwd ? 'visibility_off' : 'visibility'"
@ -78,9 +80,13 @@ export default {
const headers = { const headers = {
Authorization: this.$route.query.access_token Authorization: this.$route.query.access_token
} }
await this.$axios.post('users/reset-password', { await this.$axios.post(
'users/reset-password',
{
newPassword: this.password newPassword: this.password
}, { headers }) },
{ headers }
)
this.$q.notify({ this.$q.notify({
message: this.$t('passwordResetSuccessfully'), message: this.$t('passwordResetSuccessfully'),

View File

@ -1,6 +1,11 @@
import { route } from 'quasar/wrappers' import { route } from 'quasar/wrappers'
import { appStore } from 'stores/app' import { appStore } from 'stores/app'
import { createRouter, createMemoryHistory, createWebHistory, createWebHashHistory } from 'vue-router' import {
createRouter,
createMemoryHistory,
createWebHistory,
createWebHashHistory
} from 'vue-router'
import routes from './routes' import routes from './routes'
/* /*
@ -15,7 +20,9 @@ import routes from './routes'
export default route(function (/* { store, ssrContext } */) { export default route(function (/* { store, ssrContext } */) {
const createHistory = process.env.SERVER const createHistory = process.env.SERVER
? createMemoryHistory ? createMemoryHistory
: (process.env.VUE_ROUTER_MODE === 'history' ? createWebHistory : createWebHashHistory) : process.env.VUE_ROUTER_MODE === 'history'
? createWebHistory
: createWebHashHistory
const Router = createRouter({ const Router = createRouter({
scrollBehavior: () => ({ left: 0, top: 0 }), scrollBehavior: () => ({ left: 0, top: 0 }),
@ -24,7 +31,9 @@ export default route(function (/* { store, ssrContext } */) {
// Leave this as is and make changes in quasar.conf.js instead! // Leave this as is and make changes in quasar.conf.js instead!
// quasar.conf.js -> build -> vueRouterMode // quasar.conf.js -> build -> vueRouterMode
// quasar.conf.js -> build -> publicPath // quasar.conf.js -> build -> publicPath
history: createHistory(process.env.MODE === 'ssr' ? void 0 : process.env.VUE_ROUTER_BASE) history: createHistory(
process.env.MODE === 'ssr' ? void 0 : process.env.VUE_ROUTER_BASE
)
}) })
Router.afterEach((to, from) => { Router.afterEach((to, from) => {

View File

@ -1,4 +1,3 @@
const routes = [ const routes = [
{ {
path: '/login', path: '/login',
@ -8,17 +7,20 @@ const routes = [
name: 'login', name: 'login',
path: '/login/:email?', path: '/login/:email?',
component: () => import('pages/Login/Login.vue') component: () => import('pages/Login/Login.vue')
}, { },
{
name: 'rememberPassword', name: 'rememberPassword',
path: '/remember-password', path: '/remember-password',
component: () => import('pages/Login/RememberPassword.vue') component: () => import('pages/Login/RememberPassword.vue')
}, { },
{
name: 'resetPassword', name: 'resetPassword',
path: '/reset-password', path: '/reset-password',
component: () => import('pages/Login/ResetPassword.vue') component: () => import('pages/Login/ResetPassword.vue')
} }
] ]
}, { },
{
path: '/', path: '/',
component: () => import('layouts/MainLayout.vue'), component: () => import('layouts/MainLayout.vue'),
children: [ children: [
@ -26,23 +28,28 @@ const routes = [
name: '', name: '',
path: '', path: '',
component: () => import('src/pages/Cms/Home.vue') component: () => import('src/pages/Cms/Home.vue')
}, { },
{
name: 'home', name: 'home',
path: '/cms/home', path: '/cms/home',
component: () => import('src/pages/Cms/Home.vue') component: () => import('src/pages/Cms/Home.vue')
}, { },
{
name: 'orders', name: 'orders',
path: '/ecomerce/orders', path: '/ecomerce/orders',
component: () => import('pages/Ecomerce/Orders.vue') component: () => import('pages/Ecomerce/Orders.vue')
}, { },
{
name: 'ticket', name: 'ticket',
path: '/ecomerce/ticket/:id', path: '/ecomerce/ticket/:id',
component: () => import('pages/Ecomerce/Ticket.vue') component: () => import('pages/Ecomerce/Ticket.vue')
}, { },
{
name: 'invoices', name: 'invoices',
path: '/ecomerce/invoices', path: '/ecomerce/invoices',
component: () => import('pages/Ecomerce/Invoices.vue') component: () => import('pages/Ecomerce/Invoices.vue')
}, { },
{
name: 'catalog', name: 'catalog',
path: '/ecomerce/catalog/:category?/:type?', path: '/ecomerce/catalog/:category?/:type?',
component: () => import('pages/Ecomerce/Catalog.vue') component: () => import('pages/Ecomerce/Catalog.vue')

View File

@ -12,9 +12,7 @@ export const appStore = defineStore('hedera', {
actions: { actions: {
async loadConfig () { async loadConfig () {
const imageUrl = await jApi.getValue( const imageUrl = await jApi.getValue('SELECT url FROM imageConfig')
'SELECT url FROM imageConfig'
)
this.$patch({ imageUrl }) this.$patch({ imageUrl })
} }
} }

View File

@ -1,10 +1,10 @@
/* eslint-disable */ /* eslint-disable */
// THIS FEATURE-FLAG FILE IS AUTOGENERATED, // THIS FEATURE-FLAG FILE IS AUTOGENERATED,
// REMOVAL OR CHANGES WILL CAUSE RELATED TYPES TO STOP WORKING // REMOVAL OR CHANGES WILL CAUSE RELATED TYPES TO STOP WORKING
import "quasar/dist/types/feature-flag"; import 'quasar/dist/types/feature-flag'
declare module "quasar/dist/types/feature-flag" { declare module 'quasar/dist/types/feature-flag' {
interface QuasarFeatureFlags { interface QuasarFeatureFlags {
store: true; store: true
} }
} }

View File

@ -8,14 +8,16 @@ export const tpvStore = defineStore('tpv', {
const status = route.query.tpvStatus const status = route.query.tpvStatus
if (!(order && status)) return null if (!(order && status)) return null
await jApi.execQuery( await jApi.execQuery('CALL myTpvTransaction_end(#order, #status)', {
'CALL myTpvTransaction_end(#order, #status)', order,
{ order, status } status
) })
if (status === 'ko') { if (status === 'ko') {
const retry = confirm('retryPayQuestion') const retry = confirm('retryPayQuestion')
if (retry) { this.retryPay(order) } if (retry) {
this.retryPay(order)
}
} }
return status return status
@ -61,7 +63,9 @@ export const tpvStore = defineStore('tpv', {
input.name = field input.name = field
form.appendChild(input) form.appendChild(input)
if (postValues[field]) { input.value = postValues[field] } if (postValues[field]) {
input.value = postValues[field]
}
} }
form.submit() form.submit()
@ -73,7 +77,9 @@ export const tpvStore = defineStore('tpv', {
path += location.pathname path += location.pathname
path += location.search ? location.search : '' path += location.search ? location.search : ''
path += '#/ecomerce/orders' path += '#/ecomerce/orders'
path += '?' + new URLSearchParams({ path +=
'?' +
new URLSearchParams({
tpvStatus: status, tpvStatus: status,
tpvOrder: '_transactionId_' tpvOrder: '_transactionId_'
}).toString() }).toString()

View File

@ -4,8 +4,7 @@ import { api, jApi } from 'boot/axios'
export const userStore = defineStore('user', { export const userStore = defineStore('user', {
state: () => { state: () => {
const token = const token =
sessionStorage.getItem('vnToken') || sessionStorage.getItem('vnToken') || localStorage.getItem('vnToken')
localStorage.getItem('vnToken')
return { return {
token, token,
@ -16,7 +15,7 @@ export const userStore = defineStore('user', {
}, },
getters: { getters: {
loggedIn: state => state.token != null loggedIn: (state) => state.token != null
}, },
actions: { actions: {