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
- (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 -> 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
- (General -> Permisos) Mejorada seguridad
- (General -> Históricos) Elementos de la interfaz reorganizados para hacerla más ágil e intuitiva
### 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', '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', 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)
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, '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);
INSERT INTO `vn`.`osTicketConfig` (`id`, `host`, `user`, `password`, `oldStatus`, `newStatusId`, `day`, `comment`, `hostDb`, `userDb`, `passwordDb`, `portDb`, `responseType`, `fromEmailId`, `replyTo`)
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');

View File

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

View File

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

View File

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

View File

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

View File

@ -16,7 +16,7 @@
</vn-crud-model>
<vn-data-viewer
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="left">
<vn-avatar class="vn-mt-xs"
@ -33,17 +33,6 @@
</div>
<vn-card class="detail">
<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">
<span class="model-name"
ng-if="::$ctrl.showModelName && log.changedModel"
@ -52,10 +41,26 @@
{{::log.changedModelI18n}}
</span>
</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 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>
<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>
</div>
<div class="changes vn-pa-sm"
@ -94,10 +99,36 @@
</div>
</div>
</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">
<form vn-vertical
ng-model-options="{updateOn: 'change blur'}"
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-radio
label="All"
@ -142,25 +173,6 @@
</div>
</tpl-item>
</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
label="Changes"
ng-model="filter.changes">
@ -198,18 +210,6 @@
label="To"
ng-model="filter.to">
</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>
</vn-side-menu>
<vn-worker-descriptor-popover vn-id="workerDescriptor">

View File

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

View File

@ -3,8 +3,8 @@ Concept: Concepto
Search: Buscar
Search by id or concept: Buscar por identificador o concepto
Search by changes: |
Buscar por cambios realizados. Los atributos deben buscarse por su nombre
interno, para obtenerlo situar el cursor sobre el nombre.
Buscar por cambios. Los atributos deben buscarse por su nombre interno,
para obtenerlo situar el cursor sobre el atributo.
Entity: Entidad
Action: Acción
Author: Autor
@ -16,9 +16,12 @@ Creates: Crea
Edits: Modifica
Deletes: Elimina
Accesses: Accede
All: Todo
System: Sistema
Details: Detalles
note: nota
Changes: Cambios
today: hoy
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 "effects";
@import "util";
vn-log {
.change {
@ -77,7 +76,7 @@ vn-log {
border-radius: 50%;
width: 24px;
height: 24px;
font-size: 1.4em;
font-size: 18px;
&.notice {
background-color: $color-notice-medium
@ -98,16 +97,33 @@ vn-log {
overflow: hidden;
text-overflow: ellipsis;
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 {
font-style: italic;
}
& > .model-id {
color: $color-font-secondary;
font-size: .9rem;
float: right;
}
}
&:hover > .model > vn-icon {
display: initial;
}
}
}
.changes {

View File

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

View File

@ -68,7 +68,7 @@
</span>
</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-tbody>
</vn-table>

View File

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

View File

@ -7,7 +7,7 @@ describe('ticketLog getChanges()', () => {
return value;
};
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);

View File

@ -23,4 +23,4 @@ Restore ticket: Restaurar 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 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}}"