Merge branch 'dev' into 4793-models_translation
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
commit
8876bc2b68
|
@ -0,0 +1 @@
|
|||
DROP PROCEDURE IF EXISTS `vn`.`collection_missingTrash`;
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE `vn`.`greuge` CHANGE `userFK` `userFk` int(10) unsigned DEFAULT NULL NULL;
|
|
@ -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'
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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>
|
|
@ -8,6 +8,12 @@ class Controller extends Section {
|
|||
include: [
|
||||
{
|
||||
relation: 'greugeType',
|
||||
scope: {
|
||||
fields: ['id', 'name']
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'user',
|
||||
scope: {
|
||||
fields: ['id', 'name']
|
||||
}
|
||||
|
|
|
@ -2,3 +2,4 @@ Date: Fecha
|
|||
Comment: Comentario
|
||||
Amount: Importe
|
||||
Type: Tipo
|
||||
Created by: Creado por
|
|
@ -20,6 +20,13 @@
|
|||
translate>
|
||||
Update volume
|
||||
</vn-item>
|
||||
<vn-item
|
||||
ng-click="$ctrl.deleteCurrentRoute()"
|
||||
vn-acl="deliveryBoss"
|
||||
vn-acl-action="remove"
|
||||
translate>
|
||||
Delete route
|
||||
</vn-item>
|
||||
</slot-menu>
|
||||
<slot-body>
|
||||
<div class="attributes">
|
||||
|
|
|
@ -34,6 +34,14 @@ class Controller extends Descriptor {
|
|||
});
|
||||
}
|
||||
|
||||
deleteCurrentRoute() {
|
||||
this.$http.delete(`Routes/${this.id}`)
|
||||
.then(() => {
|
||||
this.vnApp.showSuccess(this.$t('Route deleted'));
|
||||
this.$state.go('route.index');
|
||||
});
|
||||
}
|
||||
|
||||
loadData() {
|
||||
const filter = {
|
||||
fields: [
|
||||
|
|
|
@ -23,4 +23,20 @@ describe('vnRouteDescriptorPopover', () => {
|
|||
expect(controller.route).toEqual(response);
|
||||
});
|
||||
});
|
||||
|
||||
describe('deleteCurrentRoute()', () => {
|
||||
it(`should perform a delete query to delete the current route`, () => {
|
||||
const id = 1;
|
||||
|
||||
jest.spyOn(controller.vnApp, 'showSuccess');
|
||||
|
||||
controller._id = id;
|
||||
$httpBackend.expectDELETE(`Routes/${id}`).respond(200);
|
||||
controller.deleteCurrentRoute();
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller.route).toBeUndefined();
|
||||
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Route deleted');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -4,4 +4,6 @@ Send route report: Enviar informe de ruta
|
|||
Show route report: Ver informe de ruta
|
||||
Update volume: Actualizar volumen
|
||||
Volume updated: Volumen actualizado
|
||||
Delete route: Borrar ruta
|
||||
Route deleted: Ruta borrada
|
||||
Are you sure you want to update the volume?: Estas seguro que quieres actualizar el volumen?
|
Loading…
Reference in New Issue