Merge branch 'dev' of https://git.verdnatura.es/salix into dev
This commit is contained in:
commit
f9c0d0d911
|
@ -65,6 +65,7 @@ describe('Client', () => {
|
|||
it('should define the classificationId property of the controller and then call the show method()', () => {
|
||||
controller.$scope.closeContract = {show: () => {}};
|
||||
spyOn(controller.$scope.closeContract, 'show');
|
||||
|
||||
expect(controller.classificationId).toBeFalsy();
|
||||
controller.closeContract({id: 1});
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ class Controller {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$http'];
|
||||
|
||||
ngModule.component('vnClientDescriptor', {
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
"component": "ui-view"
|
||||
},
|
||||
{
|
||||
"url": "/list?q",
|
||||
"state": "order.list",
|
||||
"component": "vn-order-list"
|
||||
"url": "/index?q",
|
||||
"state": "order.index",
|
||||
"component": "vn-order-index"
|
||||
},
|
||||
{
|
||||
"url": "/create",
|
||||
|
|
|
@ -4,11 +4,9 @@ class Controller {
|
|||
constructor($http, $state) {
|
||||
this.$http = $http;
|
||||
this.$state = $state;
|
||||
|
||||
this.ticket = null;
|
||||
}
|
||||
|
||||
_getTicket() {
|
||||
getTicket() {
|
||||
let filter = {
|
||||
include: [
|
||||
{relation: 'warehouse', scope: {fields: ['name']}},
|
||||
|
@ -16,7 +14,7 @@ class Controller {
|
|||
{
|
||||
relation: 'client',
|
||||
scope: {
|
||||
fields: ['salesPersonFk', 'name'],
|
||||
fields: ['salesPersonFk', 'name', 'isActive', 'isFreezed', 'isTaxDataChecked'],
|
||||
include: {
|
||||
relation: 'salesPerson',
|
||||
fields: ['firstName', 'name']
|
||||
|
@ -35,21 +33,21 @@ class Controller {
|
|||
}
|
||||
]
|
||||
};
|
||||
|
||||
let json = encodeURIComponent(JSON.stringify(filter));
|
||||
this.$http.get(`/ticket/api/Tickets/${this.$state.params.id}?filter=${json}`)
|
||||
.then(res => {
|
||||
let query = `/ticket/api/Tickets/${this.$state.params.id}?filter=${json}`;
|
||||
this.$http.get(query).then(res => {
|
||||
if (res.data)
|
||||
this.ticket = res.data;
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
$onInit() {
|
||||
this._getTicket();
|
||||
this.getTicket();
|
||||
}
|
||||
|
||||
reload() {
|
||||
this._getTicket();
|
||||
this.getTicket();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,4 +35,26 @@
|
|||
value="{{$ctrl.ticket.nickname}}">
|
||||
</vn-label-value>
|
||||
</div>
|
||||
<vn-horizontal pad-medium-bottom class="footer">
|
||||
<vn-icon vn-one
|
||||
vn-tooltip="Client inactive"
|
||||
icon="icon-disabled"
|
||||
ng-class="{bright: $ctrl.ticket.client.isActive == false}">
|
||||
</vn-icon>
|
||||
<vn-icon vn-one
|
||||
vn-tooltip="Client Frozen"
|
||||
icon="icon-frozen"
|
||||
ng-class="{bright: $ctrl.ticket.client.isFreezed == true}">
|
||||
</vn-icon>
|
||||
<vn-icon vn-one
|
||||
vn-tooltip="Client has debt"
|
||||
icon="icon-risk"
|
||||
ng-class="{bright: $ctrl.clientDebt > 0}">
|
||||
</vn-icon>
|
||||
<vn-icon vn-one
|
||||
vn-tooltip="Client not checked"
|
||||
icon="icon-no036"
|
||||
ng-class="{bright: $ctrl.ticket.client.isTaxDataChecked == false}">
|
||||
</vn-icon>
|
||||
</vn-horizontal>
|
||||
</vn-card>
|
||||
|
|
|
@ -1,8 +1,29 @@
|
|||
import ngModule from '../module';
|
||||
|
||||
class Controller {
|
||||
|
||||
constructor($http) {
|
||||
this.$http = $http;
|
||||
}
|
||||
|
||||
getClientDebt(clientFk) {
|
||||
this.$http.get(`/client/api/Clients/${clientFk}/getDebt`).then(response => {
|
||||
this.clientDebt = response.data.debt;
|
||||
});
|
||||
}
|
||||
|
||||
$onChanges() {
|
||||
if (this.ticket)
|
||||
this.getClientDebt(this.ticket.clientFk);
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$http'];
|
||||
|
||||
ngModule.component('vnTicketDescriptor', {
|
||||
template: require('./index.html'),
|
||||
bindings: {
|
||||
ticket: '<'
|
||||
}
|
||||
},
|
||||
controller: Controller
|
||||
});
|
||||
|
|
|
@ -31,7 +31,7 @@ module.exports = Self => {
|
|||
}
|
||||
});
|
||||
|
||||
Self.send = async (recipient, data, ctx) => {
|
||||
Self.send = async(recipient, data, ctx) => {
|
||||
let query = `SELECT vn.messageSendWithUser(?, ?, ?) AS sent`;
|
||||
let [result] = await Self.rawSql(query, [ctx.req.accessToken.userId, recipient, data.message]);
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ module.exports = Self => {
|
|||
}
|
||||
});
|
||||
|
||||
Self.priceDifference = async (ticketFk, data) => {
|
||||
Self.priceDifference = async(ticketFk, data) => {
|
||||
let filter = {
|
||||
where: {
|
||||
ticketFk: ticketFk
|
||||
|
|
Loading…
Reference in New Issue