Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 2567-calendar_rework

This commit is contained in:
Joan Sanchez 2021-06-04 11:10:43 +02:00
commit f8df3f1f3d
22 changed files with 163 additions and 47 deletions

View File

@ -120,7 +120,7 @@ BEGIN
GROUP BY tl.ticketFk
ON DUPLICATE KEY UPDATE
isAvailable = 0;
/*
INSERT INTO tmp.ticketProblems(ticketFk, itemShortage)
SELECT ticketFk, problem
FROM (
@ -142,10 +142,10 @@ BEGIN
AND NOT i.generic
AND CURDATE() = vDate
AND t.warehouseFk = vWarehouse
GROUP BY tl.ticketFk LIMIT 1) sub
GROUP BY tl.ticketFk) sub
ON DUPLICATE KEY UPDATE
itemShortage = sub.problem;
*/
INSERT INTO tmp.ticketProblems(ticketFk, itemDelay)
SELECT ticketFk, problem
FROM (
@ -165,7 +165,7 @@ BEGIN
AND NOT i.generic
AND CURDATE() = vDate
AND t.warehouseFk = vWarehouse
GROUP BY tl.ticketFk LIMIT 1) sub
GROUP BY tl.ticketFk) sub
ON DUPLICATE KEY UPDATE
itemDelay = sub.problem;
END WHILE;
@ -182,7 +182,6 @@ BEGIN
DROP TEMPORARY TABLE
tmp.clientGetDebt,
tmp.ticketList;
tmp.ticketList;
END;;$$
DELIMITER ;

View File

@ -0,0 +1,18 @@
CREATE TABLE `vn`.`invoiceInLog` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`originFk` MEDIUMINT UNSIGNED NOT NULL,
`userFk` int(10) unsigned DEFAULT 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 `originFk` (`originFk`),
KEY `userFk` (`userFk`),
CONSTRAINT `invoiceInLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `vn`.`invoiceIn` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `invoiceInLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

View File

