Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 3558-setQuantitySale

This commit is contained in:
Alex Moreno 2022-02-04 07:41:34 +01:00
commit 9df70cb30d
15 changed files with 49 additions and 45 deletions

View File

@ -0,0 +1,3 @@
UPDATE salix.defaultViewConfig
SET `columns`='{"intrastat":false,"stemMultiplier":false,"landed":false,"producer":false}'
WHERE tableCode ='itemsIndex';

View File

@ -0,0 +1,26 @@
ALTER TABLE `vn`.`state` ADD classColor varchar(12) NULL;
UPDATE `vn`.`state` s
SET s.classColor = 'warning'
WHERE s.alertLevel = 1;
UPDATE `vn`.`state` s
SET s.classColor = 'alert'
WHERE s.alertLevel = 0;
UPDATE `vn`.`state` s
SET s.classColor = 'success'
WHERE s.code LIKE 'OK';
UPDATE `vn`.`state` s
SET s.classColor = 'notice'
WHERE s.code LIKE 'FREE';
UPDATE `vn`.`state` s
SET s.classColor = 'success'
WHERE s.order >= 4
AND (s.alertLevel = 0 OR s.alertLevel = 1);
UPDATE `vn`.`state` s
SET s.classColor = 'warning'
WHERE s.code IN ('PREVIOUS_PREPARATION', 'PREPARED', 'ON_PREPARATION', 'ON_CHECKING', 'CHECKED');

View File

@ -94,7 +94,7 @@ describe('Ticket Edit basic data path', () => {
it(`should split ticket without negatives`, async() => {
const newAgency = 'Silla247';
const newDate = new Date();
newDate.setDate(newDate.getDate() + 1);
newDate.setDate(newDate.getDate() - 1);
await page.accessToSearchResult('14');
await page.accessToSection('ticket.card.basicData.stepOne');

View File

@ -82,6 +82,7 @@ module.exports = Self => {
Self.filter = async(ctx, filter, options) => {
const conn = Self.dataSource.connector;
const myOptions = {};
let to;
if (typeof options == 'object')
Object.assign(myOptions, options);
@ -109,7 +110,11 @@ module.exports = Self => {
case 'attenderFk':
return {'cl.workerFk': value};
case 'created':
return {'cl.created': value};
value.setHours(0, 0, 0, 0);
to = new Date(value);
to.setHours(23, 59, 59, 999);
return {'cl.created': {between: [value, to]}};
}
});

View File

@ -161,6 +161,7 @@ module.exports = Self => {
i.stemMultiplier,
i.typeFk,
i.isFloramondo,
pr.name AS producer,
it.name AS typeName,
it.workerFk AS buyerFk,
u.name AS userName,

View File

@ -54,6 +54,9 @@
<th field="active">
<span translate>Active</span>
</th>
<th field="producer">
<span translate>Producer</span>
</th>
<th field="landed">
<span translate>Landed</span>
</th>
@ -122,6 +125,7 @@
ng-model="::item.isActive">
</vn-check>
</td>
<td>{{::item.producer | dashIfEmpty}}</td>
<td shrink-date>{{::item.landed | date:'dd/MM/yyyy'}}</td>
<td>
<vn-horizontal class="buttons">

View File

@ -81,6 +81,8 @@ class Controller extends Section {
return {'intr.description': value};
case 'name':
return {'i.name': {like: `%${value}%`}};
case 'producer':
return {'pr.name': {like: `%${value}%`}};
case 'id':
case 'size':
case 'subname':

View File

@ -194,6 +194,7 @@ module.exports = Self => {
z.hour AS zoneLanding,
z.name AS zoneName,
z.id AS zoneFk,
st.classColor,
TIME_FORMAT(t.shipped, '%H:%i') AS preparationHour,
TIME_FORMAT(z.hour, '%H:%i') AS theoreticalhour,
TIME_FORMAT(zed.etc, '%H:%i') AS practicalHour

View File

@ -171,7 +171,7 @@
</span>
<span
ng-show="::!ticket.refFk"
class="chip {{::$ctrl.stateColor(ticket)}}">
class="chip {{::ticket.classColor}}">
{{::ticket.state}}
</span>
</td>

View File

@ -118,17 +118,6 @@ export default class Controller extends Section {
return 'success';
}
stateColor(ticket) {
if (ticket.alertLevelCode === 'OK')
return 'success';
else if (ticket.alertLevelCode === 'FREE')
return 'notice';
else if (ticket.alertLevel === 1)
return 'warning';
else if (ticket.alertLevel === 0)
return 'alert';
}
totalPriceColor(ticket) {
const total = parseInt(ticket.totalWithVat);
if (total > 0 && total < 50)

View File

@ -89,32 +89,6 @@ describe('Component vnMonitorSalesTickets', () => {
});
});
describe('stateColor()', () => {
it('should return "success" when the alertLevelCode property is "OK"', () => {
const result = controller.stateColor({alertLevelCode: 'OK'});
expect(result).toEqual('success');
});
it('should return "notice" when the alertLevelCode property is "FREE"', () => {
const result = controller.stateColor({alertLevelCode: 'FREE'});
expect(result).toEqual('notice');
});
it('should return "warning" when the alertLevel property is "1', () => {
const result = controller.stateColor({alertLevel: 1});
expect(result).toEqual('warning');
});
it('should return "alert" when the alertLevel property is "0"', () => {
const result = controller.stateColor({alertLevel: 0});
expect(result).toEqual('alert');
});
});
describe('totalPriceColor()', () => {
it('should return "warning" when the ticket amount is less than 50€', () => {
const result = controller.totalPriceColor({totalWithVat: '8.50'});

View File

@ -138,9 +138,8 @@ module.exports = Self => {
const params = [args.id, args.shipped, args.warehouseFk];
const [salesMovable] = await Self.rawSql(query, params, myOptions);
const saleMovable = sale.movable ? sale.movable : 0;
const salesNewTicket = salesMovable.filter(sale => (sale.movable ? sale.movable : 0) >= sale.quantity);
const salesNewTicket = salesMovable.filter(sale => saleMovable >= sale.quantity);
if (salesNewTicket.length) {
const newTicket = await models.Ticket.transferSales(ctx, args.id, null, salesNewTicket, myOptions);
args.id = newTicket.id;

View File

@ -112,7 +112,7 @@ module.exports = Self => {
// Get items movable
const ticketOrigin = await models.Ticket.findById(args.id, null, myOptions);
const differenceShipped = ticketOrigin.shipped.getTime() != args.shipped.getTime();
const differenceShipped = ticketOrigin.shipped.getTime() > args.shipped.getTime();
const differenceWarehouse = ticketOrigin.warehouseFk != args.warehouseId;
salesObj.haveDifferences = differenceShipped || differenceWarehouse;

View File

@ -51,8 +51,8 @@
</table>
<p v-html="$t('wasteDetailLink')"></p>
<div class="external-link vn-pa-sm vn-m-md">
<a href="https://salix.verdnatura.es/#!/item/waste" target="_blank">
https://salix.verdnatura.es/#!/item/waste
<a href="https://salix.verdnatura.es/#!/item/waste/index" target="_blank">
https://salix.verdnatura.es/#!/item/waste/index
</a>
</div>
</div>