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