Merge branch 'dev' into 2430-catalog_multi_tag
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
b6499370e1
|
@ -51,15 +51,9 @@ module.exports = Self => {
|
|||
scope: {
|
||||
fields: ['salesPersonFk', 'name'],
|
||||
include: {
|
||||
relation: 'salesPerson',
|
||||
relation: 'salesPersonUser',
|
||||
scope: {
|
||||
fields: ['userFk'],
|
||||
include: {
|
||||
relation: 'user',
|
||||
scope: {
|
||||
fields: ['nickname']
|
||||
}
|
||||
}
|
||||
fields: ['id', 'name']
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ module.exports = Self => {
|
|||
if (addressId)
|
||||
address = await models.Address.findById(addressId, null, options);
|
||||
|
||||
const salesPerson = sale.ticket().client().salesPerson();
|
||||
const salesPerson = sale.ticket().client().salesPersonUser();
|
||||
if (salesPerson) {
|
||||
const nickname = address && address.nickname || destination.description;
|
||||
const origin = ctx.req.headers.origin;
|
||||
|
@ -113,7 +113,10 @@ module.exports = Self => {
|
|||
relation: 'client',
|
||||
scope: {
|
||||
include: {
|
||||
relation: 'salesPerson'
|
||||
relation: 'salesPersonUser',
|
||||
scope: {
|
||||
fields: ['id', 'name']
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
</vn-label-value>
|
||||
<vn-label-value
|
||||
label="Salesperson"
|
||||
value="{{$ctrl.summary.claim.client.salesPerson.user.nickname}}">
|
||||
value="{{$ctrl.summary.claim.client.salesPersonUser.name}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value
|
||||
label="Attended by"
|
||||
|
|
|
@ -46,7 +46,6 @@ module.exports = function(Self) {
|
|||
isEqualizated: data.isEqualizated
|
||||
}, options);
|
||||
|
||||
|
||||
let address = await Address.create({
|
||||
clientFk: client.id,
|
||||
nickname: client.name,
|
||||
|
|
|
@ -25,17 +25,6 @@ module.exports = function(Self) {
|
|||
},
|
||||
include: [
|
||||
{
|
||||
relation: 'salesPerson',
|
||||
scope: {
|
||||
fields: ['userFk', 'firstName'],
|
||||
include: {
|
||||
relation: 'user',
|
||||
scope: {
|
||||
fields: ['name', 'nickname']
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
relation: 'contactChannel',
|
||||
scope: {
|
||||
fields: ['id', 'name']
|
||||
|
|
|
@ -25,17 +25,17 @@ module.exports = Self => {
|
|||
let conn = Self.dataSource.connector;
|
||||
let stmt = new ParameterizedSQL(`
|
||||
SELECT
|
||||
t.id,
|
||||
t.clientFk,
|
||||
t.created,
|
||||
t.amount / 100 amount,
|
||||
t.receiptFk IS NOT NULL AS isConfirmed,
|
||||
tt.message responseMessage,
|
||||
te.message errorMessage
|
||||
FROM hedera.tpvTransaction t
|
||||
JOIN hedera.tpvMerchant m ON m.id = t.merchantFk
|
||||
LEFT JOIN hedera.tpvResponse tt ON tt.id = t.response
|
||||
LEFT JOIN hedera.tpvError te ON te.code = errorCode`);
|
||||
t.id,
|
||||
t.clientFk,
|
||||
t.created,
|
||||
t.amount / 100 amount,
|
||||
t.receiptFk IS NOT NULL AS isConfirmed,
|
||||
tt.message responseMessage,
|
||||
te.message errorMessage
|
||||
FROM hedera.tpvTransaction t
|
||||
JOIN hedera.tpvMerchant m ON m.id = t.merchantFk
|
||||
LEFT JOIN hedera.tpvResponse tt ON tt.id = t.response
|
||||
LEFT JOIN hedera.tpvError te ON te.code = errorCode`);
|
||||
|
||||
stmt.merge(conn.makeSuffix(filter, 't'));
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
Self.hasCustomerRole = (id, context, callback) => {
|
||||
let query =
|
||||
`SELECT COUNT(*) > 0 isCustomer
|
||||
let query = `
|
||||
SELECT COUNT(*) > 0 isCustomer
|
||||
FROM salix.Account A
|
||||
JOIN salix.Role r ON r.id = A.roleFK
|
||||
WHERE r.name = 'customer'
|
||||
|
|
|
@ -30,12 +30,12 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
Self.isValidClient = async id => {
|
||||
let query =
|
||||
`SELECT r.name
|
||||
let query = `
|
||||
SELECT r.name
|
||||
FROM salix.Account a
|
||||
JOIN vn.client c ON a.id = c.id
|
||||
JOIN salix.RoleMapping rm ON rm.principalId = a.id
|
||||
JOIN salix.Role r ON r.id = rm.roleId
|
||||
JOIN vn.client c ON a.id = c.id
|
||||
JOIN salix.RoleMapping rm ON rm.principalId = a.id
|
||||
JOIN salix.Role r ON r.id = rm.roleId
|
||||
WHERE a.id = ? AND c.isActive AND c.isTaxDataChecked`;
|
||||
|
||||
let roleNames = await Self.rawSql(query, [id]);
|
||||
|
|
|
@ -42,15 +42,9 @@ module.exports = Self => {
|
|||
}
|
||||
},
|
||||
{
|
||||
relation: 'salesPerson',
|
||||
relation: 'salesPersonUser',
|
||||
scope: {
|
||||
fields: ['userFk'],
|
||||
include: {
|
||||
relation: 'user',
|
||||
scope: {
|
||||
fields: ['name']
|
||||
}
|
||||
}
|
||||
fields: ['id', 'name']
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -25,7 +25,6 @@ module.exports = Self => {
|
|||
Self.createWithInsurance = async(data, ctx) => {
|
||||
const tx = await Self.beginTransaction({});
|
||||
const models = Self.app.models;
|
||||
const $t = ctx.req.__; // $translate
|
||||
|
||||
try {
|
||||
let options = {transaction: tx};
|
||||
|
|
|
@ -105,7 +105,7 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
function hasSalesMan(err) {
|
||||
if (this.payMethod && !this.salesPerson)
|
||||
if (this.payMethod && !this.salesPersonUser)
|
||||
err();
|
||||
}
|
||||
|
||||
|
|
|
@ -131,11 +131,6 @@
|
|||
"model": "PayMethod",
|
||||
"foreignKey": "payMethodFk"
|
||||
},
|
||||
"salesPerson": {
|
||||
"type": "belongsTo",
|
||||
"model": "Worker",
|
||||
"foreignKey": "salesPersonFk"
|
||||
},
|
||||
"salesPersonUser": {
|
||||
"type": "belongsTo",
|
||||
"model": "Account",
|
||||
|
|
|
@ -51,7 +51,7 @@ module.exports = function(Self) {
|
|||
const data = ctx.instance;
|
||||
const insurance = await Self.findById(data.id, null, options);
|
||||
const client = insurance.classification().customer();
|
||||
const salesPerson = client.salesPerson();
|
||||
const salesPerson = client.salesPersonUser();
|
||||
|
||||
if (!salesPerson) return;
|
||||
|
||||
|
|
|
@ -43,15 +43,9 @@
|
|||
"scope": {
|
||||
"fields": ["name", "salesPersonFk"],
|
||||
"include": {
|
||||
"relation": "salesPerson",
|
||||
"relation": "salesPersonUser",
|
||||
"scope": {
|
||||
"fields": "userFk",
|
||||
"include": {
|
||||
"relation": "user",
|
||||
"scope": {
|
||||
"fields": ["name"]
|
||||
}
|
||||
}
|
||||
"fields": ["id", "name"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@
|
|||
<vn-td center shrink>
|
||||
<a ng-show="balance.hasPdf"
|
||||
target="_blank"
|
||||
href="InvoiceOuts/{{::balance.id}}/download?access_token={{::$ctrl.vnToken.token}}">
|
||||
href="api/InvoiceOuts/{{::balance.id}}/download?access_token={{::$ctrl.vnToken.token}}">
|
||||
<vn-icon-button
|
||||
icon="cloud_download"
|
||||
title="{{'Download PDF' | translate}}">
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
<span
|
||||
ng-click="workerDescriptor.show($event, $ctrl.client.salesPersonFk)"
|
||||
class="link">
|
||||
{{$ctrl.client.salesPerson.user.name}}
|
||||
{{$ctrl.client.salesPersonUser.name}}
|
||||
</span>
|
||||
</vn-label-value>
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<vn-card class="summary">
|
||||
<h5>{{$ctrl.summary.name}} - {{$ctrl.summary.id}} - {{$ctrl.summary.salesPerson.user.nickname}}</h5>
|
||||
<h5>{{$ctrl.summary.name}} - {{$ctrl.summary.id}} - {{$ctrl.summary.salesPersonUser.name}}</h5>
|
||||
<vn-horizontal>
|
||||
<vn-one>
|
||||
<h4 translate>Basic data</h4>
|
||||
|
@ -25,7 +25,7 @@
|
|||
<span
|
||||
ng-click="workerDescriptor.show($event, $ctrl.summary.salesPersonFk)"
|
||||
class="link">
|
||||
{{$ctrl.summary.salesPerson.user.name}}
|
||||
{{$ctrl.summary.salesPersonUser.name}}
|
||||
</span>
|
||||
</vn-label-value>
|
||||
<vn-label-value label="Channel"
|
||||
|
|
|
@ -108,6 +108,20 @@ module.exports = Self => {
|
|||
i.isActive,
|
||||
i.minPrice,
|
||||
i.description,
|
||||
i.name,
|
||||
i.subName,
|
||||
i.tag5,
|
||||
i.value5,
|
||||
i.tag6,
|
||||
i.value6,
|
||||
i.tag7,
|
||||
i.value7,
|
||||
i.tag8,
|
||||
i.value8,
|
||||
i.tag9,
|
||||
i.value9,
|
||||
i.tag10,
|
||||
i.value10,
|
||||
t.name AS type,
|
||||
intr.description AS intrastat,
|
||||
ori.code AS origin,
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
<vn-th field="quantity">Quantity</vn-th>
|
||||
<vn-th field="description" style="text-align: center">Description</vn-th>
|
||||
<vn-th field="size">Size</vn-th>
|
||||
<vn-th field="tags" style="text-align: center">Tags</vn-th>
|
||||
<vn-th field="type">Type</vn-th>
|
||||
<vn-th field="intrastat">Intrastat</vn-th>
|
||||
<vn-th field="origin">Origin</vn-th>
|
||||
|
@ -95,6 +96,14 @@
|
|||
{{::buy.description | dashIfEmpty}}
|
||||
</vn-td>
|
||||
<vn-td number>{{::buy.size}}</vn-td>
|
||||
<vn-td expand>
|
||||
<vn-fetched-tags
|
||||
max-length="6"
|
||||
item="::buy"
|
||||
name="::buy.name"
|
||||
sub-name="::buy.subName">
|
||||
</vn-fetched-tags>
|
||||
</vn-td>
|
||||
<vn-td shrink title="{{::buy.type}}">
|
||||
{{::buy.type}}
|
||||
</vn-td>
|
||||
|
@ -121,7 +130,12 @@
|
|||
<vn-td number>{{::buy.freightValue | currency: 'EUR':2}}</vn-td>
|
||||
<vn-td number>{{::buy.comissionValue | currency: 'EUR':2}}</vn-td>
|
||||
<vn-td number>{{::buy.packageValue | currency: 'EUR':2}}</vn-td>
|
||||
<vn-td shrink>{{::buy.isIgnored}}</vn-td>
|
||||
<vn-td shrink>
|
||||
<vn-check
|
||||
disabled="true"
|
||||
ng-model="::buy.isIgnored">
|
||||
</vn-check>
|
||||
</vn-td>
|
||||
<vn-td number>{{::buy.price2 | currency: 'EUR':2}}</vn-td>
|
||||
<vn-td number>{{::buy.price3 | currency: 'EUR':2}}</vn-td>
|
||||
<vn-td number>{{::buy.minPrice | currency: 'EUR':2}}</vn-td>
|
||||
|
|
|
@ -94,30 +94,31 @@ module.exports = Self => {
|
|||
]
|
||||
));
|
||||
|
||||
stmt = new ParameterizedSQL(`SELECT
|
||||
i.id,
|
||||
i.name,
|
||||
i.subName,
|
||||
i.image,
|
||||
i.tag5,
|
||||
i.value5,
|
||||
i.tag6,
|
||||
i.value6,
|
||||
i.tag7,
|
||||
i.value7,
|
||||
i.tag8,
|
||||
i.value8,
|
||||
tci.price,
|
||||
tci.available,
|
||||
w.lastName AS lastName,
|
||||
w.firstName,
|
||||
tci.priceKg,
|
||||
ink.hex
|
||||
FROM tmp.ticketCalculateItem tci
|
||||
JOIN vn.item i ON i.id = tci.itemFk
|
||||
JOIN vn.itemType it ON it.id = i.typeFk
|
||||
JOIN vn.ink ON ink.id = i.inkFk
|
||||
JOIN vn.worker w on w.id = it.workerFk`);
|
||||
stmt = new ParameterizedSQL(`
|
||||
SELECT
|
||||
i.id,
|
||||
i.name,
|
||||
i.subName,
|
||||
i.image,
|
||||
i.tag5,
|
||||
i.value5,
|
||||
i.tag6,
|
||||
i.value6,
|
||||
i.tag7,
|
||||
i.value7,
|
||||
i.tag8,
|
||||
i.value8,
|
||||
tci.price,
|
||||
tci.available,
|
||||
w.lastName AS lastName,
|
||||
w.firstName,
|
||||
tci.priceKg,
|
||||
ink.hex
|
||||
FROM tmp.ticketCalculateItem tci
|
||||
JOIN vn.item i ON i.id = tci.itemFk
|
||||
JOIN vn.itemType it ON it.id = i.typeFk
|
||||
JOIN vn.ink ON ink.id = i.inkFk
|
||||
JOIN vn.worker w on w.id = it.workerFk`);
|
||||
|
||||
// Apply order by tag
|
||||
if (orderBy.isTag) {
|
||||
|
|
|
@ -38,16 +38,16 @@ module.exports = Self => {
|
|||
order.agencyModeFk
|
||||
]);
|
||||
stmts.push(stmt);
|
||||
stmt = new ParameterizedSQL(`SELECT it.id, it.name, ic.name categoryName
|
||||
FROM tmp.availableCalc ac
|
||||
JOIN cache.available a ON a.calc_id = ac.calcFk
|
||||
JOIN item i ON i.id = a.item_id
|
||||
JOIN itemType it ON it.id = i.typeFk
|
||||
JOIN itemCategory ic ON ic.id = it.categoryFk
|
||||
WHERE it.categoryFk = ?
|
||||
GROUP BY it.id`, [
|
||||
itemCategoryId
|
||||
]);
|
||||
stmt = new ParameterizedSQL(`
|
||||
SELECT it.id, it.name, ic.name categoryName
|
||||
FROM tmp.availableCalc ac
|
||||
JOIN cache.available a ON a.calc_id = ac.calcFk
|
||||
JOIN item i ON i.id = a.item_id
|
||||
JOIN itemType it ON it.id = i.typeFk
|
||||
JOIN itemCategory ic ON ic.id = it.categoryFk
|
||||
WHERE it.categoryFk = ?
|
||||
GROUP BY it.id`, [itemCategoryId]
|
||||
);
|
||||
let categoriesIndex = stmts.push(stmt) - 1;
|
||||
|
||||
let sql = ParameterizedSQL.join(stmts, ';');
|
||||
|
|
|
@ -28,7 +28,6 @@ module.exports = Self => {
|
|||
|
||||
stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.order');
|
||||
|
||||
|
||||
stmt = new ParameterizedSQL(`
|
||||
CREATE TEMPORARY TABLE tmp.order
|
||||
(INDEX (orderFk))
|
||||
|
|
|
@ -31,14 +31,17 @@ module.exports = Self => {
|
|||
async function getOrderData(Self, orderId) {
|
||||
let filter = {
|
||||
include: [
|
||||
{relation: 'agencyMode', scope: {fields: ['name']}},
|
||||
{
|
||||
relation: 'agencyMode', scope: {fields: ['name']}},
|
||||
{
|
||||
relation: 'client',
|
||||
scope: {
|
||||
fields: ['salesPersonFk', 'name'],
|
||||
include: {
|
||||
relation: 'salesPerson',
|
||||
fields: ['firstName', 'name']
|
||||
relation: 'salesPersonUser',
|
||||
scope: {
|
||||
fields: ['id', 'name']
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -31,15 +31,9 @@ class Controller extends ModuleCard {
|
|||
'isTaxDataChecked'
|
||||
],
|
||||
include: {
|
||||
relation: 'salesPerson',
|
||||
relation: 'salesPersonUser',
|
||||
scope: {
|
||||
fields: ['userFk'],
|
||||
include: {
|
||||
relation: 'user',
|
||||
scope: {
|
||||
fields: ['name']
|
||||
}
|
||||
}
|
||||
fields: ['id', 'name']
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<span
|
||||
ng-click="workerDescriptor.show($event, $ctrl.order.client.salesPersonFk)"
|
||||
class="link">
|
||||
{{$ctrl.order.client.salesPerson.user.name}}
|
||||
{{$ctrl.order.client.salesPersonUser.name}}
|
||||
</span>
|
||||
</vn-label-value>
|
||||
<vn-label-value
|
||||
|
|
|
@ -31,7 +31,10 @@ module.exports = Self => {
|
|||
relation: 'client',
|
||||
scope: {
|
||||
include: {
|
||||
relation: 'salesPerson'
|
||||
relation: 'salesPersonUser',
|
||||
scope: {
|
||||
fields: ['id', 'name']
|
||||
}
|
||||
}
|
||||
}
|
||||
}]
|
||||
|
@ -69,7 +72,7 @@ module.exports = Self => {
|
|||
|
||||
await ticketTracking.destroy();
|
||||
|
||||
const salesPerson = ticket.client().salesPerson();
|
||||
const salesPerson = ticket.client().salesPersonUser();
|
||||
if (salesPerson) {
|
||||
const origin = ctx.req.headers.origin;
|
||||
const message = $t('This ticket is not an stowaway anymore', {
|
||||
|
|
|
@ -197,6 +197,7 @@ module.exports = Self => {
|
|||
t.routeFk,
|
||||
t.warehouseFk,
|
||||
t.clientFk,
|
||||
io.id AS invoiceOutId,
|
||||
a.provinceFk,
|
||||
p.name AS province,
|
||||
w.name AS warehouse,
|
||||
|
@ -216,6 +217,7 @@ module.exports = Self => {
|
|||
z.id AS zoneFk,
|
||||
CAST(z.hour AS CHAR) AS hour
|
||||
FROM ticket t
|
||||
LEFT JOIN invoiceOut io ON t.refFk = io.ref
|
||||
LEFT JOIN zone z ON z.id = t.zoneFk
|
||||
LEFT JOIN address a ON a.id = t.addressFk
|
||||
LEFT JOIN province p ON p.id = a.provinceFk
|
||||
|
@ -258,12 +260,12 @@ module.exports = Self => {
|
|||
|
||||
stmt = new ParameterizedSQL(`
|
||||
SELECT
|
||||
f.*,
|
||||
tt.total,
|
||||
tp.*
|
||||
FROM tmp.filter f
|
||||
LEFT JOIN tmp.ticketProblems tp ON tp.ticketFk = f.id
|
||||
LEFT JOIN tmp.ticketTotal tt ON tt.ticketFk = f.id`);
|
||||
f.*,
|
||||
tt.total,
|
||||
tp.*
|
||||
FROM tmp.filter f
|
||||
LEFT JOIN tmp.ticketProblems tp ON tp.ticketFk = f.id
|
||||
LEFT JOIN tmp.ticketTotal tt ON tt.ticketFk = f.id`);
|
||||
|
||||
if (args.problems != undefined && (!args.from && !args.to))
|
||||
throw new UserError('Choose a date range or days forward');
|
||||
|
|
|
@ -89,12 +89,9 @@ module.exports = Self => {
|
|||
scope: {
|
||||
fields: ['id', 'salesPersonFk'],
|
||||
include: {
|
||||
relation: 'salesPerson',
|
||||
relation: 'salesPersonUser',
|
||||
scope: {
|
||||
fields: ['id', 'userFk'],
|
||||
include: {
|
||||
relation: 'user'
|
||||
}
|
||||
fields: ['id', 'name']
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -121,15 +118,14 @@ module.exports = Self => {
|
|||
}
|
||||
|
||||
// Send notification to salesPerson
|
||||
const salesPerson = ticket.client().salesPerson();
|
||||
if (salesPerson) {
|
||||
const salesPersonUser = salesPerson.user().name;
|
||||
const salesPersonUser = ticket.client().salesPersonUser();
|
||||
if (salesPersonUser) {
|
||||
const origin = ctx.req.headers.origin;
|
||||
const message = $t(`Has deleted the ticket id`, {
|
||||
id: id,
|
||||
url: `${origin}/#!/ticket/${id}/summary`
|
||||
});
|
||||
await models.Chat.send(ctx, `@${salesPersonUser}`, message);
|
||||
await models.Chat.send(ctx, `@${salesPersonUser.name}`, message);
|
||||
}
|
||||
|
||||
return ticket.updateAttribute('isDeleted', true);
|
||||
|
|
|
@ -67,14 +67,12 @@ describe('ticket filter()', () => {
|
|||
const ctx = {req: {accessToken: {userId: 9}}, args: {pending: true}};
|
||||
const filter = {};
|
||||
const result = await app.models.Ticket.filter(ctx, filter);
|
||||
const firstRow = result[0];
|
||||
const secondRow = result[1];
|
||||
const thirdRow = result[2];
|
||||
|
||||
const length = result.length;
|
||||
const anyResult = result[Math.floor(Math.random() * Math.floor(length))];
|
||||
|
||||
expect(result.length).toEqual(7);
|
||||
expect(firstRow.state).toEqual('Libre');
|
||||
expect(secondRow.state).toEqual('Libre');
|
||||
expect(thirdRow.state).toEqual('Libre');
|
||||
expect(anyResult.state).toMatch(/(Libre|Arreglar)/);
|
||||
});
|
||||
|
||||
it('should return the tickets that are not pending', async() => {
|
||||
|
|
|
@ -57,15 +57,9 @@ module.exports = Self => {
|
|||
scope: {
|
||||
fields: ['salesPersonFk', 'name', 'phone', 'mobile'],
|
||||
include: {
|
||||
relation: 'salesPerson',
|
||||
relation: 'salesPersonUser',
|
||||
scope: {
|
||||
fields: ['userFk'],
|
||||
include: {
|
||||
relation: 'user',
|
||||
scope: {
|
||||
fields: ['name']
|
||||
}
|
||||
}
|
||||
fields: ['id', 'name']
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,15 +38,9 @@ class Controller extends ModuleCard {
|
|||
'mobile'
|
||||
],
|
||||
include: {
|
||||
relation: 'salesPerson',
|
||||
relation: 'salesPersonUser',
|
||||
scope: {
|
||||
fields: ['userFk'],
|
||||
include: {
|
||||
relation: 'user',
|
||||
scope: {
|
||||
fields: ['name']
|
||||
}
|
||||
}
|
||||
fields: ['id', 'name']
|
||||
}
|
||||
},
|
||||
},
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
<span
|
||||
ng-click="workerDescriptor.show($event, $ctrl.ticket.client.salesPersonFk)"
|
||||
class="link">
|
||||
{{$ctrl.ticket.client.salesPerson.user.name}}
|
||||
{{$ctrl.ticket.client.salesPersonUser.name}}
|
||||
</span>
|
||||
</vn-label-value>
|
||||
<vn-label-value
|
||||
|
|
|
@ -204,15 +204,9 @@ class Controller extends Descriptor {
|
|||
'isTaxDataChecked'
|
||||
],
|
||||
include: {
|
||||
relation: 'salesPerson',
|
||||
relation: 'salesPersonUser',
|
||||
scope: {
|
||||
fields: ['userFk'],
|
||||
include: {
|
||||
relation: 'user',
|
||||
scope: {
|
||||
fields: ['name']
|
||||
}
|
||||
}
|
||||
fields: ['id', 'name']
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
<vn-th field="stateFk" >State</vn-th>
|
||||
<vn-th field="zoneFk">Zone</vn-th>
|
||||
<vn-th field="warehouseFk">Warehouse</vn-th>
|
||||
<vn-th field="refFk" class="expendable">Invoice</vn-th>
|
||||
<vn-th field="hour" shrink>Closure</vn-th>
|
||||
<vn-th number>Total</vn-th>
|
||||
<vn-th></vn-th>
|
||||
|
@ -89,8 +88,17 @@
|
|||
</span>
|
||||
</vn-td>
|
||||
<vn-td class="expendable">{{::ticket.province}}</vn-td>
|
||||
<vn-td>
|
||||
<span class="chip {{$ctrl.stateColor(ticket)}}">
|
||||
<vn-td class="expendable">
|
||||
<span
|
||||
ng-show="ticket.refFk"
|
||||
title="{{::ticket.refFk}}"
|
||||
vn-click-stop="invoiceOutDescriptor.show($event, ticket.invoiceOutId)"
|
||||
class="link">
|
||||
{{::ticket.refFk}}
|
||||
</span>
|
||||
<span
|
||||
ng-show="!ticket.refFk"
|
||||
class="chip {{$ctrl.stateColor(ticket)}}">
|
||||
{{ticket.state}}
|
||||
</span>
|
||||
</vn-td>
|
||||
|
@ -103,7 +111,6 @@
|
|||
</span>
|
||||
</vn-td>
|
||||
<vn-td>{{::ticket.warehouse}}</vn-td>
|
||||
<vn-td class="expendable">{{::ticket.refFk | dashIfEmpty}}</vn-td>
|
||||
<vn-td shrink>{{::ticket.zoneLanding | date: 'HH:mm'}}</vn-td>
|
||||
<vn-td number>
|
||||
<span class="chip {{$ctrl.totalPriceColor(ticket)}}">
|
||||
|
@ -169,6 +176,9 @@
|
|||
<vn-client-balance-create
|
||||
vn-id="balanceCreateDialog">
|
||||
</vn-client-balance-create>
|
||||
<vn-invoice-out-descriptor-popover
|
||||
vn-id="invoiceOutDescriptor">
|
||||
</vn-invoice-out-descriptor-popover>
|
||||
<vn-contextmenu vn-id="contextmenu" targets="['vn-data-viewer']" model="model"
|
||||
expr-builder="$ctrl.exprBuilder(param, value)">
|
||||
<slot-menu>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<span
|
||||
ng-click="workerDescriptor.show($event, $ctrl.summary.client.salesPersonFk)"
|
||||
class="link">
|
||||
{{$ctrl.summary.client.salesPerson.user.name}}
|
||||
{{$ctrl.summary.client.salesPersonUser.name}}
|
||||
</span>
|
||||
</vn-label-value>
|
||||
<vn-label-value label="Agency"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
let env = process.env.NODE_ENV ? process.env.NODE_ENV : 'development';
|
||||
|
||||
let configPath = `/etc/salix`;
|
||||
|
@ -12,6 +13,9 @@ let configFiles = [
|
|||
];
|
||||
|
||||
for (let configFile of configFiles) {
|
||||
if (!configFile.includes(configPath))
|
||||
configFile = path.join(__dirname, configFile);
|
||||
|
||||
if (fs.existsSync(configFile)) {
|
||||
const conf = require(configFile);
|
||||
for (let prop in conf)
|
||||
|
@ -20,5 +24,4 @@ for (let configFile of configFiles) {
|
|||
}
|
||||
|
||||
config.env = env;
|
||||
|
||||
module.exports = config;
|
||||
|
|
|
@ -27,7 +27,7 @@ class Report extends Component {
|
|||
if (fs.existsSync(fullPath))
|
||||
options = require(optionsPath);
|
||||
|
||||
const page = await config.browser.newPage();
|
||||
const page = (await config.browser.pages())[0];
|
||||
await page.emulateMedia('screen');
|
||||
await page.setContent(template);
|
||||
|
||||
|
|
|
@ -10,12 +10,15 @@ module.exports = {
|
|||
const routes = await this.fetchRoutes(routesId);
|
||||
const tickets = await this.fetchTickets(routesId);
|
||||
|
||||
for (let route of routes) {
|
||||
const routeTickets = tickets.filter(ticket => {
|
||||
return ticket.routeFk == route.id;
|
||||
});
|
||||
const map = new Map();
|
||||
|
||||
route.tickets = routeTickets;
|
||||
for (let route of routes)
|
||||
map.set(route.id, route);
|
||||
|
||||
for (let ticket of tickets) {
|
||||
const route = map.get(ticket.routeFk);
|
||||
if (!route.tickets) route.tickets = [];
|
||||
route.tickets.push(ticket);
|
||||
}
|
||||
|
||||
this.routes = routes;
|
||||
|
@ -61,7 +64,7 @@ module.exports = {
|
|||
a.postalCode,
|
||||
LPAD(a.id, 5, '0') AS addressFk,
|
||||
p.name province,
|
||||
vn.ticketGetTotal(t.id) AS import,
|
||||
0 AS import,
|
||||
am.name ticketAgency,
|
||||
tob.description,
|
||||
s.shipFk,
|
||||
|
|
Loading…
Reference in New Issue