diff --git a/front/core/components/contextmenu/index.html b/front/core/components/contextmenu/index.html
index 0028c1186..7e7cae138 100644
--- a/front/core/components/contextmenu/index.html
+++ b/front/core/components/contextmenu/index.html
@@ -1,5 +1,5 @@
diff --git a/front/core/components/contextmenu/index.js b/front/core/components/contextmenu/index.js
index 9bd1c0d24..a99009d50 100755
--- a/front/core/components/contextmenu/index.js
+++ b/front/core/components/contextmenu/index.js
@@ -1,10 +1,10 @@
import ngModule from '../../module';
export default class Contextmenu {
- constructor($element, $, $window) {
+ constructor($element, $, $transclude) {
this.$element = $element;
this.element = $element[0];
this.$ = $;
- this.$window = $window;
+ this.$transclude = $transclude;
// this.displayMode = 'relative';
// Foreach element, apply an addEventListener???
@@ -27,40 +27,140 @@ export default class Contextmenu {
}); */
}
- get target() {
- return this._target;
+ $onInit() {
+ /* const transcludeElement = this.element.querySelector('vn-menu');
+ const content = angular.element(transcludeElement);
+
+ this.$transclude(($clone, $scope) => {
+ this.$contentScope = $scope;
+ // $scope.$target = 'hola??';
+ const list = angular.element('');
+ list.append($clone);
+
+ content.append(list);
+ }, null, 'menu'); */
}
- set target(value) {
- this._target = value;
+ get targets() {
+ return this._targets;
+ }
+
+ set targets(value) {
+ this._targets = value;
if (!value) return;
- const target = document.querySelector(value);// Find elements
- console.log(this.element);
+ for (let selector of value) {
+ const target = document.querySelector(selector);// Find elements
+ if (!target) continue;
- if (!target) return;
+ target.addEventListener('contextmenu', event => {
+ if (!event.defaultPrevented)
+ event.preventDefault();
- target.addEventListener('contextmenu', event => {
- if (!event.defaultPrevented)
- event.preventDefault();
+ const parent = this.$.contextmenu;
+ parent.style.top = event.pageY + 'px';
+ parent.style.left = event.pageX + 'px';
- const parent = this.$.contextmenu;
- parent.style.top = event.pageY + 'px';
- parent.style.left = event.pageX + 'px';
+ this.eventTarget = event.target;
- this.$.menu.show(parent);
- });
+ /* const menu = this.element.querySelector('vn-menu');
+ const list = document.createElement('vn-list');
+ menu.append(list);
+
+ const transcludeElement = this.element.querySelector('vn-list');
+ const content = angular.element(transcludeElement);
+ console.log(transcludeElement);
+
+ this.$transclude(($clone, $scope) => {
+ this.$contentScope = $scope;
+ $scope.$target = 'hola??';
+ console.log($clone);
+ content.append($clone);
+ }, null, 'menu'); */
+
+ this.$.menu.show(parent);
+ });
+ }
+ }
+
+ /* const transcludeElement = this.element.querySelector('vn-list');
+ const content = angular.element(transcludeElement);
+ console.log(transcludeElement);
+
+ this.$transclude(($clone, $scope) => {
+ this.$contentScope = $scope;
+ $scope.$target = 'hola??';
+ content.append($clone);
+ }); */
+
+ filterBySelection() {
+ // const target = $event.target;
+ const model = this.model;
+ const target = this.eventTarget;
+ console.log(target);
+
+ const table = target.closest('.vn-table');
+ const headerCols = table.querySelectorAll('vn-thead vn-th');
+
+ const row = target.closest('.vn-tr');
+ const col = target.closest('vn-td');
+
+ const rowIndex = row.getAttribute('data-index');
+
+ const columns = Array.from(row.querySelectorAll('vn-td'));
+
+ const fieldIndex = columns.findIndex(column => column == col);
+ const fieldName = headerCols[fieldIndex].getAttribute('field');
+
+ const rowData = model.data[rowIndex];
+
+ const filter = {where: {}};
+ filter['where'][fieldName] = rowData[fieldName];
+ console.log(filter);
+
+ model.addFilter(filter);
+ }
+
+ excludeSelection() {
+ const model = this.model;
+ const target = this.eventTarget;
+
+ const table = target.closest('.vn-table');
+ const headerCols = table.querySelectorAll('vn-thead vn-th');
+
+ const row = target.closest('.vn-tr');
+ const col = target.closest('vn-td');
+
+ const rowIndex = row.getAttribute('data-index');
+
+ const columns = Array.from(row.querySelectorAll('vn-td'));
+
+ const fieldIndex = columns.findIndex(column => column == col);
+ const fieldName = headerCols[fieldIndex].getAttribute('field');
+
+ const rowData = model.data[rowIndex];
+
+ const filter = {where: {}};
+ filter['where'][fieldName] = {neq: rowData[fieldName]};
+ console.log(filter);
+
+ model.addFilter(filter);
+ }
+
+ removeFilter() {
+ this.model.removeFilter();
}
}
-Contextmenu.$inject = ['$element', '$scope', '$window'];
+Contextmenu.$inject = ['$element', '$scope', '$transclude'];
ngModule.vnComponent('vnContextmenu', {
controller: Contextmenu,
template: require('./index.html'),
bindings: {
- target: '@?'
+ targets: '',
+ model: ''
},
transclude: {
menu: '?slotMenu'
diff --git a/modules/client/front/descriptor/index.html b/modules/client/front/descriptor/index.html
index 44563aed6..19fcba128 100644
--- a/modules/client/front/descriptor/index.html
+++ b/modules/client/front/descriptor/index.html
@@ -16,7 +16,7 @@
- Send consumer report
+ View consumer report
diff --git a/modules/client/front/descriptor/locale/es.yml b/modules/client/front/descriptor/locale/es.yml
index 88720ab44..3f59aede8 100644
--- a/modules/client/front/descriptor/locale/es.yml
+++ b/modules/client/front/descriptor/locale/es.yml
@@ -1,4 +1,4 @@
Simple ticket: Ticket simple
-Send consumer report: Enviar informe de consumo
+View consumer report: Ver informe de consumo
From date: Fecha desde
To date: Fecha hasta
\ No newline at end of file
diff --git a/modules/client/front/index/index.js b/modules/client/front/index/index.js
index 4832391ce..f5400e05a 100644
--- a/modules/client/front/index/index.js
+++ b/modules/client/front/index/index.js
@@ -19,10 +19,6 @@ export default class Controller extends Section {
this.$state.go(`ticket.index`,
{q: JSON.stringify({clientFk: client.id})});
}
-
- filterBySelection() {
- console.log('Filtro por seleccion');
- }
}
ngModule.component('vnClientIndex', {
diff --git a/modules/invoiceOut/front/descriptor/index.html b/modules/invoiceOut/front/descriptor/index.html
index 9baebb636..093d9edf7 100644
--- a/modules/invoiceOut/front/descriptor/index.html
+++ b/modules/invoiceOut/front/descriptor/index.html
@@ -56,7 +56,7 @@
diff --git a/modules/invoiceOut/front/descriptor/index.js b/modules/invoiceOut/front/descriptor/index.js
index f642c3ba7..cb4b131ac 100644
--- a/modules/invoiceOut/front/descriptor/index.js
+++ b/modules/invoiceOut/front/descriptor/index.js
@@ -22,6 +22,13 @@ class Controller extends Descriptor {
.then(() => this.vnApp.showSuccess(this.$t('InvoiceOut booked')));
}
+ get filter() {
+ if (this.invoiceOut)
+ return JSON.stringify({refFk: this.invoiceOut.ref});
+
+ return null;
+ }
+
loadData() {
const filter = {
include: [
diff --git a/modules/item/front/index/index.html b/modules/item/front/index/index.html
index 6470f4640..0ee6a8815 100644
--- a/modules/item/front/index/index.html
+++ b/modules/item/front/index/index.html
@@ -122,13 +122,4 @@
-
-
-
- Filter by selection
- Exclude selection
- Remove filter by selection
- Order DESC
- Order ASC
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/modules/ticket/back/methods/ticket/filter.js b/modules/ticket/back/methods/ticket/filter.js
index cedbe8f3b..a81f3794a 100644
--- a/modules/ticket/back/methods/ticket/filter.js
+++ b/modules/ticket/back/methods/ticket/filter.js
@@ -199,9 +199,11 @@ module.exports = Self => {
t.routeFk,
t.warehouseFk,
t.clientFk,
+ a.provinceFk,
p.name AS province,
w.name AS warehouse,
am.name AS agencyMode,
+ am.id AS agencyModeFk,
st.name AS state,
wk.lastName AS salesPerson,
ts.stateFk as stateFk,
diff --git a/modules/ticket/front/index/index.html b/modules/ticket/front/index/index.html
index ab2501a13..150dcde8f 100644
--- a/modules/ticket/front/index/index.html
+++ b/modules/ticket/front/index/index.html
@@ -15,13 +15,13 @@
Id
- Salesperson
+ Salesperson
Date
Hour
Alias
- Province
- State
- Agency
+ Province
+ State
+ Agency
Warehouse
Invoice
Closure
@@ -30,7 +30,7 @@
-
@@ -151,3 +151,17 @@
+
+
+ Filter by selection
+ Exclude selection
+ Remove filter
+
+ Filter by selection 2
+ Exclude selection 2
+ Remove filter 2
+
+
+
\ No newline at end of file
diff --git a/modules/ticket/front/index/index.js b/modules/ticket/front/index/index.js
index 59e5d949d..bb56f9cbf 100644
--- a/modules/ticket/front/index/index.js
+++ b/modules/ticket/front/index/index.js
@@ -92,6 +92,61 @@ export default class Controller extends Section {
this.selectedTicket = ticket;
this.$.summary.show();
}
+
+ filterBySelection(target) {
+ // const target = $event.target;
+ const model = this.$.model;
+ console.log(target);
+ const table = target.closest('.vn-table');
+ const headerCols = table.querySelectorAll('vn-thead vn-th');
+
+ const row = target.closest('.vn-tr');
+ const col = target.closest('vn-td');
+
+ const rowIndex = row.getAttribute('data-index');
+
+ const columns = Array.from(row.querySelectorAll('vn-td'));
+
+ const fieldIndex = columns.findIndex(column => column == col);
+ const fieldName = headerCols[fieldIndex].getAttribute('field');
+
+ const rowData = model.data[rowIndex];
+
+ const filter = {where: {}};
+ filter['where'][fieldName] = rowData[fieldName];
+ console.log(filter);
+
+ model.addFilter(filter);
+ }
+
+ excludeSelection($event, target) {
+ const model = this.$.model;
+
+ const table = target.closest('.vn-table');
+ const headerCols = table.querySelectorAll('vn-thead vn-th');
+
+ const row = target.closest('.vn-tr');
+ const col = target.closest('vn-td');
+
+ const rowIndex = row.getAttribute('data-index');
+
+ const columns = Array.from(row.querySelectorAll('vn-td'));
+
+ const fieldIndex = columns.findIndex(column => column == col);
+ const fieldName = headerCols[fieldIndex].getAttribute('field');
+
+ const rowData = model.data[rowIndex];
+
+ const filter = {where: {}};
+ filter['where'][fieldName] = {neq: rowData[fieldName]};
+ console.log(filter);
+
+ model.addFilter(filter);
+ }
+
+ removeFilter() {
+ this.$.model.removeFilter();
+ }
}
ngModule.component('vnTicketIndex', {
diff --git a/modules/ticket/front/index/locale/es.yml b/modules/ticket/front/index/locale/es.yml
index dea55b199..acc8adc80 100644
--- a/modules/ticket/front/index/locale/es.yml
+++ b/modules/ticket/front/index/locale/es.yml
@@ -3,4 +3,7 @@ Go to lines: Ir a lineas
Not available: No disponible
Payment on account...: Pago a cuenta...
Closure: Cierre
-You cannot make a payment on account from multiple clients: No puedes realizar un pago a cuenta de clientes diferentes
\ No newline at end of file
+You cannot make a payment on account from multiple clients: No puedes realizar un pago a cuenta de clientes diferentes
+Filter by selection: Filtro por selección
+Exclude selection: Excluir selección
+Remove filter: Eliminar filtro
\ No newline at end of file