#952 Ticket.descriptor eliminar polizon

This commit is contained in:
Gerard 2019-01-18 13:37:26 +01:00
parent 345acc1353
commit 97b2c23179
4 changed files with 164 additions and 0 deletions

View File

@ -0,0 +1,9 @@
Ship: Barco
Stowaway: Polizón
Cliente: Client
Ship stowaways: Polizones del barco
Stowaways to add: Polizones a añadir
Stowaways of the ticket: Polizones del ticket
Add stowaway: Añadir polizón
Remove stowaway: Borrar polizón
Are you sure you want to delete this stowaway?: ¿Estas seguro de que quieres borrar este polizón?

View File

@ -0,0 +1,41 @@
<vn-dialog
class="modalForm"
vn-id="dialog">
<tpl-body>
<vn-horizontal pad-medium class="header">
<h5><span translate>Stowaways of the ticket</span> {{$ctrl.ticket.id}}</h5>
</vn-horizontal>
<vn-horizontal pad-medium>
<vn-table>
<vn-thead>
<vn-tr>
<vn-th number>Ticket id</vn-th>
<vn-th number>Shipped</vn-th>
<vn-th number>Agency</vn-th>
<vn-th number>Warehouse</vn-th>
<vn-th number>State</vn-th>
</vn-tr>
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="stowaway in $ctrl.ticketStowaways" class="clickable" ng-click="$ctrl.showDeleteConfirm($index)">
<vn-td number>{{stowaway.id}}</vn-td>
<vn-td number>{{stowaway.ticket.landed | dateTime: 'dd/MM/yyyy'}}</vn-td>
<vn-td number>{{stowaway.ticket.agencyMode.name}}</vn-td>
<vn-td number>{{stowaway.ticket.warehouse.name}}</vn-td>
<vn-td number>{{stowaway.ticket.state.state.name}}</vn-td>
</vn-tr>
</vn-tbody>
<vn-empty-rows ng-if="$ctrl.ticketStowaways.length === 0" translate>
No results
</vn-empty-rows>
</vn-table>
</vn-horizontal>
</tpl-body>
</vn-dialog>
<vn-confirm
vn-id="confirmation-dialog"
on-response="$ctrl.deleteStowaway(response)"
question="Delete stowaway"
message="Are you sure you want to delete this stowaway?">
</vn-confirm>

View File

@ -0,0 +1,78 @@
import ngModule from '../module';
class Controller {
constructor($state, $scope, $http) {
this.$scope = $scope;
this.$state = $state;
this.$http = $http;
}
getTicketStowaways() {
if (this.ticket.stowaway) {
this.ticketStowaways = [this.ticket.stowaway];
this.showDeleteConfirm(0);
} else if (this.ticket.ship.length > 1) {
let filter = {
where: {shipFk: this.ticket.id},
include: {
relation: 'ticket',
scope: {
include: [
{relation: 'agencyMode'},
{relation: 'warehouse'},
{relation: 'state',
scope: {
fields: ['stateFk'],
include: {
relation: 'state'
}
},
},
]
}
}
};
let json = encodeURIComponent(JSON.stringify(filter));
this.$http.get(`/api/Stowaways?filter=${json}`).then(res => {
console.log(res.data);
this.ticketStowaways = res.data;
this.$scope.dialog.show();
});
}
}
deleteStowaway(response) {
if (response === 'ACCEPT') {
this.$http.delete(`/api/Stowaways/${this.stowawayToDelete.id}`).then(res => {
this.card.reload();
});
}
}
showDeleteConfirm(index) {
this.stowawayToDelete = this.ticketStowaways[index];
this.$scope.confirmationDialog.show();
}
show() {
this.getTicketStowaways();
}
hide() {
this.$scope.dialog.hide();
}
}
Controller.$inject = ['$state', '$scope', '$http', 'vnApp', '$translate'];
ngModule.component('vnRemoveStowaway', {
template: require('./removeStowaway.html'),
controller: Controller,
bindings: {
ticket: '<'
},
require: {
card: '^vnTicketCard'
}
});

View File

@ -0,0 +1,36 @@
@import 'colors';
vn-dialog.modalForm {
vn-horizontal.header{
background-color: $main-01;
h5{
color: white;
margin: 0 auto;
}
}
tpl-body {
width: 100%;
}
table {
width: 100%
}
&>div{
padding: 0!important;
}
vn-textfield {
width: 100%;
}
.buttons{
margin-top: 0!important;
}
p{
display: none;
}
button.close > vn-icon{
color: white!important;
}
vn-ticket-sale-edit-discount > div {
padding-bottom: 0!important;
}
}