Merge branch 'dev' into 4767-route.index-delete-route
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Pau 2022-11-21 08:46:32 +00:00
commit b788415920
6 changed files with 36 additions and 5 deletions

View File

@ -0,0 +1 @@
ALTER TABLE `vn`.`greuge` CHANGE `userFK` `userFk` int(10) unsigned DEFAULT NULL NULL;

View File

@ -1,6 +1,21 @@
const LoopBackContext = require('loopback-context');
module.exports = function(Self) {
require('../methods/greuge/sumAmount')(Self);
Self.observe('before save', function(ctx, next) {
const loopBackContext = LoopBackContext.getCurrentContext();
let userFk = loopBackContext.active.accessToken.userId;
if (ctx.instance)
ctx.instance.userFk = userFk;
else
ctx.data.userFk = userFk;
next();
});
Self.validatesLengthOf('description', {
max: 45,
message: 'Description should have maximum of 45 characters'

View File

@ -2,9 +2,9 @@
"name": "Greuge",
"base": "Loggable",
"log": {
"model": "ClientLog",
"relation": "client",
"showField": "description"
"model": "ClientLog",
"relation": "client",
"showField": "description"
},
"options": {
"mysql": {
@ -35,7 +35,6 @@
"type": "number",
"required": true
}
},
"relations": {
"client": {
@ -52,6 +51,11 @@
"type": "belongsTo",
"model": "GreugeType",
"foreignKey": "greugeTypeFk"
},
"user": {
"type": "belongsTo",
"model": "Account",
"foreignKey": "userFk"
}
}
}

View File

@ -29,6 +29,7 @@
<vn-thead>
<vn-tr>
<vn-th field="shipped" default-order="DESC" expand>Date</vn-th>
<vn-th field="userFk">Created by</vn-thfield></vn-th>
<vn-th field="description">Comment</vn-th>
<vn-th field="greugeTypeFk">Type</vn-th>
<vn-th field="amount" number>Amount</vn-th>
@ -37,6 +38,8 @@
<vn-tbody>
<vn-tr ng-repeat="greuge in greuges">
<vn-td shrink-datetime>{{::greuge.shipped | date:'dd/MM/yyyy HH:mm' }}</vn-td>
<vn-td><span ng-click="workerDescriptor.show($event, greuge.user.id)"
class="link">{{::greuge.user.name}}</span></vn-td>
<vn-td>
<span title="{{::greuge.description}}">{{::greuge.description}}</span>
</vn-td>
@ -57,3 +60,4 @@
vn-bind="+"
fixed-bottom-right>
</vn-float-button>
<vn-worker-descriptor-popover vn-id="workerDescriptor"></vn-worker-descriptor-popover>

View File

@ -8,6 +8,12 @@ class Controller extends Section {
include: [
{
relation: 'greugeType',
scope: {
fields: ['id', 'name']
},
},
{
relation: 'user',
scope: {
fields: ['id', 'name']
}

View File

@ -1,4 +1,5 @@
Date: Fecha
Comment: Comentario
Amount: Importe
Type: Tipo
Type: Tipo
Created by: Creado por