Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 3245-print_refactor
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
e3795ea072
|
@ -171,9 +171,10 @@ export default class SmartTable extends Component {
|
|||
if (field.length === 2)
|
||||
sortType = field[1];
|
||||
|
||||
const priority = this.sortCriteria.length + 1;
|
||||
const column = this.columns.find(column => column.field == fieldName);
|
||||
if (column) {
|
||||
this.sortCriteria.push({field: fieldName, sortType: sortType});
|
||||
this.sortCriteria.push({field: fieldName, sortType: sortType, priority: priority});
|
||||
|
||||
const isASC = sortType == 'ASC';
|
||||
const isDESC = sortType == 'DESC';
|
||||
|
@ -187,6 +188,8 @@ export default class SmartTable extends Component {
|
|||
column.element.classList.remove('desc');
|
||||
column.element.classList.add('asc');
|
||||
}
|
||||
|
||||
this.setPriority(column.element, priority);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -241,9 +244,13 @@ export default class SmartTable extends Component {
|
|||
const isDESC = existingCriteria && existingCriteria.sortType == 'DESC';
|
||||
|
||||
if (!existingCriteria) {
|
||||
this.sortCriteria.push({field: field, sortType: 'ASC'});
|
||||
const priority = this.sortCriteria.length + 1;
|
||||
|
||||
this.sortCriteria.push({field: field, sortType: 'ASC', priority: priority});
|
||||
element.classList.remove('desc');
|
||||
element.classList.add('asc');
|
||||
|
||||
this.setPriority(element, priority);
|
||||
}
|
||||
|
||||
if (isDESC) {
|
||||
|
@ -252,6 +259,8 @@ export default class SmartTable extends Component {
|
|||
}), 1);
|
||||
element.classList.remove('desc');
|
||||
element.classList.remove('asc');
|
||||
|
||||
element.querySelector('sort-priority').remove();
|
||||
}
|
||||
|
||||
if (isASC) {
|
||||
|
@ -260,9 +269,29 @@ export default class SmartTable extends Component {
|
|||
element.classList.add('desc');
|
||||
}
|
||||
|
||||
let priority = 0;
|
||||
for (const criteria of this.sortCriteria) {
|
||||
const column = this.columns.find(column => column.field == criteria.field);
|
||||
if (column) {
|
||||
criteria.priority = priority;
|
||||
priority++;
|
||||
|
||||
column.element.querySelector('sort-priority').remove();
|
||||
|
||||
this.setPriority(column.element, priority);
|
||||
}
|
||||
}
|
||||
|
||||
this.applySort();
|
||||
}
|
||||
|
||||
setPriority(column, priority) {
|
||||
const sortPriority = document.createElement('sort-priority');
|
||||
sortPriority.setAttribute('class', 'sort-priority');
|
||||
sortPriority.innerHTML = priority;
|
||||
column.appendChild(sortPriority);
|
||||
}
|
||||
|
||||
displaySearch() {
|
||||
const header = this.element.querySelector('thead > tr');
|
||||
if (!header) return;
|
||||
|
|
|
@ -96,9 +96,10 @@ describe('Component smartTable', () => {
|
|||
|
||||
expect(firstSortCriteria.field).toEqual('id');
|
||||
expect(firstSortCriteria.sortType).toEqual('ASC');
|
||||
expect(firstSortCriteria.priority).toEqual(1);
|
||||
});
|
||||
|
||||
it('should insert two new objects to the controller sortCriteria with a sortType values of "ASC" and "DESC"', () => {
|
||||
it('should add new entries to the controller sortCriteria with a sortType values of "ASC" and "DESC"', () => {
|
||||
const element = document.createElement('div');
|
||||
controller.model = {order: 'test1, id DESC'};
|
||||
controller.columns = [
|
||||
|
@ -114,8 +115,11 @@ describe('Component smartTable', () => {
|
|||
|
||||
expect(firstSortCriteria.field).toEqual('test1');
|
||||
expect(firstSortCriteria.sortType).toEqual('ASC');
|
||||
expect(firstSortCriteria.priority).toEqual(1);
|
||||
|
||||
expect(secondSortCriteria.field).toEqual('id');
|
||||
expect(secondSortCriteria.sortType).toEqual('DESC');
|
||||
expect(secondSortCriteria.priority).toEqual(2);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ smart-table {
|
|||
|
||||
}
|
||||
th[field][number] {
|
||||
& > :before {
|
||||
& > span:before {
|
||||
vertical-align: middle;
|
||||
font-family: 'Material Icons';
|
||||
content: 'arrow_downward';
|
||||
|
@ -19,26 +19,26 @@ smart-table {
|
|||
|
||||
}
|
||||
|
||||
&.asc > :before, &.desc > :before {
|
||||
&.asc > span:before, &.desc > span:before {
|
||||
color: $color-font;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
&.asc > :before {
|
||||
&.asc > span:before {
|
||||
content: 'arrow_upward';
|
||||
}
|
||||
|
||||
&.desc > :before {
|
||||
&.desc > span:before {
|
||||
content: 'arrow_downward';
|
||||
}
|
||||
|
||||
&:hover > :before {
|
||||
&:hover > span:before {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
th[field]:not([number]) {
|
||||
& > :after {
|
||||
& > span:after {
|
||||
vertical-align: middle;
|
||||
font-family: 'Material Icons';
|
||||
content: 'arrow_downward';
|
||||
|
@ -48,20 +48,20 @@ smart-table {
|
|||
|
||||
}
|
||||
|
||||
&.asc > :after, &.desc > :after {
|
||||
&.asc > span:after, &.desc > span:after {
|
||||
color: $color-font;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
&.asc > :after {
|
||||
&.asc > span:after {
|
||||
content: 'arrow_upward';
|
||||
}
|
||||
|
||||
&.desc > :after {
|
||||
&.desc > span:after {
|
||||
content: 'arrow_downward';
|
||||
}
|
||||
|
||||
&:hover > :after {
|
||||
&:hover > span:after {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
@ -143,4 +143,16 @@ smart-table {
|
|||
flex: initial;
|
||||
width: 33%
|
||||
}
|
||||
}
|
||||
.sort-priority {
|
||||
background-color: $color-font-bg-marginal;
|
||||
border-radius: 50%;
|
||||
padding: 2px 5px;
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
width: 7px;
|
||||
height: 13px;
|
||||
|
||||
font-size: 10px;
|
||||
color: $color-font-bg
|
||||
}
|
|
@ -0,0 +1,280 @@
|
|||
{
|
||||
"name": "salix-front",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "salix-front",
|
||||
"version": "1.0.0",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"@uirouter/angularjs": "^1.0.20",
|
||||
"angular": "^1.7.5",
|
||||
"angular-animate": "^1.7.8",
|
||||
"angular-moment": "^1.3.0",
|
||||
"angular-translate": "^2.18.1",
|
||||
"angular-translate-loader-partial": "^2.18.1",
|
||||
"croppie": "^2.6.5",
|
||||
"js-yaml": "^3.13.1",
|
||||
"mg-crud": "^1.1.2",
|
||||
"oclazyload": "^0.6.3",
|
||||
"require-yaml": "0.0.1",
|
||||
"validator": "^6.3.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@uirouter/angularjs": {
|
||||
"version": "1.0.30",
|
||||
"resolved": "https://registry.npmjs.org/@uirouter/angularjs/-/angularjs-1.0.30.tgz",
|
||||
"integrity": "sha512-qkc3RFZc91S5K0gc/QVAXc9LGDPXjR04vDgG/11j8+yyZEuQojXxKxdLhKIepiPzqLmGRVqzBmBc27gtqaEeZg==",
|
||||
"dependencies": {
|
||||
"@uirouter/core": "6.0.8"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"angular": ">=1.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@uirouter/core": {
|
||||
"version": "6.0.8",
|
||||
"resolved": "https://registry.npmjs.org/@uirouter/core/-/core-6.0.8.tgz",
|
||||
"integrity": "sha512-Gc/BAW47i4L54p8dqYCJJZuv2s3tqlXQ0fvl6Zp2xrblELPVfxmjnc0eurx3XwfQdaqm3T6uls6tQKkof/4QMw==",
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/angular": {
|
||||
"version": "1.8.2",
|
||||
"resolved": "https://registry.npmjs.org/angular/-/angular-1.8.2.tgz",
|
||||
"integrity": "sha512-IauMOej2xEe7/7Ennahkbb5qd/HFADiNuLSESz9Q27inmi32zB0lnAsFeLEWcox3Gd1F6YhNd1CP7/9IukJ0Gw=="
|
||||
},
|
||||
"node_modules/angular-animate": {
|
||||
"version": "1.8.2",
|
||||
"resolved": "https://registry.npmjs.org/angular-animate/-/angular-animate-1.8.2.tgz",
|
||||
"integrity": "sha512-Jbr9+grNMs9Kj57xuBU3Ju3NOPAjS1+g2UAwwDv7su1lt0/PLDy+9zEwDiu8C8xJceoTbmBNKiWGPJGBdCQLlA=="
|
||||
},
|
||||
"node_modules/angular-moment": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/angular-moment/-/angular-moment-1.3.0.tgz",
|
||||
"integrity": "sha512-KG8rvO9MoaBLwtGnxTeUveSyNtrL+RNgGl1zqWN36+HDCCVGk2DGWOzqKWB6o+eTTbO3Opn4hupWKIElc8XETA==",
|
||||
"dependencies": {
|
||||
"moment": ">=2.8.0 <3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/angular-translate": {
|
||||
"version": "2.19.0",
|
||||
"resolved": "https://registry.npmjs.org/angular-translate/-/angular-translate-2.19.0.tgz",
|
||||
"integrity": "sha512-Z/Fip5uUT2N85dPQ0sMEe1JdF5AehcDe4tg/9mWXNDVU531emHCg53ZND9Oe0dyNiGX5rWcJKmsL1Fujus1vGQ==",
|
||||
"dependencies": {
|
||||
"angular": "^1.8.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/angular-translate-loader-partial": {
|
||||
"version": "2.19.0",
|
||||
"resolved": "https://registry.npmjs.org/angular-translate-loader-partial/-/angular-translate-loader-partial-2.19.0.tgz",
|
||||
"integrity": "sha512-NnMw13LMV4bPQmJK7/pZOZAnPxe0M5OtUHchADs5Gye7V7feonuEnrZ8e1CKhBlv9a7IQyWoqcBa4Lnhg8gk5w==",
|
||||
"dependencies": {
|
||||
"angular-translate": "~2.19.0"
|
||||
}
|
||||
},
|
||||
"node_modules/argparse": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
|
||||
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
|
||||
"dependencies": {
|
||||
"sprintf-js": "~1.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/croppie": {
|
||||
"version": "2.6.5",
|
||||
"resolved": "https://registry.npmjs.org/croppie/-/croppie-2.6.5.tgz",
|
||||
"integrity": "sha512-IlChnVUGG5T3w2gRZIaQgBtlvyuYnlUWs2YZIXXR3H9KrlO1PtBT3j+ykxvy9eZIWhk+V5SpBmhCQz5UXKrEKQ=="
|
||||
},
|
||||
"node_modules/esprima": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
|
||||
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
|
||||
"bin": {
|
||||
"esparse": "bin/esparse.js",
|
||||
"esvalidate": "bin/esvalidate.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/js-yaml": {
|
||||
"version": "3.14.1",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz",
|
||||
"integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==",
|
||||
"dependencies": {
|
||||
"argparse": "^1.0.7",
|
||||
"esprima": "^4.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"js-yaml": "bin/js-yaml.js"
|
||||
}
|
||||
},
|
||||
"node_modules/mg-crud": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/mg-crud/-/mg-crud-1.1.2.tgz",
|
||||
"integrity": "sha1-p6AWGzWSPK7/8ZpIBpS2V1vDggw=",
|
||||
"dependencies": {
|
||||
"angular": "^1.6.1"
|
||||
}
|
||||
},
|
||||
"node_modules/moment": {
|
||||
"version": "2.29.1",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz",
|
||||
"integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==",
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/oclazyload": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmjs.org/oclazyload/-/oclazyload-0.6.3.tgz",
|
||||
"integrity": "sha1-Kjirv/QJDAihEBZxkZRbWfLoJ5w="
|
||||
},
|
||||
"node_modules/require-yaml": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/require-yaml/-/require-yaml-0.0.1.tgz",
|
||||
"integrity": "sha1-LhsY2RPDuqcqWk03O28Tjd0sMr0=",
|
||||
"dependencies": {
|
||||
"js-yaml": ""
|
||||
}
|
||||
},
|
||||
"node_modules/sprintf-js": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
|
||||
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw="
|
||||
},
|
||||
"node_modules/validator": {
|
||||
"version": "6.3.0",
|
||||
"resolved": "https://registry.npmjs.org/validator/-/validator-6.3.0.tgz",
|
||||
"integrity": "sha1-R84j7Y1Ord+p1LjvAHG2zxB418g=",
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@uirouter/angularjs": {
|
||||
"version": "1.0.30",
|
||||
"resolved": "https://registry.npmjs.org/@uirouter/angularjs/-/angularjs-1.0.30.tgz",
|
||||
"integrity": "sha512-qkc3RFZc91S5K0gc/QVAXc9LGDPXjR04vDgG/11j8+yyZEuQojXxKxdLhKIepiPzqLmGRVqzBmBc27gtqaEeZg==",
|
||||
"requires": {
|
||||
"@uirouter/core": "6.0.8"
|
||||
}
|
||||
},
|
||||
"@uirouter/core": {
|
||||
"version": "6.0.8",
|
||||
"resolved": "https://registry.npmjs.org/@uirouter/core/-/core-6.0.8.tgz",
|
||||
"integrity": "sha512-Gc/BAW47i4L54p8dqYCJJZuv2s3tqlXQ0fvl6Zp2xrblELPVfxmjnc0eurx3XwfQdaqm3T6uls6tQKkof/4QMw=="
|
||||
},
|
||||
"angular": {
|
||||
"version": "1.8.2",
|
||||
"resolved": "https://registry.npmjs.org/angular/-/angular-1.8.2.tgz",
|
||||
"integrity": "sha512-IauMOej2xEe7/7Ennahkbb5qd/HFADiNuLSESz9Q27inmi32zB0lnAsFeLEWcox3Gd1F6YhNd1CP7/9IukJ0Gw=="
|
||||
},
|
||||
"angular-animate": {
|
||||
"version": "1.8.2",
|
||||
"resolved": "https://registry.npmjs.org/angular-animate/-/angular-animate-1.8.2.tgz",
|
||||
"integrity": "sha512-Jbr9+grNMs9Kj57xuBU3Ju3NOPAjS1+g2UAwwDv7su1lt0/PLDy+9zEwDiu8C8xJceoTbmBNKiWGPJGBdCQLlA=="
|
||||
},
|
||||
"angular-moment": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/angular-moment/-/angular-moment-1.3.0.tgz",
|
||||
"integrity": "sha512-KG8rvO9MoaBLwtGnxTeUveSyNtrL+RNgGl1zqWN36+HDCCVGk2DGWOzqKWB6o+eTTbO3Opn4hupWKIElc8XETA==",
|
||||
"requires": {
|
||||
"moment": ">=2.8.0 <3.0.0"
|
||||
}
|
||||
},
|
||||
"angular-translate": {
|
||||
"version": "2.19.0",
|
||||
"resolved": "https://registry.npmjs.org/angular-translate/-/angular-translate-2.19.0.tgz",
|
||||
"integrity": "sha512-Z/Fip5uUT2N85dPQ0sMEe1JdF5AehcDe4tg/9mWXNDVU531emHCg53ZND9Oe0dyNiGX5rWcJKmsL1Fujus1vGQ==",
|
||||
"requires": {
|
||||
"angular": "^1.8.0"
|
||||
}
|
||||
},
|
||||
"angular-translate-loader-partial": {
|
||||
"version": "2.19.0",
|
||||
"resolved": "https://registry.npmjs.org/angular-translate-loader-partial/-/angular-translate-loader-partial-2.19.0.tgz",
|
||||
"integrity": "sha512-NnMw13LMV4bPQmJK7/pZOZAnPxe0M5OtUHchADs5Gye7V7feonuEnrZ8e1CKhBlv9a7IQyWoqcBa4Lnhg8gk5w==",
|
||||
"requires": {
|
||||
"angular-translate": "~2.19.0"
|
||||
}
|
||||
},
|
||||
"argparse": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
|
||||
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
|
||||
"requires": {
|
||||
"sprintf-js": "~1.0.2"
|
||||
}
|
||||
},
|
||||
"croppie": {
|
||||
"version": "2.6.5",
|
||||
"resolved": "https://registry.npmjs.org/croppie/-/croppie-2.6.5.tgz",
|
||||
"integrity": "sha512-IlChnVUGG5T3w2gRZIaQgBtlvyuYnlUWs2YZIXXR3H9KrlO1PtBT3j+ykxvy9eZIWhk+V5SpBmhCQz5UXKrEKQ=="
|
||||
},
|
||||
"esprima": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
|
||||
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="
|
||||
},
|
||||
"js-yaml": {
|
||||
"version": "3.14.1",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz",
|
||||
"integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==",
|
||||
"requires": {
|
||||
"argparse": "^1.0.7",
|
||||
"esprima": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"mg-crud": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/mg-crud/-/mg-crud-1.1.2.tgz",
|
||||
"integrity": "sha1-p6AWGzWSPK7/8ZpIBpS2V1vDggw=",
|
||||
"requires": {
|
||||
"angular": "^1.6.1"
|
||||
}
|
||||
},
|
||||
"moment": {
|
||||
"version": "2.29.1",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz",
|
||||
"integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ=="
|
||||
},
|
||||
"oclazyload": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmjs.org/oclazyload/-/oclazyload-0.6.3.tgz",
|
||||
"integrity": "sha1-Kjirv/QJDAihEBZxkZRbWfLoJ5w="
|
||||
},
|
||||
"require-yaml": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/require-yaml/-/require-yaml-0.0.1.tgz",
|
||||
"integrity": "sha1-LhsY2RPDuqcqWk03O28Tjd0sMr0=",
|
||||
"requires": {
|
||||
"js-yaml": ""
|
||||
}
|
||||
},
|
||||
"sprintf-js": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
|
||||
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw="
|
||||
},
|
||||
"validator": {
|
||||
"version": "6.3.0",
|
||||
"resolved": "https://registry.npmjs.org/validator/-/validator-6.3.0.tgz",
|
||||
"integrity": "sha1-R84j7Y1Ord+p1LjvAHG2zxB418g="
|
||||
}
|
||||
}
|
||||
}
|
|
@ -35,6 +35,13 @@
|
|||
{{::agencyModeName}} - {{::warehouseInName}} ({{::shipped | date: 'dd/MM/yyyy'}}) →
|
||||
{{::warehouseOutName}} ({{::landed | date: 'dd/MM/yyyy'}})
|
||||
</tpl-item>
|
||||
<append>
|
||||
<vn-icon-button
|
||||
icon="filter_alt"
|
||||
vn-click-stop="$ctrl.showFilterDialog($ctrl.entry.travelFk)"
|
||||
vn-tooltip="Filter...">
|
||||
</vn-icon-button>
|
||||
</append>
|
||||
</vn-autocomplete>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
|
@ -121,4 +128,94 @@
|
|||
ng-click="watcher.loadOriginalData()">
|
||||
</vn-button>
|
||||
</vn-button-bar>
|
||||
</form>
|
||||
</form>
|
||||
|
||||
<!-- Filter travel dialog -->
|
||||
<vn-dialog
|
||||
vn-id="filterDialog"
|
||||
message="Filter travel">
|
||||
<tpl-body class="travelFilter">
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete
|
||||
label="Agency"
|
||||
ng-model="$ctrl.travelFilterParams.agencyFk"
|
||||
url="AgencyModes"
|
||||
show-field="name"
|
||||
value-field="id">
|
||||
</vn-autocomplete>
|
||||
<vn-autocomplete
|
||||
label="Warehouse Out"
|
||||
ng-model="$ctrl.travelFilterParams.warehouseOutFk"
|
||||
url="Warehouses"
|
||||
show-field="name"
|
||||
value-field="id">
|
||||
</vn-autocomplete>
|
||||
<vn-autocomplete
|
||||
label="Warehouse In"
|
||||
ng-model="$ctrl.travelFilterParams.warehouseInFk"
|
||||
url="Warehouses"
|
||||
show-field="name"
|
||||
value-field="id">
|
||||
</vn-autocomplete>
|
||||
<vn-date-picker
|
||||
label="Shipped"
|
||||
ng-model="$ctrl.travelFilterParams.shipped">
|
||||
</vn-date-picker>
|
||||
<vn-date-picker
|
||||
label="Landed"
|
||||
ng-model="$ctrl.travelFilterParams.landed">
|
||||
</vn-date-picker>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal class="vn-mb-md">
|
||||
<vn-button vn-none
|
||||
label="Search"
|
||||
ng-click="$ctrl.filter()">
|
||||
</vn-button>
|
||||
</vn-horizontal>
|
||||
<vn-crud-model
|
||||
vn-id="travelsModel"
|
||||
url="Travels"
|
||||
filter="$ctrl.travelFilter"
|
||||
data="travels"
|
||||
limit="10">
|
||||
</vn-crud-model>
|
||||
<vn-data-viewer
|
||||
model="travelsModel"
|
||||
class="vn-w-lg">
|
||||
<vn-table class="scrollable">
|
||||
<vn-thead>
|
||||
<vn-tr>
|
||||
<vn-th shrink>ID</vn-th>
|
||||
<vn-th expand>Agency</vn-th>
|
||||
<vn-th expand>Warehouse Out</vn-th>
|
||||
<vn-th expand>Warehouse In</vn-th>
|
||||
<vn-th expand>Shipped</vn-th>
|
||||
<vn-th expand>Landed</vn-th>
|
||||
</vn-tr>
|
||||
</vn-thead>
|
||||
<vn-tbody>
|
||||
<a ng-repeat="travel in travels"
|
||||
class="clickable vn-tr search-result"
|
||||
ng-click="$ctrl.selectTravel(travel.id)">
|
||||
<vn-td shrink>
|
||||
<span
|
||||
vn-click-stop="travelDescriptor.show($event, travel.id)"
|
||||
class="link">
|
||||
{{::travel.id}}
|
||||
</span>
|
||||
</vn-td>
|
||||
<vn-td expand>{{::travel.agency.name}}</vn-td>
|
||||
<vn-td expand>{{::travel.warehouseOut.name}}</vn-td>
|
||||
<vn-td expand>{{::travel.warehouseIn.name}}</vn-td>
|
||||
<vn-td expand>{{::travel.shipped | date: 'dd/MM/yyyy'}}</vn-td>
|
||||
<vn-td expand>{{::travel.landed | date: 'dd/MM/yyyy'}}</vn-td>
|
||||
</a>
|
||||
</vn-tbody>
|
||||
</vn-table>
|
||||
</vn-data-viewer>
|
||||
<vn-travel-descriptor-popover
|
||||
vn-id="travel-descriptor"
|
||||
warehouse-fk="$ctrl.vnConfig.warehouseFk">
|
||||
</vn-travel-descriptor-popover>
|
||||
</tpl-body>
|
||||
</vn-dialog>
|
|
@ -1,10 +1,68 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'salix/components/section';
|
||||
import './style.scss';
|
||||
|
||||
class Controller extends Section {
|
||||
showFilterDialog(travel) {
|
||||
this.activeTravel = travel;
|
||||
this.travelFilterParams = {};
|
||||
this.travelFilter = {
|
||||
include: [
|
||||
{
|
||||
relation: 'agency',
|
||||
scope: {
|
||||
fields: ['name']
|
||||
}
|
||||
},
|
||||
{
|
||||
relation: 'warehouseIn',
|
||||
scope: {
|
||||
fields: ['name']
|
||||
}
|
||||
},
|
||||
{
|
||||
relation: 'warehouseOut',
|
||||
scope: {
|
||||
fields: ['name']
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.$.filterDialog.show();
|
||||
}
|
||||
|
||||
selectTravel(id) {
|
||||
this.entry.travelFk = id;
|
||||
this.$.filterDialog.hide();
|
||||
}
|
||||
|
||||
filter() {
|
||||
const filter = this.travelFilter;
|
||||
const params = this.travelFilterParams;
|
||||
const where = {};
|
||||
for (let key in params) {
|
||||
const value = params[key];
|
||||
if (!value) continue;
|
||||
|
||||
switch (key) {
|
||||
case 'agencyFk':
|
||||
case 'warehouseInFk':
|
||||
case 'warehouseOutFk':
|
||||
case 'shipped':
|
||||
case 'landed':
|
||||
where[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
filter.where = where;
|
||||
this.$.travelsModel.applyFilter(filter);
|
||||
}
|
||||
}
|
||||
ngModule.vnComponent('vnEntryBasicData', {
|
||||
template: require('./index.html'),
|
||||
controller: Section,
|
||||
bindings: {
|
||||
entry: '<'
|
||||
}
|
||||
},
|
||||
controller: Controller
|
||||
});
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
.travelFilter{
|
||||
width: 950px;
|
||||
}
|
|
@ -21,6 +21,20 @@
|
|||
ng-model="filter.fi">
|
||||
</vn-textfield>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete
|
||||
vn-one ng-model="filter.supplierFk"
|
||||
url="Suppliers"
|
||||
show-field="nickname"
|
||||
search-function="{or: [{id: $search}, {nickname: {like: '%'+ $search +'%'}}]}"
|
||||
value-field="id"
|
||||
order="nickname"
|
||||
label="Supplier">
|
||||
<tpl-item>
|
||||
{{::id}} - {{::nickname}}
|
||||
</tpl-item>
|
||||
</vn-autocomplete>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-textfield
|
||||
vn-one
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
vn-id="model"
|
||||
url="SalesMonitors/salesFilter"
|
||||
limit="20"
|
||||
order="shipped DESC, theoreticalHour, id">
|
||||
order="nickname">
|
||||
</vn-crud-model>
|
||||
<vn-portal slot="topbar">
|
||||
<vn-searchbar
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue