some parts of latestsBuys WIP
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
648c87e763
commit
f2730dd51c
|
@ -11,7 +11,7 @@ import './visible-by';
|
|||
import './bind';
|
||||
import './repeat-last';
|
||||
import './title';
|
||||
import './uvc';
|
||||
import './smart-table';
|
||||
import './droppable';
|
||||
import './http-click';
|
||||
import './http-submit';
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
<div style="position: relative;">
|
||||
<div style="position: absolute; top: 0; left: 0; padding: .3em; z-index: 1">
|
||||
<div style="position: absolute; top: 0; left: 0; z-index: 1">
|
||||
<vn-icon-button
|
||||
icon="menu"
|
||||
ng-click="$ctrl.showUvc($event)">
|
||||
class="vn-pt-sm"
|
||||
icon="more_vert"
|
||||
ng-click="$ctrl.showSmartTable($event)">
|
||||
</vn-icon-button>
|
||||
<vn-dialog
|
||||
<vn-popover
|
||||
class="modal-form"
|
||||
vn-id="uvc"
|
||||
vn-id="smart-table"
|
||||
message="Fields to show">
|
||||
<tpl-body>
|
||||
<div class="vn-pa-md">
|
||||
|
@ -24,6 +25,6 @@
|
|||
</vn-horizontal>
|
||||
</div>
|
||||
</tpl-body>
|
||||
</vn-dialog>
|
||||
</vn-popover>
|
||||
</div>
|
||||
</div>
|
|
@ -1,6 +1,6 @@
|
|||
import ngModule from '../module';
|
||||
import template from './uvc.html';
|
||||
import './uvc.scss';
|
||||
import template from './smart-table.html';
|
||||
import './smart-table.scss';
|
||||
|
||||
directive.$inject = ['$http', '$compile', 'vnApp', '$translate'];
|
||||
export function directive($http, $compile, vnApp, $translate) {
|
||||
|
@ -42,30 +42,29 @@ export function directive($http, $compile, vnApp, $translate) {
|
|||
return (el.getAttribute('th-id') == key || el.getAttribute('field') == key);
|
||||
});
|
||||
|
||||
let baseSelector = `vn-table[vn-uvc=${userConfig.tableCode}] > div`;
|
||||
let baseSelector = `vn-table[vn-smart-table=${userConfig.tableCode}] > div`;
|
||||
selectors.push(`${baseSelector} vn-thead > vn-tr > vn-th:nth-child(${index + 1})`);
|
||||
selectors.push(`${baseSelector} vn-tbody > vn-tr > vn-td:nth-child(${index + 1})`);
|
||||
selectors.push(`${baseSelector} vn-tbody > .vn-tr > vn-td:nth-child(${index + 1})`);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (document.querySelector('style[id="uvc"]')) {
|
||||
let child = document.querySelector('style[id="uvc"]');
|
||||
if (document.querySelector('style[id="smart-table"]')) {
|
||||
let child = document.querySelector('style[id="smart-table"]');
|
||||
child.parentNode.removeChild(child);
|
||||
}
|
||||
|
||||
if (selectors.length) {
|
||||
let rule = selectors.join(', ') + '{display: none;}';
|
||||
$scope.css = document.createElement('style');
|
||||
$scope.css.setAttribute('id', 'uvc');
|
||||
$scope.css.setAttribute('id', 'smart-table');
|
||||
document.head.appendChild($scope.css);
|
||||
$scope.css.appendChild(document.createTextNode(rule));
|
||||
}
|
||||
|
||||
$scope.$on('$destroy', () => {
|
||||
if ($scope.css && document.querySelector('style[id="uvc"]')) {
|
||||
let child = document.querySelector('style[id="uvc"]');
|
||||
if ($scope.css && document.querySelector('style[id="smart-table"]')) {
|
||||
let child = document.querySelector('style[id="smart-table"]');
|
||||
child.parentNode.removeChild(child);
|
||||
}
|
||||
});
|
||||
|
@ -80,13 +79,13 @@ export function directive($http, $compile, vnApp, $translate) {
|
|||
restrict: 'A',
|
||||
link: async function($scope, $element, $attrs) {
|
||||
let cTemplate = $compile(template)($scope)[0];
|
||||
$scope.$ctrl.showUvc = event => {
|
||||
$scope.$ctrl.showSmartTable = event => {
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
$scope.uvc.show();
|
||||
$scope.smartTable.show(event.target);
|
||||
};
|
||||
|
||||
let tableCode = $attrs.vnUvc.trim();
|
||||
let tableCode = $attrs.vnSmartTable.trim();
|
||||
let headerList = getHeaderList($element, $scope);
|
||||
|
||||
let defaultConfigView = {tableCode: tableCode, configuration: {}};
|
||||
|
@ -98,16 +97,16 @@ export function directive($http, $compile, vnApp, $translate) {
|
|||
|
||||
addHideClass($scope, headerList, config);
|
||||
|
||||
let table = document.querySelector(`vn-table[vn-uvc=${tableCode}]`);
|
||||
let table = document.querySelector(`vn-table[vn-smart-table=${tableCode}]`);
|
||||
|
||||
table.insertBefore(cTemplate, table.firstChild);
|
||||
$scope.$ctrl.saveConfiguration = async tableConfiguration => {
|
||||
let newConfig = await saveConfiguration(tableConfiguration);
|
||||
vnApp.showSuccess($translate.instant('Data saved!'));
|
||||
addHideClass($scope, headerList, newConfig.data);
|
||||
$scope.uvc.hide();
|
||||
$scope.smartTable.hide();
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
ngModule.directive('vnUvc', directive);
|
||||
ngModule.directive('vnSmartTable', directive);
|
|
@ -1,4 +1,4 @@
|
|||
vn-table vn-dialog[vn-id="uvc"]{
|
||||
vn-table vn-popover[vn-id="smart-table"]{
|
||||
& > div {
|
||||
min-width: 288px;
|
||||
align-items: center;
|
|
@ -22,7 +22,9 @@
|
|||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.icon-latestBuys:before {
|
||||
content: "\e95f";
|
||||
}
|
||||
.icon-zone:before {
|
||||
content: "\e95d";
|
||||
}
|
||||
|
|
|
@ -102,6 +102,7 @@
|
|||
<glyph unicode="" glyph-name="anonymous" d="M230.4 605.867c12.8 46.933 29.867 93.867 46.933 140.8 8.533 34.133 21.333 64 29.867 98.133 4.267 12.8 8.533 12.8 21.333 12.8 38.4-12.8 72.533-21.333 110.933-25.6 12.8-4.267 29.867 0 46.933 0 34.133 4.267 68.267 8.533 102.4 12.8s72.533 12.8 106.667 17.067c4.267 0 8.533 0 12.8 0s8.533 0 12.8-8.533c12.8-46.933 29.867-93.867 42.667-136.533 12.8-38.4 25.6-76.8 34.133-115.2-192 4.267-379.733 4.267-567.467 4.267zM456.533 247.467c34.133 8.533 64 12.8 98.133 4.267 8.533 0 12.8 0 12.8 8.533 17.067 34.133 42.667 59.733 76.8 72.533 38.4 17.067 76.8 21.333 115.2 8.533 34.133-8.533 59.733-29.867 81.067-55.467 25.6-34.133 38.4-72.533 34.133-119.467-8.533-51.2-34.133-89.6-76.8-115.2-51.2-34.133-132.267-29.867-179.2 12.8-42.667 34.133-59.733 76.8-64 128 0 8.533-4.267 12.8-12.8 17.067-21.333 4.267-42.667 4.267-64 0-8.533-4.267-8.533-4.267-8.533-12.8 0-21.333-4.267-46.933-12.8-68.267-12.8-29.867-34.133-55.467-64-72.533-55.467-38.4-136.533-34.133-183.467 8.533-42.667 34.133-64 76.8-59.733 128 0 59.733 29.867 106.667 85.333 136.533s115.2 25.6 170.667-12.8c12.8-8.533 21.333-17.067 34.133-29.867 0-8.533 8.533-21.333 17.067-38.4zM307.2 302.933c-64 0-115.2-51.2-115.2-110.933 0-64 46.933-115.2 110.933-115.2s115.2 46.933 115.2 110.933c4.267 64-46.933 115.2-110.933 115.2zM712.533 302.933c-64 0-115.2-51.2-115.2-110.933 0-64 46.933-115.2 110.933-115.2 59.733 0 115.2 46.933 115.2 110.933 0 59.733-46.933 115.2-110.933 115.2zM1024 409.6c-341.333 0-682.667 0-1024 0 0 0 0 0 0 0 17.067 8.533 29.867 17.067 46.933 21.333 42.667 12.8 85.333 29.867 132.267 42.667 34.133 8.533 68.267 17.067 102.4 21.333 89.6 17.067 183.467 21.333 277.333 17.067 55.467-4.267 110.933-8.533 166.4-17.067 38.4-4.267 72.533-12.8 110.933-21.333s72.533-21.333 110.933-34.133c21.333-4.267 51.2-17.067 76.8-29.867 0 0 0 0 0 0z" />
|
||||
<glyph unicode="" glyph-name="zone" d="M243.2 448c-12.8 17.067-25.6 34.133-38.4 51.2-34.133 46.933-68.267 98.133-89.6 153.6-17.067 34.133-25.6 72.533-17.067 110.933 8.533 51.2 38.4 89.6 85.333 110.933 59.733 25.6 132.267 8.533 174.933-34.133 34.133-38.4 42.667-81.067 34.133-132.267-8.533-46.933-29.867-85.333-51.2-123.733-29.867-46.933-59.733-89.6-89.6-132.267-4.267 0-4.267 0-8.533-4.267zM247.467 823.467c-46.933 0-89.6-38.4-89.6-89.6 0-46.933 38.4-89.6 85.333-89.6s89.6 38.4 89.6 85.333c0 55.467-38.4 93.867-85.333 93.867zM490.667 379.733l-17.067 25.6 12.8 8.533-34.133 183.467c0 0 0 8.533-8.533 8.533l-42.667 4.267c0 0-68.267-110.933-157.867-217.6 4.267 4.267-93.867 110.933-132.267 187.733l-110.933-51.2c0 0-4.267 0-4.267-8.533l25.6-145.067 34.133-21.333-8.533-21.333-17.067 8.533 59.733-332.8 213.333 102.4 238.933-21.333-51.2 290.133zM149.333 285.867c-12.8 4.267-29.867 12.8-42.667 17.067 4.267 8.533 4.267 17.067 8.533 21.333 17.067 0 29.867-4.267 42.667-12.8-4.267-8.533-4.267-17.067-8.533-25.6zM256 268.8c-17.067 0-34.133 4.267-46.933 4.267 0 8.533 4.267 17.067 4.267 25.6 12.8 0 29.867-4.267 42.667-4.267 0-8.533 0-17.067 0-25.6zM315.733 277.333c-4.267 8.533-4.267 12.8-8.533 21.333 17.067 8.533 29.867 17.067 42.667 21.333 4.267-8.533 8.533-12.8 8.533-21.333-12.8-8.533-25.6-12.8-42.667-21.333zM405.333 328.533c-4.267 8.533-8.533 12.8-12.8 21.333 12.8 8.533 25.6 17.067 38.4 25.6 4.267-4.267 8.533-12.8 12.8-21.333-8.533-8.533-21.333-17.067-38.4-25.6zM972.8 460.8l-29.867 25.6 12.8 21.333 12.8-8.533-34.133 187.733c0 0 0 8.533-8.533 8.533l-226.133 17.067-209.067-93.867c0 0-8.533-4.267-4.267-12.8l29.867-170.667 21.333-12.8-17.067-17.067 55.467-307.2 213.333 102.4 234.667-21.333-51.2 281.6zM580.267 465.067c-4.267 4.267-8.533 12.8-12.8 17.067 12.8 12.8 21.333 21.333 29.867 34.133 4.267-4.267 12.8-12.8 17.067-17.067-12.8-8.533-25.6-21.333-34.133-34.133zM657.067 541.867c-4.267 4.267-8.533 12.8-12.8 21.333 12.8 8.533 25.6 17.067 38.4 25.6 8.533-8.533 12.8-17.067 12.8-21.333-12.8-8.533-25.6-17.067-38.4-25.6zM797.867 571.733c-12.8 4.267-25.6 4.267-42.667 4.267 0 8.533 0 17.067 0 25.6 17.067 0 34.133 0 51.2-4.267-4.267-8.533-4.267-17.067-8.533-25.6zM891.733 520.533c-12.8 8.533-25.6 17.067-38.4 25.6 4.267 8.533 8.533 12.8 12.8 21.333 12.8-8.533 25.6-17.067 38.4-25.6-4.267-8.533-8.533-12.8-12.8-21.333z" />
|
||||
<glyph unicode="" glyph-name="inventory" d="M273.067 226.133c4.267 0 8.533 4.267 8.533 8.533v85.333h98.133v-221.867h-217.6v221.867h98.133v-81.067c0-8.533 8.533-12.8 12.8-12.8zM512 226.133c4.267 0 8.533 4.267 8.533 8.533v85.333h98.133v-221.867h-217.6v221.867h98.133v-81.067c0-8.533 8.533-12.8 12.8-12.8zM750.933 226.133c4.267 0 8.533 4.267 8.533 8.533v85.333h98.133v-221.867h-217.6v221.867h98.133v-81.067c4.267-8.533 8.533-12.8 12.8-12.8zM644.267 780.8h98.133v-81.067c0-4.267 4.267-8.533 8.533-8.533s8.533 4.267 8.533 8.533v81.067h98.133v-221.867h-217.6v221.867h4.267zM401.067 780.8h98.133v-81.067c0-4.267 4.267-8.533 8.533-8.533s8.533 4.267 8.533 8.533v81.067h98.133v-221.867h-213.333v221.867zM162.133 780.8h98.133v-81.067c0-4.267 4.267-8.533 8.533-8.533s8.533 4.267 8.533 8.533v81.067h98.133v-221.867h-213.333v221.867zM153.6 537.6h780.8v-38.4h-844.8v38.4zM68.267-42.667h-42.667v981.333h42.667v-908.8zM89.6 38.4v38.4h844.8v-38.4zM998.4-42.667h-42.667v981.333h42.667z" />
|
||||
<glyph unicode="" glyph-name="latestBuys" d="M183.467 750.933h712.533v-38.4h-768v38.4zM89.6 64c8.533 0 12.8 0 21.333-4.267v900.267h-42.667v-900.267c8.533 4.267 12.8 4.267 21.333 4.267zM955.733 512v448h-42.667v-413.867c17.067-12.8 29.867-21.333 42.667-34.133zM145.067-8.533c0-30.633-24.833-55.467-55.467-55.467s-55.467 24.833-55.467 55.467c0 30.633 24.833 55.467 55.467 55.467s55.467-24.833 55.467-55.467zM418.133 426.667h-290.133v-38.4h273.067c4.267 17.067 8.533 29.867 17.067 38.4zM392.533 106.667h-264.533v-38.4h281.6c-8.533 12.8-12.8 25.6-17.067 38.4zM725.333 247.467c-12.8 0-21.333-8.533-21.333-21.333s8.533-21.333 21.333-21.333c12.8 0 21.333 8.533 21.333 21.333 0 8.533-12.8 21.333-21.333 21.333zM721.067 541.867c-166.4 0-298.667-136.533-298.667-302.933s132.267-302.933 298.667-302.933c166.4 0 298.667 136.533 298.667 302.933 0 170.667-132.267 302.933-298.667 302.933zM725.333 34.133c-98.133 0-174.933 72.533-187.733 162.133h-34.133l51.2 64 59.733-64h-38.4c8.533-68.267 72.533-123.733 149.333-123.733 81.067 0 149.333 64 149.333 145.067s-68.267 145.067-149.333 145.067c-68.267 0-128-46.933-145.067-110.933l-21.333 29.867-17.067-12.8c8.533 29.867 25.6 55.467 46.933 76.8l-25.6 21.333c-4.267 4.267-4.267 12.8 0 17.067l12.8 12.8c4.267 4.267 12.8 4.267 17.067 0l25.6-25.6c21.333 12.8 51.2 25.6 76.8 25.6v29.867h-8.533c-8.533 0-12.8 4.267-12.8 12.8v17.067c0 8.533 4.267 12.8 12.8 12.8h59.733c8.533 0 12.8-4.267 12.8-12.8v-17.067c0-8.533-4.267-12.8-12.8-12.8h-8.533v-21.333c29.867-4.267 55.467-12.8 81.067-29.867l34.133 29.867c4.267 4.267 12.8 4.267 17.067 0l12.8-12.8c4.267-4.267 4.267-12.8 0-17.067l-25.6-25.6c29.867-34.133 51.2-76.8 51.2-128 4.267-102.4-81.067-187.733-183.467-187.733zM772.267 226.133c0-25.6-21.333-46.933-46.933-46.933s-46.933 21.333-46.933 46.933c0 25.6 21.333 46.933 46.933 46.933 8.533 0 17.067-4.267 21.333-4.267l46.933 46.933 21.333-21.333-46.933-46.933c4.267-4.267 4.267-12.8 4.267-21.333z" />
|
||||
<glyph unicode="" glyph-name="wiki" d="M793.6 733.867c0 0 4.267 0 4.267 0l76.8 12.8v-42.667c0-34.133-21.333-68.267-46.933-72.533 0 0-4.267 0-4.267 0l-76.8-12.8v42.667c0 34.133 21.333 64 46.933 72.533zM742.4 597.333l38.4 4.267c12.8 0 25.6-12.8 25.6-29.867v-21.333l-38.4-4.267c-12.8 0-25.6 12.8-25.6 29.867v21.333zM618.667 699.733l68.267 8.533c25.6 4.267 42.667-21.333 42.667-55.467v-38.4l-68.267-8.533c-25.6-4.267-42.667 21.333-42.667 55.467v38.4zM665.6 588.8c4.267 0 4.267 0 0 0l59.733 4.267v-29.867c0-25.6-17.067-46.933-34.133-55.467 0 0-4.267 0-4.267 0l-55.467-8.533v29.867c4.267 29.867 17.067 51.2 34.133 59.733zM443.733 648.533c0 0-4.267 0-4.267 0-119.467 85.333-273.067 46.933-277.333 46.933s-8.533 0-12.8 8.533c0 4.267 0 8.533 8.533 12.8 0 0 42.667 12.8 98.133 8.533 51.2 0 128-12.8 196.267-59.733 4.267-4.267 4.267-8.533 4.267-12.8-4.267-4.267-8.533-4.267-12.8-4.267zM443.733 512c0 0-4.267 0-4.267 0-119.467 85.333-273.067 46.933-277.333 46.933s-8.533 0-12.8 8.533c0 4.267 0 8.533 8.533 12.8 0 0 42.667 12.8 98.133 8.533 51.2 0 128-12.8 196.267-59.733 4.267-4.267 4.267-8.533 4.267-12.8-4.267 0-8.533-4.267-12.8-4.267zM443.733 379.733c0 0-4.267 0-4.267 0-119.467 85.333-273.067 46.933-277.333 46.933s-8.533 0-12.8 8.533c0 4.267 0 8.533 8.533 12.8 0 0 42.667 12.8 98.133 8.533 51.2 0 128-12.8 196.267-59.733 4.267-4.267 4.267-8.533 4.267-12.8-4.267 0-8.533-4.267-12.8-4.267zM443.733 247.467c0 0-4.267 0-4.267 0-119.467 85.333-273.067 46.933-277.333 46.933s-8.533 0-12.8 8.533c0 4.267 0 8.533 8.533 12.8 0 0 42.667 12.8 98.133 8.533 51.2 0 128-12.8 196.267-59.733 4.267-4.267 4.267-8.533 4.267-12.8-4.267 0-8.533-4.267-12.8-4.267zM588.8 379.733c-4.267 0-4.267 0-8.533 4.267s0 8.533 4.267 12.8c68.267 46.933 140.8 59.733 196.267 59.733s93.867-8.533 98.133-8.533c4.267 0 8.533-8.533 8.533-12.8s-8.533-8.533-12.8-8.533v0c0 0-153.6 38.4-277.333-46.933-4.267 4.267-4.267 0-8.533 0zM588.8 247.467c-4.267 0-4.267 0-8.533 4.267s0 8.533 4.267 12.8c68.267 46.933 140.8 59.733 196.267 59.733s93.867-8.533 98.133-8.533c4.267 0 8.533-8.533 8.533-12.8s-8.533-8.533-12.8-8.533v0c0 0-153.6 38.4-277.333-46.933-4.267 4.267-4.267 0-8.533 0zM985.6 738.133v64l-8.533 4.267c-4.267 0-81.067 29.867-179.2 29.867-106.667 0-200.533-34.133-277.333-98.133-76.8 64-170.667 98.133-277.333 98.133-102.4 0-174.933-29.867-179.2-29.867l-12.8-4.267v-59.733c-34.133-4.267-51.2-17.067-51.2-34.133v-614.4h452.267c17.067-12.8 38.4-21.333 64-21.333s46.933 8.533 64 21.333h443.733v614.4c0 17.067-17.067 25.6-38.4 29.867v0zM512 145.067c-38.4 17.067-166.4 64-298.667 64-51.2 0-98.133-8.533-136.533-21.333v597.333c21.333 8.533 85.333 25.6 162.133 25.6 98.133 0 183.467-29.867 256-89.6v-358.4l17.067 17.067v-234.667zM955.733 183.467c-42.667 17.067-89.6 25.6-140.8 25.6-128 0-251.733-51.2-290.133-64v238.933l17.067-17.067v349.867c68.267 59.733 153.6 89.6 256 89.6 76.8 0 136.533-17.067 162.133-25.6v-597.333z" />
|
||||
<glyph unicode="" glyph-name="attach" d="M960 866.133c-42.667 42.667-98.133 64-157.867 64s-115.2-21.333-157.867-64l-593.067-593.067c-34.133-34.133-55.467-85.333-51.2-136.533 0-42.667 17.067-81.067 46.933-110.933 34.133-38.4 81.067-59.733 132.267-59.733 46.933 0 93.867 17.067 128 51.2l541.867 546.133c25.6 25.6 42.667 64 42.667 98.133s-12.8 68.267-38.4 93.867c-25.6 25.6-59.733 38.4-98.133 38.4-34.133 0-72.533-17.067-98.133-42.667l-354.133-354.133c-4.267 0-4.267-4.267-4.267-12.8s4.267-12.8 8.533-17.067 25.6-8.533 34.133 0l354.133 354.133c12.8 17.067 38.4 25.6 59.733 25.6 25.6 0 51.2-12.8 68.267-34.133 8.533-12.8 17.067-25.6 17.067-42.667 4.267-25.6-4.267-55.467-25.6-72.533l-541.867-541.867c-25.6-25.6-55.467-38.4-93.867-38.4-34.133 0-68.267 12.8-93.867 38.4s-38.4 59.733-38.4 93.867c0 34.133 12.8 68.267 38.4 93.867l588.8 584.533c34.133 34.133 76.8 51.2 123.733 51.2s89.6-17.067 123.733-51.2c34.133-34.133 51.2-76.8 51.2-123.733s-17.067-89.6-51.2-123.733l-401.067-401.067c-4.267-4.267-8.533-12.8-8.533-17.067 0-8.533 4.267-12.8 8.533-17.067 8.533-8.533 25.6-8.533 34.133 0l401.067 401.067c89.6 89.6 89.6 230.4 4.267 320z" />
|
||||
<glyph unicode="" glyph-name="zone2" d="M98.133 17.067c-4.267 29.867-12.8 64-17.067 93.867-17.067 98.133-34.133 192-51.2 290.133-12.8 46.933-21.333 98.133-29.867 149.333 0 4.267 0 8.533 4.267 8.533 42.667 21.333 85.333 42.667 128 59.733 0 0 0 0 4.267 0 4.267-8.533 8.533-12.8 12.8-21.333-21.333-8.533-42.667-21.333-64-29.867-17.067-8.533-34.133-17.067-51.2-21.333-4.267 0-4.267-4.267-4.267-8.533 8.533-42.667 17.067-85.333 25.6-132.267 0-4.267 4.267-4.267 4.267-8.533 8.533-4.267 17.067-8.533 25.6-17.067 0-4.267-4.267-12.8-8.533-17.067-4.267 4.267-12.8 4.267-17.067 8.533 17.067-102.4 38.4-209.067 55.467-311.467 17.067 8.533 29.867 12.8 42.667 21.333 51.2 25.6 102.4 51.2 153.6 72.533 4.267 0 8.533 0 17.067 0 68.267-4.267 136.533-12.8 204.8-17.067 0 0 4.267 0 8.533 0-4.267 17.067-4.267 34.133-8.533 51.2-12.8 68.267-25.6 136.533-38.4 204.8 0 8.533-4.267 17.067-12.8 25.6-4.267 4.267-4.267 8.533-8.533 12.8 12.8 4.267 8.533 17.067 8.533 25.6-8.533 51.2-17.067 106.667-29.867 157.867 0 4.267 0 4.267-8.533 4.267-17.067 0-38.4 4.267-55.467 4.267 4.267 8.533 8.533 17.067 12.8 21.333 0 0 4.267 4.267 8.533 4.267 17.067 0 34.133-4.267 46.933-4.267 4.267 0 8.533 0 12.8 0 68.267 29.867 132.267 64 200.533 93.867 4.267 4.267 8.533 8.533 12.8 8.533 68.267-4.267 136.533-8.533 204.8-17.067 8.533 0 17.067 0 29.867-4.267 4.267 0 8.533-4.267 8.533-8.533 12.8-64 25.6-132.267 34.133-196.267 17.067-102.4 38.4-204.8 55.467-311.467 0-8.533 4.267-17.067 4.267-25.6-17.067 0-34.133 4.267-51.2 4.267-42.667 4.267-89.6 8.533-132.267 12.8-17.067 0-38.4 4.267-55.467 4.267-4.267 0-12.8 0-17.067-4.267-68.267-29.867-132.267-64-200.533-93.867 0 0-4.267 0-8.533 0-76.8 8.533-149.333 12.8-226.133 21.333-4.267 0-8.533 0-12.8 0-72.533-34.133-140.8-68.267-213.333-102.4 0-4.267 0-8.533-4.267-8.533zM989.867 217.6c0 4.267 0 4.267 0 8.533-8.533 34.133-12.8 72.533-21.333 106.667-8.533 46.933-17.067 89.6-25.6 136.533 0 8.533-4.267 12.8-8.533 17.067-8.533 4.267-12.8 12.8-21.333 17.067 4.267 8.533 8.533 12.8 12.8 17.067 4.267-4.267 8.533-4.267 12.8-8.533-4.267 12.8-4.267 21.333-4.267 34.133-8.533 46.933-17.067 93.867-25.6 145.067 0 4.267-4.267 8.533-8.533 8.533-68.267 4.267-136.533 12.8-209.067 17.067-4.267 0-8.533 0-12.8-4.267-64-29.867-123.733-59.733-187.733-85.333-4.267-4.267-8.533-4.267-4.267-12.8 4.267-29.867 12.8-64 17.067-93.867 4.267-21.333 8.533-42.667 12.8-59.733 12.8-4.267 12.8-12.8 21.333-21.333-12.8-4.267-12.8-12.8-12.8-25.6 12.8-68.267 25.6-132.267 38.4-200.533 4.267-25.6 8.533-51.2 12.8-76.8 4.267 0 4.267 0 8.533 4.267 59.733 29.867 119.467 59.733 183.467 89.6-4.267 4.267 0 4.267 4.267 4.267 51.2-4.267 106.667-8.533 157.867-12.8 21.333 0 38.4-4.267 59.733-4.267zM260.267 469.333c-12.8 17.067-25.6 34.133-38.4 46.933-29.867 46.933-59.733 93.867-85.333 145.067-12.8 29.867-21.333 64-17.067 102.4 8.533 51.2 34.133 85.333 81.067 102.4 55.467 21.333 123.733 8.533 162.133-34.133 34.133-34.133 42.667-76.8 34.133-123.733-8.533-42.667-25.6-76.8-46.933-115.2-25.6-42.667-55.467-81.067-85.333-123.733 0 4.267-4.267 0-4.267 0zM260.267 819.2c-46.933 0-81.067-34.133-81.067-81.067s38.4-81.067 81.067-81.067c46.933 0 81.067 38.4 85.333 81.067 0 42.667-38.4 81.067-85.333 81.067zM358.4 349.867c4.267-8.533 4.267-12.8 8.533-21.333-12.8-4.267-25.6-12.8-38.4-17.067-4.267 8.533-4.267 12.8-8.533 21.333 12.8 4.267 25.6 12.8 38.4 17.067zM226.133 302.933c0 8.533 4.267 17.067 4.267 21.333 12.8 0 25.6-4.267 38.4-4.267 0-8.533 0-12.8 0-25.6-12.8 8.533-29.867 8.533-42.667 8.533zM413.867 354.133c-4.267 8.533-8.533 12.8-12.8 21.333 12.8 8.533 21.333 17.067 34.133 25.6 4.267-4.267 8.533-12.8 12.8-17.067-12.8-12.8-21.333-21.333-34.133-29.867zM179.2 341.333c-4.267-8.533-4.267-12.8-8.533-21.333-12.8 4.267-25.6 8.533-38.4 17.067 4.267 8.533 4.267 12.8 8.533 21.333 12.8-8.533 25.6-12.8 38.4-17.067zM682.667 580.267c-12.8-8.533-21.333-17.067-34.133-21.333-4.267 4.267-8.533 12.8-12.8 17.067 12.8 8.533 25.6 17.067 38.4 25.6 4.267-8.533 4.267-17.067 8.533-21.333zM878.933 558.933c-4.267-8.533-8.533-12.8-12.8-21.333-12.8 8.533-25.6 17.067-34.133 21.333 4.267 8.533 8.533 12.8 8.533 21.333 12.8-8.533 25.6-17.067 38.4-21.333zM571.733 486.4c-4.267 4.267-8.533 12.8-12.8 17.067 8.533 8.533 21.333 21.333 29.867 29.867 4.267-4.267 8.533-12.8 12.8-17.067-8.533-8.533-17.067-21.333-29.867-29.867zM785.067 610.133c-4.267-8.533-4.267-17.067-8.533-21.333-12.8 0-25.6 4.267-38.4 4.267 0 8.533 0 12.8 0 21.333 17.067 0 29.867-4.267 46.933-4.267z" />
|
||||
|
|
Before Width: | Height: | Size: 108 KiB After Width: | Height: | Size: 109 KiB |
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,111 @@
|
|||
|
||||
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
||||
const buildFilter = require('vn-loopback/util/filter').buildFilter;
|
||||
const mergeFilters = require('vn-loopback/util/filter').mergeFilters;
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('latestBuysFilter', {
|
||||
description: 'Find all instances of the model matched by filter from the data source.',
|
||||
accessType: 'READ',
|
||||
accepts: [
|
||||
{
|
||||
arg: 'filter',
|
||||
type: 'Object',
|
||||
description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string',
|
||||
http: {source: 'query'}
|
||||
},
|
||||
{
|
||||
arg: 'tags',
|
||||
type: ['Object'],
|
||||
description: 'List of tags to filter with',
|
||||
http: {source: 'query'}
|
||||
}, {
|
||||
arg: 'search',
|
||||
type: 'String',
|
||||
description: `If it's and integer searchs by id, otherwise it searchs by name`,
|
||||
http: {source: 'query'}
|
||||
}, {
|
||||
arg: 'id',
|
||||
type: 'Integer',
|
||||
description: 'Item id',
|
||||
http: {source: 'query'}
|
||||
}, {
|
||||
arg: 'categoryFk',
|
||||
type: 'Integer',
|
||||
description: 'Category id',
|
||||
http: {source: 'query'}
|
||||
}, {
|
||||
arg: 'typeFk',
|
||||
type: 'Integer',
|
||||
description: 'Type id',
|
||||
http: {source: 'query'}
|
||||
}, {
|
||||
arg: 'isActive',
|
||||
type: 'Boolean',
|
||||
description: 'Whether the the item is or not active',
|
||||
http: {source: 'query'}
|
||||
}, {
|
||||
arg: 'salesPersonFk',
|
||||
type: 'Integer',
|
||||
description: 'The buyer of the item',
|
||||
http: {source: 'query'}
|
||||
}
|
||||
],
|
||||
returns: {
|
||||
type: ['Object'],
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/latestBuysFilter`,
|
||||
verb: 'GET'
|
||||
}
|
||||
});
|
||||
|
||||
Self.latestBuysFilter = async(ctx, filter) => {
|
||||
let conn = Self.dataSource.connector;
|
||||
let where = buildFilter(ctx.args, (param, value) => {
|
||||
// switch (param) {
|
||||
// case 'search':
|
||||
// return /^\d+$/.test(value)
|
||||
// ? {or: [{'i.id': value}]}
|
||||
// : {or: [{'i.name': {like: `%${value}%`}}]};
|
||||
// case 'id':
|
||||
// return {'i.id': value};
|
||||
// case 'description':
|
||||
// return {'i.description': {like: `%${value}%`}};
|
||||
// case 'categoryFk':
|
||||
// return {'ic.id': value};
|
||||
// case 'salesPersonFk':
|
||||
// return {'t.workerFk': value};
|
||||
// case 'typeFk':
|
||||
// return {'i.typeFk': value};
|
||||
// case 'isActive':
|
||||
// return {'i.isActive': value};
|
||||
// }
|
||||
});
|
||||
filter = mergeFilters(ctx.args.filter, {where});
|
||||
|
||||
let stmts = [];
|
||||
let stmt;
|
||||
|
||||
stmt = new ParameterizedSQL('CALL cache.last_buy_refresh(FALSE)');
|
||||
stmts.push(stmt);
|
||||
|
||||
stmt = new ParameterizedSQL(`
|
||||
SELECT
|
||||
size
|
||||
FROM cache.last_buy lb
|
||||
JOIN item i ON i.id = lb.item_id
|
||||
JOIN itemType it ON it.id = i.typeFk AND lb.warehouse_id = it.warehouseFk
|
||||
JOIN buy b ON b.id = lb.buy_id`
|
||||
);
|
||||
|
||||
stmt.merge(conn.makeSuffix(filter));
|
||||
let buysIndex = stmts.push(stmt) - 1;
|
||||
|
||||
let sql = ParameterizedSQL.join(stmts, ';');
|
||||
let result = await conn.executeStmt(sql);
|
||||
return buysIndex === 0 ? result : result[buysIndex];
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
const app = require('vn-loopback/server/server');
|
||||
|
||||
fdescribe('Entry latests buys filter()', () => {
|
||||
it('should return the entry matching "search"', async() => {
|
||||
let ctx = {
|
||||
args: {
|
||||
search: 1
|
||||
}
|
||||
};
|
||||
|
||||
let result = await app.models.Entry.latestBuysFilter(ctx);
|
||||
|
||||
expect(result[0].size).toEqual(300);
|
||||
});
|
||||
});
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
module.exports = Self => {
|
||||
require('../methods/entry/latestBuysFilter')(Self);
|
||||
require('../methods/entry/filter')(Self);
|
||||
require('../methods/entry/getEntry')(Self);
|
||||
};
|
||||
|
|
|
@ -2,7 +2,9 @@ export * from './module';
|
|||
|
||||
import './main';
|
||||
import './index/';
|
||||
import './latest-buys';
|
||||
import './search-panel';
|
||||
import './latest-buys-search-panel';
|
||||
import './descriptor';
|
||||
import './card';
|
||||
import './summary';
|
||||
|
|
|
@ -12,4 +12,6 @@ Reference: Referencia
|
|||
Created: Creado
|
||||
Booked: Facturado
|
||||
Is inventory: Inventario
|
||||
Notes: Notas
|
||||
Notes: Notas
|
||||
Status: Estado
|
||||
Selection: Selección
|
|
@ -0,0 +1,162 @@
|
|||
<mg-ajax path="Tags" options="mgIndex as tags"></mg-ajax>
|
||||
<div class="search-panel">
|
||||
<form ng-submit="$ctrl.onSearch()">
|
||||
<vn-horizontal>
|
||||
<vn-textfield
|
||||
vn-one
|
||||
label="General search"
|
||||
ng-model="filter.search"
|
||||
info="Search items by id, name or barcode"
|
||||
vn-focus>
|
||||
</vn-textfield>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
vn-focus
|
||||
url="ItemCategories"
|
||||
label="Category"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
ng-model="filter.categoryFk">
|
||||
</vn-autocomplete>
|
||||
<vn-autocomplete vn-one
|
||||
url="ItemTypes"
|
||||
label="Type"
|
||||
where="{categoryFk: filter.categoryFk}"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
ng-model="filter.typeFk"
|
||||
fields="['categoryFk']"
|
||||
include="'category'">
|
||||
<tpl-item>
|
||||
<div>{{name}}</div>
|
||||
<div class="text-caption text-secondary">
|
||||
{{category.name}}
|
||||
</div>
|
||||
</tpl-item>>
|
||||
</vn-autocomplete>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
disabled="false"
|
||||
ng-model="filter.salesPersonFk"
|
||||
url="Clients/activeWorkersWithRole"
|
||||
show-field="nickname"
|
||||
search-function="{firstName: $search}"
|
||||
value-field="id"
|
||||
where="{role: 'employee'}"
|
||||
label="Buyer">
|
||||
</vn-autocomplete>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal class="vn-pt-sm">
|
||||
<vn-one class="text-subtitle1" translate>
|
||||
Tags
|
||||
</vn-one>
|
||||
<vn-icon-button
|
||||
vn-none
|
||||
vn-bind="+"
|
||||
vn-tooltip="Add tag"
|
||||
icon="add_circle"
|
||||
ng-click="filter.tags.push({})">
|
||||
</vn-icon-button>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal ng-repeat="itemTag in filter.tags">
|
||||
<vn-autocomplete
|
||||
vn-id="tag"
|
||||
vn-one
|
||||
ng-model="itemTag.tagFk"
|
||||
data="tags.model"
|
||||
show-field="name"
|
||||
label="Tag"
|
||||
on-change="itemTag.value = null">
|
||||
</vn-autocomplete>
|
||||
<vn-textfield
|
||||
vn-one
|
||||
ng-show="tag.selection.isFree !== false"
|
||||
vn-id="text"
|
||||
label="Value"
|
||||
ng-model="itemTag.value">
|
||||
</vn-textfield>
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
ng-show="tag.selection.isFree === false"
|
||||
url="{{$ctrl.getSourceTable(tag.selection)}}"
|
||||
label="Value"
|
||||
ng-model="itemTag.value"
|
||||
show-field="name"
|
||||
value-field="name">
|
||||
</vn-autocomplete>
|
||||
<vn-icon-button
|
||||
vn-none
|
||||
vn-tooltip="Remove tag"
|
||||
icon="delete"
|
||||
ng-click="filter.tags.splice($index, 1)"
|
||||
tabindex="-1">
|
||||
</vn-icon-button>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal class="vn-pt-sm">
|
||||
<vn-one class="text-subtitle1" translate>
|
||||
More fields
|
||||
</vn-one>
|
||||
<vn-icon-button
|
||||
vn-none
|
||||
vn-bind="+"
|
||||
vn-tooltip="Add field"
|
||||
icon="add_circle"
|
||||
ng-click="$ctrl.fieldFilters.push({})">
|
||||
</vn-icon-button>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal ng-repeat="fieldFilter in $ctrl.fieldFilters">
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
label="Field"
|
||||
ng-model="fieldFilter.name"
|
||||
data="$ctrl.moreFields"
|
||||
value-field="name"
|
||||
show-field="label"
|
||||
show-filter="false"
|
||||
translate-fields="['label']"
|
||||
selection="info"
|
||||
on-change="fieldFilter.value = null">
|
||||
</vn-autocomplete>
|
||||
<vn-one ng-switch="info.type">
|
||||
<div ng-switch-when="Number">
|
||||
<vn-input-number
|
||||
label="Value"
|
||||
ng-model="fieldFilter.value">
|
||||
</vn-input-number>
|
||||
</div>
|
||||
<div ng-switch-when="Boolean">
|
||||
<vn-check
|
||||
label="Value"
|
||||
ng-model="fieldFilter.value">
|
||||
</vn-check>
|
||||
</div>
|
||||
<div ng-switch-when="Date">
|
||||
<vn-date-picker
|
||||
label="Value"
|
||||
ng-model="fieldFilter.value">
|
||||
</vn-date-picker>
|
||||
</div>
|
||||
<div ng-switch-default>
|
||||
<vn-textfield
|
||||
label="Value"
|
||||
ng-model="fieldFilter.value">
|
||||
</vn-textfield>
|
||||
</div>
|
||||
</vn-one>
|
||||
<vn-icon-button
|
||||
vn-none
|
||||
vn-tooltip="Remove field"
|
||||
icon="delete"
|
||||
ng-click="$ctrl.removeField($index, fieldFilter.name)"
|
||||
tabindex="-1">
|
||||
</vn-icon-button>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal class="vn-mt-lg">
|
||||
<vn-submit label="Search"></vn-submit>
|
||||
</vn-horizontal>
|
||||
</form>
|
||||
</div>
|
|
@ -0,0 +1,79 @@
|
|||
import ngModule from '../module';
|
||||
import SearchPanel from 'core/components/searchbar/search-panel';
|
||||
|
||||
class Controller extends SearchPanel {
|
||||
constructor($element, $) {
|
||||
super($element, $);
|
||||
let model = 'Item';
|
||||
let moreFields = ['id', 'description', 'name', 'isActive'];
|
||||
|
||||
let properties;
|
||||
let validations = window.validations;
|
||||
|
||||
if (validations && validations[model])
|
||||
properties = validations[model].properties;
|
||||
else
|
||||
properties = {};
|
||||
|
||||
this.moreFields = [];
|
||||
for (let field of moreFields) {
|
||||
let prop = properties[field];
|
||||
this.moreFields.push({
|
||||
name: field,
|
||||
label: prop ? prop.description : field,
|
||||
type: prop ? prop.type : null
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
get filter() {
|
||||
let filter = this.$.filter;
|
||||
|
||||
for (let fieldFilter of this.fieldFilters)
|
||||
filter[fieldFilter.name] = fieldFilter.value;
|
||||
|
||||
return filter;
|
||||
}
|
||||
|
||||
set filter(value) {
|
||||
if (!value)
|
||||
value = {};
|
||||
if (!value.tags)
|
||||
value.tags = [{}];
|
||||
|
||||
this.fieldFilters = [];
|
||||
for (let field of this.moreFields) {
|
||||
if (value[field.name] != undefined) {
|
||||
this.fieldFilters.push({
|
||||
name: field.name,
|
||||
value: value[field.name],
|
||||
info: field
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
this.$.filter = value;
|
||||
}
|
||||
|
||||
getSourceTable(selection) {
|
||||
if (!selection || selection.isFree === true)
|
||||
return null;
|
||||
|
||||
if (selection.sourceTable) {
|
||||
return ''
|
||||
+ selection.sourceTable.charAt(0).toUpperCase()
|
||||
+ selection.sourceTable.substring(1) + 's';
|
||||
} else if (selection.sourceTable == null)
|
||||
return `ItemTags/filterItemTags/${selection.id}`;
|
||||
}
|
||||
|
||||
removeField(index, field) {
|
||||
this.fieldFilters.splice(index, 1);
|
||||
this.$.filter[field] = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
ngModule.component('vnLatestBuysSearchPanel', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller
|
||||
});
|
|
@ -0,0 +1,45 @@
|
|||
import './index.js';
|
||||
|
||||
describe('Item', () => {
|
||||
describe('Component vnItemSearchPanel', () => {
|
||||
let $element;
|
||||
let controller;
|
||||
|
||||
beforeEach(ngModule('item'));
|
||||
|
||||
beforeEach(angular.mock.inject($componentController => {
|
||||
$element = angular.element(`<div></div>`);
|
||||
controller = $componentController('vnItemSearchPanel', {$element});
|
||||
}));
|
||||
|
||||
describe('getSourceTable()', () => {
|
||||
it(`should return null if there's no selection`, () => {
|
||||
let selection = null;
|
||||
let result = controller.getSourceTable(selection);
|
||||
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
|
||||
it(`should return null if there's a selection but its isFree property is truthy`, () => {
|
||||
let selection = {isFree: true};
|
||||
let result = controller.getSourceTable(selection);
|
||||
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
|
||||
it(`should return the formated sourceTable concatenated to a path`, () => {
|
||||
let selection = {sourceTable: 'hello guy'};
|
||||
let result = controller.getSourceTable(selection);
|
||||
|
||||
expect(result).toEqual('Hello guys');
|
||||
});
|
||||
|
||||
it(`should return a path if there's no sourceTable and the selection has an id`, () => {
|
||||
let selection = {id: 99};
|
||||
let result = controller.getSourceTable(selection);
|
||||
|
||||
expect(result).toEqual(`ItemTags/filterItemTags/${selection.id}`);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
|
@ -0,0 +1,8 @@
|
|||
Ink: Tinta
|
||||
Origin: Origen
|
||||
Producer: Productor.
|
||||
With visible: Con visible
|
||||
Field: Campo
|
||||
More fields: Más campos
|
||||
Add field: Añadir campo
|
||||
Remove field: Quitar campo
|
|
@ -0,0 +1,120 @@
|
|||
<vn-crud-model
|
||||
vn-id="model"
|
||||
url="Entries/latestBuysFilter"
|
||||
limit="20"
|
||||
data="buys"
|
||||
auto-load="true">
|
||||
</vn-crud-model>
|
||||
<vn-portal slot="topbar">
|
||||
<vn-searchbar
|
||||
panel="vn-latest-buys-search-panel"
|
||||
suggested-filter="$ctrl.filterParams"
|
||||
info="Search buys"
|
||||
filter="$ctrl.filterParams"
|
||||
model="model"
|
||||
auto-state="false">
|
||||
</vn-searchbar>
|
||||
</vn-portal>
|
||||
<!-- <vn-portal slot="topbar">
|
||||
<vn-searchbar
|
||||
panel="vn-latest-buys-search-panel"
|
||||
info="Search buys"
|
||||
model="model"
|
||||
auto-state="false">
|
||||
</vn-searchbar>
|
||||
</vn-portal> -->
|
||||
<vn-data-viewer
|
||||
model="model"
|
||||
class="vn-mb-xl vn-w-xl">
|
||||
<vn-card>
|
||||
<vn-table
|
||||
model="model"
|
||||
show-fields="$ctrl.showFields"
|
||||
vn-smart-table="latestBuys">
|
||||
<vn-thead>
|
||||
<vn-tr>
|
||||
<vn-th shrink
|
||||
field='Selection'>
|
||||
<vn-multi-check
|
||||
model="model">
|
||||
</vn-multi-check>
|
||||
</vn-th>
|
||||
<vn-th shrink field='status'></vn-th>
|
||||
<vn-th field="id" number>Id</vn-th>
|
||||
<vn-th field="landed" center>Landed</vn-th>
|
||||
<vn-th>Reference</vn-th>
|
||||
<vn-th field="supplierFk">Supplier</vn-th>
|
||||
<vn-th field="currencyFk" center>Currency</vn-th>
|
||||
<vn-th field="companyFk" center>Company</vn-th>
|
||||
<vn-th field="isBooked" center>Booked</vn-th>
|
||||
<vn-th field="isConfirmed" center>Confirmed</vn-th>
|
||||
<vn-th field="isOrdered" center>Ordered</vn-th>
|
||||
<vn-th>Notes</vn-th>
|
||||
</vn-tr>
|
||||
</vn-thead>
|
||||
<vn-tbody>
|
||||
<a ng-repeat="buy in $ctrl.buys"
|
||||
class="clickable vn-tr search-result"
|
||||
ui-sref="buy.card.summary({id: {{::buy.id}}})">
|
||||
<vn-td shrink>
|
||||
<vn-check
|
||||
ng-model="buy.checked"
|
||||
vn-click-stop>
|
||||
</vn-check>
|
||||
</vn-td>
|
||||
<vn-td shrink>
|
||||
<vn-icon
|
||||
ng-show="buy.isInventory"
|
||||
class="bright"
|
||||
vn-tooltip="Inventory buy"
|
||||
icon="icon-inventory">
|
||||
</vn-icon>
|
||||
<vn-icon
|
||||
ng-show="buy.isRaid"
|
||||
class="bright"
|
||||
vn-tooltip="Virtual buy"
|
||||
icon="icon-net">
|
||||
</vn-icon>
|
||||
</vn-td>
|
||||
<vn-td number>{{::buy.size}}</vn-td>
|
||||
<vn-td center>
|
||||
<span
|
||||
class="link"
|
||||
vn-click-stop="travelDescriptor.show($event, buy.travelFk)">
|
||||
{{::buy.landed | date:'dd/MM/yyyy'}}
|
||||
</span>
|
||||
</vn-td>
|
||||
<vn-td expand>{{::buy.ref}}</vn-td>
|
||||
<vn-td expand>{{::buy.supplierName}}</vn-td>
|
||||
<vn-td center expand>{{::buy.currencyCode}}</vn-td>
|
||||
<vn-td center expand>{{::buy.companyCode}}</vn-td>
|
||||
<vn-td center><vn-check ng-model="buy.isBooked" disabled="true"></vn-check></vn-td>
|
||||
<vn-td center><vn-check ng-model="buy.isConfirmed" disabled="true"></vn-check></vn-td>
|
||||
<vn-td center><vn-check ng-model="buy.isOrdered" disabled="true"></vn-check></vn-td>
|
||||
<vn-td shrink>
|
||||
<vn-icon
|
||||
ng-if="buy.notes.length"
|
||||
vn-tooltip="{{::buy.notes}}"
|
||||
icon="insert_drive_file"
|
||||
class="bright">
|
||||
</vn-icon>
|
||||
</vn-td>
|
||||
</a>
|
||||
</vn-tbody>
|
||||
</vn-table>
|
||||
</vn-card>
|
||||
</vn-data-viewer>
|
||||
<div fixed-bottom-right>
|
||||
<vn-vertical style="align-items: center;">
|
||||
<vn-button class="round sm vn-mb-sm"
|
||||
icon="edit"
|
||||
ng-show="$ctrl.totalChecked > 0"
|
||||
ng-click="$ctrl.edit()"
|
||||
vn-tooltip="Edit buys"
|
||||
tooltip-position="left">
|
||||
</vn-button>
|
||||
</vn-vertical>
|
||||
</div>
|
||||
<vn-travel-descriptor-popover
|
||||
vn-id="travelDescriptor">
|
||||
</vn-travel-descriptor-popover>
|
|
@ -0,0 +1,31 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'salix/components/section';
|
||||
|
||||
export default class Controller extends Section {
|
||||
constructor($element, $) {
|
||||
super($element, $);
|
||||
this.showFields = {
|
||||
id: false,
|
||||
actions: false
|
||||
};
|
||||
}
|
||||
get checked() {
|
||||
const buys = this.$.model.data || [];
|
||||
const checkedBuys = [];
|
||||
for (let buy of buys) {
|
||||
if (buy.checked)
|
||||
checkedBuys.push(buy);
|
||||
}
|
||||
|
||||
return checkedBuys;
|
||||
}
|
||||
|
||||
get totalChecked() {
|
||||
return this.checked.length;
|
||||
}
|
||||
}
|
||||
|
||||
ngModule.component('vnEntryLatestBuys', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller
|
||||
});
|
|
@ -0,0 +1 @@
|
|||
Edit buys: Editar compras
|
|
@ -1,5 +1,6 @@
|
|||
#Ordenar alfabeticamente
|
||||
|
||||
entry: entrada
|
||||
Latest buys: Últimas compras
|
||||
|
||||
# Sections
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
"validations": true,
|
||||
"menus": {
|
||||
"main": [
|
||||
{"state": "entry.index", "icon": "icon-entry"}
|
||||
{"state": "entry.index", "icon": "icon-entry"},
|
||||
{"state": "entry.latestBuys", "icon": "icon-latestBuys"}
|
||||
],
|
||||
"card": [
|
||||
{"state": "entry.card.buy", "icon": "icon-lines"},
|
||||
|
@ -25,6 +26,11 @@
|
|||
"state": "entry.index",
|
||||
"component": "vn-entry-index",
|
||||
"description": "Entries"
|
||||
}, {
|
||||
"url": "/latest-buys?q",
|
||||
"state": "entry.latestBuys",
|
||||
"component": "vn-entry-latest-buys",
|
||||
"description": "Latest buys"
|
||||
}, {
|
||||
"url": "/:id",
|
||||
"state": "entry.card",
|
||||
|
|
|
@ -41,7 +41,7 @@ module.exports = Self => {
|
|||
}, {
|
||||
arg: 'isActive',
|
||||
type: 'Boolean',
|
||||
description: 'Whether the the item is o not active',
|
||||
description: 'Whether the the item is or not active',
|
||||
http: {source: 'query'}
|
||||
}, {
|
||||
arg: 'salesPersonFk',
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<vn-table
|
||||
model="model"
|
||||
show-fields="$ctrl.showFields"
|
||||
vn-uvc="itemIndex">
|
||||
vn-smart-table="itemIndex">
|
||||
<vn-thead>
|
||||
<vn-tr>
|
||||
<vn-th th-id="picture" shrink></vn-th>
|
||||
|
|
Loading…
Reference in New Issue