Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor bugs #182

Merged
merged 4 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,264 changes: 1,763 additions & 501 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "ops-web",
"version": "1.0.0",
"version": "1.0.1",
"private": true,
"engines": {
"node": "16.13"
},
"scripts": {
"build": "ng build --configuration ${ENV_NAME}",
"start": "ng serve"
},
},
"dependencies": {
"@angular/animations": "^14.2.0",
"@angular/cdk": "^14.2.0",
Expand All @@ -32,10 +32,10 @@
"big.js": "^6.2.1",
"bootstrap": "^5.2.0",
"core-js": "^3.25.0",
"encrypt-storage": "^2.12.22",
"file-saver": "^2.0.5",
"moment": "^2.29.4",
"rxjs": "~7.5.6",
"secure-ls": "^1.2.6",
"tslib": "^2.0.0",
"zone.js": "~0.11.8"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,19 @@
<div class="app-batch-actions-box d-flex flex-column align-items-end flex-md-row-reverse align-items-md-center border rounded my-2">
<div class="mb-0 d-flex flex-row flex-md-column align-items-center justify-content-center">
<button class="btn btn-outline-secondary m-1" type="button"
ngbPopover="Limpiar Seleccionados" triggers="mouseenter:mouseleave" placement="left"
(click)="clearAll()" [disabled]="!batchActionsService.count(batchActionKey)">
<fa-icon [icon]="['fas', 'broom']"></fa-icon>
</button>
<div ngbDropdown placement="bottom-right" class="ms-2 d-inline-block toggle-columns-dropdown">
<button type="button" class="btn btn-primary" ngbDropdownToggle>
<fa-icon [icon]="['fas', 'square-check']"></fa-icon>
{{ count }}<span class="visually-hidden" id="selection-options">Opciones de Selección</span>
</button>
<div ngbDropdownMenu aria-labelledby="selection-options">
<ng-container *ngFor="let a of actions">
<button class="btn btn-primary m-1" type="button" *ngIf="isButtonVisible(a)"
[ngbPopover]="a.description" triggers="mouseenter:mouseleave" placement="left"
(click)="actionClick(a)" [disabled]="!batchActionsService.count(batchActionKey)">
<fa-icon [icon]="a.icon"></fa-icon>
<button ngbDropdownItem type="button" *ngIf="isButtonVisible(a)"
(click)="actionClick(a)" [disabled]="!count"
>
<fa-icon [icon]="a.icon"></fa-icon> {{ a.description }}
</button>
</ng-container>
</div>
<div class="w-100 p-1 d-flex flex-column flex-sm-row flex-sm-wrap">
<div class="p-1" *ngFor="let e of batchActionsService.getElements(batchActionKey);">
<div class="d-flex flex-row justify-content-between align-items-center px-2 py-1 border border-secondary rounded">
<div class="description fw-bold small">{{ e.description }}</div>
<div class="flex-grow-0 flex-shrink-0">
<button class="btn btn-sm btn-primary ms-2" type="button" (click)="removeItem(e.id)">
<fa-icon [icon]="['fas', 'broom']"></fa-icon>
</button>
</div>
</div>
</div>
<button ngbDropdownItem type="button"
(click)="clearAll()" [disabled]="!count">
<fa-icon [icon]="['fas', 'broom']"></fa-icon> Limpiar seleccionados
</button>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ export class BatchActionsBoxComponent {

@Output() emptySelection = new EventEmitter<void>();

constructor(public batchActionsService: BatchActionsService,
constructor(private batchActionsService: BatchActionsService,
private mensajeService: MensajeService) { }

clearAll() {
const msg = '¿Desea quitar todos los elementos de la selección?';
const msg = `¿Desea quitar los ${this.count} elementos de la selección?`;
this.mensajeService.msg(msg, MensajeModalType.CONFIRM).then((result) => {
if (result) {
this.batchActionsService.clear(this.batchActionKey);
Expand All @@ -42,7 +42,7 @@ export class BatchActionsBoxComponent {

removeItem(elementId: number) {
this.batchActionsService.removeElememt(this.batchActionKey, elementId);
if (!this.batchActionsService.count(this.batchActionKey)) {
if (!this.count) {
this.emptySelection.emit();
}
}
Expand All @@ -63,4 +63,8 @@ export class BatchActionsBoxComponent {
}
return true;
}

get count() {
return this.batchActionsService.count(this.batchActionKey);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ <h1 class="h3 m-0 flex-fill text-truncate">
<div class="me-2" *ngIf="r.descripcion"><span class="fw-bold">Detalle: </span>{{ r.descripcion }}</div>
</div>
</td>
<td class="text-end">{{ r.monto < 0 ? (r.monto * -1 | currency:'ARS':'symbol':'1.2-2') : '' }}</td>
<td class="text-end">{{ r.monto > 0 ? (r.monto | currency:'ARS':'symbol':'1.2-2') : '' }}</td>
<td class="text-end">{{ enDebeOHaber(r) === 'D' ? (r.monto * -1 | currency:'ARS':'symbol':'1.2-2') : '' }}</td>
<td class="text-end">{{ enDebeOHaber(r) === 'H' ? (r.monto | currency:'ARS':'symbol':'1.2-2') : '' }}</td>
<td class="text-end" [class.table-danger]="r.saldo.toFixed(2) < 0" [class.table-success]="r.saldo.toFixed(2) > 0">
{{ r.saldo | currency:'ARS':'symbol':'1.2-2' }}
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,31 @@ export class CuentaCorrienteClienteComponent extends ListadoDirective implements
TipoDeComprobante.NOTA_DEBITO_C,
];

tiposDeComprobantesDebe: TipoDeComprobante[] = [
TipoDeComprobante.FACTURA_A,
TipoDeComprobante.FACTURA_B,
TipoDeComprobante.FACTURA_C,
TipoDeComprobante.FACTURA_X,
TipoDeComprobante.FACTURA_Y,
TipoDeComprobante.PRESUPUESTO,
TipoDeComprobante.NOTA_DEBITO_A,
TipoDeComprobante.NOTA_DEBITO_B,
TipoDeComprobante.NOTA_DEBITO_C,
TipoDeComprobante.NOTA_DEBITO_X,
TipoDeComprobante.NOTA_DEBITO_Y,
TipoDeComprobante.NOTA_DEBITO_PRESUPUESTO,
];

tiposDeComprobantesHaber: TipoDeComprobante[] = [
TipoDeComprobante.RECIBO,
TipoDeComprobante.NOTA_CREDITO_A,
TipoDeComprobante.NOTA_CREDITO_B,
TipoDeComprobante.NOTA_CREDITO_C,
TipoDeComprobante.NOTA_CREDITO_X,
TipoDeComprobante.NOTA_CREDITO_Y,
TipoDeComprobante.NOTA_CREDITO_PRESUPUESTO,
];

helper = HelperService;

constructor(protected route: ActivatedRoute,
Expand Down Expand Up @@ -531,4 +556,16 @@ export class CuentaCorrienteClienteComponent extends ListadoDirective implements
modalRef.componentInstance.saldo = saldo;
modalRef.result.then(() => this.loadPage(1), () => { return; });
}

enDebeOHaber(r: RenglonCuentaCorriente): string {
if (this.tiposDeComprobantesDebe.indexOf(r.tipoComprobante) >= 0) {
return 'D';
}

if (this.tiposDeComprobantesHaber.indexOf(r.tipoComprobante) >= 0) {
return 'H';
}

return '';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,12 @@ export class CuentasCorrientesClienteComponent extends ListadoDirective implemen
this.loadingOverlayService.activate();
this.ubicacionesService.getLocalidades(value)
.pipe(finalize(() => this.loadingOverlayService.deactivate()))
.subscribe(
localidades => this.localidades = localidades,
err => this.mensajeService.msg(err.error, MensajeModalType.ERROR),
)
.subscribe({
next: localidades => this.localidades = localidades,
error: err => {
this.mensajeService.msg(err.error, MensajeModalType.ERROR);
},
})
;
})
;
Expand All @@ -164,10 +166,9 @@ export class CuentasCorrientesClienteComponent extends ListadoDirective implemen
}

if (values.idViajante) {
this.appliedFilters.push({ label: 'Rubro', value: values.idRubro, asyncFn: this.getUsuarioInfoAsync(values.idViajante) });
this.appliedFilters.push({ label: 'Viajante', value: values.idRubro, asyncFn: this.getUsuarioInfoAsync(values.idViajante) });
}


setTimeout(() => {
if (values.idProvincia) {
this.appliedFilters.push({ label: 'Provincia', value: this.getNombreProvincia(values.idProvincia) });
Expand Down
14 changes: 3 additions & 11 deletions src/app/components/facturas-venta/facturas-venta.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@
<div class="d-flex flex-row align-items-center my-3">
<h1 class="h3 m-0 flex-fill text-truncate"><fa-icon [icon]="['fas', 'file-invoice']"></fa-icon> Facturas de Ventas</h1>
<div class="text-end m-0 text-nowrap">
<button type="button" class="btn btn-primary ms-2" (click)="isBatchActionsBoxCollapsed = !isBatchActionsBoxCollapsed"
[attr.aria-expanded]="!isBatchActionsBoxCollapsed" aria-controls="facturasVentaBatchActionsBoxCollapse"
[class.bg-white]="!isBatchActionsBoxCollapsed"
ngbPopover="Selección" triggers="mouseenter:mouseleave" placement="left">
<fa-icon [icon]="['fas', 'check-square']"></fa-icon>&nbsp;<span class="fw-bold">{{ batchActionsService.count(baKey) }}</span>
</button>
<button type="button" class="btn btn-primary ms-2" (click)="isFiltersCollapsed = !isFiltersCollapsed"
[attr.aria-expanded]="!isFiltersCollapsed" aria-controls="facturasVentaFiltersCollapse"
[class.bg-white]="!isFiltersCollapsed"
Expand Down Expand Up @@ -62,10 +56,7 @@ <h1 class="h3 m-0 flex-fill text-truncate"><fa-icon [icon]="['fas', 'file-invoic
</div>
<app-filtros-aplicados [appliedFilters]="appliedFilters" [totalElements]="totalElements" [searching]="searching"
[ordenarPorAplicado]="ordenarPorAplicado" [sentidoAplicado]="sentidoAplicado"></app-filtros-aplicados>
<div class="facturasVentaBatchActionsBoxCollapse" [ngbCollapse]="isBatchActionsBoxCollapsed">
<app-batch-actions-box [batchActionKey]="baKey" [actions]="baActions"
(emptySelection)="isBatchActionsBoxCollapsed = !isBatchActionsBoxCollapsed" ></app-batch-actions-box>
</div>

<div class="facturas my-2">
<ng-template #info let-item let-i="index" id="infoFV">
<div class="d-flex flex-row flex-wrap">
Expand Down Expand Up @@ -105,7 +96,8 @@ <h1 class="h3 m-0 flex-fill text-truncate"><fa-icon [icon]="['fas', 'file-invoic
(afterNoAutorizar)="loadPage(0)"
></app-factura-venta-actions-bar>
</ng-template>
<app-lista [size]="size" [items]="items" [infoTemplate]="info" [actionsTemplate]="actions" [batchActionKey]="baKey"
<app-lista [size]="size" [items]="items" [infoTemplate]="info" [actionsTemplate]="actions"
[batchActionKey]="baKey" [batchActionActions]="baActions"
[page]="page" [totalPages]="totalPages" [totalElements]="totalElements" (pageChange)="loadPage($event)"></app-lista>
<app-totales [loading]="loadingTotalizadores" [data]="totalesData"></app-totales>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ export class FacturasVentaComponent extends ListadoDirective implements OnInit {
clickFn: () => this.router.navigate(['/remitos/nuevo']),
}
];
isBatchActionsBoxCollapsed = true;

tiposDeComprobantesParaAutorizacion: TipoDeComprobante[] = [
TipoDeComprobante.NOTA_CREDITO_A,
Expand Down
7 changes: 4 additions & 3 deletions src/app/components/lista-table/lista-table.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<th scope="col" *ngFor="let c of tableConfig" [ngClass]="{ 'd-none': c.hidden }">{{ c.name }}</th>
</ng-template>

<div class="d-flex flex-row">
<div class="d-flex flex-row flex-wrap justify-content-between">
<div class="flex-fill">
<div class="form-check ms-2 py-2" *ngIf="batchActionKey">
<input type="checkbox" class="form-check-input" id="check_all_items" [checked]="isAllItemsSelected" (change)="toggleAll($event)">
Expand All @@ -18,8 +18,9 @@
</label>
</div>
</div>
<div>
<div ngbDropdown placement="bottom-right" class="d-inline-block toggle-columns-dropdown" *ngIf="hasColumnsThatCanBeHidden">
<div class="flex-fill d-flex flex-row align-items-center justify-content-end">
<app-batch-actions-box [batchActionKey]="batchActionKey" [actions]="batchActionActions"></app-batch-actions-box>
<div ngbDropdown placement="bottom-right" class="ms-2 d-inline-block toggle-columns-dropdown" *ngIf="hasColumnsThatCanBeHidden">
<button type="button" class="btn btn-primary" ngbDropdownToggle ngbPopover="Mostrar/Esconder columnas" placement="left" triggers="mouseenter:mouseleave">
<fa-icon [icon]="['fas', 'toggle-on']"></fa-icon>
<span class="visually-hidden">Mostrar/Esconder columnas</span>
Expand Down
2 changes: 2 additions & 0 deletions src/app/components/lista-table/lista-table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,6 @@ export class ListaTableComponent extends ListaDirective implements OnInit {

this.tableContainer.nativeElement.scrollLeft = this.scrollLeft - walk;
}


}
14 changes: 8 additions & 6 deletions src/app/components/lista/lista.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
<ng-template #noActions>
<div class="alert alert-danger">No actions template defined</div>
</ng-template>

<div class="form-check ms-2 py-2" *ngIf="batchActionKey">
<input type="checkbox" class="form-check-input" id="check_all_items" [checked]="isAllItemsSelected" (change)="toggleAll($event)">
<label class="form-check-label fw-bold" for="check_all_items">
{{ isAllItemsSelected ? 'Deseleccionar' : 'Seleccionar' }} Todos (de ésta página)
</label>
<div class="d-flex align-items-center justify-content-between" *ngIf="batchActionKey">
<div class="form-check ms-2 py-2">
<input type="checkbox" class="form-check-input" id="check_all_items" [checked]="isAllItemsSelected" (change)="toggleAll($event)">
<label class="form-check-label fw-bold" for="check_all_items">
{{ isAllItemsSelected ? 'Deseleccionar' : 'Seleccionar' }} Todos
</label>
</div>
<app-batch-actions-box [batchActionKey]="batchActionKey" [actions]="batchActionActions"></app-batch-actions-box>
</div>
<div *ngFor="let item of items; let i=index;" class="d-flex flex-row align-items-center border-bottom border-top py-2" [class.selected]="isSelected(item)">
<div class="form-check ms-2" *ngIf="batchActionKey">
Expand Down
3 changes: 1 addition & 2 deletions src/app/components/nav-bar/nav-bar.component.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<nav class="navbar navbar-expand navbar-dark">
<div class="container-fluid">
<a routerLink="/pedidos" class="navbar-brand">
<img class="d-inline d-md-none" src="assets/logo-opensource.png" alt="">
<img class="d-none d-md-inline" src="assets/logo-opensource.png" alt="">
<img [src]="logo" alt="Logo">
</a>

<div class="collapse navbar-collapse" id="appNavigation" [ngbCollapse]="isCollapsed">
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/nav-bar/nav-bar.component.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.navbar-brand {
img {
height: 35px;
height: 40px;
width: auto;
}
#menu-btn {
Expand Down
4 changes: 4 additions & 0 deletions src/app/components/nav-bar/nav-bar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,8 @@ export class NavBarComponent implements OnInit, OnDestroy {
this.usuariosService.setSucursalPredeterminadaDeUsuario(this.usuario.idUsuario, s.idSucursal).subscribe();
}
}

get logo(): string {
return this.sucursalSeleccionada?.logo ? this.sucursalSeleccionada.logo : 'assets/logo-opensource.png';
}
}
11 changes: 1 addition & 10 deletions src/app/components/productos/productos.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ <h1 class="h3 m-0 flex-fill text-truncate"><fa-icon [icon]="['fas', 'box-open']"
<button class="btn btn-primary ms-2 my-1" routerLink="/productos/nuevo" ngbPopover="Nuevo Producto" triggers="mouseenter:mouseleave" placement="left" *ngIf="hasRoleToCreate">
<fa-icon [icon]="['fas', 'plus']"></fa-icon>
</button>
<button type="button" class="btn btn-primary ms-2" (click)="isBatchActionsBoxCollapsed = !isBatchActionsBoxCollapsed"
[attr.aria-expanded]="!isBatchActionsBoxCollapsed" aria-controls="productosBatchActionsBoxCollapse"
[class.bg-white]="!isBatchActionsBoxCollapsed"
ngbPopover="Selección" triggers="mouseenter:mouseleave" placement="left">
<fa-icon [icon]="['fas', 'check-square']"></fa-icon>&nbsp;<span class="fw-bold">{{ batchActionsService.count(baKey) }}</span>
</button>
<button class="btn btn-primary ms-2" (click)="descargarReporteAlEmail()" placement="left" ngbPopover="Imprimir" triggers="mouseenter:mouseleave">
<fa-icon [icon]="['fas', 'print']"></fa-icon>
</button>
Expand Down Expand Up @@ -78,10 +72,6 @@ <h1 class="h3 m-0 flex-fill text-truncate"><fa-icon [icon]="['fas', 'box-open']"
</div>
<app-filtros-aplicados [appliedFilters]="appliedFilters" [totalElements]="totalElements" [searching]="searching"
[ordenarPorAplicado]="ordenarPorAplicado" [sentidoAplicado]="sentidoAplicado"></app-filtros-aplicados>
<div class="productosBatchActionsBoxCollapse" [ngbCollapse]="isBatchActionsBoxCollapsed">
<app-batch-actions-box [batchActionKey]="baKey" [actions]="baActions"
(emptySelection)="isBatchActionsBoxCollapsed = !isBatchActionsBoxCollapsed" ></app-batch-actions-box>
</div>
<div class="productos my-2 bg-white">
<ng-template #actions let-item>
<div ngbDropdown class="actions d-none d-md-inline-block" container="body" placement="left-top">
Expand Down Expand Up @@ -157,6 +147,7 @@ <h1 class="h3 m-0 flex-fill text-truncate"><fa-icon [icon]="['fas', 'box-open']"
<app-lista-table
[size]="size" [items]="items"
[batchActionKey]="baKey"
[batchActionActions]="baActions"
[tableConfig]="tableConfig"
[listaTableKey]="ltKey"
[infoTemplate]="info"
Expand Down
3 changes: 1 addition & 2 deletions src/app/components/productos/productos.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import {Sucursal} from '../../models/sucursal';
styleUrls: ['./productos.component.scss']
})
export class ProductosComponent extends ListadoDirective implements OnInit {
isBatchActionsBoxCollapsed = true;
ordenArray = [
{ val: 'fechaUltimaModificacion', text: 'Fecha Últ. Modificación' },
{ val: 'descripcion', text: 'Descripción' },
Expand Down Expand Up @@ -335,7 +334,7 @@ export class ProductosComponent extends ListadoDirective implements OnInit {
return;
}

const msg = '¿Desea eliminar los productos seleccionandos?';
const msg = `¿Desea eliminar los ${this.batchActionsService.count(this.baKey)} productos seleccionandos?`;
this.mensajeService.msg(msg, MensajeModalType.CONFIRM).then((result) => {
if (result) {
this.loadingOverlayService.activate();
Expand Down
9 changes: 9 additions & 0 deletions src/app/directives/lista.directive.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Subscription } from 'rxjs';
import { EventEmitter, Input, Output, TemplateRef, OnInit, OnDestroy, Directive } from '@angular/core';
import {BatchActionKey, BatchActionsService} from '../services/batch-actions.service';
import { ActionConfiguration } from '../components/batch-actions-box/batch-actions-box.component';

@Directive()
export abstract class ListaDirective implements OnInit, OnDestroy {
Expand Down Expand Up @@ -49,6 +50,10 @@ export abstract class ListaDirective implements OnInit, OnDestroy {
}
get batchActionKey(): BatchActionKey { return this.pBatchActionKey; }

private pBatchActionActions: ActionConfiguration[];
@Input() set batchActionActions(value: ActionConfiguration[]) { this.pBatchActionActions = value; }
get batchActionActions(): ActionConfiguration[] { return this.pBatchActionActions; }

private subscription: Subscription;

protected constructor(protected batchActionsService: BatchActionsService) {}
Expand Down Expand Up @@ -118,4 +123,8 @@ export abstract class ListaDirective implements OnInit, OnDestroy {
if (!this.batchActionKey) { return false; }
return this.pItems.length && this.pItems.every(i => this.batchActionsService.hasElement(this.pBatchActionKey, this.getItemIdFn(i) as number));
}

get selectedCount(): number {
return this.batchActionsService.count(this.batchActionKey);
}
}
Loading
Loading