refs #5070 @2h refactor goToBuscaman method
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Pau 2023-01-30 12:33:28 +01:00
parent ce1bdaec17
commit 6709012e59
2 changed files with 13 additions and 3 deletions

View File

@ -91,7 +91,14 @@
</vn-input-number>
</vn-td>
<vn-td expand title="{{::ticket.street}}">{{::ticket.street}}</vn-td>
<vn-td expand>{{::ticket.city}}</vn-td>
<vn-td
expand
ng-click="$ctrl.goToBuscaman(ticket)"
class="link"
vn-tooltip="Open buscaman"
tooltip-position="up">
{{::ticket.city}}
</vn-td>
<vn-td shrink>{{::ticket.postalCode}}</vn-td>
<vn-td expand>
<span

View File

@ -74,7 +74,7 @@ class Controller extends Section {
return selectedItems;
}
goToBuscaman() {
goToBuscaman(clickedLine) {
if (!this.route.vehicleFk)
throw new UserError(`The route doesn't have a vehicle`);
let query = `Routes/${this.route.vehicleFk}/getDeliveryPoint`;
@ -88,6 +88,7 @@ class Controller extends Section {
let addresses;
if (address) addresses = address;
let lines = this.getSelectedItems(this.tickets);
if (clickedLine) lines = [clickedLine];
let url = 'http://gps.buscalia.com/usuario/localizar.aspx?bmi=true&addr=';
lines.forEach((line, index) => {
@ -96,7 +97,9 @@ class Controller extends Section {
addresses = addresses + '+to:' + line.postalCode + ' ' + line.city + ' ' + line.street;
});
window.open(url + addresses, '_blank');
if (clickedLine) addresses = addresses.replace(address + '+to:', '',);
window.open(url + encodeURI(addresses), '_blank');
});
}