Added vn-anchor to client and ticket index
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
cf8ed6f8d3
commit
011bba1660
|
@ -20,25 +20,25 @@ export function directive($state, $window) {
|
|||
ctrlPressed = false;
|
||||
});
|
||||
|
||||
function changeState(event, state) {
|
||||
const params = stringifyParams(state);
|
||||
$state.go(state.url, params);
|
||||
function changeState(event, data) {
|
||||
const params = stringifyParams(data);
|
||||
$state.go(data.state, params);
|
||||
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
function newTab(event, state) {
|
||||
const params = stringifyParams(state);
|
||||
const url = $state.href(state.url, params);
|
||||
$window.open(url);
|
||||
function newTab(event, data) {
|
||||
const params = stringifyParams(data);
|
||||
const href = $state.href(data.state, params);
|
||||
$window.open(href);
|
||||
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
function stringifyParams(state) {
|
||||
const params = Object.assign({}, state.params);
|
||||
function stringifyParams(data) {
|
||||
const params = Object.assign({}, data.params);
|
||||
for (let param in params)
|
||||
params[param] = JSON.stringify(params[param]);
|
||||
|
||||
|
@ -48,17 +48,17 @@ export function directive($state, $window) {
|
|||
return {
|
||||
restrict: 'A',
|
||||
link: function($scope, $element, $attrs) {
|
||||
const state = $scope.$eval($attrs.vnAnchor);
|
||||
const data = $scope.$eval($attrs.vnAnchor);
|
||||
$element.on('click', event => {
|
||||
if (ctrlPressed)
|
||||
newTab(event, state);
|
||||
newTab(event, data);
|
||||
else
|
||||
changeState(event, state);
|
||||
changeState(event, data);
|
||||
});
|
||||
|
||||
$element.on('mousedown', event => {
|
||||
if (event.button == 1)
|
||||
newTab(event, state);
|
||||
newTab(event, data);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
Simple ticket: Ticket simple
|
||||
View consumer report: Ver informe de consumo
|
||||
From date: Fecha desde
|
||||
To date: Fecha hasta
|
||||
To date: Fecha hasta
|
||||
Go to user: Ir al usuario
|
|
@ -40,7 +40,7 @@
|
|||
vn-tooltip="Client frozen"
|
||||
icon="icon-frozen">
|
||||
</vn-icon-button>
|
||||
<vn-icon-button vn-anchor="{url: 'ticket.index', params: {q: {clientFk: client.id}}}"
|
||||
<vn-icon-button vn-anchor="{state: 'ticket.index', params: {q: {clientFk: client.id}}}"
|
||||
vn-tooltip="Client tickets"
|
||||
icon="icon-ticket">
|
||||
</vn-icon-button>
|
||||
|
|
|
@ -119,7 +119,7 @@
|
|||
</vn-td>
|
||||
<vn-td actions>
|
||||
<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"
|
||||
icon="icon-lines">
|
||||
</vn-icon-button>
|
||||
|
|
|
@ -114,11 +114,6 @@ export default class Controller extends Section {
|
|||
return 'warning';
|
||||
}
|
||||
|
||||
goToLines(ticketFk) {
|
||||
let url = this.$state.href('ticket.card.sale', {id: ticketFk}, {absolute: true});
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
|
||||
preview(ticket) {
|
||||
this.selectedTicket = ticket;
|
||||
this.$.summary.show();
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
<vn-item-section side>
|
||||
<vn-icon-button
|
||||
ng-click="$ctrl.goToTimeControl($event, worker.id)"
|
||||
vn-tooltip="Preview"
|
||||
vn-tooltip="Time control"
|
||||
icon="access_time">
|
||||
</vn-icon-button>
|
||||
<vn-icon-button
|
||||
|
|
Loading…
Reference in New Issue