feat(entry_latest-buys): add from and to in search-panel
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
6dc373677d
commit
b460579834
|
@ -0,0 +1,7 @@
|
|||
UPDATE `salix`.`defaultViewConfig`
|
||||
SET `columns` = '{"intrastat":false,"description":false,"density":false,"isActive":false,
|
||||
"freightValue":false,"packageValue":false,"isIgnored":false,"price2":false,"minPrice":true,
|
||||
"ektFk":false,"weight":false,"id":true,"packing":true,"grouping":true,"quantity":true,
|
||||
"size":false,"name":true,"code":true,"origin":true,"family":true,"entryFk":true,"buyingValue":true,
|
||||
"comissionValue":false,"price3":true,"packageFk":true,"packingOut":true,"landing":false}'
|
||||
WHERE tableCode = 'latestBuys'
|
|
@ -73,6 +73,16 @@ module.exports = Self => {
|
|||
arg: 'packingOut',
|
||||
type: 'integer',
|
||||
description: 'the packingOut',
|
||||
},
|
||||
{
|
||||
arg: 'from',
|
||||
type: 'date',
|
||||
description: `The from date filter`
|
||||
},
|
||||
{
|
||||
arg: 'to',
|
||||
type: 'date',
|
||||
description: `The to date filter`
|
||||
}
|
||||
],
|
||||
returns: {
|
||||
|
@ -117,6 +127,10 @@ module.exports = Self => {
|
|||
return {'i.isActive': value};
|
||||
case 'floramondo':
|
||||
return {'i.isFloramondo': value};
|
||||
case 'from':
|
||||
return {'lb.landing': {gte: value}};
|
||||
case 'to':
|
||||
return {'lb.landing': {lte: value}};
|
||||
case 'visible':
|
||||
if (value)
|
||||
return {'v.visible': {gt: 0}};
|
||||
|
@ -176,7 +190,8 @@ module.exports = Self => {
|
|||
b.price3,
|
||||
b.ektFk,
|
||||
b.weight,
|
||||
b.packageFk
|
||||
b.packageFk,
|
||||
lb.landing
|
||||
FROM cache.last_buy lb
|
||||
LEFT JOIN cache.visible v ON v.item_id = lb.item_id
|
||||
AND v.calc_id = @calc_id
|
||||
|
|
|
@ -172,5 +172,24 @@ describe('Buy latests buys filter()', () => {
|
|||
|
||||
expect(results.length).toBe(2);
|
||||
});
|
||||
|
||||
it('should return results matching "from" and "to"', async() => {
|
||||
const from = new Date();
|
||||
from.setHours(0, 0, 0, 0);
|
||||
|
||||
const to = new Date();
|
||||
to.setHours(23, 59, 59, 999);
|
||||
|
||||
let ctx = {
|
||||
args: {
|
||||
from: from,
|
||||
to: to,
|
||||
}
|
||||
};
|
||||
|
||||
let results = await app.models.Buy.latestBuysFilter(ctx);
|
||||
|
||||
expect(results.length).toBe(2);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -58,6 +58,18 @@
|
|||
<tpl-item>{{name}}: {{nickname}}</tpl-item>
|
||||
</vn-autocomplete>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-date-picker
|
||||
vn-one
|
||||
label="From"
|
||||
ng-model="filter.from">
|
||||
</vn-date-picker>
|
||||
<vn-date-picker
|
||||
vn-one
|
||||
label="To"
|
||||
ng-model="filter.to">
|
||||
</vn-date-picker>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-check
|
||||
label="Is active"
|
||||
|
|
|
@ -112,6 +112,9 @@
|
|||
<th field="packingOut">
|
||||
<span translate>Package out</span>
|
||||
</th>
|
||||
<th field="landing">
|
||||
<span translate>Landing</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -207,6 +210,7 @@
|
|||
<td>{{::buy.weight}}</td>
|
||||
<td>{{::buy.packageFk}}</td>
|
||||
<td>{{::buy.packingOut}}</td>
|
||||
<td>{{::buy.landing | date: 'dd/MM/yyyy'}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -76,7 +76,8 @@ export default class Controller extends Section {
|
|||
{field: 'description', displayName: this.$t('Description')},
|
||||
{field: 'size', displayName: this.$t('Size')},
|
||||
{field: 'density', displayName: this.$t('Density')},
|
||||
{field: 'packingOut', displayName: this.$t('PackingOut')}
|
||||
{field: 'packingOut', displayName: this.$t('PackingOut')},
|
||||
{field: 'landing', displayName: this.$t('Landing')}
|
||||
];
|
||||
|
||||
return this._columns;
|
||||
|
@ -112,6 +113,8 @@ export default class Controller extends Section {
|
|||
return {'intr.description': value};
|
||||
case 'origin':
|
||||
return {'ori.code': value};
|
||||
case 'landing':
|
||||
return {[`lb.${param}`]: value};
|
||||
case 'packing':
|
||||
case 'grouping':
|
||||
case 'quantity':
|
||||
|
|
Loading…
Reference in New Issue