Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 2433-sage_fiscalData
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
1b4015a4dc
|
@ -0,0 +1,70 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
|
||||||
|
export function stringifyParams(data) {
|
||||||
|
const params = Object.assign({}, data.params);
|
||||||
|
for (let param in params)
|
||||||
|
params[param] = JSON.stringify(params[param]);
|
||||||
|
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function changeState($state, event, data) {
|
||||||
|
const params = stringifyParams(data);
|
||||||
|
$state.go(data.state, params);
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function openNewTab($state, $window, event, data) {
|
||||||
|
const params = stringifyParams(data);
|
||||||
|
const href = $state.href(data.state, params);
|
||||||
|
$window.open(href);
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows changing state for nested anchor
|
||||||
|
*
|
||||||
|
* @param {Object} $state
|
||||||
|
* @param {Object} $window
|
||||||
|
* @return {Object} The directive
|
||||||
|
*/
|
||||||
|
export function directive($state, $window) {
|
||||||
|
let ctrlPressed = false;
|
||||||
|
|
||||||
|
$window.addEventListener('keydown', event => {
|
||||||
|
if (event.key == 'Control')
|
||||||
|
ctrlPressed = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
$window.addEventListener('keyup', event => {
|
||||||
|
if (event.key == 'Control')
|
||||||
|
ctrlPressed = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
restrict: 'A',
|
||||||
|
link: function($scope, $element, $attrs) {
|
||||||
|
const data = $scope.$eval($attrs.vnAnchor);
|
||||||
|
$element.on('click', event => {
|
||||||
|
if (ctrlPressed)
|
||||||
|
openNewTab($state, $window, event, data);
|
||||||
|
else
|
||||||
|
changeState($state, event, data);
|
||||||
|
});
|
||||||
|
|
||||||
|
$element.on('mousedown', event => {
|
||||||
|
const mouseWheel = 1;
|
||||||
|
if (event.button == mouseWheel)
|
||||||
|
openNewTab($state, $window, event, data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
directive.$inject = ['$state', '$window'];
|
||||||
|
|
||||||
|
ngModule.directive('vnAnchor', directive);
|
|
@ -15,3 +15,4 @@ import './smart-table';
|
||||||
import './droppable';
|
import './droppable';
|
||||||
import './http-click';
|
import './http-click';
|
||||||
import './http-submit';
|
import './http-submit';
|
||||||
|
import './anchor';
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
Simple ticket: Ticket simple
|
Simple ticket: Ticket simple
|
||||||
View consumer report: Ver informe de consumo
|
View consumer report: Ver informe de consumo
|
||||||
From date: Fecha desde
|
From date: Fecha desde
|
||||||
To date: Fecha hasta
|
To date: Fecha hasta
|
||||||
|
Go to user: Ir al usuario
|
|
@ -40,8 +40,7 @@
|
||||||
vn-tooltip="Client frozen"
|
vn-tooltip="Client frozen"
|
||||||
icon="icon-frozen">
|
icon="icon-frozen">
|
||||||
</vn-icon-button>
|
</vn-icon-button>
|
||||||
<vn-icon-button
|
<vn-icon-button vn-anchor="{state: 'ticket.index', params: {q: {clientFk: client.id}}}"
|
||||||
ng-click="$ctrl.filterTickets(client, $event)"
|
|
||||||
vn-tooltip="Client tickets"
|
vn-tooltip="Client tickets"
|
||||||
icon="icon-ticket">
|
icon="icon-ticket">
|
||||||
</vn-icon-button>
|
</vn-icon-button>
|
||||||
|
|
|
@ -119,7 +119,7 @@
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td actions>
|
<vn-td actions>
|
||||||
<vn-icon-button
|
<vn-icon-button
|
||||||
vn-click-stop="$ctrl.goToLines(ticket.id)"
|
vn-anchor="{state: 'ticket.card.sale', params: {id: ticket.id}}"
|
||||||
vn-tooltip="Go to lines"
|
vn-tooltip="Go to lines"
|
||||||
icon="icon-lines">
|
icon="icon-lines">
|
||||||
</vn-icon-button>
|
</vn-icon-button>
|
||||||
|
|
|
@ -114,11 +114,6 @@ export default class Controller extends Section {
|
||||||
return 'warning';
|
return 'warning';
|
||||||
}
|
}
|
||||||
|
|
||||||
goToLines(ticketFk) {
|
|
||||||
let url = this.$state.href('ticket.card.sale', {id: ticketFk}, {absolute: true});
|
|
||||||
window.open(url, '_blank');
|
|
||||||
}
|
|
||||||
|
|
||||||
preview(ticket) {
|
preview(ticket) {
|
||||||
this.selectedTicket = ticket;
|
this.selectedTicket = ticket;
|
||||||
this.$.summary.show();
|
this.$.summary.show();
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
<vn-item-section side>
|
<vn-item-section side>
|
||||||
<vn-icon-button
|
<vn-icon-button
|
||||||
ng-click="$ctrl.goToTimeControl($event, worker.id)"
|
ng-click="$ctrl.goToTimeControl($event, worker.id)"
|
||||||
vn-tooltip="Preview"
|
vn-tooltip="Time control"
|
||||||
icon="access_time">
|
icon="access_time">
|
||||||
</vn-icon-button>
|
</vn-icon-button>
|
||||||
<vn-icon-button
|
<vn-icon-button
|
||||||
|
|
Loading…
Reference in New Issue