enpoint now receives all data for a buy + css refactor
This commit is contained in:
parent
65457d6dac
commit
ddc19ddbcd
|
@ -21,8 +21,8 @@ vn-chip {
|
|||
}
|
||||
}
|
||||
|
||||
&.white {
|
||||
background-color: $color-bg-panel;
|
||||
&.transparent {
|
||||
background-color: transparent;
|
||||
}
|
||||
&.colored {
|
||||
background-color: $color-main;
|
||||
|
|
|
@ -3,7 +3,7 @@ const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
|||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('addBuy', {
|
||||
description: 'Inserts or updates buy for the current entry',
|
||||
description: 'Inserts a new buy for the current entry',
|
||||
accessType: 'WRITE',
|
||||
accepts: [{
|
||||
arg: 'id',
|
||||
|
@ -26,6 +26,34 @@ module.exports = Self => {
|
|||
arg: 'packageFk',
|
||||
type: 'string',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
arg: 'packing',
|
||||
type: 'number',
|
||||
},
|
||||
{
|
||||
arg: 'grouping',
|
||||
type: 'number'
|
||||
},
|
||||
{
|
||||
arg: 'weight',
|
||||
type: 'number',
|
||||
},
|
||||
{
|
||||
arg: 'stickers',
|
||||
type: 'number',
|
||||
},
|
||||
{
|
||||
arg: 'price2',
|
||||
type: 'number',
|
||||
},
|
||||
{
|
||||
arg: 'price3',
|
||||
type: 'number',
|
||||
},
|
||||
{
|
||||
arg: 'buyingValue',
|
||||
type: 'number'
|
||||
}],
|
||||
returns: {
|
||||
type: 'object',
|
||||
|
@ -53,12 +81,13 @@ module.exports = Self => {
|
|||
try {
|
||||
const models = Self.app.models;
|
||||
|
||||
const newBuy = await models.Buy.create({
|
||||
itemFk: ctx.args.itemFk,
|
||||
entryFk: ctx.args.id,
|
||||
packageFk: ctx.args.packageFk,
|
||||
quantity: ctx.args.quantity
|
||||
}, myOptions);
|
||||
ctx.args.entryFk = ctx.args.id;
|
||||
|
||||
// remove unwanted properties
|
||||
delete ctx.args.id;
|
||||
delete ctx.args.ctx;
|
||||
|
||||
const newBuy = await models.Buy.create(ctx.args, myOptions);
|
||||
|
||||
let filter = {
|
||||
fields: [
|
||||
|
|
|
@ -83,12 +83,12 @@
|
|||
</span>
|
||||
</vn-td>
|
||||
<vn-td number>
|
||||
<vn-chip class="white" translate-attr="buy.groupingMode == 2 ? {title: 'Minimun amount'} : {title: 'Packing'}" ng-class="{'message': buy.groupingMode == 2}">
|
||||
<vn-chip class="transparent" translate-attr="buy.groupingMode == 2 ? {title: 'Minimun amount'} : {title: 'Packing'}" ng-class="{'message': buy.groupingMode == 2}">
|
||||
<span translate>{{::buy.packing | dashIfEmpty}}</span>
|
||||
</vn-chip>
|
||||
</vn-td>
|
||||
<vn-td number>
|
||||
<vn-chip class="white" translate-attr="buy.groupingMode == 1 ? {title: 'Minimun amount'} : {title: 'Grouping'}" ng-class="{'message': buy.groupingMode == 1}">
|
||||
<vn-chip class="transparent" translate-attr="buy.groupingMode == 1 ? {title: 'Minimun amount'} : {title: 'Grouping'}" ng-class="{'message': buy.groupingMode == 1}">
|
||||
<span translate>{{::buy.grouping | dashIfEmpty}}</span>
|
||||
</vn-chip>
|
||||
</vn-td>
|
||||
|
|
|
@ -102,12 +102,12 @@
|
|||
<td center title="{{::line.packageFk | dashIfEmpty}}">{{::line.packageFk | dashIfEmpty}}</td>
|
||||
<td center title="{{::line.weight}}">{{::line.weight}}</td>
|
||||
<td center>
|
||||
<vn-chip class="white" translate-attr="line.groupingMode == 2 ? {title: 'Minimun amount'} : {title: 'Packing'}" ng-class="{'message': line.groupingMode == 2}">
|
||||
<vn-chip class="transparent" translate-attr="line.groupingMode == 2 ? {title: 'Minimun amount'} : {title: 'Packing'}" ng-class="{'message': line.groupingMode == 2}">
|
||||
<span translate>{{::line.packing | dashIfEmpty}}</span>
|
||||
</vn-chip>
|
||||
</td>
|
||||
<td center>
|
||||
<vn-chip class="white" translate-attr="line.groupingMode == 1 ? {title: 'Minimun amount'} : {title: 'Grouping'}" ng-class="{'message': line.groupingMode == 1}">
|
||||
<vn-chip class="transparent" translate-attr="line.groupingMode == 1 ? {title: 'Minimun amount'} : {title: 'Grouping'}" ng-class="{'message': line.groupingMode == 1}">
|
||||
<span translate>{{::line.grouping | dashIfEmpty}}</span>
|
||||
</vn-chip>
|
||||
</vn-td>
|
||||
|
|
Loading…
Reference in New Issue