@ -151,6 +151,7 @@ export default {
mobile: 'vn-client-basic-data vn-textfield[ng-model="$ctrl.client.mobile"]',
salesPerson: 'vn-client-basic-data vn-autocomplete[ng-model="$ctrl.client.salesPersonFk"]',
channel: 'vn-client-basic-data vn-autocomplete[ng-model="$ctrl.client.contactChannelFk"]',
transferor: 'vn-client-basic-data vn-autocomplete[ng-model="$ctrl.client.transferorFk"]',
saveButton: 'vn-client-basic-data button[type=submit]'
},
clientFiscalData: {
@ -162,7 +163,6 @@ export default {
postcode: 'vn-client-fiscal-data vn-datalist[ng-model="$ctrl.client.postcode"]',
sageTax: 'vn-client-fiscal-data vn-autocomplete[ng-model="$ctrl.client.sageTaxTypeFk"]',
sageTransaction: 'vn-client-fiscal-data vn-autocomplete[ng-model="$ctrl.client.sageTransactionTypeFk"]',
transferor: 'vn-client-fiscal-data vn-autocomplete[ng-model="$ctrl.client.transferorFk"]',
city: 'vn-client-fiscal-data vn-datalist[ng-model="$ctrl.client.city"]',
province: 'vn-client-fiscal-data vn-autocomplete[ng-model="$ctrl.client.provinceFk"]',
country: 'vn-client-fiscal-data vn-autocomplete[ng-model="$ctrl.client.countryFk"]',

View File

@ -34,6 +34,7 @@ describe('Client Edit basicData path', () => {
await page.clearInput(selectors.clientBasicData.email);
await page.write(selectors.clientBasicData.email, 'PWallace@verdnatura.es');
await page.autocompleteSearch(selectors.clientBasicData.channel, 'Rumors on the streets');
await page.autocompleteSearch(selectors.clientBasicData.transferor, 'Max Eisenhardt');
await page.waitToClick(selectors.clientBasicData.saveButton);
const message = await page.waitForSnackbar();
@ -67,6 +68,13 @@ describe('Client Edit basicData path', () => {
expect(result).toEqual('Rumors on the streets');
});
it('should confirm the previous client have been selected', async() => {
const result = await page
.waitToGetProperty(selectors.clientBasicData.transferor, 'value');
expect(result).toEqual('Max Eisenhardt');
});
});
describe('as salesAssistant', () => {

View File

@ -68,7 +68,6 @@ describe('Client Edit fiscalData path', () => {
await page.write(selectors.clientFiscalData.city, 'Valencia');
await page.autocompleteSearch(selectors.clientFiscalData.sageTax, 'operaciones no sujetas');
await page.autocompleteSearch(selectors.clientFiscalData.sageTransaction, 'regularización de inversiones');
await page.autocompleteSearch(selectors.clientFiscalData.transferor, 'Max Eisenhardt');
await page.clearInput(selectors.clientFiscalData.postcode);
await page.write(selectors.clientFiscalData.postcode, '46000');
await page.waitToClick(selectors.clientFiscalData.activeCheckbox);
@ -202,12 +201,6 @@ describe('Client Edit fiscalData path', () => {
expect(result).toEqual('36: Regularización de inversiones');
});
it('should confirm the transferor have been edited', async() => {
const result = await page.waitToGetProperty(selectors.clientFiscalData.transferor, 'value');
expect(result).toEqual('Max Eisenhardt');
});
it('should confirm the city have been autocompleted', async() => {
const result = await page.waitToGetProperty(selectors.clientFiscalData.city, 'value');

View File

@ -69,6 +69,19 @@
label="Channel">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete
ng-model="$ctrl.client.transferorFk"
url="Clients/isActive"
search-function="$ctrl.transferorSearchFunction($search)"
where="{id: {neq: $ctrl.client.id}}"
show-field="name"
value-field="id"
label="Previous client"
info="In case of a company succession, specify the grantor company"
rule>
</vn-autocomplete>
</vn-horizontal>
</vn-card>
<vn-button-bar>
<vn-submit

View File

@ -1,9 +1,17 @@
import ngModule from '../module';
import Section from 'salix/components/section';
export default class Controller extends Section {
transferorSearchFunction($search) {
return /^\d+$/.test($search)
? {id: $search}
: {name: {like: '%' + $search + '%'}};
}
}
ngModule.vnComponent('vnClientBasicData', {
template: require('./index.html'),
controller: Section,
controller: Controller,
bindings: {
client: '<'
}

View File

@ -73,17 +73,6 @@
rule>
<tpl-item>{{id}}: {{transaction}}</tpl-item>
</vn-autocomplete>
<vn-autocomplete vn-one
ng-model="$ctrl.client.transferorFk"
url="Clients/isActive"
search-function="$ctrl.transferorSearchFunction($search)"
where="{id: {neq: $ctrl.client.id}}"
show-field="name"
value-field="id"
label="Previous client"
info="In case of a company succession, specify the grantor company"
rule>
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-datalist vn-one

View File

@ -173,12 +173,6 @@ export default class Controller extends Section {
this.client.provinceFk = response.provinceFk;
this.client.countryFk = response.countryFk;
}
transferorSearchFunction($search) {
return /^\d+$/.test($search)
? {id: $search}
: {name: {like: '%' + $search + '%'}};
}
}
ngModule.vnComponent('vnClientFiscalData', {

View File

@ -6,7 +6,7 @@
},
"options": {
"mysql": {
"table": "entry"
"table": "entry"
}
},
"properties": {

View File

@ -26,30 +26,35 @@
"abstract": true,
"component": "vn-entry",
"description": "Entries"
}, {
},
{
"url": "/index?q",
"state": "entry.index",
"component": "vn-entry-index",
"description": "Entries",
"acl": ["buyer", "administrative"]
}, {
},
{
"url": "/latest-buys?q",
"state": "entry.latestBuys",
"component": "vn-entry-latest-buys",
"description": "Latest buys",
"acl": ["buyer", "administrative"]
}, {
},
{
"url": "/create?supplierFk&travelFk&companyFk",
"state": "entry.create",
"component": "vn-entry-create",
"description": "New entry",
"acl": ["buyer", "administrative"]
}, {
},
{
"url": "/:id",
"state": "entry.card",
"abstract": true,
"component": "vn-entry-card"
}, {
},
{
"url": "/summary",
"state": "entry.card.summary",
"component": "vn-entry-summary",
@ -58,7 +63,8 @@
"entry": "$ctrl.entry"
},
"acl": ["buyer", "administrative"]
}, {
},
{
"url": "/basic-data",
"state": "entry.card.basicData",
"component": "vn-entry-basic-data",
@ -67,7 +73,8 @@
"entry": "$ctrl.entry"
},
"acl": ["buyer", "administrative"]
},{
},
{
"url": "/observation",
"state": "entry.card.observation",
"component": "vn-entry-observation",
@ -76,7 +83,8 @@
"entry": "$ctrl.entry"
},
"acl": ["buyer", "administrative"]
},{
},
{
"url" : "/log",
"state": "entry.card.log",
"component": "vn-entry-log",

View File

@ -4,5 +4,8 @@
},
"InvoiceInDueDay": {
"dataSource": "vn"
},
"InvoiceInLog": {
"dataSource": "vn"
}
}

View File

@ -0,0 +1,61 @@
{
"name": "InvoiceInLog",
"base": "VnModel",
"options": {
"mysql": {
"table": "invoiceInLog"
}
},
"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": "InvoiceIn",
"base": "VnModel",
"base": "Loggable",
"log": {
"model": "InvoiceInLog"
},
"options": {
"mysql": {
"table": "invoiceIn"

View File

@ -8,3 +8,4 @@ import './descriptor';
import './descriptor-popover';
import './summary';
import './basic-data';
import './log';

View File

@ -0,0 +1 @@
<vn-log url="InvoiceInLogs" 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('vnInvoiceInLog', {
template: require('./index.html'),
controller: Section,
});

View File

@ -12,6 +12,10 @@
{
"state": "invoiceIn.card.basicData",
"icon": "settings"
},
{
"state": "invoiceIn.card.log",
"icon": "history"
}
]
},
@ -53,7 +57,15 @@
"description": "Basic data",
"params": {
"invoice-in": "$ctrl.invoiceIn"
}
},
"acl": ["administrative"]
},
{
"url": "/log",
"state": "invoiceIn.card.log",
"component": "vn-invoice-in-log",
"description": "Log",
"acl": ["administrative"]
}
]
}

View File

@ -304,7 +304,6 @@ module.exports = Self => {
stmts.push(
`DROP TEMPORARY TABLE
tmp.filter,
tmp.ticket,
tmp.ticket_problems`);
let sql = ParameterizedSQL.join(stmts, ';');

View File

@ -38,7 +38,7 @@
<vn-th field="salesPersonFk" class="expendable" shrink>Salesperson</vn-th>
<vn-th field="shipped" shrink-date>Date</vn-th>
<vn-th>Hour</vn-th>
<vn-th field="hour" shrink>Closure</vn-th>
<vn-th field="zoneHour" shrink>Closure</vn-th>
<vn-th field="provinceFk" class="expendable">Province</vn-th>
<vn-th field="stateFk" shrink>State</vn-th>
<vn-th field="zoneFk">Zone</vn-th>

View File

@ -304,7 +304,6 @@ module.exports = Self => {
stmts.push(
`DROP TEMPORARY TABLE
tmp.filter,
tmp.ticket,
tmp.ticket_problems`);
let sql = ParameterizedSQL.join(stmts, ';');

View File

@ -18,7 +18,7 @@
<vn-th field="salesPersonFk" class="expendable">Salesperson</vn-th>
<vn-th field="shipped" shrink-date>Date</vn-th>
<vn-th>Hour</vn-th>
<vn-th field="hour" shrink>Closure</vn-th>
<vn-th field="zoneHour" shrink>Closure</vn-th>
<vn-th field="nickname">Alias</vn-th>
<vn-th field="provinceFk" class="expendable">Province</vn-th>
<vn-th field="stateFk" >State</vn-th>