aggiornamento Ordini GAS filtri
This commit is contained in:
0
src/rootgen/admin/gestoreordini_old/gestoreordini.scss
Executable file
0
src/rootgen/admin/gestoreordini_old/gestoreordini.scss
Executable file
167
src/rootgen/admin/gestoreordini_old/gestoreordini.ts
Executable file
167
src/rootgen/admin/gestoreordini_old/gestoreordini.ts
Executable file
@@ -0,0 +1,167 @@
|
||||
import { defineComponent, onMounted, ref } from 'vue'
|
||||
|
||||
import { CImgText } from '../../../components/CImgText/index'
|
||||
import { CCard } from '@/components/CCard'
|
||||
import { CMyPage } from '@/components/CMyPage'
|
||||
import { CTitleBanner } from '@/components/CTitleBanner'
|
||||
import { CGridTableRec } from '@/components/CGridTableRec'
|
||||
|
||||
import { colTableGestoreOrdini } from '@src/store/Modules/fieldsTable'
|
||||
import MixinMetaTags from '@/mixins/mixin-metatags'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'Gestoreordini',
|
||||
components: { CImgText, CCard, CMyPage, CTitleBanner, CGridTableRec },
|
||||
setup() {
|
||||
|
||||
const { setmeta } = MixinMetaTags()
|
||||
const filtroOrdini = ref(<any[]>[])
|
||||
const idGasordine = ref('')
|
||||
|
||||
function mounted() {
|
||||
let queryord = []
|
||||
|
||||
filtroOrdini.value = []
|
||||
|
||||
if (idGasordine.value) {
|
||||
const gasordine = {
|
||||
$match: {
|
||||
idGasordine: idGasordine.value
|
||||
},
|
||||
}
|
||||
queryord.push(gasordine)
|
||||
}
|
||||
|
||||
|
||||
const query = [
|
||||
{
|
||||
$lookup: {
|
||||
from: 'products',
|
||||
localField: 'idProduct',
|
||||
foreignField: '_id',
|
||||
as: 'product',
|
||||
},
|
||||
},
|
||||
{
|
||||
$unwind: {
|
||||
path: '$product',
|
||||
preserveNullAndEmptyArrays: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'productinfos',
|
||||
localField: 'product.idProductInfo',
|
||||
foreignField: '_id',
|
||||
as: 'productInfo',
|
||||
},
|
||||
},
|
||||
{
|
||||
$unwind: {
|
||||
path: '$productInfo',
|
||||
},
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'gasordines',
|
||||
localField: 'idGasordine',
|
||||
foreignField: '_id',
|
||||
as: 'gasordine',
|
||||
},
|
||||
},
|
||||
{
|
||||
$unwind: {
|
||||
path: '$gasordine',
|
||||
preserveNullAndEmptyArrays: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
$match: {
|
||||
$or: [
|
||||
{
|
||||
'gasordine.active': true,
|
||||
},
|
||||
{
|
||||
gasordine: {
|
||||
$exists: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
$match: {
|
||||
$or: [
|
||||
{
|
||||
quantity: {
|
||||
$gt: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
quantitypreordered: {
|
||||
$gt: 0,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
$group: {
|
||||
_id: '$product._id',
|
||||
name: {
|
||||
$first: '$productInfo.name',
|
||||
},
|
||||
weight: {
|
||||
$first: '$productInfo.weight',
|
||||
},
|
||||
price_acquistato: {
|
||||
$first: '$product.price_acquistato',
|
||||
},
|
||||
totalQuantity: {
|
||||
$sum: {
|
||||
$add: [
|
||||
'$quantity',
|
||||
'$quantitypreordered',
|
||||
],
|
||||
},
|
||||
},
|
||||
totalPrice_acquistato: {
|
||||
$sum: {
|
||||
$multiply: [
|
||||
'$product.price_acquistato',
|
||||
{
|
||||
$add: [
|
||||
'$quantity',
|
||||
'$quantitypreordered',
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
count: {
|
||||
$sum: 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
$sort: {
|
||||
name: 1,
|
||||
},
|
||||
}
|
||||
]
|
||||
|
||||
queryord.push(query)
|
||||
|
||||
filtroOrdini.value = queryord
|
||||
|
||||
}
|
||||
|
||||
onMounted(mounted)
|
||||
|
||||
return {
|
||||
colTableGestoreOrdini,
|
||||
setmeta,
|
||||
filtroOrdini,
|
||||
}
|
||||
}
|
||||
})
|
||||
33
src/rootgen/admin/gestoreordini_old/gestoreordini.vue
Executable file
33
src/rootgen/admin/gestoreordini_old/gestoreordini.vue
Executable file
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<CMyPage title="Info Prodotti" imgbackground="images/prodotti.jpg" sizes="max-height: 120px">
|
||||
<span>{{
|
||||
setmeta({
|
||||
title: 'Info Prodotti',
|
||||
description: '',
|
||||
keywords: '',
|
||||
})
|
||||
}}
|
||||
</span>
|
||||
|
||||
|
||||
<div class="q-ma-sm q-gutter-sm q-pa-xs">
|
||||
<CTitleBanner title="Info Prodotti"></CTitleBanner>
|
||||
<CGridTableRec
|
||||
prop_mytable="orders"
|
||||
prop_mytitle="Gestore Ordini"
|
||||
:prop_mycolumns="colTableGestoreOrdini"
|
||||
:filtercustom="filtroOrdini"
|
||||
prop_colkey="name"
|
||||
nodataLabel="Nessun Ordine"
|
||||
noresultLabel="Il filtro selezionato non ha trovato nessun risultato">
|
||||
|
||||
</CGridTableRec>
|
||||
</div>
|
||||
</CMyPage>
|
||||
</template>
|
||||
<script lang="ts" src="./gestoreordini.ts">
|
||||
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import 'gestoreordini.scss';
|
||||
</style>
|
||||
Reference in New Issue
Block a user