This commit is contained in:
Bernat 2019-01-16 13:02:39 +01:00
commit 4dda431944
6 changed files with 31 additions and 10 deletions

View File

@ -61,7 +61,7 @@ module.exports = Self => {
], transaction);
}
Self.importToNewRefundTicket = async (ctx, id) => {
Self.importToNewRefundTicket = async(ctx, id) => {
let models = Self.app.models;
let token = ctx.req.accessToken;
let userId = token.userId;

View File

@ -30,9 +30,13 @@ class Controller {
}
getInstance(instance) {
let validDate = /^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(.[0-9]+)?(Z)?$/;
const properties = [];
if (typeof instance == 'object' && instance != null) {
Object.keys(instance).forEach(property => {
if (validDate.test(instance[property]))
instance[property] = new Date(instance[property]).toLocaleString('es-ES');
properties.push({key: property, value: instance[property]});
});
return properties;

View File

@ -44,12 +44,12 @@ module.exports = Self => {
let clientFk = address.clientFk;
let agency;
if (params.agency)
if (params.agencyModeFk)
agency = await Self.app.models.AgencyMode.findById(params.agencyModeFk);
else
agency = {code: null};
if (agency.code != 'refund') {
if (agency.name != 'ABONO') {
let query = `SELECT vn.clientGetDebt(?, CURDATE()) AS debt`;
let clientDebt = await Self.rawSql(query, [clientFk]);

View File

@ -120,8 +120,22 @@ module.exports = Self => {
ticketFk: ticketFk
},
include: [
{relation: 'requester'},
{relation: 'atender'}
{
relation: 'requester',
scope: {
include: {
relation: 'user'
}
}
},
{
relation: 'atender',
scope: {
include: {
relation: 'user'
}
}
}
]
};
return await Self.app.models.TicketRequest.find(filter);

View File

@ -31,8 +31,13 @@ class Controller {
getInstance(instance) {
const properties = [];
let validDate = /^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(.[0-9]+)?(Z)?$/;
if (typeof instance == 'object' && instance != null) {
Object.keys(instance).forEach(property => {
if (validDate.test(instance[property]))
instance[property] = new Date(instance[property]).toLocaleString('es-ES');
properties.push({key: property, value: instance[property]});
});
return properties;

View File

@ -161,7 +161,6 @@
<vn-table model="model">
<vn-thead>
<vn-tr>
<vn-th number>Id</vn-th>
<vn-th>Description</vn-th>
<vn-th number>Created</vn-th>
<vn-th>Requester</vn-th>
@ -174,17 +173,16 @@
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="request in $ctrl.summary.requests">
<vn-td number>{{::request.id}}</vn-td>
<vn-td>{{::request.description}}</vn-td>
<vn-td number>{{::request.created | dateTime: 'dd/MM/yyyy'}}</vn-td>
<vn-td>{{::request.requester.firstName}} {{::request.requester.name}}</vn-td>
<vn-td>{{::request.atender.firstName}} {{::request.atender.name}}</vn-td>
<vn-td>{{::request.requester.user.name}}</vn-td>
<vn-td>{{::request.atender.user.name}}</vn-td>
<vn-td number>{{::request.quantity}}</vn-td>
<vn-td number>{{::request.price}}</vn-td>
<vn-td number>
<span
ng-show="::request.saleFk"
ng-click="$ctrl.showDescriptor($event, request.sale)"
ng-click="$ctrl.showDescriptor($event, request.saleFk)"
pointer class="link">
{{("000000"+request.saleFk).slice(-6)}}
</span>