feat(entry_latest-buys): add from and to in search-panel
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2021-11-23 09:00:46 +01:00
parent 6dc373677d
commit b460579834
6 changed files with 62 additions and 2 deletions

View File

@ -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'

View File

@ -73,6 +73,16 @@ module.exports = Self => {
arg: 'packingOut', arg: 'packingOut',
type: 'integer', type: 'integer',
description: 'the packingOut', description: 'the packingOut',
},
{
arg: 'from',
type: 'date',
description: `The from date filter`
},
{
arg: 'to',
type: 'date',
description: `The to date filter`
} }
], ],
returns: { returns: {
@ -117,6 +127,10 @@ module.exports = Self => {
return {'i.isActive': value}; return {'i.isActive': value};
case 'floramondo': case 'floramondo':
return {'i.isFloramondo': value}; return {'i.isFloramondo': value};
case 'from':
return {'lb.landing': {gte: value}};
case 'to':
return {'lb.landing': {lte: value}};
case 'visible': case 'visible':
if (value) if (value)
return {'v.visible': {gt: 0}}; return {'v.visible': {gt: 0}};
@ -176,7 +190,8 @@ module.exports = Self => {
b.price3, b.price3,
b.ektFk, b.ektFk,
b.weight, b.weight,
b.packageFk b.packageFk,
lb.landing
FROM cache.last_buy lb FROM cache.last_buy lb
LEFT JOIN cache.visible v ON v.item_id = lb.item_id LEFT JOIN cache.visible v ON v.item_id = lb.item_id
AND v.calc_id = @calc_id AND v.calc_id = @calc_id

View File

@ -172,5 +172,24 @@ describe('Buy latests buys filter()', () => {
expect(results.length).toBe(2); 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);
});
}); });

View File

@ -58,6 +58,18 @@
<tpl-item>{{name}}: {{nickname}}</tpl-item> <tpl-item>{{name}}: {{nickname}}</tpl-item>
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </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-horizontal>
<vn-check <vn-check
label="Is active" label="Is active"

View File

@ -112,6 +112,9 @@
<th field="packingOut"> <th field="packingOut">
<span translate>Package out</span> <span translate>Package out</span>
</th> </th>
<th field="landing">
<span translate>Landing</span>
</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -207,6 +210,7 @@
<td>{{::buy.weight}}</td> <td>{{::buy.weight}}</td>
<td>{{::buy.packageFk}}</td> <td>{{::buy.packageFk}}</td>
<td>{{::buy.packingOut}}</td> <td>{{::buy.packingOut}}</td>
<td>{{::buy.landing | date: 'dd/MM/yyyy'}}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@ -76,7 +76,8 @@ export default class Controller extends Section {
{field: 'description', displayName: this.$t('Description')}, {field: 'description', displayName: this.$t('Description')},
{field: 'size', displayName: this.$t('Size')}, {field: 'size', displayName: this.$t('Size')},
{field: 'density', displayName: this.$t('Density')}, {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; return this._columns;
@ -112,6 +113,8 @@ export default class Controller extends Section {
return {'intr.description': value}; return {'intr.description': value};
case 'origin': case 'origin':
return {'ori.code': value}; return {'ori.code': value};
case 'landing':
return {[`lb.${param}`]: value};
case 'packing': case 'packing':
case 'grouping': case 'grouping':
case 'quantity': case 'quantity':