Merge branch 'dev' into 4793-models_translation
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Vicent Llopis 2022-11-22 08:12:07 +00:00
commit 8876bc2b68
12 changed files with 71 additions and 6 deletions

View File

@ -0,0 +1 @@
DROP PROCEDURE IF EXISTS `vn`.`collection_missingTrash`;

View File

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

View File

@ -2701,7 +2701,7 @@ INSERT INTO `util`.`notificationSubscription` (`notificationFk`, `userFk`)
INSERT INTO `vn`.`routeConfig` (`id`, `defaultWorkCenterFk`)
VALUES
(1, 9);
INSERT INTO `vn`.`productionConfig` (`isPreviousPreparationRequired`, `ticketPrintedMax`, `ticketTrolleyMax`, `rookieDays`, `notBuyingMonths`, `id`, `isZoneClosedByExpeditionActivated`, `maxNotReadyCollections`, `minTicketsToCloseZone`, `movingTicketDelRoute`, `defaultZone`, `defautlAgencyMode`, `hasUniqueCollectionTime`, `maxCollectionWithoutUser`, `pendingCollectionsOrder`, `pendingCollectionsAge`)
VALUES
(0, 8, 80, 0, 0, 1, 0, 15, 25, -1, 697, 1328, 0, 1, 8, 6);

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

View File

@ -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">

View File

@ -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: [

View File

@ -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');
});
});
});

View File

@ -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?