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

This commit is contained in:
Carlos Jimenez Ruiz 2020-10-30 10:46:05 +01:00
commit 28ec55b440
17 changed files with 164 additions and 17 deletions

View File

@ -0,0 +1,20 @@
CREATE TABLE `vn`.`supplierLog` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`originFk` int(11) NOT NULL,
`userFk` int(10) unsigned NOT NULL,
`action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL,
`creationDate` timestamp NULL DEFAULT current_timestamp(),
`description` text CHARACTER SET utf8 DEFAULT NULL,
`changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
`oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL,
`newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL,
`changedModelId` int(11) DEFAULT NULL,
`changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `logSupplier_ibfk_1` (`originFk`),
KEY `supplierLog_ibfk_2` (`userFk`),
CONSTRAINT `supplierLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `supplier` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `supplierLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

View File

@ -1208,11 +1208,11 @@ INSERT INTO `vn`.`annualAverageInvoiced`(`clientFk`, `invoiced`)
(104, 500),
(105, 5000);
INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`,`isFarmer`,`retAccount`,`commission`, `created`, `postcodeFk`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`)
INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`,`isFarmer`,`commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `transactionTypeSageFk`)
VALUES
(1, 'Plants SL', 'Plants nick', 4000000001, 1, '06089160W', 0, NULL, 0, CURDATE(), 1111, 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15),
(2, 'Flower King', 'The king', 4000000002, 1, 'B22222222', 0, NULL, 0, CURDATE(), 2222, 1, 'supplier address 2', 'LONDON', 2, 45671, 1, 2, 10),
(442, 'Verdnatura Levante SL', 'Verdnatura', 4000000442, 1, 'C33333333', 0, NULL, 0, CURDATE(), 3333, 1, 'supplier address 3', 'SILLA', 1, 43022, 1, 2, 15);
(1, 'Plants SL', 'Plants nick', 4100000001, 1, '06089160W', 0, 0, CURDATE(), 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15, NULL, NULL),
(2, 'Farmer King', 'The farmer', 4000020002, 1, 'B22222222', 1, 0, CURDATE(), 1, 'supplier address 2', 'SILLA', 2, 43022, 1, 2, 10, 93, 8),
(442, 'Verdnatura Levante SL', 'Verdnatura', 5115000442, 1, 'C33333333', 0, 0, CURDATE(), 1, 'supplier address 3', 'SILLA', 1, 43022, 1, 2, 15, NULL, NULL);
INSERT INTO `cache`.`cache_calc`(`id`, `cache_id`, `cacheName`, `params`, `last_refresh`, `expires`, `created`, `connection_id`)
VALUES

View File

@ -21,10 +21,10 @@ describe('Entry summary path', () => {
});
it(`should display details from the entry on the header`, async() => {
await page.waitForTextInElement(selectors.entrySummary.header, 'The king');
await page.waitForTextInElement(selectors.entrySummary.header, 'The farmer');
const result = await page.waitToGetProperty(selectors.entrySummary.header, 'innerText');
expect(result).toContain('The king');
expect(result).toContain('The farmer');
});
it('should display some entry details like the reference', async() => {

View File

@ -4,5 +4,8 @@
},
"PayDem": {
"dataSource": "vn"
},
"SupplierLog": {
"dataSource": "vn"
}
}

View File

@ -0,0 +1,58 @@
{
"name": "SupplierLog",
"base": "VnModel",
"options": {
"mysql": {
"table": "supplierLog"
}
},
"properties": {
"id": {
"id": true,
"type": "Number",
"forceId": false
},
"originFk": {
"type": "Number",
"required": true
},
"userFk": {
"type": "Number"
},
"action": {
"type": "String",
"required": true
},
"changedModel": {
"type": "String"
},
"oldInstance": {
"type": "Object"
},
"newInstance": {
"type": "Object"
},
"creationDate": {
"type": "Date"
},
"changedModelId": {
"type": "String"
},
"changedModelValue": {
"type": "String"
},
"description": {
"type": "String"
}
},
"relations": {
"user": {
"type": "belongsTo",
"model": "Account",
"foreignKey": "userFk"
}
},
"scope": {
"order": ["creationDate DESC", "id DESC"]
}
}

View File

@ -1,6 +1,9 @@
{
"name": "Supplier",
"base": "VnModel",
"base": "Loggable",
"log": {
"model":"SupplierLog"
},
"options": {
"mysql": {
"table": "supplier"

View File

@ -1,5 +1,5 @@
<vn-portal slot="menu">
<vn-supplier-descriptor supplier="$ctrl.supplier"></vn-entry-descriptor>
<vn-supplier-descriptor supplier="$ctrl.supplier"></vn-supplier-descriptor>
<vn-left-menu source="card"></vn-left-menu>
</vn-portal>
<ui-view></ui-view>

View File

@ -1,8 +1,9 @@
export * from './module';
import './main';
import './index/';
import './search-panel';
import './summary';
import './card';
import './descriptor';
import './index/';
import './search-panel';
import './log';
import './summary';

View File

@ -0,0 +1 @@
<vn-log url="SupplierLogs" origin-id="$ctrl.$params.id"></vn-log>

View File

@ -0,0 +1,7 @@
import ngModule from '../module';
import Section from 'salix/components/section';
ngModule.vnComponent('vnSupplierLog', {
template: require('./index.html'),
controller: Section,
});

View File

@ -9,6 +9,7 @@
{"state": "supplier.index", "icon": "icon-supplier"}
],
"card": [
{"state": "supplier.card.log", "icon": "history"}
]
},
"routes": [
@ -36,6 +37,11 @@
"params": {
"supplier": "$ctrl.supplier"
}
}, {
"url" : "/log",
"state": "supplier.card.log",
"component": "vn-supplier-log",
"description": "Log"
}
]
}

View File

@ -48,6 +48,12 @@
},
"zoneFk": {
"type": "Number"
},
"zonePrice": {
"type": "Number"
},
"zoneBonus": {
"type": "Number"
}
},
"relations": {

View File

@ -15,6 +15,9 @@ class Controller extends ModuleCard {
relation: 'warehouse',
scope: {fields: ['name']}
},
{
relation: 'zone',
},
{
relation: 'invoiceOut',
scope: {fields: ['id']}

View File

@ -76,11 +76,35 @@
</section>
</div>
<div class="totalBox align-left">
<h6 class="align-center" translate>Theorical cost</h6>
<div> <vn-label translate>Price</vn-label> {{$ctrl.theoricalCost | currency: 'EUR': 2}} </div>
<h6 class="align-center" translate>Zone breakdown</h6>
<div> <vn-label translate>Price</vn-label> {{$ctrl.ticket.zonePrice | currency: 'EUR': 2}} </div>
<div> <vn-label translate>Bonus</vn-label> {{$ctrl.ticket.zoneBonus | currency: 'EUR': 2}} </div>
<div> <vn-label translate>Zone</vn-label>
<span
title="{{$ctrl.ticket.zone.name}}"
vn-click-stop="zoneDescriptor.show($event, $ctrl.ticket.zone.id)"
class="link">
{{$ctrl.ticket.zone.name | dashIfEmpty}}
</span>
</div>
<div ng-show="$ctrl.ticket.zone.isVolumetric">
<vn-label translate>Volume</vn-label> {{$ctrl.ticketVolume}}
</div>
<div ng-show="!$ctrl.ticket.zone.isVolumetric">
<vn-label translate>Packages</vn-label> {{$ctrl.ticket.packages}}
</div>
</div>
<div class="totalBox align-left">
<h6 class="align-center" translate>Theorical cost</h6>
<div class="total"> <vn-label translate>Price total</vn-label> {{$ctrl.theoricalCost | currency: 'EUR': 2}} </div>
</div>
</vn-side-menu>
<vn-item-descriptor-popover
vn-id="descriptor"
warehouse-fk="$ctrl.ticket.warehouseFk">
</vn-item-descriptor-popover>
</vn-item-descriptor-popover>
<vn-zone-descriptor-popover
vn-id="zoneDescriptor">
</vn-zone-descriptor-popover>

View File

@ -37,9 +37,10 @@ class Controller extends Section {
this._ticket = value;
if (!value) return;
this.getTheoricalCost();
this.getComponentsSum();
if (this.ticket.zone.isVolumetric)
this.getTicketVolume();
}
base() {
@ -76,6 +77,13 @@ class Controller extends Section {
this.$http.get(`Tickets/${this.ticket.id}/getComponentsSum`)
.then(res => this.componentsList = res.data);
}
getTicketVolume() {
if (!this.ticket) return;
this.$http.get(`Tickets/${this.ticket.id}/getVolume`)
.then(res => this.ticketVolume = res.data[0].volume);
}
}
ngModule.vnComponent('vnTicketComponents', {

View File

@ -89,7 +89,10 @@ describe('ticket', () => {
jest.spyOn(controller, 'getComponentsSum');
controller._ticket = undefined;
controller.ticket = {
id: 7
id: 7,
zone: {
isVolumetric: false
}
};
expect(controller.ticket).toBeDefined();

View File

@ -1,2 +1,6 @@
Theorical cost: Porte teorico
Total without VAT: Total sin IVA
Total without VAT: Total sin IVA
Bonus: Bonificación
Price: Precio
Price total: Precio total
Zone breakdown: Desglose zona