Merge branch 'dev' into 3585-invoiceIn_dueDate
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
8db6424b6d
|
@ -12,7 +12,7 @@
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-textfield
|
<vn-textfield
|
||||||
vn-one
|
vn-one
|
||||||
label="Client Id"]
|
label="Client Id"
|
||||||
ng-model="filter.clientFk">
|
ng-model="filter.clientFk">
|
||||||
</vn-textfield>
|
</vn-textfield>
|
||||||
<vn-textfield
|
<vn-textfield
|
||||||
|
|
|
@ -18,7 +18,7 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
returns: {
|
returns: {
|
||||||
type: ['Object'],
|
type: ['object'],
|
||||||
root: true
|
root: true
|
||||||
},
|
},
|
||||||
http: {
|
http: {
|
||||||
|
@ -42,6 +42,7 @@ module.exports = Self => {
|
||||||
'stickers',
|
'stickers',
|
||||||
'packing',
|
'packing',
|
||||||
'grouping',
|
'grouping',
|
||||||
|
'groupingMode',
|
||||||
'quantity',
|
'quantity',
|
||||||
'packageFk',
|
'packageFk',
|
||||||
'weight',
|
'weight',
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
describe('Buy latests buys filter()', () => {
|
describe('Entry latests buys filter()', () => {
|
||||||
it('should return the entry matching "search"', async() => {
|
it('should return the entry matching "search"', async() => {
|
||||||
const tx = await models.Buy.beginTransaction({});
|
const tx = await models.Buy.beginTransaction({});
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
@ -12,7 +12,7 @@ describe('Buy latests buys filter()', () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const results = await models.Buy.latestBuysFilter(ctx);
|
const results = await models.Buy.latestBuysFilter(ctx, options);
|
||||||
const firstBuy = results[0];
|
const firstBuy = results[0];
|
||||||
|
|
||||||
expect(results.length).toEqual(1);
|
expect(results.length).toEqual(1);
|
||||||
|
|
|
@ -111,17 +111,45 @@
|
||||||
</vn-input-number>
|
</vn-input-number>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<vn-input-number class="dense"
|
<vn-input-number
|
||||||
title="{{::buy.packing | dashIfEmpty}}"
|
title="{{::buy.packing | dashIfEmpty}}"
|
||||||
ng-model="buy.packing"
|
ng-model="buy.packing"
|
||||||
on-change="$ctrl.saveBuy(buy)">
|
on-change="$ctrl.saveBuy(buy)">
|
||||||
|
<append>
|
||||||
|
<vn-icon
|
||||||
|
pointer
|
||||||
|
ng-show="buy.groupingMode == '2'"
|
||||||
|
ng-click="$ctrl.toggleGroupingMode(buy, 'packing')"
|
||||||
|
icon="lock">
|
||||||
|
</vn-icon>
|
||||||
|
<vn-icon
|
||||||
|
pointer
|
||||||
|
ng-show="buy.groupingMode != '2'"
|
||||||
|
ng-click="$ctrl.toggleGroupingMode(buy, 'packing')"
|
||||||
|
icon="lock_open">
|
||||||
|
</vn-icon>
|
||||||
|
</append>
|
||||||
</vn-input-number>
|
</vn-input-number>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<vn-input-number class="dense"
|
<vn-input-number
|
||||||
title="{{::buy.grouping | dashIfEmpty}}"
|
title="{{::buy.grouping | dashIfEmpty}}"
|
||||||
ng-model="buy.grouping"
|
ng-model="buy.grouping"
|
||||||
on-change="$ctrl.saveBuy(buy)">
|
on-change="$ctrl.saveBuy(buy)">
|
||||||
|
<append>
|
||||||
|
<vn-icon
|
||||||
|
pointer
|
||||||
|
ng-show="buy.groupingMode == '1'"
|
||||||
|
ng-click="$ctrl.toggleGroupingMode(buy, 'grouping')"
|
||||||
|
icon="lock">
|
||||||
|
</vn-icon>
|
||||||
|
<vn-icon
|
||||||
|
pointer
|
||||||
|
ng-show="buy.groupingMode != '1'"
|
||||||
|
ng-click="$ctrl.toggleGroupingMode(buy, 'grouping')"
|
||||||
|
icon="lock_open">
|
||||||
|
</vn-icon>
|
||||||
|
</append>
|
||||||
</vn-input-number>
|
</vn-input-number>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -213,7 +241,6 @@
|
||||||
vn-id="item-descriptor"
|
vn-id="item-descriptor"
|
||||||
warehouse-fk="$ctrl.vnConfig.warehouseFk">
|
warehouse-fk="$ctrl.vnConfig.warehouseFk">
|
||||||
</vn-item-descriptor-popover>
|
</vn-item-descriptor-popover>
|
||||||
|
|
||||||
<vn-confirm
|
<vn-confirm
|
||||||
vn-id="delete-buys"
|
vn-id="delete-buys"
|
||||||
question="You are going to delete buy(s) from this entry"
|
question="You are going to delete buy(s) from this entry"
|
||||||
|
|
|
@ -56,6 +56,23 @@ export default class Controller extends Section {
|
||||||
this.buys.splice(index, 1);
|
this.buys.splice(index, 1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toggleGroupingMode(buy, mode) {
|
||||||
|
const grouping = 1;
|
||||||
|
const packing = 2;
|
||||||
|
const groupingMode = mode === 'grouping' ? grouping : packing;
|
||||||
|
|
||||||
|
const newGroupingMode = buy.groupingMode === groupingMode ? 0 : groupingMode;
|
||||||
|
|
||||||
|
const params = {
|
||||||
|
groupingMode: newGroupingMode
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$http.patch(`Buys/${buy.id}`, params).then(() => {
|
||||||
|
buy.groupingMode = newGroupingMode;
|
||||||
|
this.vnApp.showSuccess(this.$t('Data saved!'));
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngModule.vnComponent('vnEntryBuyIndex', {
|
ngModule.vnComponent('vnEntryBuyIndex', {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint max-len: ["error", { "code": 150 }]*/
|
||||||
import './index.js';
|
import './index.js';
|
||||||
|
|
||||||
describe('Entry buy', () => {
|
describe('Entry buy', () => {
|
||||||
|
@ -64,4 +65,50 @@ describe('Entry buy', () => {
|
||||||
expect(controller.buys.length).toEqual(1);
|
expect(controller.buys.length).toEqual(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('toggleGroupingMode()', () => {
|
||||||
|
it(`should toggle grouping mode from grouping to packing`, () => {
|
||||||
|
const grouping = 1;
|
||||||
|
const packing = 2;
|
||||||
|
const buy = {id: 999, groupingMode: grouping};
|
||||||
|
|
||||||
|
const query = `Buys/${buy.id}`;
|
||||||
|
$httpBackend.expectPATCH(query, {groupingMode: packing}).respond(200);
|
||||||
|
controller.toggleGroupingMode(buy, 'packing');
|
||||||
|
$httpBackend.flush();
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should toggle grouping mode from packing to grouping`, () => {
|
||||||
|
const grouping = 1;
|
||||||
|
const packing = 2;
|
||||||
|
const buy = {id: 999, groupingMode: packing};
|
||||||
|
|
||||||
|
const query = `Buys/${buy.id}`;
|
||||||
|
$httpBackend.expectPATCH(query, {groupingMode: grouping}).respond(200);
|
||||||
|
controller.toggleGroupingMode(buy, 'grouping');
|
||||||
|
$httpBackend.flush();
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should toggle off the grouping mode if it was packing to packing`, () => {
|
||||||
|
const noGrouping = 0;
|
||||||
|
const packing = 2;
|
||||||
|
const buy = {id: 999, groupingMode: packing};
|
||||||
|
|
||||||
|
const query = `Buys/${buy.id}`;
|
||||||
|
$httpBackend.expectPATCH(query, {groupingMode: noGrouping}).respond(200);
|
||||||
|
controller.toggleGroupingMode(buy, 'packing');
|
||||||
|
$httpBackend.flush();
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should toggle off the grouping mode if it was grouping to grouping`, () => {
|
||||||
|
const noGrouping = 0;
|
||||||
|
const grouping = 1;
|
||||||
|
const buy = {id: 999, groupingMode: grouping};
|
||||||
|
|
||||||
|
const query = `Buys/${buy.id}`;
|
||||||
|
$httpBackend.expectPATCH(query, {groupingMode: noGrouping}).respond(200);
|
||||||
|
controller.toggleGroupingMode(buy, 'grouping');
|
||||||
|
$httpBackend.flush();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue