Added filters
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
0fe78a2b8f
commit
90ae1562dd
|
@ -1,5 +1,5 @@
|
|||
<section vn-id="contextmenu" style="position: absolute">
|
||||
<vn-menu vn-id="menu">
|
||||
<vn-list ng-transclude="menu"></vn-list>
|
||||
<div ng-transclude="menu"></div>
|
||||
</vn-menu>
|
||||
</section>
|
||||
|
|
|
@ -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('<vn-list></vn-list>');
|
||||
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'
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<vn-item
|
||||
ng-click="consumerReportDialog.show()"
|
||||
translate>
|
||||
Send consumer report
|
||||
View consumer report
|
||||
</vn-item>
|
||||
</slot-menu>
|
||||
<slot-body>
|
||||
|
|
|
@ -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
|
|
@ -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', {
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
<div ng-transclude="btnTwo">
|
||||
<vn-quick-link
|
||||
tooltip="Invoice ticket list"
|
||||
state="['ticket.card.summary', {id: $ctrl.invoiceOut.ref}]"
|
||||
state="['ticket.index', {q: $ctrl.filter}]"
|
||||
icon="icon-ticket">
|
||||
</vn-quick-link>
|
||||
</div>
|
||||
|
|
|
@ -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: [
|
||||
|
|
|
@ -122,13 +122,4 @@
|
|||
<vn-item-summary
|
||||
item="$ctrl.itemSelected">
|
||||
</vn-item-summary>
|
||||
</vn-popup>
|
||||
<vn-contextmenu target="vn-data-viewer">
|
||||
<slot-menu>
|
||||
<vn-item ng-click="$ctrl.filterBySelection()">Filter by selection</vn-item>
|
||||
<vn-item>Exclude selection</vn-item>
|
||||
<vn-item>Remove filter by selection</vn-item>
|
||||
<vn-item>Order DESC</vn-item>
|
||||
<vn-item>Order ASC</vn-item>
|
||||
</slot-menu>
|
||||
</vn-contextmenu>
|
||||
</vn-popup>
|
|
@ -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,
|
||||
|
|
|
@ -15,13 +15,13 @@
|
|||
</vn-th>
|
||||
<vn-th></vn-th>
|
||||
<vn-th field="id" number>Id</vn-th>
|
||||
<vn-th field="salesPerson" class="expendable">Salesperson</vn-th>
|
||||
<vn-th field="salesPersonFk" class="expendable">Salesperson</vn-th>
|
||||
<vn-th field="shipped">Date</vn-th>
|
||||
<vn-th>Hour</vn-th>
|
||||
<vn-th field="nickname">Alias</vn-th>
|
||||
<vn-th field="province" class="expendable">Province</vn-th>
|
||||
<vn-th field="state" >State</vn-th>
|
||||
<vn-th field="agencyMode">Agency</vn-th>
|
||||
<vn-th field="provinceFk" class="expendable">Province</vn-th>
|
||||
<vn-th field="stateFk" >State</vn-th>
|
||||
<vn-th field="agencyModeFk">Agency</vn-th>
|
||||
<vn-th field="warehouse">Warehouse</vn-th>
|
||||
<vn-th field="refFk" class="expendable">Invoice</vn-th>
|
||||
<vn-th field="zoneHour" shrink>Closure</vn-th>
|
||||
|
@ -30,7 +30,7 @@
|
|||
</vn-tr>
|
||||
</vn-thead>
|
||||
<vn-tbody>
|
||||
<a ng-repeat="ticket in model.data"
|
||||
<a ng-repeat="ticket in model.data" data-index="{{$index}}"
|
||||
class="clickable vn-tr search-result"
|
||||
ui-sref="ticket.card.summary({id: {{::ticket.id}}})">
|
||||
<vn-td shrink>
|
||||
|
@ -151,3 +151,17 @@
|
|||
<vn-client-balance-create
|
||||
vn-id="balanceCreateDialog">
|
||||
</vn-client-balance-create>
|
||||
<vn-contextmenu vn-id="contextmenu" targets="['vn-data-viewer']" model="model">
|
||||
<slot-menu>
|
||||
<vn-item ng-click="$ctrl.filterBySelection({event: $parent.$ctrl.$eventTarget})" translate>Filter by selection</vn-item>
|
||||
<vn-item ng-click="$ctrl.excludeSelection($event, $parent.$ctrl.eventTarget)" translate>Exclude selection</vn-item>
|
||||
<vn-item ng-click="$ctrl.removeFilter()" translate>Remove filter</vn-item>
|
||||
|
||||
<vn-item ng-click="contextmenu.filterBySelection()" translate style="color:green">Filter by selection 2</vn-item>
|
||||
<vn-item ng-click="contextmenu.excludeSelection()" translate style="color:green">Exclude selection 2</vn-item>
|
||||
<vn-item ng-click="contextmenu.removeFilter()" translate style="color:green">Remove filter 2</vn-item>
|
||||
<!-- <p>Quicklinks</p>
|
||||
<vn-item>Order DESC</vn-item>
|
||||
<vn-item>Order ASC</vn-item> -->
|
||||
</slot-menu>
|
||||
</vn-contextmenu>
|
|
@ -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', {
|
||||
|
|
|
@ -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
|
||||
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
|
Loading…
Reference in New Issue