2737-supplier_basic_data_worker #539
|
@ -11,25 +11,37 @@ module.exports = Self => {
|
|||
type: 'Number',
|
||||
description: 'The document id',
|
||||
http: {source: 'path'}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
arg: 'warehouseId',
|
||||
type: 'Number',
|
||||
description: 'The warehouse id'
|
||||
}, {
|
||||
},
|
||||
{
|
||||
arg: 'companyId',
|
||||
type: 'Number',
|
||||
description: 'The company id'
|
||||
}, {
|
||||
},
|
||||
{
|
||||
arg: 'dmsTypeId',
|
||||
type: 'Number',
|
||||
description: 'The dms type id'
|
||||
}, {
|
||||
},
|
||||
{
|
||||
arg: 'reference',
|
||||
type: 'String'
|
||||
}, {
|
||||
},
|
||||
{
|
||||
arg: 'description',
|
||||
type: 'String'
|
||||
}, {
|
||||
},
|
||||
{
|
||||
arg: 'hasFile',
|
||||
type: 'Boolean',
|
||||
description: 'True if has an attached file',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
arg: 'hasFileAttached',
|
||||
type: 'Boolean',
|
||||
description: 'True if has an attached file'
|
||||
|
@ -70,7 +82,8 @@ module.exports = Self => {
|
|||
companyFk: args.companyId,
|
||||
warehouseFk: args.warehouseId,
|
||||
reference: args.reference,
|
||||
description: args.description
|
||||
description: args.description,
|
||||
hasFile: args.hasFile
|
||||
}, myOptions);
|
||||
|
||||
if (args.hasFileAttached)
|
||||
|
|
|
@ -57,6 +57,9 @@ module.exports = Self => {
|
|||
const entity = await models[imageCollection.model].findById(id, {
|
||||
fields: ['id', imageCollection.property]
|
||||
});
|
||||
|
||||
if (!entity) return false;
|
||||
|
||||
const image = await models.Image.findOne({where: {
|
||||
collectionFk: collection,
|
||||
name: entity[imageCollection.property]}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
"type": "string"
|
||||
},
|
||||
"hardCopyNumber": {
|
||||
"type": "Number"
|
||||
"type": "number"
|
||||
},
|
||||
"hasFile": {
|
||||
"type": "boolean"
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
"nRefs": {
|
||||
"type": "Number",
|
||||
"required": true,
|
||||
"default": 0
|
||||
"default": 1
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
"Company has to be official": "Company has to be official",
|
||||
"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",
|
||||
"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": "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 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 *{{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}})"
|
||||
}
|
|
@ -168,8 +168,8 @@
|
|||
"The selected ticket is not suitable for this route": "El ticket seleccionado no es apto para esta ruta",
|
||||
"Sorts whole route": "Reordena ruta entera",
|
||||
"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": "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 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 *{{shipped}}*, con una cantidad de *{{quantity}}*",
|
||||
"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}})"
|
||||
}
|
|
@ -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 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 filePath = path.join(tempPath, file);
|
||||
|
||||
|
|
|
@ -68,7 +68,8 @@
|
|||
"stemMultiplier": {
|
||||
"type": "number",
|
||||
"description": "Multiplier"
|
||||
},"image": {
|
||||
},
|
||||
"image": {
|
||||
"type": "string",
|
||||
"description": "Image"
|
||||
},
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
const LoopBackContext = require('loopback-context');
|
||||
const dateUtil = require('vn-loopback/util/date');
|
||||
|
||||
module.exports = function(Self) {
|
||||
require('../methods/ticket-request/filter')(Self);
|
||||
|
@ -26,12 +27,7 @@ module.exports = function(Self) {
|
|||
if (instance.price)
|
||||
messageText = 'New ticket request has been created with price';
|
||||
|
||||
const shipped = new Intl.DateTimeFormat('es', {
|
||||
year: 'numeric',
|
||||
month: 'numeric',
|
||||
day: 'numeric'
|
||||
}).format(ticket.shipped);
|
||||
|
||||
const shipped = dateUtil.toString(ticket.shipped);
|
||||
const message = $t(messageText, {
|
||||
description: instance.description,
|
||||
shipped: shipped,
|
||||
|
|
|
@ -367,6 +367,7 @@ class Controller extends Section {
|
|||
notAvailables
|
||||
};
|
||||
this.newSMS = {
|
||||
ticketId: this.ticket.id,
|
||||
destinationFk: this.ticket.clientFk,
|
||||
destination: phone,
|
||||
message: this.$t('Product not available', params)
|
||||
|
|
|
@ -28,7 +28,7 @@ module.exports = Self => {
|
|||
|
||||
const account = await Self.app.models.Account.findById(userId);
|
||||
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
|
||||
JOIN dms d ON d.id = wd.document
|
||||
JOIN dmsType dt ON dt.id = d.dmsTypeFk
|
||||
|
|
|
@ -57,7 +57,7 @@ class Controller extends Descriptor {
|
|||
onUploadResponse() {
|
||||
const timestamp = new Date().getTime();
|
||||
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 newZoomSrc = `${zoomSrc}&t=${timestamp}`;
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
</vn-input-file>
|
||||
</vn-horizontal>
|
||||
<vn-vertical>
|
||||
<vn-check disabled="true"
|
||||
<vn-check disabled="watcher.orgData.hasFile"
|
||||
label="Generate identifier for original file"
|
||||
ng-model="$ctrl.dms.hasFile">
|
||||
</vn-check>
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
<vn-thead>
|
||||
<vn-tr>
|
||||
<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 expand>Description</vn-th>
|
||||
<vn-th field="hasFile" shrink>Original</vn-th>
|
||||
|
@ -28,6 +29,12 @@
|
|||
<vn-tbody>
|
||||
<vn-tr ng-repeat="document in $ctrl.workerDms">
|
||||
<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>
|
||||
<span title="{{::document.reference}}">
|
||||
{{::document.reference}}
|
||||
|
@ -40,7 +47,7 @@
|
|||
</vn-td>
|
||||
<vn-td shrink>
|
||||
<vn-check
|
||||
ng-model="document.dms.hasFile"
|
||||
ng-model="document.hasFile"
|
||||
disabled="true">
|
||||
</vn-check>
|
||||
</vn-td>
|
||||
|
|
|
@ -6,42 +6,6 @@ class Controller extends Component {
|
|||
constructor($element, $, vnFile) {
|
||||
super($element, $);
|
||||
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) {
|
||||
|
|
Loading…
Reference in New Issue