Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 3888-ticket.expedition_moveExpedition
This commit is contained in:
commit
1f21fdeb65
|
@ -1,8 +1,9 @@
|
||||||
const {Report, Email, smtp} = require('vn-print');
|
const {Email} = require('vn-print');
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethodCtx('claimPickupEmail', {
|
Self.remoteMethodCtx('claimPickupEmail', {
|
||||||
description: 'Sends the the claim pickup order email with an attached PDF',
|
description: 'Sends the the claim pickup order email with an attached PDF',
|
||||||
|
accessType: 'WRITE',
|
||||||
accepts: [
|
accepts: [
|
||||||
{
|
{
|
||||||
arg: 'id',
|
arg: 'id',
|
||||||
|
@ -40,7 +41,7 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.claimPickupEmail = async(ctx, id) => {
|
Self.claimPickupEmail = async ctx => {
|
||||||
const args = Object.assign({}, ctx.args);
|
const args = Object.assign({}, ctx.args);
|
||||||
const params = {
|
const params = {
|
||||||
recipient: args.recipient,
|
recipient: args.recipient,
|
||||||
|
|
|
@ -18,46 +18,46 @@ module.exports = Self => {
|
||||||
Self.consumptionSendQueued = async() => {
|
Self.consumptionSendQueued = async() => {
|
||||||
const queues = await Self.rawSql(`
|
const queues = await Self.rawSql(`
|
||||||
SELECT
|
SELECT
|
||||||
ccq.id,
|
id,
|
||||||
c.id AS clientFk,
|
params
|
||||||
c.email AS clientEmail,
|
FROM clientConsumptionQueue
|
||||||
eu.email salesPersonEmail,
|
WHERE status = ''`);
|
||||||
REPLACE(json_extract(params, '$.from'), '"', '') AS fromDate,
|
|
||||||
REPLACE(json_extract(params, '$.to'), '"', '') AS toDate
|
|
||||||
FROM clientConsumptionQueue ccq
|
|
||||||
JOIN client c ON (
|
|
||||||
JSON_SEARCH(
|
|
||||||
JSON_ARRAY(
|
|
||||||
json_extract(params, '$.clients')
|
|
||||||
)
|
|
||||||
, 'all', c.id) IS NOT NULL)
|
|
||||||
JOIN account.emailUser eu ON eu.userFk = c.salesPersonFk
|
|
||||||
JOIN ticket t ON t.clientFk = c.id
|
|
||||||
JOIN sale s ON s.ticketFk = t.id
|
|
||||||
JOIN item i ON i.id = s.itemFk
|
|
||||||
JOIN itemType it ON it.id = i.typeFk
|
|
||||||
WHERE status = ''
|
|
||||||
AND it.isPackaging = FALSE
|
|
||||||
AND DATE(t.shipped) BETWEEN
|
|
||||||
REPLACE(json_extract(params, '$.from'), '"', '') AND
|
|
||||||
REPLACE(json_extract(params, '$.to'), '"', '')
|
|
||||||
GROUP BY c.id`);
|
|
||||||
|
|
||||||
for (const queue of queues) {
|
for (const queue of queues) {
|
||||||
try {
|
try {
|
||||||
const args = {
|
const params = JSON.parse(queue.params);
|
||||||
id: queue.clientFk,
|
|
||||||
recipient: queue.clientEmail,
|
|
||||||
replyTo: queue.salesPersonEmail,
|
|
||||||
from: queue.fromDate,
|
|
||||||
to: queue.toDate
|
|
||||||
};
|
|
||||||
|
|
||||||
const email = new Email('campaign-metrics', args);
|
const clients = await Self.rawSql(`
|
||||||
await email.send();
|
SELECT
|
||||||
|
c.id AS clientFk,
|
||||||
|
c.email AS clientEmail,
|
||||||
|
eu.email salesPersonEmail
|
||||||
|
FROM client c
|
||||||
|
JOIN account.emailUser eu ON eu.userFk = c.salesPersonFk
|
||||||
|
JOIN ticket t ON t.clientFk = c.id
|
||||||
|
JOIN sale s ON s.ticketFk = t.id
|
||||||
|
JOIN item i ON i.id = s.itemFk
|
||||||
|
JOIN itemType it ON it.id = i.typeFk
|
||||||
|
WHERE c.id IN(?)
|
||||||
|
AND it.isPackaging = FALSE
|
||||||
|
AND DATE(t.shipped) BETWEEN ? AND ?
|
||||||
|
GROUP BY c.id`, [params.clients, params.from, params.to]);
|
||||||
|
|
||||||
|
for (const client of clients) {
|
||||||
|
const args = {
|
||||||
|
id: client.clientFk,
|
||||||
|
recipient: client.clientEmail,
|
||||||
|
replyTo: client.salesPersonEmail,
|
||||||
|
from: params.from,
|
||||||
|
to: params.to
|
||||||
|
};
|
||||||
|
|
||||||
|
const email = new Email('campaign-metrics', args);
|
||||||
|
await email.send();
|
||||||
|
}
|
||||||
|
|
||||||
await Self.rawSql(`
|
await Self.rawSql(`
|
||||||
UPDATE clientConsumptionQueue
|
UPDATE clientConsumptionQueue
|
||||||
SET status = 'printed',
|
SET status = 'printed',
|
||||||
printed = ?
|
printed = ?
|
||||||
WHERE id = ?`,
|
WHERE id = ?`,
|
||||||
|
@ -69,7 +69,7 @@ module.exports = Self => {
|
||||||
WHERE id = ?`,
|
WHERE id = ?`,
|
||||||
[error.message, queue.id]);
|
[error.message, queue.id]);
|
||||||
|
|
||||||
throw e;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,15 +77,16 @@ export default class Controller extends Section {
|
||||||
|
|
||||||
onSendClientConsumption() {
|
onSendClientConsumption() {
|
||||||
const clientIds = this.checked.map(client => client.id);
|
const clientIds = this.checked.map(client => client.id);
|
||||||
const params = {
|
const data = {
|
||||||
clients: clientIds,
|
clients: clientIds,
|
||||||
from: this.campaign.from,
|
from: this.campaign.from,
|
||||||
to: this.campaign.to
|
to: this.campaign.to
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const params = JSON.stringify(data);
|
||||||
this.$http.post('ClientConsumptionQueues', {params})
|
this.$http.post('ClientConsumptionQueues', {params})
|
||||||
.then(() => this.$.filters.hide())
|
.then(() => this.$.filters.hide())
|
||||||
.then(() => this.vnApp.showSuccess(this.$t('Notifications sent!')));
|
.then(() => this.vnApp.showSuccess(this.$t('Notification sent!')));
|
||||||
}
|
}
|
||||||
|
|
||||||
exprBuilder(param, value) {
|
exprBuilder(param, value) {
|
||||||
|
|
|
@ -69,15 +69,16 @@ describe('Client notification', () => {
|
||||||
data[0].$checked = true;
|
data[0].$checked = true;
|
||||||
data[1].$checked = true;
|
data[1].$checked = true;
|
||||||
|
|
||||||
const params = Object.assign({
|
const args = Object.assign({
|
||||||
clients: [1101, 1102]
|
clients: [1101, 1102]
|
||||||
}, controller.campaign);
|
}, controller.campaign);
|
||||||
|
const params = JSON.stringify(args);
|
||||||
|
|
||||||
$httpBackend.expect('POST', `ClientConsumptionQueues`, {params}).respond(200, params);
|
$httpBackend.expect('POST', `ClientConsumptionQueues`, {params}).respond(200, params);
|
||||||
controller.onSendClientConsumption();
|
controller.onSendClientConsumption();
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Notifications sent!');
|
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Notification sent!');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ class Controller extends Section {
|
||||||
if (this.$params.warehouseFk)
|
if (this.$params.warehouseFk)
|
||||||
this.warehouseFk = this.$params.warehouseFk;
|
this.warehouseFk = this.$params.warehouseFk;
|
||||||
else if (value)
|
else if (value)
|
||||||
this.warehouseFk = value.itemType.warehouseFk;
|
this.warehouseFk = this.vnConfig.warehouseFk;
|
||||||
|
|
||||||
if (this.$params.lineFk)
|
if (this.$params.lineFk)
|
||||||
this.lineFk = this.$params.lineFk;
|
this.lineFk = this.$params.lineFk;
|
||||||
|
|
|
@ -3,6 +3,7 @@ const {Email} = require('vn-print');
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethodCtx('driverRouteEmail', {
|
Self.remoteMethodCtx('driverRouteEmail', {
|
||||||
description: 'Sends the driver route email with an attached PDF',
|
description: 'Sends the driver route email with an attached PDF',
|
||||||
|
accessType: 'WRITE',
|
||||||
accepts: [
|
accepts: [
|
||||||
{
|
{
|
||||||
arg: 'id',
|
arg: 'id',
|
||||||
|
|
|
@ -29,7 +29,7 @@ module.exports = Self => {
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
const query =
|
const query =
|
||||||
`SELECT DISTINCT u.nickname
|
`SELECT DISTINCT u.id, u.nickname
|
||||||
FROM itemType it
|
FROM itemType it
|
||||||
JOIN worker w ON w.id = it.workerFk
|
JOIN worker w ON w.id = it.workerFk
|
||||||
JOIN account.user u ON u.id = w.id`;
|
JOIN account.user u ON u.id = w.id`;
|
||||||
|
|
|
@ -18,6 +18,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
Self.closeAll = async() => {
|
Self.closeAll = async() => {
|
||||||
const toDate = new Date();
|
const toDate = new Date();
|
||||||
|
toDate.setHours(0, 0, 0, 0);
|
||||||
toDate.setDate(toDate.getDate() - 1);
|
toDate.setDate(toDate.getDate() - 1);
|
||||||
|
|
||||||
const todayMinDate = new Date();
|
const todayMinDate = new Date();
|
||||||
|
|
|
@ -42,10 +42,10 @@
|
||||||
<th field="id" shrink>
|
<th field="id" shrink>
|
||||||
<span translate>Id</span>
|
<span translate>Id</span>
|
||||||
</th>
|
</th>
|
||||||
<th field="cargoSupplierFk" expand>
|
<th field="cargoSupplierFk">
|
||||||
<span translate>Supplier</span>
|
<span translate>Supplier</span>
|
||||||
</th>
|
</th>
|
||||||
<th field="agencyModeFk" expand>
|
<th field="agencyModeFk">
|
||||||
<span translate>Agency</span>
|
<span translate>Agency</span>
|
||||||
</th>
|
</th>
|
||||||
<th field="ref">
|
<th field="ref">
|
||||||
|
@ -100,37 +100,37 @@
|
||||||
{{::travel.id}}
|
{{::travel.id}}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td expand vn-click-stop>
|
<td class="multi-line" vn-click-stop>
|
||||||
<span
|
<span
|
||||||
class="link"
|
class="link"
|
||||||
ng-click="supplierDescriptor.show($event, travel.cargoSupplierFk)">
|
ng-click="supplierDescriptor.show($event, travel.cargoSupplierFk)">
|
||||||
{{::travel.cargoSupplierNickname}}
|
{{::travel.cargoSupplierNickname}}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td expand>{{::travel.agencyModeName}}</td>
|
<td>{{::travel.agencyModeName}}</td>
|
||||||
<td
|
<td vn-click-stop>
|
||||||
name="reference"
|
<vn-td-editable name="reference" expand>
|
||||||
expand
|
<text>{{travel.ref}}</text>
|
||||||
vn-click-stop>
|
<field>
|
||||||
<vn-textfield
|
<vn-textfield class="dense" vn-focus
|
||||||
class="dense td-editable"
|
ng-model="travel.ref"
|
||||||
ng-model="travel.ref"
|
on-change="$ctrl.save(travel.id, {ref: value})">
|
||||||
on-change="$ctrl.save(travel.id, {ref: value})">
|
</vn-textfield>
|
||||||
</vn-textfield>
|
</field>
|
||||||
</vn-icon>
|
</vn-td-editable>
|
||||||
</td>
|
</td>
|
||||||
<td number>{{::travel.stickers}}</td>
|
<td number>{{::travel.stickers}}</td>
|
||||||
<td
|
<td vn-click-stop>
|
||||||
name="lockedKg"
|
<vn-td-editable name="lockedKg" expand style="text-align: right">
|
||||||
expand
|
<text number>{{travel.kg}}</text>
|
||||||
vn-click-stop>
|
<field>
|
||||||
<vn-input-number
|
<vn-input-number class="dense" vn-focus
|
||||||
number
|
ng-model="travel.kg"
|
||||||
class="td-editable number"
|
on-change="$ctrl.save(travel.id, {kg: value})"
|
||||||
ng-model="travel.kg"
|
min="0">
|
||||||
on-change="$ctrl.save(travel.id, {kg: value})"
|
</vn-input-number>
|
||||||
min="0">
|
</field>
|
||||||
</vn-input-number>
|
</vn-td-editable>
|
||||||
</td>
|
</td>
|
||||||
<td number>{{::travel.loadedKg}}</td>
|
<td number>{{::travel.loadedKg}}</td>
|
||||||
<td number>{{::travel.volumeKg}}</td>
|
<td number>{{::travel.volumeKg}}</td>
|
||||||
|
@ -150,7 +150,7 @@
|
||||||
{{::entry.id}}
|
{{::entry.id}}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td class="multi-line">
|
||||||
<span
|
<span
|
||||||
class="link"
|
class="link"
|
||||||
ng-click="supplierDescriptor.show($event, entry.supplierFk)">
|
ng-click="supplierDescriptor.show($event, entry.supplierFk)">
|
||||||
|
@ -158,7 +158,7 @@
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td expand>{{::entry.ref}}</td>
|
<td class="td-editable">{{::entry.ref}}</td>
|
||||||
<td number>{{::entry.stickers}}</td>
|
<td number>{{::entry.stickers}}</td>
|
||||||
<td number></td>
|
<td number></td>
|
||||||
<td number>{{::entry.loadedkg}}</td>
|
<td number>{{::entry.loadedkg}}</td>
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
vn-travel-extra-community {
|
vn-travel-extra-community {
|
||||||
.header {
|
.header {
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
font-size: 1.25rem;
|
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
padding: 7px;
|
padding: 7px;
|
||||||
padding-bottom: 7px;
|
padding-bottom: 7px;
|
||||||
|
@ -16,6 +15,10 @@ vn-travel-extra-community {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
.multi-line{
|
||||||
|
padding-top: 15px;
|
||||||
|
padding-bottom: 15px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
table[vn-droppable] {
|
table[vn-droppable] {
|
||||||
|
@ -29,10 +32,10 @@ vn-travel-extra-community {
|
||||||
outline: 0;
|
outline: 0;
|
||||||
height: 65px;
|
height: 65px;
|
||||||
pointer-events: fill;
|
pointer-events: fill;
|
||||||
user-select:all;
|
user-select: all;
|
||||||
}
|
}
|
||||||
|
|
||||||
tr[draggable] *::selection{
|
tr[draggable] *::selection {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,16 +46,22 @@ vn-travel-extra-community {
|
||||||
tr[draggable].dragging {
|
tr[draggable].dragging {
|
||||||
background-color: $color-primary-light;
|
background-color: $color-primary-light;
|
||||||
color: $color-font-light;
|
color: $color-font-light;
|
||||||
font-weight:bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.td-editable{
|
|
||||||
input{
|
.multi-line{
|
||||||
font-size: 1.25rem!important;
|
max-width: 200px;
|
||||||
}
|
word-wrap: normal;
|
||||||
|
white-space: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
.number *{
|
vn-td-editable text {
|
||||||
text-align: right;
|
background-color: transparent;
|
||||||
|
padding: 0;
|
||||||
|
border: 0;
|
||||||
|
border-bottom: 1px dashed $color-active;
|
||||||
|
border-radius: 0;
|
||||||
|
color: $color-active
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,10 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const leaves = map.get(parentId);
|
const leaves = map.get(parentId);
|
||||||
setLeaves(leaves);
|
|
||||||
|
const maxNodes = 250;
|
||||||
|
if (res.length <= maxNodes)
|
||||||
|
setLeaves(leaves);
|
||||||
|
|
||||||
return leaves || [];
|
return leaves || [];
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue