Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 4849-supplier-isVies
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Vicent Llopis 2023-02-17 13:06:30 +01:00
commit 39a3c8a7fa
26 changed files with 23 additions and 86 deletions

View File

@ -55,7 +55,7 @@ describe('Ticket Summary path', () => {
let result = await page let result = await page
.waitToGetProperty(selectors.ticketSummary.firstSaleItemId, 'innerText'); .waitToGetProperty(selectors.ticketSummary.firstSaleItemId, 'innerText');
expect(result).toContain('000002'); expect(result).toContain('2');
}); });
it(`should click on the first sale ID to make the item descriptor visible`, async() => { it(`should click on the first sale ID to make the item descriptor visible`, async() => {

View File

@ -45,7 +45,7 @@ describe('Claim summary path', () => {
it('should display the claimed line(s)', async() => { it('should display the claimed line(s)', async() => {
const result = await page.waitToGetProperty(selectors.claimSummary.firstSaleItemId, 'innerText'); const result = await page.waitToGetProperty(selectors.claimSummary.firstSaleItemId, 'innerText');
expect(result).toContain('000002'); expect(result).toContain('2');
}); });
it(`should click on the first sale ID making the item descriptor visible`, async() => { it(`should click on the first sale ID making the item descriptor visible`, async() => {

View File

@ -3,5 +3,4 @@ import './ucwords';
import './dash-if-empty'; import './dash-if-empty';
import './percentage'; import './percentage';
import './currency'; import './currency';
import './zero-fill';
import './id'; import './id';

View File

@ -1,25 +0,0 @@
describe('ZeroFill filter', () => {
let zeroFillFilter;
beforeEach(ngModule('vnCore'));
beforeEach(inject(_zeroFillFilter_ => {
zeroFillFilter = _zeroFillFilter_;
}));
it('should return null for a input null', () => {
expect(zeroFillFilter(null, null)).toBeNull();
});
it('should return a positive number pads a number with five zeros', () => {
expect(zeroFillFilter(1, 5)).toBe('00001');
});
it('should return negative number pads a number with five zeros', () => {
expect(zeroFillFilter(-1, 5)).toBe('-00001');
});
it('should return zero number with zero zeros', () => {
expect(zeroFillFilter(0, 1)).toBe('0');
});
});

View File

@ -1,17 +0,0 @@
import ngModule from '../module';
/**
* Pads a number with zeros.
*
* @param {Number} input The number to pad
* @param {Number} padLength The resulting number of digits
* @return {String} The zero-filled number
*/
export default function zeroFill() {
return function(input, padLength) {
if (input == null) return input;
let sign = Math.sign(input) === -1 ? '-' : '';
return sign + new Array(padLength).concat([Math.abs(input)]).join('0').slice(-padLength);
};
}
ngModule.filter('zeroFill', zeroFill);

View File

@ -101,7 +101,7 @@
<vn-span <vn-span
ng-click="itemDescriptor.show($event, saleClaimed.itemFk)" ng-click="itemDescriptor.show($event, saleClaimed.itemFk)"
class="link"> class="link">
{{::saleClaimed.itemFk | zeroFill:6}} {{::saleClaimed.itemFk}}
</vn-span> </vn-span>
</td> </td>
<td number> <td number>

View File

@ -115,7 +115,7 @@
<span <span
ng-click="itemDescriptor.show($event, saleClaimed.sale.itemFk, saleClaimed.sale.id)" ng-click="itemDescriptor.show($event, saleClaimed.sale.itemFk, saleClaimed.sale.id)"
class="link"> class="link">
{{::saleClaimed.sale.itemFk | zeroFill:6}} {{::saleClaimed.sale.itemFk}}
</span> </span>
</vn-td> </vn-td>
<vn-td expand>{{::saleClaimed.sale.ticket.landed | date: 'dd/MM/yyyy'}}</vn-td> <vn-td expand>{{::saleClaimed.sale.ticket.landed | date: 'dd/MM/yyyy'}}</vn-td>
@ -241,7 +241,7 @@
<span <span
ng-click="itemDescriptor.show($event, action.sale.itemFk, action.sale.id)" ng-click="itemDescriptor.show($event, action.sale.itemFk, action.sale.id)"
class="link"> class="link">
{{::action.sale.itemFk | zeroFill:6}} {{::action.sale.itemFk}}
</span> </span>
</vn-td> </vn-td>
<vn-td number> <vn-td number>

View File

@ -60,7 +60,7 @@
ng-if="buy.id" ng-if="buy.id"
ng-click="itemDescriptor.show($event, buy.item.id)" ng-click="itemDescriptor.show($event, buy.item.id)"
class="link"> class="link">
{{::buy.item.id | zeroFill:6}} {{::buy.item.id}}
</span> </span>
<vn-autocomplete ng-if="!buy.id" class="dense" <vn-autocomplete ng-if="!buy.id" class="dense"
vn-focus vn-focus

View File

@ -148,7 +148,7 @@
<span <span
ng-click="itemDescriptor.show($event, line.item.id)" ng-click="itemDescriptor.show($event, line.item.id)"
class="link"> class="link">
{{::line.item.id | zeroFill:6}} {{::line.item.id}}
</span> </span>
</td> </td>
<td number shrink> <td number shrink>

View File

@ -47,7 +47,7 @@
show-field="description" show-field="description"
rule rule
vn-focus> vn-focus>
<tpl-item>{{id | zeroFill:8}}: {{description}}</tpl-item> <tpl-item>{{id}}: {{description}}</tpl-item>
</vn-autocomplete> </vn-autocomplete>
<vn-input-number <vn-input-number
label="Amount" label="Amount"

View File

@ -141,7 +141,7 @@
</vn-thead> </vn-thead>
<vn-tbody> <vn-tbody>
<vn-tr ng-repeat="intrastat in $ctrl.summary.invoiceInIntrastat"> <vn-tr ng-repeat="intrastat in $ctrl.summary.invoiceInIntrastat">
<vn-td>{{::intrastat.intrastatFk | zeroFill:8}}: {{::intrastat.intrastat.description}}</vn-td> <vn-td>{{::intrastat.intrastatFk}}: {{::intrastat.intrastat.description}}</vn-td>
<vn-td>{{::intrastat.amount | currency: 'EUR':2}}</vn-td> <vn-td>{{::intrastat.amount | currency: 'EUR':2}}</vn-td>
<vn-td>{{::intrastat.net}}</vn-td> <vn-td>{{::intrastat.net}}</vn-td>
<vn-td>{{::intrastat.stems}}</vn-td> <vn-td>{{::intrastat.stems}}</vn-td>

View File

@ -39,7 +39,7 @@
<vn-td number> <vn-td number>
<span ng-click="itemDescriptor.show($event, row.itemFk)" <span ng-click="itemDescriptor.show($event, row.itemFk)"
class="link"> class="link">
{{::row.itemFk | zeroFill:6}} {{::row.itemFk}}
</span> </span>
</vn-td> </vn-td>
<vn-td vn-fetched-tags> <vn-td vn-fetched-tags>

View File

@ -95,7 +95,7 @@
<span <span
ng-click="itemDescriptor.show($event, row.itemFk)" ng-click="itemDescriptor.show($event, row.itemFk)"
class="link"> class="link">
{{::row.itemFk | zeroFill:6}} {{::row.itemFk}}
</span> </span>
</vn-td> </vn-td>
<vn-td vn-fetched-tags> <vn-td vn-fetched-tags>

View File

@ -23,7 +23,7 @@
title="{{::sale.item.name}}" title="{{::sale.item.name}}"
vn-click-stop="itemDescriptor.show($event, sale.itemFk, sale.id)" vn-click-stop="itemDescriptor.show($event, sale.itemFk, sale.id)"
class="link"> class="link">
{{::sale.itemFk | zeroFill:6}} {{::sale.itemFk}}
</span> </span>
</vn-td> </vn-td>
<vn-td vn-fetched-tags> <vn-td vn-fetched-tags>

View File

@ -27,7 +27,7 @@
<span <span
ng-click="itemDescriptor.show($event, sale.itemFk, sale.id)" ng-click="itemDescriptor.show($event, sale.itemFk, sale.id)"
class="link"> class="link">
{{sale.itemFk | zeroFill:6}} {{sale.itemFk}}
</span> </span>
</td> </td>
<td rowspan="{{::sale.components.length + 1}}" vn-fetched-tags> <td rowspan="{{::sale.components.length + 1}}" vn-fetched-tags>

View File

@ -55,7 +55,7 @@
ng-model="expedition.checked"> ng-model="expedition.checked">
</vn-check> </vn-check>
</vn-td> </vn-td>
<vn-td number expand>{{expedition.id | zeroFill:6}}</vn-td> <vn-td number expand>{{expedition.id}}</vn-td>
<vn-td number> <vn-td number>
<span <span
ng-class="{link: expedition.packagingItemFk}" ng-class="{link: expedition.packagingItemFk}"

View File

@ -75,7 +75,7 @@
ng-show="::request.saleFk" ng-show="::request.saleFk"
ng-click="itemDescriptor.show($event, request.sale.itemFk, request.sale.id)" ng-click="itemDescriptor.show($event, request.sale.itemFk, request.sale.id)"
class="link"> class="link">
{{::request.saleFk | zeroFill:6}} {{::request.saleFk}}
</span> </span>
</vn-td> </vn-td>
<vn-td number <vn-td number

View File

@ -365,7 +365,7 @@
</vn-thead> </vn-thead>
<vn-tbody> <vn-tbody>
<vn-tr ng-repeat="sale in $ctrl.transfer.sales"> <vn-tr ng-repeat="sale in $ctrl.transfer.sales">
<vn-td number shrink>{{::sale.itemFk | zeroFill:6}}</vn-td> <vn-td number shrink>{{::sale.itemFk}}</vn-td>
<vn-td> <vn-td>
<span title="{{::sale.concept}}">{{::sale.concept}}</span> <span title="{{::sale.concept}}">{{::sale.concept}}</span>
</vn-td> </vn-td>

View File

@ -177,7 +177,7 @@
<span <span
ng-click="itemDescriptor.show($event, sale.itemFk, sale.id, $ctrl.ticket.shipped)" ng-click="itemDescriptor.show($event, sale.itemFk, sale.id, $ctrl.ticket.shipped)"
class="link"> class="link">
{{sale.itemFk | zeroFill:6}} {{sale.itemFk}}
</span> </span>
</vn-td> </vn-td>
<vn-td number shrink> <vn-td number shrink>
@ -312,7 +312,7 @@
ng-show="::request.saleFk" ng-show="::request.saleFk"
ng-click="itemDescriptor.show($event, request.sale.itemFk, request.sale.id)" ng-click="itemDescriptor.show($event, request.sale.itemFk, request.sale.id)"
class="link"> class="link">
{{request.sale.itemFk | zeroFill:6}} {{request.sale.itemFk}}
</span> </span>
</vn-td> </vn-td>
<vn-td number> <vn-td number>

View File

@ -35,7 +35,7 @@
<span <span
ng-click="itemDescriptor.show($event, sale.itemFk, sale.id)" ng-click="itemDescriptor.show($event, sale.itemFk, sale.id)"
class="link"> class="link">
{{sale.itemFk | zeroFill:6}} {{sale.itemFk}}
</span> </span>
</vn-td> </vn-td>
<vn-td vn-fetched-tags> <vn-td vn-fetched-tags>

View File

@ -4,5 +4,4 @@ require('./uppercase');
require('./currency'); require('./currency');
require('./percentage'); require('./percentage');
require('./number'); require('./number');
require('./zerofill');

View File

@ -1,9 +0,0 @@
import zerofill from '../zerofill.js';
describe('zerofill filter', () => {
const superDuperNumber = 1984;
it('should filter the number filling it with zeros up to 6 characters length', () => {
expect(zerofill(superDuperNumber, '000000')).toEqual('001984');
});
});

View File

@ -1,10 +0,0 @@
const Vue = require('vue');
const zerofill = function(value, pad) {
const valueStr = String(value);
return pad.substring(0, pad.length - valueStr.length) + valueStr;
};
Vue.filter('zerofill', zerofill);
module.exports = zerofill;

View File

@ -45,7 +45,7 @@
</thead> </thead>
<tbody v-for="sale in sales"> <tbody v-for="sale in sales">
<tr> <tr>
<td>{{sale.itemFk | zerofill('000000')}}</td> <td>{{sale.itemFk}}</td>
<td class="number">{{Math.trunc(sale.subtotal)}}</td> <td class="number">{{Math.trunc(sale.subtotal)}}</td>
<td width="50%">{{sale.concept}}</td> <td width="50%">{{sale.concept}}</td>
</tr> </tr>

View File

@ -66,7 +66,7 @@
</thead> </thead>
<tbody v-for="sale in sales" class="no-page-break"> <tbody v-for="sale in sales" class="no-page-break">
<tr> <tr>
<td width="5%">{{sale.itemFk | zerofill('000000')}}</td> <td width="5%">{{sale.itemFk}}</td>
<td class="number">{{sale.quantity}}</td> <td class="number">{{sale.quantity}}</td>
<td width="50%">{{sale.concept}}</td> <td width="50%">{{sale.concept}}</td>
<td class="number" v-if="showPrices">{{sale.price | currency('EUR', $i18n.locale)}}</td> <td class="number" v-if="showPrices">{{sale.price | currency('EUR', $i18n.locale)}}</td>
@ -145,7 +145,7 @@
</thead> </thead>
<tbody> <tbody>
<tr v-for="packaging in packagings"> <tr v-for="packaging in packagings">
<td>{{packaging.itemFk | zerofill('000000')}}</td> <td>{{packaging.itemFk}}</td>
<td class="number">{{packaging.quantity}}</td> <td class="number">{{packaging.quantity}}</td>
<td width="85%">{{packaging.name}}</td> <td width="85%">{{packaging.name}}</td>
</tr> </tr>

View File

@ -96,7 +96,7 @@
</thead> </thead>
<tbody v-for="sale in ticket.sales" class="no-page-break"> <tbody v-for="sale in ticket.sales" class="no-page-break">
<tr> <tr>
<td width="5%">{{sale.itemFk | zerofill('000000')}}</td> <td width="5%">{{sale.itemFk}}</td>
<td class="number">{{sale.quantity}}</td> <td class="number">{{sale.quantity}}</td>
<td width="50%">{{sale.concept}}</td> <td width="50%">{{sale.concept}}</td>
<td class="number">{{sale.price | currency('EUR', $i18n.locale)}}</td> <td class="number">{{sale.price | currency('EUR', $i18n.locale)}}</td>