Merge branch 'dev' into 5472-user_passExpired
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2023-06-12 05:04:28 +00:00
commit d735f142a1
15 changed files with 113 additions and 78 deletions

View File

@ -19,9 +19,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
- (Tickets -> Abono) Al abonar permite crear el ticket abono con almacén o sin almmacén - (Tickets -> Abono) Al abonar permite crear el ticket abono con almacén o sin almmacén
- (General -> Desplegables) Mejorada eficiencia de carga de datos - (General -> Desplegables) Mejorada eficiencia de carga de datos
- (General -> Históricos) Ahora, ademas de los ids, se muestra la descripión de los atributos
- (General -> Históricos) Botón para hacer más ágil mostrar sólo los cambios en un registro
- (General -> Históricos) Filtro por cambios
### Changed ### Changed
- (General -> Permisos) Mejorada seguridad - (General -> Permisos) Mejorada seguridad
- (General -> Históricos) Elementos de la interfaz reorganizados para hacerla más ágil e intuitiva
### Fixed ### Fixed
- -

View File

@ -2790,7 +2790,9 @@ INSERT INTO `vn`.`ticketLog` (`originFk`, userFk, `action`, changedModel, oldIns
(7, 18, 'update', 'Sale', '{"quantity":1}', '{"quantity":10}', 1, NULL), (7, 18, 'update', 'Sale', '{"quantity":1}', '{"quantity":10}', 1, NULL),
(7, 18, 'update', 'Ticket', '{"quantity":1,"concept":"Chest ammo box"}', '{"quantity":10,"concept":"Chest ammo box"}', 1, NULL), (7, 18, 'update', 'Ticket', '{"quantity":1,"concept":"Chest ammo box"}', '{"quantity":10,"concept":"Chest ammo box"}', 1, NULL),
(7, 18, 'update', 'Sale', '{"price":3}', '{"price":5}', 1, NULL), (7, 18, 'update', 'Sale', '{"price":3}', '{"price":5}', 1, NULL),
(7, 18, 'update', NULL, NULL, NULL, NULL, "Cambio cantidad Melee weapon heavy shield 1x0.5m de '5' a '10'"); (7, 18, 'update', NULL, NULL, NULL, NULL, "Cambio cantidad Melee weapon heavy shield 1x0.5m de '5' a '10'"),
(16, 9, 'update', 'Sale', '{"quantity":10,"concept":"Shield", "price": 10.5, "itemFk": 1}', '{"quantity":8,"concept":"Shield", "price": 10.5, "itemFk": 1}' , 5689, 'Shield');
INSERT INTO `vn`.`ticketLog` (originFk, userFk, `action`, creationDate, changedModel, changedModelId, changedModelValue, oldInstance, newInstance, description) INSERT INTO `vn`.`ticketLog` (originFk, userFk, `action`, creationDate, changedModel, changedModelId, changedModelValue, oldInstance, newInstance, description)
VALUES VALUES
@ -2804,7 +2806,6 @@ INSERT INTO `vn`.`ticketLog` (originFk, userFk, `action`, creationDate, changedM
(1, 18, 'select', '2000-12-27 03:40:30', 'Ticket', 45, NULL , NULL, NULL, NULL), (1, 18, 'select', '2000-12-27 03:40:30', 'Ticket', 45, NULL , NULL, NULL, NULL),
(1, 18, 'insert', '2000-04-10 09:40:15', 'Sale', 5689, 'Shield' , NULL, '{"quantity":10,"concept":"Shield", "price": 10.5, "itemFk": 1}', NULL), (1, 18, 'insert', '2000-04-10 09:40:15', 'Sale', 5689, 'Shield' , NULL, '{"quantity":10,"concept":"Shield", "price": 10.5, "itemFk": 1}', NULL),
(1, 18, 'insert', '1999-05-09 10:00:00', 'Ticket', 45, 'Super Man' , NULL, '{"id":45,"clientFk":8608,"warehouseFk":60,"shipped":"2023-05-16T22:00:00.000Z","nickname":"Super Man","addressFk":48637,"isSigned":true,"isLabeled":true,"isPrinted":true,"packages":0,"hour":0,"created":"2023-05-16T11:42:56.000Z","isBlocked":false,"hasPriority":false,"companyFk":442,"agencyModeFk":639,"landed":"2023-05-17T22:00:00.000Z","isBoxed":true,"isDeleted":true,"zoneFk":713,"zonePrice":13,"zoneBonus":0}', NULL); (1, 18, 'insert', '1999-05-09 10:00:00', 'Ticket', 45, 'Super Man' , NULL, '{"id":45,"clientFk":8608,"warehouseFk":60,"shipped":"2023-05-16T22:00:00.000Z","nickname":"Super Man","addressFk":48637,"isSigned":true,"isLabeled":true,"isPrinted":true,"packages":0,"hour":0,"created":"2023-05-16T11:42:56.000Z","isBlocked":false,"hasPriority":false,"companyFk":442,"agencyModeFk":639,"landed":"2023-05-17T22:00:00.000Z","isBoxed":true,"isDeleted":true,"zoneFk":713,"zonePrice":13,"zoneBonus":0}', NULL);
INSERT INTO `vn`.`osTicketConfig` (`id`, `host`, `user`, `password`, `oldStatus`, `newStatusId`, `day`, `comment`, `hostDb`, `userDb`, `passwordDb`, `portDb`, `responseType`, `fromEmailId`, `replyTo`) INSERT INTO `vn`.`osTicketConfig` (`id`, `host`, `user`, `password`, `oldStatus`, `newStatusId`, `day`, `comment`, `hostDb`, `userDb`, `passwordDb`, `portDb`, `responseType`, `fromEmailId`, `replyTo`)
VALUES VALUES
(0, 'http://localhost:56596/scp', 'ostadmin', 'Admin1', '1,6', 3, 60, 'Este CAU se ha cerrado automáticamente. Si el problema persiste responda a este mensaje.', 'localhost', 'osticket', 'osticket', 40003, 'reply', 1, 'all'); (0, 'http://localhost:56596/scp', 'ostadmin', 'Admin1', '1,6', 3, 60, 'Este CAU se ha cerrado automáticamente. Si el problema persiste responda a este mensaje.', 'localhost', 'osticket', 'osticket', 40003, 'reply', 1, 'all');

View File

@ -1,4 +1,11 @@
@import "./variables";
@import "./effects";
@mixin mobile {
@media screen and (max-width: $mobile-width) {
@content;
}
}
@mixin browser($browser) { @mixin browser($browser) {
html[data-browser*="#{$browser}"] & { html[data-browser*="#{$browser}"] & {
@content; @content;

View File

@ -1,5 +1,3 @@
@import "./util";
$font-size: 11pt; $font-size: 11pt;
$menu-width: 256px; $menu-width: 256px;
$topbar-height: 56px; $topbar-height: 56px;

View File

@ -1,4 +1,4 @@
@import "variables"; @import "util";
@keyframes fadein { @keyframes fadein {
from { from {
@ -16,7 +16,7 @@ vn-background {
background-color: black; background-color: black;
z-index: 14; z-index: 14;
@media screen and (max-width: $mobile-width) { @include mobile {
&.shown { &.shown {
display: block; display: block;
opacity: .3; opacity: .3;

View File

@ -1,4 +1,4 @@
@import "effects"; @import "util";
vn-layout { vn-layout {
& > vn-topbar { & > vn-topbar {
@ -134,7 +134,7 @@ vn-layout {
border-radius: 50%; border-radius: 50%;
} }
} }
@media screen and (max-width: $mobile-width) { @include mobile {
& > vn-topbar { & > vn-topbar {
& > .start > .logo { & > .start > .logo {
display: none; display: none;

View File

@ -16,7 +16,7 @@
</vn-crud-model> </vn-crud-model>
<vn-data-viewer <vn-data-viewer
model="model" model="model"
class="vn-w-sm vn-px-sm"> class="vn-w-sm vn-px-sm vn-pb-xl">
<div class="change vn-mb-sm" ng-repeat="log in $ctrl.logs"> <div class="change vn-mb-sm" ng-repeat="log in $ctrl.logs">
<div class="left"> <div class="left">
<vn-avatar class="vn-mt-xs" <vn-avatar class="vn-mt-xs"
@ -33,17 +33,6 @@
</div> </div>
<vn-card class="detail"> <vn-card class="detail">
<div class="header vn-pa-sm"> <div class="header vn-pa-sm">
<div
class="action-date text-secondary text-caption vn-mr-sm"
title="{{::log.creationDate | date:'dd/MM/yyyy HH:mm:ss'}}">
<vn-icon
class="action vn-mr-xs"
ng-class="::$ctrl.actionsClass[log.action]"
icon="{{::$ctrl.actionsIcon[log.action]}}"
translate-attr="::{title: $ctrl.actionsText[log.action]}">
</vn-icon>
{{::$ctrl.relativeDate(log.creationDate)}}
</div>
<div class="action-model"> <div class="action-model">
<span class="model-name" <span class="model-name"
ng-if="::$ctrl.showModelName && log.changedModel" ng-if="::$ctrl.showModelName && log.changedModel"
@ -52,10 +41,26 @@
{{::log.changedModelI18n}} {{::log.changedModelI18n}}
</span> </span>
</div> </div>
<div
class="action-date text-secondary text-caption vn-ml-sm"
title="{{::log.creationDate | date:'dd/MM/yyyy HH:mm:ss'}}">
{{::$ctrl.relativeDate(log.creationDate)}}
<vn-icon
class="action vn-ml-xs"
ng-class="::$ctrl.actionsClass[log.action]"
icon="{{::$ctrl.actionsIcon[log.action]}}"
translate-attr="::{title: $ctrl.actionsText[log.action]}">
</vn-icon>
</div>
</div> </div>
<div class="model vn-pb-sm vn-px-sm" <div class="model vn-pb-sm vn-px-sm"
ng-if="::log.changedModelId || log.changedModelValue"> ng-if="::$ctrl.showModelName">
<span class="model-id" ng-if="::log.changedModelId">#{{::log.changedModelId}}</span> <span class="model-id" ng-if="::log.changedModelId">#{{::log.changedModelId}}</span>
<vn-icon
icon="filter_alt"
translate-attr="{title: 'Show all record changes'}"
ng-click="$ctrl.filterByEntity(log)">
</vn-icon>
<span class="model-value" title="{{::log.changedModelValue}}">{{::log.changedModelValue}}</span> <span class="model-value" title="{{::log.changedModelValue}}">{{::log.changedModelValue}}</span>
</div> </div>
<div class="changes vn-pa-sm" <div class="changes vn-pa-sm"
@ -94,10 +99,36 @@
</div> </div>
</div> </div>
</vn-data-viewer> </vn-data-viewer>
<vn-float-button
ng-if="model.userFilter"
icon="filter_alt_off"
translate-attr="{title: 'Quit filter'}"
ng-click="$ctrl.resetFilter()"
fixed-bottom-right>
</vn-float-button>
<vn-side-menu side="right"> <vn-side-menu side="right">
<form vn-vertical <form vn-vertical
ng-model-options="{updateOn: 'change blur'}" ng-model-options="{updateOn: 'change blur'}"
class="vn-pa-md filter"> class="vn-pa-md filter">
<vn-textfield
label="Search"
ng-model="filter.search">
<append>
<vn-icon
icon="info_outline"
vn-tooltip="Search by id or concept"
pointer>
</vn-icon>
</append>
</vn-textfield>
<vn-autocomplete
label="Entity"
ng-model="filter.changedModel"
value-field="changedModel"
show-field="changedModelI18n"
data="$ctrl.models"
class="changed-model">
</vn-autocomplete>
<vn-vertical> <vn-vertical>
<vn-radio <vn-radio
label="All" label="All"
@ -142,25 +173,6 @@
</div> </div>
</tpl-item> </tpl-item>
</vn-autocomplete> </vn-autocomplete>
<vn-textfield
label="Search"
ng-model="filter.search">
<append>
<vn-icon
icon="info_outline"
vn-tooltip="Search by id or concept"
pointer>
</vn-icon>
</append>
</vn-textfield>
<vn-autocomplete
label="Entity"
ng-model="filter.changedModel"
value-field="changedModel"
show-field="changedModelI18n"
data="$ctrl.models"
class="changed-model">
</vn-autocomplete>
<vn-textfield <vn-textfield
label="Changes" label="Changes"
ng-model="filter.changes"> ng-model="filter.changes">
@ -198,18 +210,6 @@
label="To" label="To"
ng-model="filter.to"> ng-model="filter.to">
</vn-date-picker> </vn-date-picker>
<vn-button-bar vn-vertical>
<vn-button
label="Filter"
ng-click="$ctrl.applyFilter(filter)">
</vn-button>
<vn-button
label="Reset"
class="flat"
ng-click="$ctrl.resetFilter()"
ng-if="model.userFilter">
</vn-button>
</vn-button-bar>
</form> </form>
</vn-side-menu> </vn-side-menu>
<vn-worker-descriptor-popover vn-id="workerDescriptor"> <vn-worker-descriptor-popover vn-id="workerDescriptor">

View File

@ -165,11 +165,10 @@ export default class Controller extends Section {
switch (prop) { switch (prop) {
case 'search': case 'search':
const or = []; const or = [];
if (/^[\w_-]+$/.test(value)) if (/^\s*[0-9]+\s*$/.test(value))
or.push({changedModelId: value}); return {changedModelId: value.trim()};
if (!/^[0-9]+$/.test(value)) else
or.push({changedModelValue: {like: `%${value}%`}}); return {changedModelValue: {like: `%${value}%`}};
return or.length ? {or} : null;
case 'changes': case 'changes':
return {or: [ return {or: [
{oldJson: {like: `%${value}%`}}, {oldJson: {like: `%${value}%`}},
@ -222,6 +221,14 @@ export default class Controller extends Section {
return this.$.model.applyFilter(lbFilter); return this.$.model.applyFilter(lbFilter);
} }
filterByEntity(log) {
this.$.filter = {
who: 'all',
search: log.changedModelId,
changedModel: log.changedModel
};
}
searchUser(search) { searchUser(search) {
if (/^[0-9]+$/.test(search)) { if (/^[0-9]+$/.test(search)) {
return {id: search}; return {id: search};

View File

@ -3,8 +3,8 @@ Concept: Concepto
Search: Buscar Search: Buscar
Search by id or concept: Buscar por identificador o concepto Search by id or concept: Buscar por identificador o concepto
Search by changes: | Search by changes: |
Buscar por cambios realizados. Los atributos deben buscarse por su nombre Buscar por cambios. Los atributos deben buscarse por su nombre interno,
interno, para obtenerlo situar el cursor sobre el nombre. para obtenerlo situar el cursor sobre el atributo.
Entity: Entidad Entity: Entidad
Action: Acción Action: Acción
Author: Autor Author: Autor
@ -16,9 +16,12 @@ Creates: Crea
Edits: Modifica Edits: Modifica
Deletes: Elimina Deletes: Elimina
Accesses: Accede Accesses: Accede
All: Todo
System: Sistema System: Sistema
Details: Detalles Details: Detalles
note: nota note: nota
Changes: Cambios Changes: Cambios
today: hoy today: hoy
yesterday: ayer yesterday: ayer
Show all record changes: Mostrar todos los cambios realizados en el registro
Quit filter: Quitar filtro

View File

@ -1,5 +1,4 @@
@import "variables"; @import "util";
@import "effects";
vn-log { vn-log {
.change { .change {
@ -77,7 +76,7 @@ vn-log {
border-radius: 50%; border-radius: 50%;
width: 24px; width: 24px;
height: 24px; height: 24px;
font-size: 1.4em; font-size: 18px;
&.notice { &.notice {
background-color: $color-notice-medium background-color: $color-notice-medium
@ -98,16 +97,33 @@ vn-log {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
max-height: 18px;
& > vn-icon {
@extend %clickable-light;
vertical-align: middle;
padding: 2px;
margin: -2px;
font-size: 18px;
color: $color-font-secondary;
float: right;
display: none;
@include mobile {
display: initial;
}
}
& > .model-value { & > .model-value {
font-style: italic; font-style: italic;
} }
& > .model-id { & > .model-id {
color: $color-font-secondary; color: $color-font-secondary;
font-size: .9rem; font-size: .9rem;
float: right;
} }
} }
&:hover > .model > vn-icon {
display: initial;
}
} }
} }
.changes { .changes {

View File

@ -1,5 +1,4 @@
@import "./variables"; @import "./util";
@import "./effects";
form vn-horizontal { form vn-horizontal {
align-items: center; align-items: center;
@ -22,10 +21,10 @@ form vn-horizontal {
} }
} }
@media screen and (max-width: $mobile-width) { @include mobile {
flex-direction: column; flex-direction: column;
align-items: initial; align-items: initial;
& > * { & > * {
&, &,
&:first-child, &:first-child,

View File

@ -68,7 +68,7 @@
</span> </span>
</vn-td> </vn-td>
<vn-td number>{{::clientInforma.rating}}</vn-td> <vn-td number>{{::clientInforma.rating}}</vn-td>
<vn-td number>{{::clientInforma.recommendedCredit}}</vn-td> <vn-td>{{::clientInforma.recommendedCredit | currency: 'EUR': 2}}</vn-td>
</vn-tr> </vn-tr>
</vn-tbody> </vn-tbody>
</vn-table> </vn-table>

View File

@ -61,15 +61,15 @@ module.exports = Self => {
const oldQuantity = log.oldInstance.quantity; const oldQuantity = log.oldInstance.quantity;
const newQuantity = log.newInstance?.quantity || 0; const newQuantity = log.newInstance?.quantity || 0;
if (oldQuantity || newQuantity) { if (oldQuantity > newQuantity) {
const changeMessage = $t('Change quantity', { const changeMessage = $t('Change quantity', {
concept: log.changedModelValue, concept: log.changedModelValue,
oldQuantity: oldQuantity || 0, oldQuantity: oldQuantity || 0,
newQuantity: newQuantity || 0, newQuantity: newQuantity || 0,
}); });
changes.push(changeMessage); changes.push(changeMessage);
} }
} }
return changes.join('\n'); return changes.join('\n');
}; };

View File

@ -7,7 +7,7 @@ describe('ticketLog getChanges()', () => {
return value; return value;
}; };
it('should return the changes in the sales of a ticket', async() => { it('should return the changes in the sales of a ticket', async() => {
const ticketId = 7; const ticketId = 16;
const changues = await models.TicketLog.getChanges(ctx, ticketId); const changues = await models.TicketLog.getChanges(ctx, ticketId);

View File

@ -23,4 +23,4 @@ Restore ticket: Restaurar ticket
You are going to restore this ticket: Vas a restaurar este ticket You are going to restore this ticket: Vas a restaurar este ticket
Are you sure you want to restore this ticket?: ¿Seguro que quieres restaurar el ticket? Are you sure you want to restore this ticket?: ¿Seguro que quieres restaurar el ticket?
Are you sure you want to refund all?: ¿Seguro que quieres abonar todo? Are you sure you want to refund all?: ¿Seguro que quieres abonar todo?
Send changes: "Verdnatura le recuerda:\rPedido {{ticketId}} día {{created | date: 'dd/MM/yyyy'}}\r{{changes}}" Send changes: "Verdnatura:\rPedido {{ticketId}}\r{{changes}}"