forked from verdnatura/hedera-web
More linting and formatting
This commit is contained in:
parent
e0cc4e40ba
commit
bf2094163d
|
@ -26,12 +26,9 @@ module.exports = {
|
|||
// 'plugin:vue/vue3-strongly-recommended', // Priority B: Strongly Recommended (Improving Readability)
|
||||
// 'plugin:vue/vue3-recommended', // Priority C: Recommended (Minimizing Arbitrary Choices and Cognitive Overhead)
|
||||
|
||||
'standard'
|
||||
|
||||
'standard',
|
||||
],
|
||||
|
||||
|
||||
|
||||
plugins: ['vue', 'prettier'],
|
||||
|
||||
globals: {
|
||||
|
@ -78,6 +75,7 @@ module.exports = {
|
|||
rules: {
|
||||
semi: 'off',
|
||||
indent: ['error', 4, { SwitchCase: 1 }],
|
||||
'space-before-function-paren': 'off',
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
|
@ -3,7 +3,7 @@ module.exports = {
|
|||
tabWidth: 4,
|
||||
useTabs: false,
|
||||
singleQuote: true,
|
||||
trailingComma: 'all',
|
||||
bracketSpacing: true,
|
||||
arrowParens: 'avoid',
|
||||
trailingComma: 'none'
|
||||
};
|
||||
|
|
|
@ -4,14 +4,7 @@
|
|||
"editor.bracketPairColorization.enabled": true,
|
||||
"editor.guides.bracketPairs": true,
|
||||
"editor.formatOnSave": true,
|
||||
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
|
||||
"editor.codeActionsOnSave": [
|
||||
"source.fixAll.eslint"
|
||||
],
|
||||
"eslint.validate": [
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"typescript",
|
||||
"vue"
|
||||
],
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.codeActionsOnSave": ["source.fixAll.eslint"],
|
||||
"eslint.validate": ["javascript", "javascriptreact", "typescript", "vue"]
|
||||
}
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent } from 'vue'
|
||||
import { defineComponent } from 'vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'App'
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -30,5 +30,5 @@
|
|||
<script>
|
||||
export default {
|
||||
name: 'LoginLayout'
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -62,7 +62,9 @@
|
|||
class="q-pl-lg"
|
||||
>
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ subitem.description }}</QItemLabel>
|
||||
<QItemLabel>
|
||||
{{ subitem.description }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QList>
|
||||
|
@ -165,68 +167,68 @@
|
|||
</style>
|
||||
|
||||
<script>
|
||||
import { defineComponent, ref } from 'vue'
|
||||
import { userStore } from 'stores/user'
|
||||
import { defineComponent, ref } from 'vue';
|
||||
import { userStore } from 'stores/user';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'MainLayout',
|
||||
props: {},
|
||||
|
||||
setup () {
|
||||
const leftDrawerOpen = ref(false)
|
||||
setup() {
|
||||
const leftDrawerOpen = ref(false);
|
||||
|
||||
return {
|
||||
user: userStore(),
|
||||
supplantedUser: ref(''),
|
||||
essentialLinks: ref(null),
|
||||
leftDrawerOpen,
|
||||
toggleLeftDrawer () {
|
||||
leftDrawerOpen.value = !leftDrawerOpen.value
|
||||
}
|
||||
toggleLeftDrawer() {
|
||||
leftDrawerOpen.value = !leftDrawerOpen.value;
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
async mounted () {
|
||||
this.$refs.actions.appendChild(this.$actions)
|
||||
await this.user.loadData()
|
||||
await this.$app.loadConfig()
|
||||
await this.fetchData()
|
||||
async mounted() {
|
||||
this.$refs.actions.appendChild(this.$actions);
|
||||
await this.user.loadData();
|
||||
await this.$app.loadConfig();
|
||||
await this.fetchData();
|
||||
},
|
||||
|
||||
methods: {
|
||||
async fetchData () {
|
||||
const sections = await this.$jApi.query('SELECT * FROM myMenu')
|
||||
async fetchData() {
|
||||
const sections = await this.$jApi.query('SELECT * FROM myMenu');
|
||||
|
||||
const sectionMap = new Map()
|
||||
const sectionMap = new Map();
|
||||
for (const section of sections) {
|
||||
sectionMap.set(section.id, section)
|
||||
sectionMap.set(section.id, section);
|
||||
}
|
||||
|
||||
const sectionTree = []
|
||||
const sectionTree = [];
|
||||
for (const section of sections) {
|
||||
const parent = section.parentFk
|
||||
const parent = section.parentFk;
|
||||
if (parent) {
|
||||
const parentSection = sectionMap.get(parent)
|
||||
if (!parentSection) continue
|
||||
let childs = parentSection.childs
|
||||
const parentSection = sectionMap.get(parent);
|
||||
if (!parentSection) continue;
|
||||
let childs = parentSection.childs;
|
||||
if (!childs) {
|
||||
childs = parentSection.childs = []
|
||||
childs = parentSection.childs = [];
|
||||
}
|
||||
childs.push(section)
|
||||
childs.push(section);
|
||||
} else {
|
||||
sectionTree.push(section)
|
||||
sectionTree.push(section);
|
||||
}
|
||||
}
|
||||
|
||||
this.essentialLinks = sectionTree
|
||||
this.essentialLinks = sectionTree;
|
||||
},
|
||||
|
||||
async logout () {
|
||||
this.user.logout()
|
||||
this.$router.push('/login')
|
||||
async logout() {
|
||||
this.user.logout();
|
||||
this.$router.push('/login');
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
<i18n lang="yaml">
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
<div class="q-pa-sm row items-start">
|
||||
<div class="new-card q-pa-sm" v-for="myNew in news" :key="myNew.id">
|
||||
<QCard>
|
||||
<QImg :src="`${$app.imageUrl}/news/full/${myNew.image}`"> </QImg>
|
||||
<QImg :src="`${$app.imageUrl}/news/full/${myNew.image}`">
|
||||
</QImg>
|
||||
<QCardSection>
|
||||
<div class="text-h5">{{ myNew.title }}</div>
|
||||
</QCardSection>
|
||||
|
@ -47,19 +48,19 @@
|
|||
<script>
|
||||
export default {
|
||||
name: 'PageIndex',
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
news: []
|
||||
}
|
||||
};
|
||||
},
|
||||
async mounted () {
|
||||
async mounted() {
|
||||
this.news = await this.$jApi.query(
|
||||
`SELECT title, text, image, id
|
||||
FROM news
|
||||
ORDER BY priority, created DESC`
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<i18n lang="yaml">
|
||||
|
|
|
@ -50,7 +50,9 @@
|
|||
name="cancel"
|
||||
class="cursor-pointer"
|
||||
:title="$t('deleteFilter')"
|
||||
@click="$router.push({ params: { category: null } })"
|
||||
@click="
|
||||
$router.push({ params: { category: null } })
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
<div class="categories">
|
||||
|
@ -81,7 +83,9 @@
|
|||
clearable
|
||||
:label="$t('family')"
|
||||
@filter="filterType"
|
||||
@input="$router.push({ params: { type: type && type.id } })"
|
||||
@input="
|
||||
$router.push({ params: { type: type && type.id } })
|
||||
"
|
||||
/>
|
||||
<QSelect
|
||||
v-model="order"
|
||||
|
@ -162,7 +166,8 @@
|
|||
:disable="disableScroll"
|
||||
>
|
||||
<div class="q-pa-md row justify-center q-gutter-md">
|
||||
<QSpinner v-if="isLoading" color="primary" size="50px"> </QSpinner>
|
||||
<QSpinner v-if="isLoading" color="primary" size="50px">
|
||||
</QSpinner>
|
||||
<div
|
||||
v-if="items && !items.length"
|
||||
class="text-subtitle1 text-grey-7 q-pa-md"
|
||||
|
@ -188,7 +193,9 @@
|
|||
</div>
|
||||
<div class="tags q-pt-xs">
|
||||
<div v-for="tag in item.tags" :key="tag.tagFk">
|
||||
<span class="text-grey-7">{{ tag.tag.name }}</span>
|
||||
<span class="text-grey-7">{{
|
||||
tag.tag.name
|
||||
}}</span>
|
||||
{{ tag.value }}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -199,7 +206,9 @@
|
|||
item.available
|
||||
}}</span>
|
||||
{{ $t('from') }}
|
||||
<span class="price">{{ currency(item.buy?.price3) }}</span>
|
||||
<span class="price">{{
|
||||
currency(item.buy?.price3)
|
||||
}}</span>
|
||||
</div>
|
||||
<QBtn
|
||||
icon="add_shopping_cart"
|
||||
|
@ -230,7 +239,9 @@
|
|||
</div>
|
||||
</QImg>
|
||||
<QCardSection>
|
||||
<div class="text-uppercase text-subtitle1 text-grey-7 ellipsize">
|
||||
<div
|
||||
class="text-uppercase text-subtitle1 text-grey-7 ellipsize"
|
||||
>
|
||||
{{ item.subName }}
|
||||
</div>
|
||||
<div class="text-grey-7">#{{ item.id }}</div>
|
||||
|
@ -332,15 +343,15 @@
|
|||
</style>
|
||||
|
||||
<script>
|
||||
import { date, currency } from 'src/lib/filters.js'
|
||||
import { date as qdate } from 'quasar'
|
||||
import axios from 'axios'
|
||||
import { date, currency } from 'src/lib/filters.js';
|
||||
import { date as qdate } from 'quasar';
|
||||
import axios from 'axios';
|
||||
|
||||
const CancelToken = axios.CancelToken
|
||||
const CancelToken = axios.CancelToken;
|
||||
|
||||
export default {
|
||||
name: 'HederaCatalog',
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
uid: 0,
|
||||
search: '',
|
||||
|
@ -395,44 +406,44 @@ export default {
|
|||
value: 'available'
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
created () {
|
||||
this.$app.useRightDrawer = true
|
||||
created() {
|
||||
this.$app.useRightDrawer = true;
|
||||
},
|
||||
async mounted () {
|
||||
async mounted() {
|
||||
this.categories = await this.$jApi.query(
|
||||
`SELECT c.id, l.name, c.color, c.code
|
||||
FROM vn.itemCategory c
|
||||
JOIN vn.itemCategoryL10n l ON l.id = c.id
|
||||
WHERE c.display
|
||||
ORDER BY display`
|
||||
)
|
||||
this.onRouteChange(this.$route)
|
||||
);
|
||||
this.onRouteChange(this.$route);
|
||||
},
|
||||
beforeUnmount () {
|
||||
this.clearTimeoutAndRequest()
|
||||
beforeUnmount() {
|
||||
this.clearTimeoutAndRequest();
|
||||
},
|
||||
beforeRouteUpdate (to, from, next) {
|
||||
this.onRouteChange(to)
|
||||
next()
|
||||
beforeRouteUpdate(to, from, next) {
|
||||
this.onRouteChange(to);
|
||||
next();
|
||||
},
|
||||
watch: {
|
||||
categories () {
|
||||
this.refreshTitle()
|
||||
categories() {
|
||||
this.refreshTitle();
|
||||
},
|
||||
orgTypes () {
|
||||
this.refreshTitle()
|
||||
orgTypes() {
|
||||
this.refreshTitle();
|
||||
},
|
||||
order () {
|
||||
this.loadItems()
|
||||
order() {
|
||||
this.loadItems();
|
||||
},
|
||||
date () {
|
||||
this.loadItems()
|
||||
date() {
|
||||
this.loadItems();
|
||||
},
|
||||
async category (value) {
|
||||
this.orgTypes = []
|
||||
if (!value) return
|
||||
async category(value) {
|
||||
this.orgTypes = [];
|
||||
if (!value) return;
|
||||
|
||||
const res = await this.$jApi.execQuery(
|
||||
`CALL myBasket_getAvailable;
|
||||
|
@ -446,104 +457,104 @@ export default {
|
|||
ORDER BY t.\`order\`, l.name;
|
||||
DROP TEMPORARY TABLE tmp.itemAvailable;`,
|
||||
{ category: value }
|
||||
)
|
||||
res.fetch()
|
||||
this.orgTypes = res.fetchData()
|
||||
);
|
||||
res.fetch();
|
||||
this.orgTypes = res.fetchData();
|
||||
},
|
||||
search (value) {
|
||||
const location = { params: this.$route.params }
|
||||
if (value) location.query = { search: value }
|
||||
this.$router.push(location)
|
||||
search(value) {
|
||||
const location = { params: this.$route.params };
|
||||
if (value) location.query = { search: value };
|
||||
this.$router.push(location);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
date,
|
||||
currency,
|
||||
onViewModeClick () {
|
||||
this.viewMode = this.viewMode === 'list' ? 'grid' : 'list'
|
||||
onViewModeClick() {
|
||||
this.viewMode = this.viewMode === 'list' ? 'grid' : 'list';
|
||||
},
|
||||
onRouteChange (route) {
|
||||
let { category, type } = route.params
|
||||
onRouteChange(route) {
|
||||
let { category, type } = route.params;
|
||||
|
||||
category = parseInt(category) || null
|
||||
type = parseInt(type) || null
|
||||
category = parseInt(category) || null;
|
||||
type = parseInt(type) || null;
|
||||
|
||||
this.category = category
|
||||
this.typeId = category ? type : null
|
||||
this.search = route.query.search || ''
|
||||
this.tags = []
|
||||
this.category = category;
|
||||
this.typeId = category ? type : null;
|
||||
this.search = route.query.search || '';
|
||||
this.tags = [];
|
||||
|
||||
this.refreshTitle()
|
||||
this.loadItems()
|
||||
this.refreshTitle();
|
||||
this.loadItems();
|
||||
},
|
||||
refreshTitle () {
|
||||
let title = this.$t(this.$router.currentRoute.value.name)
|
||||
let subtitle
|
||||
refreshTitle() {
|
||||
let title = this.$t(this.$router.currentRoute.value.name);
|
||||
let subtitle;
|
||||
|
||||
if (this.category) {
|
||||
const category =
|
||||
this.categories.find((i) => i.id === this.category) || {}
|
||||
title = category.name
|
||||
this.categories.find(i => i.id === this.category) || {};
|
||||
title = category.name;
|
||||
}
|
||||
|
||||
if (this.typeId) {
|
||||
this.type = this.orgTypes.find((i) => i.id === this.typeId)
|
||||
subtitle = title
|
||||
title = this.type && this.type.name
|
||||
this.type = this.orgTypes.find(i => i.id === this.typeId);
|
||||
subtitle = title;
|
||||
title = this.type && this.type.name;
|
||||
} else {
|
||||
this.type = null
|
||||
this.type = null;
|
||||
}
|
||||
|
||||
this.$app.$patch({ title, subtitle })
|
||||
this.$app.$patch({ title, subtitle });
|
||||
},
|
||||
clearTimeoutAndRequest () {
|
||||
clearTimeoutAndRequest() {
|
||||
if (this.timeout) {
|
||||
clearTimeout(this.timeout)
|
||||
this.timeout = null
|
||||
clearTimeout(this.timeout);
|
||||
this.timeout = null;
|
||||
}
|
||||
if (this.source) {
|
||||
this.source.cancel()
|
||||
this.source = null
|
||||
this.source.cancel();
|
||||
this.source = null;
|
||||
}
|
||||
},
|
||||
loadItemsDelayed () {
|
||||
this.clearTimeoutAndRequest()
|
||||
this.timeout = setTimeout(() => this.loadItems(), 500)
|
||||
loadItemsDelayed() {
|
||||
this.clearTimeoutAndRequest();
|
||||
this.timeout = setTimeout(() => this.loadItems(), 500);
|
||||
},
|
||||
loadItems () {
|
||||
this.items = null
|
||||
this.isLoading = true
|
||||
this.limit = this.pageSize
|
||||
this.disableScroll = false
|
||||
this.isLoading = false
|
||||
loadItems() {
|
||||
this.items = null;
|
||||
this.isLoading = true;
|
||||
this.limit = this.pageSize;
|
||||
this.disableScroll = false;
|
||||
this.isLoading = false;
|
||||
// this.loadItemsBase().finally(() => (this.isLoading = false))
|
||||
},
|
||||
onLoad (index, done) {
|
||||
if (this.isLoading) return done()
|
||||
this.limit += this.pageSize
|
||||
done()
|
||||
onLoad(index, done) {
|
||||
if (this.isLoading) return done();
|
||||
this.limit += this.pageSize;
|
||||
done();
|
||||
// this.loadItemsBase().finally(done)
|
||||
},
|
||||
loadItemsBase () {
|
||||
this.clearTimeoutAndRequest()
|
||||
loadItemsBase() {
|
||||
this.clearTimeoutAndRequest();
|
||||
|
||||
if (!(this.category || this.typeId || this.search)) {
|
||||
this.tags = []
|
||||
return Promise.resolve(true)
|
||||
this.tags = [];
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
|
||||
const tagFilter = []
|
||||
const tagFilter = [];
|
||||
|
||||
for (const tag of this.tags) {
|
||||
if (tag.hasFilter) {
|
||||
tagFilter.push({
|
||||
tagFk: tag.id,
|
||||
values: tag.filter
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
this.source = CancelToken.source()
|
||||
this.source = CancelToken.source();
|
||||
|
||||
const params = {
|
||||
dated: this.orderDate,
|
||||
|
@ -553,103 +564,107 @@ export default {
|
|||
order: this.order.value,
|
||||
limit: this.limit,
|
||||
tagFilter
|
||||
}
|
||||
};
|
||||
const config = {
|
||||
params,
|
||||
cancelToken: this.source.token
|
||||
}
|
||||
};
|
||||
return this.$axios
|
||||
.get('Items/catalog', config)
|
||||
.then((res) => this.onItemsGet(res))
|
||||
.catch((err) => this.onItemsError(err))
|
||||
.finally(() => (this.cancel = null))
|
||||
.then(res => this.onItemsGet(res))
|
||||
.catch(err => this.onItemsError(err))
|
||||
.finally(() => (this.cancel = null));
|
||||
},
|
||||
onItemsError (err) {
|
||||
if (err.__CANCEL__) return
|
||||
this.disableScroll = true
|
||||
throw err
|
||||
onItemsError(err) {
|
||||
if (err.__CANCEL__) return;
|
||||
this.disableScroll = true;
|
||||
throw err;
|
||||
},
|
||||
onItemsGet (res) {
|
||||
onItemsGet(res) {
|
||||
for (const tag of res.data.tags) {
|
||||
tag.uid = this.uid++
|
||||
tag.uid = this.uid++;
|
||||
|
||||
if (tag.filter) {
|
||||
tag.hasFilter = true
|
||||
tag.useRange = tag.filter.max || tag.filter.min
|
||||
tag.hasFilter = true;
|
||||
tag.useRange = tag.filter.max || tag.filter.min;
|
||||
} else {
|
||||
tag.useRange = tag.isQuantitative && tag.values.length > this.maxTags
|
||||
this.resetTagFilter(tag)
|
||||
tag.useRange =
|
||||
tag.isQuantitative && tag.values.length > this.maxTags;
|
||||
this.resetTagFilter(tag);
|
||||
}
|
||||
|
||||
if (tag.values) {
|
||||
tag.initialCount = this.maxTags
|
||||
tag.initialCount = this.maxTags;
|
||||
if (Array.isArray(tag.filter)) {
|
||||
tag.initialCount = Math.max(tag.initialCount, tag.filter.length)
|
||||
tag.initialCount = Math.max(
|
||||
tag.initialCount,
|
||||
tag.filter.length
|
||||
);
|
||||
}
|
||||
tag.showCount = tag.initialCount
|
||||
tag.showCount = tag.initialCount;
|
||||
}
|
||||
}
|
||||
|
||||
this.items = res.data.items
|
||||
this.tags = res.data.tags
|
||||
this.disableScroll = this.items.length < this.limit
|
||||
this.items = res.data.items;
|
||||
this.tags = res.data.tags;
|
||||
this.disableScroll = this.items.length < this.limit;
|
||||
},
|
||||
onRangeChange (tag, delay) {
|
||||
tag.hasFilter = true
|
||||
onRangeChange(tag, delay) {
|
||||
tag.hasFilter = true;
|
||||
|
||||
if (!delay) this.loadItems()
|
||||
else this.loadItemsDelayed()
|
||||
if (!delay) this.loadItems();
|
||||
else this.loadItemsDelayed();
|
||||
},
|
||||
onCheck (tag) {
|
||||
tag.hasFilter = tag.filter.length > 0
|
||||
this.loadItems()
|
||||
onCheck(tag) {
|
||||
tag.hasFilter = tag.filter.length > 0;
|
||||
this.loadItems();
|
||||
},
|
||||
resetTagFilter (tag) {
|
||||
tag.hasFilter = false
|
||||
resetTagFilter(tag) {
|
||||
tag.hasFilter = false;
|
||||
|
||||
if (tag.useRange) {
|
||||
tag.filter = {
|
||||
min: tag.min,
|
||||
max: tag.max
|
||||
}
|
||||
};
|
||||
} else {
|
||||
tag.filter = []
|
||||
tag.filter = [];
|
||||
}
|
||||
},
|
||||
onResetTagFilterClick (tag) {
|
||||
this.resetTagFilter(tag)
|
||||
this.loadItems()
|
||||
onResetTagFilterClick(tag) {
|
||||
this.resetTagFilter(tag);
|
||||
this.loadItems();
|
||||
},
|
||||
filterType (val, update) {
|
||||
filterType(val, update) {
|
||||
if (val === '') {
|
||||
update(() => {
|
||||
this.types = this.orgTypes
|
||||
})
|
||||
this.types = this.orgTypes;
|
||||
});
|
||||
} else {
|
||||
update(() => {
|
||||
const needle = val.toLowerCase()
|
||||
const needle = val.toLowerCase();
|
||||
this.types = this.orgTypes.filter(
|
||||
(type) => type.name.toLowerCase().indexOf(needle) > -1
|
||||
)
|
||||
})
|
||||
type => type.name.toLowerCase().indexOf(needle) > -1
|
||||
);
|
||||
});
|
||||
}
|
||||
},
|
||||
showItem (item) {
|
||||
this.item = item
|
||||
this.showItemDialog = true
|
||||
showItem(item) {
|
||||
this.item = item;
|
||||
this.showItemDialog = true;
|
||||
|
||||
const conf = this.$state.catalogConfig
|
||||
const conf = this.$state.catalogConfig;
|
||||
const params = {
|
||||
dated: this.orderDate,
|
||||
addressFk: conf.addressFk,
|
||||
agencyModeFk: conf.agencyModeFk
|
||||
}
|
||||
};
|
||||
this.$axios
|
||||
.get(`Items/${item.id}/calcCatalog`, { params })
|
||||
.then((res) => (this.lots = res.data))
|
||||
.then(res => (this.lots = res.data));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<i18n lang="yaml">
|
||||
|
|
|
@ -63,24 +63,34 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { date, currency } from 'src/lib/filters.js'
|
||||
import { date, currency } from 'src/lib/filters.js';
|
||||
|
||||
export default {
|
||||
name: 'OrdersPendingIndex',
|
||||
data () {
|
||||
const curYear = new Date().getFullYear()
|
||||
const years = []
|
||||
data() {
|
||||
const curYear = new Date().getFullYear();
|
||||
const years = [];
|
||||
|
||||
for (let year = curYear - 5; year <= curYear; year++) {
|
||||
years.push(year)
|
||||
years.push(year);
|
||||
}
|
||||
|
||||
return {
|
||||
columns: [
|
||||
{ name: 'ref', label: 'serial', field: 'ref', align: 'left' },
|
||||
{ name: 'issued', label: 'issued', field: 'issued', align: 'left' },
|
||||
{
|
||||
name: 'issued',
|
||||
label: 'issued',
|
||||
field: 'issued',
|
||||
align: 'left'
|
||||
},
|
||||
{ name: 'amount', label: 'amount', field: 'amount' },
|
||||
{ name: 'hasPdf', label: 'download', field: 'hasPdf', align: 'center' }
|
||||
{
|
||||
name: 'hasPdf',
|
||||
label: 'download',
|
||||
field: 'hasPdf',
|
||||
align: 'center'
|
||||
}
|
||||
],
|
||||
pagination: {
|
||||
rowsPerPage: 0
|
||||
|
@ -88,16 +98,16 @@ export default {
|
|||
year: curYear,
|
||||
years,
|
||||
invoices: null
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
async mounted () {
|
||||
await this.loadData()
|
||||
async mounted() {
|
||||
await this.loadData();
|
||||
},
|
||||
|
||||
watch: {
|
||||
async year () {
|
||||
await this.loadData()
|
||||
async year() {
|
||||
await this.loadData();
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -105,11 +115,11 @@ export default {
|
|||
date,
|
||||
currency,
|
||||
|
||||
async loadData () {
|
||||
async loadData() {
|
||||
const params = {
|
||||
from: new Date(this.year, 0),
|
||||
to: new Date(this.year, 11, 31, 23, 59, 59)
|
||||
}
|
||||
};
|
||||
this._invoices = await this.$jApi.query(
|
||||
`SELECT id, ref, issued, amount, hasPdf
|
||||
FROM myInvoice
|
||||
|
@ -117,10 +127,10 @@ export default {
|
|||
ORDER BY issued DESC
|
||||
LIMIT 500`,
|
||||
params
|
||||
)
|
||||
);
|
||||
},
|
||||
|
||||
invoiceUrl (id) {
|
||||
invoiceUrl(id) {
|
||||
return (
|
||||
'?' +
|
||||
new URLSearchParams({
|
||||
|
@ -128,10 +138,10 @@ export default {
|
|||
invoice: id,
|
||||
access_token: this.$user.token
|
||||
}).toString()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<i18n lang="yaml">
|
||||
|
|
|
@ -5,7 +5,12 @@
|
|||
<span class="amount" :class="{ negative: debt < 0 }">
|
||||
{{ currency(debt || 0) }}
|
||||
</span>
|
||||
<QIcon name="info" :title="$t('paymentInfo')" class="info" size="24px" />
|
||||
<QIcon
|
||||
name="info"
|
||||
:title="$t('paymentInfo')"
|
||||
class="info"
|
||||
size="24px"
|
||||
/>
|
||||
</div>
|
||||
<QBtn
|
||||
icon="payments"
|
||||
|
@ -88,47 +93,47 @@
|
|||
</style>
|
||||
|
||||
<script>
|
||||
import { date, currency } from 'src/lib/filters.js'
|
||||
import { tpvStore } from 'stores/tpv'
|
||||
import { date, currency } from 'src/lib/filters.js';
|
||||
import { tpvStore } from 'stores/tpv';
|
||||
|
||||
export default {
|
||||
name: 'OrdersPendingIndex',
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
orders: null,
|
||||
debt: 0,
|
||||
tpv: tpvStore()
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
async mounted () {
|
||||
await this.tpv.check(this.$route)
|
||||
async mounted() {
|
||||
await this.tpv.check(this.$route);
|
||||
|
||||
this.orders = await this.$jApi.query('CALL myTicket_list(NULL, NULL)')
|
||||
this.debt = await this.$jApi.getValue('SELECT -myClient_getDebt(NULL)')
|
||||
this.orders = await this.$jApi.query('CALL myTicket_list(NULL, NULL)');
|
||||
this.debt = await this.$jApi.getValue('SELECT -myClient_getDebt(NULL)');
|
||||
},
|
||||
|
||||
methods: {
|
||||
date,
|
||||
currency,
|
||||
|
||||
async onPayClick () {
|
||||
let amount = -this.debt
|
||||
amount = amount <= 0 ? null : amount
|
||||
async onPayClick() {
|
||||
let amount = -this.debt;
|
||||
amount = amount <= 0 ? null : amount;
|
||||
|
||||
let defaultAmountStr = ''
|
||||
let defaultAmountStr = '';
|
||||
if (amount !== null) {
|
||||
defaultAmountStr = amount
|
||||
defaultAmountStr = amount;
|
||||
}
|
||||
amount = prompt(this.$t('amountToPay'), defaultAmountStr)
|
||||
amount = prompt(this.$t('amountToPay'), defaultAmountStr);
|
||||
|
||||
if (amount != null) {
|
||||
amount = parseFloat(amount.replace(',', '.'))
|
||||
await this.tpv.pay(amount)
|
||||
amount = parseFloat(amount.replace(',', '.'));
|
||||
await this.tpv.pay(amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<i18n lang="yaml">
|
||||
|
|
|
@ -16,10 +16,12 @@
|
|||
<QCardSection>
|
||||
<div class="text-h6">{{ $t('shippingInformation') }}</div>
|
||||
<div>
|
||||
{{ $t('preparation') }} {{ date(ticket.shipped, 'ddd, MMMM Do') }}
|
||||
{{ $t('preparation') }}
|
||||
{{ date(ticket.shipped, 'ddd, MMMM Do') }}
|
||||
</div>
|
||||
<div>
|
||||
{{ $t('delivery') }} {{ date(ticket.shipped, 'ddd, MMMM Do') }}
|
||||
{{ $t('delivery') }}
|
||||
{{ date(ticket.shipped, 'ddd, MMMM Do') }}
|
||||
</div>
|
||||
<div>
|
||||
{{ $t(ticket.method != 'PICKUP' ? 'agency' : 'warehouse') }}
|
||||
|
@ -31,7 +33,9 @@
|
|||
<div>{{ ticket.nickname }}</div>
|
||||
<div>{{ ticket.street }}</div>
|
||||
<div>
|
||||
{{ ticket.postalCode }} {{ ticket.city }} ({{ ticket.province }})
|
||||
{{ ticket.postalCode }} {{ ticket.city }} ({{
|
||||
ticket.province
|
||||
}})
|
||||
</div>
|
||||
</QCardSection>
|
||||
<QSeparator inset />
|
||||
|
@ -39,7 +43,9 @@
|
|||
<QItem>
|
||||
<QItemSection avatar>
|
||||
<QAvatar size="68px">
|
||||
<img :src="`${$app.imageUrl}/catalog/200x200/${row.image}`" />
|
||||
<img
|
||||
:src="`${$app.imageUrl}/catalog/200x200/${row.image}`"
|
||||
/>
|
||||
</QAvatar>
|
||||
</QItemSection>
|
||||
<QItemSection>
|
||||
|
@ -75,62 +81,65 @@
|
|||
</style>
|
||||
|
||||
<script>
|
||||
import { date, currency } from 'src/lib/filters.js'
|
||||
import { date, currency } from 'src/lib/filters.js';
|
||||
|
||||
export default {
|
||||
name: 'OrdersConfirmedView',
|
||||
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
ticket: {},
|
||||
rows: null,
|
||||
services: null,
|
||||
packages: null
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
async mounted () {
|
||||
async mounted() {
|
||||
const params = {
|
||||
ticket: parseInt(this.$route.params.id)
|
||||
}
|
||||
};
|
||||
this.ticket = await this.$jApi.getObject(
|
||||
'CALL myTicket_get(#ticket)',
|
||||
params
|
||||
)
|
||||
this.rows = await this.$jApi.query('CALL myTicket_getRows(#ticket)', params)
|
||||
);
|
||||
this.rows = await this.$jApi.query(
|
||||
'CALL myTicket_getRows(#ticket)',
|
||||
params
|
||||
);
|
||||
this.services = await this.$jApi.query(
|
||||
'CALL myTicket_getServices(#ticket)',
|
||||
params
|
||||
)
|
||||
);
|
||||
this.packages = await this.$jApi.query(
|
||||
'CALL myTicket_getPackages(#ticket)',
|
||||
params
|
||||
)
|
||||
);
|
||||
},
|
||||
|
||||
methods: {
|
||||
date,
|
||||
currency,
|
||||
|
||||
discountSubtotal (line) {
|
||||
return line.quantity * line.price
|
||||
discountSubtotal(line) {
|
||||
return line.quantity * line.price;
|
||||
},
|
||||
|
||||
subtotal (line) {
|
||||
const discount = line.discount
|
||||
return this.discountSubtotal(line) * ((100 - discount) / 100)
|
||||
subtotal(line) {
|
||||
const discount = line.discount;
|
||||
return this.discountSubtotal(line) * ((100 - discount) / 100);
|
||||
},
|
||||
|
||||
onPrintClick () {
|
||||
onPrintClick() {
|
||||
const params = new URLSearchParams({
|
||||
access_token: this.$user.token,
|
||||
recipientId: this.$user.id,
|
||||
type: 'deliveryNote'
|
||||
})
|
||||
});
|
||||
window.open(
|
||||
`/api/Tickets/${this.ticket.id}/delivery-note-pdf?${params.toString()}`
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
<div>
|
||||
<div style="font-size: 30vh">404</div>
|
||||
|
||||
<div class="text-h2" style="opacity: 0.4">Oops. Nothing here...</div>
|
||||
<div class="text-h2" style="opacity: 0.4">
|
||||
Oops. Nothing here...
|
||||
</div>
|
||||
|
||||
<QBtn
|
||||
class="q-mt-xl"
|
||||
|
@ -21,9 +23,9 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent } from 'vue'
|
||||
import { defineComponent } from 'vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ErrorNotFound'
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent } from 'vue'
|
||||
import { defineComponent } from 'vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'IndexPage'
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -60,11 +60,17 @@
|
|||
<div class="footer text-center">
|
||||
<p>
|
||||
{{ $t('notACustomerYet') }}
|
||||
<a href="//verdnatura.es/register/" target="_blank" class="link">
|
||||
<a
|
||||
href="//verdnatura.es/register/"
|
||||
target="_blank"
|
||||
class="link"
|
||||
>
|
||||
{{ $t('signUp') }}
|
||||
</a>
|
||||
</p>
|
||||
<p class="contact">{{ $t('loginPhone') }} · {{ $t('loginMail') }}</p>
|
||||
<p class="contact">
|
||||
{{ $t('loginPhone') }} · {{ $t('loginMail') }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -116,41 +122,41 @@ a {
|
|||
</style>
|
||||
|
||||
<script>
|
||||
import { userStore } from 'stores/user'
|
||||
import { userStore } from 'stores/user';
|
||||
|
||||
export default {
|
||||
name: 'VnLogin',
|
||||
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
user: userStore(),
|
||||
email: '',
|
||||
password: '',
|
||||
remember: false,
|
||||
showPwd: true
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
mounted () {
|
||||
mounted() {
|
||||
if (this.$route.query.emailConfirmed !== undefined) {
|
||||
this.$q.notify({
|
||||
message: this.$t('emailConfirmedSuccessfully'),
|
||||
type: 'positive'
|
||||
})
|
||||
});
|
||||
}
|
||||
if (this.$route.params.email) {
|
||||
this.email = this.$route.params.email
|
||||
this.$refs.password.focus()
|
||||
this.email = this.$route.params.email;
|
||||
this.$refs.password.focus();
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
async onLogin () {
|
||||
await this.user.login(this.email, this.password, this.remember)
|
||||
this.$router.push('/')
|
||||
async onLogin() {
|
||||
await this.user.login(this.email, this.password, this.remember);
|
||||
this.$router.push('/');
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<i18n lang="yaml">
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<QInput
|
||||
v-model="email"
|
||||
:label="$t('user')"
|
||||
:rules="[(val) => !!val || $t('inputEmail')]"
|
||||
:rules="[val => !!val || $t('inputEmail')]"
|
||||
autofocus
|
||||
/>
|
||||
<div class="q-mt-lg">
|
||||
|
@ -63,25 +63,25 @@ a {
|
|||
<script>
|
||||
export default {
|
||||
name: 'VnRememberPasword',
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
email: ''
|
||||
}
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
async onSend () {
|
||||
async onSend() {
|
||||
const params = {
|
||||
email: this.email
|
||||
}
|
||||
await this.$axios.post('Users/reset', params)
|
||||
};
|
||||
await this.$axios.post('Users/reset', params);
|
||||
this.$q.notify({
|
||||
message: this.$t('weHaveSentEmailToRecover'),
|
||||
type: 'positive'
|
||||
})
|
||||
this.$router.push('/login')
|
||||
});
|
||||
this.$router.push('/login');
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<i18n lang="yaml">
|
||||
|
|
|
@ -23,7 +23,9 @@
|
|||
>
|
||||
<template v-slot:append>
|
||||
<QIcon
|
||||
:name="showPwd ? 'visibility_off' : 'visibility'"
|
||||
:name="
|
||||
showPwd ? 'visibility_off' : 'visibility'
|
||||
"
|
||||
class="cursor-pointer"
|
||||
@click="showPwd = !showPwd"
|
||||
/>
|
||||
|
@ -33,13 +35,18 @@
|
|||
v-model="repeatPassword"
|
||||
:label="$t('repeatPassword')"
|
||||
:type="showRpPwd ? 'password' : 'text'"
|
||||
:rules="[(value) => value == password || $t('repeatPasswordError')]"
|
||||
:rules="[
|
||||
value =>
|
||||
value == password || $t('repeatPasswordError')
|
||||
]"
|
||||
hint=""
|
||||
filled
|
||||
>
|
||||
<template v-slot:append>
|
||||
<QIcon
|
||||
:name="showRpPwd ? 'visibility_off' : 'visibility'"
|
||||
:name="
|
||||
showRpPwd ? 'visibility_off' : 'visibility'
|
||||
"
|
||||
class="cursor-pointer"
|
||||
@click="showRpPwd = !showRpPwd"
|
||||
/>
|
||||
|
@ -67,33 +74,33 @@
|
|||
<script>
|
||||
export default {
|
||||
name: 'VnRegister',
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
password: '',
|
||||
repeatPassword: '',
|
||||
showPwd: true,
|
||||
showRpPwd: true
|
||||
}
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
async onRegister () {
|
||||
async onRegister() {
|
||||
const headers = {
|
||||
Authorization: this.$route.query.access_token
|
||||
}
|
||||
};
|
||||
await this.$axios.post(
|
||||
'users/reset-password',
|
||||
{
|
||||
newPassword: this.password
|
||||
},
|
||||
{ headers }
|
||||
)
|
||||
);
|
||||
|
||||
this.$q.notify({
|
||||
message: this.$t('passwordResetSuccessfully'),
|
||||
type: 'positive'
|
||||
})
|
||||
this.$router.push('/login')
|
||||
});
|
||||
this.$router.push('/login');
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import { defineStore } from 'pinia'
|
||||
import { api, jApi } from 'boot/axios'
|
||||
import { defineStore } from 'pinia';
|
||||
import { api, jApi } from 'boot/axios';
|
||||
|
||||
export const userStore = defineStore('user', {
|
||||
state: () => {
|
||||
const token =
|
||||
sessionStorage.getItem('vnToken') || localStorage.getItem('vnToken')
|
||||
sessionStorage.getItem('vnToken') ||
|
||||
localStorage.getItem('vnToken');
|
||||
|
||||
return {
|
||||
token,
|
||||
|
@ -12,50 +13,50 @@ export const userStore = defineStore('user', {
|
|||
name: null,
|
||||
nickname: null,
|
||||
isGuest: false
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
getters: {
|
||||
loggedIn: (state) => state.token != null
|
||||
loggedIn: state => state.token != null
|
||||
},
|
||||
|
||||
actions: {
|
||||
async login (user, password, remember) {
|
||||
const params = { user, password }
|
||||
const res = await api.post('Accounts/login', params)
|
||||
async login(user, password, remember) {
|
||||
const params = { user, password };
|
||||
const res = await api.post('Accounts/login', params);
|
||||
|
||||
if (remember) {
|
||||
localStorage.setItem('vnToken', res.data.token)
|
||||
localStorage.setItem('vnToken', res.data.token);
|
||||
} else {
|
||||
sessionStorage.setItem('vnToken', res.data.token)
|
||||
sessionStorage.setItem('vnToken', res.data.token);
|
||||
}
|
||||
|
||||
this.$patch({
|
||||
token: res.data.token,
|
||||
name: user
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
async logout () {
|
||||
async logout() {
|
||||
if (this.token != null) {
|
||||
try {
|
||||
await api.post('Accounts/logout')
|
||||
await api.post('Accounts/logout');
|
||||
} catch (e) {}
|
||||
localStorage.removeItem('vnToken')
|
||||
sessionStorage.removeItem('vnToken')
|
||||
localStorage.removeItem('vnToken');
|
||||
sessionStorage.removeItem('vnToken');
|
||||
}
|
||||
this.$reset()
|
||||
this.$reset();
|
||||
},
|
||||
|
||||
async loadData () {
|
||||
async loadData() {
|
||||
const userData = await jApi.getObject(
|
||||
'SELECT id, nickname FROM account.myUser'
|
||||
)
|
||||
);
|
||||
|
||||
this.$patch({
|
||||
id: userData.id,
|
||||
nickname: userData.nickname
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue