2737-supplier_basic_data_worker #539
|
@ -11,25 +11,37 @@ module.exports = Self => {
|
||||||
type: 'Number',
|
type: 'Number',
|
||||||
description: 'The document id',
|
description: 'The document id',
|
||||||
http: {source: 'path'}
|
http: {source: 'path'}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
arg: 'warehouseId',
|
arg: 'warehouseId',
|
||||||
type: 'Number',
|
type: 'Number',
|
||||||
description: 'The warehouse id'
|
description: 'The warehouse id'
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
arg: 'companyId',
|
arg: 'companyId',
|
||||||
type: 'Number',
|
type: 'Number',
|
||||||
description: 'The company id'
|
description: 'The company id'
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
arg: 'dmsTypeId',
|
arg: 'dmsTypeId',
|
||||||
type: 'Number',
|
type: 'Number',
|
||||||
description: 'The dms type id'
|
description: 'The dms type id'
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
arg: 'reference',
|
arg: 'reference',
|
||||||
type: 'String'
|
type: 'String'
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
arg: 'description',
|
arg: 'description',
|
||||||
type: 'String'
|
type: 'String'
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
|
arg: 'hasFile',
|
||||||
|
type: 'Boolean',
|
||||||
|
description: 'True if has an attached file',
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
arg: 'hasFileAttached',
|
arg: 'hasFileAttached',
|
||||||
type: 'Boolean',
|
type: 'Boolean',
|
||||||
description: 'True if has an attached file'
|
description: 'True if has an attached file'
|
||||||
|
@ -70,7 +82,8 @@ module.exports = Self => {
|
||||||
companyFk: args.companyId,
|
companyFk: args.companyId,
|
||||||
warehouseFk: args.warehouseId,
|
warehouseFk: args.warehouseId,
|
||||||
reference: args.reference,
|
reference: args.reference,
|
||||||
description: args.description
|
description: args.description,
|
||||||
|
hasFile: args.hasFile
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
if (args.hasFileAttached)
|
if (args.hasFileAttached)
|
||||||
|
|
|
@ -57,6 +57,9 @@ module.exports = Self => {
|
||||||
const entity = await models[imageCollection.model].findById(id, {
|
const entity = await models[imageCollection.model].findById(id, {
|
||||||
fields: ['id', imageCollection.property]
|
fields: ['id', imageCollection.property]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!entity) return false;
|
||||||
|
|
||||||
const image = await models.Image.findOne({where: {
|
const image = await models.Image.findOne({where: {
|
||||||
collectionFk: collection,
|
collectionFk: collection,
|
||||||
name: entity[imageCollection.property]}
|
name: entity[imageCollection.property]}
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"hardCopyNumber": {
|
"hardCopyNumber": {
|
||||||
"type": "Number"
|
"type": "number"
|
||||||
},
|
},
|
||||||
"hasFile": {
|
"hasFile": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
"nRefs": {
|
"nRefs": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"required": true,
|
"required": true,
|
||||||
"default": 0
|
"default": 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
|
|
@ -89,7 +89,7 @@
|
||||||
"Company has to be official": "Company has to be official",
|
"Company has to be official": "Company has to be official",
|
||||||
"A travel with this data already exists": "A travel with this data already exists",
|
"A travel with this data already exists": "A travel with this data already exists",
|
||||||
"The observation type can't be repeated": "The observation type can't be repeated",
|
"The observation type can't be repeated": "The observation type can't be repeated",
|
||||||
"New ticket request has been created with price": "New ticket request has been created '{{description}}' for day <strong>{{shipped}}</strong>, with a quantity of <strong>{{quantity}}</strong> and a price of <strong>{{price}} €</strong>",
|
"New ticket request has been created with price": "New ticket request has been created *'{{description}}'* for day *{{shipped}}*, with a quantity of *{{quantity}}* and a price of *{{price}} €*",
|
||||||
"New ticket request has been created": "New ticket request has been created '{{description}}' for day <strong>{{shipped}}</strong>, with a quantity of <strong>{{quantity}}</strong>",
|
"New ticket request has been created": "New ticket request has been created *'{{description}}'* for day *{{shipped}}*, with a quantity of *{{quantity}}*",
|
||||||
"There's a new urgent ticket": "There's a new urgent ticket: [{{title}}](https://cau.verdnatura.es/WorkOrder.do?woMode=viewWO&woID={{issueId}})"
|
"There's a new urgent ticket": "There's a new urgent ticket: [{{title}}](https://cau.verdnatura.es/WorkOrder.do?woMode=viewWO&woID={{issueId}})"
|
||||||
}
|
}
|
|
@ -168,8 +168,8 @@
|
||||||
"The selected ticket is not suitable for this route": "El ticket seleccionado no es apto para esta ruta",
|
"The selected ticket is not suitable for this route": "El ticket seleccionado no es apto para esta ruta",
|
||||||
"Sorts whole route": "Reordena ruta entera",
|
"Sorts whole route": "Reordena ruta entera",
|
||||||
"Invalid account": "Cuenta inválida",
|
"Invalid account": "Cuenta inválida",
|
||||||
"New ticket request has been created with price": "Se ha creado una nueva petición de compra '{{description}}' para el día <strong>{{shipped}}</strong>, con una cantidad de <strong>{{quantity}}</strong> y un precio de <strong>{{price}} €</strong>",
|
"New ticket request has been created with price": "Se ha creado una nueva petición de compra *'{{description}}'* para el día *{{shipped}}*, con una cantidad de *{{quantity}}* y un precio de *{{price}} €*",
|
||||||
"New ticket request has been created": "Se ha creado una nueva petición de compra '{{description}}' para el día <strong>{{shipped}}</strong>, con una cantidad de <strong>{{quantity}}</strong>",
|
"New ticket request has been created": "Se ha creado una nueva petición de compra *'{{description}}'* para el día *{{shipped}}*, con una cantidad de *{{quantity}}*",
|
||||||
"That item doesn't exists": "Ese artículo no existe",
|
"That item doesn't exists": "Ese artículo no existe",
|
||||||
"There's a new urgent ticket": "Hay un nuevo ticket urgente: [{{title}}](https://cau.verdnatura.es/WorkOrder.do?woMode=viewWO&woID={{issueId}})"
|
"There's a new urgent ticket": "Hay un nuevo ticket urgente: [{{title}}](https://cau.verdnatura.es/WorkOrder.do?woMode=viewWO&woID={{issueId}})"
|
||||||
}
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
/**
|
||||||
|
* Transforms a UTC date to string without datetime.
|
||||||
|
*
|
||||||
|
* @param {date} date Date to format
|
||||||
|
* @return {String} Formatted date string
|
||||||
|
*/
|
||||||
|
function toString(date) {
|
||||||
|
date = new Date(date);
|
||||||
|
|
||||||
|
let day = date.getDate();
|
||||||
|
let month = date.getMonth() + 1;
|
||||||
|
let year = date.getFullYear();
|
||||||
|
|
||||||
|
if (day < 10)
|
||||||
|
day = `0${day}`;
|
||||||
|
|
||||||
|
if (month < 10)
|
||||||
|
month = `0${month}`;
|
||||||
|
|
||||||
|
return `${day}-${month}-${year}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
toString: toString
|
||||||
|
};
|
|
@ -48,7 +48,11 @@ module.exports = Self => {
|
||||||
|
|
||||||
const srcFile = image.url.split('/').pop();
|
const srcFile = image.url.split('/').pop();
|
||||||
const dotIndex = srcFile.lastIndexOf('.');
|
const dotIndex = srcFile.lastIndexOf('.');
|
||||||
const fileName = srcFile.substring(0, dotIndex);
|
|
||||||
|
let fileName = srcFile.substring(0, dotIndex);
|
||||||
|
if (dotIndex == -1)
|
||||||
|
fileName = srcFile;
|
||||||
|
|
||||||
const file = `${fileName}.png`;
|
const file = `${fileName}.png`;
|
||||||
const filePath = path.join(tempPath, file);
|
const filePath = path.join(tempPath, file);
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,8 @@
|
||||||
"stemMultiplier": {
|
"stemMultiplier": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"description": "Multiplier"
|
"description": "Multiplier"
|
||||||
},"image": {
|
},
|
||||||
|
"image": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Image"
|
"description": "Image"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
const LoopBackContext = require('loopback-context');
|
const LoopBackContext = require('loopback-context');
|
||||||
|
const dateUtil = require('vn-loopback/util/date');
|
||||||
|
|
||||||
module.exports = function(Self) {
|
module.exports = function(Self) {
|
||||||
require('../methods/ticket-request/filter')(Self);
|
require('../methods/ticket-request/filter')(Self);
|
||||||
|
@ -26,12 +27,7 @@ module.exports = function(Self) {
|
||||||
if (instance.price)
|
if (instance.price)
|
||||||
messageText = 'New ticket request has been created with price';
|
messageText = 'New ticket request has been created with price';
|
||||||
|
|
||||||
const shipped = new Intl.DateTimeFormat('es', {
|
const shipped = dateUtil.toString(ticket.shipped);
|
||||||
year: 'numeric',
|
|
||||||
month: 'numeric',
|
|
||||||
day: 'numeric'
|
|
||||||
}).format(ticket.shipped);
|
|
||||||
|
|
||||||
const message = $t(messageText, {
|
const message = $t(messageText, {
|
||||||
description: instance.description,
|
description: instance.description,
|
||||||
shipped: shipped,
|
shipped: shipped,
|
||||||
|
|
|
@ -367,6 +367,7 @@ class Controller extends Section {
|
||||||
notAvailables
|
notAvailables
|
||||||
};
|
};
|
||||||
this.newSMS = {
|
this.newSMS = {
|
||||||
|
ticketId: this.ticket.id,
|
||||||
destinationFk: this.ticket.clientFk,
|
destinationFk: this.ticket.clientFk,
|
||||||
destination: phone,
|
destination: phone,
|
||||||
message: this.$t('Product not available', params)
|
message: this.$t('Product not available', params)
|
||||||
|
|
|
@ -28,7 +28,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
const account = await Self.app.models.Account.findById(userId);
|
const account = await Self.app.models.Account.findById(userId);
|
||||||
const stmt = new ParameterizedSQL(
|
const stmt = new ParameterizedSQL(
|
||||||
`SELECT d.id dmsFk, d.reference, d.description, d.file, d.created
|
`SELECT d.id dmsFk, d.reference, d.description, d.file, d.created, d.hardCopyNumber, d.hasFile
|
||||||
FROM workerDocument wd
|
FROM workerDocument wd
|
||||||
JOIN dms d ON d.id = wd.document
|
JOIN dms d ON d.id = wd.document
|
||||||
JOIN dmsType dt ON dt.id = d.dmsTypeFk
|
JOIN dmsType dt ON dt.id = d.dmsTypeFk
|
||||||
|
|
|
@ -57,7 +57,7 @@ class Controller extends Descriptor {
|
||||||
onUploadResponse() {
|
onUploadResponse() {
|
||||||
const timestamp = new Date().getTime();
|
const timestamp = new Date().getTime();
|
||||||
const src = this.$rootScope.imagePath('user', '520x520', this.worker.id);
|
const src = this.$rootScope.imagePath('user', '520x520', this.worker.id);
|
||||||
const zoomSrc = this.$rootScope.imagePath('user', '1600x900', this.worker.id);
|
const zoomSrc = this.$rootScope.imagePath('user', '1600x1600', this.worker.id);
|
||||||
const newSrc = `${src}&t=${timestamp}`;
|
const newSrc = `${src}&t=${timestamp}`;
|
||||||
const newZoomSrc = `${zoomSrc}&t=${timestamp}`;
|
const newZoomSrc = `${zoomSrc}&t=${timestamp}`;
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
</vn-input-file>
|
</vn-input-file>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-vertical>
|
<vn-vertical>
|
||||||
<vn-check disabled="true"
|
<vn-check disabled="watcher.orgData.hasFile"
|
||||||
label="Generate identifier for original file"
|
label="Generate identifier for original file"
|
||||||
ng-model="$ctrl.dms.hasFile">
|
ng-model="$ctrl.dms.hasFile">
|
||||||
</vn-check>
|
</vn-check>
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
<vn-thead>
|
<vn-thead>
|
||||||
<vn-tr>
|
<vn-tr>
|
||||||
<vn-th field="dmsFk" shrink>Id</vn-th>
|
<vn-th field="dmsFk" shrink>Id</vn-th>
|
||||||
|
<vn-th field="hardCopyNumber" shrink number>Order</vn-th>
|
||||||
<vn-th field="reference" shrink>Reference</vn-th>
|
<vn-th field="reference" shrink>Reference</vn-th>
|
||||||
<vn-th expand>Description</vn-th>
|
<vn-th expand>Description</vn-th>
|
||||||
<vn-th field="hasFile" shrink>Original</vn-th>
|
<vn-th field="hasFile" shrink>Original</vn-th>
|
||||||
|
@ -28,6 +29,12 @@
|
||||||
<vn-tbody>
|
<vn-tbody>
|
||||||
<vn-tr ng-repeat="document in $ctrl.workerDms">
|
<vn-tr ng-repeat="document in $ctrl.workerDms">
|
||||||
<vn-td number shrink>{{::document.dmsFk}}</vn-td>
|
<vn-td number shrink>{{::document.dmsFk}}</vn-td>
|
||||||
|
<vn-td shrink number>
|
||||||
|
<span class="chip" title="{{::document.hardCopyNumber}}"
|
||||||
|
ng-class="{'message': document.hardCopyNumber}">
|
||||||
|
{{::document.hardCopyNumber}}
|
||||||
|
</span>
|
||||||
|
</vn-td>
|
||||||
<vn-td expand>
|
<vn-td expand>
|
||||||
<span title="{{::document.reference}}">
|
<span title="{{::document.reference}}">
|
||||||
{{::document.reference}}
|
{{::document.reference}}
|
||||||
|
@ -40,7 +47,7 @@
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td shrink>
|
<vn-td shrink>
|
||||||
<vn-check
|
<vn-check
|
||||||
ng-model="document.dms.hasFile"
|
ng-model="document.hasFile"
|
||||||
disabled="true">
|
disabled="true">
|
||||||
</vn-check>
|
</vn-check>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
|
|
|
@ -6,42 +6,6 @@ class Controller extends Component {
|
||||||
constructor($element, $, vnFile) {
|
constructor($element, $, vnFile) {
|
||||||
super($element, $);
|
super($element, $);
|
||||||
this.vnFile = vnFile;
|
this.vnFile = vnFile;
|
||||||
this.filter = {
|
|
||||||
include: {
|
|
||||||
relation: 'dms',
|
|
||||||
scope: {
|
|
||||||
fields: [
|
|
||||||
'dmsTypeFk',
|
|
||||||
'reference',
|
|
||||||
'hardCopyNumber',
|
|
||||||
'workerFk',
|
|
||||||
'description',
|
|
||||||
'hasFile',
|
|
||||||
'file',
|
|
||||||
'created',
|
|
||||||
],
|
|
||||||
include: [
|
|
||||||
{
|
|
||||||
relation: 'dmsType',
|
|
||||||
scope: {
|
|
||||||
fields: ['name']
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
relation: 'worker',
|
|
||||||
scope: {
|
|
||||||
fields: ['userFk'],
|
|
||||||
include: {
|
|
||||||
relation: 'user',
|
|
||||||
scope: {
|
|
||||||
fields: ['nickname']
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteDms(index) {
|
deleteDms(index) {
|
||||||
|
|
Loading…
Reference in New Issue