Merge branch 'dev' of http://git.verdnatura.es/salix into dev

This commit is contained in:
Carlos Jimenez 2018-11-14 18:06:04 +01:00
commit 295486c7ad
5 changed files with 126 additions and 96 deletions

View File

@ -19,14 +19,13 @@ class Controller {
},
},
{
relation: 'tracking',
relation: 'state',
scope: {
fields: ['stateFk'],
include: {
relation: 'state',
fields: ['name'],
},
order: 'created DESC'
fields: ['id', 'name'],
}
},
},
],
@ -55,5 +54,5 @@ Controller.$inject = ['$http', '$state'];
ngModule.component('vnTicketCard', {
template: require('./index.html'),
controller: Controller,
controller: Controller
});

View File

@ -274,4 +274,12 @@
question="You are going to delete lines of the ticket"
message="Continue anyway?"
on-response="$ctrl.onRemoveLinesClick(response)">
</vn-confirm>
</vn-confirm>
<vn-float-button
ng-show="$ctrl.isEditable"
ng-click="$ctrl.newOrderFromTicket()"
icon="add"
vn-tooltip="New item"
vn-bind="+"
fixed-bottom-right>
</vn-float-button>

View File

@ -68,7 +68,7 @@ class Controller {
get isEditable() {
try {
return !this.ticket.tracking.state.alertLevel;
return !this.ticket.state.state.alertLevel;
} catch (e) {}
return true;
@ -324,6 +324,13 @@ class Controller {
this.$scope.model.refresh();
});
}
newOrderFromTicket() {
this.$http.post(`/api/Orders/newFromTicket`, {ticketFk: this.ticket.id}).then(res => {
this.$state.go('order.card.catalog', {id: res.data});
this.vnApp.showSuccess(this.$translate.instant('Order created'));
});
}
}
Controller.$inject = ['$scope', '$state', '$http', 'vnApp', '$translate'];

View File

@ -615,6 +615,17 @@ describe('Ticket Edit sale path', () => {
expect(result).toEqual(1);
});
it(`should click on the search result to access to the ticket Sale`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale')
.url();
expect(url).toContain('/sale');
});
});
describe('when state is preparation and loged as salesPerson', () => {

View File

@ -2,98 +2,103 @@
"name": "Ticket",
"base": "VnModel",
"options": {
"mysql": {
"mysql": {
"table": "ticket"
}
}
},
"properties": {
"id": {
"id": true,
"type": "Number",
"description": "Identifier"
},
"shipped": {
"type": "date",
"required": true
},
"landed": {
"type": "date"
},
"nickname": {
"type": "String"
},
"location": {
"type": "String"
},
"solution": {
"type": "String"
},
"packages": {
"type": "Number"
},
"created": {
"type": "date"
},
"isDeleted": {
"type": "boolean"
}
"id": {
"id": true,
"type": "Number",
"description": "Identifier"
},
"shipped": {
"type": "date",
"required": true
},
"landed": {
"type": "date"
},
"nickname": {
"type": "String"
},
"location": {
"type": "String"
},
"solution": {
"type": "String"
},
"packages": {
"type": "Number"
},
"created": {
"type": "date"
},
"isDeleted": {
"type": "boolean"
}
},
"relations": {
"client": {
"type": "belongsTo",
"model": "Client",
"foreignKey": "clientFk"
},
"warehouse": {
"type": "belongsTo",
"model": "Warehouse",
"foreignKey": "warehouseFk"
},
"invoiceOut": {
"type": "belongsTo",
"model": "InvoiceOut",
"foreignKey": "refFk"
},
"address": {
"type": "belongsTo",
"model": "Address",
"foreignKey": "addressFk"
},
"route": {
"type": "belongsTo",
"model": "Route",
"foreignKey": "routeFk"
},
"company": {
"type": "belongsTo",
"model": "Company",
"foreignKey": "companyFk"
},
"agencyMode": {
"type": "belongsTo",
"model": "AgencyMode",
"foreignKey": "agencyModeFk",
"required": true
},
"packages": {
"type": "hasMany",
"model": "TicketPackaging",
"foreignKey": "ticketFk"
},
"tracking": {
"type": "hasOne",
"model": "TicketTracking",
"foreignKey": "ticketFk"
},
"notes": {
"type": "hasMany",
"model": "TicketObservation",
"foreignKey": "ticketFk"
},
"alertLevel": {
"type": "hasOne",
"model": "TicketState",
"foreignKey": "ticketFk"
}
"client": {
"type": "belongsTo",
"model": "Client",
"foreignKey": "clientFk"
},
"warehouse": {
"type": "belongsTo",
"model": "Warehouse",
"foreignKey": "warehouseFk"
},
"invoiceOut": {
"type": "belongsTo",
"model": "InvoiceOut",
"foreignKey": "refFk"
},
"address": {
"type": "belongsTo",
"model": "Address",
"foreignKey": "addressFk"
},
"route": {
"type": "belongsTo",
"model": "Route",
"foreignKey": "routeFk"
},
"company": {
"type": "belongsTo",
"model": "Company",
"foreignKey": "companyFk"
},
"agencyMode": {
"type": "belongsTo",
"model": "AgencyMode",
"foreignKey": "agencyModeFk",
"required": true
},
"packages": {
"type": "hasMany",
"model": "TicketPackaging",
"foreignKey": "ticketFk"
},
"tracking": {
"type": "hasMany",
"model": "TicketTracking",
"foreignKey": "ticketFk"
},
"notes": {
"type": "hasMany",
"model": "TicketObservation",
"foreignKey": "ticketFk"
},
"alertLevel": {
"type": "hasOne",
"model": "TicketState",
"foreignKey": "ticketFk"
},
"state": {
"type": "hasOne",
"model": "TicketState",
"foreignKey": "ticketFk"
}
}
}
}