- Creazione pagina Home logout
- Nuovo Gasordine - Visualizzazione GAS / BOTTEGA
This commit is contained in:
@@ -34,12 +34,15 @@ const gasordineSchema = new Schema({
|
||||
img: {
|
||||
type: String,
|
||||
},
|
||||
dataora_chiusura: {
|
||||
dataora_chiusura_ordini: {
|
||||
type: Date,
|
||||
},
|
||||
dataora_ritiro: {
|
||||
type: Date,
|
||||
},
|
||||
dataora_termine_pagamento: {
|
||||
type: Date,
|
||||
},
|
||||
});
|
||||
|
||||
var Gasordine = module.exports = mongoose.model('Gasordine', gasordineSchema);
|
||||
|
||||
@@ -35,6 +35,9 @@ const productSchema = new Schema({
|
||||
idStorehouses: [
|
||||
{ type: Schema.Types.ObjectId, ref: 'Storehouse' }
|
||||
],
|
||||
idGasordines: [
|
||||
{ type: Schema.Types.ObjectId, ref: 'Gasordine' }
|
||||
],
|
||||
idScontisticas: [
|
||||
{ type: Schema.Types.ObjectId, ref: 'Scontistica' }
|
||||
],
|
||||
@@ -42,6 +45,7 @@ const productSchema = new Schema({
|
||||
code: {
|
||||
type: String,
|
||||
unique: true,
|
||||
required: true,
|
||||
},
|
||||
codice_EAN: {
|
||||
type: String,
|
||||
@@ -93,6 +97,10 @@ const productSchema = new Schema({
|
||||
unit: {
|
||||
type: Number
|
||||
},
|
||||
minBuyQty: { // quantità minima acquistabile
|
||||
type: Number,
|
||||
default: 1,
|
||||
},
|
||||
stockQty: { // in magazzino
|
||||
type: Number,
|
||||
default: 0,
|
||||
@@ -164,7 +172,10 @@ var Product = module.exports = mongoose.model('Product', productSchema);
|
||||
productSchema.index({ idapp: 1 });
|
||||
|
||||
module.exports.getFieldsForSearch = function () {
|
||||
return [{ field: 'name', type: tools.FieldType.string }]
|
||||
return [
|
||||
{ field: 'name', type: tools.FieldType.string },
|
||||
{ field: 'description', type: tools.FieldType.string },
|
||||
]
|
||||
};
|
||||
|
||||
module.exports.executeQueryTable = function (idapp, params) {
|
||||
@@ -232,6 +243,20 @@ module.exports.findAllIdApp = async function (idapp, code, id) {
|
||||
preserveNullAndEmptyArrays: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'gasordines',
|
||||
localField: 'idGasordines',
|
||||
foreignField: '_id',
|
||||
as: 'gasordines'
|
||||
}
|
||||
},
|
||||
{
|
||||
$unwind: {
|
||||
path: '$producer',
|
||||
preserveNullAndEmptyArrays: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'providers',
|
||||
|
||||
@@ -59,9 +59,9 @@ class Cart {
|
||||
const myitem = this.items.find((rec) => rec.order._id.toString() === itemorder._id)
|
||||
if (!!myitem) {
|
||||
if (this.isAvailableByOrder(myitem.order)) {
|
||||
myitem.order.quantity++;
|
||||
myitem.order.quantity += 1;
|
||||
} else {
|
||||
myitem.order.quantitypreordered++;
|
||||
myitem.order.quantitypreordered += myitem.order.product.minBuyQty;
|
||||
}
|
||||
|
||||
this.updatetotals();
|
||||
@@ -75,7 +75,7 @@ class Cart {
|
||||
const myitem = this.items.find((rec) => rec.order._id.toString() === itemorder._id)
|
||||
if (!!myitem) {
|
||||
if (myitem.order.quantitypreordered > 0) {
|
||||
myitem.order.quantitypreordered--;
|
||||
myitem.order.quantitypreordered -= myitem.order.product.minBuyQty;
|
||||
} else {
|
||||
if (myitem.order.quantity > 0) {
|
||||
myitem.order.quantity--;
|
||||
|
||||
@@ -49,6 +49,11 @@ module.exports = {
|
||||
OPTIONS_SEARCH_USER_ALL_WORDS: 4,
|
||||
OPTIONS_ADD_COUNT_FAVORITE: 8,
|
||||
|
||||
PROD: {
|
||||
GAS: 1,
|
||||
BOTTEGA: 2,
|
||||
},
|
||||
|
||||
FRIENDSCMD: {
|
||||
SETTRUST: 121,
|
||||
REQFRIEND: 125,
|
||||
|
||||
Reference in New Issue
Block a user