Commit 2112d188 authored by Josue's avatar Josue

Initial commit

parent 950ee64f
Pipeline #352 failed with stages
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -2,7 +2,6 @@ import { NgModule } from '@angular/core'; ...@@ -2,7 +2,6 @@ import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router'; import { Routes, RouterModule } from '@angular/router';
import { BaseLayoutComponent, CustomLayoutComponent, NotFoundComponent } from '@xdf/layouts'; import { BaseLayoutComponent, CustomLayoutComponent, NotFoundComponent } from '@xdf/layouts';
import { AuthGuard, LoginComponent } from '@xdf/security'; import { AuthGuard, LoginComponent } from '@xdf/security';
import { BytebotLayoutComponent } from './modules/bytebot-layout/bytebot-layout/bytebot-layout.component';
import { HomeComponent } from './views/home/home.component'; import { HomeComponent } from './views/home/home.component';
const routes: Routes = [ const routes: Routes = [
...@@ -11,7 +10,7 @@ const routes: Routes = [ ...@@ -11,7 +10,7 @@ const routes: Routes = [
// Main redirect // Main redirect
{ path: '', redirectTo: 'home', pathMatch: 'full', canActivate: [AuthGuard] }, { path: '', redirectTo: 'home', pathMatch: 'full', canActivate: [AuthGuard] },
{ {
path: '', component: BaseLayoutComponent, path: '', component: CustomLayoutComponent,
children: [ children: [
{ path: 'home', component: HomeComponent, data: { breadcrumb: 'Home' } }, { path: 'home', component: HomeComponent, data: { breadcrumb: 'Home' } },
{ {
...@@ -27,12 +26,32 @@ const routes: Routes = [ ...@@ -27,12 +26,32 @@ const routes: Routes = [
loadChildren: () => import('./modules/agent/agent.module').then(m => m.AgentModule) loadChildren: () => import('./modules/agent/agent.module').then(m => m.AgentModule)
}, },
{ {
path: 'mantenimiento', data: { breadcrumb: 'Mantenimiento'}, canLoad: [AuthGuard], path: "airport", data: { breadcrumb: "Aeropuertos" }, canLoad: [AuthGuard],
loadChildren: () => import('./modules/mantenimiento/matenimiento.module').then(m => m.MantenimientoModule) loadChildren: () => import("./modules/airport/airport.module").then( m => m.AirportModule)
}, },
{ {
path: 'prueba', canLoad: [AuthGuard], path: "passenger", data: { breadcrumb: "Pasajeros" }, canLoad: [AuthGuard],
loadChildren: () => import('./modules/prueba/prueba.module').then(m => m.PruebaModule) loadChildren: () => import("./modules/passenger/passenger.module").then( m => m.PassengerModule)
},
{
path: "agent", data: { breadcrumb: "Agentes" }, canLoad: [AuthGuard],
loadChildren: () => import("./modules/booking-agent/booking-agent.module").then( m => m.BookingAgentModule)
},
{
path: "payment", data: { breadcrumb: "Pagos" }, canLoad: [AuthGuard],
loadChildren: () => import("./modules/payment/payment.module").then( m => m.PaymentModule)
},
{
path: "payment-reservation", data: {breadcrumb: "Pagos Reserva"}, canLoad: [AuthGuard],
loadChildren: () => import("./modules/payment-reservation/payment-reservation.module").then( m => m.PaymentReservationModule)
},
{
path: "flight", data: { breadcrumb: "Vuelos" }, canLoad: [AuthGuard],
loadChildren: () => import("./modules/flight/flight.module").then( m => m.FlightModule)
},
{
path: "reservation", data: { breadcrumb: "Reservaciones" }, canLoad: [AuthGuard],
loadChildren: () => import("./modules/reservation/reservation.module").then( m => m.ReservationModule)
} }
], ],
canActivate: [AuthGuard] canActivate: [AuthGuard]
......
...@@ -42,8 +42,15 @@ import { ...@@ -42,8 +42,15 @@ import {
import { CustomProgramsFakeBackendInterceptor } from './interceptors/custom-programs-fake-backend.interceptor'; import { CustomProgramsFakeBackendInterceptor } from './interceptors/custom-programs-fake-backend.interceptor';
import { AgentFakeBackendInterceptor } from './interceptors/agent-fake-backend.interceptor'; import { AgentFakeBackendInterceptor } from './interceptors/agent-fake-backend.interceptor';
import { OperativeDashboardFakeBackendInterceptor } from './interceptors/operative-dashboard-fake-backend.interceptor'; import { OperativeDashboardFakeBackendInterceptor } from './interceptors/operative-dashboard-fake-backend.interceptor';
import { CustomErrorHandlerInterceptor } from './interceptors/custom-error-handler.interceptor'; import { AirportFakeBackendInterceptor } from './interceptors/airport-fake-backend.interceptor';
import { PruebaFakeBackendInterceptor } from './interceptors/prueba-fake-backend.interceptor'; import { PassengerFakeBackendInterceptor } from './interceptors/passenger-fake-backend.interceptor';
import { PaymentFakeBackendInterceptor } from './interceptors/payment-fake-backend.interceptor';
import { BookingAgentFakeBackendInterceptor } from './interceptors/booking-agent-fake-backend.interceptor';
//import { AirportFakeBackendInterceptor } from './interceptors/airport-fake-backend.interceptor';
//import { PassengerFakeBackendInterceptor } from './interceptors/passenger-fake-backend.interceptor';
//import { BookingAgentFakeBackendInterceptor } from './interceptors/booking-agent-fake-backend.interceptor';
//import { PaymentFakeBackendInterceptor } from './interceptors/payment-fake-backend.interceptor';
const INITIAL_LANGUAGE = 'es'; const INITIAL_LANGUAGE = 'es';
...@@ -132,8 +139,10 @@ export function createTranslateLoader(http: HttpClient) { ...@@ -132,8 +139,10 @@ export function createTranslateLoader(http: HttpClient) {
{ provide: HTTP_INTERCEPTORS, useClass: CustomProgramsFakeBackendInterceptor, multi: true }, { provide: HTTP_INTERCEPTORS, useClass: CustomProgramsFakeBackendInterceptor, multi: true },
{ provide: HTTP_INTERCEPTORS, useClass: AgentFakeBackendInterceptor, multi: true }, { provide: HTTP_INTERCEPTORS, useClass: AgentFakeBackendInterceptor, multi: true },
{ provide: HTTP_INTERCEPTORS, useClass: OperativeDashboardFakeBackendInterceptor, multi: true }, { provide: HTTP_INTERCEPTORS, useClass: OperativeDashboardFakeBackendInterceptor, multi: true },
{ provide: HTTP_INTERCEPTORS, useClass: PruebaFakeBackendInterceptor, multi: true}, //{ provide: HTTP_INTERCEPTORS, useClass: AirportFakeBackendInterceptor, multi: true },
//{ provide: HTTP_INTERCEPTORS, useClass: PassengerFakeBackendInterceptor, multi: true },
//{ provide: HTTP_INTERCEPTORS, useClass: BookingAgentFakeBackendInterceptor, multi: true },
//{ provide: HTTP_INTERCEPTORS, useClass: PaymentFakeBackendInterceptor, multi: true },
{ provide: APP_INITIALIZER, useFactory: init_app, deps: [InitCommonsService, TranslateService], multi: true } { provide: APP_INITIALIZER, useFactory: init_app, deps: [InitCommonsService, TranslateService], multi: true }
], ],
......
import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent, HttpResponse } from '@angular/common/http'; import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest, HttpResponse } from "@angular/common/http";
import { Injectable } from '@angular/core'; import { Injectable } from "@angular/core";
import { Observable, of, throwError } from 'rxjs'; import { Observable, of, throwError } from "rxjs";
import { delay, mergeMap, materialize, dematerialize } from 'rxjs/operators';
import { ok, error } from './functions-utils.interceptor';
import { SortField, DIRECTION } from '@xdf/commons';
import * as source from '../../assets/fake-data/prueba-data.json';
import * as source from '../../assets/fake-data/airport-data.json';
import { delay, dematerialize, materialize, mergeMap } from "rxjs/operators";
import { DIRECTION, SortField } from "@xdf/commons";
const basePath = './service/settings/prueba'; const basePath = './service/airport';
@Injectable() @Injectable()
export class PruebaFakeBackendInterceptor implements HttpInterceptor { export class AirportFakeBackendInterceptor implements HttpInterceptor {
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
const {url, method, headers, body} = req;
const { url, method, headers, body } = request;
const data = (source as any).default; const data = (source as any).default;
// const dataEquivalences = (sourceEquivalences as any).default;
//const initialData = (InitialDataServiceProvider as any).default;
return of(null) return of(null)
.pipe(mergeMap(handleRoute)) .pipe(mergeMap(handleRoute))
.pipe(materialize()) .pipe(materialize())
.pipe(delay(50)) .pipe(delay(50))
.pipe(dematerialize()); .pipe(dematerialize());
function handleRoute() { function handleRoute() {
switch (true) { switch(true) {
case url.endsWith(basePath + '/page') && method === 'POST': case url.endsWith(basePath + '/page') && method === 'POST':
return pagination(body); return pagination(body);
// case url.match('.*' + basePath + '/equivalences') && method === 'GET':
// return ok(dataEquivalences); case url.match(".*" + basePath) && method === 'GET':
case url.match('.*' + basePath) && method === 'GET': console.log(url);
return getOne(url); return getOne(url);
case url.match('.*' + basePath + '/\\d+$') && method === 'DELETE':
return deleteOperation(url);
case url.match('.*' + basePath) && method === 'GET':
return ok(data.data[0]);
default: default:
// pass through any requests not handled above return next.handle(req);
return next.handle(request);
} }
} }
function pagination(body) { function pagination(body) {
body.totalPages = 1; body.totalPages = 1;
body.totalItems = 2; body.totalItems = 2;
...@@ -49,12 +41,13 @@ export class PruebaFakeBackendInterceptor implements HttpInterceptor { ...@@ -49,12 +41,13 @@ export class PruebaFakeBackendInterceptor implements HttpInterceptor {
const page_number = body.currentPage; const page_number = body.currentPage;
const page_size = body.itemsPerPage ? body.itemsPerPage : 5; const page_size = body.itemsPerPage ? body.itemsPerPage : 5;
if (body.sortFields.length > 0) { if(body.sortFields.length > 0) {
const sortField: SortField = body.sortFields[0]; const sortField: SortField = body.sortFields[0];
const sign = sortField.direction === DIRECTION.asc ? 1 : -1; const sign = sortField.direction === DIRECTION.asc ? 1: -1;
data.sort(function (a, b) {
if ((typeof a[sortField.field] === 'number') && (typeof b[sortField.field] === 'number')) { data.sort(function (a, b){
if (a[sortField.field] > b[sortField.field]) { if((typeof a[sortField.field] === 'number') && (typeof b[sortField.field] === 'number')) {
if(a[sortField.field] > b[sortField.field]) {
return 1 * sign; return 1 * sign;
} else if (a[sortField.field] < b[sortField.field]) { } else if (a[sortField.field] < b[sortField.field]) {
return -1 * sign; return -1 * sign;
...@@ -69,18 +62,22 @@ export class PruebaFakeBackendInterceptor implements HttpInterceptor { ...@@ -69,18 +62,22 @@ export class PruebaFakeBackendInterceptor implements HttpInterceptor {
body.data = data.slice(page_number * page_size, (page_number + 1) * page_size); body.data = data.slice(page_number * page_size, (page_number + 1) * page_size);
return ok(body); return ok(body);
} }
function getOne(url) {
const n = url.lastIndexOf("/") + 1; function getData() {
const id: Number = Number(url.substring(n)); return ok(data);
return ok(data.filter(x => x.id === id)[0]);
} }
function deleteOperation(url) {
const n = url.lastIndexOf("/") + 1;
const id: Number = Number(url.substring(n));
(source as any).default = data.filter(item => item.id !== id); function ok(bodyContent?) {
return of(new HttpResponse({ status: 200, body: bodyContent}));
}
function error(message: string) {
return throwError({error: {message}});
}
return ok(); function getOne(url: string) {
return ok(data);
} }
} }
}
}
\ No newline at end of file
import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest, HttpResponse } from "@angular/common/http";
import { Injectable } from "@angular/core";
import { Observable, of, throwError } from "rxjs";
import * as source from '../../assets/fake-data/agent-data.json';
import { delay, dematerialize, materialize, mergeMap } from "rxjs/operators";
import { DIRECTION, SortField } from "@xdf/commons";
const basePath = './service/agent';
@Injectable()
export class BookingAgentFakeBackendInterceptor implements HttpInterceptor {
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
const {url, method, headers, body} = req;
const data = (source as any).default;
return of(null)
.pipe(mergeMap(handleRoute))
.pipe(materialize())
.pipe(delay(50))
.pipe(dematerialize());
function handleRoute() {
switch(true) {
case url.endsWith(basePath + '/page') && method === 'POST':
return pagination(body);
case url.match(".*" + basePath) && method === 'GET':
console.log(url);
return getOne(url);
default:
return next.handle(req);
}
}
function pagination(body) {
body.totalPages = 1;
body.totalItems = 2;
const page_number = body.currentPage;
const page_size = body.itemsPerPage ? body.itemsPerPage : 5;
if(body.sortFields.length > 0) {
const sortField: SortField = body.sortFields[0];
const sign = sortField.direction === DIRECTION.asc ? 1: -1;
data.sort(function (a, b){
if((typeof a[sortField.field] === 'number') && (typeof b[sortField.field] === 'number')) {
if(a[sortField.field] > b[sortField.field]) {
return 1 * sign;
} else if (a[sortField.field] < b[sortField.field]) {
return -1 * sign;
}
return 0;
} else {
return a[sortField.field].localeCompare(b[sortField.field]) * sign;
}
});
}
body.data = data.slice(page_number * page_size, (page_number + 1) * page_size);
return ok(body);
}
function getData() {
return ok(data);
}
function ok(bodyContent?) {
return of(new HttpResponse({ status: 200, body: bodyContent}));
}
function error(message: string) {
return throwError({error: {message}});
}
function getOne(url: string) {
return ok(data);
}
}
}
\ No newline at end of file
import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest, HttpResponse } from "@angular/common/http";
import { Injectable } from "@angular/core";
import { Observable, of, throwError } from "rxjs";
import * as source from '../../assets/fake-data/passenger-data.json';
import { delay, dematerialize, materialize, mergeMap } from "rxjs/operators";
import { DIRECTION, SortField } from "@xdf/commons";
const basePath = './service/passenger';
@Injectable()
export class PassengerFakeBackendInterceptor implements HttpInterceptor {
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
const {url, method, headers, body} = req;
const data = (source as any).default;
return of(null)
.pipe(mergeMap(handleRoute))
.pipe(materialize())
.pipe(delay(50))
.pipe(dematerialize());
function handleRoute() {
switch(true) {
case url.endsWith(basePath + '/page') && method === 'POST':
return pagination(body);
case url.match(".*" + basePath) && method === 'GET':
console.log(url);
return getOne(url);
default:
return next.handle(req);
}
}
function pagination(body) {
body.totalPages = 1;
body.totalItems = 2;
const page_number = body.currentPage;
const page_size = body.itemsPerPage ? body.itemsPerPage : 5;
if(body.sortFields.length > 0) {
const sortField: SortField = body.sortFields[0];
const sign = sortField.direction === DIRECTION.asc ? 1: -1;
data.sort(function (a, b){
if((typeof a[sortField.field] === 'number') && (typeof b[sortField.field] === 'number')) {
if(a[sortField.field] > b[sortField.field]) {
return 1 * sign;
} else if (a[sortField.field] < b[sortField.field]) {
return -1 * sign;
}
return 0;
} else {
return a[sortField.field].localeCompare(b[sortField.field]) * sign;
}
});
}
body.data = data.slice(page_number * page_size, (page_number + 1) * page_size);
return ok(body);
}
function getData() {
return ok(data);
}
function ok(bodyContent?) {
return of(new HttpResponse({ status: 200, body: bodyContent}));
}
function error(message: string) {
return throwError({error: {message}});
}
function getOne(url: string) {
return ok(data);
}
}
}
\ No newline at end of file
import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest, HttpResponse } from "@angular/common/http";
import { Injectable } from "@angular/core";
import { Observable, of, throwError } from "rxjs";
import * as source from '../../assets/fake-data/payment-data.json';
import { delay, dematerialize, materialize, mergeMap } from "rxjs/operators";
import { DIRECTION, SortField } from "@xdf/commons";
const basePath = './service/payment';
@Injectable()
export class PaymentFakeBackendInterceptor implements HttpInterceptor {
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
const {url, method, headers, body} = req;
const data = (source as any).default;
return of(null)
.pipe(mergeMap(handleRoute))
.pipe(materialize())
.pipe(delay(50))
.pipe(dematerialize());
function handleRoute() {
switch(true) {
case url.endsWith(basePath + '/page') && method === 'POST':
return pagination(body);
case url.match(".*" + basePath) && method === 'GET':
console.log(url);
return getOne(url);
default:
return next.handle(req);
}
}
function pagination(body) {
body.totalPages = 1;
body.totalItems = 2;
const page_number = body.currentPage;
const page_size = body.itemsPerPage ? body.itemsPerPage : 5;
if(body.sortFields.length > 0) {
const sortField: SortField = body.sortFields[0];
const sign = sortField.direction === DIRECTION.asc ? 1: -1;
data.sort(function (a, b){
if((typeof a[sortField.field] === 'number') && (typeof b[sortField.field] === 'number')) {
if(a[sortField.field] > b[sortField.field]) {
return 1 * sign;
} else if (a[sortField.field] < b[sortField.field]) {
return -1 * sign;
}
return 0;
} else {
return a[sortField.field].localeCompare(b[sortField.field]) * sign;
}
});
}
body.data = data.slice(page_number * page_size, (page_number + 1) * page_size);
return ok(body);
}
function getData() {
return ok(data);
}
function ok(bodyContent?) {
return of(new HttpResponse({ status: 200, body: bodyContent}));
}
function error(message: string) {
return throwError({error: {message}});
}
function getOne(url: string) {
return ok(data);
}
}
}
\ No newline at end of file
...@@ -20,7 +20,7 @@ export class CaDeploymentChannelsComponent implements OnInit { ...@@ -20,7 +20,7 @@ export class CaDeploymentChannelsComponent implements OnInit {
stepper: MatStepper; stepper: MatStepper;
@Input() @Input()
changes = false; changes: boolean = false;
@ViewChild('fieldForm', {static: false}) @ViewChild('fieldForm', {static: false})
fieldFormList: any; fieldFormList: any;
......
...@@ -12,9 +12,8 @@ table { ...@@ -12,9 +12,8 @@ table {
} }
.title_header_popup { .title_header_popup {
i { i {
font-size: 28px; font-size: 28px;
padding-right: 20px; padding-right: 20px;
color: red; color: red;
} }
} }
\ No newline at end of file
\ No newline at end of file
...@@ -169,5 +169,4 @@ th.mat-header-cell { ...@@ -169,5 +169,4 @@ th.mat-header-cell {
::ng-deep .text-right > .mat-sort-header-container { ::ng-deep .text-right > .mat-sort-header-container {
justify-content: flex-end !important; justify-content: flex-end !important;
} }
\ No newline at end of file
\ No newline at end of file
...@@ -31,7 +31,7 @@ export class CaFrequentQuestionsComponent implements OnInit, AfterViewInit { ...@@ -31,7 +31,7 @@ export class CaFrequentQuestionsComponent implements OnInit, AfterViewInit {
nextPage: EventEmitter<boolean> = new EventEmitter<boolean>(); nextPage: EventEmitter<boolean> = new EventEmitter<boolean>();
public resourceAuth = new Object(); public resourceAuth = new Object();
dirty = false; dirty: boolean = false;
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
<mat-form-field class="amd-form-control"> <mat-form-field class="amd-form-control">
<input matInput [placeholder]="'label.name' | translate" formControlName="name" <input matInput [placeholder]="'label.name' | translate" formControlName="name"
maxlength="50" required> maxlength="50" required>
<!-- Borrar mat-error-->
<mat-error *ngFor="let error of getErrors('name', 'label.name')">{{ 'message.error.' + error.name | translate : error.prop}} <mat-error *ngFor="let error of getErrors('name', 'label.name')">{{ 'message.error.' + error.name | translate : error.prop}}
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
...@@ -60,6 +61,7 @@ ...@@ -60,6 +61,7 @@
[placeholder]="'label.description' | translate" maxlength="200" [placeholder]="'label.description' | translate" maxlength="200"
formControlName="description" #autosize="cdkTextareaAutosize" cdkAutosizeMinRows="3" formControlName="description" #autosize="cdkTextareaAutosize" cdkAutosizeMinRows="3"
cdkAutosizeMaxRows="6" required></textarea> cdkAutosizeMaxRows="6" required></textarea>
<!-- Borrar mat-error-->
<mat-error *ngFor="let error of getErrors('description', 'label.description')">{{ 'message.error.' + error.name | translate : error.prop}} <mat-error *ngFor="let error of getErrors('description', 'label.description')">{{ 'message.error.' + error.name | translate : error.prop}}
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
...@@ -71,6 +73,7 @@ ...@@ -71,6 +73,7 @@
<input matInput [placeholder]="'label.version' | translate" formControlName="version" <input matInput [placeholder]="'label.version' | translate" formControlName="version"
maxlength="15" required pattern="[0-9]{1,2}[.]{1}[0-9]{1,2}[.]{1}[0-9]{1,2}"> maxlength="15" required pattern="[0-9]{1,2}[.]{1}[0-9]{1,2}[.]{1}[0-9]{1,2}">
<mat-hint>##.##.##</mat-hint> <mat-hint>##.##.##</mat-hint>
<!-- Borrar mat-error-->
<mat-error *ngFor="let error of getErrors('version', 'label.version')">{{ 'message.error.' + error.name | translate : error.prop}} <mat-error *ngFor="let error of getErrors('version', 'label.version')">{{ 'message.error.' + error.name | translate : error.prop}}
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
...@@ -85,6 +88,7 @@ ...@@ -85,6 +88,7 @@
{{country.name | translate}} {{country.name | translate}}
</mat-option> </mat-option>
</mat-select> </mat-select>
<!-- Borrar mat-error-->
<mat-error *ngFor="let error of getErrors('country', 'label.country')">{{ 'message.error.' + error.name | translate : error.prop}} <mat-error *ngFor="let error of getErrors('country', 'label.country')">{{ 'message.error.' + error.name | translate : error.prop}}
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
...@@ -99,6 +103,7 @@ ...@@ -99,6 +103,7 @@
{{timezone | translate}} {{timezone | translate}}
</mat-option> </mat-option>
</mat-select> </mat-select>
<!-- Borrar mat-error-->
<mat-error *ngFor="let error of getErrors('timezone', 'label.timezone')">{{ 'message.error.' + error.name | translate : error.prop}} <mat-error *ngFor="let error of getErrors('timezone', 'label.timezone')">{{ 'message.error.' + error.name | translate : error.prop}}
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
...@@ -112,6 +117,7 @@ ...@@ -112,6 +117,7 @@
{{language.name | translate}} {{language.name | translate}}
</mat-option> </mat-option>
</mat-select> </mat-select>
<!-- Borrar mat-error-->
<mat-error *ngFor="let error of getErrors('language', 'label.language')">{{ 'message.error.' + error.name | translate : error.prop}} <mat-error *ngFor="let error of getErrors('language', 'label.language')">{{ 'message.error.' + error.name | translate : error.prop}}
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
...@@ -125,6 +131,7 @@ ...@@ -125,6 +131,7 @@
{{type.name | translate}} {{type.name | translate}}
</mat-option> </mat-option>
</mat-select> </mat-select>
<!-- Borrar mat-error-->
<mat-error *ngFor="let error of getErrors('type', 'label.type')">{{ 'message.error.' + error.name | translate : error.prop}} <mat-error *ngFor="let error of getErrors('type', 'label.type')">{{ 'message.error.' + error.name | translate : error.prop}}
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
......
...@@ -3,15 +3,15 @@ import { map } from 'rxjs/operators'; ...@@ -3,15 +3,15 @@ import { map } from 'rxjs/operators';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class UploadService { export class UploadService {
SERVER_URL = './service/agent'; SERVER_URL = './service/agent';
constructor(private httpClient: HttpClient) { } constructor(private httpClient: HttpClient) { }
public upload(formData) { public upload(formData) {
return this.httpClient.post<any>(this.SERVER_URL, formData, { return this.httpClient.post<any>(this.SERVER_URL, formData, {
reportProgress: true, reportProgress: true,
observe: 'events' observe: 'events'
}); });
......
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule, Routes } from '@angular/router';
import { AuthGuard, ResourceAuthGuard } from '@xdf/security';
import { CrudDetailComponent, CrudGridComponent, DirtyGuard, RecordResolver, TemplateResolver } from '@xdf/gallery';
const routes: Routes = [
{
path: "airport",
component: CrudGridComponent,
canActivate: [AuthGuard, ResourceAuthGuard ],
resolve: {Template: TemplateResolver},
data: {
innerTemplate: 'none',
program: "airport",
breadcrumb: 'breadcrumb.airport'
},
},
{
path: 'airport/detail/:mode', component: CrudDetailComponent,
canActivate: [AuthGuard, ResourceAuthGuard],
canDeactivate: [DirtyGuard],
resolve: {record: RecordResolver},
data: {
program: 'airport',
breadcrumb: 'breadcrumb.airport.detail'
}
}
];
@NgModule({
imports: [
RouterModule.forChild(routes)
],
exports: [RouterModule]
})
export class AirportRoutingModule { }
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { XdfGalleryModule } from '@xdf/gallery';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { AirportRoutingModule } from './airport-routing.module';
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import { XdfGalleryModule } from '@xdf/gallery';
import { XdfSettingsModule } from '@xdf/settings'; import { XdfSettingsModule } from '@xdf/settings';
import { MantenimientoRoutingModule } from './mantenimiento-routing.module';
import { PruebaComponent } from './components/prueba/prueba.component';
@NgModule({ @NgModule({
declarations: [ declarations: [],
PruebaComponent
],
imports: [ imports: [
CommonModule, CommonModule,
FormsModule, FormsModule,
...@@ -18,12 +17,7 @@ import { PruebaComponent } from './components/prueba/prueba.component'; ...@@ -18,12 +17,7 @@ import { PruebaComponent } from './components/prueba/prueba.component';
TranslateModule, TranslateModule,
XdfGalleryModule, XdfGalleryModule,
XdfSettingsModule, XdfSettingsModule,
MantenimientoRoutingModule AirportRoutingModule
],
entryComponents:[
],
providers: [
] ]
}) })
export class MantenimientoModule { } export class AirportModule { }
\ No newline at end of file
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule, Routes } from '@angular/router';
import { CrudDetailComponent, CrudGridComponent, DirtyGuard, RecordResolver, TemplateResolver } from '@xdf/gallery';
import { AuthGuard, ResourceAuthGuard } from '@xdf/security';
const routes: Routes = [
{
path: "booking_agent", component: CrudGridComponent, canActivate: [AuthGuard, ResourceAuthGuard],
resolve: {Template: TemplateResolver},
data: {
innerTemplate: 'none',
program: "booking_agent",
breadcrumb: "breadcrumb.booking_agent"
},
},
{
path: 'booking_agent/detail/:mode', component: CrudDetailComponent, canActivate: [AuthGuard, ResourceAuthGuard], canDeactivate: [DirtyGuard],
resolve: {record: RecordResolver},
data: {
program: 'booking_agent',
breadcrumb: 'breadcrumb.booking_agent.detail'
}
}
]
@NgModule({
declarations: [],
imports: [
RouterModule.forChild(routes)
],
exports: [RouterModule]
})
export class BookingAgentRoutingModule { }
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { XdfGalleryModule } from '@xdf/gallery';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import { XdfGalleryModule } from '@xdf/gallery';
import { XdfSettingsModule } from '@xdf/settings'; import { XdfSettingsModule } from '@xdf/settings';
import { PruebaRoutingModule } from './prueba-routing.module'; import { BookingAgentRoutingModule } from './booking-agent-routing.module';
import { MatPaginatorModule, MatTableModule } from '@angular/material';
@NgModule({ @NgModule({
declarations: [ declarations: [],
],
imports: [ imports: [
CommonModule, CommonModule,
FormsModule, FormsModule,
...@@ -17,14 +17,7 @@ import { MatPaginatorModule, MatTableModule } from '@angular/material'; ...@@ -17,14 +17,7 @@ import { MatPaginatorModule, MatTableModule } from '@angular/material';
TranslateModule, TranslateModule,
XdfGalleryModule, XdfGalleryModule,
XdfSettingsModule, XdfSettingsModule,
TranslateModule, BookingAgentRoutingModule
MatTableModule,
MatPaginatorModule,
PruebaRoutingModule
],
entryComponents:[
],
providers: [
] ]
}) })
export class PruebaModule { } export class BookingAgentModule { }
\ No newline at end of file
<div [formGroup]="formGroup">
<mat-form-field class="form-control-full-width" style="width: 100%" hintLabel="{{ suggest | translate }}">
<mat-label>{{ placeholder | translate}}</mat-label>
<input matInput [matDatepicker]="picker" [formControlName]="name" [required]="required" [min]="this.minDate"
(dateInput)="changeValue($event.value)" [max]="this.maxDate" onpaste="return false">
<mat-datepicker-toggle id="{{name}}" matSuffix [for]="picker" [disabled]="disabled"></mat-datepicker-toggle>
<mat-datepicker #picker [disabled]="disabled"></mat-datepicker>
<mat-error *ngIf="formGroup.controls[this.name].hasError('required')
&& !formGroup.controls[this.name].hasError('matDatepickerMax')
&& !formGroup.controls[this.name].hasError('matDatepickerMin')
&& !formGroup.controls[this.name].hasError('matDatepickerParse')">
{{ 'message.error.required' | translate:{'label': placeholder | translate} }}
</mat-error>
<mat-error *ngIf="formGroup.controls[this.name].hasError('matDatepickerMax')">
{{ 'message.error.matDatepickerMax' | translate : {'max': getDateFormat(maxDate), 'label': placeholder | translate } }}
</mat-error>
<mat-error *ngIf="formGroup.controls[this.name].hasError('matDatepickerMin')">
{{ 'message.error.matDatepickerMin' | translate : {'min': getDateFormat(minDate), 'label': placeholder | translate } }}
</mat-error>
<mat-error *ngIf="formGroup.controls[this.name].hasError('matDatepickerParse')">
{{ 'message.error.matDatepickerParse' | translate : {'pattern': format } }}
</mat-error>
</mat-form-field>
</div>
\ No newline at end of file
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { DatepickerSelectComponent } from './datepicker-select.component';
describe('DatepickerSelectComponent', () => {
let component: DatepickerSelectComponent;
let fixture: ComponentFixture<DatepickerSelectComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DatepickerSelectComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(DatepickerSelectComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, EventEmitter, Input, OnInit, Output, SimpleChanges } from '@angular/core';
import { FormControl, FormGroup } from '@angular/forms';
import { FormGroupUtils } from '@xdf/gallery';
import * as moment from 'moment';
@Component({
selector: 'byte-datepicker-select',
templateUrl: './datepicker-select.component.html',
styleUrls: ['./datepicker-select.component.scss']
})
export class DatepickerSelectComponent implements OnInit {
@Input()
placeholder: string;
@Input()
name: string;
@Input()
suggest: string;
@Input()
disabled = false;
@Input()
required = false;
@Input()
minDate: Date;
@Input()
maxDate: Date;
@Input()
formGroup: FormGroup;
@Input()
format = 'DD/MM/YYYY';
@Output('changeDate') change = new EventEmitter<Date>();
constructor(
private formGroupUtils: FormGroupUtils) { }
ngOnChanges(changes: SimpleChanges): void {
this.disabled = (this.formGroup.controls[this.name] as FormControl).disabled;
}
ngOnInit(): void {
if (!this.formGroup) {
this.formGroup = this.formGroupUtils.createTemporalFormGroup(this.name, '', this.disabled);
}
if (!this.disabled) {
this.disabled = (this.formGroup.controls[this.name] as FormControl).disabled;
}
}
changeValue(value: any): void {
this.change.emit(value);
}
getDateFormat(date: Date): any {
if (date) {
const datem = moment(date);
return datem.utc().format(this.format);
}
return null;
}
}
<form [formGroup]="form" name="form" autocomplete="off" novalidate (ngSubmit)="submit()" class="form-content">
<div class="mail-box-header detail-header" [ngClass]="{'title-border-bottom': mode !='new'}">
<xdf-form-header [icon]="icon" [title]="'tax.title'" [recordIdentifier]="record?.id"
titleDesc="Gestionar Vuelos" [mode]="mode" [resourceAuth]="resourceAuth"
(optionEvent)="optionEvent($event)" [editing]="mode === 'edit'" [displaying]="mode === 'view'">
</xdf-form-header>
</div>
<div class="mail-box-content">
<div class="header-content">
<div class="col-12">
<div class="form-content">
<div class="legend">
<span class="group-title">Datos del Vuelo</span>
</div>
<div class="group-content">
<div class="row" style="margin-bottom: 15px;">
<div class="col-6 col-md-6">
<byte-datepicker-select name="departureDate" label="Fecha Salida"
placeholder="Fecha Salida" [formGroup]="form"
[disabled]="this.form.controls['departureDate'].disabled"
[minDate]="minDate">
</byte-datepicker-select>
</div>
<div class="col-6 col-md-6">
<byte-datepicker-select name="arrivalDate" label="Fecha Llegada"
placeholder="Fecha Llegada" [formGroup]="form"
[disabled]="this.form.controls['arrivalDate'].disabled"
[minDate]="minDate">
</byte-datepicker-select>
</div>
</div>
<div class="row" style="margin-bottom: 15px;">
<div class="col-6 col-md-6">
<xdf-input name="airlineCode" label="Codigo Aerolinea" type="text" [required]="true"
placeholder="Codigo Aerolinea" [formGroup]="form"
[options]="{maxLength: 12, showLength: true}">
</xdf-input>
</div>
<div class="col-6 col-md-6">
<xdf-input name="codeTypeAircraft" label="Codigo Aeronave" type="text" [required]="true"
placeholder="Codigo Aeronave" [formGroup]="form"
[options]="{maxLength: 50, showLength: true}">
</xdf-input>
</div>
</div>
<div class="row" style="margin-bottom: 15px;">
<div class="col-6 col-md-6">
<mat-form-field style="width: 100%;">
<mat-label>Aeropuerto origen</mat-label>
<mat-select formControlName="codeAirportOrigin">
<mat-option *ngFor="let airport of airports" [value]="airport.id">
{{airport.airportCode}}
</mat-option>
</mat-select>
</mat-form-field>
</div>
<div class="col-6 col-md-6">
<mat-form-field style="width: 100%;">
<mat-label>Aeropuerto Destino</mat-label>
<mat-select formControlName="codeAirportDestination">
<mat-option *ngFor="let airport of airports" [value]="airport.id">
{{airport.airportCode}}
</mat-option>
</mat-select>
</mat-form-field>
</div>
</div>
<div class="row" style="margin-bottom: 15px;">
<div class="col-6 col-md-6">
<xdf-input name="flightCost" label="Costo" type="text" [required]="true"
placeholder="Costo" [formGroup]="form"
[options]="{maxLength: 12, showLength: true}">
</xdf-input>
</div>
</div>
</div>
<div class="hr-line-dashed" style="margin-bottom: 20px"></div>
<div class="legend">
<span class="group-title">Escalas</span>
</div>
<div class="group-content">
<byte-flight-legs-grid #taxRatesGrid [mode]="mode"></byte-flight-legs-grid>
</div>
</div>
</div>
</div>
<div class="footer-content">
<div class="col-lg-12" *ngIf="mode !== 'view'">
<div class="form-status-bar border-top">
<button type="submit" mat-stroked-button class="btn btn-primary pull-right" style="margin-top: 10px;"
[disabled]="form?.invalid || processing || form.pending || taxRatesGrid.dataSource.data.length === 0">
<i class="fa fa-save" aria-hidden="true" style="padding-right: 3px; padding-bottom: 3px;">
</i>{{'btn.save' | translate }}
</button>
</div>
</div>
</div>
</div>
</form>
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { PruebaComponent } from './prueba.component'; import { FlightFormComponent } from './flight-form.component';
describe('PruebaComponent', () => { describe('FlightFormComponent', () => {
let component: PruebaComponent; let component: FlightFormComponent;
let fixture: ComponentFixture<PruebaComponent>; let fixture: ComponentFixture<FlightFormComponent>;
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ PruebaComponent ] declarations: [ FlightFormComponent ]
}) })
.compileComponents(); .compileComponents();
})); }));
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(PruebaComponent); fixture = TestBed.createComponent(FlightFormComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
}); });
......
import { AfterViewInit, ChangeDetectorRef, Component, OnInit, ViewChild, ViewContainerRef } from '@angular/core';
import { AsyncValidatorFn, FormBuilder, FormControl, FormGroup, ValidationErrors, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { IFormView, DynaDataService, AuditDialogService, ConfirmationDialogService, RequiredValidator } from '@xdf/gallery';
import { InitCommonsService, NotificationService, NotificationType } from '@xdf/commons';
import { FlightService } from '../../services/flight.service';
import { FlightLegsGridComponent } from '../flight-legs-grid/flight-legs-grid.component';
@Component({
selector: 'byte-flight-form',
templateUrl: './flight-form.component.html',
styleUrls: ['./flight-form.component.scss']
})
export class FlightFormComponent extends IFormView implements OnInit, AfterViewInit {
airports: any[] = [];
form: FormGroup;
private taxRatesGrid: FlightLegsGridComponent;
@ViewChild('taxRatesGrid', {static: false})
set content (
content: FlightLegsGridComponent
) {
if (content) {
this.taxRatesGrid = content;
} else {
this.taxRatesGrid = undefined;
}
}
constructor(
protected formBuilder: FormBuilder,
protected vcRef: ViewContainerRef,
protected activatedRoute: ActivatedRoute,
protected router: Router,
protected dynaDataService: DynaDataService,
protected translate: TranslateService,
protected notificationService: NotificationService,
protected auditDialogService: AuditDialogService,
protected confirmationDialogService: ConfirmationDialogService,
protected init: InitCommonsService,
protected changeDetector: ChangeDetectorRef,
private flightService: FlightService ) {
super(vcRef, activatedRoute, router, dynaDataService,
translate, notificationService, auditDialogService,
confirmationDialogService, init);
}
ngAfterViewInit(): void {
if(this.mode !== 'new' && this.record) {
this.taxRatesGrid.dataSource.data = this.taxRatesGrid.autoSort(this.record.legs);
}
this.changeDetector.detectChanges();
}
ngOnInit(): void {
this.listAirports();
super.ngOnInit();
}
listAirports() {
this.flightService.getAirports().subscribe(
res => {
this.airports = res;
}
)
}
addLegsToFlight(idFlight: number) {
for(let i = 0; i < this.taxRatesGrid.dataSource.data.length; i++) {
this.taxRatesGrid.dataSource.data[i].flightCode = idFlight;
this.flightService.addLeg(this.taxRatesGrid.dataSource.data[i])
.subscribe(res => {})
}
}
protected getFields(): FormGroup {
let form;
form = this.formBuilder.group({
airlineCode: this.createFormControl('airlineCode', (this.mode !== 'new' && this.record),
true, '', [RequiredValidator.isRequired]),
codeTypeAircraft: this.createFormControl('codeTypeAircraft', (this.mode !== 'new' && this.record), true),
codeAirportOrigin: this.createFormControl('codeAirportOrigin', (this.mode !== 'new' && this.record),
true, '', [RequiredValidator.isRequired]),
codeAirportDestination: this.createFormControl('codeAirportDestination', (this.mode !== 'new' && this.record),
true, '', [RequiredValidator.isRequired]),
flightCost: this.createFormControl('flightCost', (this.mode !== 'new' && this.record), true, '', [RequiredValidator.isRequired]),
departureDate: this.createFormControl('departureDate', (this.mode !== 'new' && this.record),
true, '', [RequiredValidator.isRequired]),
arrivalDate: this.createFormControl('arrivalDate', (this.mode !== 'new' && this.record), true, '', [RequiredValidator.isRequired]),
});
return form;
}
private createFormControl(
name: string, existRecord?: boolean,
required?: boolean, defaultValue?: string,
validators?: Array<ValidationErrors>, asyncValidators?: Array<AsyncValidatorFn>): FormControl {
if(!defaultValue) {
defaultValue = '';
}
let validatorList = [];
if(validators) {
validatorList = validators;
}
if(required) {
validatorList.push(Validators.required);
}
if(name === 'code') return new FormControl(
{ value: existRecord ? this.record[name]: '', disabled: this.mode !== 'new'},
validatorList, asyncValidators
);
return new FormControl(
{ value: existRecord ? this. record[name] : '', disabled: this.mode === 'view'},
validatorList, asyncValidators);
}
submit() {
this.processing = true;
let result = {
id: this.mode != 'new' ? this.record.id: 0,
airlineCode: this.form.value['airlineCode'],
codeTypeAircraft: this.form.value['codeTypeAircraft'],
codeAirportOrigin: this.form.value['codeAirportOrigin'],
codeAirportDestination: this.form.value['codeAirportDestination'],
flightCost: this.form.value['flightCost'],
departureDate: this.form.value['departureDate'],
arrivalDate: this.form.value['arrivalDate']
}
if(this.mode == 'new') {
this.dynaDataService.create(result).subscribe(
(res) => {
this.addLegsToFlight(res['id']);
this.notificationService.showMessage(
this.translate.instant('message.create.succesful'),
this.translate.instant('title.information'),
NotificationType.success
);
this.record = new Object();
this.form.markAsPristine();
this.router.navigate([this.returnUrl]);
this.processing = false;
},
error => {
this.processing = false;
}
);
}
}
}
<div class="popup-general">
<div class="row">
<div class="col-lg-12">
<div class="dialog-title">
<img src="{{ logoSrc }}" with="25" height="25">
<span class="header-popup-text">Agregar una escala</span>
<div class="pull-right">
<button type="button" class="close" (click)="close()"></button>
</div>
</div>
</div>
</div>
<div mat-dialog-content class="dialog-content">
<form [formGroup]="form" name="form" autocomplete="off" novalidate>
<div class="group-content">
<div class="row" style="margin-top: 15px; margin-bottom: 15px;">
<div class="col-5" style="margin-inline: auto;">
<byte-datepicker-select name="arrivalDate" label="Fecha Salida" placeholder="Fecha Salida"
[formGroup]="form" [disabled]="this.form.controls['arrivalDate'].disabled"
[minDate]="minDate">
</byte-datepicker-select>
</div>
<div class="col-5" style="margin-inline: auto;">
<byte-datepicker-select name="departureDate" label="Fecha Llegada" placeholder="Fecha Llegada"
[formGroup]="form" [disabled]="this.form.controls['departureDate'].disabled"
[minDate]="minDate">
</byte-datepicker-select>
</div>
</div>
<div class="row" style="margin-top: 15px; margin-bottom: 15px;">
<div class="col-5" style="margin-inline: auto;">
<mat-form-field style="width: 100%;">
<mat-label>Aeropuerto Origen</mat-label>
<mat-select formControlName="codeAirportOrigin">
<mat-option *ngFor="let airport of airports" [value]="airport.id">
{{airport.airportCode}}
</mat-option>
</mat-select>
</mat-form-field>
</div>
<div class="col-5" style="margin-inline: auto;">
<mat-form-field style="width: 100%;">
<mat-label>Aeropuerto Destino</mat-label>
<mat-select formControlName="codeAirportDestination">
<mat-option *ngFor="let airport of airports" [value]="airport.id">
{{airport.airportCode}}
</mat-option>
</mat-select>
</mat-form-field>
</div>
</div>
</div>
</form>
</div>
<div class="dialog-footer">
<div>
<button type="button" class="btn btn-primary pull-right" (click)="save()" *ngIf="mode !== 'view'"
[disabled]="record ? ((form?.invalid && form?.touched) || processing) : (form?.invalid || processing)">
<span><i class="fa fa-floppy-o"></i>&nbsp;{{ 'btn.save' | translate }}</span>
</button>
&nbsp;
<button class="btn btn-default pull-left" (click)="close()">
<span>{{ 'btn.cancel' | translate }}</span>
</button>
</div>
</div>
</div>
\ No newline at end of file
.header-popup-text {
font-size: 17px;
font-weight: 600;
color: #676a6c;
}
img {
margin-right: 10px;
margin-bottom: 10px;
}
.btn-actions {
.btn {
white-space: nowrap;
}
}
$fontcolor: #676a6c;
.content-vertical-bar {
margin-left: 10px;
margin-right: -10px;
button {
width: 35px;
height: 35px;
margin-bottom: 5px;
display: block;
.mat-button-wrapper {
padding: 0px !important;
}
i {
margin-top: -6px;
// padding-left: 2px;
font-size: 14px;
color: $fontcolor
}
i:hover {
color: #1c84c6;
}
}
}
.content {
width: 100%;
display: flex;
padding-right: 0px !important;
.grid-container,
.filter-panel {
.crud-table {
margin-bottom: 0px;
width: 100%;
}
}
.filter-panel {
margin-bottom: 10px;
}
.toolbar-option {
margin-left: 10px;
margin-right: -10px;
}
}
.grid-ibox-content {
width: 100%;
}
.grid-ibox-content-options {
width: calc(100% - 35px);
}
.btn-actions {
.btn {
font-size: 10px;
white-space: nowrap;
}
}
.spinner-container {
height: 100%;
width: 100%;
padding-top: 50px;
position: fixed;
}
.spinner-container {
height: 100%;
width: 100%;
padding-top: 50px;
position: fixed;
}
.spinner-container mat-spinner {
margin: -10px auto 0 auto;
}
th.mat-column-actions {
width: 1px !important;
padding-right: 0px !important;
}
td.mat-column-actions {
padding-right: 20px !important;
cursor: default !important;
}
td {
vertical-align: middle !important;
color: $fontcolor;
font-size: 12px;
}
th {
vertical-align: middle !important;
}
tr.mat-header-row {
height: 50px !important;
}
tr.mat-footer-row,
tr.mat-row:not(.inner-detail-row) {
height: 40px;
}
.table-toolbar {
right: 10px;
top: 10px;
button {
font-size: 12px;
}
}
.status-button-bar {
button {
font-size: 16px;
}
padding-top: 8px;
padding-left: 15px;
}
.mat-raised-button {
padding: 0px 10px;
}
.icon-centered-button span.mat-button-wrapper {
display: flex;
}
.icon-centered-button mat-icon {
font-size: 15px;
padding-top: 2px;
}
.mat-sort-header-arrow {
visibility: hidden;
}
.mat-sort-header-button {
.mat-icon {
padding-left: 10px;
font-size: 12px;
padding-top: 5px;
}
}
.mat-icon {
height: 16px !important;
width: 16px !important;
}
.material-icons {
font-size: 12px !important;
}
@media (min-width: 576px) {
.d-sm-block {
display: table-cell !important;
}
}
@media (max-width: 576px) {
.mat-paginator-page-size-label {
display: none !important;
}
}
tr.inner-detail-row {
height: 0;
.mat-column-expandedDetail {
padding: 0 10px;
}
}
.inner-element-detail {
overflow: hidden;
display: flex;
}
//@extend
tr.inner-detail-row {
td {
border-bottom: 1px solid #dee2e6;
}
}
tr.inner-element-row.odd,
tr.inner-detail-row.odd {
background-color: rgba(0, 0, 0, 0.05);
}
tr.mat-row-auth:not(.inner-expanded-row):hover {
background-color: #f8f9fa;
cursor: pointer !important;
}
tr.mat-row-auth.inner-expanded-row:hover {
cursor: pointer !important;
}
.additional-options-section {
padding: 0;
width: 100%;
display: inline-grid;
button {
margin: 1px 0;
color: inherit;
font-size: inherit;
}
}
.mat-menu-item {
padding: 0 10px;
}
@media (min-width: 992px) {
.d-t-lg-block {
display: table-cell !important;
}
}
.tags-input {
.filter-label {
text-align: center;
align-items: inherit;
padding: 9px 15px;
border-radius: 0%;
background-color: rgba(0, 0, 0, 0.05);
}
input {
min-width: 100px;
font-size: 12px;
font-weight: 400;
color: $fontcolor;
}
button {
border-radius: 0px;
font-size: 12px;
}
.btn-options,
.btn-options:hover {
border: 0px solid #d2d2d2;
}
display: flex;
}
.icon {
margin-top: 30px;
margin-left: auto;
margin-right: auto;
}
.icon1 {
margin-left: 35%;
margin-right: auto;
}
.button-new {
margin-top: 30px;
margin-left: auto;
margin-right: auto;
}
.suggest {
margin-top: 15px;
}
.tags-input__input-field {
padding: 5px 0 5px 5px;
margin-left: 0px !important;
border: none;
flex-grow: 1;
outline: none;
}
\ No newline at end of file
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { FlightLegDialogComponent } from './flight-leg-dialog.component';
describe('FlightLegDialogComponent', () => {
let component: FlightLegDialogComponent;
let fixture: ComponentFixture<FlightLegDialogComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ FlightLegDialogComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(FlightLegDialogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, HostListener, Inject, OnInit } from '@angular/core';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
import { FlightService } from '../../services/flight.service';
@Component({
selector: 'byte-flight-leg-dialog',
templateUrl: './flight-leg-dialog.component.html',
styleUrls: ['./flight-leg-dialog.component.scss']
})
export class FlightLegDialogComponent implements OnInit {
form: FormGroup;
logoSrc: any;
minDate: Date;
record: any;
mode: any;
title = "dialog_rate_new_title"
airports: any[] = [];
constructor(
public dialogRef: MatDialogRef<FlightLegDialogComponent>,
private formBuilder: FormBuilder,
private flightService: FlightService,
@Inject(MAT_DIALOG_DATA) public data: any
) {
this.record = data.record;
this.mode = data.mode;
this.minDate = data.minDate;
}
ngOnInit() {
this.listAirports();
this.logoSrc = "assets/images/logo_byte_menu-min.png";
this.form = this.formBuilder.group({
arrivalDate: new FormControl({ disabled: this.mode === 'view' }, [Validators.required]),
departureDate: new FormControl({ disabled: this.mode === 'view' }, [Validators.required]),
codeAirportOrigin: new FormControl([Validators.required]),
codeAirportDestination: new FormControl([Validators.required]),
codeFlight: new FormControl([Validators.required])
});
console.log(this.record);
if (this.record) {
this.form.controls['arrivalDate'].setValue(this.record.arrivalDate);
this.form.controls['codeAirportOrigin'].setValue(this.record.codeAirportOrigin);
this.form.controls['codeAirportDestination'].setValue(this.record.codeAirportDestination);
this.form.controls['departureDate'].setValue(this.record.departureDate);
} else {
this.form.controls['codeAirportOrigin'].setValue('');
this.form.controls['codigoAirportDestination'].setValue('');
}
}
@HostListener('window:keyup.esc') onKeyUp() {
this.dialogRef.close(null);
}
close() {
this.dialogRef.close(null);
}
save() {
this.dialogRef.close(this.form.value)
}
listAirports() {
this.flightService.getAirports().subscribe(
res => {
this.airports = res;
console.log(res);
}
)
}
}
import { TestBed } from '@angular/core/testing';
import { FlightLegDialogService } from './flight-leg-dialog.service';
describe('FlightLegDialogService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: FlightLegDialogService = TestBed.get(FlightLegDialogService);
expect(service).toBeTruthy();
});
});
import { Injectable } from '@angular/core';
import { MatDialog, MatDialogRef } from '@angular/material';
import { FlightLegDialogComponent } from '../flight-leg-dialog.component';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
})
export class FlightLegDialogService {
componentRef: MatDialogRef<FlightLegDialogComponent>;
constructor(public dialog: MatDialog) { }
loadComponent(record: any, mode: string, minDate: any): Observable<boolean> {
this.componentRef = this.dialog.open(FlightLegDialogComponent, {
panelClass: 'custom-dialog',
width: '600px',
disableClose: true,
data: {
record,
mode,
minDate
}
});
return this.componentRef.afterClosed().pipe(map(it => it));
}
}
<div style="display: flex;">
<div class="grid-ibox-content-options">
<!-- <div class="filter-panel mat-elevation-z8 remove-buttons">
<xdf-ngx-tags-input #inputComponent name="name" class="input-lg" [fields]="fieldFilters"
(filterEvent)="onFilter(false)">
</xdf-ngx-tags-input>
</div> -->
<div class="grid-container mat-elevation-z8">
<table class="crud-table table table-striped table-hover" mat-table [dataSource]="dataSource" matSort
[matSortActive]="sortColumn" [matSortDirection]="sortDirection" matSortDisableClear
multiTemplateDataRows>
<ng-container matColumnDef="{{ template.name }}" *ngFor="let template of columnTemplateArray">
<div *ngIf="template.sortable" >
<th mat-header-cell *matHeaderCellDef mat-sort-header >
{{ template.title | translate }}
<mat-icon *ngIf="sortColumn === template?.name">
<em class="fa" [ngClass]="{
'fa-sort-amount-desc': sortDirection === 'desc',
'fa-sort-amount-asc': sortDirection === 'asc'}"></em>
</mat-icon>
</th>
</div>
<div *ngIf="!template.sortable" >
<th mat-header-cell *matHeaderCellDef > {{ template.title | translate }} </th>
</div>
<td mat-cell *matCellDef="let item" class="text-secondary"
[ngStyle]="template.style ? template.style : ''">
<span *ngIf="template.name === 'arrivalDate'">
{{ getDateFormat(item[template.name]) }}
</span>
<span *ngIf="template.name === 'departureDate'">
{{ getDateFormat(item[template.name]) }}
</span>
</td>
</ng-container>
<ng-container matColumnDef="actions">
<th mat-header-cell *matHeaderCellDef></th>
<td mat-cell *matCellDef="let item; let i = dataIndex" class="text-center" style="width: 5%;">
<div class="btn-group btn-actions" *ngIf="mode !== 'view'">
<button type="button" class="btn btn-default btn-sm" (click)="onEdit(item)" [disabled]="mode === 'view'">
<i class="fa fa-edit d-xl-none"></i>
<span class="d-none d-xl-block">
<i class="fa fa-edit"></i>&nbsp;{{"btn.edit" | translate}}
</span>
</button>
<button type="button" class="btn btn-default btn-sm" (click)="onDelete(item)" [disabled]="mode === 'view'">
<i class="fa fa-trash d-xl-none"></i>
<span class="d-none d-xl-block">
<i class="fa fa-trash"></i>&nbsp;{{"btn.delete" | translate}}
</span>
</button>
</div>
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
</table>
<mat-paginator #paginator showFirstLastButtons [pageSizeOptions]="[5, 10, 15]">
</mat-paginator>
</div>
</div>
<div class="content-vertical-bar">
<button type="button" mat-mini-fab color="default" *ngIf="mode !== 'view'" (click)="onCreate()" matTooltip="{{ 'btn.new' | translate }}">
<i class="fa fa-file-o"></i>
</button>
</div>
</div>
\ No newline at end of file
.active {
background-color: #f3f3f4;
}
$fontcolor: #676a6c;
.content {
width: 100%;
display: flex;
padding-right: 0px !important;
.grid-container {
overflow: auto;
}
.filter-panel {
.crud-table {
margin-bottom: 0px;
width: 100%;
}
}
.filter-panel {
margin-bottom: 10px;
}
.toolbar-option {
margin-left: 10px;
margin-right: -10px;
}
}
.grid-ibox-content {
width: 100%;
}
.grid-ibox-content-options {
width: calc(100% - 35px);
}
.btn-actions {
.btn {
font-size: 10px;
white-space: nowrap;
}
}
.spinner-container {
height: 100%;
width: 100%;
padding-top: 50px;
}
.spinner-container mat-spinner {
margin: -10px auto 0 auto;
}
th.mat-column-actions {
width: 1px !important;
padding-right: 0px !important;
}
td.mat-column-actions {
padding-right: 20px !important;
cursor: default !important;
}
.popover-btn {
width: auto;
margin-left: auto;
margin-right: auto;
display: flex;
padding: 2px 10px 2px 10px;
}
td {
vertical-align: middle !important;
color: $fontcolor;
font-size: 12px;
overflow: hidden;
width: auto;
text-overflow: ellipsis;
white-space: nowrap;
}
th {
vertical-align: middle !important;
}
tr.mat-header-row {
height: 50px !important;
}
tr.mat-footer-row,
tr.mat-row:not(.inner-detail-row) {
height: 40px;
}
.table-toolbar {
right: 10px;
top: 10px;
button {
font-size: 12px;
}
}
.status-button-bar {
button {
font-size: 16px;
}
padding-top: 8px;
padding-left: 15px;
}
.mat-raised-button {
padding: 0px 10px;
}
.icon-centered-button span.mat-button-wrapper {
display: flex;
}
.icon-centered-button mat-icon {
font-size: 15px;
padding-top: 2px;
}
.mat-sort-header-arrow {
visibility: hidden;
}
.mat-sort-header-button {
.mat-icon {
padding-left: 10px;
font-size: 12px;
padding-top: 5px;
}
}
@media (min-width: 576px) {
.d-sm-block {
display: table-cell !important;
}
}
@media (max-width: 576px) {
.mat-paginator-page-size-label {
display: none !important;
}
}
tr.inner-detail-row {
height: 0;
.mat-column-expandedDetail {
padding: 0 10px;
}
}
.inner-element-detail {
overflow: hidden;
display: flex;
}
tr.inner-detail-row {
td {
border-bottom: 1px solid #dee2e6;
border-top: 0px;
}
}
tr.inner-element-row.odd,
tr.inner-detail-row.odd {
background-color: rgba(0, 0, 0, 0.05);
}
tr.mat-row-auth:not(.inner-expanded-row):hover {
background-color: #f8f9fa;
cursor: pointer !important;
}
tr.mat-row-auth.inner-expanded-row:hover {
cursor: pointer !important;
}
.mat-row:hover {
cursor: pointer;
background-color: #f8f9fa;
}
tr.inner-element-row.odd:hover,
tr.inner-detail-row.odd:hover {
cursor: pointer;
background-color: #f8f9fa;
}
tr.inner-element-row-expanded td {
border-top: 0px;
border-bottom: 0px;
}
.additional-options-section {
padding: 0;
width: 100%;
display: inline-grid;
button {
margin: 1px 0;
color: inherit;
font-size: inherit;
border-radius: 0px;
padding: 0 16px;
}
}
:host::ng-deep .mat-menu-item {
padding: 0 10px;
}
@media (min-width: 992px) {
.d-t-lg-block {
display: table-cell !important;
}
}
.grid {
padding: 10px 20px 20px;
}
.icon {
line-height: 0;
}
.content-vertical-bar {
button {
margin-left: 10px;
width: 35px;
height: 35px;
margin-bottom: 5px;
display: block;
.mat-button-wrapper {
padding: 0px !important;
}
i {
margin-top: -6px;
font-size: 14px;
color: $fontcolor;
}
i:hover {
color: #1c84c6;
}
}
}
.grid-columns-section {
padding: 10px 0 0 0;
width: 100%;
display: inline-grid;
color: inherit;
font-size: inherit;
button {
margin: 5px 0 0;
border-radius: 0px;
}
.mat-checkbox {
padding: 0 10px 2px 15px;
}
}
.partyType-radio-button {
margin-top: 20px;
margin-left: 20px;
}
.new {
:hover {
color: #2186c6;
}
}
.btn-new {
color: #676a6c;
}
.text-overflow {
max-width: 400px;
font-size: 12px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
@media (max-width: 1500px) {
.text-overflow {
max-width: 350px;
font-size: 12px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
}
@media (max-width: 1000px) {
.text-overflow {
max-width: 70px;
font-size: 12px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
}
\ No newline at end of file
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { FlightLegsGridComponent } from './flight-legs-grid.component';
describe('FlightLegsGridComponent', () => {
let component: FlightLegsGridComponent;
let fixture: ComponentFixture<FlightLegsGridComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ FlightLegsGridComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(FlightLegsGridComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { DecimalPipe } from '@angular/common';
import { AfterViewInit, Component, Input, OnInit, ViewChild } from '@angular/core';
import { MatPaginator, MatSort } from '@angular/material';
import { MatTableDataSource } from '@angular/material/table';
import { ColumnTemplate } from '@xdf/gallery';
import * as moment from 'moment';
import { FlightLegDialogService } from '../flight-leg-dialog/services/flight-leg-dialog.service';
@Component({
selector: 'byte-flight-legs-grid',
templateUrl: './flight-legs-grid.component.html',
styleUrls: ['./flight-legs-grid.component.scss']
})
export class FlightLegsGridComponent implements OnInit, AfterViewInit {
@Input() mode;
columnTemplateArray : ColumnTemplate[] = [
{
name: 'arrivalDate',
sortable: false,
title: 'Fecha Salida',
visible: true,
filtable: true,
style: { width: '30%' },
type: 'date',
aliasName: null,
queryName: null,
responsive: null,
styles: null,
values: null,
digitsInfo: null,
dateFormat: null,
colStyle: null
},
{
name: 'departureDate',
sortable: false,
title: 'Fecha Llegada',
visible: true,
filtable: true,
style: { width: '30%' },
type: 'date',
aliasName: null,
queryName: null,
responsive: null,
styles: null,
values: null,
digitsInfo: null,
dateFormat: null,
colStyle: null
}
];
decimalParameter = 2;
dataSource: MatTableDataSource<any>;
displayedColumns = new Array<string>();
@ViewChild('paginator',{static: true}) paginator: MatPaginator;
@ViewChild(MatSort, { static: false }) sort: MatSort | undefined;
sortDirection = 'desc';
sortColumn = 'arrivalDate';
constructor(
private flightLegDialogService : FlightLegDialogService,
private decimalPipe : DecimalPipe,
) {}
ngAfterViewInit(): void {
this.paginator.pageSize = 5;
this.dataSource.paginator = this.paginator;
this.sort.sortChange.subscribe(() => {
console.log();
});
}
ngOnInit(): void {
this.dataSource = new MatTableDataSource<any>();
this.columnTemplateArray.forEach((column) => {
console.log(this.dataSource);
this.displayedColumns.push(column.name);
}
);
this.displayedColumns.push('actions');
}
autoSort(data) {
return data.sort((a, b) => new Date(a.arrivalDate) < new Date(b.arrivalDate) ? 1 : -1);
}
numberWithCommas(x): string {
return x ? this.decimalPipe.transform(x, '1.' + this.decimalParameter + '-' + this.decimalParameter) : '';
}
getDateFormat(liquidationDate) {
return moment(liquidationDate).format('DD-MM-YYYY');
}
onCreate() {
this.flightLegDialogService.loadComponent(null, this.mode, this.getMaxDate()).subscribe(
data => {
if(data !== null) {
let dataSource = this.dataSource.data.slice();
dataSource.push(data);
console.log(data);
this.dataSource.data = this.autoSort(dataSource);
}
}
)
}
onDelete(item) {
let dataSource = [...this.dataSource.data];
let pos = dataSource.findIndex(x => x === item);
dataSource.splice(pos, 1);
this.dataSource.data = this.autoSort(dataSource);
}
onEdit(item) {
this.flightLegDialogService.loadComponent(item, this.mode, this.getMaxDate()).subscribe(
data => {
if(data !== null) {
let dataSource = [...this.dataSource.data];
let pos = dataSource.findIndex(x => x === item);
dataSource[pos] = data;
this.dataSource.data = this.autoSort(dataSource);;
}
}
)
}
getMaxDate() {
let maxDate
if(this.dataSource.data.length > 0) {
maxDate = new Date(Math.max.apply(null,this.dataSource.data.map(x => new Date(x.arrivalDate))));
maxDate.setDate(maxDate.getDate() + 1);
} else {
maxDate = new Date();
}
return maxDate;
}
}
import { Injectable } from "@angular/core";
import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from "@angular/router";
import { HttpClient } from '@angular/common/http';
export const path = './assets/definitions/flight-definitions/flight.json';
@Injectable()
export class AirportListTemplateResolver implements Resolve<any> {
constructor(private httpClient: HttpClient) {}
resolve(route: ActivatedRouteSnapshot) {
return this.httpClient.get(path);
}
}
\ No newline at end of file
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule, Routes } from '@angular/router';
import { CrudGridComponent, DirtyGuard, RecordResolver, TemplateResolver } from '@xdf/gallery';
import { AuthGuard, ResourceAuthGuard } from '@xdf/security';
import { FlightFormComponent } from './components/flight-form/flight-form.component';
import { FlightLegDialogService } from './components/flight-leg-dialog/services/flight-leg-dialog.service';
const routes: Routes = [
{
path: "flight", component: CrudGridComponent, canActivate: [AuthGuard, ResourceAuthGuard],
resolve: {Template: TemplateResolver},
data: {
innerTemplate: 'none',
program: "flight",
breadcrumb: "breadcrumb.flight"
},
},
{
path: 'flight/detail/:mode', component: FlightFormComponent, canActivate: [AuthGuard, ResourceAuthGuard], canDeactivate: [DirtyGuard],
resolve: {record: RecordResolver},
data: {
program: 'flight',
breadcrumb: 'breadcrumb.flight.detail'
}
}
]
@NgModule({
imports: [
RouterModule.forChild(routes)
],
exports: [RouterModule],
providers: [FlightLegDialogService]
})
export class FlightRoutingModule { }
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { TranslateModule } from '@ngx-translate/core';
import { XdfGalleryModule } from '@xdf/gallery';
import { XdfSettingsModule } from '@xdf/settings';
import { MatAutocompleteModule, MatButtonModule, MatCardModule, MatCheckboxModule, MatChipsModule, MatDatepickerModule, MatDialogModule, MatExpansionModule, MatFormFieldModule, MatGridListModule, MatIconModule, MatInputModule, MatListModule, MatMenuModule, MatPaginatorModule, MatProgressSpinnerModule, MatRadioModule, MatSelectModule, MatSortModule, MatStepperModule, MatTableModule, MatTabsModule, MatTooltipModule } from '@angular/material';
import { NgScrollbarModule } from 'ngx-scrollbar';
import { XdfLayoutsModule } from '@xdf/layouts';
import { ScrollingModule } from '@angular/cdk/scrolling';
import { NgbModule, NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap';
import { FlightRoutingModule } from './flight-routing.module';
import { FlightFormComponent } from './components/flight-form/flight-form.component';
import { FlightLegsGridComponent } from './components/flight-legs-grid/flight-legs-grid.component';
import { FlightLegDialogComponent } from './components/flight-leg-dialog/flight-leg-dialog.component';
import { DatepickerSelectComponent } from './components/datepicker-select/datepicker-select.component';
@NgModule({
declarations: [
FlightFormComponent,
FlightLegsGridComponent,
FlightLegDialogComponent,
DatepickerSelectComponent
],
imports: [
CommonModule,
FormsModule,
ReactiveFormsModule,
TranslateModule,
XdfGalleryModule,
XdfSettingsModule,
MatTableModule,
MatSortModule,
MatIconModule,
MatPaginatorModule,
MatTooltipModule,
MatInputModule,
MatFormFieldModule,
MatDialogModule,
NgScrollbarModule,
XdfLayoutsModule,
MatMenuModule,
MatStepperModule,
ScrollingModule,
NgbPopoverModule,
MatChipsModule,
MatExpansionModule,
MatListModule,
MatAutocompleteModule,
NgbModule,
MatGridListModule,
MatPaginatorModule,
MatCheckboxModule,
MatSelectModule,
MatCardModule,
MatProgressSpinnerModule,
MatDialogModule,
MatButtonModule,
MatRadioModule,
MatTooltipModule,
MatTabsModule,
MatDatepickerModule,
FlightRoutingModule
],
entryComponents: [
FlightLegDialogComponent
]
})
export class FlightModule { }
import { TestBed } from '@angular/core/testing';
import { FlightService } from './flight.service';
describe('FlightService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: FlightService = TestBed.get(FlightService);
expect(service).toBeTruthy();
});
});
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class FlightService {
private url: string = "http://localhost:9077/AVB/service/airport";
private urlLeg: string = "http://localhost:9077/AVB/service/leg/";
constructor(private httpClient: HttpClient) { }
getAirports(): Observable<any[]> {
return this.httpClient.get<any[]>(`${this.url}/all`);
}
addLeg(query: any): Observable<Object> {
return this.httpClient.post(this.urlLeg, query);
}
}
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'byte-prueba',
templateUrl: './prueba.component.html',
styleUrls: ['./prueba.component.scss']
})
export class PruebaComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AuthGuard } from '@xdf/security';
import { TemplateResolver, DirtyGuard, CrudGridComponent, RecordResolver } from '@xdf/gallery';
import { ResourceAuthGuard } from '@xdf/security';
import { PruebaComponent } from './components/prueba/prueba.component';
const routes: Routes = [
{
path: '', component: PruebaComponent, canActivate: [AuthGuard, ResourceAuthGuard],
data: {
innerTemplate: 'none',
program: 'mantenimiento',
breadcrumb: 'breadcrumb.mantenimiento'
}
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class MantenimientoRoutingModule { }
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { CrudDetailComponent, CrudGridComponent, DirtyGuard, RecordResolver, TemplateResolver } from '@xdf/gallery';
import { AuthGuard, ResourceAuthGuard } from '@xdf/security';
const routes: Routes = [
{
path: "passenger", component: CrudGridComponent, canActivate: [AuthGuard, ResourceAuthGuard],
resolve: {Template: TemplateResolver},
data: {
innerTemplate: 'none',
program: "passenger",
breadcrumb: "breadcrumb.passenger"
},
},
{
path: 'passenger/detail/:mode', component: CrudDetailComponent, canActivate: [AuthGuard, ResourceAuthGuard], canDeactivate: [DirtyGuard],
resolve: {record: RecordResolver},
data: {
program: 'passenger',
breadcrumb: 'breadcrumb.passenger.detail'
}
}
]
@NgModule({
imports: [
RouterModule.forChild(routes)
],
exports: [RouterModule]
})
export class PassengerRoutingModule { }
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { TranslateModule } from '@ngx-translate/core';
import { XdfGalleryModule } from '@xdf/gallery';
import { XdfSettingsModule } from '@xdf/settings';
import { PassengerRoutingModule } from './passenger-routing.module';
@NgModule({
declarations: [],
imports: [
CommonModule,
FormsModule,
ReactiveFormsModule,
TranslateModule,
XdfGalleryModule,
XdfSettingsModule,
PassengerRoutingModule
]
})
export class PassengerModule { }
<div [formGroup]="formGroup">
<mat-form-field class="form-control-full-width" style="width: 100%" hintLabel="{{ suggest | translate }}">
<mat-label>{{ placeholder | translate}}</mat-label>
<input matInput [matDatepicker]="picker" [formControlName]="name" [required]="required" [min]="this.minDate"
(dateInput)="changeValue($event.value)" [max]="this.maxDate" onpaste="return false">
<mat-datepicker-toggle id="{{name}}" matSuffix [for]="picker" [disabled]="disabled"></mat-datepicker-toggle>
<mat-datepicker #picker [disabled]="disabled"></mat-datepicker>
<mat-error *ngIf="formGroup.controls[this.name].hasError('required')
&& !formGroup.controls[this.name].hasError('matDatepickerMax')
&& !formGroup.controls[this.name].hasError('matDatepickerMin')
&& !formGroup.controls[this.name].hasError('matDatepickerParse')">
{{ 'message.error.required' | translate:{'label': placeholder | translate} }}
</mat-error>
<mat-error *ngIf="formGroup.controls[this.name].hasError('matDatepickerMax')">
{{ 'message.error.matDatepickerMax' | translate : {'max': getDateFormat(maxDate), 'label': placeholder | translate } }}
</mat-error>
<mat-error *ngIf="formGroup.controls[this.name].hasError('matDatepickerMin')">
{{ 'message.error.matDatepickerMin' | translate : {'min': getDateFormat(minDate), 'label': placeholder | translate } }}
</mat-error>
<mat-error *ngIf="formGroup.controls[this.name].hasError('matDatepickerParse')">
{{ 'message.error.matDatepickerParse' | translate : {'pattern': format } }}
</mat-error>
</mat-form-field>
</div>
\ No newline at end of file
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { DatePickerPayComponent } from './date-picker-pay.component';
describe('DatePickerPayComponent', () => {
let component: DatePickerPayComponent;
let fixture: ComponentFixture<DatePickerPayComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DatePickerPayComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(DatePickerPayComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, EventEmitter, Input, OnInit, Output, SimpleChanges } from '@angular/core';
import { FormControl, FormGroup } from '@angular/forms';
import { FormGroupUtils } from '@xdf/gallery';
import * as moment from 'moment';
@Component({
selector: 'byte-date-picker-pay',
templateUrl: './date-picker-pay.component.html',
styleUrls: ['./date-picker-pay.component.scss']
})
export class DatePickerPayComponent implements OnInit {
@Input()
placeholder: string;
@Input()
name: string;
@Input()
suggest: string;
@Input()
disabled = false;
@Input()
required = false;
@Input()
minDate: Date;
@Input()
maxDate: Date;
@Input()
formGroup: FormGroup;
@Input()
format = 'DD/MM/YYYY';
@Output('changeDate') change = new EventEmitter<Date>();
constructor(private formGroupUtils: FormGroupUtils) { }
ngOnChanges(changes: SimpleChanges): void {
this.disabled = (this.formGroup.controls[this.name] as FormControl).disabled;
}
ngOnInit(): void {
if (!this.formGroup) {
this.formGroup = this.formGroupUtils.createTemporalFormGroup(this.name, '', this.disabled);
}
if (!this.disabled) {
this.disabled = (this.formGroup.controls[this.name] as FormControl).disabled;
}
}
changeValue(value: any): void {
this.change.emit(value);
}
getDateFormat(date: Date): any {
if (date) {
const datem = moment(date);
return datem.utc().format(this.format);
}
return null;
}
}
<form [formGroup]="form" name="form" autocomplete="off" novalidate (ngSubmit)="submit()" class="form-content">
<div class="mail-box-header detail-header" [ngClass]="{'title-border-bottom': mode !='new'}">
<xdf-form-header [icon]="icon" [title]="'tax.title'" [recordIdentifier]="record?.id" titleDesc="tax.title.desc"
[mode]="mode" [resourceAuth]="resourceAuth" (optionEvent)="optionEvent($event)" [editing]="mode === 'edit'"
[displaying]="mode === 'view'">
</xdf-form-header>
</div>
<div class="mail-box-content">
<div class="header-content">
<div class="col-12">
<div class="form-content">
<div class="legend">
<span class="group-title">Pasarela de Pago</span>
</div>
<div class="group-content">
<div class="row" style="margin-bottom: 15px;">
<div class="col-6 col-md-6">
<xdf-input name="tarjeta" label="Numero Tarjeta" type="text" [required]="true"
placeholder="Numero Tarjeta" [formGroup]="form"
[options]="{maxLength: 12, showLength: true}">
</xdf-input>
</div>
<div class="col-6 col-md-6">
<xdf-input name="nombre" label="Nombre Titular" type="text" [required]="true"
placeholder="Nombre Titular" [formGroup]="form"
[options]="{maxLength: 12, showLength: true}">
</xdf-input>
</div>
</div>
<div class="row" style="margin-bottom: 15px;">
<div class="col-6 col-md-6">
<byte-date-picker-pay name="fecha" label="Fecha Vencimiento"
placeholder="Fecha Vencimiento" [formGroup]="form"
[disabled]="this.form.controls['fecha'].disabled" [minDate]="minDate">
</byte-date-picker-pay>
</div>
<div class="col-6 col-md-6">
<xdf-input name="cvv" label="Codigo Seguridad" type="text" [required]="true"
placeholder="Codigo Seguridad" [formGroup]="form"
[options]="{maxLength: 12, showLength: true}">
</xdf-input>
</div>
</div>
</div>
<div class="hr-line-dashed" style="margin-bottom: 20px"></div>
</div>
</div>
</div>
<div class="footer-content">
<div class="col-lg-12" *ngIf="mode !== 'view'">
<div class="form-status-bar border-top">
<button type="submit" mat-stroked-button class="btn btn-primary pull-right"
style="margin-top: 10px;" [disabled]="form?.invalid || processing || form.pending">
<i class="fa fa-save" aria-hidden="true" style="padding-right: 3px; padding-bottom: 3px;">
</i>{{'btn.save' | translate }}
</button>
</div>
</div>
</div>
</div>
</form>
\ No newline at end of file
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { PaymentReservationFormComponent } from './payment-reservation-form.component';
describe('PaymentReservationFormComponent', () => {
let component: PaymentReservationFormComponent;
let fixture: ComponentFixture<PaymentReservationFormComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ PaymentReservationFormComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(PaymentReservationFormComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { AfterViewInit, Component, OnInit, ViewContainerRef } from '@angular/core';
import { AsyncValidatorFn, FormBuilder, FormControl, FormGroup, ValidationErrors, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { InitCommonsService, NotificationService, NotificationType } from '@xdf/commons';
import { AuditDialogService, ConfirmationDialogService, DynaDataService, IFormView, RequiredValidator } from '@xdf/gallery';
import { PaymentReservationService } from '../../services/payment-reservation.service';
@Component({
selector: 'byte-payment-reservation-form',
templateUrl: './payment-reservation-form.component.html',
styleUrls: ['./payment-reservation-form.component.scss']
})
export class PaymentReservationFormComponent extends IFormView implements OnInit, AfterViewInit {
form: FormGroup;
idPayment: number = 0;
constructor(
protected formBuilder: FormBuilder,
protected vcRef: ViewContainerRef,
protected activatedRoute: ActivatedRoute,
protected router: Router,
protected dynaDataService: DynaDataService,
protected translate: TranslateService,
protected notificationService: NotificationService,
protected auditDialogService: AuditDialogService,
protected confirmationDialogService: ConfirmationDialogService,
protected init: InitCommonsService,
private paymentReservationService: PaymentReservationService
) {
super(vcRef, activatedRoute, router, dynaDataService, translate, notificationService, auditDialogService, confirmationDialogService, init);
}
ngOnInit(): void {
super.ngOnInit();
}
ngAfterViewInit(): void { }
protected getFields(): FormGroup {
let form;
form = this.formBuilder.group({
tarjeta: this.createFormControl('tarjeta', (this.mode !== 'new' && this.record),
true, '', [RequiredValidator.isRequired]),
nombre: this.createFormControl('nombre', (this.mode !== 'new' && this.record),
true, '', [RequiredValidator.isRequired]),
cvv: this.createFormControl('cvv', (this.mode !== 'new' && this.record),
true, '', [RequiredValidator.isRequired]),
fecha: this.createFormControl('fecha', (this.mode !== 'new' && this.record),
true, '', [RequiredValidator.isRequired])
});
return form;
}
private createFormControl(name: string, existRecord?: boolean, required?: boolean, defaultValue?: string,
validators?: Array<ValidationErrors>, asyncValidators?: Array<AsyncValidatorFn>): FormControl {
if (!defaultValue) {
defaultValue = '';
}
let validatorList = [];
if (validators) {
validatorList = validators;
}
if (required) {
validatorList.push(Validators.required);
}
if (name === 'code') return new FormControl({ value: existRecord ? this.record[name] : '', disabled: this.mode !== 'new' }, validatorList, asyncValidators);
return new FormControl({ value: existRecord ? this.record[name] : '', disabled: this.mode === 'view' }, validatorList, asyncValidators);
}
submit(): void {
this.addPayment();
}
addPayment() {
let query = {
paymentAmount: 899,
status: "pagado"
};
this.paymentReservationService.addPayment(query).subscribe(
res => {
this.idPayment = res.id;
this.addPaymentToReservation(res.id);
console.log(res.id);
}
)
}
addPaymentToReservation(idPayment: number) {
let query = {
id: idPayment
}
this.paymentReservationService.addPaymentToReservation(this.id, query).subscribe(
res => {
this.updateStatusReservation();
}
)
}
updateStatusReservation() {
let query = {
id: this.record.id,
codeAgent: this.record.codeAgent,
codePassenger: this.record.codePassenger,
status: "pagado",
dateReservation: this.record.dateReservation
}
this.dynaDataService.update(this.id, query).subscribe(
res => {
this.notificationService.showMessage(
this.translate.instant('message.create.succesful'),
this.translate.instant('title.information'),
NotificationType.success
);
this.form.markAsPristine();
this.router.navigate([this.returnUrl]);
}
)
}
}
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule, Routes } from '@angular/router';
import { CrudDetailComponent, CrudGridComponent, DirtyGuard, RecordResolver, TemplateResolver } from '@xdf/gallery';
import { AuthGuard, ResourceAuthGuard } from '@xdf/security';
import { PaymentReservationFormComponent } from './components/payment-reservation-form/payment-reservation-form.component';
const routes: Routes = [
{
path: "payment-reservation", component: CrudGridComponent, canActivate: [AuthGuard, ResourceAuthGuard],
resolve: {Template: TemplateResolver},
data: {
innerTemplate: 'none',
program: "payment-reservation",
breadcrumb: "breadcrumb.payment"
},
},
{
path: 'payment-reservation/detail/:mode', component: PaymentReservationFormComponent, canActivate: [AuthGuard, ResourceAuthGuard],
resolve: {record: RecordResolver},
data: {
program: 'payment-reservation',
breadcrumb: 'breadcrumb.flight.detail'
}
}
]
@NgModule({
imports: [
RouterModule.forChild(routes)
],
exports: [RouterModule]
})
export class PaymentReservationRoutingModule { }
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { PaymentReservationFormComponent } from './components/payment-reservation-form/payment-reservation-form.component';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { TranslateModule } from '@ngx-translate/core';
import { XdfGalleryModule } from '@xdf/gallery';
import { XdfSettingsModule } from '@xdf/settings';
import { MatAutocompleteModule, MatButtonModule, MatCardModule, MatCheckboxModule, MatChipsModule, MatDatepickerModule, MatDialogModule, MatExpansionModule, MatFormFieldModule, MatGridListModule, MatIconModule, MatInputModule, MatListModule, MatMenuModule, MatPaginatorModule, MatProgressSpinnerModule, MatRadioModule, MatSelectModule, MatSortModule, MatStepperModule, MatTableModule, MatTabsModule, MatTooltipModule } from '@angular/material';
import { NgScrollbarModule } from 'ngx-scrollbar';
import { XdfLayoutsModule } from '@xdf/layouts';
import { ScrollingModule } from '@angular/cdk/scrolling';
import { NgbModule, NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap';
import { PaymentReservationRoutingModule } from './payment-reservation-routing.module';
import { DatePickerPayComponent } from './components/date-picker-pay/date-picker-pay.component';
@NgModule({
declarations: [PaymentReservationFormComponent, DatePickerPayComponent],
imports: [
CommonModule,
FormsModule,
ReactiveFormsModule,
TranslateModule,
XdfGalleryModule,
XdfSettingsModule,
MatTableModule,
MatSortModule,
MatIconModule,
MatPaginatorModule,
MatTooltipModule,
MatInputModule,
MatFormFieldModule,
MatDialogModule,
NgScrollbarModule,
XdfLayoutsModule,
MatMenuModule,
MatStepperModule,
ScrollingModule,
NgbPopoverModule,
MatChipsModule,
MatExpansionModule,
MatListModule,
MatAutocompleteModule,
NgbModule,
MatGridListModule,
MatPaginatorModule,
MatCheckboxModule,
MatSelectModule,
MatCardModule,
MatProgressSpinnerModule,
MatDialogModule,
MatButtonModule,
MatRadioModule,
MatTooltipModule,
MatTabsModule,
MatDatepickerModule,
PaymentReservationRoutingModule
]
})
export class PaymentReservationModule { }
import { TestBed } from '@angular/core/testing';
import { PaymentReservationService } from './payment-reservation.service';
describe('PaymentReservationService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: PaymentReservationService = TestBed.get(PaymentReservationService);
expect(service).toBeTruthy();
});
});
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class PaymentReservationService {
private urlPayment: string = "http://localhost:9077/AVB/service/payment";
private urlItinerary: string = "http://localhost:9077/AVB/service/itinerarys";
constructor(private httpClient: HttpClient) { }
addPayment(query: any): Observable<any> {
return this.httpClient.post<any>(this.urlPayment + "/", query);
}
addPaymentToReservation(id: number, query: any): Observable<Object> {
return this.httpClient.post(`${this.urlPayment + "/reservations"}/${id}/payments`, query);
}
updateStatusReservation(id: number, query: any): Observable<Object> {
return this.httpClient.put(`${this.urlItinerary + "/update"}/${id}`, query);
}
}
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { CrudGridComponent, TemplateResolver } from '@xdf/gallery';
import { AuthGuard, ResourceAuthGuard } from '@xdf/security';
const routes: Routes = [
{
path: "payment", component: CrudGridComponent, canActivate: [AuthGuard, ResourceAuthGuard],
resolve: {Template: TemplateResolver},
data: {
innerTemplate: 'none',
program: "payment",
breadcrumb: "breadcrumb.payment"
},
}
]
@NgModule({
imports: [
RouterModule.forChild(routes)
],
exports: [RouterModule]
})
export class PaymentRoutingModule { }
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { TranslateModule } from '@ngx-translate/core';
import { XdfGalleryModule } from '@xdf/gallery';
import { XdfSettingsModule } from '@xdf/settings';
import { PaymentRoutingModule } from './payment-routing.module';
@NgModule({
declarations: [],
imports: [
CommonModule,
FormsModule,
ReactiveFormsModule,
TranslateModule,
XdfGalleryModule,
XdfSettingsModule,
PaymentRoutingModule
]
})
export class PaymentModule { }
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AuthGuard } from '@xdf/security';
import { TemplateResolver, DirtyGuard, CrudGridComponent, RecordResolver } from '@xdf/gallery';
import { ResourceAuthGuard } from '@xdf/security';
const routes: Routes = [
{
path: '', component: CrudGridComponent, canActivate: [AuthGuard, ResourceAuthGuard],
resolve: { template: TemplateResolver },
data: {
innerTemplate: 'none',
program: 'prueba',
breadcrumb: 'breadcrumb.prueba'
}
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class PruebaRoutingModule { }
<div class="popup-general">
<div class="row">
<div class="col-lg-12">
<div class="dialog-title">
<img src="{{ logoSrc }}" with="25" height="25">
<span class="header-popup-text">Seleccionar un vuelo</span>
<div class="pull-right">
<button type="button" class="close" (click)="close()"></button>
</div>
</div>
</div>
</div>
<div>
<div class="mat-elevation-z8" style="margin: 15px 0px 15px;">
<table class="table table-striped table-hover" mat-table [dataSource]="dataSource" matSort>
<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>
<ng-container matColumnDef="agent">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Costo </th>
<td mat-cell *matCellDef="let row"> {{row.flightCost}} </td>
</ng-container>
<ng-container matColumnDef="passenger">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Código Aerolínea </th>
<td mat-cell *matCellDef="let row"> {{row.airlineCode}} </td>
</ng-container>
<ng-container matColumnDef="amount">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Codigo Aeronave </th>
<td mat-cell *matCellDef="let row"> {{row.codeTypeAircraft}} </td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;" (click)="details(row)"></tr>
</table>
<mat-paginator [pageSizeOptions]="[5, 10, 25, 100]" aria-label="Select page of users"></mat-paginator>
</div>
</div>
<div class="dialog-footer">
<div>
<button type="button" class="btn btn-primary pull-right" (click)="save()" *ngIf="mode !== 'view'"
[disabled]="record ? ((form?.invalid && form?.touched) || processing) : (form?.invalid || processing)">
<span><i class="fa fa-floppy-o"></i>&nbsp;{{ 'btn.save' | translate }}</span>
</button>
&nbsp;
<button class="btn btn-default pull-left" (click)="close()">
<span>{{ 'btn.cancel' | translate }}</span>
</button>
</div>
</div>
</div>
\ No newline at end of file
.active {
background-color: #f3f3f4;
}
$fontcolor: #676a6c;
.content {
width: 100%;
display: flex;
padding-right: 0px !important;
.grid-container {
overflow: auto;
}
.filter-panel {
.crud-table {
margin-bottom: 0px;
width: 100%;
}
}
.filter-panel {
margin-bottom: 10px;
}
.toolbar-option {
margin-left: 10px;
margin-right: -10px;
}
}
.grid-ibox-content {
width: 100%;
}
.grid-ibox-content-options {
width: calc(100% - 35px);
}
.btn-actions {
.btn {
font-size: 10px;
white-space: nowrap;
}
}
.spinner-container {
height: 100%;
width: 100%;
padding-top: 50px;
// position: fixed;
}
.spinner-container mat-spinner {
margin: -10px auto 0 auto;
}
th.mat-column-actions {
width: 1px !important;
padding-right: 0px !important;
}
td.mat-column-actions {
padding-right: 20px !important;
cursor: default !important;
}
.popover-btn {
width: auto;
margin-left: auto;
margin-right: auto;
display: flex;
padding: 2px 10px 2px 10px;
}
td {
vertical-align: middle !important;
color: $fontcolor;
font-size: 12px;
overflow: hidden;
width: auto;
text-overflow: ellipsis;
white-space: nowrap;
}
th {
vertical-align: middle !important;
}
tr.mat-header-row {
height: 50px !important;
}
tr.mat-footer-row,
tr.mat-row:not(.inner-detail-row) {
height: 40px;
}
.table-toolbar {
right: 10px;
top: 10px;
button {
font-size: 12px;
}
}
.status-button-bar {
button {
font-size: 16px;
}
padding-top: 8px;
padding-left: 15px;
}
.mat-raised-button {
padding: 0px 10px;
}
.icon-centered-button span.mat-button-wrapper {
display: flex;
}
.icon-centered-button mat-icon {
font-size: 15px;
padding-top: 2px;
}
.mat-sort-header-arrow {
visibility: hidden;
}
.mat-sort-header-button {
.mat-icon {
padding-left: 10px;
font-size: 12px;
padding-top: 5px;
}
}
@media (min-width: 576px) {
.d-sm-block {
display: table-cell !important;
}
}
@media (max-width: 576px) {
.mat-paginator-page-size-label {
display: none !important;
}
}
tr.inner-detail-row {
height: 0;
.mat-column-expandedDetail {
padding: 0 10px;
}
}
.inner-element-detail {
overflow: hidden;
display: flex;
}
//@extend
tr.inner-detail-row {
td {
border-bottom: 1px solid #dee2e6;
border-top: 0px;
}
}
tr.inner-element-row.odd,
tr.inner-detail-row.odd {
background-color: rgba(0, 0, 0, 0.05);
}
tr.mat-row-auth:not(.inner-expanded-row):hover {
background-color: #f8f9fa;
cursor: pointer !important;
}
tr.mat-row-auth.inner-expanded-row:hover {
cursor: pointer !important;
}
.mat-row:hover {
cursor: pointer;
background-color: #f8f9fa;
}
tr.inner-element-row.odd:hover,
tr.inner-detail-row.odd:hover {
cursor: pointer;
background-color: #f8f9fa;
}
tr.inner-element-row-expanded td {
border-top: 0px;
border-bottom: 0px;
}
.additional-options-section {
padding: 0;
width: 100%;
display: inline-grid;
button {
margin: 1px 0;
color: inherit;
font-size: inherit;
border-radius: 0px;
padding: 0 16px;
}
}
:host::ng-deep .mat-menu-item {
padding: 0 10px;
}
@media (min-width: 992px) {
.d-t-lg-block {
display: table-cell !important;
}
}
.grid {
padding: 10px 20px 20px;
}
.icon {
line-height: 0;
}
.content-vertical-bar {
button {
margin-left: 10px;
width: 35px;
height: 35px;
margin-bottom: 5px;
display: block;
.mat-button-wrapper {
padding: 0px !important;
}
i {
margin-top: -6px;
font-size: 14px;
color: $fontcolor;
}
i:hover {
color: #1c84c6;
}
}
}
.grid-columns-section {
padding: 10px 0 0 0;
width: 100%;
display: inline-grid;
color: inherit;
font-size: inherit;
button {
margin: 5px 0 0;
border-radius: 0px;
}
.mat-checkbox {
padding: 0 10px 2px 15px;
}
}
.partyType-radio-button {
margin-top: 20px;
margin-left: 20px;
}
.new {
:hover {
color: #2186c6;
}
}
.btn-new {
color: #676a6c;
}
.text-overflow {
max-width: 400px;
font-size: 12px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
@media (max-width: 1500px) {
.text-overflow {
max-width: 350px;
font-size: 12px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
}
@media (max-width: 1000px) {
.text-overflow {
max-width: 70px;
font-size: 12px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
}
\ No newline at end of file
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ReservationFlightDialogComponent } from './reservation-flight-dialog.component';
describe('ReservationFlightDialogComponent', () => {
let component: ReservationFlightDialogComponent;
let fixture: ComponentFixture<ReservationFlightDialogComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ReservationFlightDialogComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ReservationFlightDialogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, HostListener, Inject, OnInit, ViewChild } from '@angular/core';
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
import { MAT_DIALOG_DATA, MatDialogRef, MatPaginator, MatSort, MatTableDataSource } from '@angular/material';
import { ColumnTemplate } from '@xdf/gallery';
import { ReservationsService } from '../../services/reservations.service';
import { NotificationService } from '@xdf/commons';
import { TranslateService } from '@ngx-translate/core';
@Component({
selector: 'byte-reservation-flight-dialog',
templateUrl: './reservation-flight-dialog.component.html',
styleUrls: ['./reservation-flight-dialog.component.scss']
})
export class ReservationFlightDialogComponent implements OnInit {
columnTemplateArray: ColumnTemplate[] = [
{
name: 'arrivalDate',
sortable: false,
title: 'tax.rate.header.effectiveDate',
visible: true,
filtable: true,
style: { width: '30%' },
type: 'date',
aliasName: null,
queryName: null,
responsive: null,
styles: null,
values: null,
digitsInfo: null,
dateFormat: null,
colStyle: null
},
{
name: 'departureDate',
sortable: false,
title: 'tax.rate.header.effectiveDate',
visible: true,
filtable: true,
style: { width: '30%' },
type: 'date',
aliasName: null,
queryName: null,
responsive: null,
styles: null,
values: null,
digitsInfo: null,
dateFormat: null,
colStyle: null
},
{
name: 'rate',
sortable: false,
title: 'tax.rate.header.rate',
visible: true,
filtable: true,
style: { width: '30%' },
type: 'number',
aliasName: null,
queryName: null,
responsive: null,
styles: null,
values: null,
digitsInfo: null,
dateFormat: null,
colStyle: null
}
];
decimalParameter = 2;
@ViewChild('paginator', { static: true }) paginator: MatPaginator;
@ViewChild(MatSort, { static: false }) sort: MatSort | undefined;
sortDirection = 'desc';
sortColumn = 'arrivalDate';
legs: any;
form: FormGroup;
logoSrc: any;
minDate: Date;
record: any;
mode: any;
title = "dialog_rate_new_title"
airports: any[] = [];
displayedColumns: string[] = ['id', 'agent', 'passenger', 'amount'];
dataSource!: MatTableDataSource<any>;
constructor(
public dialogRef: MatDialogRef<ReservationFlightDialogComponent>,
private formBuilder: FormBuilder,
private NotificationService: NotificationService,
private translate: TranslateService,
private reservationsService: ReservationsService,
@Inject(MAT_DIALOG_DATA) public data: any
) {
this.record = data.record;
this.mode = data.mode;
this.minDate = data.minDate;
}
ngOnInit() {
this.getReservations();
this.logoSrc = "assets/images/logo_byte_menu-min.png";
this.form = this.formBuilder.group({
flightId: new FormControl({ disabled: this.mode === 'view' })
});
if (this.record) {
this.form.controls['flightId'].setValue(this.record.flightId);
} else {
this.form.controls['codeAirportOrigin'].setValue('');
this.form.controls['codeAirportDestination'].setValue('');
}
}
@HostListener('window:keyup.esc') onKeyUp() {
this.dialogRef.close(null);
}
close() {
this.dialogRef.close(null);
}
save() {
this.dialogRef.close(this.legs)
}
public getReservations() {
this.reservationsService.getFlights().subscribe(
res => {
this.dataSource = new MatTableDataSource(res);
this.dataSource.paginator = this.paginator;
this.dataSource.sort = this.sort;
}
)
}
details(id: any) {
this.legs = id;
}
}
import { TestBed } from '@angular/core/testing';
import { ReservationFlightDialogService } from './reservation-flight-dialog.service';
describe('ReservationFlightDialogService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: ReservationFlightDialogService = TestBed.get(ReservationFlightDialogService);
expect(service).toBeTruthy();
});
});
import { Injectable } from '@angular/core';
import { MatDialog, MatDialogRef } from '@angular/material';
import { ReservationFlightDialogComponent } from '../reservation-flight-dialog.component';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
})
export class ReservationFlightDialogService {
componentRef: MatDialogRef<ReservationFlightDialogComponent>;
constructor(
public dialog: MatDialog
) { }
loadComponent(record: any, mode: string, minDate: any): Observable<boolean> {
this.componentRef = this.dialog.open(ReservationFlightDialogComponent, {
panelClass: 'custom-dialog',
width: '1200px',
disableClose: true,
data: {
record,
mode,
minDate
}
});
return this.componentRef.afterClosed().pipe(map(it => {
return it;
}));
}
}
<div style="display: flex;">
<div class="grid-ibox-content-options">
<div class="grid-container mat-elevation-z8">
<table class="table table-striped table-hover" mat-table [dataSource]="dataSource" matSort>
<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>
<ng-container matColumnDef="agent">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Fecha Llegada </th>
<td mat-cell *matCellDef="let row"> {{row.departureDate}} </td>
</ng-container>
<ng-container matColumnDef="passenger">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Fecha Salida </th>
<td mat-cell *matCellDef="let row"> {{row.arrivalDate}}</td>
</ng-container>
<ng-container matColumnDef="amount">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Monto a pagar </th>
<td mat-cell *matCellDef="let row"> </td>
</ng-container>
<ng-container matColumnDef="actions">
<th mat-header-cell *matHeaderCellDef></th>
<td mat-cell *matCellDef="let item; let i = dataIndex" class="text-center" style="width: 5%;">
<div class="btn-group btn-actions" *ngIf="mode !== 'view'">
<button type="button" class="btn btn-default btn-sm" (click)="onEdit(item)"
[disabled]="mode === 'view'">
<i class="fa fa-edit d-xl-none"></i>
<span class="d-none d-xl-block">
<i class="fa fa-edit"></i>&nbsp;{{"btn.edit" | translate }}
</span>
</button>
<button type="button" class="btn btn-default btn-sm" (click)="onDelete(item)"
[disabled]="mode === 'view'">
<i class="fa fa-trash d-xl-none"></i>
<span class="d-none d-xl-block">
<i class="fa fa-trash"></i>&nbsp;{{"btn.delete" | translate}}
</span>
</button>
</div>
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
</table>
<mat-paginator #paginator showFirstLastButtons [pageSizeOptions]="[5, 10, 15]">
</mat-paginator>
</div>
</div>
<div class="content-vertical-bar">
<button type="button" mat-mini-fab color="default" *ngIf="mode !== 'view'" (click)="onCreate()"
matTooltip="{{ 'btn.new' | translate }}">
<i class="fa fa-file-o"></i>
</button>
</div>
</div>
\ No newline at end of file
.active {
background-color: #f3f3f4;
}
$fontcolor: #676a6c;
.content {
width: 100%;
display: flex;
padding-right: 0px !important;
.grid-container {
overflow: auto;
}
.filter-panel {
.crud-table {
margin-bottom: 0px;
width: 100%;
}
}
.filter-panel {
margin-bottom: 10px;
}
.toolbar-option {
margin-left: 10px;
margin-right: -10px;
}
}
.grid-ibox-content {
width: 100%;
}
.grid-ibox-content-options {
width: calc(100% - 35px);
}
.btn-actions {
.btn {
font-size: 10px;
white-space: nowrap;
}
}
.spinner-container {
height: 100%;
width: 100%;
padding-top: 50px;
// position: fixed;
}
.spinner-container mat-spinner {
margin: -10px auto 0 auto;
}
th.mat-column-actions {
width: 1px !important;
padding-right: 0px !important;
}
td.mat-column-actions {
padding-right: 20px !important;
cursor: default !important;
}
.popover-btn {
width: auto;
margin-left: auto;
margin-right: auto;
display: flex;
padding: 2px 10px 2px 10px;
}
td {
vertical-align: middle !important;
color: $fontcolor;
font-size: 12px;
overflow: hidden;
width: auto;
text-overflow: ellipsis;
white-space: nowrap;
}
th {
vertical-align: middle !important;
}
tr.mat-header-row {
height: 50px !important;
}
tr.mat-footer-row,
tr.mat-row:not(.inner-detail-row) {
height: 40px;
}
.table-toolbar {
right: 10px;
top: 10px;
button {
font-size: 12px;
}
}
.status-button-bar {
button {
font-size: 16px;
}
padding-top: 8px;
padding-left: 15px;
}
.mat-raised-button {
padding: 0px 10px;
}
.icon-centered-button span.mat-button-wrapper {
display: flex;
}
.icon-centered-button mat-icon {
font-size: 15px;
padding-top: 2px;
}
.mat-sort-header-arrow {
visibility: hidden;
}
.mat-sort-header-button {
.mat-icon {
padding-left: 10px;
font-size: 12px;
padding-top: 5px;
}
}
@media (min-width: 576px) {
.d-sm-block {
display: table-cell !important;
}
}
@media (max-width: 576px) {
.mat-paginator-page-size-label {
display: none !important;
}
}
tr.inner-detail-row {
height: 0;
.mat-column-expandedDetail {
padding: 0 10px;
}
}
.inner-element-detail {
overflow: hidden;
display: flex;
}
//@extend
tr.inner-detail-row {
td {
border-bottom: 1px solid #dee2e6;
border-top: 0px;
}
}
tr.inner-element-row.odd,
tr.inner-detail-row.odd {
background-color: rgba(0, 0, 0, 0.05);
}
tr.mat-row-auth:not(.inner-expanded-row):hover {
background-color: #f8f9fa;
cursor: pointer !important;
}
tr.mat-row-auth.inner-expanded-row:hover {
cursor: pointer !important;
}
.mat-row:hover {
cursor: pointer;
background-color: #f8f9fa;
}
tr.inner-element-row.odd:hover,
tr.inner-detail-row.odd:hover {
cursor: pointer;
background-color: #f8f9fa;
}
tr.inner-element-row-expanded td {
border-top: 0px;
border-bottom: 0px;
}
.additional-options-section {
padding: 0;
width: 100%;
display: inline-grid;
button {
margin: 1px 0;
color: inherit;
font-size: inherit;
border-radius: 0px;
padding: 0 16px;
}
}
:host::ng-deep .mat-menu-item {
padding: 0 10px;
}
@media (min-width: 992px) {
.d-t-lg-block {
display: table-cell !important;
}
}
.grid {
padding: 10px 20px 20px;
}
.icon {
line-height: 0;
}
.content-vertical-bar {
button {
margin-left: 10px;
width: 35px;
height: 35px;
margin-bottom: 5px;
display: block;
.mat-button-wrapper {
padding: 0px !important;
}
i {
margin-top: -6px;
font-size: 14px;
color: $fontcolor;
}
i:hover {
color: #1c84c6;
}
}
}
.grid-columns-section {
padding: 10px 0 0 0;
width: 100%;
display: inline-grid;
color: inherit;
font-size: inherit;
button {
margin: 5px 0 0;
border-radius: 0px;
}
.mat-checkbox {
padding: 0 10px 2px 15px;
}
}
.partyType-radio-button {
margin-top: 20px;
margin-left: 20px;
}
.new {
:hover {
color: #2186c6;
}
}
.btn-new {
color: #676a6c;
}
.text-overflow {
max-width: 400px;
font-size: 12px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
@media (max-width: 1500px) {
.text-overflow {
max-width: 350px;
font-size: 12px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
}
@media (max-width: 1000px) {
.text-overflow {
max-width: 70px;
font-size: 12px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
}
\ No newline at end of file
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ReservationFlightGridComponent } from './reservation-flight-grid.component';
describe('ReservationFlightGridComponent', () => {
let component: ReservationFlightGridComponent;
let fixture: ComponentFixture<ReservationFlightGridComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ReservationFlightGridComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ReservationFlightGridComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { AfterViewInit, Component, Input, OnInit, ViewChild } from '@angular/core';
import { MatPaginator, MatSort, MatTableDataSource } from '@angular/material';
import { ReservationFlightDialogService } from '../reservation-flight-dialog/services/reservation-flight-dialog.service';
import { DecimalPipe } from '@angular/common';
import { ReservationsService } from '../../services/reservations.service';
import * as moment from 'moment';
@Component({
selector: 'byte-reservation-flight-grid',
templateUrl: './reservation-flight-grid.component.html',
styleUrls: ['./reservation-flight-grid.component.scss']
})
export class ReservationFlightGridComponent implements OnInit, AfterViewInit {
@Input() mode;
decimalParameter = 2;
@ViewChild('paginator', { static: true }) paginator: MatPaginator;
@ViewChild(MatSort, { static: false }) sort: MatSort | undefined;
sortDirection = 'desc';
sortColumn = 'arrivalDate';
displayedColumns: string[] = ['id', 'agent', 'passenger', 'actions'];
dataSource!: MatTableDataSource<any>;
constructor(
private reservationFlightDialogService: ReservationFlightDialogService,
private decimalPipe: DecimalPipe,
private reservationService: ReservationsService
) {
}
ngAfterViewInit(): void {
this.paginator.pageSize = 5
this.dataSource.paginator = this.paginator
this.sort.sortChange.subscribe(() => {
console.log()
})
}
autoSort(data) {
return data.sort((a, b) => new Date(a.arrivalDate) < new Date(b.arrivalDate) ? 1 : -1)
}
numberWithCommas(x): string {
return x ? this.decimalPipe.transform(x, '1.' + this.decimalParameter + '-' + this.decimalParameter) : '';
}
getDateFormat(liquidationDate) {
return moment(liquidationDate).format('DD-MM-YYYY');
}
ngOnInit(): void {
this.dataSource = new MatTableDataSource<any>();
}
onEdit(item) {
this.reservationFlightDialogService.loadComponent(item, this.mode, this.getMaxDate()).subscribe(
data => {
if (data !== null) {
let dataSource = [...this.dataSource.data];
let pos = dataSource.findIndex(x => x === item)
dataSource[pos] = data;
this.dataSource.data = this.autoSort(dataSource);;
}
}
)
}
onDelete(item) {
let dataSource = [...this.dataSource.data];
let pos = dataSource.findIndex(x => x === item)
dataSource.splice(pos, 1)
this.dataSource.data = this.autoSort(dataSource);;
}
getMaxDate() {
let maxDate
if (this.dataSource.data.length > 0) {
maxDate = new Date(Math.max.apply(null, this.dataSource.data.map(x => new Date(x.arrivalDate))));
maxDate.setDate(maxDate.getDate() + 1);
} else {
maxDate = new Date();
}
return maxDate;
}
onCreate() {
this.reservationFlightDialogService.loadComponent(null, this.mode, this.getMaxDate()).subscribe(
data => {
if (data !== null) {
this.dataSource = new MatTableDataSource(data['legs']);
}
}
)
}
listLegsByFlight(id: number) {
this.reservationService.getLegsByFlightId(id).subscribe(
res => {
}
)
}
}
<form [formGroup]="form" name="form" autocomplete="off" novalidate (ngSubmit)="submit()" class="form-content">
<div class="mail-box-header detail-header" [ngClass]="{'title-border-bottom': mode !='new'}">
<xdf-form-header [icon]="icon" [title]="'tax.title'" [recordIdentifier]="record?.id"
titleDesc="Gestionar Reserva" [mode]="mode" [resourceAuth]="resourceAuth"
(optionEvent)="optionEvent($event)" [editing]="mode === 'edit'" [displaying]="mode === 'view'">
</xdf-form-header>
</div>
<div class="mail-box-content">
<div class="header-content">
<div class="col-12">
<div class="form-content">
<div class="legend">
<span class="group-title">Reserva</span>
</div>
<div class="group-content">
<div class="row" style="margin-bottom: 15px;">
<div class="col-6 col-md-6">
<mat-form-field style="width: 100%;">
<mat-label>Estado</mat-label>
<mat-select formControlName="status">
<mat-option *ngFor="let airport of airports" [value]="airport.value">
{{airport.viewValue}}
</mat-option>
</mat-select>
</mat-form-field>
</div>
</div>
</div>
<div class="hr-line-dashed" style="margin-bottom: 20px"></div>
<div class="legend">
<span class="group-title">Detalles Reserva</span>
</div>
<div class="group-content">
<byte-reservation-passenger-grid #reservationPassengerGrid [mode]="mode"></byte-reservation-passenger-grid>
</div>
<div class="group-content">
<byte-reservation-flight-grid #reservationFlightGrid [mode]="mode"></byte-reservation-flight-grid>
</div>
</div>
</div>
</div>
<div class="footer-content">
<div class="col-lg-12" *ngIf="mode !== 'view'">
<div class="form-status-bar border-top">
<button mat-stroked-button class="btn btn-primary pull-right" style="margin-top: 10px;">
<i class="fa fa-save" aria-hidden="true" style="padding-right: 3px; padding-bottom: 3px;">
</i>{{'btn.save' | translate }}
</button>
</div>
</div>
</div>
</div>
</form>
\ No newline at end of file
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ReservationFormComponent } from './reservation-form.component';
describe('ReservationFormComponent', () => {
let component: ReservationFormComponent;
let fixture: ComponentFixture<ReservationFormComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ReservationFormComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ReservationFormComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { AfterViewInit, ChangeDetectorRef, Component, OnInit, ViewChild, ViewContainerRef } from '@angular/core';
import { AsyncValidatorFn, FormBuilder, FormControl, FormGroup, ValidationErrors, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { InitCommonsService, NotificationService, NotificationType } from '@xdf/commons';
import { AuditDialogService, ConfirmationDialogService, DynaDataService, IFormView } from '@xdf/gallery';
import { ReservationsService } from '../../services/reservations.service';
import { ReservationPassengerGridComponent } from '../reservation-passenger-grid/reservation-passenger-grid.component';
import { ReservationFlightGridComponent } from '../reservation-flight-grid/reservation-flight-grid.component';
@Component({
selector: 'byte-reservation-form',
templateUrl: './reservation-form.component.html',
styleUrls: ['./reservation-form.component.scss']
})
export class ReservationFormComponent extends IFormView implements OnInit, AfterViewInit {
airports: any[] = [
{ value: 'pendiente', viewValue: 'Pendiente' },
{ value: 'cancelado', viewValue: 'Cancelado' }
];
form: FormGroup;
private reservationPassengerGrid: ReservationPassengerGridComponent;
@ViewChild('reservationPassengerGrid', { static: false })
set content(
content: ReservationPassengerGridComponent
) {
if (content) {
this.reservationPassengerGrid = content;
} else {
this.reservationPassengerGrid= undefined;
}
}
private reservationFlightGrid: ReservationFlightGridComponent;
@ViewChild('reservationFlightGrid', { static: false })
set content2(
content2: ReservationFlightGridComponent
) {
if (content2) {
this.reservationFlightGrid= content2;
} else {
this.reservationFlightGrid = undefined;
}
}
constructor(
protected formBuilder: FormBuilder,
protected vcRef: ViewContainerRef,
protected activatedRoute: ActivatedRoute,
protected router: Router,
protected dynaDataService: DynaDataService,
protected translate: TranslateService,
protected notificationService: NotificationService,
protected auditDialogService: AuditDialogService,
protected confirmationDialogService: ConfirmationDialogService,
protected init: InitCommonsService,
private changeDetector: ChangeDetectorRef,
private reservationsService: ReservationsService
) {
super(vcRef, activatedRoute, router, dynaDataService, translate, notificationService, auditDialogService, confirmationDialogService, init);
}
ngAfterViewInit(): void {
if (this.mode !== 'new' && this.record) {
this.reservationFlightGrid.dataSource.data = this.record.legs;
this.getPassenger(this.record.codePassenger);
}
this.changeDetector.detectChanges();
this.form.controls['status'].setValue('pendiente');
}
ngOnInit(): void {
super.ngOnInit();
}
protected getFields(): FormGroup {
let form
form = this.formBuilder.group({
dateReservation: this.createFormControl('dateReservation', (this.mode !== 'new' && this.record),
true, ''),
status: this.createFormControl('status', (this.mode !== 'new' && this.record), true)
});
return form;
}
private createFormControl(name: string, existRecord?: boolean, required?: boolean, defaultValue?: string,
validators?: Array<ValidationErrors>, asyncValidators?: Array<AsyncValidatorFn>): FormControl {
if (!defaultValue) {
defaultValue = '';
}
let validatorList = [];
if (validators) {
validatorList = validators;
}
if (required) {
validatorList.push(Validators.required);
}
if (name === 'code') return new FormControl({ value: existRecord ? this.record[name] : '', disabled: this.mode !== 'new' }, validatorList, asyncValidators);
return new FormControl({ value: existRecord ? this.record[name] : '', disabled: this.mode === 'view' }, validatorList, asyncValidators);
}
submit() {
if (this.mode == 'new') {
let result = {
id: this.mode != 'new' ? this.record.id : 0,
codeAgent: 1,
codePassenger: this.reservationPassengerGrid.dataSource.data[0].id,
dateReservation: "2023-05-04T04:51:27.630Z",
status: "pendiente",
flightCost: 0
}
this.reservationsService.addItinerary(result).subscribe(
(res) => {
this.notificationService.showMessage(
this.translate.instant('message.create.succesful'),
this.translate.instant('title.information'),
NotificationType.success
);
this.record = new Object();
this.form.markAsPristine();
this.router.navigate([this.returnUrl]);
this.processing = false;
for (let i = 0; i < this.reservationFlightGrid.dataSource.data.length; i++) {
this.addLegToReservation(res['id'], this.reservationFlightGrid.dataSource.data[i].id);
}
},
(error) => {
this.processing = false;
}
);
} else if (this.mode === 'edit') {
let result = {
id: this.record.id,
codeAgent: this.record.codeAgent,
codePassanger: this.record.codePassenger,
status: this.form.value['status'],
dateResrevation: this.record.dateReservation
}
this.dynaDataService.update(this.id, result).subscribe(
it => {
const title = this.translate.instant('title.information');
const message = this.translate.instant('message.update.succesful');
this.notificationService.showMessage(
message,
title,
NotificationType.success
);
this.form.markAsPristine();
this.router.navigate([this.returnUrl]);
this.processing = false;
},
error => {
this.processing = false;
}
);
}
}
public getLegsFlight(id: number) {
this.reservationsService.getLegsByFlightId(id).subscribe(
res => {
this.reservationPassengerGrid.dataSource.data = res;
}
)
}
getPassenger(id: number) {
this.reservationsService.getPassenger(id).subscribe(
res => {
console.log(res);
let datase = [];
datase.push(res)
console.log(datase);
this.reservationPassengerGrid.dataSource.data = datase;
}
)
}
addLegToReservation(idReservation: number, id: number) {
this.reservationsService.addLegToReservation(idReservation, id).subscribe(
res => {
console.log(res);
}
)
}
}
<div class="popup-general">
<div class="row">
<div class="col-lg-12">
<div class="dialog-title">
<img src="{{ logoSrc }}" with="25" height="25">
<span class="header-popup-text">Seleccionar un pasajero</span>
<div class="pull-right">
<button type="button" class="close" (click)="close()"></button>
</div>
</div>
</div>
</div>
<div>
<div class="mat-elevation-z8" style="margin: 15px 0px 15px;">
<table class="table table-striped table-hover" mat-table [dataSource]="dataSource" matSort>
<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>
<ng-container matColumnDef="agent">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Primer Nombre </th>
<td mat-cell *matCellDef="let row"> {{row.firstName}} </td>
</ng-container>
<ng-container matColumnDef="passenger">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Segundo Nombre </th>
<td mat-cell *matCellDef="let row"> {{row.secondName}} </td>
</ng-container>
<ng-container matColumnDef="amount">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Apellido </th>
<td mat-cell *matCellDef="let row"> {{row.lastName}} </td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;" (click)="details(row)"></tr>
</table>
<mat-paginator [pageSizeOptions]="[5, 10, 25, 100]" aria-label="Select page of users"></mat-paginator>
</div>
</div>
<div class="dialog-footer">
<div>
<button type="button" class="btn btn-primary pull-right" (click)="save()" *ngIf="mode !== 'view'"
[disabled]="record ? ((form?.invalid && form?.touched) || processing) : (form?.invalid || processing)">
<span><i class="fa fa-floppy-o"></i>&nbsp;{{ 'btn.save' | translate }}</span>
</button>
&nbsp;
<button class="btn btn-default pull-left" (click)="close()">
<span>{{ 'btn.cancel' | translate }}</span>
</button>
</div>
</div>
</div>
\ No newline at end of file
.active {
background-color: #f3f3f4;
}
$fontcolor: #676a6c;
.content {
width: 100%;
display: flex;
padding-right: 0px !important;
.grid-container {
overflow: auto;
}
.filter-panel {
.crud-table {
margin-bottom: 0px;
width: 100%;
}
}
.filter-panel {
margin-bottom: 10px;
}
.toolbar-option {
margin-left: 10px;
margin-right: -10px;
}
}
.grid-ibox-content {
width: 100%;
}
.grid-ibox-content-options {
width: calc(100% - 35px);
}
.btn-actions {
.btn {
font-size: 10px;
white-space: nowrap;
}
}
.spinner-container {
height: 100%;
width: 100%;
padding-top: 50px;
// position: fixed;
}
.spinner-container mat-spinner {
margin: -10px auto 0 auto;
}
th.mat-column-actions {
width: 1px !important;
padding-right: 0px !important;
}
td.mat-column-actions {
padding-right: 20px !important;
cursor: default !important;
}
.popover-btn {
width: auto;
margin-left: auto;
margin-right: auto;
display: flex;
padding: 2px 10px 2px 10px;
}
td {
vertical-align: middle !important;
color: $fontcolor;
font-size: 12px;
overflow: hidden;
width: auto;
text-overflow: ellipsis;
white-space: nowrap;
}
th {
vertical-align: middle !important;
}
tr.mat-header-row {
height: 50px !important;
}
tr.mat-footer-row,
tr.mat-row:not(.inner-detail-row) {
height: 40px;
}
.table-toolbar {
right: 10px;
top: 10px;
button {
font-size: 12px;
}
}
.status-button-bar {
button {
font-size: 16px;
}
padding-top: 8px;
padding-left: 15px;
}
.mat-raised-button {
padding: 0px 10px;
}
.icon-centered-button span.mat-button-wrapper {
display: flex;
}
.icon-centered-button mat-icon {
font-size: 15px;
padding-top: 2px;
}
.mat-sort-header-arrow {
visibility: hidden;
}
.mat-sort-header-button {
.mat-icon {
padding-left: 10px;
font-size: 12px;
padding-top: 5px;
}
}
@media (min-width: 576px) {
.d-sm-block {
display: table-cell !important;
}
}
@media (max-width: 576px) {
.mat-paginator-page-size-label {
display: none !important;
}
}
tr.inner-detail-row {
height: 0;
.mat-column-expandedDetail {
padding: 0 10px;
}
}
.inner-element-detail {
overflow: hidden;
display: flex;
}
//@extend
tr.inner-detail-row {
td {
border-bottom: 1px solid #dee2e6;
border-top: 0px;
}
}
tr.inner-element-row.odd,
tr.inner-detail-row.odd {
background-color: rgba(0, 0, 0, 0.05);
}
tr.mat-row-auth:not(.inner-expanded-row):hover {
background-color: #f8f9fa;
cursor: pointer !important;
}
tr.mat-row-auth.inner-expanded-row:hover {
cursor: pointer !important;
}
.mat-row:hover {
cursor: pointer;
background-color: #f8f9fa;
}
tr.inner-element-row.odd:hover,
tr.inner-detail-row.odd:hover {
cursor: pointer;
background-color: #f8f9fa;
}
tr.inner-element-row-expanded td {
border-top: 0px;
border-bottom: 0px;
}
.additional-options-section {
padding: 0;
width: 100%;
display: inline-grid;
button {
margin: 1px 0;
color: inherit;
font-size: inherit;
border-radius: 0px;
padding: 0 16px;
}
}
:host::ng-deep .mat-menu-item {
padding: 0 10px;
}
@media (min-width: 992px) {
.d-t-lg-block {
display: table-cell !important;
}
}
.grid {
padding: 10px 20px 20px;
}
.icon {
line-height: 0;
}
.content-vertical-bar {
button {
margin-left: 10px;
width: 35px;
height: 35px;
margin-bottom: 5px;
display: block;
.mat-button-wrapper {
padding: 0px !important;
}
i {
margin-top: -6px;
font-size: 14px;
color: $fontcolor;
}
i:hover {
color: #1c84c6;
}
}
}
.grid-columns-section {
padding: 10px 0 0 0;
width: 100%;
display: inline-grid;
color: inherit;
font-size: inherit;
button {
margin: 5px 0 0;
border-radius: 0px;
}
.mat-checkbox {
padding: 0 10px 2px 15px;
}
}
.partyType-radio-button {
margin-top: 20px;
margin-left: 20px;
}
.new {
:hover {
color: #2186c6;
}
}
.btn-new {
color: #676a6c;
}
.text-overflow {
max-width: 400px;
font-size: 12px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
@media (max-width: 1500px) {
.text-overflow {
max-width: 350px;
font-size: 12px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
}
@media (max-width: 1000px) {
.text-overflow {
max-width: 70px;
font-size: 12px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
}
\ No newline at end of file
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ReservationPassengerDialogComponent } from './reservation-passenger-dialog.component';
describe('ReservationPassengerDialogComponent', () => {
let component: ReservationPassengerDialogComponent;
let fixture: ComponentFixture<ReservationPassengerDialogComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ReservationPassengerDialogComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ReservationPassengerDialogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, HostListener, Inject, OnInit, ViewChild } from '@angular/core';
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
import { MAT_DIALOG_DATA, MatDialogRef, MatPaginator, MatSort, MatTableDataSource } from '@angular/material';
import { ColumnTemplate } from '@xdf/gallery';
import { ReservationsService } from '../../services/reservations.service';
import { NotificationService } from '@xdf/commons';
import { TranslateService } from '@ngx-translate/core';
@Component({
selector: 'byte-reservation-passenger-dialog',
templateUrl: './reservation-passenger-dialog.component.html',
styleUrls: ['./reservation-passenger-dialog.component.scss']
})
export class ReservationPassengerDialogComponent implements OnInit {
columnTemplateArray : ColumnTemplate[] = [
{
name: 'arrivalDate',
sortable: false,
title: 'tax.rate.header.effectiveDate',
visible: true,
filtable: true,
style: { width: '30%' },
type: 'date',
aliasName: null,
queryName: null,
responsive: null,
styles: null,
values: null,
digitsInfo: null,
dateFormat: null,
colStyle: null
},
{
name: 'departureDate',
sortable: false,
title: 'tax.rate.header.effectiveDate',
visible: true,
filtable: true,
style: { width: '30%' },
type: 'date',
aliasName: null,
queryName: null,
responsive: null,
styles: null,
values: null,
digitsInfo: null,
dateFormat: null,
colStyle: null
},
{
name: 'rate',
sortable: false,
title: 'tax.rate.header.rate',
visible: true,
filtable: true,
style: { width: '30%' },
type: 'number',
aliasName: null,
queryName: null,
responsive: null,
styles: null,
values: null,
digitsInfo: null,
dateFormat: null,
colStyle: null
}
];
decimalParameter = 2;
@ViewChild('paginator',{static: true}) paginator: MatPaginator;
@ViewChild(MatSort, { static: false }) sort: MatSort | undefined;
sortDirection = 'desc';
sortColumn = 'arrivalDate';
passenger: any;
form: FormGroup;
logoSrc: any;
minDate: Date;
record: any;
mode: any;
title = "dialog_rate_new_title"
airports: any[] = [];
displayedColumns: string[] = ['id', 'agent','passenger', 'amount'];
dataSource!: MatTableDataSource<any>;
constructor(
public dialogRef: MatDialogRef<ReservationPassengerDialogComponent>,
private formBuilder :FormBuilder,
private notificationService: NotificationService,
private translate: TranslateService,
private reservationsService: ReservationsService,
@Inject(MAT_DIALOG_DATA) public data: any
) {
this.record = data.record;
this.mode = data.mode;
this.minDate = data.minDate;
}
ngOnInit() {
this.getReservations();
this.logoSrc = "assets/images/logo_byte_menu-min.png";
this.form = this.formBuilder.group({
passengerId: new FormControl({ disabled: this.mode === 'view'}),
});
console.log(this.record);
if(this.record){
this.form.controls['passengerId'].setValue(this.record.passengerId);
}else{
this.form.controls['codeAirportOrigin'].setValue('');
this.form.controls['codeAirportDestination'].setValue('');
}
}
@HostListener('window:keyup.esc') onKeyUp() {
this.dialogRef.close(null);
}
close() {
this.dialogRef.close(null);
}
save(){
this.dialogRef.close(this.passenger);
}
public getReservations(){
this.reservationsService.getPassengers().subscribe(
res => {
this.dataSource = new MatTableDataSource(res);
this.dataSource.paginator = this.paginator;
this.dataSource.sort = this.sort;
}
)
}
details(id: any){
this.passenger = id;
console.log(id);
}
}
import { TestBed } from '@angular/core/testing';
import { ReservationPassengerDialogService } from './reservation-passenger-dialog.service';
describe('ReservationPassengerDialogService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: ReservationPassengerDialogService = TestBed.get(ReservationPassengerDialogService);
expect(service).toBeTruthy();
});
});
import { Injectable } from '@angular/core';
import { MatDialog, MatDialogRef } from '@angular/material';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { ReservationPassengerDialogComponent } from '../reservation-passenger-dialog.component';
@Injectable({
providedIn: 'root'
})
export class ReservationPassengerDialogService {
componentRef: MatDialogRef<ReservationPassengerDialogComponent>;
constructor(
public dialog: MatDialog
) { }
loadComponent(record: any, mode: string, minDate: any): Observable<any> {
this.componentRef = this.dialog.open(ReservationPassengerDialogComponent, {
panelClass: 'custom-dialog',
width: '1200px',
disableClose: true,
data: {
record,
mode,
minDate
}
});
return this.componentRef.afterClosed().pipe(map(it => {return it;}));
}
}
<div style="display: flex;padding-bottom: 50px;">
<div class="grid-ibox-content-options">
<div class="grid-container mat-elevation-z8">
<table class="table table-striped table-hover" mat-table [dataSource]="dataSource" matSort>
<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>
<ng-container matColumnDef="agent">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Apellido </th>
<td mat-cell *matCellDef="let row"> {{row.lastName}} </td>
</ng-container>
<ng-container matColumnDef="passenger">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Primer Nombre </th>
<td mat-cell *matCellDef="let row">{{row.firstName}}</td>
</ng-container>
<ng-container matColumnDef="monto">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Segundo Nombre </th>
<td mat-cell *matCellDef="let row"> {{row.secondName}} </td>
</ng-container>
<ng-container matColumnDef="actions">
<th mat-header-cell *matHeaderCellDef></th>
<td mat-cell *matCellDef="let item; let i = dataIndex" class="text-center" style="width: 5%;">
<div class="btn-group btn-actions" *ngIf="mode !== 'view'">
<button type="button" class="btn btn-default btn-sm" (click)="onEdit(item)"
[disabled]="mode === 'view'">
<i class="fa fa-edit d-xl-none"></i>
<span class="d-none d-xl-block">
<i class="fa fa-edit"></i>&nbsp;{{ "btn.edit" | translate }}
</span>
</button>
<button type="button" class="btn btn-default btn-sm" (click)="onDelete(item)"
[disabled]="mode === 'view'">
<i class="fa fa-trash d-xl-none"></i>
<span class="d-none d-xl-block">
<i class="fa fa-trash"></i>&nbsp;{{ "btn.delete" | translate }}
</span>
</button>
</div>
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
</table>
<mat-paginator #paginator showFirstLastButtons [pageSizeOptions]="[5, 10, 15]">
</mat-paginator>
</div>
</div>
<div class="content-vertical-bar">
<button type="button" mat-mini-fab color="default" *ngIf="mode !== 'view'" (click)="onCreate()"
matTooltip="{{ 'btn.new' | translate }}">
<i class="fa fa-file-o"></i>
</button>
</div>
</div>
\ No newline at end of file
.active {
background-color: #f3f3f4;
}
$fontcolor: #676a6c;
.content {
width: 100%;
display: flex;
padding-right: 0px !important;
.grid-container {
overflow: auto;
}
.filter-panel {
.crud-table {
margin-bottom: 0px;
width: 100%;
}
}
.filter-panel {
margin-bottom: 10px;
}
.toolbar-option {
margin-left: 10px;
margin-right: -10px;
}
}
.grid-ibox-content {
width: 100%;
}
.grid-ibox-content-options {
width: calc(100% - 35px);
}
.btn-actions {
.btn {
font-size: 10px;
white-space: nowrap;
}
}
.spinner-container {
height: 100%;
width: 100%;
padding-top: 50px;
// position: fixed;
}
.spinner-container mat-spinner {
margin: -10px auto 0 auto;
}
th.mat-column-actions {
width: 1px !important;
padding-right: 0px !important;
}
td.mat-column-actions {
padding-right: 20px !important;
cursor: default !important;
}
.popover-btn {
width: auto;
margin-left: auto;
margin-right: auto;
display: flex;
padding: 2px 10px 2px 10px;
}
td {
vertical-align: middle !important;
color: $fontcolor;
font-size: 12px;
overflow: hidden;
width: auto;
text-overflow: ellipsis;
white-space: nowrap;
}
th {
vertical-align: middle !important;
}
tr.mat-header-row {
height: 50px !important;
}
tr.mat-footer-row,
tr.mat-row:not(.inner-detail-row) {
height: 40px;
}
.table-toolbar {
right: 10px;
top: 10px;
button {
font-size: 12px;
}
}
.status-button-bar {
button {
font-size: 16px;
}
padding-top: 8px;
padding-left: 15px;
}
.mat-raised-button {
padding: 0px 10px;
}
.icon-centered-button span.mat-button-wrapper {
display: flex;
}
.icon-centered-button mat-icon {
font-size: 15px;
padding-top: 2px;
}
.mat-sort-header-arrow {
visibility: hidden;
}
.mat-sort-header-button {
.mat-icon {
padding-left: 10px;
font-size: 12px;
padding-top: 5px;
}
}
@media (min-width: 576px) {
.d-sm-block {
display: table-cell !important;
}
}
@media (max-width: 576px) {
.mat-paginator-page-size-label {
display: none !important;
}
}
tr.inner-detail-row {
height: 0;
.mat-column-expandedDetail {
padding: 0 10px;
}
}
.inner-element-detail {
overflow: hidden;
display: flex;
}
//@extend
tr.inner-detail-row {
td {
border-bottom: 1px solid #dee2e6;
border-top: 0px;
}
}
tr.inner-element-row.odd,
tr.inner-detail-row.odd {
background-color: rgba(0, 0, 0, 0.05);
}
tr.mat-row-auth:not(.inner-expanded-row):hover {
background-color: #f8f9fa;
cursor: pointer !important;
}
tr.mat-row-auth.inner-expanded-row:hover {
cursor: pointer !important;
}
.mat-row:hover {
cursor: pointer;
background-color: #f8f9fa;
}
tr.inner-element-row.odd:hover,
tr.inner-detail-row.odd:hover {
cursor: pointer;
background-color: #f8f9fa;
}
tr.inner-element-row-expanded td {
border-top: 0px;
border-bottom: 0px;
}
.additional-options-section {
padding: 0;
width: 100%;
display: inline-grid;
button {
margin: 1px 0;
color: inherit;
font-size: inherit;
border-radius: 0px;
padding: 0 16px;
}
}
:host::ng-deep .mat-menu-item {
padding: 0 10px;
}
@media (min-width: 992px) {
.d-t-lg-block {
display: table-cell !important;
}
}
.grid {
padding: 10px 20px 20px;
}
.icon {
line-height: 0;
}
.content-vertical-bar {
button {
margin-left: 10px;
width: 35px;
height: 35px;
margin-bottom: 5px;
display: block;
.mat-button-wrapper {
padding: 0px !important;
}
i {
margin-top: -6px;
font-size: 14px;
color: $fontcolor;
}
i:hover {
color: #1c84c6;
}
}
}
.grid-columns-section {
padding: 10px 0 0 0;
width: 100%;
display: inline-grid;
color: inherit;
font-size: inherit;
button {
margin: 5px 0 0;
border-radius: 0px;
}
.mat-checkbox {
padding: 0 10px 2px 15px;
}
}
.partyType-radio-button {
margin-top: 20px;
margin-left: 20px;
}
.new {
:hover {
color: #2186c6;
}
}
.btn-new {
color: #676a6c;
}
.text-overflow {
max-width: 400px;
font-size: 12px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
@media (max-width: 1500px) {
.text-overflow {
max-width: 350px;
font-size: 12px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
}
@media (max-width: 1000px) {
.text-overflow {
max-width: 70px;
font-size: 12px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
}
\ No newline at end of file
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ReservationPassengerGridComponent } from './reservation-passenger-grid.component';
describe('ReservationPassengerGridComponent', () => {
let component: ReservationPassengerGridComponent;
let fixture: ComponentFixture<ReservationPassengerGridComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ReservationPassengerGridComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ReservationPassengerGridComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { AfterViewInit, Component, Input, OnInit, ViewChild } from '@angular/core';
import { MatPaginator, MatSort, MatTableDataSource } from '@angular/material';
import { ReservationPassengerDialogService } from '../reservation-passenger-dialog/services/reservation-passenger-dialog.service';
import { DecimalPipe } from '@angular/common';
import * as moment from 'moment';
@Component({
selector: 'byte-reservation-passenger-grid',
templateUrl: './reservation-passenger-grid.component.html',
styleUrls: ['./reservation-passenger-grid.component.scss']
})
export class ReservationPassengerGridComponent implements OnInit, AfterViewInit {
@Input() mode;
decimalParameter = 2;
@ViewChild('paginator', { static: true }) paginator: MatPaginator;
@ViewChild(MatSort, { static: false }) sort: MatSort | undefined;
sortDirection = 'desc';
sortColumn = 'arrivalDate';
displayedColumns: string[] = ['id', 'agent', 'passenger', 'actions'];
dataSource !: MatTableDataSource<any>;
constructor(
private reservationPassengerDialogService: ReservationPassengerDialogService,
private decimalPipe: DecimalPipe,
) { }
ngAfterViewInit(): void {
this.paginator.pageSize = 5
this.dataSource.paginator = this.paginator
this.sort.sortChange.subscribe(() => {
})
}
autoSort(data) {
return data.sort((a, b) => new Date(a.arrivalDate) < new Date(b.arrivalDate) ? 1 : -1)
}
numberWithCommas(x): string {
return x ? this.decimalPipe.transform(x, '1.' + this.decimalParameter + '-' + this.decimalParameter) : '';
}
getDateFormat(liquidationDate) {
return moment(liquidationDate).format('DD-MM-YYYY');
}
ngOnInit(): void {
this.dataSource = new MatTableDataSource<any>();
}
onEdit(item) {
this.reservationPassengerDialogService.loadComponent(item, this.mode, this.getMaxDate()).subscribe(
data => {
if (data !== null) {
let dataSource = [...this.dataSource.data];
let pos = dataSource.findIndex(x => x === item)
dataSource[pos] = data;
this.dataSource.data = this.autoSort(dataSource);
}
}
)
}
onDelete(item) {
let dataSource = [...this.dataSource.data];
let pos = dataSource.findIndex(x => x === item)
dataSource.splice(pos, 1)
this.dataSource.data = this.autoSort(dataSource);
}
getMaxDate() {
let maxDate
if (this.dataSource.data.length > 0) {
maxDate = new Date(Math.max.apply(null, this.dataSource.data.map(x => new Date(x.arrivalDate))));
maxDate.setDate(maxDate.getDate() + 1);
} else {
maxDate = new Date();
}
return maxDate;
}
onCreate() {
this.reservationPassengerDialogService.loadComponent(null, this.mode, this.getMaxDate()).subscribe(
data => {
if (data !== null) {
let datase = [];
datase.push(data)
console.log(datase);
this.dataSource = new MatTableDataSource(datase);
}
}
)
}
}
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { CrudGridComponent, DirtyGuard, RecordResolver, TemplateResolver } from '@xdf/gallery';
import { AuthGuard, ResourceAuthGuard } from '@xdf/security';
import { ReservationFormComponent } from './components/reservation-form/reservation-form.component';
import { ReservationPassengerDialogService } from './components/reservation-passenger-dialog/services/reservation-passenger-dialog.service';
import { ReservationFlightDialogService } from './components/reservation-flight-dialog/services/reservation-flight-dialog.service';
const routes: Routes = [
{
path: "reservation", component: CrudGridComponent, canActivate: [AuthGuard, ResourceAuthGuard],
resolve: {Template: TemplateResolver},
data: {
innerTemplate: 'none',
program: "reservation",
breadcrumb: "breadcrumb.flight"
},
},
{
path: 'reservation/detail/:mode', component: ReservationFormComponent, canActivate: [AuthGuard, ResourceAuthGuard], canDeactivate: [DirtyGuard],
resolve: {record: RecordResolver},
data: {
program: 'reservation',
breadcrumb: 'breadcrumb.flight.detail'
}
}
]
@NgModule({
imports: [
RouterModule.forChild(routes)
],
exports: [RouterModule],
providers: [
ReservationPassengerDialogService,
ReservationFlightDialogService
]
})
export class ReservationRoutingModule { }
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { TranslateModule } from '@ngx-translate/core';
import { XdfGalleryModule } from '@xdf/gallery';
import { XdfSettingsModule } from '@xdf/settings';
import { MatAutocompleteModule, MatButtonModule, MatCardModule, MatCheckboxModule, MatChipsModule, MatDatepickerModule, MatDialogModule, MatExpansionModule, MatFormFieldModule, MatGridListModule, MatIconModule, MatInputModule, MatListModule, MatMenuModule, MatPaginatorModule, MatProgressSpinnerModule, MatRadioModule, MatSelectModule, MatSortModule, MatStepperModule, MatTableModule, MatTabsModule, MatTooltipModule } from '@angular/material';
import { NgScrollbarModule } from 'ngx-scrollbar';
import { XdfLayoutsModule } from '@xdf/layouts';
import { ScrollingModule } from '@angular/cdk/scrolling';
import { NgbModule, NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap';
import { ReservationRoutingModule } from './reservation-routing.module';
import { ReservationFormComponent } from './components/reservation-form/reservation-form.component';
import { ReservationPassengerDialogComponent } from './components/reservation-passenger-dialog/reservation-passenger-dialog.component';
import { ReservationPassengerGridComponent } from './components/reservation-passenger-grid/reservation-passenger-grid.component';
import { ReservationFlightDialogComponent } from './components/reservation-flight-dialog/reservation-flight-dialog.component';
import { ReservationFlightGridComponent } from './components/reservation-flight-grid/reservation-flight-grid.component';
import { XdfCommonsModule } from '@xdf/commons';
@NgModule({
declarations: [ReservationFormComponent, ReservationPassengerDialogComponent, ReservationPassengerGridComponent, ReservationFlightDialogComponent, ReservationFlightGridComponent],
imports: [
CommonModule,
FormsModule,
ReactiveFormsModule,
TranslateModule,
XdfGalleryModule,
XdfSettingsModule,
MatTableModule,
MatSortModule,
MatIconModule,
MatPaginatorModule,
MatTooltipModule,
MatInputModule,
MatFormFieldModule,
MatDialogModule,
XdfCommonsModule,
NgScrollbarModule,
XdfLayoutsModule,
MatMenuModule,
MatStepperModule,
ScrollingModule,
NgbPopoverModule,
MatChipsModule,
MatListModule,
MatAutocompleteModule,
MatExpansionModule,
NgbModule,
MatGridListModule,
MatCheckboxModule,
MatSelectModule,
MatCardModule,
MatProgressSpinnerModule,
MatButtonModule,
MatRadioModule,
MatTabsModule,
MatDatepickerModule,
ReservationRoutingModule
],
entryComponents: [
ReservationPassengerDialogComponent,
ReservationFlightDialogComponent
]
})
export class ReservationModule { }
import { TestBed } from '@angular/core/testing';
import { ReservationsService } from './reservations.service';
describe('ReservationsService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: ReservationsService = TestBed.get(ReservationsService);
expect(service).toBeTruthy();
});
});
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class ReservationsService {
private urlPassenger: string = "http://localhost:9077/AVB/service/passenger";
private urlFlight: string = "http://localhost:9077/AVB/service/flight";
private urlLeg: string = "http://localhost:9077/AVB/service/leg";
private urlItinerary: string = "http://localhost:9077/AVB/service/itinerarys";
constructor(private httpClient: HttpClient) { }
getPassengers(): Observable<any[]> {
return this.httpClient.get<any[]>(`${this.urlPassenger}/all`);
}
getPassenger(id: number): Observable<any> {
return this.httpClient.get<any>(`${this.urlPassenger}/${id}`);
}
getFlights(): Observable<any[]> {
return this.httpClient.get<any[]>(`${this.urlFlight}/all`);
}
getLegsByFlightId(id: number): Observable<any[]> {
return this.httpClient.get<any>(`${this.urlLeg}/list/${id}/flights`);
}
addItinerary(query: any): Observable<any> {
return this.httpClient.post<any>(this.urlItinerary + "/", query);
}
addLegToReservation(idReservation: number, idLeg: number): Observable<Object> {
return this.httpClient.post(`${this.urlLeg}/reservation/${idReservation}`, {id: idLeg});
}
}
...@@ -32,63 +32,73 @@ ...@@ -32,63 +32,73 @@
}, },
{ {
"id": 37, "id": 37,
"name": "CONVERSATIONAL_AGENT", "name": "airport",
"label": "menu.parent.agent", "label": "menu.parent.airport",
"icon": "<i class=\"fa fa-cog\"></i>", "icon": "<i class=\"fa fa-plane\"></i>",
"fullPath": "/configuration/agent", "fullPath": "/airport/airport",
"singlePath": "configuration", "singlePath": "airport",
"isProgram": true,
"children": []
},
{
"id": 38,
"name": "passenger",
"label": "menu.parent.passenger",
"icon": "<i class=\"fa fa-user-circle\"></i>",
"fullPath": "/passenger/passenger",
"singlePath": "passenger",
"isProgram": true, "isProgram": true,
"children": [] "children": []
}, },
{
"id": 38,
"name": "BBOT_DASHBOARD",
"label": "menu.parent.dashboard",
"icon": "<i class=\"fa fa-area-chart\"></i>",
"fullPath": "/dashboards",
"singlePath": "dashboards",
"isProgram": false,
"children": [
{
"id": 32,
"name": "operative_dashboard",
"label": "menu.dashboard.operative",
"icon": null,
"fullPath": "/dashboards/operative",
"singlePath": "operative",
"isProgram": true,
"children": []
},
{
"id": 32,
"name": "customer_interaction_dashboard",
"label": "menu.dashboard.customer.interaction",
"icon": null,
"fullPath": "/dashboards/customer-interaction",
"singlePath": "customer-interaction",
"isProgram": true,
"children": []
}
]
},
{ {
"id": 39, "id": 39,
"name": "Mantenimiento", "name": "booking_agent",
"label": "menu.parent.mantenimiento", "label": "menu.parent.booking_agent",
"icon": "<i class=\"fa fa-cog\"></i>", "icon": "<i class=\"fa fa-user\"></i>",
"fullPath": "/mantenimiento", "fullPath": "/agent/booking_agent",
"singlePath": "mantenimiento", "singlePath": "booking_agent",
"isProgram": true, "isProgram": true,
"children": [] "children": []
}, },
{ {
"id": 40, "id": 40,
"name": "prueba", "name": "payment",
"label": "prueba.parent.mantenimiento", "label": "menu.parent.payment",
"icon": "<i class=\"fa fa-cog\"></i>", "icon": "<i class=\"fa fa-folder\"></i>",
"fullPath": "/prueba", "fullPath": "/payment/payment",
"singlePath": "prueba", "singlePath": "payment",
"isProgram": true,
"children": []
},
{
"id": 41,
"name": "payment-reservation",
"label": "menu.parent.reservation_payment",
"icon": "<i class=\"fa fa-dollar\"></i>",
"fullPath": "/payment-reservation/payment-reservation",
"singlePath": "payment-reservation",
"isProgram": true,
"children": []
},
{
"id": 42,
"name": "flight",
"label": "menu.parent.flight",
"icon": "<i class=\"fa fa-suitcase\"></i>",
"fullPath": "/flight/flight",
"singlePath": "flight",
"isProgram": true,
"children": []
},
{
"id": 43,
"name": "reservation",
"label": "menu.parent.reservation",
"icon": "<i class=\"fa fa-book\"></i>",
"fullPath": "/reservation/reservation",
"singlePath": "reservation",
"isProgram": true, "isProgram": true,
"children": [] "children": []
} }
] ]
{
"name": "booking_agent",
"title": "Agentes",
"fieldToShowInActon": "id",
"titleDesc": "Registrar un nuevo Agente",
"icon": "<i class=\"material-icons\"> <span class=\"fa fa-user-circle fa-sm\"> </span> </i>",
"service": "./service/agent",
"recordId": "id",
"showFormIn": "standard",
"attributes": [
{
"name": "id",
"type": "number",
"formOptions": {
"options": {
"readonly": true,
"hideInNew": true
},
"validators": [
],
"controlType": "number"
}
},
{
"name": "agentName",
"type": "string",
"formOptions": {
"options": {
},
"validators": [
"required"
],
"controlType": "text"
}
},
{
"name": "agentLastname",
"type": "string",
"formOptions": {
"options": {
},
"validators": [
"required"
],
"controlType": "text"
}
},
{
"name": "dni",
"type": "string",
"formOptions": {
"options": {
},
"validators": [
"required"
],
"controlType": "text"
}
},
{
"name": "agentPhone",
"type": "string",
"formOptions": {
"options": {
},
"validators": [
"required"
],
"controlType": "text"
}
},
{
"name": "agentDetails",
"type": "string",
"formOptions": {
"options": {
"styleClass": "col-md-12"
},
"validators": [
"required"
],
"controlType": "text"
}
}
],
"groups": [
{
"name": "personal_info",
"title": "passenger_group_info",
"description": "country_group_info_description",
"controls": [
[
"agentName",
"agentLastname",
"dni",
"agentPhone"
],
[
"agentDetails"
]
]
}
],
"grid": [
{
"sortColumnDefault": "id",
"sortColumnDirection": "asc",
"pagingSize": 5,
"expandRow": false,
"columns": [
{
"name": "id",
"sortable": true,
"style": {
"width": "50px"
},
"optional": false,
"filter": true
},
{
"name": "agentLastname",
"sortable": true,
"style": {
"width": "50px"
},
"optional": false,
"filter": true
},
{
"name": "agentName",
"sortable": true,
"style": {
"width": "50px"
},
"optional": false,
"filter": true
},
{
"name": "agentPhone",
"sortable": true,
"style": {
"width": "50px"
},
"optional": false,
"filter": true
}
]
}
]
}
\ No newline at end of file
{ {
"name": "prueba", "name": "airport",
"title": "prueba_info", "title": "Aeropuerto",
"fieldToShowInActon": "id", "fieldToShowInActon": "id",
"titleDesc": "prueba_group_info", "titleDesc": "Registrar un nuevo aeropuerto",
"icon": "<i class=\"material-icons\">business_center</i>", "icon": "<i class=\"material-icons\"> <span class=\"fa fa-plane fa-sm\"> </span> </i>",
"service": "./service/settings/prueba", "service": "./service/airport",
"recordId": "id", "recordId": "id",
"showFormIn": "standard", "showFormIn": "standard",
"attributes": [ "attributes": [
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
"formOptions": { "formOptions": {
"options": { "options": {
"readonly": true, "readonly": true,
"hideInNew": false "hideInNew": true
}, },
"validators": [ "validators": [
], ],
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
} }
}, },
{ {
"name": "date", "name": "airportCode",
"type": "string", "type": "string",
"formOptions": { "formOptions": {
"options": { "options": {
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
} }
}, },
{ {
"name": "description", "name": "airportName",
"type": "string", "type": "string",
"formOptions": { "formOptions": {
"options": { "options": {
...@@ -46,11 +46,11 @@ ...@@ -46,11 +46,11 @@
} }
}, },
{ {
"name": "trigger", "name": "airportLocation",
"type": "string", "type": "string",
"formOptions": { "formOptions": {
"options": { "options": {
"styleClass": "col-xl-4" "styleClass": "col-md-6"
}, },
"validators": [ "validators": [
"required" "required"
...@@ -59,38 +59,35 @@ ...@@ -59,38 +59,35 @@
} }
}, },
{ {
"name": "event", "name": "details",
"type": "string", "type": "string",
"formOptions": { "formOptions": {
"options": { "options": {
"styleClass": "col-xl-3" "styleClass": "col-md-12"
}, },
"validators": [ "validators": [
"required"
], ],
"controlType": "text" "controlType": "text"
} }
},
{
"name": "status",
"type": "valpos",
"formOptions": {
"values": {
"G": "prueba.created",
"C": "prueba.false"
},
"options": {
"hideInNew": false,
"styleClass": "col-md-6",
"styles": {
"G": "label label-success pr-3",
"C": "label label-danger"
}
},
"controlType": "checkbox"
}
} }
], ],
"groups": [ "groups": [
{
"name": "personal_info",
"title": "airport_group_info",
"description": "country_group_info_description",
"controls": [
[
"airportCode",
"airportName",
"airportLocation"
],
[
"details"
]
]
}
], ],
"grid": [ "grid": [
{ {
...@@ -109,16 +106,16 @@ ...@@ -109,16 +106,16 @@
"filter": true "filter": true
}, },
{ {
"name": "description", "name": "airportCode",
"sortable": true, "sortable": true,
"style": { "style": {
"width": "200px" "width": "200px"
}, },
"optional": false, "optional": true,
"filter": true "filter": true
}, },
{ {
"name": "status", "name": "airportName",
"sortable": true, "sortable": true,
"style": { "style": {
"width": "50px" "width": "50px"
......
...@@ -6,5 +6,11 @@ ...@@ -6,5 +6,11 @@
{ "system_settings_userpolicy": "./assets/definitions/setting-definitions/system-settings-userpolicy.json" }, { "system_settings_userpolicy": "./assets/definitions/setting-definitions/system-settings-userpolicy.json" },
{ "application": "./assets/definitions/setting-definitions/application.json" }, { "application": "./assets/definitions/setting-definitions/application.json" },
{ "valpos": "./assets/definitions/setting-definitions/valpos.json"}, { "valpos": "./assets/definitions/setting-definitions/valpos.json"},
{ "prueba": "./assets/definitions/prueba-definition/prueba.json" } { "airport": "./assets/definitions/airport-definitions/airport.json" },
{ "passenger": "./assets/definitions/passenger-definitions/passenger.json" },
{ "agent": "./assets/definitions/agent-definitions/agent.json" },
{ "payment": "./assets/definitions/payment-definitions/payment.json" },
{ "payment_reservation": "./assets/definitions/payment-reservation-definitions/payment-reservation.json" },
{ "flight": "./assets/definitions/flight-definitions/flight.json" },
{ "reservation": "./assets/definitions/reservation-definitions/reservation.json" }
] ]
\ No newline at end of file
{
"name": "airport",
"title": "Aeropuerto",
"fieldToShowInActon": "id",
"titleDesc": "Registrar un nuevo aeropuerto",
"icon": "<i class=\"material-icons\"> <span class=\"fa fa-plane fa-sm\"> </span> </i>",
"service": "./service/airport",
"recordId": "id",
"showFormIn": "standard",
"attributes": [
{
"name": "id",
"type": "number",
"formOptions": {
"options": {
"readonly": true,
"hideInNew": true
},
"validators": [
],
"controlType": "number"
}
},
{
"name": "airportCode",
"type": "string",
"formOptions": {
"options": {
},
"validators": [
"required"
],
"controlType": "text"
}
},
{
"name": "airportName",
"type": "string",
"formOptions": {
"options": {
},
"validators": [
"required"
],
"controlType": "text"
}
},
{
"name": "airportLocation",
"type": "string",
"formOptions": {
"options": {
"styleClass": "col-md-6"
},
"validators": [
"required"
],
"controlType": "text"
}
},
{
"name": "details",
"type": "string",
"formOptions": {
"options": {
"styleClass": "col-md-12"
},
"validators": [
"required"
],
"controlType": "text"
}
}
],
"groups": [
],
"grid": [
{
"sortColumnDefault": "id",
"sortColumnDirection": "asc",
"pagingSize": 5,
"expandRow": false,
"columns": [
{
"name": "id",
"sortable": true,
"style": {
"width": "50px"
},
"optional": false,
"filter": true
},
{
"name": "airportCode",
"sortable": true,
"style": {
"width": "200px"
},
"optional": true,
"filter": true
},
{
"name": "airportName",
"sortable": true,
"style": {
"width": "50px"
},
"optional": false,
"filter": true
}
]
}
]
}
\ No newline at end of file
{
"name": "flight",
"title": "Vuelos",
"fieldToShowInActon": "id",
"titleDesc": "Registrar un nuevo vuelo",
"icon": "<i class=\"material-icons\"> <span class=\"fa fa-suitcase fa-sm\"> </span> </i>",
"service": "./service/flight",
"recordId": "id",
"showFormIn": "standard",
"attributes": [
{
"name": "id",
"type": "number",
"formOptions": {
"options": {
"readonly": true,
"hideInNew": true
},
"validators": [
],
"controlType": "number"
}
},
{
"name": "flightCost",
"type": "number",
"formOptions": {
"options": {
},
"validators": [
"required"
],
"controlType": "number"
}
},
{
"name": "airlineCode",
"type": "string",
"formOptions": {
"options": {
},
"validators": [
"required"
],
"controlType": "text"
}
},
{
"name": "codeTypeAircraft",
"type": "string",
"formOptions": {
"options": {
},
"validators": [
"required"
],
"controlType": "text"
}
},
{
"name": "departureDate",
"type": "Date",
"formOptions": {
"options": {
},
"validators": [
"required"
],
"controlType": "text"
}
},
{
"name": "arrivalDate",
"type": "Date",
"formOptions": {
"options": {
},
"validators": [
"required"
],
"controlType": "text"
}
},
{
"name": "status",
"type": "valpos",
"formOptions": {
"values": {
"pagado": "payment.status.locked"
},
"options": {
"hideInNew": false,
"styles": {
"pagado": "label label-primary"
}
}
}
}
],
"groups": [
{
"name": "personal_info",
"title": "airport_group_info",
"description": "country_group_info_description",
"controls": [
[
"airportCode",
"airportName",
"airportLocation"
],
[
"details"
]
]
}
],
"grid": [
{
"sortColumnDefault": "id",
"sortColumnDirection": "asc",
"pagingSize": 5,
"expandRow": false,
"columns": [
{
"name": "id",
"sortable": true,
"style": {
"width": "50px"
},
"optional": false,
"filter": true
},
{
"name": "airlineCode",
"sortable": true,
"style": {
"width": "200px"
},
"optional": true,
"filter": true
},
{
"name": "codeTypeAircraft",
"sortable": true,
"style": {
"width": "50px"
},
"optional": false,
"filter": true
},
{
"name": "flightCost",
"sortable": true,
"style": {
"width": "50px"
},
"optional": false,
"filter": true
}
]
}
]
}
\ No newline at end of file
{
"name": "passenger",
"title": "Pasajeros",
"fieldToShowInActon": "id",
"titleDesc": "Registrar un nuevo pasajero",
"icon": "<i class=\"material-icons\"> <span class=\"fa fa-user-circle fa-sm\"> </span> </i>",
"service": "./service/passenger",
"recordId": "id",
"showFormIn": "standard",
"attributes": [
{
"name": "id",
"type": "number",
"formOptions": {
"options": {
"readonly": true,
"hideInNew": false
},
"validators": [
],
"controlType": "number"
}
},
{
"name": "firstName",
"type": "string",
"formOptions": {
"options": {
},
"validators": [
"required"
],
"controlType": "text"
}
},
{
"name": "secondName",
"type": "string",
"formOptions": {
"options": {
},
"validators": [
"required"
],
"controlType": "text"
}
},
{
"name": "lastName",
"type": "string",
"formOptions": {
"options": {
},
"validators": [
"required"
],
"controlType": "text"
}
},
{
"name": "phoneNumber",
"type": "string",
"formOptions": {
"options": {
},
"validators": [
"required"
],
"controlType": "text"
}
},
{
"name": "email",
"type": "string",
"formOptions": {
"options": {
"styleClass": "col-md-6"
},
"validators": [
"required"
],
"controlType": "text"
}
},
{
"name": "address",
"type": "string",
"formOptions": {
"options": {
},
"validators": [
"required"
],
"controlType": "text"
}
},
{
"name": "city",
"type": "string",
"formOptions": {
"options": {
},
"validators": [
"required"
],
"controlType": "text"
}
},
{
"name": "province",
"type": "string",
"formOptions": {
"options": {
},
"validators": [
"required"
],
"controlType": "text"
}
},
{
"name": "country",
"type": "string",
"formOptions": {
"options": {
},
"validators": [
"required"
],
"controlType": "text"
}
},
{
"name": "details",
"type": "string",
"formOptions": {
"options": {
"styleClass": "col-md-12"
},
"validators": [
"required"
],
"controlType": "text"
}
}
],
"groups": [
{
"name": "personal_info",
"title": "passenger_group_info",
"description": "country_group_info_description",
"controls": [
[
"firstName",
"secondName",
"lastName",
"phoneNumber",
"email"
],
[
"address",
"city",
"province",
"country"
],
[
"details"
]
]
}
],
"grid": [
{
"sortColumnDefault": "id",
"sortColumnDirection": "asc",
"pagingSize": 5,
"expandRow": false,
"columns": [
{
"name": "id",
"sortable": true,
"style": {
"width": "50px"
},
"optional": false,
"filter": true
},
{
"name": "lastName",
"sortable": true,
"style": {
"width": "50px"
},
"optional": false,
"filter": true
},
{
"name": "firstName",
"sortable": true,
"style": {
"width": "50px"
},
"optional": false,
"filter": true
},
{
"name": "secondName",
"sortable": true,
"style": {
"width": "50px"
},
"optional": false,
"filter": true
},
{
"name": "phoneNumber",
"sortable": true,
"style": {
"width": "50px"
},
"optional": false,
"filter": true
}
]
}
]
}
\ No newline at end of file
{
"name": "payment",
"title": "Pagos",
"fieldToShowInActon": "id",
"titleDesc": "Visualizar los pagos",
"icon": "<i class=\"material-icons\"> <span class=\"fa fa-folder fa-sm\"> </span> </i>",
"service": "./service/payment",
"recordId": "id",
"showFormIn": "standard",
"attributes": [
{
"name": "id",
"type": "number",
"formOptions": {
"options": {
"readonly": true,
"hideInNew": false
},
"validators": [
],
"controlType": "number"
}
},
{
"name": "paymentDate",
"type": "string",
"formOptions": {
"options": {
},
"validators": [
"required"
],
"controlType": "text"
}
},
{
"name": "status",
"type": "valpos",
"formOptions": {
"values": {
"pagado": "payment.status.locked"
},
"options": {
"hideInNew": false,
"styles": {
"pagado": "label label-primary"
}
}
}
}
],
"groups": [
{
"name": "personal_info",
"title": "airport_group_info",
"description": "country_group_info_description",
"controls": [
[
"airportCode",
"airportName",
"airportLocation"
],
[
"details"
]
]
}
],
"grid": [
{
"sortColumnDefault": "id",
"sortColumnDirection": "asc",
"pagingSize": 5,
"expandRow": false,
"columns": [
{
"name": "id",
"sortable": true,
"style": {
"width": "50px"
},
"optional": false,
"filter": true
},
{
"name": "paymentAmount",
"sortable": true,
"style": {
"width": "50px"
},
"optional": false,
"filter": true
},
{
"name": "paymentDate",
"sortable": true,
"style": {
"width": "50px"
},
"optional": false,
"filter": true
},
{
"name": "status",
"sortable": true,
"style": {
"width": "50px"
},
"optional": false,
"filter": true
}
]
}
]
}
\ No newline at end of file
{
"name": "payment-reservation",
"title": "Realizar Pagos",
"fieldToShowInActon": "id",
"titleDesc": "Efectuar los pagos",
"icon": "<i class=\"material-icons\"> <span class=\"fa fa-money fa-sm\"> </span> </i>",
"service": "./service/itinerarys",
"recordId": "id",
"showFormIn": "standard",
"attributes": [
{
"name": "id",
"type": "number",
"formOptions": {
"options": {
"readonly": true,
"hideInNew": false
},
"validators": [
],
"controlType": "number"
}
},
{
"name": "dateReservation",
"type": "string",
"formOptions": {
"options": {
},
"validators": [
"required"
],
"controlType": "text"
}
},
{
"name": "status",
"type": "valpos",
"formOptions": {
"values": {
"pendiente": "payment_reservation.status.pendiente",
"cancelado": "payment_reservation.status.cancelado",
"pagado": "payment_reservation.status.pagado"
},
"options": {
"hideInNew": false,
"styles": {
"pagado": "label label-primary",
"cancelado": "label label-danger",
"pendiente": "label label-warning"
}
}
}
}
],
"groups": [
{
"name": "personal_info",
"title": "airport_group_info",
"description": "country_group_info_description",
"controls": [
]
}
],
"grid": [
{
"sortColumnDefault": "id",
"sortColumnDirection": "asc",
"pagingSize": 5,
"expandRow": false,
"columns": [
{
"name": "id",
"sortable": true,
"style": {
"width": "50px"
},
"optional": false,
"filter": true
},
{
"name": "dateReservation",
"sortable": true,
"style": {
"width": "50px"
},
"optional": false,
"filter": true
},
{
"name": "status",
"sortable": true,
"style": {
"width": "50px"
},
"optional": false,
"filter": true
}
]
}
]
}
\ No newline at end of file
{
"name": "reservation",
"title": "Reservas",
"fieldToShowInActon": "id",
"titleDesc": "Registrar una nueva Reserva",
"icon": "<i class=\"material-icons\"> <span class=\"fa fa-book fa-sm\"> </span> </i>",
"service": "./service/itinerarys",
"recordId": "id",
"showFormIn": "standard",
"attributes": [
{
"name": "id",
"type": "number",
"formOptions": {
"options": {
"readonly": true,
"hideInNew": false
},
"validators": [
],
"controlType": "number"
}
},
{
"name": "dateReservation",
"type": "string",
"formOptions": {
"options": {
},
"validators": [
"required"
],
"controlType": "text"
}
},
{
"name": "status",
"type": "valpos",
"formOptions": {
"values": {
"pendiente": "payment_reservation.status.pendiente",
"cancelado": "payment_reservation.status.cancelado",
"pagado": "payment_reservation.status.pagado"
},
"options": {
"hideInNew": false,
"styles": {
"pagado": "label label-primary",
"cancelado": "label label-danger",
"pendiente": "label label-warning"
}
}
}
}
],
"groups": [
{
"name": "personal_info",
"title": "airport_group_info",
"description": "country_group_info_description",
"controls": [
]
}
],
"grid": [
{
"sortColumnDefault": "id",
"sortColumnDirection": "asc",
"pagingSize": 5,
"expandRow": false,
"columns": [
{
"name": "id",
"sortable": true,
"style": {
"width": "50px"
},
"optional": false,
"filter": true
},
{
"name": "dateReservation",
"sortable": true,
"style": {
"width": "50px"
},
"optional": false,
"filter": true
},
{
"name": "status",
"sortable": true,
"style": {
"width": "50px"
},
"optional": false,
"filter": true
}
]
}
]
}
\ No newline at end of file
...@@ -94,21 +94,21 @@ ...@@ -94,21 +94,21 @@
"name": "status", "name": "status",
"type": "valpos", "type": "valpos",
"formOptions": { "formOptions": {
"values": { "values": {
"A": "user.status.active", "A": "user.status.active",
"I": "user.status.inactive" "I": "user.status.inactive"
}, },
"controlType": "badge", "controlType": "badge",
"options": { "options": {
"hideInNew": true, "hideInNew": true,
"styleClass": "col-md-6", "styleClass": "col-md-6",
"styles": { "styles": {
"A": "label label-primary", "A": "label label-primary",
"I": "label label-danger" "I": "label label-danger"
}
} }
}
} }
} }
], ],
"groups": [ "groups": [
{ {
...@@ -162,11 +162,11 @@ ...@@ -162,11 +162,11 @@
"name": "status", "name": "status",
"sortable": true, "sortable": true,
"style": { "style": {
"width": "50px" "width": "50px"
}, },
"optional": false, "optional": false,
"filter": true "filter": true
} }
] ]
} }
] ]
......
[
{
"id": 1,
"agentName": "Fiorella",
"agentLastname": "Talavera",
"dni": "76622429",
"agentPhone": "942368728",
"agentDetails": "Agente de Reservas"
},
{
"id": 2,
"agentName": "Huber",
"agentLastname": "Calla",
"dni": "73423454",
"agentPhone": "988734742",
"agentDetails": "Booking Agent"
}
]
\ No newline at end of file
[
{
"id": 1,
"airportCode": "LIM",
"airportName": "Lima",
"airportLocation": "Lima, Callao",
"details": "Aeropuerto Internacional del Peru"
},
{
"id": 2,
"airportCode": "MIA",
"airportName": "Miami",
"airportLocation": "Miami, Florida",
"details": "Aerpuerto de Miami"
},
{
"id": 3,
"airportCode": "MAD",
"airportName": "Madrid",
"airportLocation": "Madrid Barajas",
"details": "Aerpuerto de Madrid"
},
{
"id": 4,
"airportCode": "MEX",
"airportName": "Mexico",
"airportLocation": "Ciudad de Mexico",
"details": "Aerpuerto de Mexico"
},
{
"id": 5,
"airportCode": "NYC",
"airportName": "New York",
"airportLocation": "New York City",
"details": "Aerpuerto de NY"
}
]
\ No newline at end of file
[
{
"id": 1,
"firstName": "Josue",
"secondName": "Daniel",
"lastName": "Ponte",
"phoneNumber": "954705670",
"email": "jponte@bytesw.com",
"address": "calle petalos",
"city": "Lima",
"province": "Lima",
"country": "Perú",
"details": "Pasajero Peruano"
},
{
"id": 2,
"firstName": "Saith",
"secondName": "Karin",
"lastName": "Calla",
"phoneNumber": "923456789",
"email": "skcalla@gmail.com",
"address": "Francisco de Paula",
"city": "Lima",
"province": "Lima",
"country": "Perú",
"details": "Pasajero Peruano"
}
]
\ No newline at end of file
[
{
"id": 1,
"paymentDate": "24-04-2023",
"status": "pagado"
},
{
"id": 2,
"paymentDate": "24-04-2023",
"status": "pagado"
}
]
\ No newline at end of file
...@@ -10,6 +10,11 @@ ...@@ -10,6 +10,11 @@
"CONVERSATIONAL_AGENT", "CONVERSATIONAL_AGENT",
"OPERATIVE_DASHBOARD", "OPERATIVE_DASHBOARD",
"customer_interaction_dashboard", "customer_interaction_dashboard",
"Mantenimiento", "airport",
"Prueba" "passenger",
"booking_agent",
"payment",
"payment-reservation",
"flight",
"reservation"
] ]
\ No newline at end of file
[
{
"id": 1,
"date": "2021-04-10",
"description": "Descripcion caso 1",
"trigger": "US-0004",
"event": "No existe fichero del ABD",
"status": "G"
},
{
"id": 2,
"date": "2021-08-01",
"description": "Descripcion caso 2",
"trigger": "US-0004",
"event": "No existe fichero del ABD",
"status": "C"
},
{
"id": 3,
"date": "2021-01-05",
"description": "Descripcion caso 3",
"trigger": "US-0004",
"event": "No existe fichero del ABD",
"status": "G"
},
{
"id": 4,
"date": "2021-06-16",
"description": "Descripcion caso 3",
"trigger": "US-0004",
"event": "No existe fichero del ABD",
"status": "G"
},
{
"id": 5,
"date": "2021-03-03",
"description": "Descripcion caso 3",
"trigger": "US-0004",
"event": "No existe fichero del ABD",
"status": "C"
},
{
"id": 6,
"date": "2021-07-06",
"description": "Descripcion caso 3",
"trigger": "US-0004",
"event": "No existe fichero del ABD",
"status": "G"
},
{
"id": 7,
"date": "2021-01-22",
"description": "Descripcion caso 3",
"trigger": "US-0004",
"event": "No existe fichero del ABD",
"status": "C"
},
{
"id": 8,
"date": "2021-07-03",
"description": "Descripcion caso 3",
"trigger": "US-0004",
"event": "No existe fichero del ABD",
"status": "C"
},
{
"id": 9,
"date": "2021-05-24",
"description": "Descripcion caso 3",
"trigger": "US-0004",
"event": "No existe fichero del ABD",
"status": "G"
},
{
"id": 10,
"date": "2021-06-18",
"description": "Descripcion caso 3",
"trigger": "US-0004",
"event": "No existe fichero del ABD",
"status": "C"
}
]
\ No newline at end of file
...@@ -99,7 +99,5 @@ ...@@ -99,7 +99,5 @@
"dashboards.customer.interaction.sentences": "Frases no identificadas", "dashboards.customer.interaction.sentences": "Frases no identificadas",
"dashboards.customer.interaction.intents": "Intenciones más utilizadas", "dashboards.customer.interaction.intents": "Intenciones más utilizadas",
"security.password.error.passwordMinLength": "La contraseña no cumple con el mínimo de caracteres configurado.", "security.password.error.passwordMinLength": "La contraseña no cumple con el mínimo de caracteres configurado.",
"message.error.duplicated": "Registro duplicado", "message.error.duplicated": "Registro duplicado"
"prueba_info":"PRUEBA 1"
} }
\ No newline at end of file
...@@ -15,5 +15,15 @@ ...@@ -15,5 +15,15 @@
"menu.parent.agent": "Agentes", "menu.parent.agent": "Agentes",
"menu.parent.dashboard": "Dashboards", "menu.parent.dashboard": "Dashboards",
"menu.dashboard.operative": "Indicadores operativos", "menu.dashboard.operative": "Indicadores operativos",
"menu.dashboard.customer.interaction": "Indicadores de interacción" "menu.dashboard.customer.interaction": "Indicadores de interacción",
"menu.parent.airport": "Aeropuertos",
"menu.parent.passenger": "Pasajeros",
"menu.parent.booking_agent": "Agentes",
"menu.parent.payment": "Pagos",
"menu.parent.reservation_payment": "Gestor de Pagos",
"menu.parent.flight": "Vuelos",
"menu.parent.reservation": "Reservas",
"tax_dialogRate_effectiveDate": "Fecha efectiva",
"tax_dialogRate_rate": "Tasa"
} }
\ No newline at end of file
...@@ -65,5 +65,86 @@ ...@@ -65,5 +65,86 @@
"user.status.inactive": "Inactivo", "user.status.inactive": "Inactivo",
"user.status.password.expired": "Contraseña expirada", "user.status.password.expired": "Contraseña expirada",
"user.status.created": "Creado", "user.status.created": "Creado",
"user.status.deleted": "Eliminado" "user.status.deleted": "Eliminado",
"airport_group_info": "Informacion general",
"breadcrumb.airport": "Aeropuerto",
"breadcrumb.airport.detail": "Aeropuerto",
"airport_id_header": "Id",
"airport_airportCode_header": "Código",
"airport_airportName_header": "Nombre",
"airport_form_airportCode_placeholder": "Código",
"airport_form_airportName_placeholder": "Nombre",
"airport_form_airportLocation_placeholder": "Localizacion",
"airport_form_details_placeholder": "Detalles",
"passenger_group_info": "Datos del pasajero",
"breadcrumb.passenger": "Pasajero",
"breadcrumb.passenger.detail": "Pasajero",
"passenger_id_header": "Id",
"passenger_lastName_header": "Apellido",
"passenger_firstName_header": "Primer Nombre",
"passenger_secondName_header": "Segundo Nombre",
"passenger_phoneNumber_header": "Telefono",
"passenger_form_firstName_placeholder": "Nombre",
"passenger_form_secondName_placeholder": "Segundo Nombre",
"passenger_form_lastName_placeholder": "Apellido",
"passenger_form_phoneNumber_placeholder": "Telefono",
"passenger_form_email_placeholder": "Correo",
"passenger_form_address_placeholder": "Direccion",
"passenger_form_city_placeholder": "Ciudad",
"passenger_form_province_placeholder": "Provincia",
"passenger_form_country_placeholder": "Pais",
"passenger_form_details_placeholder": "Detalles",
"booking_agent_group_info": "Datos del agente",
"breadcrumb.booking_agent": "Agente",
"breadcrumb.booking_agent.detail": "Agente",
"booking_agent_id_header": "Id",
"booking_agent_agentLastname_header": "Apellido",
"booking_agent_agentName_header": "Nombre",
"booking_agent_agentPhone_header": "Telefono",
"booking_agent_form_agentName_placeholder": "Nombre",
"booking_agent_form_agentLastname_placeholder": "Apellido",
"booking_agent_form_dni_placeholder": "DNI",
"booking_agent_form_agentPhone_placeholder": "Telefono",
"booking_agent_form_agentDetails_placeholder": "Detalles",
"breadcrumb.payment": "Pago",
"payment_id_header": "Id",
"payment_paymentAmount_header": "Monto",
"payment_paymentDate_header": "Fecha",
"payment_nombre_header": "Fecha",
"payment_status_header": "Estado",
"payment.status.locked": "Pagado",
"payment_reservation.status.pendiente": "Pendiente",
"payment_reservation.status.cancelado": "Cancelado",
"payment_reservation.status.pagado": "Pagado",
"breadcrumb.flight": "Vuelo",
"breadcrumb.flight.detail": "Vuelo",
"flight_id_header" : "Id",
"flight_airlineCode_header": "Codigo Aerolinea",
"flight_codeTypeAircraft_header": "Codigo Aeronave",
"flight_flightCost_header": "Costo",
"payment-reservation_id_header" : "Id",
"payment-reservation_dateReservation_header" : "Fecha Reservacion",
"payment-reservation_status_header" : "Estado",
"reservation_id_header" : "Id",
"reservation_dateReservation_header" : "Fecha Reservacion",
"reservation_status_header" : "Estado"
} }
\ No newline at end of file
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
"module": "esnext", "module": "esnext",
"moduleResolution": "node", "moduleResolution": "node",
"importHelpers": true, "importHelpers": true,
"target": "es5", "target": "es6",
"typeRoots": [ "typeRoots": [
"node_modules/@types" "node_modules/@types"
], ],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment