first commit
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
|
||||
# For additional information regarding the format and rule options, please see:
|
||||
# https://github.com/browserslist/browserslist#queries
|
||||
|
||||
# For the full list of supported browsers by the Angular framework, please see:
|
||||
# https://angular.io/guide/browser-support
|
||||
|
||||
# You can see what browsers were selected by your queries by running:
|
||||
# npx browserslist
|
||||
|
||||
last 1 Chrome version
|
||||
last 1 Firefox version
|
||||
last 2 Edge major versions
|
||||
last 2 Safari major versions
|
||||
last 2 iOS major versions
|
||||
Firefox ESR
|
||||
@@ -0,0 +1,16 @@
|
||||
# Editor configuration, see https://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.ts]
|
||||
quote_type = single
|
||||
|
||||
[*.md]
|
||||
max_line_length = off
|
||||
trim_trailing_whitespace = false
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||
|
||||
# Compiled output
|
||||
/dist
|
||||
/tmp
|
||||
/out-tsc
|
||||
/bazel-out
|
||||
|
||||
# Node
|
||||
/node_modules
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
|
||||
# IDEs and editors
|
||||
.idea/
|
||||
.project
|
||||
.classpath
|
||||
.c9/
|
||||
*.launch
|
||||
.settings/
|
||||
*.sublime-workspace
|
||||
|
||||
# Visual Studio Code
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
.history/*
|
||||
|
||||
# Miscellaneous
|
||||
/.angular/cache
|
||||
.sass-cache/
|
||||
/connect.lock
|
||||
/coverage
|
||||
/libpeerconnection.log
|
||||
testem.log
|
||||
/typings
|
||||
|
||||
# System files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
|
||||
"recommendations": ["angular.ng-template"]
|
||||
}
|
||||
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
{
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "ng serve",
|
||||
"type": "pwa-chrome",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "npm: start",
|
||||
"url": "http://localhost:4200/"
|
||||
},
|
||||
{
|
||||
"name": "ng test",
|
||||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "npm: test",
|
||||
"url": "http://localhost:9876/debug.html"
|
||||
}
|
||||
]
|
||||
}
|
||||
Vendored
+42
@@ -0,0 +1,42 @@
|
||||
{
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "start",
|
||||
"isBackground": true,
|
||||
"problemMatcher": {
|
||||
"owner": "typescript",
|
||||
"pattern": "$tsc",
|
||||
"background": {
|
||||
"activeOnStart": true,
|
||||
"beginsPattern": {
|
||||
"regexp": "(.*?)"
|
||||
},
|
||||
"endsPattern": {
|
||||
"regexp": "bundle generation complete"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "test",
|
||||
"isBackground": true,
|
||||
"problemMatcher": {
|
||||
"owner": "typescript",
|
||||
"pattern": "$tsc",
|
||||
"background": {
|
||||
"activeOnStart": true,
|
||||
"beginsPattern": {
|
||||
"regexp": "(.*?)"
|
||||
},
|
||||
"endsPattern": {
|
||||
"regexp": "bundle generation complete"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
# GenesisFront
|
||||
|
||||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.3.0.
|
||||
|
||||
## Development server
|
||||
|
||||
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
|
||||
|
||||
## Code scaffolding
|
||||
|
||||
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
|
||||
|
||||
## Build
|
||||
|
||||
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
||||
|
||||
## Running end-to-end tests
|
||||
|
||||
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
|
||||
|
||||
## Further help
|
||||
|
||||
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
{
|
||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||
"cli": {
|
||||
"analytics": "e51e7892-83e9-4b54-8eed-f5d2bea3ac97"
|
||||
},
|
||||
"version": 1,
|
||||
"newProjectRoot": "projects",
|
||||
"projects": {
|
||||
"genesisFront": {
|
||||
"projectType": "application",
|
||||
"schematics": {
|
||||
"@schematics/angular:component": {
|
||||
"style": "scss"
|
||||
},
|
||||
"@schematics/angular:application": {
|
||||
"strict": true
|
||||
}
|
||||
},
|
||||
"root": "",
|
||||
"sourceRoot": "src",
|
||||
"prefix": "app",
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@angular-devkit/build-angular:browser",
|
||||
"options": {
|
||||
"outputPath": "dist/genesis-front",
|
||||
"index": "src/index.html",
|
||||
"main": "src/main.ts",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"tsConfig": "tsconfig.app.json",
|
||||
"inlineStyleLanguage": "scss",
|
||||
"assets": [
|
||||
"src/favicon.ico",
|
||||
"src/assets"
|
||||
],
|
||||
"styles": [
|
||||
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
|
||||
"src/styles.scss",
|
||||
"./node_modules/primeicons/primeicons.css",
|
||||
"./node_modules/primeng/resources/themes/mdc-light-indigo/theme.css",
|
||||
"./node_modules/primeng/resources/primeng.min.css",
|
||||
"./node_modules/ngx-toastr/toastr.css",
|
||||
],
|
||||
"scripts": []
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"budgets": [
|
||||
{
|
||||
"type": "initial",
|
||||
"maximumWarning": "4mb",
|
||||
"maximumError": "5mb"
|
||||
},
|
||||
{
|
||||
"type": "anyComponentStyle",
|
||||
"maximumWarning": "2kb",
|
||||
"maximumError": "4kb"
|
||||
}
|
||||
],
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.prod.ts"
|
||||
}
|
||||
],
|
||||
"outputHashing": "all"
|
||||
},
|
||||
"development": {
|
||||
"buildOptimizer": false,
|
||||
"optimization": false,
|
||||
"vendorChunk": true,
|
||||
"extractLicenses": false,
|
||||
"sourceMap": true,
|
||||
"namedChunks": true
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "production"
|
||||
},
|
||||
"serve": {
|
||||
"builder": "@angular-devkit/build-angular:dev-server",
|
||||
"configurations": {
|
||||
"production": {
|
||||
"browserTarget": "genesisFront:build:production"
|
||||
},
|
||||
"development": {
|
||||
"browserTarget": "genesisFront:build:development"
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "development"
|
||||
},
|
||||
"extract-i18n": {
|
||||
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||
"options": {
|
||||
"browserTarget": "genesisFront:build"
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"builder": "@angular-devkit/build-angular:karma",
|
||||
"options": {
|
||||
"main": "src/test.ts",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"tsConfig": "tsconfig.spec.json",
|
||||
"karmaConfig": "karma.conf.js",
|
||||
"inlineStyleLanguage": "scss",
|
||||
"assets": [
|
||||
"src/favicon.ico",
|
||||
"src/assets"
|
||||
],
|
||||
"styles": [
|
||||
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
|
||||
"src/styles.scss",
|
||||
"./node_modules/primeicons/primeicons.css",
|
||||
"./node_modules/primeng/resources/themes/mdc-light-indigo/theme.css",
|
||||
"./node_modules/primeng/resources/primeng.min.css",
|
||||
"./node_modules/ngx-toastr/toastr.css",
|
||||
],
|
||||
"scripts": []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultProject": "genesisFront"
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
// Karma configuration file, see link for more information
|
||||
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
||||
|
||||
module.exports = function (config) {
|
||||
config.set({
|
||||
basePath: '',
|
||||
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
||||
plugins: [
|
||||
require('karma-jasmine'),
|
||||
require('karma-chrome-launcher'),
|
||||
require('karma-jasmine-html-reporter'),
|
||||
require('karma-coverage'),
|
||||
require('@angular-devkit/build-angular/plugins/karma')
|
||||
],
|
||||
client: {
|
||||
jasmine: {
|
||||
// you can add configuration options for Jasmine here
|
||||
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
|
||||
// for example, you can disable the random execution with `random: false`
|
||||
// or set a specific seed with `seed: 4321`
|
||||
},
|
||||
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
||||
},
|
||||
jasmineHtmlReporter: {
|
||||
suppressAll: true // removes the duplicated traces
|
||||
},
|
||||
coverageReporter: {
|
||||
dir: require('path').join(__dirname, './coverage/genesis-front'),
|
||||
subdir: '.',
|
||||
reporters: [
|
||||
{ type: 'html' },
|
||||
{ type: 'text-summary' }
|
||||
]
|
||||
},
|
||||
reporters: ['progress', 'kjhtml'],
|
||||
port: 9876,
|
||||
colors: true,
|
||||
logLevel: config.LOG_INFO,
|
||||
autoWatch: true,
|
||||
browsers: ['Chrome'],
|
||||
singleRun: false,
|
||||
restartOnFileChange: true
|
||||
});
|
||||
};
|
||||
Generated
+20710
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"name": "genesis-front",
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
"build": "ng build",
|
||||
"watch": "ng build --watch --configuration development",
|
||||
"test": "ng test",
|
||||
"postinstall": "ngcc"
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@angular/animations": "~13.3.0",
|
||||
"@angular/cdk": "^13.3.2",
|
||||
"@angular/common": "~13.3.0",
|
||||
"@angular/compiler": "~13.3.0",
|
||||
"@angular/core": "~13.3.0",
|
||||
"@angular/forms": "~13.3.0",
|
||||
"@angular/material": "^13.3.2",
|
||||
"@angular/platform-browser": "~13.3.0",
|
||||
"@angular/platform-browser-dynamic": "~13.3.0",
|
||||
"@angular/router": "~13.3.0",
|
||||
"@fullcalendar/angular": "^5.11.0",
|
||||
"@fullcalendar/daygrid": "^5.11.0",
|
||||
"@fullcalendar/interaction": "^5.11.0",
|
||||
"@fullcalendar/timegrid": "^5.11.0",
|
||||
"angular-resize-event": "^3.1.1",
|
||||
"animate.css": "^4.1.1",
|
||||
"chart.js": "^3.6.0",
|
||||
"chartjs-plugin-datalabels": "^2.0.0",
|
||||
"file-saver": "^2.0.5",
|
||||
"jwt-decode": "^3.1.2",
|
||||
"mat-select-filter": "^2.4.1",
|
||||
"md5": "^2.3.0",
|
||||
"ng2-charts": "^3.0.11",
|
||||
"ngx-mask": "^13.1.8",
|
||||
"ngx-toastr": "^14.2.4",
|
||||
"primeicons": "^5.0.0",
|
||||
"primeng": "^13.3.2",
|
||||
"rxjs": "~7.5.0",
|
||||
"ts-md5": "^1.2.11",
|
||||
"tslib": "^2.3.0",
|
||||
"zone.js": "~0.11.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "~13.3.0",
|
||||
"@angular/cli": "~13.3.0",
|
||||
"@angular/compiler-cli": "~13.3.0",
|
||||
"@types/file-saver": "^2.0.5",
|
||||
"@types/jasmine": "~3.10.0",
|
||||
"@types/node": "^12.11.1",
|
||||
"jasmine-core": "~4.0.0",
|
||||
"karma": "~6.3.0",
|
||||
"karma-chrome-launcher": "~3.1.0",
|
||||
"karma-coverage": "~2.1.0",
|
||||
"karma-jasmine": "~4.0.0",
|
||||
"karma-jasmine-html-reporter": "~1.7.0",
|
||||
"typescript": "~4.6.2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
import {NgModule} from '@angular/core';
|
||||
import {RouterModule, Routes} from '@angular/router';
|
||||
import {NavbarComponent} from "./components/navbar/navbar.component";
|
||||
import {AdminGuard} from "./guards/admin.guard";
|
||||
import {LoginGuard} from "./guards/login.guard";
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
loadChildren: () => import('./modules/login/login.module').then(m => m.LoginModule)
|
||||
},
|
||||
{
|
||||
path: '',
|
||||
component: NavbarComponent,
|
||||
children: [
|
||||
{
|
||||
path: 'home',
|
||||
canActivate: [LoginGuard],
|
||||
loadChildren: () => import('./modules/home/home.module').then(m => m.HomeModule)
|
||||
},
|
||||
{
|
||||
path: 'client',
|
||||
canActivate: [AdminGuard],
|
||||
loadChildren: () => import('./modules/client/client.module').then(m => m.ClientModule)
|
||||
},
|
||||
{
|
||||
path: 'dashboard',
|
||||
canActivate: [AdminGuard],
|
||||
loadChildren: () => import('./modules/dashboard/dashboard.module').then(m => m.DashboardModule)
|
||||
},
|
||||
{
|
||||
path: 'user',
|
||||
canActivate: [AdminGuard],
|
||||
loadChildren: () => import('./modules/user/user.module').then(m => m.UserModule)
|
||||
},
|
||||
{
|
||||
path: 'case',
|
||||
canActivate: [AdminGuard],
|
||||
loadChildren: () => import('./modules/case/case.module').then(m => m.CaseModule)
|
||||
},
|
||||
{
|
||||
path: 'courier',
|
||||
canActivate: [LoginGuard],
|
||||
loadChildren: () => import('./modules/courier/courier.module').then(m => m.CourierModule)
|
||||
}
|
||||
// {
|
||||
// path: 'profile',
|
||||
// loadChildren: () => import('./modules/profile/profile.module').then(m => m.ProfileModule)
|
||||
// }
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forRoot(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class AppRoutingModule {
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<router-outlet></router-outlet>
|
||||
@@ -0,0 +1,35 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { AppComponent } from './app.component';
|
||||
|
||||
describe('AppComponent', () => {
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [
|
||||
RouterTestingModule
|
||||
],
|
||||
declarations: [
|
||||
AppComponent
|
||||
],
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
it('should create the app', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.componentInstance;
|
||||
expect(app).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should have as title 'genesisFront'`, () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.componentInstance;
|
||||
expect(app.title).toEqual('genesisFront');
|
||||
});
|
||||
|
||||
it('should render title', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
fixture.detectChanges();
|
||||
const compiled = fixture.nativeElement as HTMLElement;
|
||||
expect(compiled.querySelector('.content span')?.textContent).toContain('genesisFront app is running!');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
templateUrl: './app.component.html',
|
||||
styleUrls: ['./app.component.scss']
|
||||
})
|
||||
export class AppComponent {
|
||||
title = 'genesisFront';
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import {NgModule} from '@angular/core';
|
||||
import {BrowserModule} from '@angular/platform-browser';
|
||||
|
||||
import {AppRoutingModule} from './app-routing.module';
|
||||
import {AppComponent} from './app.component';
|
||||
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
|
||||
import {HTTP_INTERCEPTORS, HttpClientModule} from "@angular/common/http";
|
||||
import {AuthInterceptorService} from "./middleware/auth-interceptor.service";
|
||||
import {ToastrModule} from "ngx-toastr";
|
||||
import {AngularMaterialModule} from "./shared/material.module";
|
||||
import {ReactiveFormsModule} from "@angular/forms";
|
||||
import { FilterComponent } from './components/filter/filter.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
AppRoutingModule,
|
||||
BrowserAnimationsModule,
|
||||
ToastrModule.forRoot(),
|
||||
AngularMaterialModule,
|
||||
HttpClientModule,
|
||||
ReactiveFormsModule,
|
||||
],
|
||||
providers: [
|
||||
{
|
||||
provide: HTTP_INTERCEPTORS,
|
||||
useClass: AuthInterceptorService,
|
||||
multi: true
|
||||
}
|
||||
],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
export class AppModule {
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
<div *ngIf="loadSpinner == true" class="body_modal">
|
||||
<mat-spinner></mat-spinner>
|
||||
</div>
|
||||
<div class="body_modal" *ngIf="activityForm && loadSpinner == false">
|
||||
<div class="body_modal-tittle">
|
||||
<h1>{{activity ? 'Editar' : 'Agregar'}} Actividad</h1>
|
||||
<button mat-icon-button color="warn" *ngIf="activity" (click)="deleteActivity()">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
<div class="body_modal-form" *ngIf="clients.length == 0">
|
||||
<h3 style="text-align: center">No tienes casos asignados por el momento.</h3>
|
||||
</div>
|
||||
<form [formGroup]="activityForm" class="body_modal-form" *ngIf="clients.length !== 0">
|
||||
<div class="body_modal-form_row">
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field">
|
||||
<mat-label>Selecciona Cliente</mat-label>
|
||||
<mat-select formControlName="id_client" (selectionChange)="getAssingCases()" [disabled]="(activity && rol !== 'admin') || (id_client && rol !== 'admin')">
|
||||
<mat-option *ngFor="let client$ of clients" [value]="client$.id">{{client$.businessname}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field">
|
||||
<mat-label>Selecciona Caso</mat-label>
|
||||
|
||||
<mat-select formControlName="id_case" [disabled]="(activity && rol !== 'admin') || (id_case && rol !== 'admin')">
|
||||
<mat-option *ngFor="let case$ of cases" [value]="case$.id">{{case$.name}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="body_modal-form_row">
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field">
|
||||
<mat-label>Actividad</mat-label>
|
||||
<textarea matInput formControlName="description" placeholder="Ingresa Actividad" required></textarea>
|
||||
<mat-error *ngIf="activityForm.controls['description'].hasError('required')">
|
||||
Este campo es <strong>requerido</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field">
|
||||
<mat-label>Fecha de Inicio</mat-label>
|
||||
<input type="datetime-local" matInput formControlName="created" required>
|
||||
<mat-error *ngIf="activityForm.controls['created'].hasError('required')">
|
||||
Este campo es <strong>requerido</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="body_modal-form_row">
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field"
|
||||
*ngIf="!bills && type && !category && !payment">
|
||||
<mat-label>Honorario</mat-label>
|
||||
<input type="number" matInput formControlName="rate">
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field" *ngIf="type || bills || category">
|
||||
<mat-label>Monto Único</mat-label>
|
||||
<input type="number" matInput formControlName="amount">
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field" *ngIf="bills">
|
||||
<mat-label>Tipo</mat-label>
|
||||
<mat-select formControlName="id_paytype">
|
||||
<mat-option [value]="3">Debe</mat-option>
|
||||
<mat-option [value]="2">Haber</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field" *ngIf="category">
|
||||
<mat-label>Tipo</mat-label>
|
||||
<mat-select formControlName="id_category">
|
||||
<mat-option [value]="1">Mensajería</mat-option>
|
||||
<mat-option [value]="2">Traslado</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div class="body_modal-form_row">
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field" *ngIf="!bills && !category && !payment">
|
||||
<mat-label>Cantidad de Horas</mat-label>
|
||||
<input type="number" matInput formControlName="hours">
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field" *ngIf="payment">
|
||||
<mat-label>Monto Único</mat-label>
|
||||
<input type="number" matInput formControlName="amount">
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field" *ngIf="users">
|
||||
<mat-label>Responsable</mat-label>
|
||||
<mat-select formControlName="id_created" [disabled]="rol !== 'admin'">
|
||||
<mat-option *ngFor="let user$ of users" [value]="user$.id">{{user$.name + " " + user$.lastname}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<!-- <div class="body_modal-form_row" *ngIf="bills">-->
|
||||
<!-- -->
|
||||
<!-- </div>-->
|
||||
</form>
|
||||
<div class="body_modal-form_row">
|
||||
<button mat-raised-button color="warn" (click)="this.dialogRef.close(false)">Cerrar</button>
|
||||
<button mat-raised-button color="primary" (click)="addActivity()" *ngIf="clients.length !== 0"
|
||||
[disabled]="invalidForm() || spinner || !cases"
|
||||
[class.spinner]="spinner">{{activity ? 'Editar' : 'Agregar'}}</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,45 @@
|
||||
.body_modal-form {
|
||||
width: 100%;
|
||||
height: 90%;
|
||||
padding: 2%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.body_modal-form_row {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.body_modal-form_row-field {
|
||||
padding-right: 3%;
|
||||
width: 51%;
|
||||
}
|
||||
|
||||
.body_modal {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.body_modal-tittle {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 0 2%;
|
||||
}
|
||||
|
||||
.body_modal-tittle h1 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.body_modal-tittle button {
|
||||
margin-left: auto;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ActivitiesComponent } from './activities.component';
|
||||
|
||||
describe('ActivitiesComponent', () => {
|
||||
let component: ActivitiesComponent;
|
||||
let fixture: ComponentFixture<ActivitiesComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ ActivitiesComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ActivitiesComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,267 @@
|
||||
import {Component, EventEmitter, Input, OnInit, Output, Inject} from '@angular/core';
|
||||
import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from "@angular/material/dialog";
|
||||
import {Activity} from "../../models/activity";
|
||||
import {Case} from "../../models/case";
|
||||
import {Client} from "../../models/client";
|
||||
import {FormBuilder, FormGroup, Validators} from "@angular/forms";
|
||||
import {CaseService} from "../../services/case.service";
|
||||
import {MatSnackBar} from "@angular/material/snack-bar";
|
||||
import {Decode, Response} from "../../models/response";
|
||||
import {ToastrService} from "ngx-toastr";
|
||||
import {AuthService} from "../../services/auth.service";
|
||||
import {DatePipe} from "@angular/common";
|
||||
import {ActivityService} from "../../services/activity.service";
|
||||
import {ClientService} from "../../services/client.service";
|
||||
import {ConfirmComponent} from "../confirm/confirm.component";
|
||||
import { UserService } from 'src/app/services/user.service';
|
||||
import { User } from 'src/app/models/user';
|
||||
|
||||
@Component({
|
||||
selector: 'app-activities',
|
||||
templateUrl: './activities.component.html',
|
||||
styleUrls: ['./activities.component.scss']
|
||||
})
|
||||
export class ActivitiesComponent implements OnInit {
|
||||
|
||||
@Output() closeModal: EventEmitter<Activity> = new EventEmitter<Activity>();
|
||||
@Input() info: any = this.data.info;
|
||||
@Input() activity: any = this.data.activity;
|
||||
@Input() type: any = this.data.type;
|
||||
@Input() bills: any = this.data.bills;
|
||||
@Input() id_case: any = this.data.id_case ? this.data.id_case : null;
|
||||
@Input() id_client: any = this.data.id_client;
|
||||
@Input() category: any = this.data.category;
|
||||
@Input() payment: any = this.data.payment;
|
||||
activityForm!: FormGroup;
|
||||
cases!: Case[];
|
||||
clients!: Client[];
|
||||
loadSpinner!: boolean;
|
||||
token!: Decode;
|
||||
spinner = false;
|
||||
rol!: string;
|
||||
users!: User[];
|
||||
|
||||
constructor(
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
public dialog: MatDialog,
|
||||
public dialogRef: MatDialogRef<ActivitiesComponent>,
|
||||
private fb: FormBuilder,
|
||||
private caseService: CaseService,
|
||||
private clientService: ClientService,
|
||||
private userService: UserService,
|
||||
private toastr: ToastrService,
|
||||
private authService: AuthService,
|
||||
private datePipe: DatePipe,
|
||||
private activityService: ActivityService
|
||||
) {
|
||||
this.loadSpinner = true;
|
||||
this.token = this.authService.token;
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.rol = this.authService.token.rol;
|
||||
// @ts-ignore
|
||||
this.userService.getAllUsers().subscribe((response: Response) => {
|
||||
this.users = response.data.users!;
|
||||
if (!this.activity) {
|
||||
if (this.token.rol !== 'admin') {
|
||||
// @ts-ignore
|
||||
this.caseService.getClientsByAssingCase().subscribe((response: Response) => {
|
||||
this.clients = response.data.clients!;
|
||||
|
||||
this.createForm();
|
||||
this.loadSpinner = false;
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
})
|
||||
} else if (this.token.rol == 'admin') {
|
||||
// @ts-ignore
|
||||
this.clientService.getAllClient().subscribe((response: Response) => {
|
||||
this.clients = response.data.clients!;
|
||||
this.createForm();
|
||||
if (this.id_case) {
|
||||
this.getAssingCases();
|
||||
this.createForm();
|
||||
}
|
||||
this.loadSpinner = false;
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
})
|
||||
}
|
||||
} else {
|
||||
// @ts-ignore
|
||||
this.clientService.getAllClientNotFilter().subscribe((response: Response) => {
|
||||
this.clients = response.data.clients!;
|
||||
// @ts-ignore
|
||||
this.caseService.getAllCasesNotFilter().subscribe((response: Response) => {
|
||||
this.cases = response.data.cases!;
|
||||
this.createForm();
|
||||
this.loadSpinner = false;
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
})
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.activityForm = this.fb.group({
|
||||
id_client: [this.id_client ? this.id_client : this.activity ? this.activity.case!.id_client ? this.activity.case!.id_client : this.activity.id_client : '', Validators.required],
|
||||
id_case: [this.id_case ? this.id_case : this.activity ? this.activity.id_case : '', Validators.required],
|
||||
description: [this.activity ? this.activity.description : '', Validators.required],
|
||||
created: [{
|
||||
value: this.payment || this.category || this.type || this.bills ? this.info : this.activity ? this.datePipe.transform(this.activity.created, 'yyyy-MM-ddTHH:mm') : !this.info.allDay ?
|
||||
(this.datePipe.transform(this.info.date, 'yyyy-MM-ddTHH:mm')) : this.info.dateStr + 'T08:00',
|
||||
disabled: !this.bills && !this.payment && !this.category && !this.info,
|
||||
}, Validators.required],
|
||||
hours: [this.activity ? this.activity.hours ? this.activity.hours : '' : ''],
|
||||
rate: [this.activity ? this.activity.rate ? this.activity.rate : this.token.rate : this.token.rate],
|
||||
amount: [this.activity ? this.activity.amount : null],
|
||||
id_paytype: [this.activity ? this.activity.id_paytype : this.bills ? '' : this.category ? 3 : this.payment ? 4 : 1, Validators.required],
|
||||
id_category: [this.category ? this.activity ? this.activity.id_category : '' : null],
|
||||
id_created: [this.activity ? this.activity.id_created ? this.activity.id_created : this.token.id : this.token.id]
|
||||
})
|
||||
}
|
||||
|
||||
getAssingCases() {
|
||||
this.activityForm.controls['id_case'].setValue(null);
|
||||
if (this.token.rol !== 'admin') {
|
||||
// @ts-ignore
|
||||
this.caseService.getAssingCaseByClients(this.activityForm.controls['id_client'].value).subscribe((response: Response) => {
|
||||
this.cases = response.data.cases!;
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
})
|
||||
} else {
|
||||
// @ts-ignore
|
||||
this.caseService.getCasesByClient(this.activityForm.controls['id_client'].value).subscribe((response: Response) => {
|
||||
this.cases = response.data.cases!;
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
addActivity() {
|
||||
this.spinner = true;
|
||||
if (this.activity) {
|
||||
const data = {
|
||||
...this.activityForm.value,
|
||||
hours: this.activityForm.controls['hours'].value === '' ? null : this.activityForm.controls['hours'].value,
|
||||
id: this.activity.id_activity !== undefined ? this.activity.id_activity : this.activity.id_activities,
|
||||
amount: this.activityForm.controls['amount'].value === '' ? null : this.activityForm.controls['amount'].value,
|
||||
rate: this.activityForm.controls['rate'].value == this.token.rate ? null : this.activityForm.controls['rate'].value === '' ? null : this.activityForm.controls['rate'].value
|
||||
}
|
||||
if (data.id_paytype == 4) {
|
||||
|
||||
} else {
|
||||
// @ts-ignore
|
||||
this.activityService.putUpdateActivity(data).subscribe((response: Response) => {
|
||||
this.spinner = false;
|
||||
this.toastr.success(response.data.message, 'Exito!');
|
||||
this.dialogRef.close(true);
|
||||
}, error => {
|
||||
this.spinner = false;
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
})
|
||||
}
|
||||
|
||||
} else {
|
||||
const data = {
|
||||
...this.activityForm.value,
|
||||
hours: this.activityForm.controls['hours'].value === '' ? null : this.activityForm.controls['hours'].value,
|
||||
amount: this.activityForm.controls['amount'].value === '' ? null : this.activityForm.controls['amount'].value,
|
||||
created: this.datePipe.transform(this.activityForm.controls['created'].value, 'yyyy-MM-dd HH:mm'),
|
||||
rate: this.activityForm.controls['rate'].value == this.token.rate ? null : this.activityForm.controls['rate'].value === '' ? null : this.activityForm.controls['rate'].value,
|
||||
id_created: this.token.id,
|
||||
}
|
||||
if (data.id_paytype == 4) {
|
||||
// @ts-ignore
|
||||
this.activityService.postCreatePayment(data).subscribe((response: Response) => {
|
||||
this.spinner = false;
|
||||
this.toastr.success(response.data.message, 'Exito!');
|
||||
this.dialogRef.close(true);
|
||||
}, error => {
|
||||
this.spinner = false;
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
})
|
||||
} else {
|
||||
// @ts-ignore
|
||||
this.activityService.postCreateActivity(data).subscribe((response: Response) => {
|
||||
this.spinner = false;
|
||||
this.toastr.success(response.data.message, 'Exito!');
|
||||
this.dialogRef.close(true);
|
||||
}, error => {
|
||||
this.spinner = false;
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
deleteActivity() {
|
||||
this.dialog.open(ConfirmComponent, {
|
||||
maxWidth: '60%',
|
||||
minWidth: '330px',
|
||||
panelClass: 'dialog-container',
|
||||
disableClose: true,
|
||||
data: {type: 'warning', message: 'Seguro que deseas eliminar la actividad?'}
|
||||
}).afterClosed().subscribe(result => {
|
||||
if (result === true) {
|
||||
// @ts-ignore
|
||||
this.activityService.getDisableActivity(this.activity.id_activity ? this.activity.id_activity : this.activity.id_activities).subscribe((response: Response) => {
|
||||
this.toastr.success(response.data.message, 'Exito!');
|
||||
this.getAssingCases();
|
||||
this.dialogRef.close(true);
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.message, title);
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
invalidForm() {
|
||||
if (this.activityForm.invalid) {
|
||||
return true;
|
||||
} else {
|
||||
if (this.category && (this.activityForm.controls['id_category'].value === '' || this.activityForm.controls['id_category'].value === null)) {
|
||||
|
||||
return true
|
||||
} else {
|
||||
if (this.activityForm.controls['hours'].value === '' || this.activityForm.controls['hours'].value === null) {
|
||||
if (this.activityForm.controls['amount'].value === '' || this.activityForm.controls['amount'].value === null) {
|
||||
|
||||
return true
|
||||
} else {
|
||||
if (this.activityForm.controls['amount'].value === '' || this.activityForm.controls['amount'].value === null) {
|
||||
if (this.activityForm.controls['hours'].value === '' || this.activityForm.controls['hours'].value === null) {
|
||||
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
<div *ngIf="loadSpinner == true" class="body_modal">
|
||||
<mat-spinner></mat-spinner>
|
||||
</div>
|
||||
<div class="body_modal" *ngIf="caseForm && loadSpinner == false">
|
||||
<div class="body_modal-tittle">
|
||||
<h1>{{case ? 'Editar' : 'Agregar'}} Caso</h1>
|
||||
</div>
|
||||
<form [formGroup]="caseForm" class="body_modal-form">
|
||||
<div class="body_modal-form_row">
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field">
|
||||
<mat-label>Caso</mat-label>
|
||||
<input type="text" matInput formControlName="name" required>
|
||||
<!-- <mat-error *ngIf="activityForm.controls['created'].hasError('required')">-->
|
||||
<!-- Este campo es <strong>requerido</strong>-->
|
||||
<!-- </mat-error>-->
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field">
|
||||
<mat-label>Cliente</mat-label>
|
||||
<mat-select formControlName="id_client">
|
||||
<mat-option [value]="">Selecciona Cliente</mat-option>
|
||||
<mat-option *ngFor="let client of clients" [value]="client.id">{{client.businessname}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field" *ngIf="!case">
|
||||
<mat-label>Asignar caso</mat-label>
|
||||
<mat-select multiple required>
|
||||
<mat-option *ngFor="let user of users" [value]="user.id"
|
||||
(onSelectionChange)="assingCase(user.id!)">{{user.name}} {{user.lastname}}
|
||||
({{user.acronym}})
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field">
|
||||
<mat-label>Descripcion</mat-label>
|
||||
<textarea type="text" matInput formControlName="description" rows="10"> </textarea>
|
||||
<!-- <mat-error *ngIf="activityForm.controls['created'].hasError('required')">-->
|
||||
<!-- Este campo es <strong>requerido</strong>-->
|
||||
<!-- </mat-error>-->
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="body_modal-form_row">
|
||||
<button mat-raised-button color="primary" (click)="addCase()" style="margin-bottom: 5%;"
|
||||
[disabled]="caseForm.invalid || spinner || (case ? userAssing == [] ? true : false : userAssing.length < 1 ? true : false) "
|
||||
[class.spinner]="spinner">{{case ? 'Editar' : 'Agregar'}}</button>
|
||||
<button mat-raised-button color="warn" (click)="this.dialogRef.close(false)">Cerrar</button>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,28 @@
|
||||
.body_modal-form {
|
||||
width: 100%;
|
||||
//height: 90%;
|
||||
padding: 2%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.body_modal-form_row {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.body_modal-form_row-field {
|
||||
padding-right: 3%;
|
||||
}
|
||||
|
||||
.body_modal {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AddCaseComponent } from './add-case.component';
|
||||
|
||||
describe('AddCaseComponent', () => {
|
||||
let component: AddCaseComponent;
|
||||
let fixture: ComponentFixture<AddCaseComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ AddCaseComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AddCaseComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,151 @@
|
||||
import {Component, EventEmitter, Inject, Input, OnInit, Output} from '@angular/core';
|
||||
import {Case} from "../../models/case";
|
||||
import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from "@angular/material/dialog";
|
||||
import {FormArray, FormBuilder, FormGroup, Validators} from "@angular/forms";
|
||||
import {CaseService} from "../../services/case.service";
|
||||
import {ClientService} from "../../services/client.service";
|
||||
import {ToastrService} from "ngx-toastr";
|
||||
import {AuthService} from "../../services/auth.service";
|
||||
import {DatePipe} from "@angular/common";
|
||||
import {Client} from "../../models/client";
|
||||
import {Response} from "../../models/response";
|
||||
import {UserService} from "../../services/user.service";
|
||||
import {User} from "../../models/user";
|
||||
|
||||
@Component({
|
||||
selector: 'app-add-case',
|
||||
templateUrl: './add-case.component.html',
|
||||
styleUrls: ['./add-case.component.scss']
|
||||
})
|
||||
export class AddCaseComponent implements OnInit {
|
||||
|
||||
@Output() closeModal: EventEmitter<Case> = new EventEmitter<Case>();
|
||||
@Input() case: Case = this.data;
|
||||
clients!: Client[];
|
||||
users!: User[];
|
||||
caseForm!: FormGroup;
|
||||
arrayForm!: FormArray;
|
||||
userAssing: any[] = [];
|
||||
loadSpinner: boolean = false;
|
||||
spinner = false;
|
||||
|
||||
constructor(
|
||||
@Inject(MAT_DIALOG_DATA) public data: Case,
|
||||
public dialog: MatDialog,
|
||||
public dialogRef: MatDialogRef<AddCaseComponent>,
|
||||
private fb: FormBuilder,
|
||||
private caseService: CaseService,
|
||||
private clientService: ClientService,
|
||||
private toastr: ToastrService,
|
||||
private authService: AuthService,
|
||||
private datePipe: DatePipe,
|
||||
private userService: UserService
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.loadSpinner = true;
|
||||
this.userAssing = [];
|
||||
if (!this.case) {
|
||||
// @ts-ignore
|
||||
this.clientService.getAllClient().subscribe((response: Response) => {
|
||||
this.clients = response.data.clients!;
|
||||
// @ts-ignore
|
||||
this.userService.getAllUsers().subscribe((response: Response) => {
|
||||
this.users = response.data.users!;
|
||||
this.createForm();
|
||||
this.loadSpinner = false;
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
});
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
});
|
||||
} else {
|
||||
// @ts-ignore
|
||||
|
||||
this.clientService.getAllClientNotFilter().subscribe((response: Response) => {
|
||||
this.clients = response.data.clients!;
|
||||
this.createForm();
|
||||
this.loadSpinner = false;
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
createForm() {
|
||||
|
||||
this.caseForm = this.fb.group({
|
||||
name: [this.case ? this.case.name : '', Validators.required],
|
||||
id_client: [this.case ? this.case.id_client : '', Validators.required],
|
||||
description: [this.case ? this.case.description : '']
|
||||
})
|
||||
}
|
||||
|
||||
assingCase(id: number) {
|
||||
const index = this.userAssing.findIndex(id_user => id_user == id)
|
||||
if (index > -1) {
|
||||
this.userAssing.splice(index, 1);
|
||||
} else {
|
||||
this.userAssing.push(id);
|
||||
}
|
||||
}
|
||||
|
||||
addCase() {
|
||||
this.spinner = true;
|
||||
let case$: Case = {
|
||||
name: this.caseForm.controls['name'].value,
|
||||
id_client: this.caseForm.controls['id_client'].value,
|
||||
description: this.caseForm.controls['description'].value,
|
||||
id_created: this.authService.token.id
|
||||
}
|
||||
if (!this.case) {
|
||||
// @ts-ignore
|
||||
this.caseService.postCreateCase(case$).subscribe((response: Response) => {
|
||||
let assingCase: any[] = []
|
||||
this.userAssing.map(user => {
|
||||
assingCase.push({
|
||||
id_user: user,
|
||||
id_case: response.data.id_case
|
||||
});
|
||||
});
|
||||
// @ts-ignore
|
||||
this.caseService.postAssingCase(assingCase).subscribe((response$: Response) => {
|
||||
this.toastr.success(response.data.message, 'Exito!');
|
||||
this.spinner = false;
|
||||
this.dialogRef.close(true);
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
this.spinner = false;
|
||||
})
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
this.spinner = false;
|
||||
})
|
||||
} else {
|
||||
case$ = {
|
||||
...this.case,
|
||||
...case$,
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
this.caseService.putUpdateCase(case$).subscribe((response: Response) => {
|
||||
this.toastr.success(response.data.message, 'Exito!');
|
||||
this.spinner = false;
|
||||
this.dialogRef.close(true);
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
this.spinner = false;
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<div class="body_modal" *ngIf="specializationForm">
|
||||
<div class="body_modal-tittle">
|
||||
<h1>Agregar Especialización</h1>
|
||||
</div>
|
||||
<form [formGroup]="specializationForm" class="body_modal-form">
|
||||
<div class="body_modal-form_row">
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field">
|
||||
<mat-label>Especialización</mat-label>
|
||||
<input type="text" matInput formControlName="name" required>
|
||||
<!-- <mat-error *ngIf="activityForm.controls['created'].hasError('required')">-->
|
||||
<!-- Este campo es <strong>requerido</strong>-->
|
||||
<!-- </mat-error>-->
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="body_modal-form_row">
|
||||
<button mat-raised-button color="primary" (click)="submit()" style="margin-bottom: 5%;"
|
||||
[disabled]="specializationForm.invalid || spinner"
|
||||
[class.spinner]="spinner">Agregar
|
||||
</button>
|
||||
<button mat-raised-button color="warn" (click)="this.dialogRef.close(false)">Cerrar</button>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,28 @@
|
||||
.body_modal-form {
|
||||
width: 100%;
|
||||
height: 90%;
|
||||
padding: 2%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.body_modal-form_row {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.body_modal-form_row-field {
|
||||
padding-right: 3%;
|
||||
}
|
||||
|
||||
.body_modal {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AddSpecializationComponent } from './add-specialization.component';
|
||||
|
||||
describe('AddSpecializationComponent', () => {
|
||||
let component: AddSpecializationComponent;
|
||||
let fixture: ComponentFixture<AddSpecializationComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ AddSpecializationComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AddSpecializationComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,56 @@
|
||||
import {Component, EventEmitter, Inject, OnInit, Output} from '@angular/core';
|
||||
import {Data} from "../../models/data";
|
||||
import {FormBuilder, FormGroup, Validators} from "@angular/forms";
|
||||
import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from "@angular/material/dialog";
|
||||
import {User} from "../../models/user";
|
||||
import {ToastrService} from "ngx-toastr";
|
||||
import {DatePipe} from "@angular/common";
|
||||
import {SpecializationService} from "../../services/specialization.service";
|
||||
import {Response} from "../../models/response";
|
||||
|
||||
@Component({
|
||||
selector: 'app-add-specialization',
|
||||
templateUrl: './add-specialization.component.html',
|
||||
styleUrls: ['./add-specialization.component.scss']
|
||||
})
|
||||
export class AddSpecializationComponent implements OnInit {
|
||||
@Output() closeModal: EventEmitter<Data> = new EventEmitter<Data>();
|
||||
specializations!: Data[];
|
||||
spinner = false;
|
||||
specializationForm!: FormGroup;
|
||||
|
||||
constructor(
|
||||
@Inject(MAT_DIALOG_DATA) public data: User,
|
||||
public dialog: MatDialog,
|
||||
public dialogRef: MatDialogRef<AddSpecializationComponent>,
|
||||
private fb: FormBuilder,
|
||||
private toastr: ToastrService,
|
||||
private datePipe: DatePipe,
|
||||
private specializationServie: SpecializationService
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.createForm();
|
||||
}
|
||||
|
||||
createForm(){
|
||||
this.specializationForm = this.fb.group({
|
||||
name: ['', Validators.required]
|
||||
})
|
||||
}
|
||||
|
||||
submit(){
|
||||
this.spinner = true;
|
||||
// @ts-ignore
|
||||
this.specializationServie.postCreateSpecialization(this.specializationForm.value).subscribe((response: Response) =>{
|
||||
this.toastr.success(response.data.message, 'Exito!');
|
||||
this.spinner = false;
|
||||
this.dialogRef.close(true);
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
this.spinner = false;
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<div *ngIf="loadSpinner == true" class="body_modal">
|
||||
<mat-spinner></mat-spinner>
|
||||
</div>
|
||||
<div class="body_modal" *ngIf="userForm && loadSpinner == false">
|
||||
<div class="body_modal-tittle">
|
||||
<h1>{{user ? 'Editar' : 'Agregar'}} Usuario</h1>
|
||||
</div>
|
||||
<form [formGroup]="userForm" class="body_modal-form">
|
||||
<div class="body_modal-form_row">
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field">
|
||||
<mat-label>Nombre</mat-label>
|
||||
<input type="text" matInput formControlName="name" required>
|
||||
<!-- <mat-error *ngIf="activityForm.controls['created'].hasError('required')">-->
|
||||
<!-- Este campo es <strong>requerido</strong>-->
|
||||
<!-- </mat-error>-->
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field">
|
||||
<mat-label>Apellido</mat-label>
|
||||
<input type="text" matInput formControlName="lastname" required>
|
||||
<!-- <mat-error *ngIf="activityForm.controls['created'].hasError('required')">-->
|
||||
<!-- Este campo es <strong>requerido</strong>-->
|
||||
<!-- </mat-error>-->
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field">
|
||||
<mat-label>Email</mat-label>
|
||||
<input type="email" matInput formControlName="email" required>
|
||||
<!-- <mat-error *ngIf="activityForm.controls['created'].hasError('required')">-->
|
||||
<!-- Este campo es <strong>requerido</strong>-->
|
||||
<!-- </mat-error>-->
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field">
|
||||
<mat-label>Acrónimo</mat-label>
|
||||
<input type="text" matInput formControlName="acronym" required>
|
||||
<!-- <mat-error *ngIf="activityForm.controls['created'].hasError('required')">-->
|
||||
<!-- Este campo es <strong>requerido</strong>-->
|
||||
<!-- </mat-error>-->
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field" *ngIf="!user">
|
||||
<mat-label>Contraseña</mat-label>
|
||||
<input type="text" matInput formControlName="password" required>
|
||||
<!-- <mat-error *ngIf="activityForm.controls['created'].hasError('required')">-->
|
||||
<!-- Este campo es <strong>requerido</strong>-->
|
||||
<!-- </mat-error>-->
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field">
|
||||
<mat-label>Honorarios</mat-label>
|
||||
<input type="text" matInput formControlName="rate" required>
|
||||
<!-- <mat-error *ngIf="activityForm.controls['created'].hasError('required')">-->
|
||||
<!-- Este campo es <strong>requerido</strong>-->
|
||||
<!-- </mat-error>-->
|
||||
</mat-form-field>
|
||||
<div class="specialization-row">
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field_sp">
|
||||
<mat-label>Especialización</mat-label>
|
||||
<mat-select formControlName="id_specialization" [disabled]="!specializations">
|
||||
<mat-option [value]="">Selecciona Especialización</mat-option>
|
||||
<mat-option *ngFor="let specialization of specializations"
|
||||
[value]="specialization.id">{{specialization.name}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<button type="button" mat-raised-button color="primary" (click)="addSpecialization()">Añadir
|
||||
</button>
|
||||
</div>
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field">
|
||||
<mat-label>Rol</mat-label>
|
||||
<mat-select formControlName="id_rol">
|
||||
<mat-option [value]="">Selecciona Rol</mat-option>
|
||||
<mat-option *ngFor="let rol of roles" [value]="rol.id">{{rol.name}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="body_modal-form_row">
|
||||
<button mat-raised-button color="primary" (click)="submit()" style="margin-bottom: 5%;"
|
||||
[disabled]="userForm.invalid || spinner || userForm.controls['id_specialization'].value == '' || userForm.controls['id_rol'].value == ''"
|
||||
[class.spinner]="spinner">{{user ? 'Editar' : 'Agregar'}}</button>
|
||||
<button mat-raised-button color="warn" (click)="this.dialogRef.close(false)">Cerrar</button>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,41 @@
|
||||
.body_modal-form {
|
||||
width: 100%;
|
||||
height: 90%;
|
||||
padding: 2%;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
|
||||
.body_modal-form_row {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-bottom: 5%;
|
||||
}
|
||||
|
||||
.body_modal-form_row-field {
|
||||
padding-right: 3%;
|
||||
}
|
||||
|
||||
.body_modal-form_row-field_sp {
|
||||
width: 71%;
|
||||
padding-right: 3%;
|
||||
}
|
||||
|
||||
.body_modal {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.specialization-row {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AddUserComponent } from './add-user.component';
|
||||
|
||||
describe('AddUserComponent', () => {
|
||||
let component: AddUserComponent;
|
||||
let fixture: ComponentFixture<AddUserComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ AddUserComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AddUserComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,134 @@
|
||||
import {Component, EventEmitter, Inject, Input, OnInit, Output} from '@angular/core';
|
||||
import {Case} from "../../models/case";
|
||||
import {User} from "../../models/user";
|
||||
import {FormBuilder, FormGroup, Validators} from "@angular/forms";
|
||||
import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from "@angular/material/dialog";
|
||||
import {ToastrService} from "ngx-toastr";
|
||||
import {DatePipe} from "@angular/common";
|
||||
import {UserService} from "../../services/user.service";
|
||||
import {SpecializationService} from "../../services/specialization.service";
|
||||
import {Data} from "../../models/data";
|
||||
import {Response} from "../../models/response";
|
||||
import {AddSpecializationComponent} from "../add-specialization/add-specialization.component";
|
||||
|
||||
@Component({
|
||||
selector: 'app-add-user',
|
||||
templateUrl: './add-user.component.html',
|
||||
styleUrls: ['./add-user.component.scss']
|
||||
})
|
||||
export class AddUserComponent implements OnInit {
|
||||
|
||||
@Output() closeModal: EventEmitter<User> = new EventEmitter<User>();
|
||||
@Input() user: User = this.data;
|
||||
users!: User[];
|
||||
specializations!: Data[];
|
||||
roles!: Data[];
|
||||
userForm!: FormGroup;
|
||||
loadSpinner: boolean = false;
|
||||
spinner = false;
|
||||
|
||||
constructor(
|
||||
@Inject(MAT_DIALOG_DATA) public data: User,
|
||||
public dialog: MatDialog,
|
||||
public dialogRef: MatDialogRef<AddUserComponent>,
|
||||
private fb: FormBuilder,
|
||||
private toastr: ToastrService,
|
||||
private datePipe: DatePipe,
|
||||
private userService: UserService,
|
||||
private specializationServie: SpecializationService
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.loadSpinner = true;
|
||||
// @ts-ignore
|
||||
this.userService.getAllRoles().subscribe((response: Response) => {
|
||||
this.roles = response.data.roles!;
|
||||
// @ts-ignore
|
||||
this.specializationServie.getAllSpecializations().subscribe((response: Response) => {
|
||||
this.specializations = response.data.specializations!;
|
||||
this.loadSpinner = false;
|
||||
this.createForm();
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
})
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
getSpecializations() {
|
||||
// @ts-ignore
|
||||
this.specializationServie.getAllSpecializations().subscribe((response: Response) => {
|
||||
this.specializations = response.data.specializations!;
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
})
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.userForm = this.fb.group({
|
||||
name: [this.user ? this.user.name : '', Validators.required],
|
||||
lastname: [this.user ? this.user.lastname : '', Validators.required],
|
||||
email: [this.user ? this.user.email : '', Validators.compose([Validators.required, Validators.email])],
|
||||
rate: [this.user ? this.user.rate : '', Validators.required],
|
||||
acronym: [this.user ? this.user.acronym : '', Validators.required],
|
||||
password: ['', !this.user ? Validators.required : ''],
|
||||
id_specialization: [this.user ? this.user.id_specialization : '', Validators.required],
|
||||
id_rol: [this.user ? this.user.id_rol : '', Validators.required],
|
||||
})
|
||||
}
|
||||
|
||||
addSpecialization() {
|
||||
this.dialog.open(AddSpecializationComponent, {
|
||||
maxWidth: '60%',
|
||||
minWidth: '330px',
|
||||
panelClass: 'dialog-container',
|
||||
disableClose: true,
|
||||
}).afterClosed().subscribe(result => {
|
||||
if (result === true) {
|
||||
this.getSpecializations();
|
||||
}
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.message, title);
|
||||
})
|
||||
}
|
||||
|
||||
submit() {
|
||||
this.spinner = true;
|
||||
if (!this.user) {
|
||||
// @ts-ignore
|
||||
this.userService.postCreateUser(this.userForm.value).subscribe((response: Response) => {
|
||||
this.toastr.success(response.data.message, 'Exito!');
|
||||
this.spinner = false;
|
||||
this.dialogRef.close(true);
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
this.spinner = false;
|
||||
})
|
||||
} else {
|
||||
const data = {
|
||||
...this.userForm.value,
|
||||
password: this.user.password,
|
||||
id: this.user.id
|
||||
}
|
||||
// @ts-ignore
|
||||
this.userService.putUpdateUser(data).subscribe((response: Response) => {
|
||||
this.toastr.success(response.data.message, 'Exito!');
|
||||
this.spinner = false;
|
||||
this.dialogRef.close(true);
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
this.spinner = false;
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<div *ngIf="loadSpinner == true" class="body_modal">
|
||||
<mat-spinner></mat-spinner>
|
||||
</div>
|
||||
<div class="body_modal" *ngIf="arrAssing && loadSpinner == false">
|
||||
<div class="body_modal-tittle">
|
||||
<h1>{{type == 'assing' ? 'Asignar' : 'Remover'}} Usuario</h1>
|
||||
</div>
|
||||
<div class="body_modal-form">
|
||||
<div class="body_modal-form_row">
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field" *ngIf="arrAssing.length > 0">
|
||||
<mat-label>Usuario</mat-label>
|
||||
<mat-select multiple>
|
||||
<mat-option [disabled]="opcAll" (onSelectionChange)="assingAll($event)" *ngIf="type === 'assing'">
|
||||
Todos
|
||||
</mat-option>
|
||||
<mat-option (onSelectionChange)="assingCase(user, $event)" *ngFor="let user of arrAssing" [disabled]="opcUser"
|
||||
[value]="user.id">{{user.name}} {{user.lastname}} ({{user.acronym}})
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<h3 *ngIf="arrAssing.length == 0">No hay usuarios para {{type == 'assing' ? 'asignar' : 'remover'}}</h3>
|
||||
</div>
|
||||
<button mat-raised-button color="primary" (click)="submit()" style="margin-bottom: 5%;"
|
||||
[disabled]="assingUsers.length < 1 || spinner"
|
||||
[class.spinner]="spinner">{{type == 'assing' ? 'Asignar' : 'Remover'}}</button>
|
||||
<button mat-raised-button color="warn" (click)="this.dialogRef.close(false)">Cerrar</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,29 @@
|
||||
.body_modal-form {
|
||||
width: 90%;
|
||||
height: 90%;
|
||||
padding: 2%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.body_modal-form_row {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.body_modal-form_row-field {
|
||||
padding-right: 3%;
|
||||
}
|
||||
|
||||
.body_modal {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AssingCaseComponent } from './assing-case.component';
|
||||
|
||||
describe('AssingCaseComponent', () => {
|
||||
let component: AssingCaseComponent;
|
||||
let fixture: ComponentFixture<AssingCaseComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ AssingCaseComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AssingCaseComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,130 @@
|
||||
import {Component, EventEmitter, Inject, Input, OnInit, Output} from '@angular/core';
|
||||
import {Case} from "../../models/case";
|
||||
import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from "@angular/material/dialog";
|
||||
import {ToastrService} from "ngx-toastr";
|
||||
import {UserService} from "../../services/user.service";
|
||||
import {CaseService} from "../../services/case.service";
|
||||
import {Response} from "../../models/response";
|
||||
import {User} from "../../models/user";
|
||||
|
||||
@Component({
|
||||
selector: 'app-assing-case',
|
||||
templateUrl: './assing-case.component.html',
|
||||
styleUrls: ['./assing-case.component.scss']
|
||||
})
|
||||
export class AssingCaseComponent implements OnInit {
|
||||
|
||||
@Output() closeModal: EventEmitter<Case> = new EventEmitter<Case>();
|
||||
@Input() id_case: number = this.data.id_case;
|
||||
@Input() type: string = this.data.type;
|
||||
assingUsers: any[] = [];
|
||||
users!: User[];
|
||||
arrAssing!: any [];
|
||||
loadSpinner = false;
|
||||
spinner = false;
|
||||
opcAll: boolean = false;
|
||||
opcUser: boolean = false;
|
||||
|
||||
constructor(
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
public dialog: MatDialog,
|
||||
public dialogRef: MatDialogRef<AssingCaseComponent>,
|
||||
private toastr: ToastrService,
|
||||
private userService: UserService,
|
||||
private caseService: CaseService,
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.loadSpinner = true;
|
||||
if (this.type === 'unassing') {
|
||||
// @ts-ignore
|
||||
this.caseService.getAssingUsersByCase(this.id_case).subscribe((response: Response) => {
|
||||
this.arrAssing = response.data.users!;
|
||||
this.loadSpinner = false;
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
})
|
||||
} else if (this.type === 'assing') {
|
||||
// @ts-ignore
|
||||
this.caseService.getNotAssingUsersByCase(this.id_case).subscribe((response: Response) => {
|
||||
this.arrAssing = response.data.users!;
|
||||
this.loadSpinner = false;
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
assingCase(id: number, event: any) {
|
||||
const index = this.assingUsers.findIndex(id_user => id_user == id)
|
||||
if (index > -1) {
|
||||
this.assingUsers.splice(index, 1);
|
||||
} else {
|
||||
this.assingUsers.push(id);
|
||||
}
|
||||
this.opcAll = this.assingUsers.length != 0;
|
||||
}
|
||||
|
||||
assingAll(event: any) {
|
||||
if (event.source._selected) {
|
||||
this.opcUser = true;
|
||||
for (let user of this.arrAssing) {
|
||||
this.assingUsers.push(user.id);
|
||||
}
|
||||
} else {
|
||||
this.assingUsers = [];
|
||||
this.opcUser = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
submit() {
|
||||
this.spinner = true;
|
||||
let aux: any[] = []
|
||||
let cont = 0
|
||||
this.assingUsers.map(id => {
|
||||
aux.push({
|
||||
id_user: id.id,
|
||||
id_case: this.id_case
|
||||
})
|
||||
})
|
||||
if (this.type === 'assing') {
|
||||
// @ts-ignore
|
||||
this.caseService.postAssingCase(aux).subscribe((response: Response) => {
|
||||
this.toastr.success(response.data.message, 'Exito!');
|
||||
this.spinner = false;
|
||||
this.dialogRef.close();
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
})
|
||||
} else if (this.type === 'unassing') {
|
||||
for (let user of aux) {
|
||||
if (cont === aux.length - 1) {
|
||||
// @ts-ignore
|
||||
this.caseService.postUnassingCase(user).subscribe((response: Response) => {
|
||||
this.toastr.success(response.data.message, 'Exito!');
|
||||
this.spinner = false;
|
||||
cont = 0;
|
||||
this.dialogRef.close();
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
})
|
||||
} else {
|
||||
// @ts-ignore
|
||||
this.caseService.postUnassingCase(user).subscribe((response: Response) => {
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
});
|
||||
cont = cont + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<div class="body_dialog">
|
||||
<div class="body_dialog_icon">
|
||||
<mat-icon class="type_icon" *ngIf="type==='warning'">warning</mat-icon>
|
||||
<mat-icon class="type_icon" *ngIf="type==='delete'">delete</mat-icon>
|
||||
</div>
|
||||
<div mat-dialog-content class="body_dialog_message">
|
||||
<p>{{message}}</p>
|
||||
</div>
|
||||
<div mat-dialog-actions class="body_dialog_action">
|
||||
<button mat-button (click)="dialogRef.close()">Regresar</button>
|
||||
<button mat-button (click)="confirmDialog()">Confirmar</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
.type_icon{
|
||||
font-size: xxx-large;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.body_dialog{
|
||||
display: flex;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.body_dialog_icon{
|
||||
height: 50%;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
font-size: xxx-large;
|
||||
color: #ffe623;
|
||||
}
|
||||
|
||||
.body_dialog_message{
|
||||
height: 25%;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.body_dialog_action{
|
||||
height: 25%;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ConfirmComponent } from './confirm.component';
|
||||
|
||||
describe('ConfirmComponent', () => {
|
||||
let component: ConfirmComponent;
|
||||
let fixture: ComponentFixture<ConfirmComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ ConfirmComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ConfirmComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,27 @@
|
||||
import {Component, EventEmitter, Inject, Input, OnInit, Output} from '@angular/core';
|
||||
import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from "@angular/material/dialog";
|
||||
|
||||
@Component({
|
||||
selector: 'app-confirm',
|
||||
templateUrl: './confirm.component.html',
|
||||
styleUrls: ['./confirm.component.scss']
|
||||
})
|
||||
export class ConfirmComponent implements OnInit {
|
||||
|
||||
@Output() closeModal: EventEmitter<any> = new EventEmitter<any>();
|
||||
@Input() message: string = this.data.message;
|
||||
@Input() type: string = this.data.type;
|
||||
constructor(
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
public dialog: MatDialog,
|
||||
public dialogRef: MatDialogRef<ConfirmComponent>,
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
confirmDialog(){
|
||||
this.dialogRef.close(true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<div class="body_modal" *ngIf="!clients || !cases || !users">
|
||||
<mat-spinner></mat-spinner>
|
||||
</div>
|
||||
|
||||
<div class="body_modal" *ngIf="filterForm && clients && cases && users">
|
||||
<div class="body_modal-tittle">
|
||||
<h1>Filtro</h1>
|
||||
</div>
|
||||
<form [formGroup]="filterForm" class="body_modal-form">
|
||||
<div class="body_modal-form_row">
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field">
|
||||
<mat-label>Usuario</mat-label>
|
||||
<mat-select formControlName="id_created">
|
||||
<mat-option [value]="null">Selecciona Usuario</mat-option>
|
||||
<mat-option *ngFor="let user$ of users" [value]="user$.id">{{user$.name}} {{user$.lastname}}
|
||||
({{user$.acronym}})
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="body_modal-form_row">
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field">
|
||||
<mat-label>Cliente</mat-label>
|
||||
<mat-select formControlName="id_client" (selectionChange)="casesByClient()">
|
||||
<mat-option [value]="null">Selecciona Cliente</mat-option>
|
||||
<mat-option *ngFor="let client$ of clients" [value]="client$.id">{{client$.businessname}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="body_modal-form_row">
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field">
|
||||
<mat-label>Caso</mat-label>
|
||||
<mat-select formControlName="id_case">
|
||||
<mat-option [value]="null">Selecciona Caso</mat-option>
|
||||
<mat-option *ngFor="let case$ of cases" [value]="case$.id">{{case$.name}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="body_modal-form_row" *ngIf="export === true">
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field">
|
||||
<mat-label>Fecha Inicio</mat-label>
|
||||
<input type="date" matInput formControlName="fecha_inicio" [max]="today">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="body_modal-form_row" *ngIf="export === true">
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field">
|
||||
<mat-label>Fecha Fin</mat-label>
|
||||
<input type="date" matInput formControlName="fecha_fin" [max]="today">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="body_modal-form_row">
|
||||
<button mat-raised-button color="warn" (click)="this.dialogRef.close(false)">Cerrar</button>
|
||||
<button mat-raised-button color="primary" (click)="dialogRef.close(filterForm.value)">Filtrar</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,29 @@
|
||||
.body_modal-form {
|
||||
width: 100%;
|
||||
height: 90%;
|
||||
padding: 2%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.body_modal-form_row {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.body_modal-form_row-field {
|
||||
margin-bottom: 3%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.body_modal {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { FilterComponent } from './filter.component';
|
||||
|
||||
describe('FilterComponent', () => {
|
||||
let component: FilterComponent;
|
||||
let fixture: ComponentFixture<FilterComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ FilterComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(FilterComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,106 @@
|
||||
import {Component, EventEmitter, Inject, Input, OnInit, Output} from '@angular/core';
|
||||
import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from "@angular/material/dialog";
|
||||
import {FormBuilder, FormGroup} from "@angular/forms";
|
||||
import {DatePipe} from "@angular/common";
|
||||
import {Response} from "../../models/response";
|
||||
import {Client} from "../../models/client";
|
||||
import {User} from "../../models/user";
|
||||
import {Case} from "../../models/case";
|
||||
import {ToastrService} from "ngx-toastr";
|
||||
import {UserService} from "../../services/user.service";
|
||||
import {ClientService} from "../../services/client.service";
|
||||
import {CaseService} from "../../services/case.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-filter',
|
||||
templateUrl: './filter.component.html',
|
||||
styleUrls: ['./filter.component.scss']
|
||||
})
|
||||
export class FilterComponent implements OnInit {
|
||||
|
||||
@Output() closeModal: EventEmitter<any> = new EventEmitter<any>();
|
||||
@Input() export: boolean = this.data.export;
|
||||
clients!: Client[];
|
||||
users!: User[];
|
||||
cases!: Case[];
|
||||
filterForm!: FormGroup;
|
||||
today;
|
||||
disable: boolean = false;
|
||||
|
||||
constructor(public dialog: MatDialog,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
private fb: FormBuilder,
|
||||
private toastr: ToastrService,
|
||||
private userService: UserService,
|
||||
private clientService: ClientService,
|
||||
private caseService: CaseService,
|
||||
private datePipe: DatePipe,
|
||||
public dialogRef: MatDialogRef<FilterComponent>) {
|
||||
this.today = this.datePipe.transform(new Date(), 'YYYY-MM-dd');
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.createForm();
|
||||
// @ts-ignore
|
||||
this.clientService.getAllClient().subscribe((response: Response) => {
|
||||
this.clients = response.data.clients!;
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
});
|
||||
// @ts-ignore
|
||||
this.caseService.getAllCases().subscribe((response: Response) => {
|
||||
this.cases = response.data.cases!;
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
});
|
||||
// @ts-ignore
|
||||
this.userService.getAllUsers().subscribe((response: Response) => {
|
||||
this.users = response.data.users!;
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
});
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.filterForm = this.fb.group({
|
||||
id_created: [null],
|
||||
id_client: [null],
|
||||
id_case: [null],
|
||||
fecha_inicio: [null],
|
||||
fecha_fin: [null]
|
||||
})
|
||||
}
|
||||
|
||||
casesByClient() {
|
||||
this.disable = true;
|
||||
if (this.filterForm.controls['id_client'].value !== null) {
|
||||
// @ts-ignore
|
||||
this.caseService.getCasesByClient(this.filterForm.controls['id_client'].value).subscribe((response: Response) => {
|
||||
this.cases = response.data.cases!
|
||||
this.disable = false;
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
})
|
||||
} else {
|
||||
// @ts-ignore
|
||||
this.caseService.getAllCases().subscribe((response: Response) => {
|
||||
this.cases = response.data.cases!
|
||||
this.disable = false;
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
cleanFilter() {
|
||||
this.filterForm.reset();
|
||||
// this.getAllEvents();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<div class="body_modal" *ngIf="resetForm ">
|
||||
<div class="body_modal-tittle">
|
||||
<h1>Recuperar contraseña</h1>
|
||||
</div>
|
||||
<form [formGroup]="resetForm" class="body_modal-form">
|
||||
<div class="body_modal-form_row">
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field">
|
||||
<mat-label>Correo</mat-label>
|
||||
<input type="email" matInput formControlName="email" placeholder="example@aspen-legal.com" required>
|
||||
<mat-error *ngIf="resetForm.controls['email'].hasError('required')">
|
||||
Este campo es <strong>requerido</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="body_modal-form_row">
|
||||
<button mat-raised-button color="warn" (click)="this.dialogRef.close(false)">Cerrar</button>
|
||||
<button mat-raised-button color="primary" (click)="sendMail()"
|
||||
[disabled]="resetForm.invalid || spinner"
|
||||
[class.spinner]="spinner">Enviar Correo</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,29 @@
|
||||
.body_modal-form {
|
||||
width: 100%;
|
||||
height: 90%;
|
||||
padding: 2%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.body_modal-form_row {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.body_modal-form_row-field {
|
||||
margin-bottom: 3%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.body_modal {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ForgotPasswordComponent } from './forgot-password.component';
|
||||
|
||||
describe('ForgotPasswordComponent', () => {
|
||||
let component: ForgotPasswordComponent;
|
||||
let fixture: ComponentFixture<ForgotPasswordComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ ForgotPasswordComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ForgotPasswordComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,49 @@
|
||||
import {Component, EventEmitter, OnInit, Output} from '@angular/core';
|
||||
import {AuthService} from "../../services/auth.service";
|
||||
import {FormBuilder, FormGroup, Validators} from "@angular/forms";
|
||||
import {MatDialog, MatDialogRef} from "@angular/material/dialog";
|
||||
import {ToastrService} from "ngx-toastr";
|
||||
import {Response} from "../../models/response";
|
||||
|
||||
@Component({
|
||||
selector: 'app-forgot-password',
|
||||
templateUrl: './forgot-password.component.html',
|
||||
styleUrls: ['./forgot-password.component.scss']
|
||||
})
|
||||
export class ForgotPasswordComponent implements OnInit {
|
||||
|
||||
@Output() closeModal: EventEmitter<any> = new EventEmitter<any>();
|
||||
spinner = false;
|
||||
resetForm!: FormGroup
|
||||
constructor(
|
||||
private authService: AuthService,
|
||||
private fb: FormBuilder,
|
||||
public dialog: MatDialog,
|
||||
public dialogRef: MatDialogRef<ForgotPasswordComponent>,
|
||||
private toastr: ToastrService,
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.createForm();
|
||||
}
|
||||
|
||||
createForm(){
|
||||
this.resetForm = this.fb.group({
|
||||
email: ['', Validators.compose([Validators.required, Validators.email])]
|
||||
})
|
||||
}
|
||||
|
||||
sendMail(){
|
||||
this.spinner =true;
|
||||
// @ts-ignore
|
||||
this.authService.forgotPassword(this.resetForm.controls['email'].value).subscribe((response: Response) => {
|
||||
this.toastr.success(response.data.message, 'Exito!');
|
||||
this.spinner =false;
|
||||
this.dialogRef.close();
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
this.spinner =false;
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<mat-toolbar color="primary" class="body_navbar">
|
||||
<button mat-icon-button (click)="drawer.toggle() ">
|
||||
<mat-icon>menu</mat-icon>
|
||||
</button>
|
||||
<span>Aspen Legal</span>
|
||||
<!-- <span>Génesis</span>-->
|
||||
<div class="account">
|
||||
<h4>{{displayName}}</h4>
|
||||
<button mat-icon-button [matMenuTriggerFor]="menu">
|
||||
<mat-icon>account_circle</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<mat-menu #menu="matMenu">
|
||||
<!-- <button mat-menu-item [routerLink]="['/profile']">-->
|
||||
<!-- <mat-icon>account_circle</mat-icon>-->
|
||||
<!-- <span>Perfil</span>-->
|
||||
<!-- </button>-->
|
||||
<button mat-menu-item (click)="resetPassword()">
|
||||
<mat-icon>password</mat-icon>
|
||||
<span>Cambio de Clave</span>
|
||||
</button>
|
||||
<button mat-menu-item (click)="logOut()">
|
||||
<mat-icon>logout</mat-icon>
|
||||
<span>Cerrar Sesión</span>
|
||||
</button>
|
||||
</mat-menu>
|
||||
</mat-toolbar>
|
||||
<mat-drawer-container autosize class="body">
|
||||
<mat-drawer #drawer mode="side" class="body_drawer">
|
||||
<mat-nav-list>
|
||||
<a mat-list-item [routerLink]="['/home']" routerLinkActive="active"
|
||||
[routerLinkActiveOptions]="{exact: true}">
|
||||
<span mat-list-icon class="material-icons">home</span>
|
||||
<span class="item_name">Home</span>
|
||||
</a>
|
||||
<mat-divider></mat-divider>
|
||||
<a mat-list-item [routerLink]="['/courier']" routerLinkActive="active"
|
||||
[routerLinkActiveOptions]="{exact: true}">
|
||||
<span mat-list-icon class="material-icons">directions_car</span>
|
||||
<span class="item_name">Mensajería</span>
|
||||
</a>
|
||||
<mat-divider></mat-divider>
|
||||
<a mat-list-item [routerLink]="['/dashboard']" routerLinkActive="active" *ngIf="user_rol === 'admin'"
|
||||
[routerLinkActiveOptions]="{exact: true}">
|
||||
<span mat-list-icon class="material-icons">dashboard</span>
|
||||
<span class="item_name">Dashboard</span>
|
||||
</a>
|
||||
<mat-divider *ngIf="user_rol === 'admin'"></mat-divider>
|
||||
<a mat-list-item [routerLink]="['/client']" routerLinkActive="active" *ngIf="user_rol === 'admin'"
|
||||
[routerLinkActiveOptions]="{exact: true}">
|
||||
<span mat-list-icon class="material-icons">people</span>
|
||||
<span class="item_name">Clientes</span>
|
||||
</a>
|
||||
<mat-divider *ngIf="user_rol === 'admin'"></mat-divider>
|
||||
<a mat-list-item [routerLink]="['/case']" routerLinkActive="active" *ngIf="user_rol === 'admin'"
|
||||
[routerLinkActiveOptions]="{exact: true}">
|
||||
<span mat-list-icon class="material-icons">cases</span>
|
||||
<span class="item_name">Casos</span>
|
||||
</a>
|
||||
<mat-divider *ngIf="user_rol === 'admin'"></mat-divider>
|
||||
<a mat-list-item [routerLink]="['/user']" routerLinkActive="active" *ngIf="user_rol === 'admin'"
|
||||
[routerLinkActiveOptions]="{exact: true}">
|
||||
<span mat-list-icon class="material-icons">account_box</span>
|
||||
<span class="item_name">Usuarios</span>
|
||||
</a>
|
||||
<mat-divider *ngIf="user_rol === 'admin'"></mat-divider>
|
||||
</mat-nav-list>
|
||||
</mat-drawer>
|
||||
<router-outlet></router-outlet>
|
||||
</mat-drawer-container>
|
||||
@@ -0,0 +1,19 @@
|
||||
.body {
|
||||
height: calc(100vh - 64px);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.body_navbar {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.body_drawer {
|
||||
width: 10%;
|
||||
}
|
||||
|
||||
.account {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { NavbarComponent } from './navbar.component';
|
||||
|
||||
describe('NavbarComponent', () => {
|
||||
let component: NavbarComponent;
|
||||
let fixture: ComponentFixture<NavbarComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ NavbarComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(NavbarComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,57 @@
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {Router} from "@angular/router";
|
||||
import {AuthService} from "../../services/auth.service";
|
||||
import {ToastrService} from "ngx-toastr";
|
||||
import {ConfirmComponent} from "../confirm/confirm.component";
|
||||
import {Response} from "../../models/response";
|
||||
import {MatDialog} from "@angular/material/dialog";
|
||||
import {ForgotPasswordComponent} from "../forgot-password/forgot-password.component";
|
||||
import {ResetPasswordComponent} from "../reset-password/reset-password.component";
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-navbar',
|
||||
templateUrl: './navbar.component.html',
|
||||
styleUrls: ['./navbar.component.scss']
|
||||
})
|
||||
export class NavbarComponent implements OnInit {
|
||||
|
||||
user_rol: string
|
||||
displayName: string
|
||||
|
||||
constructor(private router: Router, private authService: AuthService, private toastr: ToastrService, private dialog: MatDialog) {
|
||||
this.user_rol = this.authService.token.rol
|
||||
this.displayName = this.authService.token.displayName
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
logOut() {
|
||||
this.dialog.open(ConfirmComponent, {
|
||||
maxWidth: '60%',
|
||||
minWidth: '330px',
|
||||
panelClass: 'dialog-container',
|
||||
disableClose: true,
|
||||
data: {type: 'warning', message: '¿Seguro que deseas cerrar sesión?'}
|
||||
}).afterClosed().subscribe(result => {
|
||||
if (result === true) {
|
||||
this.authService.token = null;
|
||||
localStorage.removeItem('auth_token');
|
||||
localStorage.clear();
|
||||
this.toastr.success('Ha cerrado sesión satisfactoriamente', '¡Exito!');
|
||||
this.router.navigate(['']);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
resetPassword() {
|
||||
this.dialog.open(ResetPasswordComponent, {
|
||||
maxWidth: '60%',
|
||||
minWidth: '330px',
|
||||
panelClass: 'dialog-container',
|
||||
disableClose: true,
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<div class="body_modal" *ngIf="resetForm ">
|
||||
<div class="body_modal-tittle">
|
||||
<h1>Recuperar contraseña</h1>
|
||||
</div>
|
||||
<form [formGroup]="resetForm" class="body_modal-form">
|
||||
<div class="body_modal-form_row">
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field">
|
||||
<mat-label>Contraseña anterior</mat-label>
|
||||
<input type="password" matInput formControlName="oldpassword" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field">
|
||||
<mat-label>Nueva contraseña</mat-label>
|
||||
<input type="password" matInput formControlName="password" required>
|
||||
<mat-error *ngIf="errorMessage('password',8).value">
|
||||
{{errorMessage('password', 8).message}}
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field">
|
||||
<mat-label>Repite nueva contraseña</mat-label>
|
||||
<input type="password" matInput formControlName="confirmPassword" placeholder="example@aspen-legal.com" required>
|
||||
<mat-error *ngIf="errorMessage('confirmPassword',8).value">
|
||||
{{errorMessage('confirmPassword', 8).message}}
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="body_modal-form_row">
|
||||
<button mat-raised-button color="warn" (click)="this.dialogRef.close(false)">Cerrar</button>
|
||||
<button mat-raised-button color="primary" (click)="submit()"
|
||||
[disabled]="resetForm.invalid || spinner"
|
||||
[class.spinner]="spinner">Cambiar</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,31 @@
|
||||
.body_modal-form {
|
||||
width: 100%;
|
||||
height: 90%;
|
||||
padding: 2%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.body_modal-form_row {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
justify-content: space-around;
|
||||
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.body_modal-form_row-field {
|
||||
margin-bottom: 3%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.body_modal {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ResetPasswordComponent } from './reset-password.component';
|
||||
|
||||
describe('ResetPasswordComponent', () => {
|
||||
let component: ResetPasswordComponent;
|
||||
let fixture: ComponentFixture<ResetPasswordComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ ResetPasswordComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ResetPasswordComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,121 @@
|
||||
import {Component, EventEmitter, Inject, OnInit, Output} from '@angular/core';
|
||||
import {AuthService} from "../../services/auth.service";
|
||||
import {FormBuilder, FormGroup, Validators} from "@angular/forms";
|
||||
import {Activity} from "../../models/activity";
|
||||
import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from "@angular/material/dialog";
|
||||
import {ToastrService} from "ngx-toastr";
|
||||
import {Response} from "../../models/response";
|
||||
import {ValidatePassword} from "../../validators/confirmed.validator";
|
||||
|
||||
@Component({
|
||||
selector: 'app-reset-password',
|
||||
templateUrl: './reset-password.component.html',
|
||||
styleUrls: ['./reset-password.component.scss']
|
||||
})
|
||||
export class ResetPasswordComponent implements OnInit {
|
||||
|
||||
@Output() closeModal: EventEmitter<any> = new EventEmitter<any>();
|
||||
spinner = false;
|
||||
resetForm!: FormGroup
|
||||
|
||||
constructor(
|
||||
private authService: AuthService,
|
||||
private fb: FormBuilder,
|
||||
public dialog: MatDialog,
|
||||
public dialogRef: MatDialogRef<ResetPasswordComponent>,
|
||||
private toastr: ToastrService,
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.createForm();
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.resetForm = this.fb.group({
|
||||
oldpassword: ['', Validators.required],
|
||||
password: [null, Validators.compose([
|
||||
// 1\. Password Field is Required
|
||||
Validators.required,
|
||||
// 2\. check whether the entered password has a number
|
||||
ValidatePassword.patternValidator(/\d/, {hasNumber: true}),
|
||||
// 3\. check whether the entered password has upper case letter
|
||||
ValidatePassword.patternValidator(/[A-Z]/, {hasCapitalCase: true}),
|
||||
// 4\. check whether the entered password has a lower-case letter
|
||||
ValidatePassword.patternValidator(/[a-z]/, {hasSmallCase: true}),
|
||||
// 5\. check whether the entered password has a special character
|
||||
ValidatePassword.patternValidator(/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/, {hasSpecialCharacters: true}),
|
||||
// 6\. Has a minimum length of 8 characters
|
||||
Validators.minLength(8)])
|
||||
],
|
||||
confirmPassword: ['', Validators.required],
|
||||
},
|
||||
{
|
||||
validator: ValidatePassword.matchPassword
|
||||
})
|
||||
}
|
||||
|
||||
submit() {
|
||||
this.spinner = true;
|
||||
const data = {
|
||||
oldpassword: this.resetForm.controls['oldpassword'].value,
|
||||
password: this.resetForm.controls['password'].value
|
||||
}
|
||||
// @ts-ignore
|
||||
this.authService.resetPassword(data).subscribe((response: Response) => {
|
||||
this.toastr.success(response.data.message, 'Exito!');
|
||||
this.spinner = false;
|
||||
this.dialogRef.close();
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
this.spinner = false;
|
||||
})
|
||||
}
|
||||
|
||||
errorMessage(value: any, min?: any) {
|
||||
if (this.resetForm.controls[value].invalid && (this.resetForm.controls[value].dirty
|
||||
|| this.resetForm.controls[value].touched)) {
|
||||
// @ts-ignore
|
||||
if (this.resetForm.controls[value].value == 'default' || this.resetForm.controls[value].errors.required) {
|
||||
return {
|
||||
value: true,
|
||||
message: 'Campo Requerido'
|
||||
};
|
||||
} else {
|
||||
if (value === 'password') {
|
||||
return {
|
||||
value: true,
|
||||
message: 'La contraseña debe estar formada por al menos una mayúscula, una minúscula, números y algun caracter especial '
|
||||
};
|
||||
} else {
|
||||
if (value === 'confirmPassword') {
|
||||
return {
|
||||
value: true,
|
||||
message: 'Las contraseñas no coinciden'
|
||||
};
|
||||
} else {
|
||||
if (min) {
|
||||
return {
|
||||
value: true,
|
||||
message: 'Caracteres mínimo: ' + min
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
value: true,
|
||||
message: 'Campo Inválido'
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
value: false,
|
||||
message: ''
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<div class="body_modal" *ngIf="dateForm ">
|
||||
<div class="body_modal-tittle">
|
||||
<h1>Selecciona Rango</h1>
|
||||
</div>
|
||||
<form [formGroup]="dateForm" class="body_modal-form">
|
||||
<div class="body_modal-form_row">
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field">
|
||||
<mat-label>Fecha Inicio</mat-label>
|
||||
<input type="date" matInput formControlName="fecha_inicio" [max]="today">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="body_modal-form_row">
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field">
|
||||
<mat-label>Fecha Fin</mat-label>
|
||||
<input type="date" matInput formControlName="fecha_fin" [max]="today">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="body_modal-form_row">
|
||||
<button mat-raised-button color="warn" (click)="this.dialogRef.close(false)">Cerrar</button>
|
||||
<button mat-raised-button color="primary" (click)="dialogRef.close(dateForm.value)">Filtrar</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,29 @@
|
||||
.body_modal-form {
|
||||
width: 100%;
|
||||
height: 90%;
|
||||
padding: 2%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.body_modal-form_row {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.body_modal-form_row-field {
|
||||
margin-bottom: 3%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.body_modal {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SearchComponent } from './search.component';
|
||||
|
||||
describe('SearchComponent', () => {
|
||||
let component: SearchComponent;
|
||||
let fixture: ComponentFixture<SearchComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ SearchComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SearchComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,35 @@
|
||||
import {Component, EventEmitter, OnInit, Output} from '@angular/core';
|
||||
import {MatDialog, MatDialogRef} from "@angular/material/dialog";
|
||||
import {FormBuilder, FormGroup} from "@angular/forms";
|
||||
import {DatePipe} from "@angular/common";
|
||||
|
||||
@Component({
|
||||
selector: 'app-search',
|
||||
templateUrl: './search.component.html',
|
||||
styleUrls: ['./search.component.scss']
|
||||
})
|
||||
export class SearchComponent implements OnInit {
|
||||
|
||||
@Output() closeModal: EventEmitter<any> = new EventEmitter<any>();
|
||||
dateForm!: FormGroup;
|
||||
today;
|
||||
|
||||
constructor(public dialog: MatDialog,
|
||||
private fb: FormBuilder,
|
||||
private datePipe: DatePipe,
|
||||
public dialogRef: MatDialogRef<SearchComponent>,) {
|
||||
this.today = this.datePipe.transform(new Date(), 'YYYY-MM-dd');
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.createForm();
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.dateForm = this.fb.group({
|
||||
fecha_inicio: [null],
|
||||
fecha_fin: [null],
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<div class="body_modal" *ngIf="spinner == true">
|
||||
<mat-spinner></mat-spinner>
|
||||
</div>
|
||||
<div class="body_modal" *ngIf="spinner == false">
|
||||
<div class="body_modal-tittle">
|
||||
<h1>Trabajo Invertido</h1>
|
||||
</div>
|
||||
<div class="body_filter">
|
||||
<form [formGroup]="filterForm" class="body_modal-form">
|
||||
<div class="body_modal-form_row">
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field">
|
||||
<mat-label>Fecha Inicio</mat-label>
|
||||
<input type="date" matInput formControlName="fecha_inicio" [max]="today">
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="fill" class="body_modal-form_row-field">
|
||||
<mat-label>Fecha Fin</mat-label>
|
||||
<input type="date" matInput formControlName="fecha_fin" [max]="today">
|
||||
</mat-form-field>
|
||||
<button mat-raised-button color="primary" (click)="postUserFees()">Filtrar</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="body_table">
|
||||
<mat-form-field appearance="standard">
|
||||
<mat-label>Filter</mat-label>
|
||||
<input matInput (keyup)="applyFilter($event)" placeholder="Ex. Mia" #input>
|
||||
</mat-form-field>
|
||||
<div class="mat-elevation-z8">
|
||||
<table mat-table [dataSource]="dataSource" matSort class="body_table-table">
|
||||
<ng-container matColumnDef="id">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> ID</th>
|
||||
<td mat-cell *matCellDef="let row"> {{row.id}} </td>
|
||||
<td mat-footer-cell *matFooterCellDef></td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="displayName">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Responsable</th>
|
||||
<td mat-cell *matCellDef="let row"> {{row.name}} {{row.lastname}} ({{row.acronym}})</td>
|
||||
<td mat-footer-cell *matFooterCellDef></td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="hours">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Horas Trabajadas</th>
|
||||
<td mat-cell *matCellDef="let row"> {{row.horas_totales}} </td>
|
||||
<td mat-footer-cell *matFooterCellDef></td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="amount">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header>Honorario Correspondiente</th>
|
||||
<td mat-cell *matCellDef="let row"> ${{row.honorarios | money}} </td>
|
||||
<td mat-footer-cell *matFooterCellDef></td>
|
||||
</ng-container>
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
<tr class="mat-row" *matNoDataRow>
|
||||
<td class="mat-cell" colspan="4">No data matching the filter "{{input.value}}"</td>
|
||||
</tr>
|
||||
</table>
|
||||
<mat-paginator [pageSizeOptions]="[5, 10, 25, 50]" (page)="onPageChange($event)"></mat-paginator>
|
||||
</div>
|
||||
<div class="body_modal-action_row">
|
||||
<button mat-raised-button color="warn" (click)="this.dialogRef.close(false)">Cerrar</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,38 @@
|
||||
.body_modal-form_row-field {
|
||||
padding: 0 1% 0 0;
|
||||
width: 48%;
|
||||
}
|
||||
|
||||
.body_modal-form_row {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.body_modal-form {
|
||||
width: 100%;
|
||||
height: 90%;
|
||||
padding: 2%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
|
||||
.body_modal {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.body_modal-action_row {
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 5% 0 0 0;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { UserRateComponent } from './user-rate.component';
|
||||
|
||||
describe('UserRateComponent', () => {
|
||||
let component: UserRateComponent;
|
||||
let fixture: ComponentFixture<UserRateComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ UserRateComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(UserRateComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,122 @@
|
||||
import {Component, ElementRef, Inject, Input, OnInit, ViewChild} from '@angular/core';
|
||||
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
|
||||
import {ReportingService} from "../../services/reporting.service";
|
||||
import {Response} from "../../models/response";
|
||||
import {ToastrService} from "ngx-toastr";
|
||||
import {FormBuilder, FormGroup} from "@angular/forms";
|
||||
import {MatPaginator, PageEvent} from "@angular/material/paginator";
|
||||
import {MatSort} from "@angular/material/sort";
|
||||
import {MatTableDataSource} from "@angular/material/table";
|
||||
import {DatePipe} from "@angular/common";
|
||||
import {TableStateService} from "../../services/table-state.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-user-rate',
|
||||
templateUrl: './user-rate.component.html',
|
||||
styleUrls: ['./user-rate.component.scss']
|
||||
})
|
||||
export class UserRateComponent implements OnInit {
|
||||
|
||||
@Input() id_case: number = this.data.id_case;
|
||||
today;
|
||||
spinner = false;
|
||||
filterForm!: FormGroup;
|
||||
fees: any = [];
|
||||
displayedColumns: string[] = ['id', 'displayName', 'hours', 'amount'];
|
||||
dataSource!: MatTableDataSource<any>;
|
||||
private tableStateKey = 'user-rate';
|
||||
private paginatorRef: MatPaginator | null = null;
|
||||
@ViewChild('input') filterInput?: ElementRef<HTMLInputElement>;
|
||||
|
||||
@ViewChild(MatPaginator, {static: false}) set paginator(value: MatPaginator) {
|
||||
this.paginatorRef = value;
|
||||
if (this.dataSource) {
|
||||
this.dataSource.paginator = value;
|
||||
this.restoreTableState();
|
||||
}
|
||||
};
|
||||
@ViewChild(MatSort, {static: false}) set sort(value: MatSort) {
|
||||
if (this.dataSource) {
|
||||
this.dataSource.sort = value;
|
||||
}
|
||||
}
|
||||
|
||||
constructor(
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
private reportingService: ReportingService,
|
||||
private toastr: ToastrService,
|
||||
private fb: FormBuilder,
|
||||
public dialogRef: MatDialogRef<UserRateComponent>,
|
||||
private datePipe: DatePipe,
|
||||
private tableStateService: TableStateService,
|
||||
) {
|
||||
this.today = this.datePipe.transform(new Date(), 'YYYY-MM-dd');
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.createForm();
|
||||
if (this.id_case) {
|
||||
this.tableStateKey = `user-rate:${this.id_case}`;
|
||||
}
|
||||
this.postUserFees();
|
||||
}
|
||||
|
||||
applyFilter(event: Event) {
|
||||
const filterValue = (event.target as HTMLInputElement).value;
|
||||
this.dataSource.filter = filterValue.trim().toLowerCase();
|
||||
this.tableStateService.updateState(this.tableStateKey, {
|
||||
filter: filterValue,
|
||||
pageIndex: 0
|
||||
});
|
||||
|
||||
if (this.dataSource.paginator) {
|
||||
this.dataSource.paginator.firstPage();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.filterForm = this.fb.group({
|
||||
fecha_inicio: [null],
|
||||
fecha_fin: [null],
|
||||
})
|
||||
}
|
||||
|
||||
postUserFees() {
|
||||
this.spinner = true;
|
||||
// @ts-ignore
|
||||
this.reportingService.postCalculateUserFees(this.id_case, this.filterForm.controls['fecha_inicio'].value, this.filterForm.controls['fecha_fin'].value, null).subscribe((response: Response) => {
|
||||
this.fees = response.data.data;
|
||||
this.dataSource = new MatTableDataSource(this.fees);
|
||||
this.dataSource.paginator = this.paginatorRef
|
||||
this.dataSource.sort = this.sort;
|
||||
this.restoreTableState();
|
||||
this.spinner = false;
|
||||
}, error => {
|
||||
this.spinner = false;
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
})
|
||||
}
|
||||
|
||||
onPageChange(event: PageEvent) {
|
||||
this.tableStateService.updateState(this.tableStateKey, {
|
||||
pageIndex: event.pageIndex,
|
||||
pageSize: event.pageSize
|
||||
});
|
||||
}
|
||||
|
||||
private restoreTableState() {
|
||||
if (!this.dataSource || !this.paginatorRef) {
|
||||
return;
|
||||
}
|
||||
this.tableStateService.applyState(
|
||||
this.tableStateKey,
|
||||
this.dataSource,
|
||||
this.paginatorRef,
|
||||
this.filterInput?.nativeElement
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AdminGuard } from './admin.guard';
|
||||
|
||||
describe('AdminGuard', () => {
|
||||
let guard: AdminGuard;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
guard = TestBed.inject(AdminGuard);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(guard).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,39 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import {ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot, UrlTree} from '@angular/router';
|
||||
import {ToastrService} from "ngx-toastr";
|
||||
import {AuthService} from "../services/auth.service";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AdminGuard implements CanActivate {
|
||||
constructor(private toastr: ToastrService, private authService: AuthService, private router: Router) {
|
||||
}
|
||||
canActivate(
|
||||
route: ActivatedRouteSnapshot,
|
||||
state: RouterStateSnapshot): Promise<boolean> {
|
||||
|
||||
|
||||
if(this.authService.token){
|
||||
const rol = this.authService.token.rol;
|
||||
if(rol === 'admin'){
|
||||
// @ts-ignore
|
||||
return true;
|
||||
} else {
|
||||
this.toastr.error('No tienes acceso a este recurso', 'Error!')
|
||||
this.router.navigate(['/home']);
|
||||
// @ts-ignore
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
this.toastr.error('No tienes acceso a este recurso', 'Error!')
|
||||
this.router.navigate(['']);
|
||||
// @ts-ignore
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { LoginGuard } from './login.guard';
|
||||
|
||||
describe('LoginGuard', () => {
|
||||
let guard: LoginGuard;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
guard = TestBed.inject(LoginGuard);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(guard).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,33 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot, UrlTree} from '@angular/router';
|
||||
import {Observable} from 'rxjs';
|
||||
import {ToastrService} from "ngx-toastr";
|
||||
import {AuthService} from "../services/auth.service";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class LoginGuard implements CanActivate {
|
||||
constructor(private toastr: ToastrService, private authService: AuthService, private router: Router) {
|
||||
}
|
||||
|
||||
canActivate(
|
||||
route: ActivatedRouteSnapshot,
|
||||
state: RouterStateSnapshot): Promise<boolean> {
|
||||
|
||||
|
||||
if (this.authService.token) {
|
||||
// this.router.navigate(['/home']);
|
||||
// @ts-ignore
|
||||
return true;
|
||||
} else {
|
||||
this.toastr.error('Inicia sesión para acceder a este recurso', 'Error!')
|
||||
this.router.navigate(['']);
|
||||
// @ts-ignore
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {
|
||||
HttpInterceptor,
|
||||
HttpRequest,
|
||||
HttpHandler,
|
||||
HttpEvent,
|
||||
HttpResponse,
|
||||
HttpErrorResponse
|
||||
} from '@angular/common/http';
|
||||
import {Observable} from 'rxjs';
|
||||
import {Response} from '../models/response';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AuthInterceptorService implements HttpInterceptor {
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
||||
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
||||
const token: Response = JSON.parse(localStorage.getItem('auth_token')!);
|
||||
let request = req;
|
||||
if (token) {
|
||||
req.headers.set('Access-Control-Allow-Origin', '*');
|
||||
req.headers.set('Authorization', `Bearer ${token}`);
|
||||
request = req.clone({
|
||||
setHeaders: {
|
||||
authorization: `Bearer ${token}`,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
request.headers.set('Access-Control-Allow-Origin', '*');
|
||||
|
||||
return new Observable((observer) => {
|
||||
next.handle(request).subscribe(
|
||||
// @ts-ignore
|
||||
(res: HttpResponse<any>) => {
|
||||
observer.next(res);
|
||||
},
|
||||
(err: HttpErrorResponse) => {
|
||||
// if(err.status == 401 || err.status ==)
|
||||
observer.error(err);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import {Case} from "./case";
|
||||
import {User} from "./user";
|
||||
import {Data} from "./data";
|
||||
|
||||
export interface Activity {
|
||||
id?: number;
|
||||
description?: string;
|
||||
hours?: number;
|
||||
created?: string;
|
||||
updated?: string;
|
||||
amount?: number | null;
|
||||
rate?: number | null;
|
||||
id_created?: number;
|
||||
id_status?: number;
|
||||
id_paytype?: number;
|
||||
id_case?: number;
|
||||
paytype?: string;
|
||||
status?: string;
|
||||
case?: Case;
|
||||
user?: User
|
||||
id_category?: number;
|
||||
category?: any;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
export interface Case {
|
||||
id?: number;
|
||||
name?: string;
|
||||
created?: string;
|
||||
updated?: string
|
||||
id_client?: number;
|
||||
description?: string;
|
||||
id_created?: number;
|
||||
businessname?: any
|
||||
client?: any;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
export interface Client {
|
||||
id?: number;
|
||||
identdocument?: any;
|
||||
businessname?: string;
|
||||
description?: any;
|
||||
created?: string;
|
||||
updated?: string;
|
||||
id_documenttype?: any;
|
||||
id_recomended?: string;
|
||||
status?: string;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export interface Data {
|
||||
id?: number;
|
||||
name?: string;
|
||||
table?: string;
|
||||
description?: string;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import {Activity} from "./activity";
|
||||
import {Case} from "./case";
|
||||
import {Data} from "./data";
|
||||
import {User} from "./user";
|
||||
import {Client} from "./client";
|
||||
|
||||
export interface Response {
|
||||
data: {
|
||||
id_client?: number;
|
||||
id_case?: number;
|
||||
message?: string;
|
||||
accessToken?: string;
|
||||
activities?: Activity[];
|
||||
activity?: Activity;
|
||||
cases?: Case[];
|
||||
case?: Case;
|
||||
users?: User[];
|
||||
user?: User;
|
||||
specializations?: Data[];
|
||||
specialization?: Data;
|
||||
client?: Client;
|
||||
clients?: Client[];
|
||||
documentTypes?: Data[];
|
||||
assings?: any[];
|
||||
roles?: Data[];
|
||||
data?: any;
|
||||
};
|
||||
status: string;
|
||||
}
|
||||
|
||||
export interface Decode {
|
||||
iat: string;
|
||||
exp: string;
|
||||
displayName?: string;
|
||||
id?: number;
|
||||
rol?: string;
|
||||
acronym?: string;
|
||||
rate?: number;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
export interface User {
|
||||
id?: number;
|
||||
name?: string;
|
||||
lastname?: string;
|
||||
email?: string;
|
||||
rate?: number;
|
||||
acronym?: string;
|
||||
password?: string;
|
||||
created?: string;
|
||||
updated?: string;
|
||||
id_rol?: number;
|
||||
id_specialization?: number;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import {NgModule} from '@angular/core';
|
||||
import {RouterModule, Routes} from '@angular/router';
|
||||
import {BillsComponent} from "./bills.component";
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: BillsComponent
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class BillsRoutingModule {
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
<div class="body" *ngIf="spinner == true">
|
||||
<mat-spinner></mat-spinner>
|
||||
</div>
|
||||
<div class="body" *ngIf="spinner == false">
|
||||
<div class="body_action">
|
||||
<div class="body_action-section">
|
||||
<button mat-fab color="warn" [routerLink]="['/case']">
|
||||
<mat-icon>arrow_back</mat-icon>
|
||||
</button>
|
||||
<h2 style="margin-left: 5%">Regresar</h2>
|
||||
</div>
|
||||
<div class="body_action-section_two">
|
||||
<p>
|
||||
<strong>Cliente: </strong>{{caseFee ? caseFee !== [] ? caseFee[0].businessname : this.infoCase!.businessname : this.infoCase!.client.businessname}}
|
||||
</p>
|
||||
<p>
|
||||
<strong>Caso: </strong>{{caseFee ? caseFee !== [] ? caseFee[0].case : this.infoCase!.name : this.infoCase!.name}}
|
||||
</p>
|
||||
</div>
|
||||
<div class="body_action-section_three">
|
||||
<button mat-mini-fab color="primary" matTooltip="Agregar Actividad" (click)="addActivities()">
|
||||
<mat-icon>add</mat-icon>
|
||||
</button>
|
||||
<button mat-mini-fab color="primary" matTooltip="Filtrar" (click)="filterActivities()">
|
||||
<mat-icon>search</mat-icon>
|
||||
</button>
|
||||
<button mat-mini-fab color="primary" matTooltip="Exportar Excel" (click)="exportFile()" [disabled]="export">
|
||||
<mat-icon>download</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="body_table">
|
||||
<mat-form-field appearance="standard">
|
||||
<mat-label>Filter</mat-label>
|
||||
<input matInput (keyup)="applyFilter($event)" placeholder="Ex. Mia" #input>
|
||||
</mat-form-field>
|
||||
<div class="mat-elevation-z8">
|
||||
<table mat-table [dataSource]="dataSource" matSort class="body_table-table">
|
||||
<ng-container matColumnDef="id">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> ID</th>
|
||||
<td mat-cell *matCellDef="let row"> {{row.id}} </td>
|
||||
<td mat-footer-cell *matFooterCellDef><strong></strong></td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="description">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Descripcion</th>
|
||||
<td mat-cell *matCellDef="let row"> {{row.prevdescription}}</td>
|
||||
<td mat-footer-cell *matFooterCellDef></td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="created">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Fecha de Creacioón</th>
|
||||
<td mat-cell *matCellDef="let row"> {{row.created}}</td>
|
||||
<td mat-footer-cell *matFooterCellDef></td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="displayName">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Responsable</th>
|
||||
<td mat-cell *matCellDef="let row"> {{row.name}} {{row.lastname}} ({{row.acronym}})</td>
|
||||
<td mat-footer-cell *matFooterCellDef></td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="debe">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Debe</th>
|
||||
<td mat-cell *matCellDef="let row"> {{row.id_paytype == 3 ? (row.amount | money) : '-'}} </td>
|
||||
<td mat-footer-cell *matFooterCellDef>
|
||||
${{(infoCase ? 0 : (caseFee[0].debe === null ? 0 : caseFee[0].debe)) | money}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="haber">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Haber</th>
|
||||
<td mat-cell *matCellDef="let row"> {{row.id_paytype == 2 ? (row.amount | money) : '-'}} </td>
|
||||
<td mat-footer-cell *matFooterCellDef>
|
||||
${{(infoCase ? 0 : (caseFee[0].haber === null ? 0 : caseFee[0].haber)) | money}}</td>
|
||||
</ng-container>
|
||||
<!-- <ng-container matColumnDef="credit">-->
|
||||
<!-- <th mat-header-cell *matHeaderCellDef mat-sort-header> Haber</th>-->
|
||||
<!-- <td mat-cell *matCellDef="let row"> {{row.id_paytype === 2 ? row.total : '-' }} </td>-->
|
||||
<!-- <td mat-footer-cell *matFooterCellDef> ${{accountStatus.credito}}</td>-->
|
||||
<!-- </ng-container>-->
|
||||
<ng-container matColumnDef="edit">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header></th>
|
||||
<td mat-cell *matCellDef="let row">
|
||||
<button mat-icon-button (click)="addActivities(row)" matTooltip="Editar" matTooltipPosition="right">
|
||||
<mat-icon>edit</mat-icon>
|
||||
</button>
|
||||
</td>
|
||||
<td mat-footer-cell *matFooterCellDef><strong>TOTAL</strong></td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="delete">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header></th>
|
||||
<td mat-cell *matCellDef="let row">
|
||||
<button mat-icon-button (click)="deleteActivity(row.id)" matTooltip="Eliminar"
|
||||
matTooltipPosition="right">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</td>
|
||||
<td mat-footer-cell *matFooterCellDef>{{(infoCase ? 0 : (caseFee[0].total === null ? 0 : caseFee[0].total)) | money}}
|
||||
$
|
||||
</td>
|
||||
</ng-container>
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
<tr mat-footer-row *matFooterRowDef="displayedColumns"></tr>
|
||||
<tr class="mat-row" *matNoDataRow>
|
||||
<td class="mat-cell" colspan="4">No data matching the filter "{{input.value}}"</td>
|
||||
</tr>
|
||||
</table>
|
||||
<mat-paginator [pageSizeOptions]="[5, 10, 25, 50]" (page)="onPageChange($event)"></mat-paginator>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
.body_action-section {
|
||||
height: 100%;
|
||||
width: 10%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
//justify-content: center;
|
||||
}
|
||||
|
||||
.body_action-section_three {
|
||||
height: 100%;
|
||||
width: 15%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.body_action-section_two {
|
||||
height: 100%;
|
||||
width: 75%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.body_action-section_two p {
|
||||
margin: 0;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { BillsComponent } from './bills.component';
|
||||
|
||||
describe('BillsComponent', () => {
|
||||
let component: BillsComponent;
|
||||
let fixture: ComponentFixture<BillsComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ BillsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(BillsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,233 @@
|
||||
import {Component, ElementRef, OnInit, ViewChild} from '@angular/core';
|
||||
import {MatTableDataSource} from "@angular/material/table";
|
||||
import {DatePipe} from "@angular/common";
|
||||
import {ReportingService} from "../../../services/reporting.service";
|
||||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {Response} from "../../../models/response";
|
||||
import {SearchComponent} from "../../../components/search/search.component";
|
||||
import {MatDialog} from "@angular/material/dialog";
|
||||
import {Activity} from "../../../models/activity";
|
||||
import {ActivitiesComponent} from "../../../components/activities/activities.component";
|
||||
import * as FileSaver from "file-saver";
|
||||
import {ToastrService} from "ngx-toastr";
|
||||
import {ConfirmComponent} from "../../../components/confirm/confirm.component";
|
||||
import {MatPaginator, PageEvent} from "@angular/material/paginator";
|
||||
import {MatSort} from "@angular/material/sort";
|
||||
import {CaseService} from "../../../services/case.service";
|
||||
import {Case} from "../../../models/case";
|
||||
import {ActivityService} from "../../../services/activity.service";
|
||||
import {TableStateService} from "../../../services/table-state.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-bills',
|
||||
templateUrl: './bills.component.html',
|
||||
styleUrls: ['./bills.component.scss']
|
||||
})
|
||||
export class BillsComponent implements OnInit {
|
||||
|
||||
export: boolean = false;
|
||||
spinner = false;
|
||||
today;
|
||||
displayedColumns: string[] = ['id', 'description', 'created', 'displayName', 'debe', 'haber', 'edit', 'delete'];
|
||||
caseFee: any;
|
||||
dataSource!: MatTableDataSource<any>;
|
||||
infoCase: Case | undefined;
|
||||
private tableStateKey = 'case:bills';
|
||||
private paginatorRef: MatPaginator | null = null;
|
||||
@ViewChild('input') filterInput?: ElementRef<HTMLInputElement>;
|
||||
|
||||
@ViewChild(MatPaginator, {static: false}) set paginator(value: MatPaginator) {
|
||||
this.paginatorRef = value;
|
||||
if (this.dataSource) {
|
||||
this.dataSource.paginator = value;
|
||||
this.restoreTableState();
|
||||
}
|
||||
};
|
||||
@ViewChild(MatSort, {static: false}) set sort(value: MatSort) {
|
||||
if (this.dataSource) {
|
||||
this.dataSource.sort = value;
|
||||
}
|
||||
}
|
||||
|
||||
constructor(private datePipe: DatePipe,
|
||||
private reportingService: ReportingService,
|
||||
private activateRoute: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dialog: MatDialog,
|
||||
private toastr: ToastrService,
|
||||
private caseService: CaseService,
|
||||
private activityService: ActivityService,
|
||||
private tableStateService: TableStateService,
|
||||
) {
|
||||
this.today = this.datePipe.transform(new Date(), 'YYYY-MM-ddThh:mm');
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
if (!this.activateRoute.snapshot.params['id']) {
|
||||
this.router.navigate(['/case'])
|
||||
} else {
|
||||
this.tableStateKey = `case:bills:${this.activateRoute.snapshot.params['id']}`;
|
||||
this.getActivityRelations();
|
||||
}
|
||||
}
|
||||
|
||||
getActivityRelations(fecha_inicio?: string | null, fecha_fin?: string | null) {
|
||||
this.spinner = true;
|
||||
this.caseFee = undefined;
|
||||
this.infoCase = undefined;
|
||||
this.reportingService.postActivityRelations(this.activateRoute.snapshot.params['id'], fecha_inicio ? fecha_inicio : null, fecha_fin ? fecha_fin : null)
|
||||
// @ts-ignore
|
||||
.subscribe((response: Response) => {
|
||||
if (response.data.data.length === 0) {
|
||||
// @ts-ignore
|
||||
this.caseService.getCaseByID(this.activateRoute.snapshot.params['id']).subscribe((response: Response) => {
|
||||
this.infoCase = response.data.case;
|
||||
// @ts-ignore
|
||||
this.dataSource = new MatTableDataSource([]);
|
||||
this.dataSource.paginator = this.paginatorRef
|
||||
this.dataSource.sort = this.sort;
|
||||
this.restoreTableState();
|
||||
this.spinner = false;
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!';
|
||||
this.toastr.error(error.message, title);
|
||||
})
|
||||
} else {
|
||||
this.caseFee = response.data.data;
|
||||
// @ts-ignore
|
||||
this.caseFee.map(activity => {
|
||||
activity.prevdescription = activity.description.length > 50 ? activity.description.slice(0, 40) + '...' : activity.description;
|
||||
activity.created = this.datePipe.transform(activity.created, 'YYYY-MM-dd')
|
||||
return activity
|
||||
});
|
||||
this.dataSource = new MatTableDataSource(this.caseFee);
|
||||
this.dataSource.paginator = this.paginatorRef
|
||||
this.dataSource.sort = this.sort;
|
||||
this.restoreTableState();
|
||||
this.spinner = false;
|
||||
}
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.message, title);
|
||||
})
|
||||
}
|
||||
|
||||
applyFilter(event: Event) {
|
||||
const filterValue = (event.target as HTMLInputElement).value;
|
||||
this.dataSource.filter = filterValue.trim().toLowerCase();
|
||||
this.tableStateService.updateState(this.tableStateKey, {
|
||||
filter: filterValue,
|
||||
pageIndex: 0
|
||||
});
|
||||
|
||||
if (this.dataSource.paginator) {
|
||||
this.dataSource.paginator.firstPage();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
filterActivities() {
|
||||
this.dialog.open(SearchComponent, {
|
||||
maxWidth: '60%',
|
||||
minWidth: '330px',
|
||||
panelClass: 'dialog-container',
|
||||
disableClose: true,
|
||||
}).afterClosed().subscribe(result => {
|
||||
if (result != false) {
|
||||
this.getActivityRelations(result.fecha_inicio, result.fecha_fin)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
addActivities(activity?: any) {
|
||||
if (activity) {
|
||||
activity = {
|
||||
...activity,
|
||||
id_activity: activity.id
|
||||
}
|
||||
}
|
||||
this.dialog.open(ActivitiesComponent, {
|
||||
maxWidth: '60%',
|
||||
minWidth: '330px',
|
||||
panelClass: 'dialog-container',
|
||||
disableClose: true,
|
||||
data: {
|
||||
info: this.today,
|
||||
bills: true,
|
||||
id_case: Number(this.activateRoute.snapshot.params['id']),
|
||||
id_client: this.infoCase ? this.infoCase.id_client : this.caseFee[0].id_client,
|
||||
activity: activity
|
||||
}
|
||||
}).afterClosed().subscribe(result => {
|
||||
if (result == true) {
|
||||
this.getActivityRelations();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
exportFile() {
|
||||
this.export = true;
|
||||
this.dialog.open(SearchComponent, {
|
||||
maxWidth: '60%',
|
||||
minWidth: '330px',
|
||||
panelClass: 'dialog-container',
|
||||
disableClose: true,
|
||||
}).afterClosed().subscribe(result => {
|
||||
if (result != false) {
|
||||
this.reportingService.postExporOthertBills(this.activateRoute.snapshot.params['id'], result.fecha_inicio, result.fecha_fin).subscribe((res: Blob) => {
|
||||
this.toastr.success('Archivo descargado con exito!', 'Exito!');
|
||||
var blob = new Blob([res], {type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});
|
||||
FileSaver.saveAs(blob, 'gastos.xlsx');
|
||||
this.export = false;
|
||||
})
|
||||
} else {
|
||||
this.export = false;
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
deleteActivity(id: number) {
|
||||
this.dialog.open(ConfirmComponent, {
|
||||
maxWidth: '60%',
|
||||
minWidth: '330px',
|
||||
panelClass: 'dialog-container',
|
||||
disableClose: true,
|
||||
data: {type: 'warning', message: 'Seguro que deseas eliminar la actividad?'}
|
||||
}).afterClosed().subscribe(result => {
|
||||
if (result === true) {
|
||||
// @ts-ignore
|
||||
this.activityService.getDisableActivity(id).subscribe((response: Response) => {
|
||||
this.toastr.success(response.data.message, 'Exito!');
|
||||
this.getActivityRelations();
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.message, title);
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
onPageChange(event: PageEvent) {
|
||||
this.tableStateService.updateState(this.tableStateKey, {
|
||||
pageIndex: event.pageIndex,
|
||||
pageSize: event.pageSize
|
||||
});
|
||||
}
|
||||
|
||||
private restoreTableState() {
|
||||
if (!this.dataSource || !this.paginatorRef) {
|
||||
return;
|
||||
}
|
||||
this.tableStateService.applyState(
|
||||
this.tableStateKey,
|
||||
this.dataSource,
|
||||
this.paginatorRef,
|
||||
this.filterInput?.nativeElement
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
import { BillsRoutingModule } from './bills-routing.module';
|
||||
import { BillsComponent } from './bills.component';
|
||||
import {SharedModule} from "../../../shared/shared.module";
|
||||
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
BillsComponent
|
||||
],
|
||||
imports: [
|
||||
SharedModule,
|
||||
BillsRoutingModule
|
||||
]
|
||||
})
|
||||
export class BillsModule { }
|
||||
@@ -0,0 +1,41 @@
|
||||
import {NgModule} from '@angular/core';
|
||||
import {RouterModule, Routes} from '@angular/router';
|
||||
import {CaseComponent} from "./case.component";
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: CaseComponent,
|
||||
},
|
||||
{
|
||||
path: 'info/:id',
|
||||
loadChildren: () => import('./info-case/info-case.module').then(m => m.InfoCaseModule)
|
||||
},
|
||||
{
|
||||
path: 'info',
|
||||
loadChildren: () => import('./info-case/info-case.module').then(m => m.InfoCaseModule)
|
||||
},
|
||||
{
|
||||
path: 'bill',
|
||||
loadChildren: () => import('./bills/bills.module').then(m => m.BillsModule)
|
||||
},
|
||||
{
|
||||
path: 'bill/:id',
|
||||
loadChildren: () => import('./bills/bills.module').then(m => m.BillsModule)
|
||||
},
|
||||
{
|
||||
path: 'payment/:id',
|
||||
loadChildren: () => import('./payment/payment.module').then(m => m.PaymentModule)
|
||||
},
|
||||
{
|
||||
path: 'payment',
|
||||
loadChildren: () => import('./payment/payment.module').then(m => m.PaymentModule)
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class CaseRoutingModule {
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
<div class="body" *ngIf="spinner == true">
|
||||
<mat-spinner></mat-spinner>
|
||||
</div>
|
||||
<div class="body" *ngIf="cases && spinner == false">
|
||||
<div class="body_action">
|
||||
<div class="body_action-section">
|
||||
<button mat-fab color="primary" (click)="addCase()">
|
||||
<mat-icon>add</mat-icon>
|
||||
</button>
|
||||
<h2>Agregar Caso</h2>
|
||||
</div>
|
||||
<div class="body_action-second-section">
|
||||
<h2>Exportar Excel</h2>
|
||||
<button mat-mini-fab color="primary" (click)="exportFile()" [disabled]="export">
|
||||
<mat-icon>download</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="body_table">
|
||||
<mat-form-field appearance="standard">
|
||||
<mat-label>Filter</mat-label>
|
||||
<input matInput (keyup)="applyFilter($event)" placeholder="Ex. Mia" #input id="inp">
|
||||
</mat-form-field>
|
||||
<div class="mat-elevation-z8">
|
||||
<table mat-table [dataSource]="dataSource" matSort class="body_table-table">
|
||||
|
||||
<!-- ID Column -->
|
||||
<ng-container matColumnDef="id">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> ID</th>
|
||||
<td mat-cell *matCellDef="let row"> {{row.id}} </td>
|
||||
</ng-container>
|
||||
|
||||
<!-- Progress Column -->
|
||||
<ng-container matColumnDef="name">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Caso</th>
|
||||
<td mat-cell *matCellDef="let row"> {{row.name}}</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="businessname">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Cliente</th>
|
||||
<td mat-cell *matCellDef="let row"> {{row.businessname}} </td>
|
||||
</ng-container>
|
||||
|
||||
<!-- Fruit Column -->
|
||||
<ng-container matColumnDef="created">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Fecha de Creación</th>
|
||||
<td mat-cell *matCellDef="let row"> {{row.created}} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="bills">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header></th>
|
||||
<td mat-cell *matCellDef="let row">
|
||||
<button mat-icon-button [routerLink]="['/case/bill/',row.id]" matTooltip="Gastos"
|
||||
matTooltipPosition="right">
|
||||
<mat-icon>payments</mat-icon>
|
||||
</button>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="view">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header></th>
|
||||
<td mat-cell *matCellDef="let row">
|
||||
<button mat-icon-button [routerLink]="['/case/info/',row.id]" matTooltip="Ver actividades"
|
||||
matTooltipPosition="right">
|
||||
<mat-icon>wysiwyg</mat-icon>
|
||||
</button>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="payment">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header></th>
|
||||
<td mat-cell *matCellDef="let row">
|
||||
<button mat-icon-button [routerLink]="['/case/payment/',row.id]" matTooltip="Abonos"
|
||||
matTooltipPosition="right">
|
||||
<mat-icon>credit_card</mat-icon>
|
||||
</button>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="edit">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header></th>
|
||||
<td mat-cell *matCellDef="let row">
|
||||
<button mat-icon-button (click)="addCase(row)" matTooltip="Editar" matTooltipPosition="right">
|
||||
<mat-icon>edit</mat-icon>
|
||||
</button>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="assing">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header></th>
|
||||
<td mat-cell *matCellDef="let row">
|
||||
<button mat-icon-button (click)="assing('assing', row.id)" matTooltip="Asignar" matTooltipPosition="right">
|
||||
<mat-icon>person_add</mat-icon>
|
||||
</button>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="unassing">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header></th>
|
||||
<td mat-cell *matCellDef="let row">
|
||||
<button mat-icon-button (click)="assing('unassing', row.id)" matTooltip="Desasignar"
|
||||
matTooltipPosition="right">
|
||||
<mat-icon>person_remove</mat-icon>
|
||||
</button>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="delete">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header></th>
|
||||
<td mat-cell *matCellDef="let row">
|
||||
<button mat-icon-button (click)="disableCase(row.id)" matTooltip="Eliminar" matTooltipPosition="right">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
|
||||
<!-- Row shown when there is no matching data. -->
|
||||
<tr class="mat-row" *matNoDataRow>
|
||||
<td class="mat-cell" colspan="4">No data matching the filter "{{input.value}}"</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<mat-paginator [pageSizeOptions]="[5, 10, 25, 50]" (page)="onPageChange($event)"></mat-paginator>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { CaseComponent } from './case.component';
|
||||
|
||||
describe('CaseComponent', () => {
|
||||
let component: CaseComponent;
|
||||
let fixture: ComponentFixture<CaseComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ CaseComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(CaseComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,178 @@
|
||||
import {Component, ElementRef, OnInit, ViewChild} from '@angular/core';
|
||||
import {MatTableDataSource} from "@angular/material/table";
|
||||
import {MatPaginator, PageEvent} from "@angular/material/paginator";
|
||||
import {MatSort} from "@angular/material/sort";
|
||||
import {Case} from "../../models/case";
|
||||
import {CaseService} from "../../services/case.service";
|
||||
import {Response} from "../../models/response";
|
||||
import {ToastrService} from "ngx-toastr";
|
||||
import {ConfirmComponent} from "../../components/confirm/confirm.component";
|
||||
import {MatDialog} from "@angular/material/dialog";
|
||||
import {DatePipe} from "@angular/common";
|
||||
import {ClientService} from "../../services/client.service";
|
||||
import {AddCaseComponent} from "../../components/add-case/add-case.component";
|
||||
import {AssingCaseComponent} from "../../components/assing-case/assing-case.component";
|
||||
import {ReportingService} from "../../services/reporting.service";
|
||||
import * as FileSaver from 'file-saver';
|
||||
import {TableStateService} from "../../services/table-state.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-case',
|
||||
templateUrl: './case.component.html',
|
||||
styleUrls: ['./case.component.scss']
|
||||
})
|
||||
export class CaseComponent implements OnInit {
|
||||
cases: Case[] = []
|
||||
spinner = false;
|
||||
displayedColumns: string[] = ['id', 'name', 'businessname', 'created', 'bills', 'view', 'payment','edit', 'assing', 'unassing', 'delete'];
|
||||
dataSource!: MatTableDataSource<Case>;
|
||||
private readonly tableStateKey = 'case:list';
|
||||
private paginatorRef: MatPaginator | null = null;
|
||||
@ViewChild('input') filterInput?: ElementRef<HTMLInputElement>;
|
||||
|
||||
@ViewChild(MatPaginator, {static: false}) set paginator(value: MatPaginator) {
|
||||
this.paginatorRef = value;
|
||||
if (this.dataSource) {
|
||||
this.dataSource.paginator = value;
|
||||
this.restoreTableState();
|
||||
}
|
||||
};
|
||||
@ViewChild(MatSort, {static: false}) set sort(value: MatSort) {
|
||||
if (this.dataSource) {
|
||||
this.dataSource.sort = value;
|
||||
}
|
||||
}
|
||||
|
||||
export: boolean = false;
|
||||
|
||||
constructor(private caseService: CaseService,
|
||||
private clientService: ClientService,
|
||||
private toastr: ToastrService,
|
||||
private dialog: MatDialog,
|
||||
private datePipe: DatePipe,
|
||||
private reportingService: ReportingService,
|
||||
private tableStateService: TableStateService
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.getCases();
|
||||
}
|
||||
|
||||
exportFile() {
|
||||
this.export = true;
|
||||
this.reportingService.exportCases().subscribe((res: Blob) => {
|
||||
this.toastr.success('Archivo descargado con exito!', 'Exito!');
|
||||
var blob = new Blob([res], {type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});
|
||||
FileSaver.saveAs(blob, 'casos.xlsx');
|
||||
this.export = false;
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
getCases() {
|
||||
this.spinner = true;
|
||||
// @ts-ignore
|
||||
this.caseService.getAllCases().subscribe((response: Response) => {
|
||||
this.cases = response.data.cases!;
|
||||
this.cases.map(case$ => {
|
||||
// @ts-ignore
|
||||
case$.created = this.datePipe.transform(case$.created, 'YYYY-MM-dd');
|
||||
case$.businessname = case$.client.businessname
|
||||
return case$;
|
||||
})
|
||||
this.dataSource = new MatTableDataSource(this.cases);
|
||||
this.dataSource.paginator = this.paginatorRef;
|
||||
this.dataSource.sort = this.sort;
|
||||
this.restoreTableState();
|
||||
this.spinner = false;
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
})
|
||||
}
|
||||
|
||||
applyFilter(event: Event) {
|
||||
const filterValue = (event.target as HTMLInputElement).value;
|
||||
this.dataSource.filter = filterValue!.trim().toLowerCase();
|
||||
this.tableStateService.updateState(this.tableStateKey, {
|
||||
filter: filterValue,
|
||||
pageIndex: 0
|
||||
});
|
||||
if (this.dataSource.paginator) {
|
||||
this.dataSource.paginator.firstPage();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
onPageChange(event: PageEvent) {
|
||||
this.tableStateService.updateState(this.tableStateKey, {
|
||||
pageIndex: event.pageIndex,
|
||||
pageSize: event.pageSize
|
||||
});
|
||||
}
|
||||
|
||||
private restoreTableState() {
|
||||
if (!this.dataSource || !this.paginatorRef) {
|
||||
return;
|
||||
}
|
||||
this.tableStateService.applyState(
|
||||
this.tableStateKey,
|
||||
this.dataSource,
|
||||
this.paginatorRef,
|
||||
this.filterInput?.nativeElement
|
||||
);
|
||||
}
|
||||
|
||||
disableCase(id: number) {
|
||||
this.dialog.open(ConfirmComponent, {
|
||||
maxWidth: '60%',
|
||||
minWidth: '330px',
|
||||
panelClass: 'dialog-container',
|
||||
disableClose: true,
|
||||
data: {type: 'warning', message: 'Seguro que deseas eliminar el caso?'}
|
||||
}).afterClosed().subscribe(result => {
|
||||
if (result === true) {
|
||||
// @ts-ignore
|
||||
this.caseService.getDisableCase(id).subscribe((response: Response) => {
|
||||
this.toastr.success(response.data.message, 'Exito!');
|
||||
this.getCases();
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.message, title);
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
addCase(_case?: Case) {
|
||||
this.dialog.open(AddCaseComponent, {
|
||||
maxWidth: '60%',
|
||||
minWidth: '330px',
|
||||
panelClass: 'dialog-container',
|
||||
disableClose: true,
|
||||
data: _case
|
||||
}).afterClosed().subscribe(result => {
|
||||
if (result === true) {
|
||||
this.getCases();
|
||||
}
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.message, title);
|
||||
})
|
||||
}
|
||||
|
||||
assing(type: string, id: number) {
|
||||
this.dialog.open(AssingCaseComponent, {
|
||||
maxWidth: '60%',
|
||||
minWidth: '330px',
|
||||
panelClass: 'dialog-container',
|
||||
disableClose: true,
|
||||
data: {id_case: id, type: type}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import {NgModule} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
|
||||
import {CaseRoutingModule} from './case-routing.module';
|
||||
import {CaseComponent} from './case.component';
|
||||
import {SharedModule} from "../../shared/shared.module";
|
||||
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
CaseComponent
|
||||
],
|
||||
imports: [
|
||||
SharedModule,
|
||||
CaseRoutingModule
|
||||
]
|
||||
})
|
||||
export class CaseModule {
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import {InfoCaseComponent} from "./info-case.component";
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: InfoCaseComponent
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class InfoCaseRoutingModule { }
|
||||
@@ -0,0 +1,148 @@
|
||||
<div class="body" *ngIf="spinner == true || caseFee == undefined">
|
||||
<mat-spinner></mat-spinner>
|
||||
</div>
|
||||
<div class="body" *ngIf="spinner == false && activityFee && caseFee!== undefined">
|
||||
<div class="body_action">
|
||||
<div class="body_action-section">
|
||||
<button mat-fab color="warn" [routerLink]="['/case']">
|
||||
<mat-icon>arrow_back</mat-icon>
|
||||
</button>
|
||||
<h2 style="margin-left: 5%">Regresar</h2>
|
||||
</div>
|
||||
<div class="body_action-section_two">
|
||||
<mat-card class="card_body">
|
||||
<div class="card_body-icon">
|
||||
<mat-icon>business_center</mat-icon>
|
||||
</div>
|
||||
<mat-divider [vertical]="true"></mat-divider>
|
||||
<div class="card_body-info">
|
||||
<h5><strong>Cliente</strong></h5>
|
||||
<h4>{{caseFee.cliente ? caseFee.cliente : caseFee.client.businessname}}</h4>
|
||||
</div>
|
||||
</mat-card>
|
||||
<mat-card class="card_body">
|
||||
<div class="card_body-icon">
|
||||
<mat-icon>cases</mat-icon>
|
||||
</div>
|
||||
<mat-divider [vertical]="true"></mat-divider>
|
||||
<div class="card_body-info">
|
||||
<h5><strong>Caso</strong></h5>
|
||||
<h4>{{caseFee.caso ? caseFee.caso : caseFee.name}}</h4>
|
||||
</div>
|
||||
</mat-card>
|
||||
<mat-card class="card_body">
|
||||
<div class="card_body-icon">
|
||||
<mat-icon>hourglass_bottom</mat-icon>
|
||||
</div>
|
||||
<mat-divider [vertical]="true"></mat-divider>
|
||||
<div class="card_body-info">
|
||||
<h5><strong>Total horas registradas:</strong></h5>
|
||||
<h4>{{totalHours}}</h4>
|
||||
</div>
|
||||
</mat-card>
|
||||
</div>
|
||||
<div class="body_action-section_three">
|
||||
<!-- <button mat-mini-fab color="primary" matTooltip="Agregar Actividad" (click)="addActivities()">-->
|
||||
<!-- <mat-icon>add</mat-icon>-->
|
||||
<!-- </button>-->
|
||||
<button mat-mini-fab color="primary" matTooltip="Filtrar" (click)="filterActivities()">
|
||||
<mat-icon>search</mat-icon>
|
||||
</button>
|
||||
<button mat-mini-fab color="primary" matTooltip="Honorarios por Usuario" (click)="userRates()">
|
||||
<mat-icon>person</mat-icon>
|
||||
</button>
|
||||
<button mat-mini-fab color="primary" matTooltip="Exportar Excel" (click)="exportFile()" [disabled]="export">
|
||||
<mat-icon>download</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="body_table">
|
||||
<mat-form-field appearance="standard">
|
||||
<mat-label>Filter</mat-label>
|
||||
<input matInput (keyup)="applyFilter($event)" placeholder="Ex. Mia" #input>
|
||||
</mat-form-field>
|
||||
<div class="mat-elevation-z8">
|
||||
<table mat-table [dataSource]="dataSource" matSort class="body_table-table">
|
||||
<ng-container matColumnDef="id">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> ID</th>
|
||||
<td mat-cell *matCellDef="let row"> {{row.id_activity}} </td>
|
||||
<td mat-footer-cell *matFooterCellDef><strong>Aspen</strong></td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="description">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Descripcion</th>
|
||||
<td mat-cell *matCellDef="let row"> {{row.prevdescription}}</td>
|
||||
<td mat-footer-cell *matFooterCellDef>${{(caseFee.aspen ? caseFee.aspen : 0) | money}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="created">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Fecha de Creacioón</th>
|
||||
<td mat-cell *matCellDef="let row"> {{row.created}}</td>
|
||||
<td mat-footer-cell *matFooterCellDef><strong>Responsable de Cuenta</strong></td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="displayName">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Responsable</th>
|
||||
<td mat-cell *matCellDef="let row"> {{row.responsable}}</td>
|
||||
<td mat-footer-cell *matFooterCellDef>${{(caseFee.responsable_cuenta ? caseFee.responsable_cuenta : 0) | money}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="hours">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Horas invertidas</th>
|
||||
<td mat-cell *matCellDef="let row"> {{row.amount === null ? row.hours : '-'}} </td>
|
||||
<td mat-footer-cell *matFooterCellDef><strong>Trabajo Invertido</strong></td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="rate">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Valor Honorario</th>
|
||||
<td mat-cell *matCellDef="let row"> {{row.amount === null ? (row.rate | money) : '-'}} </td>
|
||||
<td mat-footer-cell *matFooterCellDef>${{(caseFee.trabajo_invertido ? caseFee.trabajo_invertido : 0) | money}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="amount">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Monto Único</th>
|
||||
<td mat-cell *matCellDef="let row"> {{row.amount !== null ? (row.amount | money) : '-'}} </td>
|
||||
<td mat-footer-cell *matFooterCellDef><strong>Total</strong></td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="total">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Total</th>
|
||||
<td mat-cell *matCellDef="let row"> {{row.total | money}} </td>
|
||||
<td mat-footer-cell *matFooterCellDef>${{(caseFee.total ? caseFee.total : 0) | money}}</td>
|
||||
</ng-container>
|
||||
<!-- <ng-container matColumnDef="credit">-->
|
||||
<!-- <th mat-header-cell *matHeaderCellDef mat-sort-header> Haber</th>-->
|
||||
<!-- <td mat-cell *matCellDef="let row"> {{row.id_paytype === 2 ? row.total : '-' }} </td>-->
|
||||
<!-- <td mat-footer-cell *matFooterCellDef> ${{accountStatus.credito}}</td>-->
|
||||
<!-- </ng-container>-->
|
||||
<ng-container matColumnDef="edit">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header></th>
|
||||
<td mat-cell *matCellDef="let row">
|
||||
<button mat-icon-button (click)="addActivities(row)" matTooltip="Editar" matTooltipPosition="right">
|
||||
<mat-icon>edit</mat-icon>
|
||||
</button>
|
||||
</td>
|
||||
<td mat-footer-cell *matFooterCellDef></td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="delete">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header></th>
|
||||
<td mat-cell *matCellDef="let row">
|
||||
<button mat-icon-button (click)="deleteActivity(row.id_activity)" matTooltip="Eliminar"
|
||||
matTooltipPosition="right">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</td>
|
||||
<td mat-footer-cell *matFooterCellDef></td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="payment">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header>Pagado</th>
|
||||
<td mat-cell *matCellDef="let row">
|
||||
<mat-icon *ngIf="row.payment != null && row.payment != false" style="color:green">done</mat-icon>
|
||||
<mat-icon *ngIf="row.payment == null || row.payment == false" style="color:red">close</mat-icon>
|
||||
</td>
|
||||
<td mat-footer-cell *matFooterCellDef></td>
|
||||
</ng-container>
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
<tr mat-footer-row *matFooterRowDef="displayedColumns"></tr>
|
||||
<tr class="mat-row" *matNoDataRow>
|
||||
<td class="mat-cell" colspan="4">No data matching the filter "{{input.value}}"</td>
|
||||
</tr>
|
||||
</table>
|
||||
<mat-paginator [pageSizeOptions]="[5, 10, 25, 50]" (page)="onPageChange($event)"></mat-paginator>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,63 @@
|
||||
.body_action-section {
|
||||
height: 100%;
|
||||
width: 10%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
//justify-content: center;
|
||||
}
|
||||
|
||||
.body_action-section_three {
|
||||
height: 100%;
|
||||
width: 15%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.body_action-section_two {
|
||||
height: 100%;
|
||||
width: 75%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.body_action-section_two p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.card_body {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
width: 20%;
|
||||
min-width: 160px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.card_body-icon {
|
||||
height: 100%;
|
||||
width: 25%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 1%;
|
||||
}
|
||||
|
||||
.card_body-info {
|
||||
height: 100%;
|
||||
width: 75%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-left: 1%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.card_body-info h5 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.card_body-info h4 {
|
||||
margin: 0;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { InfoCaseComponent } from './info-case.component';
|
||||
|
||||
describe('InfoCaseComponent', () => {
|
||||
let component: InfoCaseComponent;
|
||||
let fixture: ComponentFixture<InfoCaseComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ InfoCaseComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(InfoCaseComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,242 @@
|
||||
import {Component, ElementRef, OnInit, ViewChild} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {ReportingService} from "../../../services/reporting.service";
|
||||
import {Response} from "../../../models/response";
|
||||
import {MatTableDataSource} from "@angular/material/table";
|
||||
import {Case} from "../../../models/case";
|
||||
import {MatPaginator, PageEvent} from "@angular/material/paginator";
|
||||
import {MatSort} from "@angular/material/sort";
|
||||
import {DatePipe} from "@angular/common";
|
||||
import {CaseService} from "../../../services/case.service";
|
||||
import {ActivitiesComponent} from "../../../components/activities/activities.component";
|
||||
import {MatDialog} from "@angular/material/dialog";
|
||||
import {Activity} from "../../../models/activity";
|
||||
import {ToastrService} from "ngx-toastr";
|
||||
import {SearchComponent} from "../../../components/search/search.component";
|
||||
import {ConfirmComponent} from "../../../components/confirm/confirm.component";
|
||||
import {ActivityService} from "../../../services/activity.service";
|
||||
import {UserRateComponent} from "../../../components/user-rate/user-rate.component";
|
||||
import * as FileSaver from "file-saver";
|
||||
import {TableStateService} from "../../../services/table-state.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-info-case',
|
||||
templateUrl: './info-case.component.html',
|
||||
styleUrls: ['./info-case.component.scss']
|
||||
})
|
||||
export class InfoCaseComponent implements OnInit {
|
||||
|
||||
export: boolean = false;
|
||||
spinner = false;
|
||||
today;
|
||||
totalHours: any;
|
||||
caseFee: any;
|
||||
accountStatus: any;
|
||||
activityFee: any = [];
|
||||
displayedColumns: string[] = ['id', 'description', 'created', 'displayName', 'hours', 'rate', 'amount', 'total', 'payment', 'edit', 'delete'];
|
||||
dataSource!: MatTableDataSource<any>;
|
||||
private tableStateKey = 'case:info';
|
||||
private paginatorRef: MatPaginator | null = null;
|
||||
@ViewChild('input') filterInput?: ElementRef<HTMLInputElement>;
|
||||
|
||||
@ViewChild(MatPaginator, {static: false}) set paginator(value: MatPaginator) {
|
||||
this.paginatorRef = value;
|
||||
if (this.dataSource) {
|
||||
this.dataSource.paginator = value;
|
||||
this.restoreTableState();
|
||||
}
|
||||
};
|
||||
@ViewChild(MatSort, {static: false}) set sort(value: MatSort) {
|
||||
if (this.dataSource) {
|
||||
this.dataSource.sort = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
constructor(private activateRoute: ActivatedRoute,
|
||||
private router: Router,
|
||||
private reportingService: ReportingService,
|
||||
private caseService: CaseService,
|
||||
private datePipe: DatePipe,
|
||||
private toastr: ToastrService,
|
||||
private activityService: ActivityService,
|
||||
private dialog: MatDialog,
|
||||
private tableStateService: TableStateService,) {
|
||||
this.today = this.datePipe.transform(new Date(), 'YYYY-MM-ddThh:mm');
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
if (!this.activateRoute.snapshot.params['id']) {
|
||||
this.router.navigate(['/case'])
|
||||
} else {
|
||||
this.tableStateKey = `case:info:${this.activateRoute.snapshot.params['id']}`;
|
||||
this.getFees();
|
||||
}
|
||||
}
|
||||
|
||||
deleteActivity(id: number) {
|
||||
this.dialog.open(ConfirmComponent, {
|
||||
maxWidth: '60%',
|
||||
minWidth: '330px',
|
||||
panelClass: 'dialog-container',
|
||||
disableClose: true,
|
||||
data: {type: 'warning', message: 'Seguro que deseas eliminar la actividad?'}
|
||||
}).afterClosed().subscribe(result => {
|
||||
if (result === true) {
|
||||
// @ts-ignore
|
||||
this.activityService.getDisableActivity(id).subscribe((response: Response) => {
|
||||
this.toastr.success(response.data.message, 'Exito!');
|
||||
this.getFees();
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.message, title);
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
getFees(fecha_inicio?: string, fecha_fin?: string) {
|
||||
this.spinner = true;
|
||||
// @ts-ignore
|
||||
this.reportingService.getCalculateFees(this.activateRoute.snapshot.params['id'], fecha_inicio ? fecha_inicio : null, fecha_fin ? fecha_fin : null).subscribe((response: Response) => {
|
||||
this.caseFee = response.data.data[0];
|
||||
if (this.caseFee == undefined) {
|
||||
// @ts-ignore
|
||||
this.caseService.getCaseByID(this.activateRoute.snapshot.params['id']).subscribe((response: Response) => {
|
||||
this.caseFee = response.data.case;
|
||||
})
|
||||
}
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
});
|
||||
// @ts-ignore
|
||||
this.reportingService.postTotalHoursByCase(this.activateRoute.snapshot.params['id'], fecha_inicio ? fecha_inicio : null, fecha_fin ? fecha_fin : null).subscribe((response: Response) => {
|
||||
this.totalHours = response.data.data[0].horas;
|
||||
})
|
||||
// @ts-ignore
|
||||
this.reportingService.getCalculateFeeByAtivity(this.activateRoute.snapshot.params['id'], fecha_inicio ? fecha_inicio : null, fecha_fin ? fecha_fin : null).subscribe((response: Response) => {
|
||||
this.activityFee = response.data.data;
|
||||
// @ts-ignore
|
||||
this.activityFee.map((activity: any) => {
|
||||
activity.prevdescription = activity.description.length > 50 ? activity.description.slice(0, 40) + '...' : activity.description;
|
||||
activity.created = this.datePipe.transform(activity.created, 'YYYY-MM-dd');
|
||||
activity.responsable = activity.name + ' ' + activity.lastname + ' (' + activity.acronym + ')'
|
||||
return activity
|
||||
});
|
||||
this.dataSource = new MatTableDataSource(this.activityFee);
|
||||
this.dataSource.paginator = this.paginatorRef
|
||||
this.dataSource.sort = this.sort;
|
||||
this.restoreTableState();
|
||||
this.spinner = false;
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.error.data.message, title);
|
||||
});
|
||||
}
|
||||
|
||||
applyFilter(event: Event) {
|
||||
const filterValue = (event.target as HTMLInputElement).value;
|
||||
this.dataSource.filter = filterValue.trim().toLowerCase();
|
||||
this.tableStateService.updateState(this.tableStateKey, {
|
||||
filter: filterValue,
|
||||
pageIndex: 0
|
||||
});
|
||||
|
||||
if (this.dataSource.paginator) {
|
||||
this.dataSource.paginator.firstPage();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
addActivities(activity?: Activity) {
|
||||
this.dialog.open(ActivitiesComponent, {
|
||||
maxWidth: '60%',
|
||||
minWidth: '330px',
|
||||
panelClass: 'dialog-container',
|
||||
disableClose: true,
|
||||
data: {
|
||||
info: this.today,
|
||||
type: true,
|
||||
id_case: Number(this.activateRoute.snapshot.params['id']),
|
||||
id_client: this.caseFee.id,
|
||||
activity: activity
|
||||
}
|
||||
}).afterClosed().subscribe(result => {
|
||||
if (result == true) {
|
||||
this.getFees();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
filterActivities() {
|
||||
this.dialog.open(SearchComponent, {
|
||||
maxWidth: '60%',
|
||||
minWidth: '330px',
|
||||
panelClass: 'dialog-container',
|
||||
disableClose: true,
|
||||
}).afterClosed().subscribe(result => {
|
||||
if (result != false) {
|
||||
this.getFees(result.fecha_inicio, result.fecha_fin)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
userRates() {
|
||||
this.dialog.open(UserRateComponent, {
|
||||
maxWidth: '60%',
|
||||
minWidth: '330px',
|
||||
panelClass: 'dialog-container',
|
||||
disableClose: true,
|
||||
data: {
|
||||
id_case: Number(this.activateRoute.snapshot.params['id'])
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
exportFile() {
|
||||
this.export = true;
|
||||
this.dialog.open(SearchComponent, {
|
||||
maxWidth: '60%',
|
||||
minWidth: '330px',
|
||||
panelClass: 'dialog-container',
|
||||
disableClose: true,
|
||||
}).afterClosed().subscribe(result => {
|
||||
if (result != false) {
|
||||
this.reportingService.postExportBills(this.activateRoute.snapshot.params['id'], result.fecha_inicio, result.fecha_fin).subscribe((res: Blob) => {
|
||||
this.toastr.success('Archivo descargado con exito!', 'Exito!');
|
||||
var blob = new Blob([res], {type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});
|
||||
FileSaver.saveAs(blob, 'gastos.xlsx');
|
||||
this.export = false;
|
||||
})
|
||||
} else {
|
||||
this.export = false;
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
onPageChange(event: PageEvent) {
|
||||
this.tableStateService.updateState(this.tableStateKey, {
|
||||
pageIndex: event.pageIndex,
|
||||
pageSize: event.pageSize
|
||||
});
|
||||
}
|
||||
|
||||
private restoreTableState() {
|
||||
if (!this.dataSource || !this.paginatorRef) {
|
||||
return;
|
||||
}
|
||||
this.tableStateService.applyState(
|
||||
this.tableStateKey,
|
||||
this.dataSource,
|
||||
this.paginatorRef,
|
||||
this.filterInput?.nativeElement
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import {NgModule} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
|
||||
import {InfoCaseRoutingModule} from './info-case-routing.module';
|
||||
import {InfoCaseComponent} from './info-case.component';
|
||||
import {SharedModule} from "../../../shared/shared.module";
|
||||
import {SearchComponent} from "../../../components/search/search.component";
|
||||
import {UserRateComponent} from "../../../components/user-rate/user-rate.component";
|
||||
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
InfoCaseComponent,
|
||||
SearchComponent,
|
||||
UserRateComponent
|
||||
],
|
||||
imports: [
|
||||
SharedModule,
|
||||
InfoCaseRoutingModule
|
||||
]
|
||||
})
|
||||
export class InfoCaseModule {
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import {NgModule} from '@angular/core';
|
||||
import {RouterModule, Routes} from '@angular/router';
|
||||
import {PaymentComponent} from "./payment.component";
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: PaymentComponent
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class PaymentRoutingModule {
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
<div class="body" *ngIf="spinner == true">
|
||||
<mat-spinner></mat-spinner>
|
||||
</div>
|
||||
<div class="body" *ngIf="spinner == false">
|
||||
<div class="body_action">
|
||||
<div class="body_action-section">
|
||||
<button mat-fab color="warn" [routerLink]="['/case']">
|
||||
<mat-icon>arrow_back</mat-icon>
|
||||
</button>
|
||||
<h2 style="margin-left: 5%">Regresar</h2>
|
||||
</div>
|
||||
<div class="body_action-section_two">
|
||||
<mat-card class="card_body">
|
||||
<div class="card_body-icon">
|
||||
<mat-icon>business_center</mat-icon>
|
||||
</div>
|
||||
<mat-divider [vertical]="true"></mat-divider>
|
||||
<div class="card_body-info">
|
||||
<h5><strong>Cliente</strong></h5>
|
||||
<h4>{{businessName}}</h4>
|
||||
</div>
|
||||
</mat-card>
|
||||
<mat-card class="card_body">
|
||||
<div class="card_body-icon">
|
||||
<mat-icon>cases</mat-icon>
|
||||
</div>
|
||||
<mat-divider [vertical]="true"></mat-divider>
|
||||
<div class="card_body-info">
|
||||
<h5><strong>Caso</strong></h5>
|
||||
<h4>{{caso}}</h4>
|
||||
</div>
|
||||
</mat-card>
|
||||
<mat-card class="card_body">
|
||||
<div class="card_body-icon">
|
||||
<mat-icon>attach_money</mat-icon>
|
||||
</div>
|
||||
<mat-divider [vertical]="true"></mat-divider>
|
||||
<div class="card_body-info">
|
||||
<h5><strong>Monto Pendiente</strong></h5>
|
||||
<h4>{{pendingBalance | money}}</h4>
|
||||
</div>
|
||||
</mat-card>
|
||||
</div>
|
||||
<div class="body_action-section_three">
|
||||
<button mat-mini-fab color="primary" matTooltip="Agregar Abono" (click)="addPayment()">
|
||||
<mat-icon>add</mat-icon>
|
||||
</button>
|
||||
<button mat-mini-fab color="primary" matTooltip="Filtrar" (click)="filterActivities()">
|
||||
<mat-icon>search</mat-icon>
|
||||
</button>
|
||||
<!-- <button mat-mini-fab color="primary" matTooltip="Exportar Excel" (click)="exportFile()" [disabled]="export">
|
||||
<mat-icon>download</mat-icon>
|
||||
</button> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="body_table">
|
||||
<mat-form-field appearance="standard">
|
||||
<mat-label>Filter</mat-label>
|
||||
<input matInput (keyup)="applyFilter($event)" placeholder="Ex. Mia" #input>
|
||||
</mat-form-field>
|
||||
<div class="mat-elevation-z8">
|
||||
<table mat-table [dataSource]="dataSource" matSort class="body_table-table">
|
||||
|
||||
<!-- ID Column -->
|
||||
<ng-container matColumnDef="id">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> ID</th>
|
||||
<td mat-cell *matCellDef="let row"> {{row.id}} </td>
|
||||
<td mat-footer-cell *matFooterCellDef></td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="description">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Descripción</th>
|
||||
<td mat-cell *matCellDef="let row"> {{row.description}} </td>
|
||||
<td mat-footer-cell *matFooterCellDef></td>
|
||||
</ng-container>
|
||||
|
||||
<!-- Fruit Column -->
|
||||
<ng-container matColumnDef="amount">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Monto</th>
|
||||
<td mat-cell *matCellDef="let row"> ${{row.amount | money}} </td>
|
||||
<td mat-footer-cell *matFooterCellDef><strong>${{abono | money}}</strong></td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="client">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Cliente</th>
|
||||
<td mat-cell *matCellDef="let row"> {{row.businessname}} </td>
|
||||
<td mat-footer-cell *matFooterCellDef></td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="case">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Caso</th>
|
||||
<td mat-cell *matCellDef="let row"> {{row.case}} </td>
|
||||
<td mat-footer-cell *matFooterCellDef></td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="created">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Fecha</th>
|
||||
<td mat-cell *matCellDef="let row"> {{row.created}} </td>
|
||||
<td mat-footer-cell *matFooterCellDef><strong>TOTAL:</strong></td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="user">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Responsable</th>
|
||||
<td mat-cell *matCellDef="let row"> {{row.user}} </td>
|
||||
<td mat-footer-cell *matFooterCellDef></td>
|
||||
</ng-container>
|
||||
|
||||
|
||||
<!-- <ng-container matColumnDef="view">-->
|
||||
<!-- <th mat-header-cell *matHeaderCellDef mat-sort-header></th>-->
|
||||
<!-- <td mat-cell *matCellDef="let row">-->
|
||||
<!-- <button mat-icon-button>-->
|
||||
<!-- <mat-icon>wysiwyg</mat-icon>-->
|
||||
<!-- </button>-->
|
||||
<!-- </td>-->
|
||||
<!-- </ng-container>-->
|
||||
|
||||
<ng-container matColumnDef="edit">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header></th>
|
||||
<td mat-cell *matCellDef="let row">
|
||||
<button mat-icon-button (click)="addPayment(row)" matTooltip="Editar" matTooltipPosition="right">
|
||||
<mat-icon>edit</mat-icon>
|
||||
</button>
|
||||
</td>
|
||||
<td mat-footer-cell *matFooterCellDef></td>
|
||||
</ng-container>
|
||||
|
||||
|
||||
<ng-container matColumnDef="delete">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header></th>
|
||||
<td mat-cell *matCellDef="let row">
|
||||
<button mat-icon-button (click)="disablePayment(row.id)" matTooltip="Eliminar" matTooltipPosition="right">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</td>
|
||||
<td mat-footer-cell *matFooterCellDef></td>
|
||||
</ng-container>
|
||||
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
<tr mat-footer-row *matFooterRowDef="displayedColumns"></tr>
|
||||
|
||||
<!-- Row shown when there is no matching data. -->
|
||||
<tr class="mat-row" *matNoDataRow>
|
||||
<td class="mat-cell" colspan="4">No data matching the filter "{{input.value}}"</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<mat-paginator [pageSizeOptions]="[5, 10, 25, 50]" (page)="onPageChange($event)"></mat-paginator>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,63 @@
|
||||
.body_action-section {
|
||||
height: 100%;
|
||||
width: 10%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
//justify-content: center;
|
||||
}
|
||||
|
||||
.body_action-section_three {
|
||||
height: 100%;
|
||||
width: 15%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.body_action-section_two {
|
||||
height: 100%;
|
||||
width: 75%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.body_action-section_two p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.card_body {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
width: 20%;
|
||||
min-width: 160px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.card_body-icon {
|
||||
height: 100%;
|
||||
width: 25%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 1%;
|
||||
}
|
||||
|
||||
.card_body-info {
|
||||
height: 100%;
|
||||
width: 75%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-left: 1%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.card_body-info h5 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.card_body-info h4 {
|
||||
margin: 0;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PaymentComponent } from './payment.component';
|
||||
|
||||
describe('PaymentComponent', () => {
|
||||
let component: PaymentComponent;
|
||||
let fixture: ComponentFixture<PaymentComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ PaymentComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PaymentComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,279 @@
|
||||
import {Component, ElementRef, OnInit, ViewChild} from '@angular/core';
|
||||
import {Activity} from "../../../models/activity";
|
||||
import {MatTableDataSource} from "@angular/material/table";
|
||||
import {MatPaginator, PageEvent} from "@angular/material/paginator";
|
||||
import {MatSort} from "@angular/material/sort";
|
||||
import {ToastrService} from "ngx-toastr";
|
||||
import {MatDialog} from "@angular/material/dialog";
|
||||
import {DatePipe} from "@angular/common";
|
||||
import {ActivityService} from "../../../services/activity.service";
|
||||
import {AuthService} from "../../../services/auth.service";
|
||||
import {ReportingService} from "../../../services/reporting.service";
|
||||
import {ActivitiesComponent} from "../../../components/activities/activities.component";
|
||||
import {ConfirmComponent} from "../../../components/confirm/confirm.component";
|
||||
import {Response} from "../../../models/response";
|
||||
import {SearchComponent} from "../../../components/search/search.component";
|
||||
import * as FileSaver from "file-saver";
|
||||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import { CaseService } from 'src/app/services/case.service';
|
||||
import {TableStateService} from "../../../services/table-state.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-payment',
|
||||
templateUrl: './payment.component.html',
|
||||
styleUrls: ['./payment.component.scss']
|
||||
})
|
||||
export class PaymentComponent implements OnInit {
|
||||
|
||||
payments!: any[];
|
||||
abono: any = 0;
|
||||
deuda: any = 0;
|
||||
rol!: string;
|
||||
id_user;
|
||||
client!: number;
|
||||
businessName!: string;
|
||||
caso!: string;
|
||||
today;
|
||||
spinner = false;
|
||||
displayedColumns: string[] = ['id', 'description', 'user', 'created', 'amount', 'delete'];
|
||||
dataSource!: MatTableDataSource<Activity>;
|
||||
private tableStateKey = 'case:payment';
|
||||
private paginatorRef: MatPaginator | null = null;
|
||||
@ViewChild('input') filterInput?: ElementRef<HTMLInputElement>;
|
||||
|
||||
@ViewChild(MatPaginator, {static: false}) set paginator(value: MatPaginator) {
|
||||
this.paginatorRef = value;
|
||||
if (this.dataSource) {
|
||||
this.dataSource.paginator = value;
|
||||
this.restoreTableState();
|
||||
}
|
||||
};
|
||||
@ViewChild(MatSort, {static: false}) set sort(value: MatSort) {
|
||||
if (this.dataSource) {
|
||||
this.dataSource.sort = value;
|
||||
}
|
||||
}
|
||||
|
||||
exports = ['Excel', 'PDF'];
|
||||
export: boolean = false;
|
||||
|
||||
constructor(
|
||||
private toastr: ToastrService,
|
||||
private dialog: MatDialog,
|
||||
private datePipe: DatePipe,
|
||||
private activityService: ActivityService,
|
||||
private caseService: CaseService,
|
||||
private authService: AuthService,
|
||||
private activateRoute: ActivatedRoute,
|
||||
private router: Router,
|
||||
private reportingService: ReportingService,
|
||||
private tableStateService: TableStateService
|
||||
) {
|
||||
this.id_user = this.authService.token.id;
|
||||
this.today = this.datePipe.transform(new Date(), 'YYYY-MM-ddThh:mm');
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
if (!this.activateRoute.snapshot.params['id']) {
|
||||
this.router.navigate(['/case'])
|
||||
} else {
|
||||
this.rol = this.authService.token.rol;
|
||||
this.tableStateKey = `case:payment:${this.activateRoute.snapshot.params['id']}`;
|
||||
this.getPayments(null, null);
|
||||
}
|
||||
}
|
||||
|
||||
getPayments(fecha_inicio: string | null, fecha_fin: string | null) {
|
||||
this.spinner = true;
|
||||
this.activityService.getPaymentTotal(this.activateRoute.snapshot.params['id'], {
|
||||
fecha_inicio: fecha_inicio,
|
||||
fecha_fin: fecha_fin
|
||||
})
|
||||
// @ts-ignore
|
||||
.subscribe((response: Response) => {
|
||||
this.abono = this.roundCurrency(response.data.data[0]?.abono ?? 0.00);
|
||||
this.deuda = this.roundCurrency(response.data.data[0]?.monto ?? 0.00);
|
||||
|
||||
if(this.abono > 0){
|
||||
this.activityService.getAllPayment(this.activateRoute.snapshot.params['id'], {
|
||||
fecha_inicio: fecha_inicio,
|
||||
fecha_fin: fecha_fin
|
||||
})
|
||||
// @ts-ignore
|
||||
.subscribe((response: Response) => {
|
||||
if(response.data.activities?.length! > 0){
|
||||
this.payments = response.data.activities!;
|
||||
this.payments.map((p: any) => {
|
||||
p.created = this.datePipe.transform(p.created, 'YYYY-MM-dd');
|
||||
p.user = p.username + ' ' + p.userlastname
|
||||
})
|
||||
// @ts-ignore
|
||||
this.client = this.payments[0]?.id_client ? this.payments[0].id_client : null;
|
||||
this.caso = this.payments[0].case!;
|
||||
this.businessName = this.payments[0].businessname;
|
||||
this.dataSource = new MatTableDataSource(this.payments);
|
||||
this.dataSource.paginator = this.paginatorRef
|
||||
this.dataSource.sort = this.sort;
|
||||
this.restoreTableState();
|
||||
this.spinner = false;
|
||||
}
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.message, title);
|
||||
});
|
||||
} else {
|
||||
// @ts-ignore
|
||||
this.caseService.getCaseByID(this.activateRoute.snapshot.params['id']).subscribe((response: Response) => {
|
||||
this.client = response.data.case?.id_client!;
|
||||
this.businessName = response.data.case?.client.businessname;
|
||||
this.caso = response.data.case?.name!;
|
||||
this.spinner = false;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.message, title);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
exportFile() {
|
||||
this.export = true;
|
||||
this.dialog.open(SearchComponent, {
|
||||
maxWidth: '60%',
|
||||
minWidth: '330px',
|
||||
panelClass: 'dialog-container',
|
||||
disableClose: true,
|
||||
}).afterClosed().subscribe(result => {
|
||||
if (result != false) {
|
||||
const data = {
|
||||
id_created: this.rol === 'admin' ? null : this.id_user,
|
||||
fecha_inicio: result.fecha_inicio,
|
||||
fecha_fin: result.fecha_fin
|
||||
}
|
||||
this.reportingService.postExportPayment(this.activateRoute.snapshot.params['id'],result.fecha_inicio, result.fecha_fin).subscribe((res: Blob) => {
|
||||
this.toastr.success('Archivo descargado con exito!', 'Exito!');
|
||||
var blob = new Blob([res], {type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});
|
||||
FileSaver.saveAs(blob, 'abonos.xlsx');
|
||||
this.export = false;
|
||||
})
|
||||
} else {
|
||||
this.export = false;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
applyFilter(event: Event) {
|
||||
const filterValue = (event.target as HTMLInputElement).value;
|
||||
this.dataSource.filter = filterValue.trim().toLowerCase();
|
||||
this.tableStateService.updateState(this.tableStateKey, {
|
||||
filter: filterValue,
|
||||
pageIndex: 0
|
||||
});
|
||||
|
||||
if (this.dataSource.paginator) {
|
||||
this.dataSource.paginator.firstPage();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
addPayment(activity?: any) {
|
||||
if (activity) {
|
||||
activity = {
|
||||
...activity,
|
||||
id_activity: activity.id,
|
||||
user: {
|
||||
name: activity.username,
|
||||
lastname: activity.userlastname
|
||||
}
|
||||
}
|
||||
}
|
||||
this.dialog.open(ActivitiesComponent, {
|
||||
maxWidth: '60%',
|
||||
minWidth: '330px',
|
||||
panelClass: 'dialog-container',
|
||||
disableClose: true,
|
||||
data: {
|
||||
info: this.today,
|
||||
payment: true,
|
||||
id_case: Number(this.activateRoute.snapshot.params['id']),
|
||||
id_client: this.client,
|
||||
activity: activity
|
||||
}
|
||||
}).afterClosed().subscribe(result => {
|
||||
if (result == true) {
|
||||
this.getPayments(null, null);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
disablePayment(id: number) {
|
||||
this.dialog.open(ConfirmComponent, {
|
||||
maxWidth: '60%',
|
||||
minWidth: '330px',
|
||||
panelClass: 'dialog-container',
|
||||
disableClose: true,
|
||||
data: {type: 'warning', message: 'Seguro que deseas eliminar la actividad?'}
|
||||
}).afterClosed().subscribe(result => {
|
||||
if (result === true) {
|
||||
// @ts-ignore
|
||||
this.activityService.getPaymentDisable(id).subscribe((response: Response) => {
|
||||
this.toastr.success(response.data.message, 'Exito!');
|
||||
this.getPayments(null, null);
|
||||
}, error => {
|
||||
const title = '¡Error ' + error.status + '!'
|
||||
this.toastr.error(error.message, title);
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
filterActivities() {
|
||||
this.dialog.open(SearchComponent, {
|
||||
maxWidth: '60%',
|
||||
minWidth: '330px',
|
||||
panelClass: 'dialog-container',
|
||||
disableClose: true,
|
||||
}).afterClosed().subscribe(result => {
|
||||
if (result != false) {
|
||||
this.getPayments(result.fecha_inicio, result.fecha_fin);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
onPageChange(event: PageEvent) {
|
||||
this.tableStateService.updateState(this.tableStateKey, {
|
||||
pageIndex: event.pageIndex,
|
||||
pageSize: event.pageSize
|
||||
});
|
||||
}
|
||||
|
||||
get pendingBalance(): number {
|
||||
return this.roundCurrency(Number(this.deuda) - Number(this.abono));
|
||||
}
|
||||
|
||||
private restoreTableState() {
|
||||
if (!this.dataSource || !this.paginatorRef) {
|
||||
return;
|
||||
}
|
||||
this.tableStateService.applyState(
|
||||
this.tableStateKey,
|
||||
this.dataSource,
|
||||
this.paginatorRef,
|
||||
this.filterInput?.nativeElement
|
||||
);
|
||||
}
|
||||
|
||||
private roundCurrency(value: unknown): number {
|
||||
const numericValue = Number(value);
|
||||
if (!Number.isFinite(numericValue)) {
|
||||
return 0;
|
||||
}
|
||||
return Math.round((numericValue + Number.EPSILON) * 100) / 100;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
import { PaymentRoutingModule } from './payment-routing.module';
|
||||
import { PaymentComponent } from './payment.component';
|
||||
import {SharedModule} from "../../../shared/shared.module";
|
||||
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
PaymentComponent
|
||||
],
|
||||
imports: [
|
||||
SharedModule,
|
||||
PaymentRoutingModule
|
||||
]
|
||||
})
|
||||
export class PaymentModule { }
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user