first commit
This commit is contained in:
22
src/app/app-routing.module.ts
Normal file
22
src/app/app-routing.module.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: 'Auth',
|
||||
loadChildren: () =>
|
||||
import('./modules/auth/auth.module').then((m) => m.AuthModule),
|
||||
},
|
||||
{
|
||||
path: '',
|
||||
loadChildren: () =>
|
||||
import('./layouts/theme.module').then((m) => m.ThemeModule),
|
||||
},
|
||||
{ path: '**', redirectTo: 'Error/404', pathMatch: 'full' },
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forRoot(routes, { onSameUrlNavigation: 'reload' })],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class AppRoutingModule {}
|
||||
67
src/app/app.component.html
Normal file
67
src/app/app.component.html
Normal file
@@ -0,0 +1,67 @@
|
||||
<router-outlet></router-outlet>
|
||||
<app-loader></app-loader>
|
||||
<p-toast [preventOpenDuplicates]="true"></p-toast>
|
||||
<div class="SSExpireWarning">
|
||||
<p-dialog (onHide)="Close(false)" header="" [(visible)]="commonService.displayPosition" position="center" [modal]="true"
|
||||
[style]="{width: '450px'}" [draggable]="false" [resizable]="false" [showHeader]="false">
|
||||
<div class="SSExpire-Modal">
|
||||
<span class="text-center">
|
||||
<svg focusable="false" color="secondary" fill="none" aria-hidden="true" role="presentation"
|
||||
viewBox="0 0 56 56" preserveAspectRatio="xMidYMid meet" size="62" width="56"
|
||||
class="sc-hMqMXs jdbxAS">
|
||||
<circle cx="28" cy="28" r="22" fill="#F7F9FA"></circle>
|
||||
<path
|
||||
d="M11.7862 43.553L12.1367 47.0874C12.2074 47.8 12.469 49.8536 13.185 49.845C18.1263 49.7855 24.0454 49.7758 29.3073 49.8157C31.2661 49.8306 33.17 49.0367 33.3633 47.0875L33.7138 43.553C34.0697 39.9639 31.7579 36.6164 28.6804 34.7356L25.2072 32.6132C24.6538 32.275 24.3163 31.6731 24.3163 31.0245C24.3163 30.375 24.6511 29.7714 25.2021 29.4276L28.7998 27.1827C31.8564 25.2753 33.7138 21.927 33.7138 18.3241V15.1723C33.7138 13.2835 31.3584 12.7625 29.4695 12.7567C27.3296 12.75 25.0078 12.75 22.75 12.75H22.7359C20.4026 12.75 18.2578 12.75 16.0308 12.7574C14.1421 12.7636 11.7862 13.2836 11.7862 15.1723L11.7862 18.3241C11.7862 21.927 13.6436 25.2753 16.7002 27.1827L20.2979 29.4276C20.8489 29.7714 21.1837 30.375 21.1837 31.0245C21.1837 31.6731 20.8462 32.275 20.2928 32.6132L16.8196 34.7356C13.7421 36.6164 11.4303 39.9639 11.7862 43.553Z"
|
||||
fill="white"></path>
|
||||
<path
|
||||
d="M21.1844 29.9803L18.581 28.3848L16.2747 26.935C17.1373 24.9676 19.2659 23.8796 21.3658 24.3327L22.6353 24.6067C25.0208 25.1215 27.5067 24.4248 29.2771 22.7451L29.3496 22.6764C30.2896 21.7846 31.6285 21.4515 32.8768 21.7987L31.6261 25.2815L29.5378 27.3699L24.3169 29.9803L24.0255 31.5101C23.8721 32.3157 23.7948 33.134 23.7948 33.9542V34.1774C23.7948 34.9871 24.1725 35.7504 24.8161 36.2416L29.496 39.8131C32.0788 41.7841 33.3173 45.0513 32.6903 48.2392C32.6786 48.2989 32.6275 48.3429 32.5667 48.3455L22.7507 48.7739L12.9347 48.3455C12.8739 48.3429 12.8228 48.2989 12.811 48.2392C12.184 45.0513 13.4226 41.7841 16.0053 39.8131L20.6852 36.2416C21.3288 35.7504 21.7065 34.9871 21.7065 34.1774V33.9542C21.7065 33.134 21.6293 32.3157 21.4758 31.5101L21.1844 29.9803Z"
|
||||
fill="#D8DCDE"></path>
|
||||
<path opacity="0.23"
|
||||
d="M21.1844 29.9803L18.581 28.3847L15.4087 26.1522L19.3337 27.5522C21.1653 28.2054 23.2078 27.7932 24.6427 26.4807C25.4876 25.7079 26.5619 25.2323 27.7021 25.1266L28.3238 25.0689C29.5704 24.9532 30.7644 24.5104 31.7849 23.7853L32.1993 23.4909C32.2732 23.4384 32.3696 23.5157 32.3344 23.5992L31.6261 25.2815L29.5377 27.3698L24.3169 29.9803L24.0255 31.5101C23.872 32.3157 23.7948 33.134 23.7948 33.9541V34.1774C23.7948 34.9871 24.1725 35.7504 24.8161 36.2416L29.4961 39.8132C32.0788 41.7841 33.3173 45.0512 32.6903 48.239C32.6786 48.2988 32.6273 48.3428 32.5664 48.3453L22.3106 48.7739L12.9344 48.3457C12.8737 48.3429 12.8228 48.299 12.811 48.2394C12.184 45.0514 13.4226 41.7841 16.0054 39.8129L20.6851 36.2416C21.3288 35.7504 21.7065 34.9871 21.7065 34.1774V33.9541C21.7065 33.134 21.6292 32.3157 21.4758 31.5101L21.1844 29.9803Z"
|
||||
fill="#66797F"></path>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||
d="M22.7369 13.25C20.4031 13.25 18.2589 13.25 16.0327 13.2574C15.12 13.2604 14.138 13.3893 13.4036 13.7158C12.6841 14.0357 12.2864 14.4963 12.2864 15.1723L12.2864 18.3241C12.2864 21.7545 14.0548 24.9425 16.9651 26.7585L20.5628 29.0034C21.2602 29.4386 21.6839 30.2025 21.6839 31.0245C21.6839 31.8473 21.2557 32.6108 20.5537 33.0398L17.0806 35.1623C14.1085 36.9786 11.9529 40.1651 12.284 43.5037L12.6345 47.0381C12.6692 47.3881 12.7491 48.0457 12.9015 48.6053C12.9787 48.8891 13.0655 49.1122 13.1535 49.2533C13.1844 49.3029 13.2074 49.3303 13.2215 49.3445C18.1578 49.2855 24.0614 49.2759 29.3113 49.3158C30.231 49.3227 31.0993 49.1382 31.7432 48.7577C32.3696 48.3875 32.787 47.8339 32.8659 47.0381L33.2164 43.5037C33.5475 40.1651 31.3919 36.9786 28.4198 35.1623L24.9467 33.0398C24.2446 32.6108 23.8164 31.8473 23.8164 31.0245C23.8164 30.2025 24.2402 29.4386 24.9376 29.0034L28.5353 26.7585C31.4455 24.9425 33.214 21.7545 33.214 18.3241V15.1723C33.214 14.4961 32.8163 14.0353 32.0969 13.7152C31.3626 13.3885 30.3808 13.2595 29.4682 13.2566C27.3291 13.25 25.0082 13.25 22.7502 13.25H22.7369ZM22.736 12.25H22.7502C25.0076 12.25 27.3306 12.25 29.4713 12.2567C30.4475 12.2597 31.5878 12.3941 32.5034 12.8015C33.434 13.2156 34.214 13.9597 34.214 15.1723V18.3241C34.214 22.0995 32.2677 25.6082 29.0647 27.6068L25.467 29.8518C25.0623 30.1043 24.8164 30.5476 24.8164 31.0245C24.8164 31.4989 25.0633 31.9392 25.4681 32.1865L28.9413 34.309C32.1244 36.2542 34.5923 39.7626 34.2115 43.6024L33.8611 47.1368C33.7467 48.2903 33.1155 49.1082 32.2519 49.6186C31.4058 50.1187 30.3428 50.3236 29.3037 50.3157C24.0448 50.2758 18.129 50.2856 13.1912 50.3449C12.7431 50.3503 12.4594 50.03 12.3051 49.7826C12.1404 49.5188 12.0231 49.1856 11.9366 48.868C11.7615 48.2249 11.6753 47.4994 11.6393 47.1368L11.2888 43.6024C10.9081 39.7626 13.376 36.2542 16.5591 34.309L20.0322 32.1865C20.437 31.9392 20.6839 31.4989 20.6839 31.0245C20.6839 30.5476 20.438 30.1043 20.0334 29.8518L16.4357 27.6068C13.2327 25.6082 11.2864 22.0995 11.2864 18.3241L11.2864 15.1723C11.2864 13.9596 12.0667 13.2158 12.9973 12.8021C13.913 12.3949 15.0533 12.2606 16.0294 12.2574C18.2573 12.25 20.4029 12.25 22.736 12.25Z"
|
||||
fill="#66797F"></path>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||
d="M9.25 12.75C9.52614 12.75 9.75 12.9739 9.75 13.25V48.25C9.75 48.5261 9.52614 48.75 9.25 48.75C8.97386 48.75 8.75 48.5261 8.75 48.25V13.25C8.75 12.9739 8.97386 12.75 9.25 12.75Z"
|
||||
fill="#66797F"></path>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||
d="M36.25 12.75C35.9739 12.75 35.75 12.9739 35.75 13.25V48.25C35.75 48.5261 35.9739 48.75 36.25 48.75C36.5261 48.75 36.75 48.5261 36.75 48.25V13.25C36.75 12.9739 36.5261 12.75 36.25 12.75Z"
|
||||
fill="#66797F"></path>
|
||||
<path d="M6.75 11.25H38.75V14.25H6.75V11.25Z" fill="#D8DCDE"></path>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||
d="M5.25 14.75C5.25 14.4739 5.47386 14.25 5.75 14.25H39.75C40.0261 14.25 40.25 14.4739 40.25 14.75C40.25 15.0261 40.0261 15.25 39.75 15.25H5.75C5.47386 15.25 5.25 15.0261 5.25 14.75Z"
|
||||
fill="#66797F"></path>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||
d="M5.25 11.25C5.25 10.9739 5.47386 10.75 5.75 10.75H39.75C40.0261 10.75 40.25 10.9739 40.25 11.25C40.25 11.5261 40.0261 11.75 39.75 11.75H5.75C5.47386 11.75 5.25 11.5261 5.25 11.25Z"
|
||||
fill="#66797F"></path>
|
||||
<path d="M6.75 47.25H38.75V50.25H6.75V47.25Z" fill="#D8DCDE"></path>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||
d="M5.25 50.75C5.25 50.4739 5.47386 50.25 5.75 50.25H39.75C40.0261 50.25 40.25 50.4739 40.25 50.75C40.25 51.0261 40.0261 51.25 39.75 51.25H5.75C5.47386 51.25 5.25 51.0261 5.25 50.75Z"
|
||||
fill="#66797F"></path>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||
d="M5.25 47.25C5.25 46.9739 5.47386 46.75 5.75 46.75H39.75C40.0261 46.75 40.25 46.9739 40.25 47.25C40.25 47.5261 40.0261 47.75 39.75 47.75H5.75C5.47386 47.75 5.25 47.5261 5.25 47.25Z"
|
||||
fill="#66797F"></path>
|
||||
<path
|
||||
d="M50.25 17.5C50.25 24.2655 44.7655 29.75 38 29.75C31.2345 29.75 25.75 24.2655 25.75 17.5C25.75 10.7345 31.2345 5.25 38 5.25C44.7655 5.25 50.25 10.7345 50.25 17.5Z"
|
||||
fill="white"></path>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||
d="M38 5.75C31.5107 5.75 26.25 11.0107 26.25 17.5C26.25 23.9893 31.5107 29.25 38 29.25C44.4893 29.25 49.75 23.9893 49.75 17.5C49.75 11.0107 44.4893 5.75 38 5.75ZM25.25 17.5C25.25 10.4584 30.9584 4.75 38 4.75C45.0416 4.75 50.75 10.4584 50.75 17.5C50.75 24.5416 45.0416 30.25 38 30.25C30.9584 30.25 25.25 24.5416 25.25 17.5Z"
|
||||
fill="#66797F"></path>
|
||||
<path
|
||||
d="M48.5 17.5C48.5 23.299 43.799 28 38 28C32.201 28 27.5 23.299 27.5 17.5C27.5 11.701 32.201 7 38 7C43.799 7 48.5 11.701 48.5 17.5Z"
|
||||
fill="#EDF1F3"></path>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||
d="M35.6919 11.9279C36.794 11.4714 38.0067 11.3519 39.1766 11.5846C40.3466 11.8174 41.4213 12.3918 42.2647 13.2353L43.9303 14.9008H42.1687C41.8925 14.9008 41.6687 15.1247 41.6687 15.4008C41.6687 15.677 41.8925 15.9008 42.1687 15.9008H45.1374C45.4136 15.9008 45.6374 15.677 45.6374 15.4008V12.4321C45.6374 12.1559 45.4136 11.9321 45.1374 11.9321C44.8613 11.9321 44.6374 12.1559 44.6374 12.4321V14.1937L42.9718 12.5282C41.9885 11.5448 40.7357 10.8752 39.3717 10.6039C38.0078 10.3326 36.594 10.4718 35.3093 11.004C34.0245 11.5362 32.9263 12.4374 32.1537 13.5936C31.3811 14.7499 30.9688 16.1094 30.9688 17.5C30.9688 18.8907 31.3811 20.2501 32.1537 21.4064C32.9263 22.5626 34.0245 23.4639 35.3093 23.996C36.594 24.5282 38.0078 24.6675 39.3717 24.3962C40.7357 24.1248 41.9885 23.4552 42.9718 22.4718C43.1671 22.2766 43.1671 21.96 42.9718 21.7647C42.7766 21.5695 42.46 21.5695 42.2647 21.7647C41.4213 22.6082 40.3466 23.1826 39.1766 23.4154C38.0067 23.6481 36.794 23.5286 35.6919 23.0722C34.5899 22.6157 33.6479 21.8426 32.9852 20.8508C32.3225 19.859 31.9688 18.6929 31.9688 17.5C31.9688 16.3071 32.3225 15.1411 32.9852 14.1492C33.6479 13.1574 34.5899 12.3843 35.6919 11.9279Z"
|
||||
fill="#66797F"></path>
|
||||
</svg>
|
||||
</span>
|
||||
<div class="ExpireHeader"> Session Expire Warning </div>
|
||||
<div class="ExpireDesc">Your session will expire in {{commonService.remainingTime}} seconds. </div>
|
||||
<div class="ExpireDesc">Do you want to extend the session? </div>
|
||||
<span class="btnExtend">
|
||||
<button pButton class="btn-primary" label="Extend Now" (click)="extendJWTTime()"></button>
|
||||
</span>
|
||||
</div>
|
||||
</p-dialog>
|
||||
</div>
|
||||
108
src/app/app.component.ts
Normal file
108
src/app/app.component.ts
Normal file
@@ -0,0 +1,108 @@
|
||||
import { Component, Renderer2 } from '@angular/core';
|
||||
import * as moment from 'moment';
|
||||
import { Subscription, interval } from 'rxjs';
|
||||
import { CommonFunctionService } from './core/common/common-function.service';
|
||||
import { API } from './core/services/api.service';
|
||||
import { RouteChangeService } from './core/common/RouteChangeService.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
templateUrl: './app.component.html',
|
||||
})
|
||||
export class AppComponent {
|
||||
// displayPosition = false;
|
||||
// position: string;
|
||||
title = "AngularStructure";
|
||||
constructor(private renderer: Renderer2, public commonService: CommonFunctionService, private ApiSer: API, private routeChangeService: RouteChangeService) {
|
||||
// Check if userId exists in sessionStorage
|
||||
if (sessionStorage.getItem('LoginUserData')) {
|
||||
// Set up an interval that runs every second
|
||||
this.commonService.StartTimer();
|
||||
} else {
|
||||
// If userId doesn't exist in sessionStorage
|
||||
// Set displayPosition to false, remove 'excd' from sessionStorage, and unsubscribe from the subscription
|
||||
this.commonService.displayPosition = false;
|
||||
sessionStorage.removeItem('excd');
|
||||
this.commonService.subscription?.unsubscribe();
|
||||
}
|
||||
|
||||
}
|
||||
stopTimer() {
|
||||
if (this.commonService.subscription) {
|
||||
this.commonService.subscription.unsubscribe();
|
||||
this.commonService.subscription = undefined;
|
||||
}
|
||||
};
|
||||
|
||||
ngOnInit(): void {
|
||||
//sessionStorage.getItem("userId")
|
||||
// ? ""
|
||||
// : (window.location.href = "/Login/Login");
|
||||
// const links = this.renderer.createElement("link");
|
||||
// links.setAttribute("rel", "stylesheet");
|
||||
// links.setAttribute("type", "text/css");
|
||||
// links.setAttribute(
|
||||
// "href",
|
||||
// isTheme ? "../assets/css/empire/e-default.css" : "../assets/css/retina/r-default.css"
|
||||
// );
|
||||
// this.renderer.appendChild(document.head, links);
|
||||
// const link = this.renderer.createElement("link");
|
||||
// link.setAttribute("rel", "stylesheet");
|
||||
// link.setAttribute("type", "text/css");
|
||||
// link.setAttribute(
|
||||
// "href",
|
||||
// isTheme ? "../assets/css/empire.css" : "../assets/css/retina.css"
|
||||
// );
|
||||
// this.renderer.appendChild(document.head, link);
|
||||
// this.commonService.GetOrgDetails();
|
||||
// this.route.queryParams.subscribe(obj => {
|
||||
// console.log(obj)
|
||||
// // if(obj.key) CommonFunctions.DecryptReq("UfCP%2FE7upxltDZyVLfTj%2F8fMMbudOAFfwLCR1RVqPXNvD%203jblAZ3pQ0i9LtrXpE0DFYbSnyHNj353T2bJx9Zg%3D%3D");
|
||||
|
||||
// })
|
||||
// sessionStorage.getItem('userId') ? '' : window.location.href = '/Login/Login'
|
||||
}
|
||||
|
||||
showPositionDialog(position: string) {
|
||||
this.commonService.position = position;
|
||||
this.commonService.displayPosition = true;
|
||||
};
|
||||
|
||||
ngOnDestroy() {
|
||||
// Unsubscribe from the observable to prevent memory leaks
|
||||
this.commonService.subscription.unsubscribe();
|
||||
}
|
||||
extendJWTTime() {
|
||||
this.stopTimer();
|
||||
let postdata = {
|
||||
"JwtToken": sessionStorage.getItem('JwtToken'),
|
||||
"RefreshToken": sessionStorage.getItem('RefreshToken')
|
||||
};
|
||||
this.ApiSer.AdminPost('/JWT/RefreshToken', postdata).subscribe(res => {
|
||||
if (!res.Status) {
|
||||
this.commonService.loginOut();
|
||||
} else {
|
||||
sessionStorage.setItem('JwtToken', res.JwtToken);
|
||||
sessionStorage.setItem('RefreshToken', res.RefreshToken);
|
||||
sessionStorage.setItem('JwtTokenExpiry', res.JwtTokenExpiry);
|
||||
this.Close(true)
|
||||
this.commonService.StartTimer();
|
||||
}
|
||||
})
|
||||
};
|
||||
// remainingTime: number;
|
||||
exit() {
|
||||
this.commonService.displayPosition = false;
|
||||
sessionStorage.removeItem('excd');
|
||||
this.commonService.loginOut();
|
||||
};
|
||||
Close(check) {
|
||||
this.commonService.displayPosition = false;
|
||||
sessionStorage.setItem('excd', 'OK')
|
||||
if (check) {
|
||||
setTimeout(function () {
|
||||
sessionStorage.removeItem('excd');
|
||||
}, 10000); // 10000 milliseconds = 10 second
|
||||
}
|
||||
}
|
||||
}
|
||||
42
src/app/app.module.ts
Normal file
42
src/app/app.module.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { AppRoutingModule } from './app-routing.module';
|
||||
import { AppComponent } from './app.component';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { InterceptLoader } from './core/common/intercept-loader.service';
|
||||
import { MessageService } from 'primeng/api';
|
||||
import { ToastModule } from 'primeng/toast';
|
||||
import { AuthGuard } from './core/guard/auth.guard';
|
||||
import { DialogModule } from 'primeng/dialog';
|
||||
import { ButtonModule } from 'primeng/button';
|
||||
import { LoaderComponent } from './core/shared/intercept-loader/intercept-loader.component';
|
||||
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
LoaderComponent,
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
HttpClientModule,
|
||||
BrowserAnimationsModule,
|
||||
AppRoutingModule,
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
ToastModule,
|
||||
ButtonModule,
|
||||
DialogModule
|
||||
],
|
||||
providers: [
|
||||
TranslateService, MessageService,
|
||||
AuthGuard,
|
||||
{ provide: HTTP_INTERCEPTORS, useClass: InterceptLoader, multi: true }
|
||||
],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
export class AppModule { }
|
||||
|
||||
51
src/app/core/common/RouteChangeService.service.ts
Normal file
51
src/app/core/common/RouteChangeService.service.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Router, NavigationEnd } from '@angular/router';
|
||||
import { filter } from 'rxjs/operators';
|
||||
import { MessageService } from 'primeng/api';
|
||||
import { API } from '../services/api.service';
|
||||
import { securityFunctions } from './security';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class RouteChangeService {
|
||||
constructor(private router: Router, private apiService: API) {
|
||||
this.setupRouteChangeSubscription();
|
||||
// this.checkSessionMsg()
|
||||
}
|
||||
|
||||
private setupRouteChangeSubscription() {
|
||||
this.router.events
|
||||
.pipe(filter(event => event instanceof NavigationEnd))
|
||||
.subscribe(() => {
|
||||
const currentUrl = this.router.url;
|
||||
// Check the current route's URL
|
||||
|
||||
if (currentUrl.includes('Unauthorized') || currentUrl == '/' || currentUrl.includes('/404') || currentUrl.includes('/error') || currentUrl.includes('/Auth') || currentUrl.includes('/Home') || currentUrl.includes('/Login')) {
|
||||
// console.log('Not making API call for 404 or error route:', currentUrl);
|
||||
} else {
|
||||
let LoginUserData = JSON.parse(securityFunctions.getSessionStorage('LoginUserData'));
|
||||
// Call your API function here
|
||||
let url = currentUrl
|
||||
if (currentUrl.includes('?')) {
|
||||
url = currentUrl.split('?')[0]
|
||||
}
|
||||
let obj = {
|
||||
"page_url": url,
|
||||
"user_id": LoginUserData.user_id,
|
||||
"project_id": '2405170833594899108'
|
||||
}
|
||||
this.apiService.AdminPost('/MenuMasterNew/IsAuthorizedPage', obj).subscribe(
|
||||
(response) => {
|
||||
if (!response.resp) {
|
||||
this.router.navigate(['/Unauthorized']);
|
||||
}
|
||||
},
|
||||
(error) => {
|
||||
this.router.navigate(['/'])
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
657
src/app/core/common/common-function.service.ts
Normal file
657
src/app/core/common/common-function.service.ts
Normal file
@@ -0,0 +1,657 @@
|
||||
import { MessageService } from "primeng/api";
|
||||
import { API } from "../services/api.service";
|
||||
import { Injectable } from "@angular/core";
|
||||
import { Title } from "@angular/platform-browser";
|
||||
import { ValidationService } from "./validation.service";
|
||||
import * as moment from "moment";
|
||||
import { FileUpload } from "primeng/fileupload";
|
||||
import jsPDF from "jspdf";
|
||||
import * as FileSaver from "file-saver";
|
||||
import autoTable from 'jspdf-autotable';
|
||||
import { UserLoginData } from "../models/common-model/userModel";
|
||||
import { securityFunctions } from "./security";
|
||||
import { UserLog } from "../models/common-model/user-logout.model";
|
||||
import { Subscription, interval } from "rxjs";
|
||||
import { environment } from "src/environments/environment";
|
||||
import { Router, NavigationEnd } from '@angular/router';
|
||||
import { filter } from 'rxjs/operators';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class CommonFunctionService {
|
||||
LoginUserData: UserLoginData
|
||||
constructor(
|
||||
public MsgService: MessageService,
|
||||
public ApiServ: API,
|
||||
public validationService: ValidationService,
|
||||
public titleService: Title,
|
||||
public router:Router
|
||||
) {
|
||||
this.LoginUserData = securityFunctions.getSessionStorage('LoginUserData') ? JSON.parse(securityFunctions.getSessionStorage('LoginUserData')) : null
|
||||
this.clientId = environment.client_id
|
||||
}
|
||||
clientId = ''
|
||||
logo;
|
||||
AllMenu;
|
||||
ChangeStatusAllowed = false;
|
||||
DownloadFilesAllowed = false;
|
||||
environmentObj = environment;
|
||||
ddLoader = {
|
||||
country: false,
|
||||
city: false,
|
||||
Currency: false,
|
||||
vendor: false,
|
||||
};
|
||||
MenuTabList = {
|
||||
Overview: { val:false, link:'Services/Hotel/HotelManage/OverView', IsActive: false, Download: false},
|
||||
MealAddOn: { val:false, link:'Services/Hotel/HotelManage/HotelMealAdd', IsActive: false, Download: false},
|
||||
Rooms: { val:false, link:'Services/Hotel/HotelManage/HotelAddRoom', IsActive: false, Download: false},
|
||||
HotelSeason: { val:false, link:'Services/Hotel/HotelManage/AddSeason', IsActive: false, Download: false},
|
||||
RoomContract: { val:false, link:'Services/Hotel/HotelManage/RoomContractAdd', IsActive: false, Download: false},
|
||||
MinStay: { val:false, link:'Services/Hotel/HotelManage/AddMinStay', IsActive: false, Download: false},
|
||||
RoomAllocation: { val:false, link:'Services/Hotel/HotelManage/AddAllocation', IsActive: false, Download: false},
|
||||
HotelBlockDates: { val:false, link:'Services/Hotel/HotelManage/HotelAddBlockDate', IsActive: false, Download: false},
|
||||
HotelOffers: { val:false, link:'Services/Hotel/HotelManage/AddOffer', IsActive: false, Download: false},
|
||||
HotelSupplements: { val:false, link:'Services/Hotel/HotelManage/AddSuppliment', IsActive: false, Download: false},
|
||||
}
|
||||
CurrencyList = [];
|
||||
CountryList = [];
|
||||
CityList = [];
|
||||
agencyData = [];
|
||||
timer;
|
||||
AllVendor = []
|
||||
// =============================== normal function ==========================
|
||||
|
||||
/**
|
||||
* this function for show message
|
||||
* @param check boolean
|
||||
* @param message text
|
||||
*/
|
||||
public showMessage(check, message, type?) {
|
||||
this.MsgService.add({
|
||||
severity: type ? type : check ? "success" : "error",
|
||||
detail: message,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @author Ayaan kazi
|
||||
* last updated by Abdul Razzak on 03-06-2024
|
||||
* @param otpInp
|
||||
* @param otpBox
|
||||
*/
|
||||
focusEmptyOtpInp(otpInp, otpBox) {
|
||||
let targetOtpInput = otpInp.target;
|
||||
const otpInputWrapper = targetOtpInput.closest('.ng-otp-input-wrapper');
|
||||
const inputList = [...otpInputWrapper.querySelectorAll('input')];
|
||||
let ind = inputList.findIndex(z => z.getAttribute('id') == targetOtpInput.id);
|
||||
if (ind == -1 || inputList[ind].value == '') {
|
||||
for (let i = 0; i <= inputList.length; i++) {
|
||||
let inp = inputList[i];
|
||||
if (inp?.value == '') {
|
||||
let id = inp.getAttribute('id');
|
||||
otpBox.focusTo(id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// check Token expire time
|
||||
/**
|
||||
* @param check pass boolean for check time expire or not
|
||||
*/
|
||||
CheckTokenExpireTime(check) {
|
||||
const currentISOString = moment.utc(this.ApiServ.getAdjustedLocalTime()).format('YYYY-MM-DD HH:mm:ss');
|
||||
const time1 = moment.utc(sessionStorage.getItem('JwtTokenExpiry')).subtract(3, 'seconds').format('YYYY-MM-DD HH:mm:ss');
|
||||
const isTime1AfterTime2 = this.isTime1AfterTime2(time1, currentISOString);
|
||||
if (isTime1AfterTime2) {
|
||||
let postdata = {
|
||||
"JwtToken": sessionStorage.getItem('JwtToken'),
|
||||
"RefreshToken": sessionStorage.getItem('RefreshToken')
|
||||
}
|
||||
this.ApiServ.AdminPost('/JWT/RefreshToken', postdata).subscribe(res => {
|
||||
if (!res.Status) {
|
||||
this.loginOut();
|
||||
} else {
|
||||
sessionStorage.setItem('JwtToken', res.JwtToken);
|
||||
sessionStorage.setItem('RefreshToken', res.RefreshToken);
|
||||
sessionStorage.setItem('JwtTokenExpiry', res.JwtTokenExpiry);
|
||||
check ? window.location.href = "/Home/Dashboard" : '';
|
||||
}
|
||||
})
|
||||
} else {
|
||||
check ? window.location.href = "/Home/Dashboard" : '';
|
||||
}
|
||||
};
|
||||
isTime1AfterTime2(time1, time2) {
|
||||
const date1 = new Date(time1); // Create a Date object for time1
|
||||
const date2 = new Date(time2); // Create a Date object for time2
|
||||
return date1 < date2 ? true : false; // Compare the two Date objects
|
||||
};
|
||||
// ---------------------------------------------- Export file ----------------------------------------------
|
||||
/**
|
||||
* this function for download excel
|
||||
* @param GetallData all data
|
||||
* @param title_list header and property list
|
||||
* @param file_name file name
|
||||
*/
|
||||
public exportExcel(GetallData, title_list, file_name) {
|
||||
let bookResultResp = GetallData.map(el => {
|
||||
let obj = {}
|
||||
title_list.forEach(title => obj[title.header] = el[title.field])
|
||||
return obj;
|
||||
});
|
||||
import("xlsx").then((xlsx) => {
|
||||
console.log(xlsx);
|
||||
const worksheet = xlsx.utils.json_to_sheet(bookResultResp);
|
||||
const workbook = { Sheets: { data: worksheet }, SheetNames: ["data"] };
|
||||
const excelBuffer: any = xlsx.write(workbook, {
|
||||
bookType: "xlsx",
|
||||
type: "array",
|
||||
});
|
||||
this.saveAsExcelFile(excelBuffer, file_name);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* @param buffer
|
||||
* @param fileName
|
||||
*/
|
||||
saveAsExcelFile(buffer: any, fileName: string): void {
|
||||
import("file-saver").then((abc) => {
|
||||
let EXCEL_TYPE =
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8";
|
||||
let EXCEL_EXTENSION = ".xlsx";
|
||||
const data: Blob = new Blob([buffer], {
|
||||
type: EXCEL_TYPE,
|
||||
});
|
||||
console.log(FileSaver);
|
||||
FileSaver.saveAs(
|
||||
data,
|
||||
fileName + "_export_" + new Date().getTime() + EXCEL_EXTENSION
|
||||
);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* this function for download PDF
|
||||
* @param GetallData all data
|
||||
* @param title_list header and property list
|
||||
* @param file_name file name
|
||||
*/
|
||||
public exportPdf(GetallData, title_list, file_name) {
|
||||
let bookResultResp = GetallData.map(el => {
|
||||
let data_Array = [];
|
||||
title_list.forEach(title => data_Array.push(el[title.field]))
|
||||
return data_Array
|
||||
});
|
||||
let key_Array = [];
|
||||
title_list.forEach(title => key_Array.push(title.header))
|
||||
const head = [key_Array]
|
||||
const doc = new jsPDF("l", "ex", [100, 280]);
|
||||
autoTable(doc, {
|
||||
head: head,
|
||||
body: bookResultResp,
|
||||
didDrawCell: (bookResultResp) => { },
|
||||
});
|
||||
doc.save(file_name);
|
||||
}
|
||||
// ---------------------------------------------- amount Formater ----------------------------------------------
|
||||
/**
|
||||
*
|
||||
* @param amount
|
||||
* @param amountFormat
|
||||
* @param amountFormatDecimalSpliter
|
||||
* @returns
|
||||
*/
|
||||
public amountFormater(amount, amountFormat, amountFormatDecimalSpliter) {
|
||||
amountFormat = amountFormat != null && amountFormat != '' ? amountFormat : '#,###,###,###.##';
|
||||
amountFormatDecimalSpliter = amountFormatDecimalSpliter != null && amountFormatDecimalSpliter != '' ? amountFormatDecimalSpliter : '.';
|
||||
let outputAmount = amount;
|
||||
let splitAmount = amount.toString().split('.');
|
||||
let splitAmountFormat = amountFormat
|
||||
.toString()
|
||||
.split(amountFormatDecimalSpliter);
|
||||
let amountSplitList =
|
||||
splitAmount != null && splitAmount.length > 0
|
||||
? splitAmount[0].split('').reverse()
|
||||
: [];
|
||||
let decimalAmountSplitList =
|
||||
splitAmount != null && splitAmount.length > 1
|
||||
? splitAmount[1].split('')
|
||||
: [];
|
||||
let amountFormatSplitList =
|
||||
splitAmountFormat != null && splitAmountFormat.length > 0
|
||||
? splitAmountFormat[0].split('').reverse()
|
||||
: [];
|
||||
let decimalAmountFormatSplitList =
|
||||
splitAmountFormat != null && splitAmountFormat.length > 1
|
||||
? splitAmountFormat[1].split('')
|
||||
: [];
|
||||
|
||||
decimalAmountFormatSplitList.forEach((x, index) => {
|
||||
decimalAmountFormatSplitList[index] = decimalAmountSplitList[index]
|
||||
? decimalAmountSplitList[index]
|
||||
: '0';
|
||||
});
|
||||
let amountSplitListTemp = [];
|
||||
let amountIndex = 0;
|
||||
amountFormatSplitList.forEach((x, index) => {
|
||||
if (amountFormatSplitList[index] == '#' && amountSplitList[amountIndex]) {
|
||||
amountSplitListTemp.push(amountSplitList[amountIndex]);
|
||||
amountIndex += 1;
|
||||
} else if (amountSplitList[amountIndex]) {
|
||||
amountSplitListTemp.push(amountFormatSplitList[index]);
|
||||
}
|
||||
});
|
||||
|
||||
if (decimalAmountFormatSplitList && decimalAmountFormatSplitList.length > 0) {
|
||||
outputAmount =
|
||||
amountSplitListTemp.reverse().join('') +
|
||||
amountFormatDecimalSpliter +
|
||||
decimalAmountFormatSplitList.join('');
|
||||
} else {
|
||||
outputAmount =
|
||||
amountSplitListTemp.reverse().join('')
|
||||
}
|
||||
return outputAmount;
|
||||
}
|
||||
// ---------------------------------------------- passsword update functions ---------------------------------------------------------
|
||||
|
||||
// This function for password criteria
|
||||
password_criteria(password_Value) {
|
||||
password_Value.length >= 8 ? this.password_criteria_obj.is_length = true : this.password_criteria_obj.is_length = false;
|
||||
password_Value.match(this.validationService.regExps.lower_case) ? this.password_criteria_obj.is_lowerCase = true : this.password_criteria_obj.is_lowerCase = false;
|
||||
password_Value.match(this.validationService.regExps.Capital_case) ? this.password_criteria_obj.is_Uppercase = true : this.password_criteria_obj.is_Uppercase = false;
|
||||
password_Value.match(this.validationService.regExps.numbers) ? this.password_criteria_obj.is_numbers = true : this.password_criteria_obj.is_numbers = false;
|
||||
password_Value.match(this.validationService.regExps.special_characters) ? this.password_criteria_obj.is_special_characters = true : this.password_criteria_obj.is_special_characters = false;
|
||||
};
|
||||
password_criteria_obj = {
|
||||
is_lowerCase: false,
|
||||
is_Uppercase: false,
|
||||
is_Capital_case: false,
|
||||
is_numbers: false,
|
||||
is_special_characters: false,
|
||||
is_length: false
|
||||
};
|
||||
|
||||
public isFormControlHasError(e, validationType) {
|
||||
let result = e.hasError(validationType) && (e.dirty || e.touched);
|
||||
return result;
|
||||
};
|
||||
|
||||
// for create priority update array of object
|
||||
// createPriorityObj(data, rule) {
|
||||
// return data.map(e => ({ priority: e.priority, [rule]: e[rule] }));
|
||||
// };
|
||||
// /**
|
||||
// * Updates the priority and sets the 'is_change' flag for an element in the given list
|
||||
// * based on a specified rule identifier property.
|
||||
// *
|
||||
// * @param listToUpdate - The array of objects
|
||||
// * @param targetRuleId - The value of the rule identifier to find the target element.
|
||||
// * @param newPriority - The new priority value to set.
|
||||
// * @param ruleIdProperty - The property name representing the rule identifier in each object.
|
||||
// */
|
||||
// updatePriorityByRuleId(listToUpdate, targetRuleId, newPriority, ruleIdProperty) {
|
||||
// if (newPriority !== "") {
|
||||
// const targetElement = listToUpdate.find(item => item[ruleIdProperty] === targetRuleId);
|
||||
// if (targetElement) {
|
||||
// targetElement.is_change = true;
|
||||
// targetElement.priority = parseInt(newPriority);
|
||||
// };
|
||||
// };
|
||||
// };
|
||||
|
||||
// -------------------------------------------------------------Date Formmat function --------------------------------------------------
|
||||
/**
|
||||
* Converts a UTC date to a formatted local time string.
|
||||
* @author Abdul Razzak
|
||||
* @param date
|
||||
* @param format
|
||||
*/
|
||||
UtcToLocaleTime(date, format = 'DD MMM YYYY, HH:mm:ss') {
|
||||
let localeTime = moment.utc(date).local();
|
||||
let formattedTime = localeTime.format(format);
|
||||
return formattedTime;
|
||||
}
|
||||
GetTimeZoneGMT() {
|
||||
let _date = new Date().getTimezoneOffset();
|
||||
return `${((_date / 60) > 0 ? "-" : "+")}${Math.floor(Math.abs(_date / 60))} hours ${Math.abs(_date % 60)} minutes`
|
||||
};
|
||||
|
||||
convertDateToSave(date: Date) {
|
||||
return moment(date).format('YYYY-MM-DD') + 'T00:00:00Z'
|
||||
};
|
||||
convertDateToSaveWithoutTime(date: Date) {
|
||||
return moment(date).format('YYYY-MM-DD')
|
||||
};
|
||||
convertDateWithTimeToShow(date: Date) {
|
||||
return moment(date).format('DD MMM YYYY, HH:mm:ss')
|
||||
};
|
||||
convertDateToShow(date: Date) {
|
||||
return moment(date).format('DD MMM YYYY')
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------- image update function ------------------------------------------------------------
|
||||
/**
|
||||
* for check image file
|
||||
* @param file
|
||||
* @param controls
|
||||
* @param filedata
|
||||
* @author Abdul Razzak
|
||||
*/
|
||||
checkImageFile(file, controls, filedata: FileUpload) {
|
||||
const reader = new FileReader();
|
||||
reader.readAsText(file); // Read as binary data
|
||||
reader.onload = (e) => {
|
||||
const binaryString = e.target.result as string;
|
||||
const hasScriptTag = this.hasScriptTagInBinary(binaryString);
|
||||
if (hasScriptTag) {
|
||||
filedata.clear();
|
||||
this.showMessage(false, 'Invalid file (contains script tag)');
|
||||
} else {
|
||||
controls.setValue(file);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Image script validation
|
||||
* @author Abdul Razzak
|
||||
*/
|
||||
hasScriptTagInBinary(binaryData: string) {
|
||||
// This is a simplified and potentially unreliable approach
|
||||
const scriptTagRegex = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/g;
|
||||
return scriptTagRegex.test(binaryData);
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------ api calls function---------------------------------------------------------
|
||||
GetCurrencyList(val) {
|
||||
if (val.length >= 2 || val == 'ALL') {
|
||||
this.ddLoader.Currency = true;
|
||||
clearTimeout(this.timer);
|
||||
this.timer = setTimeout(() => {
|
||||
let request = {
|
||||
"langcode": "en",
|
||||
"query": val == 'ALL' ? '' : val
|
||||
}
|
||||
this.ApiServ.AdminGoPost(`/MasterSearch/GetAllCurrency`, request).subscribe(res => {
|
||||
if (res) {
|
||||
this.CurrencyList = res?.Result;
|
||||
this.ddLoader.Currency = false;
|
||||
}
|
||||
});
|
||||
}, 500);
|
||||
};
|
||||
if (!val) {
|
||||
this.CurrencyList = [];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* this function for get standalone feature by code
|
||||
* @param pageId page id
|
||||
*/
|
||||
getFeatures(pageId) {
|
||||
return this.ApiServ.Get("/MenuMasterNew/GetAllFeatureCode/2110180851430030870/" + pageId)
|
||||
}
|
||||
|
||||
getCountryBySearch(val) {
|
||||
if (val.length >= 2) {
|
||||
this.ddLoader.country = true;
|
||||
clearTimeout(this.timer);
|
||||
this.timer = setTimeout(() => {
|
||||
this.ApiServ.AdminGet(`/MasterSearch/GetAllCountry/en/` + val).subscribe(res => {
|
||||
if (res) {
|
||||
this.CountryList = res;
|
||||
this.ddLoader.country = false;
|
||||
}
|
||||
});
|
||||
}, 500);
|
||||
}
|
||||
if (!val) {
|
||||
this.CountryList = [];
|
||||
}
|
||||
};
|
||||
// This function is used for country search by name.
|
||||
|
||||
checkCountryExist = false;
|
||||
getCitySearchByCountryCode(val, country_code) {
|
||||
if (country_code) {
|
||||
this.checkCountryExist = false;
|
||||
if (val.length >= 2) {
|
||||
this.ddLoader.city = true;
|
||||
clearTimeout(this.timer);
|
||||
this.timer = setTimeout(() => {
|
||||
this.ApiServ.AdminGet(`/MasterSearch/GetCitySearch/en/${country_code}/` + val).subscribe(res => {
|
||||
if (res) {
|
||||
this.CityList = res;
|
||||
this.ddLoader.city = false;
|
||||
}
|
||||
});
|
||||
}, 500);
|
||||
}
|
||||
if (!val) {
|
||||
this.CityList = [];
|
||||
}
|
||||
} else this.checkCountryExist = true;
|
||||
};
|
||||
ExtranetVendorMaster(val, check) {
|
||||
if (val.length >= 2) {
|
||||
this.ddLoader.vendor = true;
|
||||
clearTimeout(this.timer);
|
||||
this.timer = setTimeout(() => {
|
||||
this.FetchExtranetVendorMaster(val, check)
|
||||
}, 500);
|
||||
}
|
||||
if (!val) {
|
||||
this.AllVendor = [];
|
||||
}
|
||||
};
|
||||
|
||||
FetchExtranetVendorMaster(val, check) {
|
||||
let searchObj = {
|
||||
vendor_name: check ? val : '',
|
||||
extranet_vendor_id: !check ? val : '',
|
||||
};
|
||||
return this.ApiServ.AdminGoPost('/ExtranetVendorMaster/GetAll', searchObj)
|
||||
};
|
||||
loginOut() {
|
||||
let loginData = sessionStorage.getItem('IP');
|
||||
this.LoginUserData = JSON.parse(securityFunctions.getSessionStorage('LoginUserData'));
|
||||
try {
|
||||
let userLogModel = new UserLog();
|
||||
userLogModel.ip = loginData['iP'];
|
||||
userLogModel.ip_city = loginData['city'];
|
||||
userLogModel.ip_country_code = loginData['countryCode'];
|
||||
userLogModel.ip_lat = loginData['lat'];
|
||||
userLogModel.ip_lon = loginData['lon'];
|
||||
userLogModel.ip_proxy = loginData['proxy'];
|
||||
userLogModel.user_id = this.LoginUserData.user_id;
|
||||
userLogModel.user_type = this.LoginUserData.user_type;
|
||||
this.ApiServ.AdminPost("/Log/SaveLogoutLog", userLogModel).subscribe(d => {
|
||||
securityFunctions.resetSessionStoage('lastLogin')
|
||||
securityFunctions.resetSessionStoage('LoginUserData')
|
||||
securityFunctions.resetSessionStoage('IP')
|
||||
securityFunctions.resetSessionStoage('userName')
|
||||
securityFunctions.resetSessionStoage('JwtToken')
|
||||
securityFunctions.resetSessionStoage('RefreshToken')
|
||||
securityFunctions.resetSessionStoage('JwtTokenExpiry')
|
||||
sessionStorage.removeItem('selMenu');
|
||||
window.location.href = '/Auth/Login';
|
||||
});
|
||||
} catch (error) {
|
||||
window.location.href = '/Auth/Login';
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
displayPosition = false;
|
||||
position: string;
|
||||
public subscription: Subscription;
|
||||
remainingTime: number;
|
||||
StartTimer() {
|
||||
const source = interval(1000);
|
||||
// Subscribe to the interval observable
|
||||
this.subscription = source.subscribe(() => {
|
||||
// Get the current time in milliseconds
|
||||
const currentTime = moment.utc(this.ApiServ.getAdjustedLocalTime()).valueOf();
|
||||
const LastEndpointCallTime = moment.utc(sessionStorage.getItem('LastEndpointCallTime')).valueOf();
|
||||
// Get the token expiry time from sessionStorage
|
||||
const tokenExpiry = moment.utc(sessionStorage.getItem('JwtTokenExpiry'));
|
||||
// Calculate the time difference between token expiry and current time in milliseconds
|
||||
const timeDifference = tokenExpiry.valueOf() - currentTime;
|
||||
// Calculate the diffence between current time and the last endpoint call time.
|
||||
const diff_between_endpoint_call = currentTime - LastEndpointCallTime
|
||||
|
||||
// Check if time difference is less than or equal to 2 minutes (120000 milliseconds)
|
||||
if (timeDifference <= 120000) {
|
||||
if (this.displayPosition && this.remainingTime <= 0) {
|
||||
this.exit();
|
||||
} else {
|
||||
if (diff_between_endpoint_call >= 780000) {
|
||||
// If excd is not set and displayPosition is not already true, set displayPosition to true
|
||||
if (!sessionStorage.getItem('excd') && !this.displayPosition) {
|
||||
this.displayPosition = true;
|
||||
}
|
||||
|
||||
// Calculate remaining time in seconds
|
||||
const remainingTimeSeconds = tokenExpiry.diff(moment.utc(this.ApiServ.getAdjustedLocalTime()), 'seconds');
|
||||
// Update remainingTime property
|
||||
this.remainingTime = remainingTimeSeconds;
|
||||
// If remaining time is less than or equal to 0, call exit function
|
||||
if (this.remainingTime <= 0) {
|
||||
this.exit();
|
||||
}
|
||||
} else {
|
||||
this.extendJWTTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
exit() {
|
||||
this.displayPosition = false;
|
||||
sessionStorage.removeItem('excd');
|
||||
this.loginOut();
|
||||
};
|
||||
extendJWTTime() {
|
||||
this.stopTimer();
|
||||
let postdata = {
|
||||
"JwtToken": sessionStorage.getItem('JwtToken'),
|
||||
"RefreshToken": sessionStorage.getItem('RefreshToken')
|
||||
};
|
||||
this.ApiServ.AdminPost('/JWT/RefreshToken', postdata).subscribe(res => {
|
||||
if (!res.Status) {
|
||||
this.loginOut();
|
||||
} else {
|
||||
sessionStorage.setItem('JwtToken', res.JwtToken);
|
||||
sessionStorage.setItem('RefreshToken', res.RefreshToken);
|
||||
sessionStorage.setItem('JwtTokenExpiry', res.JwtTokenExpiry);
|
||||
sessionStorage.setItem('RefreshTokenExpireAt', res.RefreshTokenExpireAt);
|
||||
this.Close(true);
|
||||
this.StartTimer();
|
||||
}
|
||||
})
|
||||
};
|
||||
stopTimer() {
|
||||
if (this.subscription) {
|
||||
this.subscription.unsubscribe();
|
||||
this.subscription = undefined;
|
||||
}
|
||||
};
|
||||
Close(check) {
|
||||
this.displayPosition = false;
|
||||
sessionStorage.setItem('excd', 'OK')
|
||||
if (check) {
|
||||
setTimeout(function () {
|
||||
sessionStorage.removeItem('excd');
|
||||
}, 10000); // 10000 milliseconds = 10 second
|
||||
}
|
||||
}
|
||||
AffiliateDetails(value, target, check, agencytype?, is_active?, is_cug?) {
|
||||
let obj = {
|
||||
AgencyId: check ? value : null,
|
||||
AgencyName: !check ? value : ''
|
||||
}
|
||||
if (value.length >= 3) {
|
||||
this.ddLoader[target] = true;
|
||||
clearTimeout(this.timer);
|
||||
this.timer = setTimeout(() => {
|
||||
this.ApiServ.PostGo(`/AgencyDetail/GetAllAffiliateDetail`, obj).subscribe(res => {
|
||||
if (res) {
|
||||
this.agencyData = res.result;
|
||||
if (agencytype) {
|
||||
if (agencytype == '211526104324609556' || agencytype == '211526104324609557') {
|
||||
if (agencytype == '211526104324609556') this.agencyData = this.agencyData.filter(z => z.AgencyType == 'B2C');
|
||||
if (agencytype == '211526104324609557') this.agencyData = this.agencyData.filter(z => z.AgencyType == 'B2B');
|
||||
}
|
||||
else this.agencyData = this.agencyData.filter(z => z.AgencyType == agencytype);
|
||||
};
|
||||
if(is_active) this.agencyData = res.result.filter(z => z.AgencyType == 'B2B' && z.IsActive);
|
||||
if(is_cug) this.agencyData = res.result.filter(z => (z.AgencyType === "B2B" || z.is_cug) && z.IsActive);
|
||||
if(!is_active && is_cug) this.agencyData = res.result.filter(z => (z.AgencyType === "B2B" || z.is_cug));
|
||||
this.ddLoader[target] = false;
|
||||
}
|
||||
});
|
||||
}, 500);
|
||||
} else {
|
||||
this.agencyData = [];
|
||||
}
|
||||
}
|
||||
public amountDefiner(amount, definer) {
|
||||
let outputAmount = amount;
|
||||
let splitAmount = amount.toString().split(".");
|
||||
if (splitAmount.length > 1 && splitAmount[1].length > 0) {
|
||||
let decimals = splitAmount[1].substr(0, definer);
|
||||
outputAmount = parseFloat(decimals.length > 0 ? `${splitAmount[0]}.${decimals}` : amount).toFixed(definer);
|
||||
} else {
|
||||
outputAmount = parseFloat(`${splitAmount[0]}.0}`).toFixed(definer)
|
||||
}
|
||||
return outputAmount;
|
||||
}
|
||||
|
||||
getHeaderSize(logoElem) {
|
||||
const logo = logoElem.nativeElement;
|
||||
let header_height = 0;
|
||||
if (logo) {
|
||||
header_height = logo.clientHeight;
|
||||
}
|
||||
return header_height;
|
||||
}
|
||||
|
||||
CheckActiveTabMenus(menulist){
|
||||
this.AllMenu = menulist;
|
||||
Object.keys(this.MenuTabList).forEach(e=>{
|
||||
const Menu = menulist.find(d=>d.page_data.includes(this.MenuTabList[e].link));
|
||||
if(Menu){
|
||||
this.MenuTabList[e].val = true;
|
||||
this.MenuTabList[e].Download = Menu.permission.Download;
|
||||
this.MenuTabList[e].IsActive = Menu.permission.Status;
|
||||
}
|
||||
});
|
||||
this.onRouteChange();
|
||||
this.router.events
|
||||
.pipe(filter(event => event instanceof NavigationEnd)) // Filter to get NavigationEnd event
|
||||
.subscribe(() => {
|
||||
this.onRouteChange(); // Trigger your function
|
||||
});
|
||||
|
||||
}
|
||||
onRouteChange(): void {
|
||||
const currentUrl = this.router.url;
|
||||
const currentUrlMenu = this.AllMenu.find(d=>{
|
||||
if(d.page_data){
|
||||
const page_data = JSON.parse(d.page_data);
|
||||
return page_data.some(e=>currentUrl.includes(e.page_url.replaceAll('/$','')))
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if(currentUrlMenu){
|
||||
this.DownloadFilesAllowed = currentUrlMenu.permission.Download;
|
||||
this.ChangeStatusAllowed = currentUrlMenu.permission.Status;
|
||||
}
|
||||
}
|
||||
}
|
||||
264
src/app/core/common/intercept-loader.service.ts
Normal file
264
src/app/core/common/intercept-loader.service.ts
Normal file
@@ -0,0 +1,264 @@
|
||||
import { HttpHandler, HttpRequest, HttpResponse } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable, Subject, throwError } from 'rxjs';
|
||||
import { catchError, exhaustMap, finalize, take } from 'rxjs/operators';
|
||||
import * as moment from 'moment';
|
||||
import { MessageService } from 'primeng/api';
|
||||
import { LoaderService } from './loader.service';
|
||||
import { API } from '../services/api.service';
|
||||
import { securityFunctions } from './security';
|
||||
import { UserLog } from '../models/common-model/user-logout.model';
|
||||
import { UserLoginData } from '../models/common-model/userModel';
|
||||
import { CommonFunctionService } from './common-function.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class InterceptLoader {
|
||||
private readonly requests: HttpRequest<any>[] = [];
|
||||
LoginUserData: UserLoginData
|
||||
constructor(
|
||||
private readonly loaderService: LoaderService,
|
||||
private readonly apiServ: API,
|
||||
public MsgService: MessageService,
|
||||
private readonly commonService: CommonFunctionService) {
|
||||
}
|
||||
|
||||
removeRequest(req: HttpRequest<any>) {
|
||||
const i = this.requests.indexOf(req);
|
||||
if (i >= 0) {
|
||||
this.requests.splice(i, 1);
|
||||
}
|
||||
if (!req.url.includes('RetryInvoice') && !req.url.includes('invoice/GetCustomer') && !req.url.includes('UserMachine/CheckUserVerified')) {
|
||||
this.loaderService.isLoading.next(this.requests.length > 0);
|
||||
}
|
||||
}
|
||||
private readonly refreshToken$ = new Subject<void>();
|
||||
private refreshInProgress = false;
|
||||
intercept(req: HttpRequest<any>, next: HttpHandler) {
|
||||
const modifiedRequest = this.headerSetup(req);
|
||||
const adjustedTime = this.apiServ.getAdjustedLocalTime(); // Get adjusted local time
|
||||
const currentISOString = moment.utc(adjustedTime).format('YYYY-MM-DD HH:mm:ss');
|
||||
const time1 = moment.utc(sessionStorage.getItem('JwtTokenExpiry')).subtract(3, 'seconds').format('YYYY-MM-DD HH:mm:ss');
|
||||
const isTime1AfterTime2 = this.isTime1AfterTime2(time1, currentISOString);
|
||||
const isRefreshTokenUrl = req.url.toLowerCase().includes('/jwt/refreshtoken');
|
||||
const isLogoutLogUrl = req.url.toLowerCase().includes('/log/savelogoutlog');
|
||||
let UGT = sessionStorage.getItem('UGT');
|
||||
const isServerUTCTimeUrl = req.url.includes('/Server/GetServerUTCTime');
|
||||
if (((isTime1AfterTime2) && !isRefreshTokenUrl && !isLogoutLogUrl) || (!UGT && !isServerUTCTimeUrl)) {
|
||||
// If a token refresh is in progress, wait for it to complete before proceeding
|
||||
if (this.refreshInProgress) {
|
||||
return this.refreshToken$.pipe(
|
||||
take(1),
|
||||
exhaustMap(() => {
|
||||
const modifiedRequest = this.headerSetup(req);
|
||||
this.requests.push(modifiedRequest);
|
||||
if (!req.url.includes('RetryInvoice') && !req.url.includes('invoice/GetCustomer') && !req.url.includes('UserMachine/CheckUserVerified')) {
|
||||
this.loaderService.isLoading.next(true);
|
||||
}
|
||||
return this.ObservableReturn(modifiedRequest, next)
|
||||
})
|
||||
);
|
||||
}
|
||||
// Trigger token refresh and queue other requests
|
||||
this.refreshInProgress = true;
|
||||
this.refreshToken$.next();
|
||||
if (!UGT && !isServerUTCTimeUrl) {
|
||||
return this.GetServerTime(req, next);
|
||||
} else {
|
||||
return this.GetJWTToKen(req, next);
|
||||
}
|
||||
} else {
|
||||
this.requests.push(modifiedRequest);
|
||||
if (!req.url.includes('RetryInvoice') && !req.url.includes('invoice/GetCustomer') && !req.url.includes('UserMachine/CheckUserVerified')) {
|
||||
this.loaderService.isLoading.next(true);
|
||||
}
|
||||
return this.ObservableReturn(modifiedRequest, next);
|
||||
}
|
||||
}
|
||||
|
||||
isTime1AfterTime2(time1, time2) {
|
||||
const date1 = new Date(time1); // Create a Date object for time1
|
||||
const date2 = new Date(time2); // Create a Date object for time2
|
||||
return date1 < date2 ? true : false; // Compare the two Date objects
|
||||
}
|
||||
|
||||
ObservableReturn(req, next) {
|
||||
return Observable.create(observer => {
|
||||
const subscription = next.handle(req).subscribe(
|
||||
event => {
|
||||
if (event instanceof HttpResponse) {
|
||||
|
||||
this.removeRequest(req);
|
||||
observer.next(event);
|
||||
|
||||
}
|
||||
},
|
||||
err => {
|
||||
if (err.status === 401) {
|
||||
// Response status is 401, so you can run your function here
|
||||
const customResponse = err; // Pass the response to your function
|
||||
// updated by Abdul Razzak on 23 mar 2024
|
||||
if (err.url.toLowerCase().includes('/log/savelogoutlog')) {
|
||||
window.location.href = '/Auth/Login';
|
||||
} else {
|
||||
this.handleUnauthorizedResponse(customResponse.error); // Replace this with your actual function
|
||||
}
|
||||
this.removeRequest(req);
|
||||
} else if (err.status === 429) {
|
||||
this.MsgService.add({
|
||||
severity: "error",
|
||||
detail: err.error["metadata"]?.message ? err.error["metadata"]?.message : 'Service is currently unavailable',
|
||||
});
|
||||
this.removeRequest(req);
|
||||
} else {
|
||||
this.removeRequest(req);
|
||||
console.log('error' + err);
|
||||
observer.error(err);
|
||||
}
|
||||
},
|
||||
() => {
|
||||
this.removeRequest(req);
|
||||
observer.complete();
|
||||
});
|
||||
// remove request from queue when cancelled
|
||||
return () => {
|
||||
this.removeRequest(req);
|
||||
subscription.unsubscribe();
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
handleUnauthorizedResponse(Response) {
|
||||
if (Response.AuthResponseType == 2 || Response.AuthResponseType == 1 || Response.AuthResponseType == 4 || Response.AuthResponseType == 5 || Response.AuthResponseType == 6 || Response.AuthResponseType == 7 || Response.AuthResponseType == 8) {
|
||||
this.loginOut();
|
||||
}
|
||||
if (Response.AuthResponseType == 3) {
|
||||
this.MsgService.add({
|
||||
severity: "error",
|
||||
detail: Response["message"],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
loginOut() {
|
||||
let loginData = sessionStorage.getItem('IP');
|
||||
let LoginUserData = JSON.parse(securityFunctions.getSessionStorage('LoginUserData'));
|
||||
try {
|
||||
let userLogModel = new UserLog();
|
||||
userLogModel.ip = loginData['iP'];
|
||||
userLogModel.ip_city = loginData['city'];
|
||||
userLogModel.ip_country_code = loginData['countryCode'];
|
||||
userLogModel.ip_lat = loginData['lat'];
|
||||
userLogModel.ip_lon = loginData['lon'];
|
||||
userLogModel.ip_proxy = loginData['proxy'];
|
||||
userLogModel.user_id = LoginUserData.user_id;
|
||||
userLogModel.user_type = LoginUserData.user_type;
|
||||
this.apiServ.AdminPost("/Log/SaveLogoutLog", userLogModel).subscribe(d => {
|
||||
securityFunctions.resetSessionStoage('lastLogin')
|
||||
securityFunctions.resetSessionStoage('LoginUserData')
|
||||
securityFunctions.resetSessionStoage('IP')
|
||||
securityFunctions.resetSessionStoage('userName')
|
||||
securityFunctions.resetSessionStoage('userType')
|
||||
securityFunctions.resetSessionStoage('JwtToken')
|
||||
securityFunctions.resetSessionStoage('RefreshToken')
|
||||
securityFunctions.resetSessionStoage('JwtTokenExpiry')
|
||||
sessionStorage.removeItem('selMenu');
|
||||
window.location.href = '/Auth/Login';
|
||||
});
|
||||
} catch (error) {
|
||||
window.location.href = '/Auth/Login';
|
||||
}
|
||||
}
|
||||
GetJWTToKen(req,next) {
|
||||
let postdata = {
|
||||
"JwtToken": sessionStorage.getItem('JwtToken'),
|
||||
"RefreshToken": sessionStorage.getItem('RefreshToken')
|
||||
};
|
||||
return this.apiServ.AdminPost('/JWT/RefreshToken', postdata).pipe(
|
||||
catchError((error) => {
|
||||
// return throwError(error);
|
||||
if (error.status === 401) {
|
||||
// Response status is 401, so you can run your function here
|
||||
const customResponse = error; // Pass the response to your function
|
||||
// updated by Abdul Razzak on 04 apr 2024
|
||||
this.handleUnauthorizedResponse(customResponse.error); // Replace this with your actual function
|
||||
this.removeRequest(req);
|
||||
return throwError(error);
|
||||
} else {
|
||||
console.log('Error:', error);
|
||||
this.removeRequest(req);
|
||||
return throwError(error);
|
||||
}
|
||||
}),
|
||||
finalize(() => {
|
||||
this.refreshInProgress = false;
|
||||
this.refreshToken$.next(); // Signal completion of token refresh
|
||||
}),
|
||||
exhaustMap((res: any) => {
|
||||
if (!res.Status) {
|
||||
this.loginOut();
|
||||
const modifiedRequest = this.headerSetup(req);
|
||||
this.requests.push(modifiedRequest);
|
||||
} else {
|
||||
sessionStorage.setItem('JwtToken', res.JwtToken);
|
||||
sessionStorage.setItem('RefreshToken', res.RefreshToken);
|
||||
sessionStorage.setItem('JwtTokenExpiry', res.JwtTokenExpiry);
|
||||
const modifiedRequest = this.headerSetup(req);
|
||||
if (!req.url.includes('RetryInvoice') && !req.url.includes('invoice/GetCustomer') && !req.url.includes('UserMachine/CheckUserVerified') && !req.url.toLowerCase().includes('/jwt/refreshtoken')) {
|
||||
this.loaderService.isLoading.next(true);
|
||||
}
|
||||
this.commonService.StartTimer();
|
||||
return this.ObservableReturn(modifiedRequest, next);
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
GetServerTime(req, next) {
|
||||
return this.apiServ.GetGo('/Server/GetServerUTCTime').pipe(
|
||||
catchError((error) => {
|
||||
console.log('Error:', error);
|
||||
this.removeRequest(req);
|
||||
return throwError(error);
|
||||
}),
|
||||
finalize(() => {
|
||||
this.refreshInProgress = false;
|
||||
this.refreshToken$.next(); // Signal completion of token refresh
|
||||
}),
|
||||
exhaustMap((res) => {
|
||||
this.SetuserLocalGapTime(res)
|
||||
this.loaderService.isLoading.next(true);
|
||||
let modifiedRequest = this.headerSetup(req);
|
||||
return this.ObservableReturn(modifiedRequest, next);
|
||||
})
|
||||
);
|
||||
};
|
||||
SetuserLocalGapTime(data) {
|
||||
let gaptime = data.server_utc_time - new Date().getTime();
|
||||
sessionStorage.setItem('UGT', gaptime.toString());
|
||||
}
|
||||
|
||||
headerSetup(req) {
|
||||
this.LoginUserData = securityFunctions.getSessionStorage('LoginUserData') ? JSON.parse(securityFunctions.getSessionStorage('LoginUserData')) : '';
|
||||
// let domain = document.location.host
|
||||
let domain = 'extranet.dev.futuretravelplatform.com'
|
||||
let domainName = domain.replace(/^(https?:\/\/)?/, '');
|
||||
const adjustedTime = this.apiServ.getAdjustedLocalTime(); // Get adjusted local time
|
||||
// Handle vendor id in token
|
||||
// Don't remove '~' as there was a length undefined in the API to get vendor id
|
||||
let domain_time = domainName + '~' + adjustedTime + '~' + '' + '~' + '' + '~' + '' + '~' + (this.LoginUserData ? this.LoginUserData.extranet_vendor_id : '');
|
||||
let key = securityFunctions.rsa_public_key;
|
||||
let encrypted_string = securityFunctions.encryptRSA(key, domain_time).toString();
|
||||
if (!req.url.toLowerCase().includes('/jwt/refreshtoken')) {
|
||||
sessionStorage.setItem('LastEndpointCallTime', moment.utc(adjustedTime).format('YYYY-MM-DD HH:mm:ss'));
|
||||
}
|
||||
return req.clone({
|
||||
setHeaders: {
|
||||
'Authorization': 'Bearer ' + sessionStorage.getItem('JwtToken'),
|
||||
'token': encrypted_string
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
11
src/app/core/common/loader.service.ts
Normal file
11
src/app/core/common/loader.service.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class LoaderService {
|
||||
|
||||
public isLoading = new BehaviorSubject(false);
|
||||
constructor() { }
|
||||
}
|
||||
154
src/app/core/common/security.ts
Normal file
154
src/app/core/common/security.ts
Normal file
@@ -0,0 +1,154 @@
|
||||
import * as CryptoJS from 'crypto-js';
|
||||
import { JSEncrypt } from 'jsencrypt';
|
||||
export class securityFunctions {
|
||||
|
||||
static yek = "$uPer@dm1n~dI@z7";
|
||||
static sayek = "$uper@dmin~diaZ1"
|
||||
static savi = "$uper@dmin~diaZ1"
|
||||
static rsa_public_key = `-----BEGIN PUBLIC KEY-----
|
||||
MIICITANBgkqhkiG9w0BAQEFAAOCAg4AMIICCQKCAgB0rRSHGZK/FtK15IRfQxtl
|
||||
dN5ToPtfXGzTNBe1vGhow5xqp6BLubMKKPwCj3zOJiAm1Ip1VNqqYxWnaL8ZErBF
|
||||
rErtE0r7kn50QgGgJCpdrWJ4unhaoe1su207d9oY6D6OBH90v1aXA6ZjN7zTJmiq
|
||||
FJZOOTQE6t/XwNAOphq/B6Lcr1iQSQmSqaMozy4OQ4NvIzNTQn5tcs9qJBMsKFeU
|
||||
cSp8VK76JBNEqSuEHNmbV2d/IQ5XAqVUiAs34kH2xWRSbBmy0WK3c3QKGzC1MRWM
|
||||
9JauLN56TKUFOmUSjfWY3caJru6HxsiMTGKnvflXHfgA2aLAPxu72pIHoCTy5Hxj
|
||||
AUoKM7qXUn/kQj4Ci0M/0LRF4boqd37wpbyVNeXNvqm+dLjxklf/+NHMfNL2Wvb4
|
||||
ekHUVI8nMVPgswIcQ7q/Njf9DC+LA+/duf8m9JDjI3J6r9y1gQugdkLETGzF2Gj1
|
||||
ToU0Pocrg6CFHImqq2z+cOeWnURrV0f0I1UWWGCb79OZxZ5oDjM9uCLRsoe8+Npg
|
||||
ACZNf4AbnM7OUNj5TEYs6t/tUYouvTB7gH452I3EH6KWBl+ZTgCg0RFkOMazNOjn
|
||||
4J0yfbaPvpVgKzF2WRyn63mTO2tdLRl5s9uqMFhXmCs6IzEqBpxMKL1aS6ONZLDG
|
||||
5qPtpCPJnUFQEBTVlSO15QIDAQAB
|
||||
-----END PUBLIC KEY-----`
|
||||
/**
|
||||
* encrypting text using cryptoJS with 128/8 key size
|
||||
* used CBC mode
|
||||
* used Pkcs7 padding
|
||||
* returning encrypted text
|
||||
* @param plainText text to be encrypted
|
||||
*/
|
||||
//encrypt text using AES
|
||||
public static encryptText(plainText) {
|
||||
var key = CryptoJS.enc.Utf8.parse(this.yek);
|
||||
var iv = CryptoJS.enc.Utf8.parse(this.yek);
|
||||
|
||||
var encryptedText = CryptoJS.AES.encrypt(CryptoJS.enc.Utf8.parse(plainText), key,
|
||||
{
|
||||
keySize: 128 / 8,
|
||||
iv: iv,
|
||||
mode: CryptoJS.mode.CBC,
|
||||
padding: CryptoJS.pad.Pkcs7
|
||||
}).toString();
|
||||
return encryptedText;
|
||||
}
|
||||
|
||||
/**
|
||||
* decryption method for decrypt text that was decrypted in encrypt text method
|
||||
* @param cipherText text to be encrypt
|
||||
*/
|
||||
//decrypt cypher text using AES
|
||||
public static decryptText(cipherText) {
|
||||
var key = CryptoJS.enc.Utf8.parse(this.yek);
|
||||
var iv = CryptoJS.enc.Utf8.parse(this.yek);
|
||||
|
||||
var decryptedText = CryptoJS.AES.decrypt(cipherText, key,
|
||||
{
|
||||
keySize: 128 / 8,
|
||||
iv: iv,
|
||||
mode: CryptoJS.mode.CBC,
|
||||
padding: CryptoJS.pad.Pkcs7
|
||||
}).toString(CryptoJS.enc.Utf8);
|
||||
return decryptedText;
|
||||
}
|
||||
|
||||
public static setLocalStoage(key: string, value) {
|
||||
localStorage.setItem(key, this.encryptText(value));
|
||||
}
|
||||
|
||||
public static getLocalStoage(key: string) {
|
||||
var value = localStorage.getItem(key);
|
||||
if (value) {
|
||||
return this.decryptText(value);
|
||||
}
|
||||
}
|
||||
|
||||
public static setSessionStorage(key: string, value) {
|
||||
sessionStorage.setItem(key, this.encryptText(value));
|
||||
}
|
||||
|
||||
public static getSessionStorage(key: string) {
|
||||
var value = sessionStorage.getItem(key);
|
||||
if (value) {
|
||||
return this.decryptText(value);
|
||||
}
|
||||
}
|
||||
public static resetLocalStoage(key: string) {
|
||||
localStorage.removeItem(key);
|
||||
}
|
||||
public static resetSessionStoage(key: string) {
|
||||
sessionStorage.removeItem(key);
|
||||
}
|
||||
public static getSaUrlKey(userId) {
|
||||
var key = CryptoJS.enc.Utf8.parse(this.sayek);
|
||||
var iv = CryptoJS.enc.Utf8.parse(this.savi);
|
||||
|
||||
var encryptedText = CryptoJS.AES.encrypt(CryptoJS.enc.Utf8.parse(userId), key,
|
||||
{
|
||||
keySize: 128 / 8,
|
||||
iv: iv,
|
||||
mode: CryptoJS.mode.CBC,
|
||||
padding: CryptoJS.pad.Pkcs7
|
||||
}).toString();
|
||||
return encryptedText;
|
||||
}
|
||||
|
||||
public static DecryptReq(data) {
|
||||
var key = CryptoJS.enc.Utf8.parse(this.sayek);
|
||||
var iv = CryptoJS.enc.Utf8.parse(this.savi);
|
||||
|
||||
// encrypt data using AES
|
||||
var encrypted = CryptoJS.AES.decrypt(data, key, { iv: iv });
|
||||
|
||||
return encrypted.toString(CryptoJS.enc.Utf8)
|
||||
}
|
||||
|
||||
/**
|
||||
* method to add restrict for priority
|
||||
*
|
||||
*/
|
||||
checkLength(e, input) {
|
||||
const functionalKeys = ['Backspace', 'ArrowRight', 'ArrowLeft'];
|
||||
if (functionalKeys.indexOf(e.key) !== -1) {
|
||||
return;
|
||||
}
|
||||
const keyValue = +e.key;
|
||||
if (isNaN(keyValue)) {
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
let newValue;
|
||||
newValue = input.value + keyValue.toString();
|
||||
if (+newValue > 100 || +newValue == 0 || newValue.length > 3) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
public static EncryptReq(data) {
|
||||
var key = CryptoJS.enc.Utf8.parse(this.sayek);
|
||||
var iv = CryptoJS.enc.Utf8.parse(this.savi);
|
||||
|
||||
// encrypt data using AES
|
||||
var encrypted = CryptoJS.AES.encrypt(data, key, { iv: iv });
|
||||
|
||||
// convert encrypted data to base64 string for transport
|
||||
var encryptedBase64 = encrypted.toString();
|
||||
return encryptedBase64
|
||||
}
|
||||
|
||||
public static encryptRSA(publicKey: string, jsonString: string) {
|
||||
const encryptor = new JSEncrypt();
|
||||
encryptor.setPublicKey(publicKey);
|
||||
|
||||
const encrypted = encryptor.encrypt(jsonString);
|
||||
|
||||
return encrypted;
|
||||
}
|
||||
}
|
||||
269
src/app/core/common/static-data.service.ts
Normal file
269
src/app/core/common/static-data.service.ts
Normal file
@@ -0,0 +1,269 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class StaticDataService {
|
||||
|
||||
ActivityOverViewtab = 0;
|
||||
Hours = [
|
||||
{ id: 0, name: '00' },
|
||||
{ id: 1, name: '01' },
|
||||
{ id: 2, name: '02' },
|
||||
{ id: 3, name: '03' },
|
||||
{ id: 4, name: '04' },
|
||||
{ id: 5, name: '05' },
|
||||
{ id: 6, name: '06' },
|
||||
{ id: 7, name: '07' },
|
||||
{ id: 8, name: '08' },
|
||||
{ id: 9, name: '09' },
|
||||
{ id: 10, name: '10' },
|
||||
{ id: 11, name: '11' },
|
||||
{ id: 12, name: '12' },
|
||||
{ id: 13, name: '13' },
|
||||
{ id: 14, name: '14' },
|
||||
{ id: 15, name: '15' },
|
||||
{ id: 16, name: '16' },
|
||||
{ id: 17, name: '17' },
|
||||
{ id: 18, name: '18' },
|
||||
{ id: 19, name: '19' },
|
||||
{ id: 20, name: '20' },
|
||||
{ id: 21, name: '21' },
|
||||
{ id: 22, name: '22' },
|
||||
{ id: 23, name: '23' },
|
||||
];
|
||||
HoursAndMinutes = [
|
||||
{ hour: '00', minute: '00' },
|
||||
{ hour: '00', minute: '30' },
|
||||
{ hour: '01', minute: '00' },
|
||||
{ hour: '01', minute: '30' },
|
||||
{ hour: '02', minute: '00' },
|
||||
{ hour: '02', minute: '30' },
|
||||
{ hour: '03', minute: '00' },
|
||||
{ hour: '03', minute: '30' },
|
||||
{ hour: '04', minute: '00' },
|
||||
{ hour: '04', minute: '30' },
|
||||
{ hour: '05', minute: '00' },
|
||||
{ hour: '05', minute: '30' },
|
||||
{ hour: '06', minute: '00' },
|
||||
{ hour: '06', minute: '30' },
|
||||
{ hour: '07', minute: '00' },
|
||||
{ hour: '07', minute: '30' },
|
||||
{ hour: '08', minute: '00' },
|
||||
{ hour: '08', minute: '30' },
|
||||
{ hour: '09', minute: '00' },
|
||||
{ hour: '09', minute: '30' },
|
||||
{ hour: '10', minute: '00' },
|
||||
{ hour: '10', minute: '30' },
|
||||
{ hour: '11', minute: '00' },
|
||||
{ hour: '11', minute: '30' },
|
||||
{ hour: '12', minute: '00' },
|
||||
{ hour: '12', minute: '30' },
|
||||
{ hour: '13', minute: '00' },
|
||||
{ hour: '13', minute: '30' },
|
||||
{ hour: '14', minute: '00' },
|
||||
{ hour: '14', minute: '30' },
|
||||
{ hour: '15', minute: '00' },
|
||||
{ hour: '15', minute: '30' },
|
||||
{ hour: '16', minute: '00' },
|
||||
{ hour: '16', minute: '30' },
|
||||
{ hour: '17', minute: '00' },
|
||||
{ hour: '17', minute: '30' },
|
||||
{ hour: '18', minute: '00' },
|
||||
{ hour: '18', minute: '30' },
|
||||
{ hour: '19', minute: '00' },
|
||||
{ hour: '19', minute: '30' },
|
||||
{ hour: '20', minute: '00' },
|
||||
{ hour: '20', minute: '30' },
|
||||
{ hour: '21', minute: '00' },
|
||||
{ hour: '21', minute: '30' },
|
||||
{ hour: '22', minute: '00' },
|
||||
{ hour: '22', minute: '30' },
|
||||
{ hour: '23', minute: '00' },
|
||||
{ hour: '23', minute: '30' },
|
||||
];
|
||||
days = [
|
||||
{ id: 0, name: '00' },
|
||||
{ id: 1, name: '01' },
|
||||
{ id: 2, name: '02' },
|
||||
{ id: 3, name: '03' },
|
||||
{ id: 4, name: '04' },
|
||||
{ id: 5, name: '05' },
|
||||
{ id: 6, name: '06' },
|
||||
{ id: 7, name: '07' },
|
||||
{ id: 8, name: '08' },
|
||||
{ id: 9, name: '09' },
|
||||
{ id: 10, name: '10' },
|
||||
{ id: 11, name: '11' },
|
||||
{ id: 12, name: '12' },
|
||||
{ id: 13, name: '13' },
|
||||
{ id: 14, name: '14' },
|
||||
{ id: 15, name: '15' },
|
||||
{ id: 16, name: '16' },
|
||||
{ id: 17, name: '17' },
|
||||
{ id: 18, name: '18' },
|
||||
{ id: 19, name: '19' },
|
||||
{ id: 20, name: '20' },
|
||||
{ id: 21, name: '21' },
|
||||
{ id: 22, name: '22' },
|
||||
{ id: 23, name: '23' },
|
||||
{ id: 24, name: '24' },
|
||||
{ id: 25, name: '25' },
|
||||
{ id: 26, name: '26' },
|
||||
{ id: 27, name: '27' },
|
||||
{ id: 28, name: '28' },
|
||||
{ id: 29, name: '29' },
|
||||
{ id: 30, name: '30' },
|
||||
{ id: 31, name: '31' }
|
||||
];
|
||||
minutes = [
|
||||
{ id: 0, name: '00' },
|
||||
{ id: 1, name: '01' },
|
||||
{ id: 2, name: '02' },
|
||||
{ id: 3, name: '03' },
|
||||
{ id: 4, name: '04' },
|
||||
{ id: 5, name: '05' },
|
||||
{ id: 6, name: '06' },
|
||||
{ id: 7, name: '07' },
|
||||
{ id: 8, name: '08' },
|
||||
{ id: 9, name: '09' },
|
||||
{ id: 10, name: '10' },
|
||||
{ id: 11, name: '11' },
|
||||
{ id: 12, name: '12' },
|
||||
{ id: 13, name: '13' },
|
||||
{ id: 14, name: '14' },
|
||||
{ id: 15, name: '15' },
|
||||
{ id: 16, name: '16' },
|
||||
{ id: 17, name: '17' },
|
||||
{ id: 18, name: '18' },
|
||||
{ id: 19, name: '19' },
|
||||
{ id: 20, name: '20' },
|
||||
{ id: 21, name: '21' },
|
||||
{ id: 22, name: '22' },
|
||||
{ id: 23, name: '23' },
|
||||
{ id: 24, name: '24' },
|
||||
{ id: 25, name: '25' },
|
||||
{ id: 26, name: '26' },
|
||||
{ id: 27, name: '27' },
|
||||
{ id: 28, name: '28' },
|
||||
{ id: 29, name: '29' },
|
||||
{ id: 30, name: '30' },
|
||||
{ id: 31, name: '31' },
|
||||
{ id: 32, name: '32' },
|
||||
{ id: 33, name: '33' },
|
||||
{ id: 34, name: '34' },
|
||||
{ id: 35, name: '35' },
|
||||
{ id: 36, name: '36' },
|
||||
{ id: 37, name: '37' },
|
||||
{ id: 38, name: '38' },
|
||||
{ id: 39, name: '39' },
|
||||
{ id: 40, name: '40' },
|
||||
{ id: 41, name: '41' },
|
||||
{ id: 42, name: '42' },
|
||||
{ id: 43, name: '43' },
|
||||
{ id: 44, name: '44' },
|
||||
{ id: 45, name: '45' },
|
||||
{ id: 46, name: '46' },
|
||||
{ id: 47, name: '47' },
|
||||
{ id: 48, name: '48' },
|
||||
{ id: 49, name: '49' },
|
||||
{ id: 50, name: '50' },
|
||||
{ id: 51, name: '51' },
|
||||
{ id: 52, name: '52' },
|
||||
{ id: 53, name: '53' },
|
||||
{ id: 54, name: '54' },
|
||||
{ id: 55, name: '55' },
|
||||
{ id: 56, name: '56' },
|
||||
{ id: 57, name: '57' },
|
||||
{ id: 58, name: '58' },
|
||||
{ id: 59, name: '59' },
|
||||
];
|
||||
AtoZ = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
|
||||
WeekDaysList = [
|
||||
{
|
||||
"ItemKey": "MONDAY",
|
||||
"Itemkey2": "Monday",
|
||||
"ItemToDisplay": "Mon",
|
||||
"ItemOrder": 1,
|
||||
},
|
||||
{
|
||||
"ItemKey": "TUESDAY",
|
||||
"Itemkey2": "Tuesday",
|
||||
"ItemToDisplay": "Tue",
|
||||
"ItemOrder": 2,
|
||||
},
|
||||
{
|
||||
"ItemKey": "WEDNESDAY",
|
||||
"Itemkey2": "Wednesday",
|
||||
"ItemToDisplay": "Wed",
|
||||
"ItemOrder": 3,
|
||||
},
|
||||
{
|
||||
"ItemKey": "THURSDAY",
|
||||
"Itemkey2": "Thursday",
|
||||
"ItemToDisplay": "Thu",
|
||||
"ItemOrder": 4,
|
||||
},
|
||||
{
|
||||
"ItemKey": "FRIDAY",
|
||||
"Itemkey2": "Friday",
|
||||
"ItemToDisplay": "Fri",
|
||||
"ItemOrder": 5,
|
||||
},
|
||||
{
|
||||
"ItemKey": "SATURDAY",
|
||||
"Itemkey2": "Saturday",
|
||||
"ItemToDisplay": "Sat",
|
||||
"ItemOrder": 6,
|
||||
},
|
||||
{
|
||||
"ItemKey": "SUNDAY",
|
||||
"Itemkey2": "Sunday",
|
||||
"ItemToDisplay": "Sun",
|
||||
"ItemOrder": 7,
|
||||
}
|
||||
];
|
||||
// flight contract
|
||||
CabinsClassType = [
|
||||
{ value: 'Y', displayName: 'Economy' },
|
||||
{ value: 'W', displayName: 'Premium Economy' },
|
||||
{ value: 'C', displayName: 'Business Class' },
|
||||
{ value: 'F', displayName: 'First Class' },
|
||||
];
|
||||
RefundType = [
|
||||
{ value: 'REFUNDABLE', displayName: 'Refundable' },
|
||||
{ value: 'NONREFUNDABLE', displayName: 'Non-Refundable' },
|
||||
];
|
||||
ConfirmationType = [
|
||||
{ value: 'YES', displayName: 'Instant' },
|
||||
{ value: 'NO', displayName: 'Manual' },
|
||||
];
|
||||
PaxTypes = [
|
||||
{ value: 'A', displayName: 'Adult' },
|
||||
{ value: 'C', displayName: 'Child' },
|
||||
{ value: 'I', displayName: 'Infant' },
|
||||
];
|
||||
AmountType = [
|
||||
{ value: 'FIXED', displayName: 'Fixed' },
|
||||
{ value: 'PERCENTAGE', displayName: 'Percentage' },
|
||||
];
|
||||
BagUnit = [
|
||||
{ value: 'KG', displayName: 'KG' },
|
||||
{ value: 'POUNDS', displayName: 'Pounds' },
|
||||
{ value: 'PIECE', displayName: 'Piece' },
|
||||
{ value: 'TEXT', displayName: 'Text' },
|
||||
];
|
||||
dateType = [
|
||||
{ value: '1', displayName: 'Departure Date' },
|
||||
{ value: '2', displayName: 'Return Date' },
|
||||
];
|
||||
FareTypeApp = [
|
||||
{ value: 'ONEWAY', displayName: 'Oneway Only' },
|
||||
{ value: 'ROUNDTRIP', displayName: 'Roundtrip / Multicity Only' },
|
||||
{ value: 'BOTH', displayName: 'Both' },
|
||||
];
|
||||
Confirmation_Type = [
|
||||
{ value: 'INSTANT', displayName: 'Instant' },
|
||||
{ value: 'MANUAL', displayName: 'Manual' },
|
||||
];
|
||||
}
|
||||
156
src/app/core/common/validation.service.ts
Normal file
156
src/app/core/common/validation.service.ts
Normal file
@@ -0,0 +1,156 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AbstractControl, FormControl, ValidatorFn, Validators } from '@angular/forms';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
|
||||
export class ValidationService {
|
||||
regExps = {
|
||||
password: /^[0-9]{6}$/,
|
||||
passwordV2: /(?=.*[!@#$%^&*()_+\-=\[\]{};':"\\|,<>\/?~])(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z]).{8,}/,
|
||||
mobCode: /^[0-9]{2,4}$/,
|
||||
mobNum: /^[0-9]*$/,
|
||||
numbers: /[0-9]/,
|
||||
decimal: /^(0|[1-9.]\d*)(\.\d+)?$/,
|
||||
alpha_numeric: /^[a-zA-Z ]*$/,
|
||||
lower_case: /[a-z]/,
|
||||
Capital_case: /[A-Z]/,
|
||||
special_characters: /[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/,
|
||||
lat_long: /^-?(?=.*\d\.\d)(?!.*\.\d*\.)\d+\.?\d*$/
|
||||
};
|
||||
get email() {
|
||||
return new FormControl('', [Validators.required, Validators.email]);
|
||||
}
|
||||
get email_non_required() {
|
||||
return new FormControl('', [Validators.email]);
|
||||
}
|
||||
get passwordV2() {
|
||||
return new FormControl('', [
|
||||
Validators.required,
|
||||
Validators.pattern(this.regExps['passwordV2']),
|
||||
]);
|
||||
}
|
||||
get passwordV2_non_required() {
|
||||
return new FormControl('', [
|
||||
Validators.required,
|
||||
Validators.pattern(this.regExps['passwordV2']),
|
||||
]);
|
||||
}
|
||||
get password() {
|
||||
return new FormControl('', [
|
||||
Validators.required,
|
||||
Validators.pattern(this.regExps['password']),
|
||||
]);
|
||||
}
|
||||
get password_non_required() {
|
||||
return new FormControl('', [
|
||||
Validators.pattern(this.regExps['password']),
|
||||
]);
|
||||
}
|
||||
get number() {
|
||||
return new FormControl('', [
|
||||
Validators.required,
|
||||
Validators.pattern(this.regExps['mobNum']),
|
||||
]);
|
||||
}
|
||||
get mobNo() {
|
||||
return new FormControl('', [
|
||||
Validators.pattern(this.regExps['mobNum']),
|
||||
Validators.required,
|
||||
]);
|
||||
}
|
||||
get alpha_numeric() {
|
||||
return new FormControl('', [
|
||||
Validators.pattern(this.regExps['alpha_numeric'])
|
||||
]);
|
||||
}
|
||||
get alphaNumericWithReq() {
|
||||
return new FormControl('', [
|
||||
Validators.pattern(this.regExps['alpha_numeric']),
|
||||
Validators.required,
|
||||
]);
|
||||
}
|
||||
get required() {
|
||||
return new FormControl(null, [Validators.required]);
|
||||
}
|
||||
|
||||
get decimal() {
|
||||
return new FormControl('', [
|
||||
Validators.pattern(this.regExps['decimal']),
|
||||
Validators.required,
|
||||
]);
|
||||
}
|
||||
get numreq() {
|
||||
return new FormControl('', [
|
||||
Validators.pattern(this.regExps['mobNum']),
|
||||
Validators.required,
|
||||
]);
|
||||
}
|
||||
get lat_long() {
|
||||
return new FormControl('', [
|
||||
Validators.pattern(this.regExps['lat_long']),
|
||||
Validators.required,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
onBlur(Control, validationType) {
|
||||
return Control.hasError(validationType) && Control.touched;
|
||||
}
|
||||
|
||||
|
||||
getFormArrControls(formArrayName, index, controlName) {
|
||||
return formArrayName.controls[index].controls[controlName];
|
||||
}
|
||||
|
||||
showValidationsMsg(form) {
|
||||
form.markAllAsTouched();
|
||||
}
|
||||
|
||||
prioirtyValidation(alldata) {
|
||||
let message = null
|
||||
let pri_arr = alldata.filter((el, ind) => {
|
||||
return alldata.findIndex(e => e.priority == el.priority) != ind;
|
||||
});
|
||||
let negative_pr = alldata.filter(e => e.priority < 0);
|
||||
let max_pr = alldata.filter(e => e.priority > 100);
|
||||
let zero_pr = alldata.filter(e => e.priority == 0)
|
||||
if (negative_pr.length > 0) {
|
||||
message = "Priority can't be negative"
|
||||
} else if (pri_arr.length > 0) {
|
||||
message = "Priority can't be same"
|
||||
} else if (max_pr.length > 0) {
|
||||
message = "Priority can't be above 100"
|
||||
} else if (zero_pr.length > 0) {
|
||||
message = "Priority can't be 0"
|
||||
}
|
||||
return message
|
||||
}
|
||||
|
||||
|
||||
scrollTo(el: Element): void {
|
||||
if (el) {
|
||||
el.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
}
|
||||
scrollToError(): void {
|
||||
const errorInput = document.querySelector('.ErrorWrapper');
|
||||
const errorspan = document.querySelector('.errorspan');
|
||||
this.scrollTo(errorInput ? errorInput : errorspan);
|
||||
}
|
||||
dateRangeValidation(): ValidatorFn {
|
||||
return (control: AbstractControl): { [key: string]: boolean } | null => {
|
||||
if (control.value) {
|
||||
if (control.value.length <= 1 || control.value[1] == null) {
|
||||
return { 'todate': true };
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
43
src/app/core/guard/auth.guard.ts
Normal file
43
src/app/core/guard/auth.guard.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
// Angular
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from '@angular/router';
|
||||
// RxJS
|
||||
import { Observable } from 'rxjs';
|
||||
import { securityFunctions } from '../common/security';
|
||||
@Injectable()
|
||||
export class AuthGuard implements CanActivate {
|
||||
constructor(
|
||||
private router: Router) { }
|
||||
|
||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | Promise<boolean> | boolean {
|
||||
if (securityFunctions.getSessionStorage('LoginUserData')) {
|
||||
let userdata = securityFunctions.getSessionStorage('LoginUserData') ? JSON.parse(securityFunctions.getSessionStorage('LoginUserData')) : null
|
||||
if (userdata) {
|
||||
if (userdata.user_id) {
|
||||
// let tpinApplicable = sessionStorage.getItem('TpinApplicable') == 'true' ? true : false;
|
||||
// let tpinActivated = sessionStorage.getItem('T_Activated') == 'true' ? true : false;
|
||||
// let tpinExpired = sessionStorage.getItem('T_Expired') == 'true' ? true : false;
|
||||
// if (tpinApplicable) {
|
||||
// if (!tpinActivated || tpinExpired) {
|
||||
// let userId = sessionStorage.getItem('userId')
|
||||
// const now = new Date();
|
||||
// const formattedDate = now.toISOString().slice(0, 19).replace('T', ' ');
|
||||
// let keyVal = securityFunctions.EncryptReq(userId + '~' + formattedDate + '~' + (tpinExpired ? 'expired' : 'create')).trim()
|
||||
// this.router.navigate(['/Login/TPIN'], { queryParams: { key: keyVal } })
|
||||
// return false;
|
||||
// }
|
||||
// else {
|
||||
// return true
|
||||
// }
|
||||
// }
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
window.location.href = '/Auth/Login';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
|
||||
export class ActivityContent {
|
||||
activity_content_id: string | null;
|
||||
org_id: string | null;
|
||||
activity_id: string;
|
||||
supplier_id: string;
|
||||
language_code: string;
|
||||
activity_name: string;
|
||||
departure_point: string;
|
||||
meeting_point: string;
|
||||
drop_point: string;
|
||||
activity_highlight: string;
|
||||
activity_description: string;
|
||||
activity_restriction: string;
|
||||
activities_details: string;
|
||||
activity_inclusion: string;
|
||||
activity_exclusion: string;
|
||||
revision_nbr: number | null;
|
||||
created_by: string | null;
|
||||
created_on: string | null;
|
||||
updated_by: string | null;
|
||||
updated_on: string | null;
|
||||
is_active: boolean;
|
||||
is_deleted: boolean;
|
||||
additional_pick_up_details: string;
|
||||
daywise_itinerary: string;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
export class AllocationItems {
|
||||
activity_allocation_id: string | null;
|
||||
activity_contract_id: string | null;
|
||||
activity_slot_id: string | null;
|
||||
_date: string;
|
||||
allocation_count: number | null;
|
||||
release_days: number | null;
|
||||
_allocation_type: string | null;
|
||||
is_active: boolean;
|
||||
}
|
||||
|
||||
|
||||
export class UpdateAllocation {
|
||||
activity_contract_id: string | null;
|
||||
activity_slot_id: string | null;
|
||||
allocationItems: AllocationItems[];
|
||||
}
|
||||
|
||||
export class AllocationOverview {
|
||||
activity_allocation_id: string | null;
|
||||
activity_contract_id: string | null;
|
||||
activity_slot_id: string | null;
|
||||
_date: string;
|
||||
allocation_count: number | null;
|
||||
release_days: number | null;
|
||||
booking_count: number | null;
|
||||
remaining_count: number | null;
|
||||
_allocation_type: string | null;
|
||||
is_active: boolean;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
export class CancellationDisplay {
|
||||
activity_cancellation_policy_id: string;
|
||||
date: string;
|
||||
_cancellation_policy_type: string;
|
||||
from: number;
|
||||
to: number;
|
||||
_charge_type: string;
|
||||
charge_value: number;
|
||||
}
|
||||
export class GetCancellationPolicy {
|
||||
contract_id: string;
|
||||
from_date: string | null;
|
||||
to_date: string | null;
|
||||
slot_id: string | null;
|
||||
seasonId: string[] | null;
|
||||
days: string | null;
|
||||
}
|
||||
|
||||
|
||||
export class UpdateCancellationPolicy {
|
||||
activity_contract_id: string;
|
||||
_no_show_policy_type: string;
|
||||
no_show_value: number;
|
||||
cancellation_policy: CancellationDisplay[];
|
||||
}
|
||||
|
||||
// export class UpdateCancellationPolicy {
|
||||
// activity_contract_id: string;
|
||||
// cancellation_policy: CancellationDisplay[];
|
||||
// }
|
||||
@@ -0,0 +1,16 @@
|
||||
export class EditActivityContractDetail {
|
||||
contract_id: string;
|
||||
option_name: string;
|
||||
currency_code: string;
|
||||
language_code: string;
|
||||
include_nationality_code: string;
|
||||
exclude_nationality_code: string;
|
||||
_nationality_type: string;
|
||||
is_exclude_nationality: boolean;
|
||||
rate_inclusion: string;
|
||||
contract_remark: string;
|
||||
is_pickup_included: boolean;
|
||||
is_drop_off_included: boolean;
|
||||
is_guide_included: boolean;
|
||||
guide_languages: string;
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
|
||||
|
||||
|
||||
export class ActivityAllContract {
|
||||
activity_id: string;
|
||||
option_name: string | null;
|
||||
is_pickup_included: boolean;
|
||||
is_drop_off_included: boolean;
|
||||
}
|
||||
|
||||
export class GetRateDetails {
|
||||
contract_id: string;
|
||||
slot_id: string | null;
|
||||
from_date: string | null;
|
||||
to_date: string | null;
|
||||
dates: string | null;
|
||||
seasonId: string[] | null;
|
||||
days: string | null;
|
||||
}
|
||||
|
||||
// export class GetTieredRateDetail {
|
||||
// contract_id: string;
|
||||
// slot_id: string;
|
||||
// dates: string;
|
||||
// days: string;
|
||||
// }
|
||||
|
||||
|
||||
export class EditActivityContractRate {
|
||||
activity_contract_id: string;
|
||||
activity_slot_id: string;
|
||||
perPaxPrices: PaxRates[] | null;
|
||||
perVehicleRates: VehicleRates[] | null;
|
||||
tieredPricings: TieredPricingList[] | null;
|
||||
privateTransfer: ActivityPrivateTransfer[] | null;
|
||||
sharedTransfer: ActivitySharedTransfer | null;
|
||||
}
|
||||
export class PaxRates {
|
||||
activity_rate_per_pax_id: string;
|
||||
date: string;
|
||||
adult_rate: number;
|
||||
senior_rate: number;
|
||||
youth_rate: number;
|
||||
child_rate: number;
|
||||
}
|
||||
|
||||
|
||||
export class VehicleRates {
|
||||
activity_rate_per_vehicle_id: string;
|
||||
vehicle_supplier_id: string;
|
||||
vehicle_id: string;
|
||||
vehicle_max_occupancy: string;
|
||||
date: string;
|
||||
rate: number;
|
||||
}
|
||||
|
||||
export class TieredPricingList {
|
||||
id: string;
|
||||
pricing: PaxPricing[];
|
||||
}
|
||||
|
||||
export class PaxPricing {
|
||||
pax_type: string;
|
||||
sequence: number;
|
||||
rate: number;
|
||||
}
|
||||
|
||||
export class ActivityPrivateTransfer {
|
||||
vehicle_id: string;
|
||||
vehicle_occupancy: string;
|
||||
vehicle_supplier_id: string;
|
||||
rate: number;
|
||||
}
|
||||
export class ActivitySharedTransfer {
|
||||
vehicle_supplier_id: string;
|
||||
adult_rate: number;
|
||||
senior_rate: number;
|
||||
youth_rate: number;
|
||||
child_rate: number;
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
|
||||
|
||||
export class SaveActivityContractDetails {
|
||||
activityContract: ActivityContract;
|
||||
activityContractDetails: ActivityDetails[];
|
||||
privateTransfer: ActivityPrivateTransfer[];
|
||||
sharedTransfer: ActivitySharedTransfer;
|
||||
incNationalityCodes: string[] | null;
|
||||
excNationalityCodes: string[] | null;
|
||||
seasonIdsForRateDates: string[] | null;
|
||||
datesForRates: DateRange[];
|
||||
slotDetails: SlotDetails[] | null;
|
||||
activityCancellationDetails: ActivityCancellationDetails[] | null;
|
||||
}
|
||||
|
||||
export class ActivityPrivateTransfer {
|
||||
vehicle_id: string;
|
||||
vehicle_occupancy: string;
|
||||
vehicle_supplier_id: string;
|
||||
rate: number;
|
||||
}
|
||||
export class ActivitySharedTransfer {
|
||||
vehicle_supplier_id: string;
|
||||
adult_rate: number;
|
||||
senior_rate: number;
|
||||
youth_rate: number;
|
||||
child_rate: number;
|
||||
}
|
||||
|
||||
export class Specific {
|
||||
specificTimeSlot: DateRange[];
|
||||
specificSlotRateRange: RateRange;
|
||||
activityPaxRate: ActivityPaxRate;
|
||||
activityVehicleRate: ActivityVehicleRate;
|
||||
}
|
||||
|
||||
export class SlotDetails {
|
||||
slot: Slot[];
|
||||
applicableDays: string;
|
||||
rateRange: RateRange | null;
|
||||
activityPaxRate: ActivityPaxRate | null;
|
||||
activityVehicleRate: ActivityVehicleRate[] | null;
|
||||
activityCancellationDetails: ActivityCancellationDetails[] | null;
|
||||
}
|
||||
export class Slot {
|
||||
slotId: string;
|
||||
is_private_transfer: boolean;
|
||||
is_shared_transfer: boolean;
|
||||
is_without_transfer: boolean;
|
||||
}
|
||||
|
||||
|
||||
export class ActivityContract {
|
||||
activity_contract_id: string | null;
|
||||
org_id: string | null;
|
||||
supplier_id: string;
|
||||
activity_id: string | null;
|
||||
currency_code: string;
|
||||
_nationality_type: string;
|
||||
is_exclude_nationality: boolean;
|
||||
_period_type: string;
|
||||
season_id: string;
|
||||
is_pickup_included: boolean;
|
||||
is_drop_off_included: boolean;
|
||||
is_private_transfer_price_included: boolean;
|
||||
is_shared_transfer_price_included: boolean;
|
||||
is_slot_wise_cancellation_policy: boolean;
|
||||
is_guide_included: boolean;
|
||||
guide_languages: string;
|
||||
_rate_type: string;
|
||||
_pricing_type: string;
|
||||
_no_show_policy_type: string;
|
||||
no_show_charge_value: number;
|
||||
is_approved: boolean;
|
||||
is_rejected: boolean;
|
||||
reviewed_by: string;
|
||||
reviewer_comments: string;
|
||||
reviewer_user_type: string;
|
||||
reviewed_on: string | null;
|
||||
revision_nbr: number | null;
|
||||
created_by: string | null;
|
||||
created_on: string | null;
|
||||
updated_by: string | null;
|
||||
updated_on: string | null;
|
||||
is_active: boolean;
|
||||
is_deleted: boolean;
|
||||
}
|
||||
|
||||
export class ActivityDetails {
|
||||
language_code: string;
|
||||
option_name: string;
|
||||
rate_inclusion: string;
|
||||
contract_remark: string;
|
||||
}
|
||||
export class DateRange {
|
||||
Start: string;
|
||||
End: string;
|
||||
}
|
||||
|
||||
export class AgeRange {
|
||||
from_count: number;
|
||||
to_count: number;
|
||||
sequence: number;
|
||||
rate: number;
|
||||
}
|
||||
|
||||
|
||||
export class RateRange {
|
||||
adultAgeRange: AgeRange[];
|
||||
youthAgeRange: AgeRange[];
|
||||
seniorAgeRange: AgeRange[];
|
||||
childAgeRange: AgeRange[];
|
||||
allocationDetails: AllocationDetails | null;
|
||||
}
|
||||
|
||||
|
||||
export class ActivityPaxRate {
|
||||
date: string;
|
||||
adult_rate: number;
|
||||
senior_rate: number;
|
||||
youth_rate: number;
|
||||
child_rate: number;
|
||||
allocationDetails: AllocationDetails | null;
|
||||
}
|
||||
export class Slots {
|
||||
slotId: string;
|
||||
is_private_transfer: boolean;
|
||||
is_shared_transfer: boolean;
|
||||
is_without_transfer: boolean;
|
||||
}
|
||||
|
||||
export class ActivityVehicleRate {
|
||||
rate: number;
|
||||
vehicle_supplier_id: number;
|
||||
vehicle_id: number;
|
||||
vehicle_max_occupancy: number;
|
||||
allocationDetails: AllocationDetails | null;
|
||||
}
|
||||
|
||||
export class ActivityCancellationDetails {
|
||||
from: number;
|
||||
to: number;
|
||||
CP_Type: string;
|
||||
CP_Value: number;
|
||||
cancellation_Type: string;
|
||||
}
|
||||
|
||||
export class AllocationDetails {
|
||||
_allocation_type: string;
|
||||
allocation_count: number;
|
||||
booking_count: number;
|
||||
vehicle_id: string;
|
||||
remaining_count: number;
|
||||
_release_type: string;
|
||||
date: string;
|
||||
release_days: number;
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
|
||||
export class experience_add {
|
||||
activity_id: string;
|
||||
org_id: string;
|
||||
supplier_id: string;
|
||||
activity_code: number;
|
||||
category_id: string;
|
||||
emergency_phone_code: string;
|
||||
emergency_phone_nbr: string;
|
||||
default_lang_code: string;
|
||||
_service_language: string;
|
||||
service_days: number;
|
||||
service_hours: number;
|
||||
service_minutes: number;
|
||||
starting_city: string;
|
||||
is_pickup_included: boolean;
|
||||
_pickup_point_type: string;
|
||||
_hotel_pickup_type: string;
|
||||
pickup_hotel: string;
|
||||
hotel_zone: string;
|
||||
pickup_before_hour: number;
|
||||
pickup_before_minute: number;
|
||||
meeting_before_hour: number;
|
||||
meeting_before_minute: number;
|
||||
is_drop_included: boolean;
|
||||
min_pax: number;
|
||||
max_pax: number;
|
||||
is_adult: boolean;
|
||||
adult_age_from: number;
|
||||
adult_age_to: number;
|
||||
is_senior: boolean;
|
||||
senior_age_from: number;
|
||||
senior_age_to: number;
|
||||
is_youth: boolean;
|
||||
youth_age_from: number;
|
||||
youth_age_to: number;
|
||||
is_child: boolean;
|
||||
child_age_from: number;
|
||||
child_age_to: number;
|
||||
max_child_count: number;
|
||||
free_child_age_from: number;
|
||||
free_child_age_to: number;
|
||||
is_child_seat: boolean;
|
||||
thumbnail_image: string;
|
||||
activity_images: string;
|
||||
activity_videos: string;
|
||||
requirements: string;
|
||||
revision_nbr: number;
|
||||
created_by: string;
|
||||
created_on: string | null;
|
||||
updated_by: string | null;
|
||||
updated_on: string | null;
|
||||
is_active: boolean | null;
|
||||
is_deleted: boolean | null;
|
||||
category_name: string;
|
||||
sub_category_id: string;
|
||||
country_code: string;
|
||||
city_id: string;
|
||||
activityContents: ActivityContent[];
|
||||
activity_content_json: string;
|
||||
}
|
||||
|
||||
export class ActivityContent {
|
||||
activity_content_id: string;
|
||||
org_id: string;
|
||||
activity_id: string;
|
||||
supplier_id: string;
|
||||
language_code: string;
|
||||
activity_name: string;
|
||||
departure_point: string;
|
||||
meeting_point: string;
|
||||
drop_point: string;
|
||||
activity_highlight: string;
|
||||
activity_description: string;
|
||||
activity_restriction: string;
|
||||
activities_details: string;
|
||||
activity_inclusion: string;
|
||||
activity_exclusion: string;
|
||||
revision_nbr: number;
|
||||
created_by: string;
|
||||
created_on: string;
|
||||
updated_by: string;
|
||||
updated_on: string;
|
||||
is_active: boolean;
|
||||
is_deleted: boolean;
|
||||
additional_pick_up_details: string;
|
||||
daywise_itinerary: string;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
export class ActivitySeasonDetails {
|
||||
activitySeason: ActivitySeason;
|
||||
seasondateRange: ActivitySeasonDateRange[];
|
||||
}
|
||||
|
||||
export class ActivitySeasonDateRange {
|
||||
fromDate: string;
|
||||
toDate: string;
|
||||
}
|
||||
|
||||
export class ActivitySeason {
|
||||
activity_season_id: string;
|
||||
org_id: string;
|
||||
activity_id: string;
|
||||
supplier_id: string;
|
||||
season_name: string;
|
||||
created_by: string;
|
||||
created_on: string;
|
||||
updated_by: string;
|
||||
updated_on: string;
|
||||
is_active: boolean;
|
||||
is_deleted: boolean;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
export class ActivitySlot {
|
||||
activity_slot_id: string;
|
||||
org_id: string;
|
||||
supplier_id: string;
|
||||
activity_id: string;
|
||||
start_time: string;
|
||||
end_time: string;
|
||||
cut_off_time: string | null;
|
||||
timezone: string | null;
|
||||
revision_nbr: number;
|
||||
created_by: string | null;
|
||||
created_on: string | null;
|
||||
updated_by: string | null;
|
||||
updated_on: string | null;
|
||||
is_active: boolean | null;
|
||||
is_deleted: boolean | null;
|
||||
}
|
||||
export class GetActivitySlot {
|
||||
activity_id: string;
|
||||
from_hour: string | null;
|
||||
from_minute: string | null;
|
||||
to_hour: string | null;
|
||||
to_minute: string | null;
|
||||
}
|
||||
58
src/app/core/models/common-model/Sign-in.model.ts
Normal file
58
src/app/core/models/common-model/Sign-in.model.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
export class LoginModel {
|
||||
EmailID: string
|
||||
Password: string
|
||||
domain: string
|
||||
ProjectId: string
|
||||
MachineId: string
|
||||
Platform: string
|
||||
Browser: string
|
||||
City: string
|
||||
CountryCode: string
|
||||
Lat: number
|
||||
Lon: number
|
||||
Proxy: boolean
|
||||
IP: string
|
||||
time: string
|
||||
}
|
||||
|
||||
export class OTPModel {
|
||||
oTP: string;
|
||||
userId: string;
|
||||
city: string;
|
||||
ProjectId: string;
|
||||
countryCode: string;
|
||||
lat: number;
|
||||
lon: number;
|
||||
proxy: boolean;
|
||||
iP: string;
|
||||
platform: string | null;
|
||||
browser: string | null;
|
||||
macId: string | null;
|
||||
}
|
||||
|
||||
export class SSOModel {
|
||||
emailID: string;
|
||||
domain: string;
|
||||
}
|
||||
|
||||
export class dtoKey {
|
||||
key: string;
|
||||
}
|
||||
|
||||
export class agency_data {
|
||||
is_pay_at_agency: boolean;
|
||||
time_zone: string;
|
||||
b2c_agency_code: string;
|
||||
utc: string;
|
||||
pay_at_agency_disclaimer: string;
|
||||
org_id: string;
|
||||
b2c_agency_id: string;
|
||||
project: string;
|
||||
domain: string;
|
||||
is_active: boolean;
|
||||
}
|
||||
export class SSOLoginModel {
|
||||
isSSO: boolean
|
||||
isLoggedIn: boolean
|
||||
token: string
|
||||
}
|
||||
11
src/app/core/models/common-model/user-logout.model.ts
Normal file
11
src/app/core/models/common-model/user-logout.model.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
export class UserLog{
|
||||
user_id:string;
|
||||
user_type:string;
|
||||
IsMFAApplicable:boolean;
|
||||
ip_city:string;
|
||||
ip_country_code:string;
|
||||
ip_lat:number;
|
||||
ip_lon:number;
|
||||
ip_proxy:boolean;
|
||||
ip:string;
|
||||
}
|
||||
66
src/app/core/models/common-model/userModel.ts
Normal file
66
src/app/core/models/common-model/userModel.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
export class changeUserLoginPassword {
|
||||
user_id: string;
|
||||
org_id: string;
|
||||
first_name: string;
|
||||
middle_name: string;
|
||||
last_name: string;
|
||||
user_mobile_country_code: string;
|
||||
user_mobile: string;
|
||||
email: string;
|
||||
password: string;
|
||||
country: string;
|
||||
city: string;
|
||||
user_type: string;
|
||||
affiliate_id: string;
|
||||
affiliate_type: string;
|
||||
user_profile: string;
|
||||
user_role: string;
|
||||
is_active: boolean;
|
||||
created_by: string;
|
||||
updated_by: string;
|
||||
created_on: string;
|
||||
updated_on: string;
|
||||
time_zone: string;
|
||||
}
|
||||
|
||||
export class UserLoginData {
|
||||
user_id: string;
|
||||
org_id: number;
|
||||
first_name: string;
|
||||
middle_name: string;
|
||||
last_name: string;
|
||||
user_mobile_country_code: string;
|
||||
user_mobile: string;
|
||||
email: string;
|
||||
password: string;
|
||||
country: string;
|
||||
city: string;
|
||||
user_type: string;
|
||||
user_profile: string;
|
||||
user_role: string;
|
||||
is_active: boolean;
|
||||
created_on: Date;
|
||||
created_by: string;
|
||||
updated_on: Date;
|
||||
updated_by: string;
|
||||
affiliate_id: number;
|
||||
markup_type: string;
|
||||
is_mfa_applicable: boolean;
|
||||
is_inactive_wrong_attempt: boolean;
|
||||
is_cancel_pnr: boolean;
|
||||
is_cancel_ticketed_pnr: boolean;
|
||||
is_import_pnr_access: boolean;
|
||||
is_allow_void_ticket: boolean;
|
||||
last_log_on: Date;
|
||||
is_password_expired: boolean;
|
||||
is_login_expired: boolean;
|
||||
role_id: number;
|
||||
jwt_token_id: number;
|
||||
refresh_token: string;
|
||||
refresh_token_expire_at: Date;
|
||||
change_default_password: boolean;
|
||||
is_b2b_surcharge: boolean;
|
||||
is_reserve_hotel_booking: boolean;
|
||||
extranet_vendor_id: string;
|
||||
timezone: string;
|
||||
}
|
||||
221
src/app/core/models/flight-service/flight-contracts.model.ts
Normal file
221
src/app/core/models/flight-service/flight-contracts.model.ts
Normal file
@@ -0,0 +1,221 @@
|
||||
|
||||
|
||||
export class FlightContractDTO {
|
||||
contract_id: string | null;
|
||||
org_id: string | null;
|
||||
supplier_id: string;
|
||||
contract_name: string;
|
||||
contract_description: string;
|
||||
pnr: string;
|
||||
is_instant_confirmation: boolean;
|
||||
_trip_type: string;
|
||||
no_of_legs: number;
|
||||
from_airport: string;
|
||||
to_airport: string;
|
||||
is_economy: boolean;
|
||||
is_premium_economy: boolean;
|
||||
is_business: boolean;
|
||||
is_first_class: boolean;
|
||||
is_all_pax_type: boolean;
|
||||
is_adult: boolean;
|
||||
is_child: boolean;
|
||||
is_infant: boolean;
|
||||
currency_code: string;
|
||||
validating_airline: string;
|
||||
is_multi_day: boolean;
|
||||
is_multi_day_range: boolean;
|
||||
outbound_date: string;
|
||||
return_date: string;
|
||||
operation_from: string;
|
||||
operation_to: string;
|
||||
revision_nbr: number | null;
|
||||
created_by: string | null;
|
||||
created_on: string | null;
|
||||
updated_by: string | null;
|
||||
updated_on: string | null;
|
||||
is_active: boolean | null;
|
||||
is_deleted: boolean | null;
|
||||
outbound_days: string | null;
|
||||
outbound_dates: string | null;
|
||||
flightDetail: FlightDetailDto[];
|
||||
flightRate: FlightsRateDto[];
|
||||
}
|
||||
export class FlightsRateDto {
|
||||
rate_id: string | null;
|
||||
org_id: string | null;
|
||||
supplier_id: string | null;
|
||||
contract_id: string | null;
|
||||
contract_date_unique_id: string | null;
|
||||
outbound_date: string;
|
||||
return_date: string;
|
||||
rbd: string;
|
||||
cabin_class: string;
|
||||
adt_base_fare: number;
|
||||
adt_tax: number;
|
||||
chd_base_fare: number;
|
||||
chd_tax: number;
|
||||
inf_base_fare: number;
|
||||
inf_tax: number;
|
||||
seat_allocation: number;
|
||||
seat_booked: number;
|
||||
seat_remaining: number;
|
||||
adt_check_bag: number;
|
||||
chd_check_bag: number;
|
||||
inf_check_bag: number;
|
||||
_check_bag_unit: number;
|
||||
adt_cabin_bag: number;
|
||||
chd_cabin_bag: number;
|
||||
inf_cabin_bag: number;
|
||||
_cabin_bag_unit: number;
|
||||
_fare_type: number;
|
||||
adt_fare_rule: string;
|
||||
chd_fare_rule: string;
|
||||
inf_fare_rule: string;
|
||||
is_meal_included: boolean;
|
||||
meal_details: string;
|
||||
inclusions: string;
|
||||
pnr: string;
|
||||
is_instant_confirmation: boolean;
|
||||
is_stop_sale: boolean;
|
||||
revision_nbr: number | null;
|
||||
created_by: string | null;
|
||||
created_on: string | null;
|
||||
updated_by: string | null;
|
||||
updated_on: string | null;
|
||||
is_active: boolean | null;
|
||||
is_deleted: boolean | null;
|
||||
}
|
||||
//
|
||||
export class FlightContractReq {
|
||||
FlightContract: FlightContracts;
|
||||
FlightDetails: FlightDetailDto[];
|
||||
FlightRates: FlightRateArray[];
|
||||
}
|
||||
export class FlightContracts {
|
||||
contract_name: string;
|
||||
contract_description: string;
|
||||
trip_type: string;
|
||||
origin: string;
|
||||
destination: string;
|
||||
no_of_legs: number;
|
||||
currency_code: string;
|
||||
contracted_cabin_class: string;
|
||||
contracted_pax_type: string;
|
||||
validating_airline: string;
|
||||
is_multi_day: boolean;
|
||||
is_oneway_sale_allowed: boolean;
|
||||
multi_day_operation_type: string;
|
||||
operation_from: string; // Assuming you'll handle date parsing separately
|
||||
operation_to: string; // Assuming you'll handle date parsing separately
|
||||
departure_date: string; // Assuming you'll handle date parsing separately
|
||||
return_date: string; // Assuming you'll handle date parsing separately
|
||||
departure_days: string;
|
||||
departure_dates: string;
|
||||
is_nearby_airports: boolean;
|
||||
is_active: boolean;
|
||||
nearby_from_airports: string;
|
||||
nearby_to_airports: string;
|
||||
is_instant_confirmation: boolean;
|
||||
}
|
||||
|
||||
export class FlightDetailDto {
|
||||
flight_details_id: string | null;
|
||||
org_id: string | null;
|
||||
supplier_id: string | null;
|
||||
contract_id: string | null;
|
||||
airline_code: string;
|
||||
flight_no: string;
|
||||
aircraft_type_id: string;
|
||||
from_airport: string;
|
||||
to_airport: string;
|
||||
departure_date: string;
|
||||
departure_time: string;
|
||||
is_next_day_departure: boolean;
|
||||
departure_terminal: string;
|
||||
is_next_day_arrival: boolean;
|
||||
arrival_date: string;
|
||||
arrival_time: string;
|
||||
arrival_terminal: string;
|
||||
flying_duration: string;
|
||||
sector_nbr: number | null;
|
||||
_sector_type: string;
|
||||
leg_nbr: number;
|
||||
seg_nbr: number;
|
||||
contract_date_unique_id: string | null;
|
||||
revision_nbr: number | null;
|
||||
created_by: string | null;
|
||||
created_on: string | null;
|
||||
updated_by: string | null;
|
||||
updated_on: string | null;
|
||||
is_active: boolean | null;
|
||||
is_deleted: boolean | null;
|
||||
}
|
||||
export class FlightRateArray {
|
||||
rate_id: string;
|
||||
org_id: string;
|
||||
contract_id: string;
|
||||
contract_date_unique_id: string;
|
||||
departure_date: Date;
|
||||
rbd: string;
|
||||
fare_family_group_id: string;
|
||||
fare_family_name: string;
|
||||
cabin_class: string;
|
||||
adt_base_fare: number;
|
||||
adt_tax: number;
|
||||
chd_base_fare: number;
|
||||
chd_tax: number;
|
||||
inf_base_fare: number;
|
||||
inf_tax: number;
|
||||
fare_type_applicability: string;
|
||||
round_trip_discount_type: string;
|
||||
is_apply_discount_with_same_vc_only: boolean;
|
||||
adult_round_trip_discount: number;
|
||||
child_round_trip_discount: number;
|
||||
infant_round_trip_discount: number;
|
||||
seat_allocation: number;
|
||||
seat_booked: number;
|
||||
seat_cancelled: number;
|
||||
is_checked_bag_included: boolean;
|
||||
adt_check_bag: string;
|
||||
chd_check_bag: string;
|
||||
inf_check_bag: string;
|
||||
_check_bag_unit: string;
|
||||
adt_cabin_bag: string;
|
||||
chd_cabin_bag: string;
|
||||
inf_cabin_bag: string;
|
||||
_cabin_bag_unit: string;
|
||||
refund_type: string;
|
||||
adt_fare_rule: string;
|
||||
chd_fare_rule: string;
|
||||
inf_fare_rule: string;
|
||||
is_meal_included: boolean;
|
||||
meal_details: string;
|
||||
inclusions: string;
|
||||
pnr: string;
|
||||
is_instant_confirmation: boolean;
|
||||
is_stop_sale: boolean;
|
||||
updated_by: string;
|
||||
}
|
||||
export class FlightDetailsSearchModel {
|
||||
contract_name: string;
|
||||
vendor_id: string;
|
||||
validating_airline: string;
|
||||
trip_type: string;
|
||||
flight_no: string;
|
||||
cabin_class: string;
|
||||
origin: string;
|
||||
destination: string;
|
||||
departure_days: string;
|
||||
date_type: string;
|
||||
from_date: string;
|
||||
to_date: string;
|
||||
pnr: string;
|
||||
currency_code: string;
|
||||
refund_type: string;
|
||||
rbd: string;
|
||||
is_instant_confirmation: boolean;
|
||||
is_multi_day: boolean;
|
||||
is_oneway_sale_allowed: boolean;
|
||||
airline_code: any;
|
||||
confirmation_type: string;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
export class FlightRateobj {
|
||||
_id: string;
|
||||
_from_date: string;
|
||||
_to_date: string;
|
||||
days: string;
|
||||
_rbd: string;
|
||||
}
|
||||
|
||||
|
||||
|
||||
export class UpdateFlightRate {
|
||||
contract_id: string;
|
||||
flight_rate: dtoFlightRate[];
|
||||
}
|
||||
|
||||
export class dtoFlightRate {
|
||||
rate_id: string;
|
||||
outbound_date: string;
|
||||
adt_base_fare: number;
|
||||
adt_tax: number;
|
||||
chd_base_fare: number;
|
||||
chd_tax: number;
|
||||
inf_base_fare: number;
|
||||
inf_tax: number;
|
||||
seat_allocation: number;
|
||||
adt_check_bag: number;
|
||||
chd_check_bag: number;
|
||||
inf_check_bag: number;
|
||||
_check_bag_unit: number;
|
||||
adt_cabin_bag: number;
|
||||
chd_cabin_bag: number;
|
||||
inf_cabin_bag: number;
|
||||
_cabin_bag_unit: number;
|
||||
_fare_type: number;
|
||||
adt_fare_rule: string;
|
||||
chd_fare_rule: string;
|
||||
inf_fare_rule: string;
|
||||
is_meal_included: boolean;
|
||||
meal_details: string;
|
||||
inclusions: string;
|
||||
pnr: string;
|
||||
is_instant_confirmation: boolean;
|
||||
is_stop_sale: boolean;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
export class ContractDetailDto {
|
||||
contract_id: string;
|
||||
contract_name: string;
|
||||
contract_description: string;
|
||||
is_premium_economy: boolean;
|
||||
is_economy: boolean;
|
||||
is_business: boolean;
|
||||
is_first_class: boolean;
|
||||
is_all_pax_type: boolean;
|
||||
is_adult: boolean;
|
||||
is_child: boolean;
|
||||
is_infant: boolean;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
export class UpdateFlightDetail {
|
||||
contract_id: string;
|
||||
departure_dates: string;
|
||||
outbound_days: string;
|
||||
flight_detail: FlightDetailobj[];
|
||||
}
|
||||
|
||||
export class FlightDetailobj {
|
||||
airline_code: string;
|
||||
flight_no: string;
|
||||
_aircraft_type: string;
|
||||
from_airport: string;
|
||||
to_airport: string;
|
||||
departure_time: string;
|
||||
is_next_day_departure: boolean;
|
||||
departure_terminal: string;
|
||||
is_next_day_arrival: boolean;
|
||||
arrival_time: string;
|
||||
arrival_terminal: string;
|
||||
flying_duration: string;
|
||||
sector_nbr: number | null;
|
||||
_sector_type: string;
|
||||
leg_nbr: number;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
export class FlightContractSearhObj {
|
||||
contract_name: string;
|
||||
supplier_name: string;
|
||||
_trip_type: string;
|
||||
airline_code: string;
|
||||
flight_no: string;
|
||||
from_airport: string;
|
||||
to_airport: string;
|
||||
dep_from_date: string;
|
||||
dep_to_date: string;
|
||||
ret_from_date: string;
|
||||
ret_to_date: string;
|
||||
dep_days: string;
|
||||
ret_days: string;
|
||||
is_multi_day: boolean;
|
||||
pnr: string;
|
||||
rbd: string;
|
||||
currency_code: string;
|
||||
fare_type: number;
|
||||
is_instant_confirmation: boolean;
|
||||
is_economy: boolean;
|
||||
is_premium_economy: boolean;
|
||||
is_business: boolean;
|
||||
is_first_class: boolean;
|
||||
}
|
||||
73
src/app/core/models/hotelService/AddRoom/Room.model.ts
Normal file
73
src/app/core/models/hotelService/AddRoom/Room.model.ts
Normal file
@@ -0,0 +1,73 @@
|
||||
|
||||
|
||||
export class ContractRoom {
|
||||
room_id: string;
|
||||
org_id: string;
|
||||
supplier_id: string;
|
||||
room_category_name_code: number;
|
||||
is_living_room: boolean;
|
||||
living_room_count: number;
|
||||
living_bed_count: number;
|
||||
living_bed_type: number;
|
||||
is_living_bed:boolean
|
||||
is_bedroom: boolean;
|
||||
bedroom_count: number;
|
||||
bed_count: string;
|
||||
is_bathroom: boolean;
|
||||
bathroom_count: number;
|
||||
is_bathtub: boolean;
|
||||
is_jacuzzi: boolean;
|
||||
room_size: number;
|
||||
room_measure_unit: string;
|
||||
room_images: string;
|
||||
thumbnail_image: string;
|
||||
display_room_name: string;
|
||||
extra_bed_type: number;
|
||||
hotel_id: string;
|
||||
hotel_code: number;
|
||||
room_view_code: number;
|
||||
room_type_code: number;
|
||||
room_code: number;
|
||||
max_adult: number;
|
||||
max_child: number;
|
||||
min_total_occupancy: number;
|
||||
max_total_occupancy: number;
|
||||
min_adult_age: number;
|
||||
min_child_age: number;
|
||||
max_child_age: number;
|
||||
is_extra_bed_supported: boolean;
|
||||
max_extra_bed_count: number;
|
||||
free_child_count: number;
|
||||
free_child_age_from: number;
|
||||
free_child_age_to: number;
|
||||
is_group_rate: boolean;
|
||||
is_paid_child_age_range: boolean;
|
||||
room_amenity_codes: string;
|
||||
revision_nbr: number;
|
||||
is_deleted: boolean;
|
||||
is_active: boolean;
|
||||
created_by: string;
|
||||
created_on: string;
|
||||
updated_by: string | null;
|
||||
updated_on: string | null;
|
||||
contract_paid_child_age_range: ContractRoomPaidChildAgeRange[];
|
||||
}
|
||||
|
||||
|
||||
export class ContractRoomPaidChildAgeRange {
|
||||
contract_paid_child_age_range_id: string;
|
||||
org_id: string;
|
||||
supplier_id: string;
|
||||
room_id: string;
|
||||
from_age: number;
|
||||
to_age: number;
|
||||
sequence: number;
|
||||
revision_nbr: number;
|
||||
is_deleted: boolean;
|
||||
is_active: boolean;
|
||||
created_by: string;
|
||||
created_on: string;
|
||||
updated_by: string | null;
|
||||
updated_on: string | null;
|
||||
is_child_range: boolean;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
export class OverViewData {
|
||||
Date: any[];
|
||||
RoomDetails : roomsOverViewData[];
|
||||
}
|
||||
export class roomsOverViewData {
|
||||
room_name: string;
|
||||
room_id: string;
|
||||
currency_code: string;
|
||||
status: string[];
|
||||
allocation: AllocationDet[];
|
||||
allocation_id: any[];
|
||||
net_sold: any[];
|
||||
availability: any[];
|
||||
RoomContractDetails: ContractDetails[];
|
||||
}
|
||||
export class AllocationDet{
|
||||
id:string;
|
||||
value:any;
|
||||
}
|
||||
export class ContractDetails {
|
||||
contract_name: string;
|
||||
aria_collapse: boolean;
|
||||
rate_plan: string;
|
||||
meal_plan: string;
|
||||
child_age_range_1: string;
|
||||
child_age_range_2: string;
|
||||
min_stay: string[];
|
||||
ChildDataRange1: ChildDetailsArr[];
|
||||
ChildDataRange2: ChildDetailsArr[];
|
||||
AdultData: ChildDetailsArr[];
|
||||
}
|
||||
export class ChildDetailsArr {
|
||||
value: string[];
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
export class ViewSeason {
|
||||
season: ContractSeason;
|
||||
seasondateRange: SeasonDateRange[];
|
||||
}
|
||||
|
||||
export class SeasonDateRange {
|
||||
|
||||
fromDate: string;
|
||||
toDate: string;
|
||||
}
|
||||
|
||||
|
||||
|
||||
export class ContractSeason {
|
||||
season_id: string;
|
||||
org_id: string;
|
||||
supplier_id: string;
|
||||
hotel_id: string;
|
||||
hotel_code: string;
|
||||
season_name: string;
|
||||
created_by: string;
|
||||
created_on: string;
|
||||
updated_by: string | null;
|
||||
updated_on: string | null;
|
||||
is_active: boolean;
|
||||
is_deleted: boolean;
|
||||
}
|
||||
43
src/app/core/models/optional-ons/optional-ons.model.ts
Normal file
43
src/app/core/models/optional-ons/optional-ons.model.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
|
||||
|
||||
export class ActivityAddOn {
|
||||
activity_add_on_id: string | null;
|
||||
org_id: string | null;
|
||||
supplier_id: string | null;
|
||||
activity_id: string | null;
|
||||
_rate_type: string | null;
|
||||
currency_code: string | null;
|
||||
per_service_rate: number;
|
||||
revision_nbr: number | null;
|
||||
created_by: string | null;
|
||||
created_on: string | null;
|
||||
updated_by: string | null;
|
||||
updated_on: string | null;
|
||||
is_active: boolean;
|
||||
is_deleted: boolean;
|
||||
adult_rate: number;
|
||||
senior_rate: number;
|
||||
youth_rate: number;
|
||||
child_rate: number;
|
||||
activityAddOnDetails: ActivityAddOnDetails[];
|
||||
activity_addon_details_json: string | null;
|
||||
}
|
||||
|
||||
export class ActivityAddOnDetails {
|
||||
activity_add_on_details_id: string;
|
||||
org_id: string;
|
||||
supplier_id: string;
|
||||
activity_id: string;
|
||||
activity_add_on_id: string;
|
||||
language_code: string;
|
||||
add_on_name: string;
|
||||
add_on_description: string;
|
||||
add_on_image: string;
|
||||
revision_nbr: number;
|
||||
created_by: string;
|
||||
created_on: string;
|
||||
updated_by: string;
|
||||
updated_on: string;
|
||||
is_active: boolean;
|
||||
is_deleted: boolean;
|
||||
}
|
||||
61
src/app/core/models/user-role-management/user-role.model.ts
Normal file
61
src/app/core/models/user-role-management/user-role.model.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
|
||||
export class dtoRoleMaster_Root {
|
||||
roleMaster: dtoRoleMaster;
|
||||
roleAccessMapping: dtoRoleAccessMapping[];
|
||||
json_role_master: string;
|
||||
json_role_access_mapping: string;
|
||||
}
|
||||
|
||||
|
||||
export class dtoRoleMaster {
|
||||
role_id: string;
|
||||
org_id: string;
|
||||
role_name: string;
|
||||
reporting_role_id: string;
|
||||
role_description: string;
|
||||
role_type: string;
|
||||
affiliate_id: string;
|
||||
extranet_vendor_id: string;
|
||||
is_active: boolean | null;
|
||||
created_on: string;
|
||||
created_by: string;
|
||||
updated_on: string;
|
||||
updated_by: string;
|
||||
}
|
||||
|
||||
|
||||
export class dtoRoleAccessMapping {
|
||||
role_access_id: string;
|
||||
org_id: string;
|
||||
role_id: string;
|
||||
project_id: string;
|
||||
menu_id: string;
|
||||
permission: string;
|
||||
is_active: boolean | null;
|
||||
created_on: string;
|
||||
created_by: string;
|
||||
updated_on: string;
|
||||
updated_by: string;
|
||||
}
|
||||
|
||||
|
||||
export class dtoRoleUserAccessUnmapping {
|
||||
user_access_un_map_id: string;
|
||||
org_id: string;
|
||||
user_id: string;
|
||||
role_id: string;
|
||||
project_id: string;
|
||||
menu_id: string;
|
||||
permission: string;
|
||||
is_active: boolean | null;
|
||||
created_on: string | null;
|
||||
created_by: string;
|
||||
updated_on: string | null;
|
||||
updated_by: string;
|
||||
}
|
||||
|
||||
|
||||
export class dtoRoleUserAccessUnMappingModel {
|
||||
user_id: string;
|
||||
user_access_unmapping_list: dtoRoleUserAccessUnmapping[];
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
import { HttpClient } from "@angular/common/http";
|
||||
import { Injectable } from "@angular/core";
|
||||
import { environment } from "src/environments/environment";
|
||||
|
||||
@Injectable()
|
||||
export class HotelBookingManagementService {
|
||||
|
||||
private headers = { 'Content-Type': 'application/json; charset=utf-8' };
|
||||
|
||||
constructor(private http: HttpClient) {
|
||||
if(sessionStorage.getItem('userId')){
|
||||
this.headers['LoggedInUser'] = sessionStorage.getItem('userId');
|
||||
}
|
||||
}
|
||||
|
||||
// listing page
|
||||
getAllAgency() {
|
||||
return this.http.get<any>(environment.APIBaseUrl + '/AgencyDetail/GetAllAffiliates', { headers: this.headers })
|
||||
}
|
||||
getAllCompany() {
|
||||
return this.http.get<any>(environment.APIBaseUrl + '/CompanyMaster/GetAllCompanyDetails', { headers: this.headers })
|
||||
}
|
||||
getAllEntity() {
|
||||
return this.http.get<any>(environment.APIBaseUrl + '/EntityMaster/GetAllEntity', { headers: this.headers })
|
||||
}
|
||||
getAllHotelSupplier() {
|
||||
return this.http.get<any>(environment.APIBaseUrl + '/HotelSupplier/GetAllHotelSupplier', { headers: this.headers })
|
||||
}
|
||||
getAllHotelSupplierV2() {
|
||||
return this.http.get<any>(environment.APIBaseUrl + '/HotelSupplierV2/GetAllHotelSupplierV2s', { headers: this.headers })
|
||||
}
|
||||
getAllHotelCountry() {
|
||||
return this.http.get<any>(environment.APIBaseUrl + '/hotel/CountryList/en', { headers: this.headers })
|
||||
}
|
||||
getAllHotelCityByCountry(country_code) {
|
||||
return this.http.get<any>(environment.APIBaseUrl + '/hotel/CityList/' + country_code+ '/en', { headers: this.headers })
|
||||
}
|
||||
getHotelBookingList(reqData) {
|
||||
return this.http.post<any>(environment.APIBaseUrl + '/HotelBooking/GetBookingList', reqData, { headers: this.headers })
|
||||
}
|
||||
bookingQualityCheck(trip_tbl_id) {
|
||||
return this.http.post<any>(environment.APIBaseUrl + '/Booking/UpdateQualityCheck/' + trip_tbl_id, null, { headers: this.headers })
|
||||
}
|
||||
|
||||
// View page
|
||||
getAllCurrency() {
|
||||
return this.http.get<any>(environment.APIBaseUrl + '/CurrencyMaster/GetAllCurrencies', { headers: this.headers })
|
||||
}
|
||||
getCustomerDetails(trip_id) {
|
||||
return this.http.get<any>(`${environment.APIBaseUrl}/HotelBooking/GetCustomerDetails/${trip_id}`, { headers: this.headers })
|
||||
}
|
||||
GetItenaryDetails(trip_id) {
|
||||
return this.http.get<any>(`${environment.APIBaseUrl}/HotelBooking/GetItenaryDetails/${trip_id}`, { headers: this.headers })
|
||||
}
|
||||
getPassengerDetails(trip_id) {
|
||||
return this.http.get<any>(`${environment.APIBaseUrl}/HotelBooking/GetPassengerDetails/${trip_id}`, { headers: this.headers })
|
||||
}
|
||||
getCostingDetails(trip_id) {
|
||||
return this.http.get<any>(`${environment.APIBaseUrl}/HotelBooking/GetCostingDetails/${trip_id}`, { headers: this.headers })
|
||||
}
|
||||
getPaymentDetails(trip_id) {
|
||||
return this.http.get<any>(`${environment.APIBaseUrl}/HotelBooking/GetPaymentDetails/${trip_id}`, { headers: this.headers })
|
||||
}
|
||||
getDocumentDetails(trip_id) {
|
||||
return this.http.get<any>(`${environment.APIBaseUrl}/HotelBooking/GetDocumentDetails/${trip_id}`, { headers: this.headers })
|
||||
}
|
||||
getNotesDetail(trip_id) {
|
||||
return this.http.get<any>(`${environment.APIBaseUrl}/HotelBooking/GetNotesDetail/${trip_id}`, { headers: this.headers })
|
||||
}
|
||||
getHotelBookingDetail(booking_id) {
|
||||
const org_id = sessionStorage.getItem('org_id');
|
||||
return this.http.get<any>(`${environment.hotelApiBaseUrl}/hotel/BookingDetails?org_id=${org_id}&booking_id=${booking_id}`, { headers: this.headers })
|
||||
}
|
||||
saveConfirmationNumber(reqData) {
|
||||
return this.http.post<any>(`${environment.APIBaseUrl}/HotelBooking/SaveConfirmationNumber`, reqData, { headers: this.headers })
|
||||
}
|
||||
saveNotesDetail(reqData){
|
||||
return this.http.post<any>(`${environment.APIBaseUrl}/HotelBooking/SaveNotesDetail`, reqData, { headers: this.headers })
|
||||
}
|
||||
printInvoiceDocument(document_number){
|
||||
return this.http.get<any>(`${environment.APIBaseUrl}/HotelBooking/SendInvoiceEmail/${document_number}`, { headers: this.headers })
|
||||
}
|
||||
sendInvoiceDocumentMail(document_number, email_id){
|
||||
return this.http.get<any>(`${environment.APIBaseUrl}/HotelBooking/SendInvoiceEmail/${document_number}/${email_id}`, { headers: this.headers })
|
||||
}
|
||||
sendItineraryDocumentMail(reqData){
|
||||
return this.http.post<any>(`${environment.APIBaseUrl}/HotelBooking/SendItineraryEmail`, reqData, { headers: this.headers })
|
||||
}
|
||||
sendVoucherDocumentMail(reqData){
|
||||
return this.http.post<any>(`${environment.APIBaseUrl}/HotelBooking/SendVoucherEmail`, reqData, { headers: this.headers })
|
||||
}
|
||||
UpdateBooking(reqData){
|
||||
return this.http.post<any>(`${environment.APIBaseUrl}/HotelBooking/UpdateBooking`, reqData, { headers: this.headers })
|
||||
};
|
||||
GethotelCityName(reqData){
|
||||
return this.http.post<any>(`${environment.hotelApiBaseUrl}/hotel/hotelcitylist`, reqData, { headers: this.headers })
|
||||
};
|
||||
GetCancelBooking(reqData){
|
||||
return this.http.post<any>(`${environment.hotelApiBaseUrl}/hotel/cancelfee`, reqData, { headers: this.headers })
|
||||
};
|
||||
}
|
||||
11
src/app/core/services/HotelServices/manage-hotel.service.ts
Normal file
11
src/app/core/services/HotelServices/manage-hotel.service.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ManageHotelService {
|
||||
|
||||
Extranet_Hotel_Id;
|
||||
Active_tab = 'OverView';
|
||||
constructor() { }
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ContractRoom } from 'src/app/core/models/hotelService/AddRoom/Room.model';
|
||||
import { environment } from 'src/environments/environment';
|
||||
// import { CommonFunctions } from 'src/app/core/common/common-functions';
|
||||
// import { environment } from 'src/environments/environment';
|
||||
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
|
||||
export class AddRoomService {
|
||||
SaveRoom(dataPost: ContractRoom) {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
constructor(private http: HttpClient) { }
|
||||
getAllRoomCategory() {
|
||||
return this.http.get(environment.APIBaseUrl + "/RoomCategoryName/GetAllRoomCategory")
|
||||
};
|
||||
GetAllHotelAmenity() {
|
||||
return this.http.get(environment.APIBaseUrl + "/HotelAmenity/GetAllHotelAmenity")
|
||||
};
|
||||
GetAllRoomViewName() {
|
||||
return this.http.get(environment.APIBaseUrl + "/RoomViewName/GetAllRoomViewName")
|
||||
};
|
||||
GetAllRoomBedType() {
|
||||
return this.http.get(environment.APIBaseUrl + "/BedTypeMaster/GetAllBedType")
|
||||
};
|
||||
SaveRoomContract(roomDetails) {
|
||||
return this.http.post(environment.APIBaseUrl + "/RoomContract/SaveContractRoom", roomDetails)
|
||||
};
|
||||
UpdateRoomContract(roomDetails) {
|
||||
return this.http.post(environment.APIBaseUrl + "/RoomContract/UpdateContractRoom", roomDetails)
|
||||
};
|
||||
saveImage(file) {
|
||||
return this.http.post(environment.APIBaseUrl + "/FileUpload/SaveFile", file)
|
||||
};
|
||||
getlovtype() {
|
||||
let formdata = {
|
||||
"lov_types": [{ "lov_type": "MeasureUnit" }],
|
||||
"lov_lang": "en"
|
||||
}
|
||||
return this.http.post(environment.APIBaseUrl + "/LovMaster/GetLov", formdata)
|
||||
};
|
||||
GetRoomContractById(Id) {
|
||||
return this.http.get(environment.APIBaseUrl + "/RoomContract/GetContractRoom/" + Id)
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { environment } from 'src/environments/environment';
|
||||
// import { CommonFunctions } from 'src/app/core/common/common-functions';
|
||||
// import { environment } from 'src/environments/environment';
|
||||
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
|
||||
export class RoomContractService {
|
||||
constructor(private http: HttpClient) { }
|
||||
|
||||
GetAllRoomContract() {
|
||||
return this.http.get(environment.APIBaseUrl + "/RoomContract/GetAllContractRoom")
|
||||
};
|
||||
|
||||
UpdateStatus(form) {
|
||||
return this.http.post(environment.APIBaseUrl + "/RoomContract/UpdateStatus", form)
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { environment } from 'src/environments/environment';
|
||||
// import { CommonFunctions } from 'src/app/core/common/common-functions';
|
||||
// import { environment } from 'src/environments/environment';
|
||||
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
|
||||
export class SeasonSettingService {
|
||||
constructor(private http: HttpClient) { }
|
||||
GetAllSeason() {
|
||||
return this.http.get(environment.APIBaseUrl + "/SeasonContract/GetAllSeason")
|
||||
};
|
||||
UpdateStatus(formData) {
|
||||
return this.http.post(environment.APIBaseUrl + "/SeasonContract/UpdateSeasonStatus", formData)
|
||||
};
|
||||
SaveSeason(formData) {
|
||||
return this.http.post(environment.APIBaseUrl + "/SeasonContract/SaveSeason", formData)
|
||||
};
|
||||
UpdateSeason(formData) {
|
||||
return this.http.post(environment.APIBaseUrl + "/SeasonContract/UpdateSeason", formData)
|
||||
};
|
||||
GetContractSeasonById(id) {
|
||||
return this.http.get(environment.APIBaseUrl + "/SeasonContract/GetContractSeasonById/"+ id)
|
||||
};
|
||||
|
||||
}
|
||||
46
src/app/core/services/active-sidebar.service.ts
Normal file
46
src/app/core/services/active-sidebar.service.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { BreakpointObserver, Breakpoints } from "@angular/cdk/layout";
|
||||
import { Injectable } from "@angular/core";
|
||||
import { Subject, takeUntil } from "rxjs";
|
||||
|
||||
@Injectable({
|
||||
providedIn: "root",
|
||||
})
|
||||
export class ActiveSidebarService {
|
||||
activeSide = "IsActive";
|
||||
MobileShow = true;
|
||||
destroyed = new Subject<void>();
|
||||
isTouchEvent!: boolean;
|
||||
constructor(
|
||||
breakpointObserver: BreakpointObserver,
|
||||
) {
|
||||
breakpointObserver.observe([Breakpoints.XSmall, Breakpoints.Small])
|
||||
.pipe(takeUntil(this.destroyed))
|
||||
.subscribe((result) => {
|
||||
if (
|
||||
result.breakpoints["(max-width: 599.98px)"] ||
|
||||
result.breakpoints["(min-width: 600px) and (max-width: 959.98px)"]
|
||||
) {
|
||||
this.MobileShow = true;
|
||||
} else {
|
||||
this.MobileShow = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
SideBar(ele: string) {
|
||||
// if (this.MobileShow) {
|
||||
if (this.activeSide == ele) {
|
||||
this.activeSide = "";
|
||||
//a.type == 'mouseenter' ? this.activeSide = "" : this.activeSide = "IsActive";
|
||||
} else {
|
||||
this.activeSide = "IsActive";
|
||||
//a.type == 'mouseenter' ? this.activeSide = "IsActive" : this.activeSide = "";
|
||||
// }
|
||||
}
|
||||
}
|
||||
//ActiveSideBar(ele) {
|
||||
// this.activeSide = "";
|
||||
//}
|
||||
//DisActiveSideBar(ele) {
|
||||
// this.activeSide = "IsActive";
|
||||
//}
|
||||
}
|
||||
123
src/app/core/services/api.service.ts
Normal file
123
src/app/core/services/api.service.ts
Normal file
@@ -0,0 +1,123 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { environment } from 'src/environments/environment';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
|
||||
export class API {
|
||||
constructor(private http: HttpClient) {
|
||||
}
|
||||
private headers = {
|
||||
'Content-Type': 'application/json; charset=utf-8',
|
||||
// 'LoggedInUser': sessionStorage.getItem('userId')
|
||||
};
|
||||
// Extranet API Base Url
|
||||
Post(url, obj) {
|
||||
return this.http.post<any>(environment.ExtranetAPIBaseUrl + url, obj,
|
||||
{ headers: this.headers }
|
||||
);
|
||||
}
|
||||
|
||||
Put(url, obj) {
|
||||
return this.http.put<any>(environment.ExtranetAPIBaseUrl + url, obj,
|
||||
{ headers: this.headers }
|
||||
);
|
||||
}
|
||||
|
||||
Delete(url) {
|
||||
return this.http.delete<any>(environment.ExtranetAPIBaseUrl + url,
|
||||
{ headers: this.headers }
|
||||
);
|
||||
}
|
||||
|
||||
Get(url) {
|
||||
return this.http.get<any>(environment.ExtranetAPIBaseUrl + url,
|
||||
{ headers: this.headers }
|
||||
);
|
||||
}
|
||||
// Admin API Base Url
|
||||
AdminPost(url, obj) {
|
||||
return this.http.post<any>(environment.APIBaseUrl + url, obj,
|
||||
{ headers: this.headers }
|
||||
);
|
||||
}
|
||||
|
||||
AdminPut(url, obj) {
|
||||
return this.http.put<any>(environment.APIBaseUrl + url, obj,
|
||||
{ headers: this.headers }
|
||||
);
|
||||
}
|
||||
|
||||
AdminDelete(url) {
|
||||
return this.http.delete<any>(environment.APIBaseUrl + url,
|
||||
{ headers: this.headers }
|
||||
);
|
||||
}
|
||||
|
||||
AdminGet(url) {
|
||||
return this.http.get<any>(environment.APIBaseUrl + url,
|
||||
{ headers: this.headers }
|
||||
);
|
||||
}
|
||||
// admin api go
|
||||
AdminGoPost(url, obj) {
|
||||
return this.http.post<any>(environment.AdminAPIGOBaseUrl + url, obj,
|
||||
{ headers: this.headers }
|
||||
);
|
||||
}
|
||||
|
||||
AdminGOPut(url, obj) {
|
||||
return this.http.put<any>(environment.AdminAPIGOBaseUrl + url, obj,
|
||||
{ headers: this.headers }
|
||||
);
|
||||
}
|
||||
|
||||
AdminGODelete(url) {
|
||||
return this.http.delete<any>(environment.AdminAPIGOBaseUrl + url,
|
||||
{ headers: this.headers }
|
||||
);
|
||||
}
|
||||
|
||||
AdminGOGet(url) {
|
||||
return this.http.get<any>(environment.AdminAPIGOBaseUrl + url,
|
||||
{ headers: this.headers }
|
||||
);
|
||||
}
|
||||
//
|
||||
PostFile(url, obj) {
|
||||
return this.http.post<any>(environment.APIBaseUrl + url, obj,);
|
||||
}
|
||||
|
||||
PostFileExtranet(url, obj){
|
||||
return this.http.post<any>(environment.ExtranetAPIBaseUrl + url, obj,);
|
||||
}
|
||||
|
||||
//Admin API GO
|
||||
PostGo(url, obj, customHeaders = null) {
|
||||
let postHeaders = JSON.parse(JSON.stringify(this.headers))
|
||||
if (customHeaders != null) {
|
||||
postHeaders = { ...postHeaders, ...customHeaders }
|
||||
}
|
||||
return this.http.post<any>(environment.APIBaseGoUrl + url, obj,
|
||||
{ headers: postHeaders }
|
||||
);
|
||||
}
|
||||
|
||||
GetGo(url) {
|
||||
return this.http.get<any>(environment.APIBaseGoUrl + url,
|
||||
{ headers: this.headers }
|
||||
);
|
||||
}
|
||||
|
||||
PostFileGo(url, obj) {
|
||||
return this.http.post<any>(environment.APIBaseGoUrl + url, obj,);
|
||||
}
|
||||
getAdjustedLocalTime(): number {
|
||||
const calculatedTime = sessionStorage.getItem('UGT') || '0';
|
||||
const localTime = new Date().getTime();
|
||||
return localTime + parseInt(calculatedTime);
|
||||
}
|
||||
}
|
||||
|
||||
38
src/app/core/services/breakpoints.services.ts
Normal file
38
src/app/core/services/breakpoints.services.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { BehaviorSubject, Subject, takeUntil } from 'rxjs';
|
||||
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class BreakpointsService {
|
||||
public IsMobile = new BehaviorSubject(false);
|
||||
destroyed = new Subject<void>();
|
||||
ngOnDestroy() {
|
||||
this.destroyed.next();
|
||||
this.destroyed.complete();
|
||||
}
|
||||
constructor(private breakpointObserver: BreakpointObserver) {
|
||||
this.checkTest();
|
||||
}
|
||||
|
||||
checkTest() {
|
||||
this.breakpointObserver
|
||||
.observe([Breakpoints.XSmall, Breakpoints.Small])
|
||||
.pipe(takeUntil(this.destroyed))
|
||||
.subscribe((result) => {
|
||||
if (
|
||||
result.breakpoints['(max-width: 599.98px)'] ||
|
||||
result.breakpoints['(min-width: 600px) and (max-width: 959.98px)']
|
||||
) {
|
||||
this.IsMobile.next(true);
|
||||
} else {
|
||||
this.IsMobile.next(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
checkMob() {
|
||||
return this.IsMobile.getValue();
|
||||
}
|
||||
}
|
||||
58
src/app/core/services/common.service.ts
Normal file
58
src/app/core/services/common.service.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import { Injectable } from "@angular/core";
|
||||
import * as CryptoJS from 'crypto-js';
|
||||
|
||||
export class CommonService{
|
||||
static yek = "$uPer@dm1n~dI@z7";
|
||||
|
||||
private static encryptText(plainText) {
|
||||
var key = CryptoJS.enc.Utf8.parse(this.yek);
|
||||
var iv = CryptoJS.enc.Utf8.parse(this.yek);
|
||||
|
||||
var encryptedText = CryptoJS.AES.encrypt(CryptoJS.enc.Utf8.parse(plainText), key,
|
||||
{
|
||||
keySize: 128 / 8,
|
||||
iv: iv,
|
||||
mode: CryptoJS.mode.CBC,
|
||||
padding: CryptoJS.pad.Pkcs7
|
||||
}).toString();
|
||||
return encryptedText;
|
||||
}
|
||||
|
||||
public static decryptText(cipherText) {
|
||||
var key = CryptoJS.enc.Utf8.parse(this.yek);
|
||||
var iv = CryptoJS.enc.Utf8.parse(this.yek);
|
||||
|
||||
var decryptedText = CryptoJS.AES.decrypt(cipherText, key,
|
||||
{
|
||||
keySize: 128 / 8,
|
||||
iv: iv,
|
||||
mode: CryptoJS.mode.CBC,
|
||||
padding: CryptoJS.pad.Pkcs7
|
||||
}).toString(CryptoJS.enc.Utf8);
|
||||
return decryptedText;
|
||||
}
|
||||
public static setSessionStorage(key: string, value) {
|
||||
sessionStorage.setItem(key, this.encryptText(value));
|
||||
}
|
||||
|
||||
public static getSessionStoage(key: string) {
|
||||
var value = sessionStorage.getItem(key);
|
||||
if (value) {
|
||||
return this.decryptText(value);
|
||||
} else return null;
|
||||
}
|
||||
public static resetLocalStoage(key: string) {
|
||||
localStorage.removeItem(key);
|
||||
}
|
||||
public static setLocalStoage(key: string, value) {
|
||||
value = JSON.stringify(value);
|
||||
localStorage.setItem(key, this.encryptText(value));
|
||||
}
|
||||
|
||||
public static getLocalStoage(key: string) {
|
||||
var value = localStorage.getItem(key);
|
||||
if (value) {
|
||||
return JSON.parse(this.decryptText(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
27
src/app/core/services/event-utils.ts
Normal file
27
src/app/core/services/event-utils.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
let eventGuid = 0;
|
||||
const TODAY_STR = new Date().toISOString().replace(/T.*$/, ''); // YYYY-MM-DD of today
|
||||
|
||||
export const INITIAL_EVENTS = [
|
||||
{
|
||||
id: createEventId(),
|
||||
title: 'All-day event',
|
||||
start: TODAY_STR
|
||||
},
|
||||
{
|
||||
id: createEventId(),
|
||||
title: 'Timed event',
|
||||
start: TODAY_STR + 'T00:00:00',
|
||||
end: TODAY_STR + 'T03:00:00'
|
||||
},
|
||||
{
|
||||
id: createEventId(),
|
||||
title: 'Timed event',
|
||||
start: TODAY_STR + 'T12:00:00',
|
||||
end: TODAY_STR + 'T15:00:00'
|
||||
}
|
||||
];
|
||||
|
||||
export function createEventId() {
|
||||
return String(eventGuid++);
|
||||
}
|
||||
0
src/app/core/services/events.calender.service.ts
Normal file
0
src/app/core/services/events.calender.service.ts
Normal file
@@ -0,0 +1,133 @@
|
||||
import { MessageService } from "primeng/api";
|
||||
import { Injectable } from "@angular/core";
|
||||
import { Title } from "@angular/platform-browser";
|
||||
import * as moment from "moment";
|
||||
import { FileUpload } from "primeng/fileupload";
|
||||
import jsPDF from "jspdf";
|
||||
import * as FileSaver from "file-saver";
|
||||
import autoTable from 'jspdf-autotable';
|
||||
import { API } from "../api.service";
|
||||
import { ValidationService } from "../../common/validation.service";
|
||||
|
||||
@Injectable()
|
||||
export class FlightContractService {
|
||||
constructor(
|
||||
public ApiServ: API,
|
||||
public validationService: ValidationService,
|
||||
public titleService: Title
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
ddLoader = {
|
||||
AirLine: false,
|
||||
Currency: false,
|
||||
origin: false,
|
||||
destination: false,
|
||||
ToAirport: false,
|
||||
FormAirport: false,
|
||||
AirCraft: false,
|
||||
}
|
||||
timer;
|
||||
AirlineList = [];
|
||||
AirportList = [];
|
||||
AllAirCraftList = [];
|
||||
getAirLineBySearch(val) {
|
||||
if (val.length >= 2) {
|
||||
this.ddLoader.AirLine = true;
|
||||
clearTimeout(this.timer);
|
||||
this.timer = setTimeout(() => {
|
||||
let request = {
|
||||
"langcode": "en",
|
||||
"query": val
|
||||
}
|
||||
this.ApiServ.AdminGoPost(`/MasterSearch/GetAllAirLine`, request).subscribe(res => {
|
||||
if (res) {
|
||||
this.AirlineList = res?.Result;
|
||||
this.ddLoader.AirLine = false;
|
||||
}
|
||||
});
|
||||
}, 500);
|
||||
};
|
||||
if (!val) {
|
||||
this.AirlineList = [];
|
||||
}
|
||||
};
|
||||
|
||||
GetAirportList(val, name) {
|
||||
if (val.length >= 2) {
|
||||
this.ddLoader[name] = true;
|
||||
clearTimeout(this.timer);
|
||||
this.timer = setTimeout(() => {
|
||||
this.ApiServ.AdminGOGet(`/Airport/GetList/en/` + val).subscribe(res => {
|
||||
if (res) {
|
||||
this.AirportList = res;
|
||||
this.ddLoader[name] = false;
|
||||
}
|
||||
});
|
||||
}, 500);
|
||||
};
|
||||
if (!val) {
|
||||
this.AirlineList = [];
|
||||
}
|
||||
};
|
||||
getAircraftList(val) {
|
||||
let repObj = {
|
||||
aircraft_name: val
|
||||
};
|
||||
if (val.length >= 3) {
|
||||
this.ddLoader.AirCraft = true;
|
||||
clearTimeout(this.timer);
|
||||
this.timer = setTimeout(() => {
|
||||
this.ApiServ.Post(`/MasterSearch/GetAllAircraftType`, repObj).subscribe(res => {
|
||||
if (res) {
|
||||
this.AllAirCraftList = res.data;
|
||||
this.ddLoader.AirCraft = false;
|
||||
}
|
||||
});
|
||||
}, 500);
|
||||
}
|
||||
};
|
||||
GetAirportsByAirportCode(data) {
|
||||
let obj = {
|
||||
airport_code: data
|
||||
}
|
||||
this.ApiServ.AdminGoPost('/Airport/GetAirportsByAirportCode', obj).subscribe(res => {
|
||||
if (res) {
|
||||
if (res.Result && res.Result.length > 0) {
|
||||
this.AirportList = res.Result;
|
||||
this.AirportList = this.AirportList.map(e => ({ 'ac': e.airport_code, 'ct': e.city_name }));
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.AirportList = [];
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
};
|
||||
GetAirlineByAirlineCode(data) {
|
||||
let obj = {
|
||||
airline_code: data
|
||||
}
|
||||
this.ApiServ.AdminGoPost('/MasterSearch/GetAirlineByAirlineCode', obj).subscribe(res => {
|
||||
if (res) {
|
||||
this.AirlineList = res.Result;
|
||||
setTimeout(() => {
|
||||
this.AirlineList = [];
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
};
|
||||
GetAircraftTypeById(data) {
|
||||
let obj = {
|
||||
aircraft_type_id: data
|
||||
}
|
||||
this.ApiServ.Post('/MasterSearch/GetAircraftTypeById', obj).subscribe(res => {
|
||||
if (res) {
|
||||
this.AllAirCraftList = res.data;
|
||||
setTimeout(() => {
|
||||
this.AllAirCraftList = [];
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
21
src/app/core/services/node.service.ts
Normal file
21
src/app/core/services/node.service.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { TreeNode } from 'primeng/api';
|
||||
|
||||
@Injectable()
|
||||
export class NodeService {
|
||||
constructor(private http: HttpClient) { }
|
||||
|
||||
getFiles() {
|
||||
return this.http.get<any>('assets/files.json')
|
||||
.toPromise()
|
||||
.then(res => <TreeNode[]>res.data);
|
||||
}
|
||||
|
||||
getLazyFiles() {
|
||||
return this.http.get<any>('assets/files-lazy.json')
|
||||
.toPromise()
|
||||
.then(res => <TreeNode[]>res.data);
|
||||
}
|
||||
}
|
||||
787
src/app/core/services/nodeservice.ts
Normal file
787
src/app/core/services/nodeservice.ts
Normal file
@@ -0,0 +1,787 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable()
|
||||
export class NodeService {
|
||||
[x: string]: any;
|
||||
getTreeNodesData() {
|
||||
return [
|
||||
{
|
||||
key: '0',
|
||||
label: 'Documents',
|
||||
data: 'Documents Folder',
|
||||
icon: 'pi pi-fw pi-inbox',
|
||||
children: [
|
||||
{
|
||||
key: '0-0',
|
||||
label: 'Work',
|
||||
data: 'Work Folder',
|
||||
icon: 'pi pi-fw pi-cog',
|
||||
children: [
|
||||
{ key: '0-0-0', label: 'Expenses.doc', icon: 'pi pi-fw pi-file', data: 'Expenses Document' },
|
||||
{ key: '0-0-1', label: 'Resume.doc', icon: 'pi pi-fw pi-file', data: 'Resume Document' }
|
||||
]
|
||||
},
|
||||
{
|
||||
key: '0-1',
|
||||
label: 'Home',
|
||||
data: 'Home Folder',
|
||||
icon: 'pi pi-fw pi-home',
|
||||
children: [{ key: '0-1-0', label: 'Invoices.txt', icon: 'pi pi-fw pi-file', data: 'Invoices for this month' }]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: '1',
|
||||
label: 'Events',
|
||||
data: 'Events Folder',
|
||||
icon: 'pi pi-fw pi-calendar',
|
||||
children: [
|
||||
{ key: '1-0', label: 'Meeting', icon: 'pi pi-fw pi-calendar-plus', data: 'Meeting' },
|
||||
{ key: '1-1', label: 'Product Launch', icon: 'pi pi-fw pi-calendar-plus', data: 'Product Launch' },
|
||||
{ key: '1-2', label: 'Report Review', icon: 'pi pi-fw pi-calendar-plus', data: 'Report Review' }
|
||||
]
|
||||
},
|
||||
{
|
||||
key: '2',
|
||||
label: 'Movies',
|
||||
data: 'Movies Folder',
|
||||
icon: 'pi pi-fw pi-star-fill',
|
||||
children: [
|
||||
{
|
||||
key: '2-0',
|
||||
icon: 'pi pi-fw pi-star-fill',
|
||||
label: 'Al Pacino',
|
||||
data: 'Pacino Movies',
|
||||
children: [
|
||||
{ key: '2-0-0', label: 'Scarface', icon: 'pi pi-fw pi-video', data: 'Scarface Movie' },
|
||||
{ key: '2-0-1', label: 'Serpico', icon: 'pi pi-fw pi-video', data: 'Serpico Movie' }
|
||||
]
|
||||
},
|
||||
{
|
||||
key: '2-1',
|
||||
label: 'Robert De Niro',
|
||||
icon: 'pi pi-fw pi-star-fill',
|
||||
data: 'De Niro Movies',
|
||||
children: [
|
||||
{ key: '2-1-0', label: 'Goodfellas', icon: 'pi pi-fw pi-video', data: 'Goodfellas Movie' },
|
||||
{ key: '2-1-1', label: 'Untouchables', icon: 'pi pi-fw pi-video', data: 'Untouchables Movie' }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
getTreeTableNodesData() {
|
||||
return [
|
||||
{
|
||||
key: '0',
|
||||
data: {
|
||||
name: 'Applications',
|
||||
view: '100kb',
|
||||
add: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
key: '0-0',
|
||||
data: {
|
||||
name: 'React',
|
||||
view: '25kb',
|
||||
add: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
key: '0-0-0',
|
||||
data: {
|
||||
name: 'react.app',
|
||||
view: '10kb',
|
||||
add: 'Application'
|
||||
}
|
||||
},
|
||||
{
|
||||
key: '0-0-1',
|
||||
data: {
|
||||
name: 'native.app',
|
||||
view: '10kb',
|
||||
add: 'Application'
|
||||
}
|
||||
},
|
||||
{
|
||||
key: '0-0-2',
|
||||
data: {
|
||||
name: 'mobile.app',
|
||||
view: '5kb',
|
||||
add: 'Application'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: '0-1',
|
||||
data: {
|
||||
name: 'editor.app',
|
||||
view: '25kb',
|
||||
add: 'Application'
|
||||
}
|
||||
},
|
||||
{
|
||||
key: '0-2',
|
||||
data: {
|
||||
name: 'settings.app',
|
||||
view: '50kb',
|
||||
add: 'Application'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: '1',
|
||||
data: {
|
||||
name: 'Cloud',
|
||||
view: '20kb',
|
||||
add: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
key: '1-0',
|
||||
data: {
|
||||
name: 'backup-1.zip',
|
||||
view: '10kb',
|
||||
add: 'Zip'
|
||||
}
|
||||
},
|
||||
{
|
||||
key: '1-1',
|
||||
data: {
|
||||
name: 'backup-2.zip',
|
||||
view: '10kb',
|
||||
add: 'Zip'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: '2',
|
||||
data: {
|
||||
name: 'Desktop',
|
||||
view: '150kb',
|
||||
add: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
key: '2-0',
|
||||
data: {
|
||||
name: 'note-meeting.txt',
|
||||
view: '50kb',
|
||||
add: 'Text'
|
||||
}
|
||||
},
|
||||
{
|
||||
key: '2-1',
|
||||
data: {
|
||||
name: 'note-todo.txt',
|
||||
view: '100kb',
|
||||
add: 'Text'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: '3',
|
||||
data: {
|
||||
name: 'Documents',
|
||||
view: '75kb',
|
||||
add: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
key: '3-0',
|
||||
data: {
|
||||
name: 'Work',
|
||||
view: '55kb',
|
||||
add: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
key: '3-0-0',
|
||||
data: {
|
||||
name: 'Expenses.doc',
|
||||
view: '30kb',
|
||||
add: 'Document'
|
||||
}
|
||||
},
|
||||
{
|
||||
key: '3-0-1',
|
||||
data: {
|
||||
name: 'Resume.doc',
|
||||
view: '25kb',
|
||||
add: 'Resume'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: '3-1',
|
||||
data: {
|
||||
name: 'Home',
|
||||
view: '20kb',
|
||||
add: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
key: '3-1-0',
|
||||
data: {
|
||||
name: 'Invoices',
|
||||
view: '20kb',
|
||||
add: 'Text'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: '4',
|
||||
data: {
|
||||
name: 'Downloads',
|
||||
view: '25kb',
|
||||
add: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
key: '4-0',
|
||||
data: {
|
||||
name: 'Spanish',
|
||||
view: '10kb',
|
||||
add: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
key: '4-0-0',
|
||||
data: {
|
||||
name: 'tutorial-a1.txt',
|
||||
view: '5kb',
|
||||
add: 'Text'
|
||||
}
|
||||
},
|
||||
{
|
||||
key: '4-0-1',
|
||||
data: {
|
||||
name: 'tutorial-a2.txt',
|
||||
view: '5kb',
|
||||
add: 'Text'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: '4-1',
|
||||
data: {
|
||||
name: 'Travel',
|
||||
view: '15kb',
|
||||
add: 'Text'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
key: '4-1-0',
|
||||
data: {
|
||||
name: 'Hotel.pdf',
|
||||
view: '10kb',
|
||||
add: 'PDF'
|
||||
}
|
||||
},
|
||||
{
|
||||
key: '4-1-1',
|
||||
data: {
|
||||
name: 'Flight.pdf',
|
||||
view: '5kb',
|
||||
add: 'PDF'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: '5',
|
||||
data: {
|
||||
name: 'Main',
|
||||
view: '50kb',
|
||||
add: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
key: '5-0',
|
||||
data: {
|
||||
name: 'bin',
|
||||
view: '50kb',
|
||||
add: 'Link'
|
||||
}
|
||||
},
|
||||
{
|
||||
key: '5-1',
|
||||
data: {
|
||||
name: 'etc',
|
||||
view: '100kb',
|
||||
add: 'Link'
|
||||
}
|
||||
},
|
||||
{
|
||||
key: '5-2',
|
||||
data: {
|
||||
name: 'var',
|
||||
view: '100kb',
|
||||
add: 'Link'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: '6',
|
||||
data: {
|
||||
name: 'Other',
|
||||
view: '5kb',
|
||||
add: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
key: '6-0',
|
||||
data: {
|
||||
name: 'todo.txt',
|
||||
view: '3kb',
|
||||
add: 'Text'
|
||||
}
|
||||
},
|
||||
{
|
||||
key: '6-1',
|
||||
data: {
|
||||
name: 'logo.png',
|
||||
view: '2kb',
|
||||
add: 'Picture'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: '7',
|
||||
data: {
|
||||
name: 'Pictures',
|
||||
view: '150kb',
|
||||
add: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
key: '7-0',
|
||||
data: {
|
||||
name: 'barcelona.jpg',
|
||||
view: '90kb',
|
||||
add: 'Picture'
|
||||
}
|
||||
},
|
||||
{
|
||||
key: '7-1',
|
||||
data: {
|
||||
name: 'primeng.png',
|
||||
view: '30kb',
|
||||
add: 'Picture'
|
||||
}
|
||||
},
|
||||
{
|
||||
key: '7-2',
|
||||
data: {
|
||||
name: 'prime.jpg',
|
||||
view: '30kb',
|
||||
add: 'Picture'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: '8',
|
||||
data: {
|
||||
name: 'Videos',
|
||||
view: '1500kb',
|
||||
add: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
key: '8-0',
|
||||
data: {
|
||||
name: 'primefaces.mkv',
|
||||
view: '1000kb',
|
||||
add: 'Video'
|
||||
}
|
||||
},
|
||||
{
|
||||
key: '8-1',
|
||||
data: {
|
||||
name: 'intro.avi',
|
||||
view: '500kb',
|
||||
add: 'Video'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
getLazyNodesData() {
|
||||
return [
|
||||
{
|
||||
"label": "Lazy Node 0",
|
||||
"data": "Node 0",
|
||||
"expandedIcon": "pi pi-folder-open",
|
||||
"collapsedIcon": "pi pi-folder",
|
||||
"leaf": false
|
||||
},
|
||||
{
|
||||
"label": "Lazy Node 1",
|
||||
"data": "Node 1",
|
||||
"expandedIcon": "pi pi-folder-open",
|
||||
"collapsedIcon": "pi pi-folder",
|
||||
"leaf": false
|
||||
},
|
||||
{
|
||||
"label": "Lazy Node 1",
|
||||
"data": "Node 2",
|
||||
"expandedIcon": "pi pi-folder-open",
|
||||
"collapsedIcon": "pi pi-folder",
|
||||
"leaf": false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
getFileSystemNodesData() {
|
||||
return [
|
||||
{
|
||||
"data":{
|
||||
"name":"Applications",
|
||||
"view":"200mb",
|
||||
"add":"Folder"
|
||||
},
|
||||
"children":[
|
||||
{
|
||||
"data":{
|
||||
"name":"Angular",
|
||||
"view":"25mb",
|
||||
"add":"Folder"
|
||||
},
|
||||
"children":[
|
||||
{
|
||||
"data":{
|
||||
"name":"angular.app",
|
||||
"view":"10mb",
|
||||
"add":"Application"
|
||||
}
|
||||
},
|
||||
{
|
||||
"data":{
|
||||
"name":"cli.app",
|
||||
"view":"10mb",
|
||||
"add":"Application"
|
||||
}
|
||||
},
|
||||
{
|
||||
"data":{
|
||||
"name":"mobile.app",
|
||||
"view":"5mb",
|
||||
"add":"Application"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"data":{
|
||||
"name":"editor.app",
|
||||
"view":"25mb",
|
||||
"add":"Application"
|
||||
}
|
||||
},
|
||||
{
|
||||
"data":{
|
||||
"name":"settings.app",
|
||||
"view":"50mb",
|
||||
"add":"Application"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"data":{
|
||||
"name":"Cloud",
|
||||
"view":"20mb",
|
||||
"add":"Folder"
|
||||
},
|
||||
"children":[
|
||||
{
|
||||
"data":{
|
||||
"name":"backup-1.zip",
|
||||
"view":"10mb",
|
||||
"add":"Zip"
|
||||
}
|
||||
},
|
||||
{
|
||||
"data":{
|
||||
"name":"backup-2.zip",
|
||||
"view":"10mb",
|
||||
"add":"Zip"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"name":"Desktop",
|
||||
"view":"150kb",
|
||||
"add":"Folder"
|
||||
},
|
||||
"children":[
|
||||
{
|
||||
"data":{
|
||||
"name":"note-meeting.txt",
|
||||
"view":"50kb",
|
||||
"add":"Text"
|
||||
}
|
||||
},
|
||||
{
|
||||
"data":{
|
||||
"name":"note-todo.txt",
|
||||
"view":"100kb",
|
||||
"add":"Text"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"data":{
|
||||
"name":"Documents",
|
||||
"view":"75kb",
|
||||
"add":"Folder"
|
||||
},
|
||||
"children":[
|
||||
{
|
||||
"data":{
|
||||
"name":"Work",
|
||||
"view":"55kb",
|
||||
"add":"Folder"
|
||||
},
|
||||
"children":[
|
||||
{
|
||||
"data":{
|
||||
"name":"Expenses.doc",
|
||||
"view":"30kb",
|
||||
"add":"Document"
|
||||
}
|
||||
},
|
||||
{
|
||||
"data":{
|
||||
"name":"Resume.doc",
|
||||
"view":"25kb",
|
||||
"add":"Resume"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"data":{
|
||||
"name":"Home",
|
||||
"view":"20kb",
|
||||
"add":"Folder"
|
||||
},
|
||||
"children":[
|
||||
{
|
||||
"data":{
|
||||
"name":"Invoices",
|
||||
"view":"20kb",
|
||||
"add":"Text"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"name":"Downloads",
|
||||
"view":"25mb",
|
||||
"add":"Folder"
|
||||
},
|
||||
"children":[
|
||||
{
|
||||
"data": {
|
||||
"name":"Spanish",
|
||||
"view":"10mb",
|
||||
"add":"Folder"
|
||||
},
|
||||
"children":[
|
||||
{
|
||||
"data":{
|
||||
"name":"tutorial-a1.txt",
|
||||
"view":"5mb",
|
||||
"add":"Text"
|
||||
}
|
||||
},
|
||||
{
|
||||
"data":{
|
||||
"name":"tutorial-a2.txt",
|
||||
"view":"5mb",
|
||||
"add":"Text"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"data":{
|
||||
"name":"Travel",
|
||||
"view":"15mb",
|
||||
"add":"Text"
|
||||
},
|
||||
"children":[
|
||||
{
|
||||
"data":{
|
||||
"name":"Hotel.pdf",
|
||||
"view":"10mb",
|
||||
"add":"PDF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"data":{
|
||||
"name":"Flight.pdf",
|
||||
"view":"5mb",
|
||||
"add":"PDF"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"name":"Main",
|
||||
"view":"50mb",
|
||||
"add":"Folder"
|
||||
},
|
||||
"children":[
|
||||
{
|
||||
"data":{
|
||||
"name":"bin",
|
||||
"view":"50kb",
|
||||
"add":"Link"
|
||||
}
|
||||
},
|
||||
{
|
||||
"data":{
|
||||
"name":"etc",
|
||||
"view":"100kb",
|
||||
"add":"Link"
|
||||
}
|
||||
},
|
||||
{
|
||||
"data":{
|
||||
"name":"var",
|
||||
"view":"100kb",
|
||||
"add":"Link"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"data":{
|
||||
"name":"Other",
|
||||
"view":"5mb",
|
||||
"add":"Folder"
|
||||
},
|
||||
"children":[
|
||||
{
|
||||
"data":{
|
||||
"name":"todo.txt",
|
||||
"view":"3mb",
|
||||
"add":"Text"
|
||||
}
|
||||
},
|
||||
{
|
||||
"data":{
|
||||
"name":"logo.png",
|
||||
"view":"2mb",
|
||||
"add":"Picture"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"data":{
|
||||
"name":"Pictures",
|
||||
"view":"150kb",
|
||||
"add":"Folder"
|
||||
},
|
||||
"children":[
|
||||
{
|
||||
"data":{
|
||||
"name":"barcelona.jpg",
|
||||
"view":"90kb",
|
||||
"add":"Picture"
|
||||
}
|
||||
},
|
||||
{
|
||||
"data":{
|
||||
"name":"primeng.png",
|
||||
"view":"30kb",
|
||||
"add":"Picture"
|
||||
}
|
||||
},
|
||||
{
|
||||
"data":{
|
||||
"name":"prime.jpg",
|
||||
"view":"30kb",
|
||||
"add":"Picture"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"data":{
|
||||
"name":"Videos",
|
||||
"view":"1500mb",
|
||||
"add":"Folder"
|
||||
},
|
||||
"children":[
|
||||
{
|
||||
"data":{
|
||||
"name":"primefaces.mkv",
|
||||
"view":"1000mb",
|
||||
"add":"Video"
|
||||
}
|
||||
},
|
||||
{
|
||||
"data":{
|
||||
"name":"intro.avi",
|
||||
"view":"500mb",
|
||||
"add":"Video"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
getTreeTableNodes() {
|
||||
return Promise.resolve(this.getTreeTableNodesData());
|
||||
}
|
||||
|
||||
getTreeNodes() {
|
||||
return Promise.resolve(this.getTreeNodesData());
|
||||
}
|
||||
|
||||
getFiles() {
|
||||
return Promise.resolve(this.getTreeNodesData());
|
||||
}
|
||||
|
||||
getLazyFiles() {
|
||||
return Promise.resolve(this.getLazyNodesData());
|
||||
}
|
||||
|
||||
getFilesystem() {
|
||||
return Promise.resolve(this.getFileSystemNodesData());
|
||||
}
|
||||
|
||||
};
|
||||
113
src/app/core/services/product.service.ts
Normal file
113
src/app/core/services/product.service.ts
Normal file
@@ -0,0 +1,113 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { Product } from './product';
|
||||
|
||||
@Injectable()
|
||||
export class ProductService {
|
||||
|
||||
status: string[] = ['OUTOFSTOCK', 'INSTOCK', 'LOWSTOCK'];
|
||||
|
||||
productNames: string[] = [
|
||||
"Bamboo Watch",
|
||||
"Black Watch",
|
||||
"Blue Band",
|
||||
"Blue T-Shirt",
|
||||
"Bracelet",
|
||||
"Brown Purse",
|
||||
"Chakra Bracelet",
|
||||
"Galaxy Earrings",
|
||||
"Game Controller",
|
||||
"Gaming Set",
|
||||
"Gold Phone Case",
|
||||
"Green Earbuds",
|
||||
"Green T-Shirt",
|
||||
"Grey T-Shirt",
|
||||
"Headphones",
|
||||
"Light Green T-Shirt",
|
||||
"Lime Band",
|
||||
"Mini Speakers",
|
||||
"Painted Phone Case",
|
||||
"Pink Band",
|
||||
"Pink Purse",
|
||||
"Purple Band",
|
||||
"Purple Gemstone Necklace",
|
||||
"Purple T-Shirt",
|
||||
"Shoes",
|
||||
"Sneakers",
|
||||
"Teal T-Shirt",
|
||||
"Yellow Earbuds",
|
||||
"Yoga Mat",
|
||||
"Yoga Set",
|
||||
];
|
||||
|
||||
constructor(private http: HttpClient) { }
|
||||
|
||||
getProductsSmall() {
|
||||
return this.http.get<any>('assets\products.json')
|
||||
.toPromise()
|
||||
.then(res => <Product[]>res.data)
|
||||
.then(data => { return data; });
|
||||
}
|
||||
|
||||
getProducts() {
|
||||
return this.http.get<any>('assets/products.json')
|
||||
.toPromise()
|
||||
.then(res => <Product[]>res.data)
|
||||
.then(data => { return data; });
|
||||
}
|
||||
|
||||
getProductsWithOrdersSmall() {
|
||||
return this.http.get<any>('assets/products-orders-small.json')
|
||||
.toPromise()
|
||||
.then(res => <Product[]>res.data)
|
||||
.then(data => { return data; });
|
||||
}
|
||||
|
||||
generatePrduct(): Product {
|
||||
const product: Product = {
|
||||
id: this.generateId(),
|
||||
name: this.generateName(),
|
||||
description: "Product Description",
|
||||
price: this.generatePrice(),
|
||||
quantity: this.generateQuantity(),
|
||||
category: "Product Category",
|
||||
inventoryStatus: this.generateStatus(),
|
||||
rating: this.generateRating()
|
||||
};
|
||||
|
||||
// product.image = product.name.toLocaleLowerCase().split(/[ ,]+/).join('-')+".jpg";;
|
||||
return product;
|
||||
}
|
||||
|
||||
generateId() {
|
||||
let text = "";
|
||||
let possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
|
||||
for (var i = 0; i < 5; i++) {
|
||||
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
generateName() {
|
||||
return this.productNames[Math.floor(Math.random() * Math.floor(30))];
|
||||
}
|
||||
|
||||
generatePrice() {
|
||||
return Math.floor(Math.random() * Math.floor(299)+1);
|
||||
}
|
||||
|
||||
generateQuantity() {
|
||||
return Math.floor(Math.random() * Math.floor(75)+1);
|
||||
}
|
||||
|
||||
generateStatus() {
|
||||
return this.status[Math.floor(Math.random() * Math.floor(3))];
|
||||
}
|
||||
|
||||
generateRating() {
|
||||
return Math.floor(Math.random() * Math.floor(5)+1);
|
||||
}
|
||||
}
|
||||
12
src/app/core/services/product.ts
Normal file
12
src/app/core/services/product.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
export interface Product {
|
||||
id?:string;
|
||||
code?:string;
|
||||
name?:string;
|
||||
description?:string;
|
||||
price?:number;
|
||||
quantity?:number;
|
||||
inventoryStatus?:string;
|
||||
category?:string;
|
||||
image?:string;
|
||||
rating?:number;
|
||||
}
|
||||
109
src/app/core/services/sso.service.ts
Normal file
109
src/app/core/services/sso.service.ts
Normal file
@@ -0,0 +1,109 @@
|
||||
import { HttpClient, HttpHeaders } from "@angular/common/http";
|
||||
import { Injectable } from "@angular/core";
|
||||
import { Router } from "@angular/router";
|
||||
import { environment } from "src/environments/environment";
|
||||
import { CommonService } from "./common.service";
|
||||
import { of } from "rxjs";
|
||||
import { LoginModel, SSOLoginModel } from "../models/common-model/Sign-in.model";
|
||||
import { API } from "./api.service";
|
||||
import { securityFunctions } from "../common/security";
|
||||
import { CommonFunctionService } from "../common/common-function.service";
|
||||
import * as moment from "moment";
|
||||
|
||||
@Injectable()
|
||||
export class SSOService {
|
||||
sso: SSOLoginModel = new SSOLoginModel();
|
||||
constructor(private http: HttpClient, private router: Router, private apiServ: API, private commonService: CommonFunctionService) { }
|
||||
validateSSOLogin(key, loginUserId?) {
|
||||
sessionStorage.removeItem('LoginUserData');
|
||||
this.http.get("https://pro.ip-api.com/json/?fields=query,countryCode,lat,lon,city,proxy&&key=JZDsrdeBzIM0yyN").subscribe(data => {
|
||||
if (data) {
|
||||
let obj = {
|
||||
city: data['city'],
|
||||
countryCode: data['countryCode'],
|
||||
lat: data['lat'],
|
||||
lon: data['lon'],
|
||||
proxy: data['proxy'],
|
||||
iP: data['query'],
|
||||
};
|
||||
sessionStorage.setItem('IP', JSON.stringify(obj));
|
||||
let loginModel = new LoginModel();
|
||||
if (key) {
|
||||
let req_obj = {
|
||||
key: encodeURIComponent(key),
|
||||
city: obj.city,
|
||||
countryCode: obj.countryCode,
|
||||
lat: obj.lat,
|
||||
lon: obj.lon,
|
||||
proxy: obj.proxy,
|
||||
iP: obj.iP,
|
||||
};
|
||||
this.apiServ.AdminPost('/KeyGenerate/VendorSSOKey', req_obj).subscribe({
|
||||
next: res => {
|
||||
if (res && res.resp) {
|
||||
let data = null;
|
||||
if (loginUserId) {
|
||||
if (loginUserId.includes(" ")) {
|
||||
data = loginUserId.replace(/ /g, "+");
|
||||
} else {
|
||||
data = loginUserId;
|
||||
}
|
||||
}
|
||||
let loginId = loginUserId ? securityFunctions.decryptText(data) : null;
|
||||
// set before jwt token so other api work proper
|
||||
sessionStorage.setItem('JwtToken', res.respObj.JwtToken);
|
||||
sessionStorage.setItem('RefreshToken', res.respObj.RefreshToken);
|
||||
sessionStorage.setItem('JwtTokenExpiry', res.respObj.JwtTokenExpiry);
|
||||
securityFunctions.setSessionStorage('LoginUserData', JSON.stringify(res.respObj.userLogin));
|
||||
let date = new Date(moment(res.respObj.userLogin.last_login).format("YYYY MM DD hh:mm:ss") + " UTC");
|
||||
let lastLogin = moment(date.toString()).format("hh:mm:ss, DD MMM YYYY");
|
||||
sessionStorage.setItem('lastLogin', lastLogin);
|
||||
sessionStorage.setItem('userName', res.respObj.userLogin.first_name);
|
||||
this.commonService.FetchExtranetVendorMaster(res.respObj.userLogin.extranet_vendor_id, false).subscribe(data => {
|
||||
if (data) {
|
||||
securityFunctions.setSessionStorage('VData', JSON.stringify(data.Result[0]));
|
||||
}
|
||||
});
|
||||
this.router.navigate(['/'])
|
||||
this.commonService.StartTimer();
|
||||
} else {
|
||||
this.router.navigate(['/Auth/Login']);
|
||||
}
|
||||
},
|
||||
error: err => {
|
||||
this.router.navigate(['/Auth/Login']);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.router.navigate(['/Auth/Login']);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// GetUserdata(userid) {
|
||||
// if (userid) {
|
||||
// return this.http.get(environment.adminAPIUrl + "/UserAccount/GetUserDetail/" + userid)
|
||||
// } else {
|
||||
// return of('continue');
|
||||
// }
|
||||
// }
|
||||
UserIpDetails;
|
||||
GetIpAddress() {
|
||||
this.http.get("https://pro.ip-api.com/json/?fields=query,countryCode,lat,lon,city,proxy&&key=JZDsrdeBzIM0yyN").subscribe(res => {
|
||||
if (res) {
|
||||
this.UserIpDetails = res;
|
||||
let obj = {
|
||||
city: res['city'],
|
||||
countryCode: res['countryCode'],
|
||||
lat: res['lat'],
|
||||
lon: res['lon'],
|
||||
proxy: res['proxy'],
|
||||
iP: res['query'],
|
||||
}
|
||||
sessionStorage.setItem('IP', JSON.stringify(obj));
|
||||
}
|
||||
})
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<div class="progress-loader" [hidden]="!loading">
|
||||
<!-- -->
|
||||
<div class="loading-spinner">
|
||||
<div class="row examples">
|
||||
<div class="col-3">
|
||||
<div class="snippet" data-title=".dot-pulse">
|
||||
<div class="stage">
|
||||
<div class="dot-pulse"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,23 @@
|
||||
import { ChangeDetectorRef, Component, OnInit } from '@angular/core';
|
||||
import { LoaderService } from 'src/app/core/common/loader.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-loader',
|
||||
templateUrl: './intercept-loader.component.html',
|
||||
})
|
||||
export class LoaderComponent implements OnInit {
|
||||
|
||||
loading: boolean;
|
||||
|
||||
constructor(private loaderService: LoaderService, private cd: ChangeDetectorRef) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.loaderService.isLoading.subscribe((v) => {
|
||||
this.loading = v;
|
||||
this.cd.detectChanges();
|
||||
});
|
||||
}
|
||||
}
|
||||
13
src/app/core/shared/shared.module.ts
Normal file
13
src/app/core/shared/shared.module.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
],
|
||||
imports: [
|
||||
CommonModule
|
||||
]
|
||||
})
|
||||
export class SharedModule { }
|
||||
19
src/app/layouts/base/base.component.html
Normal file
19
src/app/layouts/base/base.component.html
Normal file
@@ -0,0 +1,19 @@
|
||||
<div class="app-main" [ngClass]="{'ng-app-main-active': ChcekSidebar.activeSide == 'IsActive'}">
|
||||
<div class="app-asidebar">
|
||||
<custom-sidebar></custom-sidebar>
|
||||
</div>
|
||||
<div [ngStyle]="{'padding-top.px': headerHeight}" style="height: 100%;">
|
||||
<div class="app-mainBody">
|
||||
<div class="app-header" #headerElement>
|
||||
<app-header></app-header>
|
||||
</div>
|
||||
<div class="app-mainContent">
|
||||
<router-outlet></router-outlet>
|
||||
</div>
|
||||
<div class="app-extra-space"></div>
|
||||
<!-- <div class="app-footer">
|
||||
<app-footer></app-footer>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
34
src/app/layouts/base/base.component.ts
Normal file
34
src/app/layouts/base/base.component.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { Component, ElementRef, OnDestroy, ViewChild } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { ActiveSidebarService } from 'src/app/core/services/active-sidebar.service';
|
||||
|
||||
@Component({
|
||||
templateUrl: './base.component.html',
|
||||
selector: 'app-base',
|
||||
})
|
||||
export class BaseComponent {
|
||||
constructor(public ChcekSidebar: ActiveSidebarService) {}
|
||||
|
||||
@ViewChild('headerElement') headerElement!: ElementRef;
|
||||
headerHeight: number = 0;
|
||||
resizeObserver!: ResizeObserver;
|
||||
ngAfterViewInit() {
|
||||
this.resizeObserver = new ResizeObserver(entries => {
|
||||
for (let entry of entries) {
|
||||
if (entry.target === this.headerElement.nativeElement) {
|
||||
this.headerHeight = entry.contentRect.height;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (this.headerElement && this.headerElement.nativeElement) {
|
||||
this.resizeObserver.observe(this.headerElement.nativeElement);
|
||||
}
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if (this.resizeObserver && this.headerElement && this.headerElement.nativeElement) {
|
||||
this.resizeObserver.unobserve(this.headerElement.nativeElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<!-- <div class="progress-loader" [hidden]="!loading">
|
||||
<div class="loading-spinner">
|
||||
<div class="row examples">
|
||||
<div class="col-3">
|
||||
<div class="snippet" data-title=".dot-pulse">
|
||||
<div class="stage">
|
||||
<div class="dot-pulse"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
22
src/app/layouts/intercept-loader/loader/loader.component.ts
Normal file
22
src/app/layouts/intercept-loader/loader/loader.component.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { ChangeDetectorRef, Component, OnInit } from '@angular/core';
|
||||
import { LoaderService } from 'src/app/core/common/loader.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-loader',
|
||||
templateUrl: './loader.component.html',
|
||||
})
|
||||
export class LoaderComponent implements OnInit {
|
||||
|
||||
loading: boolean;
|
||||
|
||||
constructor(private loaderService: LoaderService, private cd: ChangeDetectorRef) {
|
||||
|
||||
|
||||
}
|
||||
ngOnInit() {
|
||||
this.loaderService.isLoading.subscribe((v) => {
|
||||
this.loading = v;
|
||||
this.cd.detectChanges();
|
||||
});
|
||||
}
|
||||
}
|
||||
68
src/app/layouts/pages-routing.module.ts
Normal file
68
src/app/layouts/pages-routing.module.ts
Normal file
@@ -0,0 +1,68 @@
|
||||
// Angular
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
// Components
|
||||
import { AuthGuard } from '../core/guard/auth.guard';
|
||||
import { BaseComponent } from './base/base.component';
|
||||
import { unauthorizedComponent } from './unauthorized/unauthorized.component';
|
||||
// Auth
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
canActivate: [AuthGuard],
|
||||
component: BaseComponent,
|
||||
children: [
|
||||
{
|
||||
path: "Unauthorized",
|
||||
component: unauthorizedComponent,
|
||||
},
|
||||
{
|
||||
path: 'BookingManagement',
|
||||
loadChildren: () =>
|
||||
import('../modules/booking-management/booking-management.module').then(
|
||||
(m) => m.BookingManagementModule
|
||||
),
|
||||
},
|
||||
{
|
||||
path: 'Services',
|
||||
loadChildren: () =>
|
||||
import('../modules/services/services.module').then((m) => m.ServicesModule),
|
||||
},
|
||||
{
|
||||
path: 'UserConfiguration',
|
||||
loadChildren: () =>
|
||||
import('../modules/user-configuration/user-configuration.module').then((m) => m.UserConfigurationModule),
|
||||
},
|
||||
{
|
||||
path: 'ActivityConfiguration',
|
||||
loadChildren: () =>
|
||||
import('../modules/services/activity-config/activity-config.module').then((m) => m.ActivityConfigModule),
|
||||
},
|
||||
// {
|
||||
// path: 'Error/403',
|
||||
// data: {
|
||||
// type: 'error-v6',
|
||||
// code: 403,
|
||||
// title: '403... Access forbidden',
|
||||
// desc: "Looks like you don't have permission to access for requested page.<br> Please, contact administrator",
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// path: 'Error/404',
|
||||
// data: {
|
||||
// type: 'error-v4',
|
||||
// },
|
||||
// },
|
||||
// { path: 'Error/:type' },
|
||||
{ path: '', redirectTo: '', pathMatch: 'full' },
|
||||
{ path: '**', redirectTo: 'Error/404', pathMatch: 'full' },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class PagesRoutingModule { }
|
||||
51
src/app/layouts/theme.module.ts
Normal file
51
src/app/layouts/theme.module.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
|
||||
// Angular
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { RouterModule } from '@angular/router';
|
||||
// NgBootstrap
|
||||
// Translation
|
||||
import { BaseComponent } from './base/base.component';
|
||||
import { PagesRoutingModule } from './pages-routing.module';
|
||||
import { FooterComponent } from '../modules/common/footer/footer.component';
|
||||
import { HeaderComponent } from '../modules/common/header/header.component';
|
||||
//Angular Material
|
||||
import { MatExpansionModule } from '@angular/material/expansion';
|
||||
import { AuthGuard } from '../core/guard/auth.guard';
|
||||
import { SideBarComponent } from '../modules/common/sidebar/sidebar.component';
|
||||
import { PanelMenuModule } from 'primeng/panelmenu';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { unauthorizedComponent } from './unauthorized/unauthorized.component';
|
||||
import { CustomSidebarComponent } from '../modules/common/custom-sidebar/custom-sidebar.component';
|
||||
import { CustomSidebarItemComponent } from '../modules/common/custom-sidebar/custom-sidebar-item/custom-sidebar-item.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
BaseComponent,
|
||||
FooterComponent,
|
||||
HeaderComponent,
|
||||
SideBarComponent,
|
||||
unauthorizedComponent,
|
||||
CustomSidebarComponent,
|
||||
CustomSidebarItemComponent,
|
||||
],
|
||||
imports: [
|
||||
CommonModule,
|
||||
RouterModule,
|
||||
PagesRoutingModule,
|
||||
|
||||
// material module
|
||||
MatExpansionModule,
|
||||
MatButtonModule,
|
||||
MatMenuModule,
|
||||
// material module
|
||||
|
||||
// prime ng
|
||||
PanelMenuModule
|
||||
],
|
||||
exports: [],
|
||||
providers: [],
|
||||
})
|
||||
export class ThemeModule { }
|
||||
|
||||
59
src/app/layouts/unauthorized/unauthorized.component.html
Normal file
59
src/app/layouts/unauthorized/unauthorized.component.html
Normal file
@@ -0,0 +1,59 @@
|
||||
<div class="error-404">
|
||||
<div class="errorWrap">
|
||||
<div class="errorSvG"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="400px" height="400px" viewBox="0 0 871 731">
|
||||
<defs>
|
||||
<clipPath id="clip-_403_SVG">
|
||||
<rect width="871" height="731"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
<g id="_403_SVG" data-name="403 SVG" clip-path="url(#clip-_403_SVG)">
|
||||
<rect width="871" height="731" fill="#fff"/>
|
||||
<g id="_403_SVG-2" data-name="403 SVG" transform="translate(-14.173 -11.597)">
|
||||
<g id="Group_13964" data-name="Group 13964">
|
||||
<g id="Group_13963" data-name="Group 13963">
|
||||
<path id="Path_14692" data-name="Path 14692" d="M162.71,414.43s-2.02.84-5.46,2.47" fill="none" stroke="#204482" stroke-miterlimit="10" stroke-width="1"/>
|
||||
<path id="Path_14693" data-name="Path 14693" d="M146.49,422.35c-44.3,23.8-154.05,99.36.91,201.27C336.19,747.78,507.15,486.6,507.15,486.6l182.8-113.06s272.22-20.34,119.1-210.83c0,0-50.14-63.02-200.74-86.68" fill="none" stroke="#204482" stroke-miterlimit="10" stroke-width="1" stroke-dasharray="12.062 12.062"/>
|
||||
<path id="Path_14694" data-name="Path 14694" d="M602.35,75.12q-2.94-.435-5.94-.85" fill="none" stroke="#204482" stroke-miterlimit="10" stroke-width="1"/>
|
||||
</g>
|
||||
</g>
|
||||
<path id="Path_14695" data-name="Path 14695" d="M674.67,565.19q9.165-9,18.33-18.01c-.38-.68-.59-1.06-.8-1.44q-23.58-43.05,1.3-85.36c1.56-2.66,3.64-2.66,5.23-.03,13.75,22.65,16.29,46.52,7.81,71.59-.14.42-.28.84-.42,1.27-.01.04.03.09-.02-.04,7.68-7.68,15.41-15.4,22.94-22.92-2-4.77-4.46-9.49-6.01-14.49-6.23-20.12-3.79-39.26,7.22-57.25,1.48-2.43,3.52-2.46,5.01-.07a67.64,67.64,0,0,1,10.41,41.01,69.766,69.766,0,0,1-3.19,16.69,7.072,7.072,0,0,0-.18.71q10.17-10.17,20.7-20.71c-1.05-2.29-2.45-4.87-3.47-7.6q-9.285-24.975,4.38-47.92c1.63-2.74,3.69-2.73,5.31-.03a53.415,53.415,0,0,1,6.11,42.83c-.05.19-.09.39-.12.58a1.455,1.455,0,0,0,.08.34c.36-.3.67-.54.95-.81,2.19-2.18,4.4-4.34,6.54-6.57a5.033,5.033,0,0,0,1.14-2.01c6.03-20.57,19.34-33.66,40.12-39.06,2.81-.73,4.3.77,3.58,3.56q-8.13,31.26-39.2,40.15a5.8,5.8,0,0,0-2.26,1.29c-2.44,2.34-4.8,4.76-7.35,7.32,2.77-.55,5.27-1.16,7.81-1.52a53.151,53.151,0,0,1,36.63,7.77c2.09,1.31,2.08,3.45-.03,4.77a53.993,53.993,0,0,1-55.34,1.38,1.641,1.641,0,0,0-1.5.07c-6.84,6.76-13.63,13.57-20.73,20.66,2.39-.66,4.38-1.29,6.4-1.77q27.735-6.555,52.19,8.11c.3.18.59.37.88.56,2.1,1.42,2.11,3.41-.03,4.78a66.117,66.117,0,0,1-24.91,9.64,67.7,67.7,0,0,1-45.98-8.19c-.65-.37-1.11-.61-1.8.08q-11.07,11.145-22.2,22.23a3.761,3.761,0,0,0-.31.42c3.79-1.06,7.52-2.32,11.33-3.14,22.03-4.78,42.65-1.17,61.84,10.63,2.53,1.56,2.52,3.61,0,5.19a82.086,82.086,0,0,1-85.37,1.37c-.38-.22-.77-.43-1.16-.64q-9.345,9.12-18.62,18.18h-3.29C674.67,567.58,674.67,566.39,674.67,565.19Z" fill="#a1c7ff"/>
|
||||
<path id="Path_14696" data-name="Path 14696" d="M297.95,595.96q-10.065-7.98-20.14-15.96c.3-.72.47-1.12.64-1.52q18.885-45.315-10.35-84.74c-1.84-2.48-3.9-2.26-5.21.52-11.27,23.98-11.26,47.99-.17,72.02.19.4.37.81.55,1.22.02.03-.02.09.02-.04-8.45-6.82-16.96-13.68-25.24-20.36,1.48-4.95,3.42-9.91,4.43-15.05,4.06-20.66-.4-39.44-13.25-56.16-1.73-2.26-3.77-2.07-4.99.46a67.709,67.709,0,0,0-6,41.89,69.827,69.827,0,0,0,4.94,16.25c.13.31.23.63.25.69q-11.19-9.03-22.78-18.39c.8-2.38,1.92-5.1,2.64-7.93q6.585-25.83-9.44-47.18c-1.91-2.55-3.96-2.32-5.29.54a53.382,53.382,0,0,0-1.53,43.23q.105.285.18.57a2.071,2.071,0,0,1-.04.35,12.159,12.159,0,0,1-1.03-.71c-2.41-1.94-4.84-3.85-7.2-5.84a4.951,4.951,0,0,1-1.34-1.88c-8.18-19.82-22.8-31.42-44.04-34.58-2.88-.43-4.2,1.22-3.18,3.92q11.4,30.21,43.24,35.76a5.782,5.782,0,0,1,2.38,1.04c2.68,2.06,5.28,4.23,8.08,6.5-2.82-.25-5.37-.6-7.93-.69a53.2,53.2,0,0,0-35.6,11.61c-1.94,1.52-1.71,3.65.54,4.74a54.015,54.015,0,0,0,55.18-4.5,1.619,1.619,0,0,1,1.49-.09c7.52,6,15,12.05,22.81,18.35-2.44-.41-4.49-.82-6.55-1.08q-28.275-3.57-51.04,13.6c-.28.21-.55.43-.82.65-1.94,1.64-1.74,3.61.54,4.75a66.161,66.161,0,0,0,25.79,6.94,67.663,67.663,0,0,0,44.85-13.03c.61-.44,1.04-.73,1.79-.11q12.18,9.915,24.43,19.75a3.089,3.089,0,0,1,.35.38c-3.88-.65-7.72-1.5-11.6-1.92-22.41-2.41-42.54,3.36-60.37,17.14-2.35,1.82-2.12,3.86.55,5.16a81.257,81.257,0,0,0,49.46,7.33,80.382,80.382,0,0,0,35.57-15.03c.36-.26.73-.51,1.09-.76q10.26,8.085,20.44,16.1c1.09-.12,2.18-.23,3.27-.35C298.2,598.34,298.08,597.15,297.95,595.96Z" fill="#a1c7ff"/>
|
||||
<path id="Path_14697" data-name="Path 14697" d="M482.45,107.42c20.2,0,40.41-.12,60.61.02,52.27.36,88.66,38.7,88.71,93.35.03,29.68-.18,59.37.16,89.05.08,6.7-2.02,8.52-8.09,8.19-8.79-.48-17.63-.37-26.43-.03-4.89.19-6.16-1.65-6.13-6.62.19-28.56.12-57.12.04-85.68-.09-33.87-21.46-56.12-53.85-56.15q-55.125-.045-110.26-.01c-32.65.08-54.06,22.61-54.12,56.8-.04,28.11-.13,56.22.11,84.33.05,5.58-1.58,7.54-6.95,7.33-9.23-.37-18.48-.23-27.72-.07-3.95.07-5.78-1.04-5.76-5.68.2-33.51-.51-67.03.41-100.51,1.22-44.33,37.27-82.2,79.63-83.93,23.18-.95,46.42-.17,69.63-.17A1.609,1.609,0,0,0,482.45,107.42Z" fill="#fff" stroke="#204482" stroke-miterlimit="10" stroke-width="10"/>
|
||||
<path id="Path_14698" data-name="Path 14698" d="M684.59,668.34c-2.82-4.53-5.78-7.19-5.53-9.47s3.73-5.77,5.78-5.75c2.01.01,5.44,3.65,5.6,5.9C690.61,661.33,687.57,663.89,684.59,668.34Z" fill="#e91200"/>
|
||||
<path id="Path_14699" data-name="Path 14699" d="M482.88,696.76h0c134.56,0,243.64-109.08,243.64-243.64V366.8a68.032,68.032,0,0,0-68.03-68.03H307.28a68.032,68.032,0,0,0-68.03,68.03v86.32C239.24,587.68,348.32,696.76,482.88,696.76Z" fill="#fff" stroke="#204482" stroke-miterlimit="10" stroke-width="10"/>
|
||||
<g id="Group_13965" data-name="Group 13965">
|
||||
<path id="Path_14700" data-name="Path 14700" d="M200.76,625.81a1.675,1.675,0,0,1-2.37-.05l-2.96-3.08-3.08,2.97a1.68,1.68,0,0,1-2.33-2.42l3.08-2.97-2.97-3.08a1.675,1.675,0,0,1,.05-2.37,1.694,1.694,0,0,1,1.19-.47,1.673,1.673,0,0,1,1.17.51l2.97,3.08,3.08-2.96a1.675,1.675,0,0,1,2.37.05,1.694,1.694,0,0,1,.47,1.19,1.673,1.673,0,0,1-.51,1.17l-3.08,2.96,2.96,3.08A1.69,1.69,0,0,1,200.76,625.81Z" fill="none" stroke="#204482" stroke-miterlimit="10" stroke-width="3"/>
|
||||
</g>
|
||||
<g id="Group_13966" data-name="Group 13966">
|
||||
<path id="Path_14701" data-name="Path 14701" d="M814.34,598.97a1.675,1.675,0,0,1-2.37-.05l-2.96-3.08-3.08,2.97a1.68,1.68,0,0,1-2.33-2.42l3.08-2.97-2.97-3.08a1.675,1.675,0,0,1,.05-2.37,1.694,1.694,0,0,1,1.19-.47,1.673,1.673,0,0,1,1.17.51l2.97,3.08,3.08-2.96a1.675,1.675,0,0,1,2.37.05,1.694,1.694,0,0,1,.47,1.19,1.673,1.673,0,0,1-.51,1.17l-3.08,2.96,2.96,3.08A1.69,1.69,0,0,1,814.34,598.97Z" fill="none" stroke="#204482" stroke-miterlimit="10" stroke-width="3"/>
|
||||
</g>
|
||||
<circle id="Ellipse_990" data-name="Ellipse 990" cx="9.07" cy="9.07" r="9.07" transform="translate(837.64 415.71)" fill="none" stroke="#1f4582" stroke-miterlimit="10" stroke-width="4"/>
|
||||
<circle id="Ellipse_991" data-name="Ellipse 991" cx="6.66" cy="6.66" r="6.66" transform="translate(195.48 162.25)" fill="none" stroke="#1f4582" stroke-miterlimit="10" stroke-width="2.938"/>
|
||||
<path id="Path_14702" data-name="Path 14702" d="M44.35,379.92l11.17-4.75a.851.851,0,0,0,.18-1.46l-9.7-7.3a.848.848,0,0,0-1.35.58l-1.47,12.05A.845.845,0,0,0,44.35,379.92Z" fill="none" stroke="#204482" stroke-miterlimit="10" stroke-width="3"/>
|
||||
<path id="Path_14703" data-name="Path 14703" d="M696.32,191.92l11.17-4.75a.851.851,0,0,0,.18-1.46l-9.7-7.3a.847.847,0,0,0-1.35.58l-1.47,12.05A.842.842,0,0,0,696.32,191.92Z" fill="none" stroke="#204482" stroke-miterlimit="10" stroke-width="3"/>
|
||||
<circle id="Ellipse_992" data-name="Ellipse 992" cx="94.11" cy="94.11" r="94.11" transform="translate(388.77 403.65)" fill="none" stroke="#fff" stroke-miterlimit="10" stroke-width="18"/>
|
||||
<path id="Path_14704" data-name="Path 14704" d="M498.02,493.96l6.25,75.59h-42.8l5.8-75.85a31.958,31.958,0,1,1,30.75.26Z" fill="#fff" stroke="#204482" stroke-miterlimit="10" stroke-width="10"/>
|
||||
<g id="Group_13967" data-name="Group 13967">
|
||||
<path id="Path_14705" data-name="Path 14705" d="M570.92,76.28q-21.105-14.355-42.18-28.75c-.2-.14-.47-.23-.57-.42a1.814,1.814,0,0,1-.36-1.08c.06-.27.52-.48.84-.64a1.408,1.408,0,0,1,.62-.04q33.165-1.23,66.21-4.34c2.03-.19,4.06-.41,6.09-.59,1.02-.09,1.43.48,1.12,1.45-.11.35-.05.77-.14,1.13a2.447,2.447,0,0,1-.48,1.15,69.939,69.939,0,0,0-11.08,12.72,3.05,3.05,0,0,0-.48,1.64c.02,4.79.1,9.59.12,14.38,0,.42-.22,1.06-.52,1.19-.32.14-.85-.19-1.28-.34a1.492,1.492,0,0,1-.35-.27,16.418,16.418,0,0,0-10.44-3.57,1.447,1.447,0,0,0-1.03.51c-1.07,1.56-2.04,3.17-3.1,4.74a16.2,16.2,0,0,1-1.39,1.56A5.456,5.456,0,0,1,570.92,76.28Zm12.34-16.03a2.889,2.889,0,0,0-.47-.16,257.517,257.517,0,0,1-34.64-8.2c-4.3-1.29-8.75-2.05-13.14-3.05a1.408,1.408,0,0,0-.83.04c12.36,8.45,24.71,16.91,37.17,25.43A41.567,41.567,0,0,1,583.26,60.25ZM547.63,48.91q20.22,2.91,40.44,5.76c.45.06.81.16,1.12-.39a42.823,42.823,0,0,1,9.01-11.26c.08-.07.14-.16.36-.4-20.77,2.01-41.38,3.45-62.03,4.51C540.24,47.73,543.93,48.38,547.63,48.91Z" fill="#204482"/>
|
||||
<path id="Path_14706" data-name="Path 14706" d="M525.39,47.44c.09-.19.4-.53.37-.83a1.151,1.151,0,0,0-.61-.86c-1.69-.4-3.4-.74-5.12-1a1.162,1.162,0,0,0-.91.63c-.1.29.14.99.35,1.04,1.83.44,3.68.78,5.53,1.14A3.141,3.141,0,0,0,525.39,47.44Z" fill="#204482"/>
|
||||
<path id="Path_14707" data-name="Path 14707" d="M522.77,39.7c.46.52.8.9,1.13,1.28.63.71,1.26,1.43,1.91,2.13a.95.95,0,1,0,1.44-1.24c-.9-1.03-1.79-2.08-2.76-3.04a1.253,1.253,0,0,0-1.17-.15C523.03,38.83,522.94,39.37,522.77,39.7Z" fill="#204482"/>
|
||||
<path id="Path_14708" data-name="Path 14708" d="M525.89,48.76a5.715,5.715,0,0,0-3.01,2.84,1.243,1.243,0,0,0,.39,1.17,1.442,1.442,0,0,0,1.21-.28,13.935,13.935,0,0,0,2.05-1.94,1.468,1.468,0,0,0,.29-1.22C526.7,49.02,526.13,48.89,525.89,48.76Z" fill="#204482"/>
|
||||
<path id="Path_14709" data-name="Path 14709" d="M571.36,74.32a41.573,41.573,0,0,1,11.9-14.07,2.889,2.889,0,0,0-.47-.16,257.517,257.517,0,0,1-34.64-8.2c-4.3-1.29-8.75-2.05-13.14-3.05a1.408,1.408,0,0,0-.83.04Q552.72,61.57,571.36,74.32Z" fill="#3666b6"/>
|
||||
<path id="Path_14710" data-name="Path 14710" d="M536.54,47.14c3.7.6,7.39,1.24,11.1,1.78q20.22,2.91,40.44,5.76c.45.06.81.16,1.12-.39a42.823,42.823,0,0,1,9.01-11.26c.08-.07.14-.16.36-.4C577.79,44.64,557.18,46.07,536.54,47.14Z" fill="#3666b6"/>
|
||||
</g>
|
||||
<path id="Path_14711" data-name="Path 14711" d="M674.84,576.63c-.01-.22-.03-.45-.04-.67-.91-13.63,3.17-17.24,15.95-13.36,1.89.57,4.37,4.13,4.24,6.15q-2.16,33.525-5.32,66.97c-.18,1.95-3.03,3.63-4.64,5.44-1.79-2.09-4.92-4.03-5.15-6.3-2.01-19.37-3.5-38.81-5.14-58.22A.275.275,0,0,1,674.84,576.63Z" fill="#e91200"/>
|
||||
<path id="Path_14712" data-name="Path 14712" d="M684.32,686.71q-40.935,0-81.88-.01c-11.4-.01-13.39-3.55-7.84-13.61q41.385-75.045,82.75-150.1c5.24-9.51,9.3-9.67,14.51-.26q42.09,76.185,84.04,152.45c4.11,7.46,1.89,11.45-6.47,11.47-28.37.08-56.74.03-85.1.03C684.32,686.7,684.32,686.7,684.32,686.71Zm-9.48-110.08c-.04,0-.07.01-.11.01,1.64,19.41,3.13,38.85,5.14,58.22.24,2.27,3.36,4.21,5.15,6.3,1.61-1.81,4.46-3.49,4.64-5.44q3.12-33.435,5.32-66.97c.13-2.01-2.35-5.57-4.24-6.15-12.79-3.88-16.86-.27-15.95,13.36C674.81,576.18,674.82,576.4,674.84,576.63Zm9.75,91.71c2.98-4.45,6.02-7.01,5.85-9.32-.16-2.26-3.59-5.89-5.6-5.9-2.05-.01-5.52,3.48-5.78,5.75S681.77,663.81,684.59,668.34Z" fill="#fff"/>
|
||||
<path id="Path_14713" data-name="Path 14713" d="M684.54,696.06q-47.685,0-95.38-.01c-12.53-.01-15.1-4.68-8.82-16.14q47.745-87.12,95.54-174.19,8.715-15.885,17.78.08c9.64,16.95,19.49,33.77,28.84,50.9q34.14,62.595,67.87,125.43c4.67,8.66,1.7,13.87-7.88,13.89q-48.975.105-97.96.03C684.54,696.04,684.54,696.05,684.54,696.06Zm-.22-9.35v-.02c28.37,0,56.74.05,85.1-.03,8.36-.02,10.58-4.01,6.47-11.47q-41.97-76.26-84.04-152.45c-5.2-9.42-9.26-9.26-14.51.26q-41.37,75.06-82.75,150.1c-5.55,10.06-3.56,13.6,7.84,13.61Q643.38,686.74,684.32,686.71Z" fill="#e91200"/>
|
||||
<path id="Path_14714" data-name="Path 14714" d="M311.23,257.68c-2.86,9.7-6.38,18.92-8.25,28.49-4.75,24.25-1.96,47.77,7.8,70.44a27.284,27.284,0,0,1,2.29,12.9c-3.71,36.18-20.7,63.44-52.97,77.6s-63.25,9.1-90.91-13.62c-19.79-16.26-29.49-38.47-31.93-64.32a20.481,20.481,0,0,1,1.3-9.79c14.65-32.81,14.47-65.54.1-98.34a13.419,13.419,0,0,1-.61-2.18c11.43-5.54,23.11-10.2,33.75-16.7a43.083,43.083,0,0,1,24.26-6.67c21.47.3,42.96-.25,64.43-.27a20.811,20.811,0,0,1,8.68,1.76c13.46,6.35,26.79,13.01,40.16,19.58C310.08,256.92,310.77,257.41,311.23,257.68ZM225.3,244.65c-7.91,0-15.02.39-22.08-.09-11.44-.78-21.92.97-31.6,8.2-4.98,3.72-11.05,5.98-16.86,8.27-4.07,1.6-5.3,3.42-3.78,7.94,10.48,31.07,9.14,61.69-3.48,91.88a19.788,19.788,0,0,0-1.53,9.07c3.86,41.36,36.84,74.45,74.9,75.39,42.62,1.05,76.65-28.28,82.45-71.6a32.251,32.251,0,0,0-1.97-15.47c-10.54-26.47-12.62-53.42-5.42-81.08,3.55-13.63,2.86-12.26-8.63-20-17.82-12-36.76-14.73-57.04-12.76C228.35,244.58,226.41,244.6,225.3,244.65Z" fill="#e91200"/>
|
||||
<path id="Path_14715" data-name="Path 14715" d="M225.3,244.65c1.11-.06,3.04-.08,4.97-.26,20.28-1.97,39.22.75,57.04,12.76,11.49,7.74,12.18,6.37,8.63,20-7.2,27.66-5.12,54.61,5.42,81.08a32.267,32.267,0,0,1,1.97,15.47c-5.8,43.32-39.83,72.65-82.45,71.6-38.06-.94-71.04-34.03-74.9-75.39a19.92,19.92,0,0,1,1.53-9.07c12.62-30.18,13.96-60.81,3.48-91.88-1.52-4.52-.29-6.34,3.78-7.94,5.81-2.29,11.88-4.55,16.86-8.27,9.68-7.23,20.16-8.97,31.6-8.2C210.28,245.04,217.39,244.65,225.3,244.65Z" fill="#fff"/>
|
||||
<path id="Path_14716" data-name="Path 14716" d="M250.22,302.81c7.4,5.89,10.95,8.49,18.38,14.41-16.93,19.22-28.91,42.35-45.78,61.51-12.7-10.55-24.64-20.72-37.22-30.44,5.14-7.41,6.43-8.3,11.67-16.55,7.8,6.85,15.12,13.27,23.4,20.54C230.56,335.72,240.15,319.66,250.22,302.81Z" fill="#e91200"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg></div>
|
||||
<div class="errorContent">
|
||||
<h1>4Ø3</h1>
|
||||
<h3>Sorry! You are not authorized to view this page.</h3>
|
||||
<h5>Please contact your administrator</h5>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
16
src/app/layouts/unauthorized/unauthorized.component.ts
Normal file
16
src/app/layouts/unauthorized/unauthorized.component.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { CommonFunctionService } from 'src/app/core/common/common-function.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-Unauthorized',
|
||||
templateUrl: './unauthorized.component.html',
|
||||
})
|
||||
export class unauthorizedComponent implements OnInit {
|
||||
|
||||
constructor(private _commonSer: CommonFunctionService) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this._commonSer.CheckTokenExpireTime(false)
|
||||
}
|
||||
|
||||
}
|
||||
0
src/app/modules/auth/auth.component.html
Normal file
0
src/app/modules/auth/auth.component.html
Normal file
14
src/app/modules/auth/auth.component.ts
Normal file
14
src/app/modules/auth/auth.component.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-auth',
|
||||
templateUrl: './auth.component.html',
|
||||
})
|
||||
export class AuthComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
}
|
||||
63
src/app/modules/auth/auth.module.ts
Normal file
63
src/app/modules/auth/auth.module.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { MessageService } from 'primeng/api';
|
||||
import { PasswordModule } from 'primeng/password';
|
||||
import { ToastModule } from 'primeng/toast';
|
||||
import { ValidationService } from 'src/app/core/common/validation.service';
|
||||
import { LoginComponent } from './login/login.component';
|
||||
import { InterceptLoader } from 'src/app/core/common/intercept-loader.service';
|
||||
import { ForgetPasswordComponent } from './forget-password/forget-password.component';
|
||||
import { VerifyEmailComponent } from './verify-email/verify-email.component';
|
||||
import { NgOtpInputModule } from 'ng-otp-input';
|
||||
import { SingleSignOnComponent } from './single-sign-on/single-sign-on.component';
|
||||
import { SSOService } from 'src/app/core/services/sso.service';
|
||||
import { ButtonModule } from 'primeng/button';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: 'Login',
|
||||
component: LoginComponent
|
||||
},
|
||||
{
|
||||
path: 'Forget-Password',
|
||||
component: ForgetPasswordComponent
|
||||
},
|
||||
{
|
||||
path: 'verify-email',
|
||||
component: VerifyEmailComponent
|
||||
},
|
||||
{
|
||||
path: 'SSOLogin',
|
||||
component: SingleSignOnComponent
|
||||
},
|
||||
{ path: '', redirectTo: 'Login', pathMatch: 'full' },
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
LoginComponent,
|
||||
ForgetPasswordComponent,
|
||||
VerifyEmailComponent,
|
||||
SingleSignOnComponent,
|
||||
],
|
||||
imports: [
|
||||
ButtonModule,
|
||||
ToastModule,
|
||||
CommonModule,
|
||||
PasswordModule,
|
||||
NgOtpInputModule,
|
||||
HttpClientModule,
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
MatCheckboxModule,
|
||||
RouterModule.forChild(routes),
|
||||
],
|
||||
providers: [MessageService, ValidationService,
|
||||
SSOService,
|
||||
{ provide: HTTP_INTERCEPTORS, useClass: InterceptLoader, multi: true }]
|
||||
})
|
||||
export class AuthModule { }
|
||||
@@ -0,0 +1,89 @@
|
||||
<div class="app-ForgotWrap" *ngIf="showMsgValid" [ngStyle]="{'background-image':'url(' + commonService.environmentObj.cdnBaseUrl + 'assets/banner/bg-common.jpg)'}">
|
||||
<div class="app-ForgotBody">
|
||||
<div class="app-loginLogo">
|
||||
<img alt="">
|
||||
</div>
|
||||
<div class="profileReset_pwdWrapper" *ngIf="showMsgValid.Resp" [formGroup]="ResetPswdForm">
|
||||
<div class="ResetPassword">
|
||||
<div class="resetHead text-center mb-20">
|
||||
<h4 class="mb-3">Reset Your Password</h4>
|
||||
<span class="loginTxt">Enter your new password and then re-enter it for confirmation.</span>
|
||||
</div>
|
||||
<div class="formControlWrapper mb-0">
|
||||
<span class="formLabel">Create your password</span>
|
||||
<div style="position: relative;">
|
||||
<input class="formInput loginPassword" type="{{ showPass ? 'text' : 'password' }}"
|
||||
[ngClass]="{'errorInput': validationService.onBlur(ResetPswdForm.controls['Password'],'required') || validationService.onBlur(ResetPswdForm.controls['Password'],'pattern')}"
|
||||
placeholder="Enter your password" feedback="false"
|
||||
(keyup)="commonService.password_criteria(ResetPswdForm.get('Password').value)"
|
||||
formControlName="Password" (keyup)="onKeyUp($event)">
|
||||
<svg width="16px" height="16px" viewBox="0 0 24 24" id="lock" data-name="Flat Color" xmlns="http://www.w3.org/2000/svg" class="loginF_icons"><path id="primary" d="M18,8H17V7A5,5,0,0,0,7,7V8H6a2,2,0,0,0-2,2V20a2,2,0,0,0,2,2H18a2,2,0,0,0,2-2V10A2,2,0,0,0,18,8ZM9,7a3,3,0,0,1,6,0V8H9Z" style="fill: #8E8E8E;"></path><path id="secondary" d="M12,12a2.5,2.5,0,0,0-1,4.79V18a1,1,0,0,0,2,0V16.79A2.5,2.5,0,0,0,12,12Z" style="fill: #fff;"></path></svg>
|
||||
<i (click)="showPass =!showPass"
|
||||
[ngClass]="{'pi-eye-slash' : showPass , 'pi-eye': !showPass } " class="pi eyeICon"></i>
|
||||
</div>
|
||||
<span class="errorspan"
|
||||
*ngIf="validationService.onBlur(ResetPswdForm.controls['Password'],'required')">
|
||||
Please enter password </span>
|
||||
<span class="errorspan"
|
||||
*ngIf="validationService.onBlur(ResetPswdForm.controls['Password'],'pattern')">
|
||||
Please check the password criteria </span>
|
||||
</div>
|
||||
<div class="conditiontrue_wrapper">
|
||||
<ul>
|
||||
<li class="PswdCriteria"
|
||||
[ngClass]="{'PswdSuccess' : commonService.password_criteria_obj.is_lowerCase }">One
|
||||
lowercase letter</li>
|
||||
<li class="PswdCriteria"
|
||||
[class]="commonService.password_criteria_obj.is_Uppercase ? 'PswdSuccess': 'PswdFail'">One
|
||||
uppercase
|
||||
letter</li>
|
||||
<li class="PswdCriteria"
|
||||
[class]="commonService.password_criteria_obj.is_numbers ? 'PswdSuccess': 'PswdFail'">
|
||||
One number</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li class="PswdCriteria"
|
||||
[class]="commonService.password_criteria_obj.is_special_characters ? 'PswdSuccess': 'PswdFail'">
|
||||
One
|
||||
special character</li>
|
||||
<li class="PswdCriteria"
|
||||
[class]="commonService.password_criteria_obj.is_length ? 'PswdSuccess': 'PswdFail'">8
|
||||
characters minimum</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="formControlWrapper mb-4">
|
||||
<span class="formLabel">Confirm new password</span>
|
||||
<!-- <input [appGlobalValidation]='true' class="loginInput error-input" formControlName="confirm_password" type="text" placeholder=""
|
||||
[ngClass]="{'errorInput': validationService.onBlur(ResetPswdForm.controls['confirm_password'],'required') || validationService.onBlur(ResetPswdForm.controls['confirm_password'],'pattern')}" /> -->
|
||||
<div style="position: relative;">
|
||||
<input class="formInput loginPassword" type="{{ confirmPass ? 'text' : 'password' }}"
|
||||
[ngClass]="{'errorInput': validationService.onBlur(ResetPswdForm.controls['confirm_password'],'required') || validationService.onBlur(ResetPswdForm.controls['confirm_password'],'pattern')}"
|
||||
placeholder="Enter new password" feedback="false" formControlName="confirm_password"
|
||||
(keyup)="onKeyUp($event)">
|
||||
<svg width="16px" height="16px" viewBox="0 0 24 24" id="lock" data-name="Flat Color" xmlns="http://www.w3.org/2000/svg" class="loginF_icons"><path id="primary" d="M18,8H17V7A5,5,0,0,0,7,7V8H6a2,2,0,0,0-2,2V20a2,2,0,0,0,2,2H18a2,2,0,0,0,2-2V10A2,2,0,0,0,18,8ZM9,7a3,3,0,0,1,6,0V8H9Z" style="fill: #8E8E8E;"></path><path id="secondary" d="M12,12a2.5,2.5,0,0,0-1,4.79V18a1,1,0,0,0,2,0V16.79A2.5,2.5,0,0,0,12,12Z" style="fill: #fff;"></path></svg>
|
||||
<i (click)="confirmPass =!confirmPass"
|
||||
[ngClass]="{'pi-eye-slash' : confirmPass , 'pi-eye': !confirmPass } "
|
||||
class="pi eyeICon"></i>
|
||||
</div>
|
||||
<span class="errorspan"
|
||||
*ngIf="validationService.onBlur(ResetPswdForm.controls['confirm_password'],'required')"> Please
|
||||
enter confirm password </span>
|
||||
</div>
|
||||
<div class="profileReset_pwdBtn">
|
||||
<button class="btn btn-primary w-100" (click)="ResetPassword()">Reset Password</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="resetPwdCustom" *ngIf="!showMsgValid.Resp">
|
||||
<div class="custom-card cardDenied">
|
||||
<div class="card-content">
|
||||
<img [src]="commonService.environmentObj.cdnBaseUrl + 'assets/icon/cross.png'" alt="Image" width="100px">
|
||||
<h4 class="mt-2">Thank you.</h4>
|
||||
<h4 class="mb-3">{{showMsgValid.Message}}</h4>
|
||||
<p>You can close this page.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p-toast></p-toast>
|
||||
@@ -0,0 +1,88 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { CommonFunctionService } from 'src/app/core/common/common-function.service';
|
||||
import { securityFunctions } from 'src/app/core/common/security';
|
||||
import { ValidationService } from 'src/app/core/common/validation.service';
|
||||
import { API } from 'src/app/core/services/api.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-forget-password',
|
||||
templateUrl: './forget-password.component.html',
|
||||
})
|
||||
export class ForgetPasswordComponent implements OnInit {
|
||||
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
public fb: FormBuilder,
|
||||
public validationService: ValidationService,
|
||||
public ApiServ: API,
|
||||
private route: ActivatedRoute,
|
||||
public commonService: CommonFunctionService
|
||||
|
||||
) { }
|
||||
showPass = false;
|
||||
confirmPass = false;
|
||||
ResetPswdForm: FormGroup;
|
||||
|
||||
ngOnInit(): void {
|
||||
this.ResetPswdForm = this.fb.group({
|
||||
Password: this.validationService.passwordV2,
|
||||
confirm_password: this.validationService.required,
|
||||
EncryptedData: [''],
|
||||
});
|
||||
this.route.queryParams.subscribe((key_obj) => {
|
||||
if (key_obj) {
|
||||
this.ResetPswdForm.get('EncryptedData').setValue(key_obj['key']);
|
||||
this.checkResetPassAllow(key_obj['key'])
|
||||
}
|
||||
});
|
||||
}
|
||||
ResetPassword() {
|
||||
if (this.ResetPswdForm.status == 'INVALID') {
|
||||
this.validationService.showValidationsMsg(this.ResetPswdForm);
|
||||
return;
|
||||
}
|
||||
let reset_pswd_obj_val = this.ResetPswdForm.getRawValue();
|
||||
if (reset_pswd_obj_val.Password != reset_pswd_obj_val.confirm_password) {
|
||||
this.commonService.showMessage(false, 'Your password does not match with confirm password')
|
||||
return;
|
||||
}
|
||||
let data = {
|
||||
Password: reset_pswd_obj_val.Password,
|
||||
EncryptedData: reset_pswd_obj_val.EncryptedData,
|
||||
};
|
||||
let Object = {
|
||||
key: securityFunctions.encryptRSA(securityFunctions.rsa_public_key, JSON.stringify(data)),
|
||||
};
|
||||
this.ApiServ.AdminGoPost('/ExtranetUserMaster/UpdatePassword', Object).subscribe(res => {
|
||||
if (res.resp) {
|
||||
this.commonService.showMessage(true, 'Your password has been changed successfully.')
|
||||
}
|
||||
else {
|
||||
this.commonService.showMessage(res['Resp'], res['Message'])
|
||||
}
|
||||
setTimeout(() => {
|
||||
res.Resp ? this.router.navigate(['/Auth/Login']) : '';
|
||||
}, 500);
|
||||
})
|
||||
}
|
||||
btnClick() {
|
||||
this.router.navigateByUrl("Auth/Login");
|
||||
};
|
||||
|
||||
showMsgValid;
|
||||
checkResetPassAllow(dataObj) {
|
||||
this.ApiServ.AdminGOGet("/ExtranetUserMaster/IsLinkValid/" + dataObj + '/true').subscribe(res => {
|
||||
if (res) {
|
||||
this.showMsgValid = res
|
||||
}
|
||||
})
|
||||
}
|
||||
onKeyUp(event: KeyboardEvent) {
|
||||
if (event.keyCode === 13) { // If Enter key is pressed
|
||||
this.ResetPassword();
|
||||
}
|
||||
}
|
||||
}
|
||||
239
src/app/modules/auth/login/login.component.html
Normal file
239
src/app/modules/auth/login/login.component.html
Normal file
@@ -0,0 +1,239 @@
|
||||
<div class="app-loginWrap" [ngStyle]="{'background-image':'url(' + commonService.environmentObj.cdnBaseUrl + 'assets/banner/bg-extranet.png)'}">
|
||||
<div class="overlay"></div>
|
||||
<div class="app-loginBody" [formGroup]="SignInForm">
|
||||
<div class="login-textWrap">
|
||||
<!-- <div class="login-head"> Welcome</div>
|
||||
<div class="login-text"> Enter your credentials to unlock a world of possibilities and personalized
|
||||
experiences. We're delighted to have you here! </div> -->
|
||||
</div>
|
||||
<div class="app-loginLogo">
|
||||
<!-- <img alt="Agency Logo"> -->
|
||||
</div>
|
||||
<!-- sign In Form -->
|
||||
<div class="app-loginContent" *ngIf="!ShowUserVerificationBox && !OTPSection && !ForgetPassword">
|
||||
<div class="app-loginLogo">
|
||||
<img [src]="orgLogo"
|
||||
alt="Agency">
|
||||
</div>
|
||||
<div class="loginUser">
|
||||
<div class="loginHead">
|
||||
<h3>Sign In</h3>
|
||||
<p>Please sign in to continue</p>
|
||||
</div>
|
||||
<div class="loginForm">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="formControlWrapper mb-20">
|
||||
<span class="formLabel">Email</span>
|
||||
<div class="input-wrap">
|
||||
<input class="formInput" (keyup)="onKeyUp($event)" formControlName="EmailID"
|
||||
type="text" placeholder="Email Id"
|
||||
[ngClass]="{'errorInput':validationService.onBlur(SignInForm.controls['EmailID'],'required') || validationService.onBlur(SignInForm.controls['EmailID'],'email')}"
|
||||
placeholder="Email Id" />
|
||||
<svg width="16px" height="16px" viewBox="0 0 24 24" fill="#8E8E8E"
|
||||
xmlns="http://www.w3.org/2000/svg" class="loginF_icons">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||
d="M20.8 4H3.2C2.54 4 2 4.54 2 5.2v12.4C2 18.92 3.08 20 4.4 20h15.2c1.32 0 2.4-1.08 2.4-2.4V5.2c0-.66-.54-1.2-1.2-1.2ZM5.65 6.3a1 1 0 1 0-1.3 1.52l6.87 5.89a1.2 1.2 0 0 0 .78.285 1.2 1.2 0 0 0 .78-.286l6.87-5.89a1 1 0 1 0-1.3-1.518L12 11.744 5.65 6.301Z"
|
||||
fill="#8E8E8E"></path>
|
||||
</svg>
|
||||
</div>
|
||||
<span class="errorspan"
|
||||
*ngIf="validationService.onBlur(SignInForm.controls['EmailID'],'required')">Please
|
||||
enter email</span>
|
||||
<span class="errorspan"
|
||||
*ngIf="validationService.onBlur(SignInForm.controls['EmailID'],'email')">Please
|
||||
enter valid email</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-12">
|
||||
<div class="formControlWrapper mb-0">
|
||||
<div [ngClass]="{'errorpassword':validationService.onBlur(SignInForm.controls['Password'],'required')}">
|
||||
<span class="formLabel">Password</span>
|
||||
<div class="input-wrap">
|
||||
<input class="formInput loginPassword hide-eye-icon"
|
||||
type="{{ showPass ? 'text' : 'password' }}" placeholder="Password" autocomplete="off"
|
||||
(keyup)="onKeyUp($event);errorMessage = ''" formControlName="Password"><svg
|
||||
width="16px" height="16px" viewBox="0 0 24 24" id="lock"
|
||||
data-name="Flat Color" xmlns="http://www.w3.org/2000/svg"
|
||||
class="loginF_icons">
|
||||
<path id="primary"
|
||||
d="M18,8H17V7A5,5,0,0,0,7,7V8H6a2,2,0,0,0-2,2V20a2,2,0,0,0,2,2H18a2,2,0,0,0,2-2V10A2,2,0,0,0,18,8ZM9,7a3,3,0,0,1,6,0V8H9Z"
|
||||
style="fill: #8E8E8E;"></path>
|
||||
<path id="secondary"
|
||||
d="M12,12a2.5,2.5,0,0,0-1,4.79V18a1,1,0,0,0,2,0V16.79A2.5,2.5,0,0,0,12,12Z"
|
||||
style="fill: #fff;"></path>
|
||||
</svg>
|
||||
<i (click)="viewPass()"
|
||||
[ngClass]="{'pi-eye-slash' : showPass , 'pi-eye': !showPass } "
|
||||
class="pi eyeICon"></i>
|
||||
</div>
|
||||
<span class="errorspan"
|
||||
*ngIf="validationService.onBlur(SignInForm.controls['Password'],'required')">Please
|
||||
enter password </span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-right mt-10">
|
||||
<a class="forgetPass" (click)="ForgetPassword = true;errorMessage = ''"> Forget Password?</a>
|
||||
</div>
|
||||
<div class="userMessage text-center">
|
||||
<span class="errorspan">{{errorMessage}}</span>
|
||||
</div>
|
||||
<div class="loginFooter mt-20">
|
||||
<button class="btn btn-primary w-100" [disabled]="disableSignInButton" (click)="SignIn()">Sign
|
||||
In</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- MacId varify -->
|
||||
<div class="app-loginContent text-center" *ngIf="ShowUserVerificationBox">
|
||||
<div class="app-loginImage">
|
||||
<img [src]="commonService.environmentObj.cdnBaseUrl + 'assets/icon/send-notification.png'" alt="Image" width="100px">
|
||||
<h4 class="mb-3 mt-10">For your security</h4>
|
||||
<p>Please verify your identification by clicking on the verification link send on your mail which is
|
||||
valid for 5 minutes.</p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- OTP section -->
|
||||
<div class="app-loginContent" *ngIf="OTPSection">
|
||||
<div class="ng-backbtn mb-10">
|
||||
<a (click)="OTPSection = false; errorMessage = ''">
|
||||
<svg fill="var(--color-body-text)" focusable="false" viewBox="0 0 24 24" aria-hidden="true"
|
||||
role="presentation" class="ng-backsvg">
|
||||
<path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"></path>
|
||||
</svg>
|
||||
<span class="ng-backtext">Back to sign in</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="app-loginOtpWrap">
|
||||
<h3 class="temp_loginPassHeading">OTP Verification</h3>
|
||||
<p class="codeText"><span>Code sent to </span> <span>{{Email}}</span></p>
|
||||
<div class="mb-20">
|
||||
<ng-otp-input #ngOtpInput [config]="config"
|
||||
(click)="commonService.focusEmptyOtpInp($event, ngOtpInput)"
|
||||
(onInputChange)="onOtpChange($event)" (keyup.enter)="Verify()"></ng-otp-input>
|
||||
</div>
|
||||
<span class="resendOTP" *ngIf="timerBtn"> Resend code in 00:{{timeLeft >= 0 && timeLeft <= 9?'0' +
|
||||
timeLeft : timeLeft}} </span>
|
||||
<div class="temp_loginOtpResndTxtWrapper mt-10">
|
||||
<a class="temp_loginOtpResndCodeLink" (click)="ReSendOTP()" *ngIf="resendBtn">Resend
|
||||
code</a>
|
||||
</div>
|
||||
<div class="temp_loginResendOtp" *ngIf="!resendBtn && !timerBtn">
|
||||
<h4 class="temp_loginOtpTitle">Didn't receive an OTP?</h4>
|
||||
<a class="temp_loginOtpLink" (click)="loginPage()">Please try again to login</a>
|
||||
</div>
|
||||
<div class="userMessage">
|
||||
<span class="errorspan">{{errorMessage}}</span>
|
||||
</div>
|
||||
<div class="verifyBtn mt-20">
|
||||
<button class="btn btn-primary w-100" (click)="Verify()">Verify</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Forget Password -->
|
||||
<div class="app-loginContent" *ngIf="ForgetPassword">
|
||||
<div class="ng-backbtn mb-3">
|
||||
<a (click)="ForgetPassword = false">
|
||||
<svg fill="#000" focusable="false" viewBox="0 0 24 24" aria-hidden="true" role="presentation"
|
||||
class="ng-backsvg">
|
||||
<path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"></path>
|
||||
</svg>
|
||||
<span class="ng-backtext">Back to sign in</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="loginHead">
|
||||
<h3>Forget Your Password</h3>
|
||||
</div>
|
||||
<div class="formControlWrapper mb-0">
|
||||
<span class="formLabel">Reset your password using your email</span>
|
||||
<div class="input-wrap">
|
||||
<input formControlName="forgetPassEmail" class="formInput" type="text" placeholder="Email Id"
|
||||
[ngClass]="{'errorInput':validationService.onBlur(SignInForm.controls['forgetPassEmail'],'required') || validationService.onBlur(SignInForm.controls['forgetPassEmail'],'email')}"
|
||||
(keyup)="onKeyup($event)" />
|
||||
<svg width="16px" height="16px" viewBox="0 0 24 24" fill="#8E8E8E"
|
||||
xmlns="http://www.w3.org/2000/svg" class="loginF_icons">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||
d="M20.8 4H3.2C2.54 4 2 4.54 2 5.2v12.4C2 18.92 3.08 20 4.4 20h15.2c1.32 0 2.4-1.08 2.4-2.4V5.2c0-.66-.54-1.2-1.2-1.2ZM5.65 6.3a1 1 0 1 0-1.3 1.52l6.87 5.89a1.2 1.2 0 0 0 .78.285 1.2 1.2 0 0 0 .78-.286l6.87-5.89a1 1 0 1 0-1.3-1.518L12 11.744 5.65 6.301Z"
|
||||
fill="#8E8E8E"></path>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
<span class="errorspan"
|
||||
*ngIf="validationService.onBlur(SignInForm.controls['forgetPassEmail'],'required')">Please enter
|
||||
email</span>
|
||||
<span class="errorspan"
|
||||
*ngIf="validationService.onBlur(SignInForm.controls['forgetPassEmail'],'email')">Please enter
|
||||
valid email</span>
|
||||
<div class="loginFooter">
|
||||
<button class="btn btn-primary w-100" (click)="SendMail()">Continue</button>
|
||||
<div class="loginNote">
|
||||
<h4> If you don't remember the email address you used to create your account,please <span
|
||||
class="contactUs">
|
||||
Contact us
|
||||
</span>
|
||||
</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="app-ResetWrap">
|
||||
<div class="app-loginContent">
|
||||
<div class="ng-backbtn mb-10">
|
||||
<a>
|
||||
<svg fill="var(--color-body-text)" focusable="false" viewBox="0 0 24 24" aria-hidden="true"
|
||||
role="presentation" class="ng-backsvg">
|
||||
<path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"></path>
|
||||
</svg>
|
||||
<span class="ng-backtext">Back to sign in</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="loginHead text-start">
|
||||
<h3 class="mb-2">Password Expired</h3>
|
||||
</div>
|
||||
<span class="loginTxt">Your organization policy requires you to change your password now.</span>
|
||||
<div class="formControlWrapper mb-0 form-input-control mt-10">
|
||||
<span class="formLabel">New Password</span>
|
||||
<input class="loginInput error-input"/>
|
||||
<div style="position: relative;">
|
||||
<input class="form-control loginPassword">
|
||||
<i class="pi eyeICon"></i>
|
||||
</div>
|
||||
<span class="errorspan">
|
||||
Please enter password </span>
|
||||
<span class="errorspan">
|
||||
Please enter valid password </span>
|
||||
</div>
|
||||
<div class="conditiontrue_wrapper">
|
||||
<ul>
|
||||
<li class="PswdCriteria" >One lowercase letter
|
||||
</li>
|
||||
<li class="PswdCriteria"> One uppercase letter
|
||||
</li>
|
||||
<li class="PswdCriteria"> One number</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li class="PswdCriteria"> One special character</li>
|
||||
<li class="PswdCriteria"> 8
|
||||
characters minimum</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="formControlWrapper">
|
||||
<span class="formLabel">Confirm New Password</span>
|
||||
<div class="" style="position: relative;">
|
||||
<input class="form-control loginPassword">
|
||||
<i class="pi eyeICon">
|
||||
</i>
|
||||
</div>
|
||||
<span class="errorspan"> Please
|
||||
enter confirm password </span>
|
||||
</div>
|
||||
<div class="verifyBtn">
|
||||
<button class="btn btn-primary w-100" >Set Password</button>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<p-toast></p-toast>
|
||||
578
src/app/modules/auth/login/login.component.ts
Normal file
578
src/app/modules/auth/login/login.component.ts
Normal file
@@ -0,0 +1,578 @@
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { Component, OnInit, Renderer2 } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
import { Router } from '@angular/router';
|
||||
import { ValidationService } from 'src/app/core/common/validation.service';
|
||||
import { API } from 'src/app/core/services/api.service';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import * as moment from 'moment';
|
||||
import { CommonFunctionService } from 'src/app/core/common/common-function.service';
|
||||
import { securityFunctions } from 'src/app/core/common/security';
|
||||
import { CookieService } from 'ngx-cookie-service';
|
||||
import { LoginModel, OTPModel } from 'src/app/core/models/common-model/Sign-in.model';
|
||||
import { NgOtpInputConfig } from 'ng-otp-input';
|
||||
@Component({
|
||||
selector: 'app-login',
|
||||
templateUrl: './login.component.html',
|
||||
})
|
||||
export class LoginComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
public ApiServ: API,
|
||||
public commonService: CommonFunctionService,
|
||||
public titleService: Title,
|
||||
public fb: FormBuilder,
|
||||
public validationService: ValidationService,
|
||||
private http: HttpClient,
|
||||
private cookieService: CookieService,
|
||||
private renderer: Renderer2,
|
||||
) { }
|
||||
SignInForm: FormGroup;
|
||||
ResetPswdForm: FormGroup;
|
||||
ShowUserVerificationBox = false;
|
||||
showPass: boolean = false;
|
||||
userInterval;
|
||||
errorMessage = '';
|
||||
OTPSection = false;
|
||||
ForgetPassword = false;
|
||||
Email = '';
|
||||
UserIpDetails;
|
||||
// Timer
|
||||
resendBtn;
|
||||
timerBtn;
|
||||
timeLeft: number;
|
||||
interval;
|
||||
NewPaas = false;
|
||||
comfirmPass = false;
|
||||
ngOnInit(): void {
|
||||
sessionStorage.removeItem('excd');
|
||||
securityFunctions.resetSessionStoage('lastLogin')
|
||||
securityFunctions.resetSessionStoage('LoginUserData')
|
||||
securityFunctions.resetSessionStoage('VData')
|
||||
securityFunctions.resetSessionStoage('userName')
|
||||
securityFunctions.resetSessionStoage('JwtToken')
|
||||
securityFunctions.resetSessionStoage('RefreshToken')
|
||||
securityFunctions.resetSessionStoage('JwtTokenExpiry')
|
||||
securityFunctions.resetSessionStoage('menu')
|
||||
this.SignInForm = this.fb.group({
|
||||
EmailID: this.validationService.email,
|
||||
Password: this.validationService.required,
|
||||
OTP: this.validationService.required,
|
||||
forgetPassEmail: this.validationService.email
|
||||
});
|
||||
this.IsPassWordChange = false;
|
||||
this.GetIpAddress();
|
||||
this.changePasswordCreate();
|
||||
};
|
||||
SetupPage() {
|
||||
this.getLogo()
|
||||
}
|
||||
orgLogo
|
||||
getLogo() {
|
||||
const favicon = this.renderer.selectRootElement('link[rel="icon"]', true);
|
||||
this.ApiServ.AdminGet('/ForgotPassword/GetOrgLogo').subscribe((res) => {
|
||||
if (res != null) if (res["logo"] != null) {
|
||||
this.orgLogo = res["logo"];
|
||||
sessionStorage.setItem("logo", JSON.stringify(res));
|
||||
this.titleService.setTitle('Inventory Management | ' + res.org_name)
|
||||
document.documentElement.style.setProperty('--primary-theme', res['primary_color']);
|
||||
document.documentElement.style.setProperty('--secondary-theme', res['secondary_color']);
|
||||
this.renderer.setAttribute(favicon, 'href', res['favicon'] ? res['favicon'] : './assets/images/TMC.svg');
|
||||
} else {
|
||||
this.orgLogo = "https://cdn-aos.b-cdn.net/Static/Email/TMC.svg";
|
||||
}
|
||||
})
|
||||
}
|
||||
onKeyUp(event) {
|
||||
if (event.keyCode == 13 && !this.disableSignInButton) {
|
||||
this.SignIn();
|
||||
}
|
||||
|
||||
}
|
||||
viewPass() {
|
||||
this.showPass = !this.showPass;
|
||||
}
|
||||
// config OTP
|
||||
config: NgOtpInputConfig = {
|
||||
allowNumbersOnly: true,
|
||||
length: 4,
|
||||
isPasswordInput: false,
|
||||
disableAutoFocus: true,
|
||||
placeholder: '●',
|
||||
};
|
||||
|
||||
userId = '';
|
||||
disableSignInButton = false;
|
||||
SignIn() {
|
||||
if (this.SignInForm.get('EmailID').status == "INVALID" || this.SignInForm.get('Password').status == "INVALID") {
|
||||
this.validationService.showValidationsMsg(this.SignInForm.get('EmailID'));
|
||||
this.validationService.showValidationsMsg(this.SignInForm.get('Password'));
|
||||
return;
|
||||
}
|
||||
this.disableSignInButton = true;
|
||||
clearInterval(this.userInterval);
|
||||
let val = this.SignInForm.getRawValue();
|
||||
let postData = new LoginModel();
|
||||
postData.EmailID = val.EmailID;
|
||||
postData.Password = val.Password;
|
||||
postData.domain = document.location.host;
|
||||
// postData.domain = 'extranet.aos-dev.com';
|
||||
postData.ProjectId = '2405170833594899108';
|
||||
postData.Browser = this.getBrowserName();
|
||||
postData.City = this.UserIpDetails.city;
|
||||
postData.CountryCode = this.UserIpDetails.countryCode;
|
||||
postData.IP = this.UserIpDetails.query;
|
||||
postData.Lon = this.UserIpDetails.lon;
|
||||
postData.Lat = this.UserIpDetails.lat;
|
||||
postData.Proxy = this.UserIpDetails.proxy;
|
||||
postData.Platform = this.getPlatform();
|
||||
postData.MachineId = this.cookieService.check('MacId') ? this.cookieService.get('MacId') : ''
|
||||
postData.time = (this.ApiServ.getAdjustedLocalTime() * 10000 + 621355968000000000).toString()
|
||||
localStorage.setItem('UserEmail', val.EmailID);
|
||||
let obj = {
|
||||
key: securityFunctions.encryptRSA(securityFunctions.rsa_public_key, JSON.stringify(postData)),
|
||||
};
|
||||
// let domain = 'extranet.aos-dev.com'
|
||||
// // let domain = document.location.host;
|
||||
// let domainName = domain.replace(/^(https?:\/\/)?/, '');
|
||||
// let domain_time = domainName + '~' + new Date().getTime();
|
||||
// let key = securityFunctions.rsa_public_key;
|
||||
// let encrypted_string = securityFunctions.encryptRSA(key, domain_time).toString();
|
||||
// const headers = new HttpHeaders({
|
||||
// 'token': encrypted_string,
|
||||
// });
|
||||
// const options = { headers: headers };
|
||||
this.ApiServ.AdminPost('/ExtranetLogin/ValidateLogin', obj).subscribe((res) => {
|
||||
if (res !== null) { // Check if res is not null
|
||||
this.disableSignInButton = false
|
||||
this.CheckUserStatusForLogin(res, true);
|
||||
} else {
|
||||
this.disableSignInButton = false
|
||||
this.router.navigateByUrl("Auth/Login");
|
||||
}
|
||||
}, error => {
|
||||
this.disableSignInButton = false
|
||||
this.router.navigateByUrl("Auth/Login");
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// verify
|
||||
CheckUserVerification(key_resp) {
|
||||
let req = {
|
||||
key: key_resp
|
||||
}
|
||||
// let domain = document.location.host
|
||||
// let domainName = domain.replace(/^(https?:\/\/)?/, '');
|
||||
// let domain_time = domainName + '~' + new Date().getTime();
|
||||
// let key = securityFunctions.rsa_public_key;
|
||||
// let encrypted_string = securityFunctions.encryptRSA(key, domain_time).toString();
|
||||
// const headers = new HttpHeaders({
|
||||
// // 'Referer': window.location.origin, // Assuming you want to send the current origin as Referer
|
||||
// 'token': encrypted_string
|
||||
// });
|
||||
// const options = { headers: headers };
|
||||
this.ApiServ.AdminPost('/UserMachine/CheckUserVerified', req).subscribe(res => {
|
||||
if (res) {
|
||||
if (res.Status) {
|
||||
clearInterval(this.userInterval);
|
||||
if (res.VerificationStatus == 'APPROVED') {
|
||||
this.SignIn();
|
||||
} else if (res.VerificationStatus == 'REJECT') {
|
||||
this.ShowUserVerificationBox = false;
|
||||
this.OTPSection = false;
|
||||
this.errorMessage = 'Access Rejected';
|
||||
}
|
||||
} else {
|
||||
if (res.Message == 'Key Expired.') {
|
||||
clearInterval(this.userInterval);
|
||||
this.ShowUserVerificationBox = false;
|
||||
this.errorMessage = 'Key Expired';
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
loginPage() {
|
||||
this.ShowUserVerificationBox = false;
|
||||
this.OTPSection = false;
|
||||
this.ForgetPassword = false;
|
||||
}
|
||||
|
||||
// OTP set
|
||||
onOtpChange(otp) {
|
||||
this.SignInForm.get('OTP').setValue(otp);
|
||||
// if (otp.keyCode == 13 ) {
|
||||
// this.Verify();
|
||||
// }
|
||||
}
|
||||
// Common verify
|
||||
CheckUserStatusForLogin(res, MFACheck) {
|
||||
if (res.Status) {
|
||||
this.userId = res.ResponseObject.user_id;
|
||||
if (!res.ResponseObject.change_default_password) {
|
||||
const expirationDate = new Date();
|
||||
expirationDate.setFullYear(expirationDate.getFullYear() + 1);
|
||||
res.MachineId && res.MachineId != 'null' ? this.cookieService.set('MacId', res.MachineId, expirationDate) : '';
|
||||
if (MFACheck && res.ResponseObject.IsMFAApplicable) {
|
||||
if (res.ResponseObject.IsMFAApplicable) {
|
||||
this.timerBtn = true;
|
||||
this.resendBtn = false;
|
||||
this.OTPSection = true;
|
||||
this.errorMessage = '';
|
||||
this.timeLeft = 60;
|
||||
this.startTimer();
|
||||
this.Email = localStorage.getItem('UserEmail');
|
||||
return
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (MFACheck) {
|
||||
if (!res.IsVerified) {
|
||||
let time = (this.ApiServ.getAdjustedLocalTime() * 10000 + 621355968000000000).toString();
|
||||
var url_content = res.ResponseObject.user_id + "-" + res.MachineId.replace(/-/g, "~") + "-" + time;
|
||||
let key = securityFunctions.EncryptReq(url_content)
|
||||
this.ShowUserVerificationBox = true;
|
||||
this.OTPSection = false;
|
||||
this.userInterval = setInterval(() => {
|
||||
this.CheckUserVerification(key);
|
||||
}, 6000);
|
||||
let verificationTimeout = 5 * 60 * 1000;
|
||||
setTimeout(() => {
|
||||
clearInterval(this.userInterval);
|
||||
}, verificationTimeout);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
this.SetSessionForLogin(res);
|
||||
}
|
||||
} else {
|
||||
this.SetSessionForLogin(res);
|
||||
this.commonService.showMessage(res['ResponseObject'], res['Message']);
|
||||
}
|
||||
};
|
||||
// this.getMenus().subscribe(res => {
|
||||
// if (res) {
|
||||
// // sessionStorage.setItem('menu', JSON.stringify(res))
|
||||
// // this.IsOpenDefaultUrl(res);
|
||||
// }
|
||||
// })
|
||||
} else {
|
||||
this.IsPassWordChange = true;
|
||||
return
|
||||
}
|
||||
} else {
|
||||
// !res.Status ? this.loginPage() : '';
|
||||
if (res.Message == 'token details not saved') {
|
||||
this.loginPage()
|
||||
}
|
||||
this.errorMessage = res.Message
|
||||
}
|
||||
}
|
||||
|
||||
SetSessionForLogin(res) {
|
||||
clearInterval(this.userInterval);
|
||||
let date = new Date(moment(res.ResponseObject.last_login).format("YYYY MM DD hh:mm:ss") + " UTC");
|
||||
let lastLogin = moment(date.toString()).format("hh:mm:ss, DD MMM YYYY");
|
||||
securityFunctions.setSessionStorage('LoginUserData', JSON.stringify(res.ResponseObject));
|
||||
sessionStorage.getItem('JwtToken') ? '' : sessionStorage.setItem('JwtToken', res.JwtToken);
|
||||
sessionStorage.getItem('RefreshToken') ? '' : sessionStorage.setItem('RefreshToken', res.RefreshToken);
|
||||
sessionStorage.getItem('JwtTokenExpiry') ? '' : sessionStorage.setItem('JwtTokenExpiry', res.JwtTokenExpiry);
|
||||
this.commonService.FetchExtranetVendorMaster(res.ResponseObject.extranet_vendor_id, false).subscribe(data => {
|
||||
if (data) {
|
||||
securityFunctions.setSessionStorage('VData', JSON.stringify(data.Result[0]));
|
||||
}
|
||||
});
|
||||
sessionStorage.setItem('userName', res.ResponseObject.first_name);
|
||||
sessionStorage.setItem('org_id', res.ResponseObject.org_id);
|
||||
sessionStorage.setItem('lastLogin', lastLogin);
|
||||
// sessionStorage.setItem('IscancelPNR', res.ResponseObject.IsCancelPnr);
|
||||
// sessionStorage.setItem('Is_Void', res.ResponseObject.IsAllowVoidTicket);
|
||||
// sessionStorage.setItem('TpinApplicable', res.TpinApplicable);
|
||||
// sessionStorage.setItem('T_Activated', res.TpinActivated);
|
||||
// sessionStorage.setItem('T_Expired', res.TpinExpired);
|
||||
this.ShowUserVerificationBox = false;
|
||||
this.OTPSection = false;
|
||||
this.router.navigateByUrl("/");
|
||||
this.commonService.StartTimer();
|
||||
}
|
||||
// MFA
|
||||
startTimer() {
|
||||
this.interval = setInterval(() => {
|
||||
if (this.timeLeft > 0) {
|
||||
this.timeLeft--;
|
||||
}
|
||||
if (this.timeLeft == 0) {
|
||||
clearInterval(this.interval);
|
||||
this.resendBtn = true;
|
||||
this.timerBtn = false;
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
ReSendOTP() {
|
||||
this.SendOTP();
|
||||
this.timerBtn = false;
|
||||
this.resendBtn = false;
|
||||
this.timeLeft = -1;
|
||||
};
|
||||
SendOTP() {
|
||||
this.ApiServ.AdminGet('/OTP/ResendOTP/' + this.userId).subscribe(
|
||||
(data) => {
|
||||
if (data) {
|
||||
this.commonService.showMessage(data['resp'], data['respMsg']);
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
getMenus() {
|
||||
return this.http.get(environment.APIBaseUrl + '/MenuMasterNew/GetAllMenuByUserId/' + sessionStorage.getItem('userId') + '/2405170833594899108')
|
||||
}
|
||||
Verify() {
|
||||
if (this.SignInForm.get('OTP').status == "INVALID") {
|
||||
this.errorMessage = 'Please enter valid OTP'
|
||||
return;
|
||||
}
|
||||
let val = this.SignInForm.getRawValue();
|
||||
let postData = new OTPModel();
|
||||
postData.oTP = val.OTP;
|
||||
postData.userId = this.userId;
|
||||
postData.browser = this.getBrowserName();
|
||||
postData.city = this.UserIpDetails.city;
|
||||
postData.countryCode = this.UserIpDetails.countryCode;
|
||||
postData.iP = this.UserIpDetails.query;
|
||||
postData.lon = this.UserIpDetails.lon;
|
||||
postData.lat = this.UserIpDetails.lat;
|
||||
postData.proxy = this.UserIpDetails.proxy;
|
||||
postData.ProjectId = '2405170833594899108';
|
||||
postData.platform = this.getPlatform();
|
||||
postData.macId = this.cookieService.check('MacId') ? this.cookieService.get('MacId') : '';
|
||||
this.ApiServ.AdminPost('/OTP/VerifyOTP', postData).subscribe(res => {
|
||||
if (res) {
|
||||
this.CheckUserStatusForLogin(res, false);
|
||||
} else {
|
||||
this.router.navigateByUrl("Auth/Login");
|
||||
}
|
||||
})
|
||||
};
|
||||
// forget Password
|
||||
SendMail() {
|
||||
if (this.SignInForm.get('forgetPassEmail').status == "INVALID") {
|
||||
this.validationService.showValidationsMsg(this.SignInForm.get('forgetPassEmail'));
|
||||
return;
|
||||
}
|
||||
let val = this.SignInForm.get('forgetPassEmail').value;
|
||||
let request = {
|
||||
email: val,
|
||||
domain: window.location.origin,
|
||||
time: (this.ApiServ.getAdjustedLocalTime()).toString()
|
||||
};
|
||||
let obj = {
|
||||
key: securityFunctions.encryptRSA(securityFunctions.rsa_public_key, JSON.stringify(request)),
|
||||
};
|
||||
this.ApiServ.AdminGoPost('/ExtranetUserMaster/ValidateEmail', obj).subscribe(
|
||||
(data) => {
|
||||
if (data) {
|
||||
this.commonService.showMessage(data['Resp'], data['Message']);
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
// get user details
|
||||
getPlatform() {
|
||||
var platform = "";
|
||||
const userAgent = window.navigator.userAgent.toLowerCase();
|
||||
if (/android/i.test(userAgent)) {
|
||||
platform = 'Android device';
|
||||
} else if (/iphone|ipad|ipod/i.test(userAgent)) {
|
||||
platform = 'iOS device';
|
||||
} else if (/windows phone/i.test(userAgent)) {
|
||||
platform = 'Windows phone';
|
||||
} else if (/win/i.test(userAgent)) {
|
||||
platform = 'Windows desktop';
|
||||
} else if (/mac/i.test(userAgent)) {
|
||||
platform = 'Mac desktop';
|
||||
} else if (/linux/i.test(userAgent)) {
|
||||
platform = 'Linux desktop';
|
||||
} else {
|
||||
platform = 'Unknown device';
|
||||
}
|
||||
return platform;
|
||||
}
|
||||
// getBrowser() {
|
||||
// var browserName = '';
|
||||
// var userAgent = navigator.userAgent;
|
||||
|
||||
// if (userAgent.indexOf('Firefox') > -1) {
|
||||
// browserName = 'Mozilla Firefox';
|
||||
// } else if (userAgent.indexOf('Opera') > -1 || userAgent.indexOf('OPR') > -1) {
|
||||
// browserName = 'Opera';
|
||||
// } else if (userAgent.indexOf('Trident') > -1) {
|
||||
// browserName = 'Microsoft Internet Explorer';
|
||||
// } else if (userAgent.indexOf('Edge') > -1) {
|
||||
// browserName = 'Microsoft Edge';
|
||||
// } else if (userAgent.indexOf('Chrome') > -1) {
|
||||
// browserName = 'Google Chrome';
|
||||
// } else if (userAgent.indexOf('Safari') > -1) {
|
||||
// browserName = 'Apple Safari';
|
||||
// }
|
||||
|
||||
// return browserName;
|
||||
// }
|
||||
|
||||
getBrowserName(): string {
|
||||
const userAgent = navigator.userAgent;
|
||||
if (userAgent.includes("Chrome")) {
|
||||
return "Google Chrome";
|
||||
} else if (userAgent.includes("Firefox")) {
|
||||
return "Mozilla Firefox";
|
||||
} else if (userAgent.includes("Safari") && !userAgent.includes("Chrome")) {
|
||||
return "Apple Safari";
|
||||
} else if (userAgent.includes("Edge")) {
|
||||
return "Microsoft Edge";
|
||||
} else if (userAgent.includes("OPR") || userAgent.includes("Opera")) {
|
||||
return "Opera";
|
||||
} else if (userAgent.includes("MSIE") || userAgent.includes("Trident/")) {
|
||||
return "Internet Explorer";
|
||||
} else {
|
||||
return "Unknown Browser";
|
||||
}
|
||||
}
|
||||
|
||||
// Example usage:
|
||||
GetIpAddress() {
|
||||
this.http.get("https://pro.ip-api.com/json/?fields=query,countryCode,lat,lon,city,proxy&&key=JZDsrdeBzIM0yyN").subscribe(res => {
|
||||
if (res) {
|
||||
this.UserIpDetails = res;
|
||||
let obj = {
|
||||
city: res['city'],
|
||||
countryCode: res['countryCode'],
|
||||
lat: res['lat'],
|
||||
lon: res['lon'],
|
||||
proxy: res['proxy'],
|
||||
iP: res['query'],
|
||||
};
|
||||
this.SetupPage();
|
||||
sessionStorage.setItem('IP', JSON.stringify(obj));
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
// common function
|
||||
addRemoveValid(name, check) {
|
||||
if (check) {
|
||||
this.SignInForm.get(name).addValidators([Validators.required]);
|
||||
} else {
|
||||
this.SignInForm.get(name).clearValidators();
|
||||
}
|
||||
this.SignInForm.get(name).updateValueAndValidity();
|
||||
this.SignInForm.get(name).markAsUntouched();
|
||||
};
|
||||
|
||||
// Tpin
|
||||
// CheckTpinAllowOrNot(response) {
|
||||
// if (response.TpinApplicable) {
|
||||
// if (!response.TpinActivated || response.TpinExpired) {
|
||||
// const now = new Date();
|
||||
// const formattedDate = now.toISOString().slice(0, 19).replace('T', ' ');
|
||||
// let keyVal = securityFunctions.EncryptReq(response.ResponseObject.user_id + '~' + formattedDate + '~' + (response.TpinExpired ? 'expired' : 'create')).trim()
|
||||
// this.router.navigate(['/Login/TPIN'], { queryParams: { key: keyVal } });
|
||||
// return false
|
||||
// }
|
||||
// }
|
||||
// return true
|
||||
// }
|
||||
|
||||
password_criteria_obj = {
|
||||
is_lowerCase: false,
|
||||
is_Uppercase: false,
|
||||
is_Capital_case: false,
|
||||
is_numbers: false,
|
||||
is_special_characters: false,
|
||||
is_length: false
|
||||
};
|
||||
IsPassWordChange = false;
|
||||
changePasswordCreate() {
|
||||
this.password_criteria_obj = {
|
||||
is_lowerCase: false,
|
||||
is_Uppercase: false,
|
||||
is_Capital_case: false,
|
||||
is_numbers: false,
|
||||
is_special_characters: false,
|
||||
is_length: false
|
||||
};
|
||||
this.ResetPswdForm = this.fb.group({
|
||||
Password: this.validationService.passwordV2,
|
||||
confirm_password: this.validationService.required,
|
||||
});
|
||||
}
|
||||
password_criteria(password_Value) {
|
||||
password_Value.length >= 8 ? this.password_criteria_obj.is_length = true : this.password_criteria_obj.is_length = false;
|
||||
password_Value.match(this.validationService.regExps.lower_case) ? this.password_criteria_obj.is_lowerCase = true : this.password_criteria_obj.is_lowerCase = false;
|
||||
password_Value.match(this.validationService.regExps.Capital_case) ? this.password_criteria_obj.is_Uppercase = true : this.password_criteria_obj.is_Uppercase = false;
|
||||
password_Value.match(this.validationService.regExps.numbers) ? this.password_criteria_obj.is_numbers = true : this.password_criteria_obj.is_numbers = false;
|
||||
password_Value.match(this.validationService.regExps.special_characters) ? this.password_criteria_obj.is_special_characters = true : this.password_criteria_obj.is_special_characters = false;
|
||||
};
|
||||
|
||||
// ResetPassword() {
|
||||
// if (this.ResetPswdForm.status == 'INVALID') {
|
||||
// this.validationService.showValidationsMsg(this.ResetPswdForm);
|
||||
// return;
|
||||
// }
|
||||
// let reset_pswd_obj_val = this.ResetPswdForm.getRawValue();
|
||||
// if (reset_pswd_obj_val.Password != reset_pswd_obj_val.confirm_password) {
|
||||
// this.commonService.showMessage(false, 'Your password does not match with confirm password')
|
||||
// return;
|
||||
// }
|
||||
// let PostData = {
|
||||
// "user_id": this.userId,
|
||||
// "password": reset_pswd_obj_val.Password,
|
||||
// "change_default_password": false
|
||||
// }
|
||||
// let encryptRSAData = {
|
||||
// key: securityFunctions.encryptRSA(securityFunctions.rsa_public_key, JSON.stringify(PostData)),
|
||||
// };
|
||||
// this.http.post<any>(environment.APIBaseUrl + '/StaffMaster/ResetStaffPasswordHome', encryptRSAData).subscribe(res => {
|
||||
// if (res.resp) {
|
||||
// this.commonService.showMessage(true, 'Your password has been changed successfully.');
|
||||
// this.IsPassWordChange = false;
|
||||
// }
|
||||
// else {
|
||||
// this.commonService.showMessage(res.resp, res.respMsg);
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
|
||||
|
||||
//
|
||||
// IsOpenDefaultUrl(data) {
|
||||
// let agency = data.find(e => e.menu_id == '2306211409428416327');
|
||||
// let flight_booking = data.find(e => e.menu_id == '2307251023313127095');
|
||||
// let hotel_booking = data.find(e => e.menu_id == '2307251027232645472');
|
||||
// let flight_transaction = data.find(e => e.menu_id == '2307251045530701040');
|
||||
// let lead_management = data.find(e => e.menu_id == '2307251305094097395');
|
||||
// if (agency) this.navigateMenuLink(agency);
|
||||
// else if (flight_booking) this.navigateMenuLink(flight_booking);
|
||||
// else if (hotel_booking) this.navigateMenuLink(hotel_booking);
|
||||
// else if (lead_management) this.navigateMenuLink(lead_management);
|
||||
// else if (flight_transaction) this.navigateMenuLink(flight_transaction);
|
||||
// else this.router.navigateByUrl("/Home/Dashboard");
|
||||
// }
|
||||
navigateMenuLink(menu) {
|
||||
let url = '/' + menu.ui_controller + '/' + menu.ui_action;
|
||||
if (url) {
|
||||
sessionStorage.setItem('selMenu', url);
|
||||
window.location.href = window.location.origin + url;
|
||||
}
|
||||
};
|
||||
|
||||
onKeyup(event: KeyboardEvent) {
|
||||
if (event.keyCode === 13) { // If Enter key is pressed
|
||||
this.SendMail();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<!-- <p>single-sign-on</p> -->
|
||||
@@ -0,0 +1,26 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { SSOService } from 'src/app/core/services/sso.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-single-sign-on',
|
||||
templateUrl: './single-sign-on.component.html',
|
||||
})
|
||||
export class SingleSignOnComponent implements OnInit {
|
||||
IPData;
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private ssoService: SSOService,
|
||||
) {
|
||||
this.route.queryParams.subscribe((params) => {
|
||||
ssoService.validateSSOLogin(params['key'], params['LoginUserId']);
|
||||
if (params['langcode']) {
|
||||
sessionStorage.setItem('LangCode', params['langcode']);
|
||||
}
|
||||
});
|
||||
};
|
||||
ngOnInit(): void {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<div class="custom-container">
|
||||
<div class="custom-card cardDeactive" *ngIf="ShowApprovalCard">
|
||||
<div class="card-content">
|
||||
<img [src]="commonService.environmentObj.cdnBaseUrl + 'assets/icon/correct.png'" alt="Image" width="100px">
|
||||
<h4 class="mt-2">Thank you.</h4>
|
||||
<h4 class="mb-3">Sign-in attempt was approved.</h4>
|
||||
<p>You can close this page.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="custom-card cardDeactive" *ngIf="ShowDeactivateCard">
|
||||
<div class="card-content">
|
||||
<img [src]="commonService.environmentObj.cdnBaseUrl + 'assets/icon/correct.png'" alt="Image" width="100px">
|
||||
<h4 class="mt-2">Thank you.</h4>
|
||||
<h4 class="mb-3">Your account has been deactivated.</h4>
|
||||
<p>You can close this page.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="custom-card cardDenied" *ngIf="ShowRejectedCard">
|
||||
<div class="card-content">
|
||||
<img [src]="commonService.environmentObj.cdnBaseUrl + 'assets/icon/cross.png'" alt="Image" width="100px">
|
||||
<h4 class="mt-2">Thank you.</h4>
|
||||
<h4 class="mb-3">Sign-in attempt was denied.</h4>
|
||||
<p>You can close this page.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="custom-card cardExpired" *ngIf="ShowExpiredCard">
|
||||
<div class="card-content">
|
||||
<img [src]="commonService.environmentObj.cdnBaseUrl + 'assets/icon/expired.svg'" alt="Image" width="100px">
|
||||
<h4 class="mt-2">The link you followed has expired.</h4>
|
||||
<h4 class="mb-3">Please try to login again.</h4>
|
||||
<p>You can close this page.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
53
src/app/modules/auth/verify-email/verify-email.component.ts
Normal file
53
src/app/modules/auth/verify-email/verify-email.component.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { CommonFunctionService } from 'src/app/core/common/common-function.service';
|
||||
import { API } from 'src/app/core/services/api.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-verify-email',
|
||||
templateUrl: './verify-email.component.html',
|
||||
})
|
||||
export class VerifyEmailComponent implements OnInit {
|
||||
|
||||
IPData;
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private ApiServ: API,
|
||||
public commonService: CommonFunctionService,
|
||||
) { }
|
||||
ShowApprovalCard = false;
|
||||
ShowRejectedCard = false;
|
||||
ShowDeactivateCard = false;
|
||||
ShowExpiredCard = false;
|
||||
ngOnInit() {
|
||||
this.ShowApprovalCard = false;
|
||||
this.ShowRejectedCard = false;
|
||||
this.ShowDeactivateCard = false;
|
||||
this.ShowExpiredCard = false;
|
||||
this.route.queryParams.subscribe((params) => {
|
||||
this.VerifyUserEmail(params['key']);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
VerifyUserEmail(key_resp) {
|
||||
let obj = {
|
||||
key: key_resp,
|
||||
};
|
||||
this.ApiServ.AdminPost('/UserMachine/VerifyMachineEmail', obj).subscribe(
|
||||
(d) => {
|
||||
if (d && d.Status) {
|
||||
if (d.VerificationStatus == 'APPROVED') this.ShowApprovalCard = true;
|
||||
else if (d.VerificationStatus == 'REJECT') this.ShowRejectedCard = true;
|
||||
else this.ShowDeactivateCard = true;
|
||||
} else {
|
||||
if (!d.Status && d.Message == 'Key Expired') {
|
||||
this.ShowExpiredCard = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<p>booking-management works!</p>
|
||||
@@ -0,0 +1,11 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-booking-management',
|
||||
templateUrl: './booking-management.component.html',
|
||||
})
|
||||
export class BookingManagementComponent implements OnInit {
|
||||
constructor() {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { BookingManagementComponent } from './booking-management.component';
|
||||
import { ExperienceBookingComponent } from './experience-booking/experience-booking.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: 'HotelBooking',
|
||||
loadChildren: () =>
|
||||
import('./hotel-booking/hotel-booking.module').then(
|
||||
(m) => m.HotelBookingModule
|
||||
),
|
||||
},
|
||||
{
|
||||
path: 'ExperienceBooking',
|
||||
loadChildren: () =>
|
||||
import('./experience-booking/experience-booking.module').then(
|
||||
(m) => m.ExperienceBookingModule
|
||||
),
|
||||
},
|
||||
{
|
||||
path: '',
|
||||
pathMatch: 'full',
|
||||
redirectTo: 'search',
|
||||
},
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
declarations: [BookingManagementComponent, ExperienceBookingComponent],
|
||||
imports: [CommonModule, RouterModule.forChild(routes)],
|
||||
})
|
||||
export class BookingManagementModule {}
|
||||
@@ -0,0 +1 @@
|
||||
<p>Experience-booking-search works!</p>
|
||||
@@ -0,0 +1,14 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-Experience-booking-search',
|
||||
templateUrl: './experience-booking-search.component.html',
|
||||
})
|
||||
export class ExperienceBookingSearchComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<p>Experience-booking works!</p>
|
||||
@@ -0,0 +1,14 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-Experience-booking',
|
||||
templateUrl: './experience-booking.component.html',
|
||||
})
|
||||
export class ExperienceBookingComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { ExperienceBookingSearchComponent } from './experience-booking-search/experience-booking-search.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: 'Search',
|
||||
component: ExperienceBookingSearchComponent,
|
||||
},
|
||||
{
|
||||
path: '',
|
||||
pathMatch: 'full',
|
||||
redirectTo: 'Search',
|
||||
},
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
declarations: [ExperienceBookingSearchComponent],
|
||||
imports: [CommonModule, RouterModule.forChild(routes)],
|
||||
})
|
||||
export class ExperienceBookingModule {}
|
||||
@@ -0,0 +1,672 @@
|
||||
<div class="ng-card custom-shadow">
|
||||
<div class="ng-cardHead">
|
||||
<div class="ng-cardLabel">
|
||||
<h3 class="ng-cardTitle">Hotel Booking</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ng-searchBody">
|
||||
<form [formGroup]="HotelBookingFiltersForm">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<div class="formControlWrapper">
|
||||
<span class="formLabel"> Trip ID </span>
|
||||
<input type="text" class="formInput" formControlName="fltr_trip_id" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<div class="formControlWrapper">
|
||||
<span class="formLabel"> Booking ID </span>
|
||||
<input type="text" class="formInput" formControlName="fltr_booking_id" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<div class="formControlWrapper hotelsearch_singleselect">
|
||||
<span class="formLabel">Company</span>
|
||||
<ng-select #CompanyNg [items]="Companylist" class="is-invalid" placeholder="Select" bindLabel="CompanyName"
|
||||
bindValue="CompanyID" formControlName="fltr_company">
|
||||
<ng-template ng-header-tmp>
|
||||
<div class="temp_mobileBack">
|
||||
<div class="temp_mobileHead">
|
||||
<div class="temp_mobileTitle">
|
||||
<h4>Company</h4>
|
||||
</div>
|
||||
<button matRipple (click)="CompanyNg.close()" class="temp_mobileBackButton">
|
||||
<i class="material-icons"> close </i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
<ng-template ng-header-tmp>
|
||||
<div class="select-mobileHeader">
|
||||
<button matRipple class="select-mobileBack">
|
||||
<i class="material-icons"> arrow_back </i>
|
||||
</button>
|
||||
<div class="select-mobileTitle">Company</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
</ng-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<div class="hotelsearch_singleselect formControlWrapper">
|
||||
<span class="formLabel">Branch</span>
|
||||
<ng-select #BranchNg [items]="Entitylist" class="is-invalid" placeholder="Select" bindLabel="EntityName"
|
||||
bindValue="EntityId" formControlName="fltr_branch">
|
||||
<ng-template ng-header-tmp>
|
||||
<div class="temp_mobileBack">
|
||||
<div class="temp_mobileHead">
|
||||
<div class="temp_mobileTitle">
|
||||
<h4>Branch</h4>
|
||||
</div>
|
||||
<button matRipple (click)="BranchNg.close()" class="temp_mobileBackButton">
|
||||
<i class="material-icons"> close </i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
<ng-template ng-header-tmp>
|
||||
<div class="select-mobileHeader">
|
||||
<button matRipple class="select-mobileBack">
|
||||
<i class="material-icons"> arrow_back </i>
|
||||
</button>
|
||||
<div class="select-mobileTitle">Branch</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
</ng-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<div class="formControlWrapper">
|
||||
<span class="formLabel"> Hotel Name </span>
|
||||
<input type="text" class="formInput" formControlName="fltr_hotel_name" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<div class="formControlWrapper">
|
||||
<span class="formLabel">Country</span>
|
||||
<ng-select #CountryNg [items]="Countrylist" class="is-invalid" placeholder="Select" bindLabel="country_name"
|
||||
bindValue="country_code" formControlName="fltr_country" (change)="onCountrySelect($event)">
|
||||
<ng-template ng-header-tmp>
|
||||
<div class="temp_mobileBack">
|
||||
<div class="temp_mobileHead">
|
||||
<div class="temp_mobileTitle">
|
||||
<h4>Country</h4>
|
||||
</div>
|
||||
<button matRipple (click)="CountryNg.close()" class="temp_mobileBackButton">
|
||||
<i class="material-icons"> close </i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
<ng-template ng-header-tmp>
|
||||
<div class="select-mobileHeader">
|
||||
<button matRipple class="select-mobileBack">
|
||||
<i class="material-icons"> arrow_back </i>
|
||||
</button>
|
||||
<div class="select-mobileTitle">Country</div>
|
||||
</div>
|
||||
<div class="select-search">
|
||||
<span class="material-icons"> search </span>
|
||||
<input type="text" #searchType (input)="CountryNg.filter(searchType.value)" />
|
||||
</div>
|
||||
</ng-template>
|
||||
</ng-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<div class="formControlWrapper">
|
||||
<span class="formLabel">City</span>
|
||||
<ng-select #CityNg [readonly]="!HotelBookingFiltersForm.get('fltr_country').value" [items]="Citylist"
|
||||
class="is-invalid" placeholder="Select" bindLabel="city_name" bindValue="city_code"
|
||||
formControlName="fltr_city">
|
||||
<ng-template ng-header-tmp>
|
||||
<div class="temp_mobileBack">
|
||||
<div class="temp_mobileHead">
|
||||
<div class="temp_mobileTitle">
|
||||
<h4>City</h4>
|
||||
</div>
|
||||
<button matRipple (click)="CityNg.close()" class="temp_mobileBackButton">
|
||||
<i class="material-icons"> close </i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
<ng-template ng-header-tmp>
|
||||
<div class="select-mobileHeader">
|
||||
<button matRipple class="select-mobileBack">
|
||||
<i class="material-icons"> arrow_back </i>
|
||||
</button>
|
||||
<div class="select-mobileTitle">City</div>
|
||||
</div>
|
||||
<div class="select-search">
|
||||
<span class="material-icons"> search </span>
|
||||
<input type="text" #searchType (input)="CityNg.filter(searchType.value)" />
|
||||
</div>
|
||||
</ng-template>
|
||||
</ng-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<div class="formControlWrapper hotelsearch_singleselect">
|
||||
<span class="formLabel">Star Rating</span>
|
||||
<ng-select #StarRatingNg [items]="StarRating" class="is-invalid" placeholder="Select" bindLabel="value"
|
||||
bindValue="key" formControlName="fltr_star_rating">
|
||||
<ng-template ng-header-tmp>
|
||||
<div class="temp_mobileBack">
|
||||
<div class="temp_mobileHead">
|
||||
<div class="temp_mobileTitle">
|
||||
<h4>Star Rating</h4>
|
||||
</div>
|
||||
<button matRipple (click)="StarRatingNg.close()" class="temp_mobileBackButton">
|
||||
<i class="material-icons"> close </i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
<ng-template ng-header-tmp>
|
||||
<div class="select-mobileHeader">
|
||||
<button matRipple class="select-mobileBack">
|
||||
<i class="material-icons"> arrow_back </i>
|
||||
</button>
|
||||
<div class="select-mobileTitle">Star Rating</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
</ng-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<div class="formControlWrapper">
|
||||
<span class="formLabel"> Guest Name </span>
|
||||
<input type="text" class="formInput" formControlName="fltr_guest_name" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<div class="formControlWrapper">
|
||||
<span class="formLabel"> Contact Number </span>
|
||||
<input type="text" class="formInput" formControlName="fltr_guest_contact_no" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<div class="formControlWrapper hotelsearch_singleselect">
|
||||
<span class="formLabel">Booking Status</span>
|
||||
<ng-select #BookingStatusNg [items]="BookingStatus" class="is-invalid" placeholder="Select"
|
||||
bindLabel="value" bindValue="key" formControlName="fltr_booking_status">
|
||||
<ng-template ng-header-tmp>
|
||||
<div class="temp_mobileBack">
|
||||
<div class="temp_mobileHead">
|
||||
<div class="temp_mobileTitle">
|
||||
<h4>Booking Status</h4>
|
||||
</div>
|
||||
<button matRipple (click)="BookingStatusNg.close()" class="temp_mobileBackButton">
|
||||
<i class="material-icons"> close </i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
<ng-template ng-header-tmp>
|
||||
<div class="select-mobileHeader">
|
||||
<button matRipple class="select-mobileBack">
|
||||
<i class="material-icons"> arrow_back </i>
|
||||
</button>
|
||||
<div class="select-mobileTitle">Booking Status</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
</ng-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<div class="formControlWrapper hotelsearch_singleselect">
|
||||
<span class="formLabel">Invoice Status</span>
|
||||
<ng-select #InvoiceStatusNg [items]="InvoiceStatus" class="is-invalid" placeholder="Select"
|
||||
bindLabel="value" bindValue="key" formControlName="fltr_invoice_status">
|
||||
<ng-template ng-header-tmp>
|
||||
<div class="temp_mobileBack">
|
||||
<div class="temp_mobileHead">
|
||||
<div class="temp_mobileTitle">
|
||||
<h4>Invoice Status</h4>
|
||||
</div>
|
||||
<button matRipple (click)="InvoiceStatusNg.close()" class="temp_mobileBackButton">
|
||||
<i class="material-icons"> close </i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
<ng-template ng-header-tmp>
|
||||
<div class="select-mobileHeader">
|
||||
<button matRipple class="select-mobileBack">
|
||||
<i class="material-icons"> arrow_back </i>
|
||||
</button>
|
||||
<div class="select-mobileTitle">Invoice Status</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
</ng-select>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="col-lg-3">
|
||||
<div class="formControlWrapper hotelsearch_singleselect">
|
||||
<span class="formLabel">Vendor Name</span>
|
||||
<ng-select #VendorNg class="is-invalid" placeholder="Select">
|
||||
<ng-template ng-header-tmp>
|
||||
<div class="temp_mobileBack">
|
||||
<div class="temp_mobileHead">
|
||||
<div class="temp_mobileTitle">
|
||||
<h4>Vendor Name</h4>
|
||||
</div>
|
||||
<button matRipple (click)="VendorNg.close()" class="temp_mobileBackButton">
|
||||
<i class="material-icons"> close </i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
<ng-template ng-header-tmp>
|
||||
<div class="select-mobileHeader">
|
||||
<button matRipple class="select-mobileBack">
|
||||
<i class="material-icons"> arrow_back </i>
|
||||
</button>
|
||||
<div class="select-mobileTitle">supplier</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
</ng-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<div class="formControlWrapper hotelsearch_singleselect">
|
||||
<span class="formLabel">Contract Name</span>
|
||||
<ng-select #ContractNg class="is-invalid" placeholder="Select">
|
||||
<ng-template ng-header-tmp>
|
||||
<div class="temp_mobileBack">
|
||||
<div class="temp_mobileHead">
|
||||
<div class="temp_mobileTitle">
|
||||
<h4>Contract Name</h4>
|
||||
</div>
|
||||
<button matRipple (click)="ContractNg.close()" class="temp_mobileBackButton">
|
||||
<i class="material-icons"> close </i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
<ng-template ng-header-tmp>
|
||||
<div class="select-mobileHeader">
|
||||
<button matRipple class="select-mobileBack">
|
||||
<i class="material-icons"> arrow_back </i>
|
||||
</button>
|
||||
<div class="select-mobileTitle">supplier</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
</ng-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<div class="formControlWrapper hotelsearch_singleselect">
|
||||
<span class="formLabel">Offers</span>
|
||||
<ng-select #OfferNg class="is-invalid" placeholder="Select">
|
||||
<ng-template ng-header-tmp>
|
||||
<div class="temp_mobileBack">
|
||||
<div class="temp_mobileHead">
|
||||
<div class="temp_mobileTitle">
|
||||
<h4>Offers</h4>
|
||||
</div>
|
||||
<button matRipple (click)="OfferNg.close()" class="temp_mobileBackButton">
|
||||
<i class="material-icons"> close </i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
<ng-template ng-header-tmp>
|
||||
<div class="select-mobileHeader">
|
||||
<button matRipple class="select-mobileBack">
|
||||
<i class="material-icons"> arrow_back </i>
|
||||
</button>
|
||||
<div class="select-mobileTitle">supplier</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
</ng-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<div class="formControlWrapper hotelsearch_singleselect">
|
||||
<span class="formLabel">Supplements</span>
|
||||
<ng-select #SupplementsNg class="is-invalid" placeholder="Select">
|
||||
<ng-template ng-header-tmp>
|
||||
<div class="temp_mobileBack">
|
||||
<div class="temp_mobileHead">
|
||||
<div class="temp_mobileTitle">
|
||||
<h4>Supplements</h4>
|
||||
</div>
|
||||
<button matRipple (click)="SupplementsNg.close()" class="temp_mobileBackButton">
|
||||
<i class="material-icons"> close </i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
<ng-template ng-header-tmp>
|
||||
<div class="select-mobileHeader">
|
||||
<button matRipple class="select-mobileBack">
|
||||
<i class="material-icons"> arrow_back </i>
|
||||
</button>
|
||||
<div class="select-mobileTitle">supplier</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
</ng-select>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="col-lg-3">
|
||||
<div class="formControlWrapper">
|
||||
<span class="formLabel">Confirmation No.</span>
|
||||
<input type="text" class="formInput" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<div class="formControlWrapper">
|
||||
<div class="">
|
||||
<span class="formLabel">Date Type</span>
|
||||
</div>
|
||||
<ng-select #DateTypeNg class="is-invalid" placeholder="Select" [items]="Date_Type"
|
||||
formControlName="fltr_date">
|
||||
<ng-template ng-header-tmp>
|
||||
<div class="temp_mobileBack">
|
||||
<div class="temp_mobileHead">
|
||||
<div class="temp_mobileTitle">
|
||||
<h4>Date Type</h4>
|
||||
</div>
|
||||
<button matRipple (click)="DateTypeNg.close()" class="temp_mobileBackButton">
|
||||
<i class="material-icons"> close </i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
<ng-template>
|
||||
<div class="select-mobileHeader">
|
||||
<button matRipple class="select-mobileBack">
|
||||
<i class="material-icons"> arrow_back </i>
|
||||
</button>
|
||||
<div class="select-mobileTitle">Payment Status</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
</ng-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 calenderField">
|
||||
<div class="formControlWrapper">
|
||||
<span class="formLabel">From Date</span>
|
||||
<p-calendar #DateNg [showIcon]="true" formControlName="from_Date" placeholder="Select"
|
||||
(onClose)="applyToDate(HotelBookingFiltersForm.controls['from_Date'].value)" [readonlyInput]="true"
|
||||
inputId="range1" [showButtonBar]="true" dateFormat="dd M yy">
|
||||
<ng-template pTemplate="header">
|
||||
<div class="temp_mobileBack">
|
||||
<div class="temp_mobileHead">
|
||||
<div class="temp_mobileTitle">
|
||||
<h4>Date</h4>
|
||||
</div>
|
||||
<button matRipple (click)="DateNg.hideOverlay()" class="temp_mobileBackButton">
|
||||
<i class="material-icons"> close </i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
</p-calendar>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 calenderField">
|
||||
<div class="formControlWrapper">
|
||||
<span class="formLabel">To Date</span>
|
||||
<p-calendar #DatesNg [showIcon]="true" formControlName="To_Date" [minDate]="To_Date_Start"
|
||||
[readonlyInput]="true" inputId="range2" [showButtonBar]="true" dateFormat="dd M yy" placeholder="Select">
|
||||
<ng-template pTemplate="header">
|
||||
<div class="temp_mobileBack">
|
||||
<div class="temp_mobileHead">
|
||||
<div class="temp_mobileTitle">
|
||||
<h4>Date</h4>
|
||||
</div>
|
||||
<button matRipple (click)="DatesNg.hideOverlay()" class="temp_mobileBackButton">
|
||||
<i class="material-icons"> close </i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
</p-calendar>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<mat-checkbox formControlName="under_cancel">Under Free Cancellation</mat-checkbox>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="ng-searchFooter">
|
||||
<div class="MainDivBtn-1">
|
||||
<button class="btn btn-secondary mr-10 ResetBtn" (click)="search_form_reset()">Reset</button>
|
||||
<button class="btn btn-primary SearchBtn" (click)="search_bookings()">Search</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dataTable custom-shadow actionButtonSticky">
|
||||
<p-table #dt [columns]="cols" [rowsPerPageOptions]="[10, 20, 50, 100]" [paginator]="true" [rows]="10"
|
||||
currentPageReportTemplate="Showing {first} to {last} of {totalRecords} entries" [value]="HotelBookingList"
|
||||
responsiveLayout="scroll" [showCurrentPageReport]="true" [globalFilterFields]="['trip_id',
|
||||
'booking_id',
|
||||
'hotel_name',
|
||||
'hotel_city',
|
||||
'hotel_country',
|
||||
'no_of_rooms',
|
||||
'no_of_nights',
|
||||
'booking_date',
|
||||
'checkin_date',
|
||||
'checkout_date',
|
||||
'lead_guest',
|
||||
'guest_nationality_code',
|
||||
'guest_mobile_no',
|
||||
'room_names_custom',
|
||||
'supplier_name',
|
||||
'supplier_ref_no',
|
||||
'agency_type',
|
||||
'payment_gateway_name',
|
||||
'booking_status_custom',
|
||||
'total',
|
||||
'booking_guid',
|
||||
'assigned_user_name',
|
||||
'assigned_user_name_2',]" [resizableColumns]="true" styleClass="p-datatable-gridlines"
|
||||
[sortField]="'custom_booking_date'" [sortOrder]="-1">
|
||||
<ng-template pTemplate="caption">
|
||||
<p-toolbar>
|
||||
<ng-template pTemplate="left">
|
||||
<button type="button" (click)="dt.exportCSV()" class="btn btn-grey mr-10">CSV</button>
|
||||
<button type="button" (click)="commonserv.exportExcel(HotelBookingList,cols,'Hotel booking management')"
|
||||
class="btn btn-grey mr-10">Excel</button>
|
||||
<button type="button" (click)="commonserv.exportPdf(HotelBookingList,cols,'Hotel booking management')"
|
||||
class="btn btn-grey">PDF</button>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="right">
|
||||
<div class="p-d-flex p-ai-center">
|
||||
<span class="p-input-icon-left">
|
||||
<i class="pi pi-search"></i>
|
||||
<input pInputText type="search" #searchInp (input)="dt.filterGlobal(searchInp.value, 'contains')"
|
||||
placeholder="Search" />
|
||||
</span>
|
||||
</div>
|
||||
</ng-template>
|
||||
</p-toolbar>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="header" let-columns>
|
||||
<tr>
|
||||
<th scope="col" pSortableColumn="trip_id">
|
||||
<span>Trip ID</span>
|
||||
<p-sortIcon field="trip_id" class="p-sort-icon "></p-sortIcon>
|
||||
</th>
|
||||
<th scope="col" pSortableColumn="booking_id">
|
||||
<span>Booking ID</span>
|
||||
<p-sortIcon field="booking_id" class="p-sort-icon"></p-sortIcon>
|
||||
</th>
|
||||
<th scope="col" pSortableColumn="hotel_name">
|
||||
<span> Hotel Name</span>
|
||||
<p-sortIcon field="hotel_name" class="p-sort-icon"></p-sortIcon>
|
||||
</th>
|
||||
<th scope="col" pSortableColumn="hotel_country">
|
||||
<span>Country</span>
|
||||
<p-sortIcon field="hotel_country" class="p-sort-icon"></p-sortIcon>
|
||||
</th>
|
||||
<th scope="col" pSortableColumn="hotel_city">
|
||||
<span>City</span>
|
||||
<p-sortIcon field="hotel_city" class="p-sort-icon"></p-sortIcon>
|
||||
</th>
|
||||
<th scope="col" pSortableColumn="custom_booking_date">
|
||||
<span>Booking Date</span>
|
||||
<p-sortIcon field="custom_booking_date" class="p-sort-icon"></p-sortIcon>
|
||||
</th>
|
||||
<th scope="col" pSortableColumn="custom_checkin_date">
|
||||
<span>Check In Date</span>
|
||||
<p-sortIcon field="custom_checkin_date" class="p-sort-icon"></p-sortIcon>
|
||||
</th>
|
||||
<th scope="col" pSortableColumn="custom_checkout_date">
|
||||
<span>Check Out Date</span>
|
||||
<p-sortIcon field="custom_checkout_date" class="p-sort-icon"></p-sortIcon>
|
||||
</th>
|
||||
<th scope="col" pSortableColumn="no_of_nights">
|
||||
<span>No Of Nights</span>
|
||||
<p-sortIcon field="no_of_nights" class="p-sort-icon"></p-sortIcon>
|
||||
</th>
|
||||
<th scope="col" pSortableColumn="no_of_rooms">
|
||||
<span>No Of Rooms</span>
|
||||
<p-sortIcon field="no_of_rooms" class="p-sort-icon"></p-sortIcon>
|
||||
</th>
|
||||
<th scope="col" pSortableColumn="room_names_custom">
|
||||
<span>Room Name</span>
|
||||
<p-sortIcon field="room_names_custom" class="p-sort-icon"></p-sortIcon>
|
||||
</th>
|
||||
<th scope="col" pSortableColumn="lead_guest">
|
||||
<span>Lead Guest</span>
|
||||
<p-sortIcon field="lead_guest" class="p-sort-icon"></p-sortIcon>
|
||||
</th>
|
||||
<th scope="col" pSortableColumn="guest_nationality_code">
|
||||
<span>Lead Nationality</span>
|
||||
<p-sortIcon field="guest_nationality_code" class="p-sort-icon"></p-sortIcon>
|
||||
</th>
|
||||
<th scope="col" pSortableColumn="guest_mobile_no">
|
||||
<span>Lead Mobile Number</span>
|
||||
<p-sortIcon field="guest_mobile_no" class="p-sort-icon"></p-sortIcon>
|
||||
</th>
|
||||
<!-- <th scope="col" pSortableColumn="">
|
||||
<span>Vendor Name</span>
|
||||
<p-sortIcon field="" class="p-sort-icon"></p-sortIcon>
|
||||
</th>
|
||||
<th scope="col" pSortableColumn="">
|
||||
<span>Contract Name</span>
|
||||
<p-sortIcon field="" class="p-sort-icon"></p-sortIcon>
|
||||
</th>
|
||||
<th scope="col" pSortableColumn="">
|
||||
<span>Offers</span>
|
||||
<p-sortIcon field="" class="p-sort-icon"></p-sortIcon>
|
||||
</th>
|
||||
<th scope="col" pSortableColumn="">
|
||||
<span>Supplements</span>
|
||||
<p-sortIcon field="" class="p-sort-icon"></p-sortIcon>
|
||||
</th> -->
|
||||
<th scope="col" pSortableColumn="hotel_confirmation_number">
|
||||
<span>Confirmation No</span>
|
||||
<p-sortIcon field="hotel_confirmation_number" class="p-sort-icon"></p-sortIcon>
|
||||
</th>
|
||||
<th scope="col" pSortableColumn="supplier_total_amount">
|
||||
<span>Vendor Booking Amount</span>
|
||||
<p-sortIcon field="supplier_total_amount" class="p-sort-icon"></p-sortIcon>
|
||||
</th>
|
||||
<th scope="col" pSortableColumn="booking_status_custom">
|
||||
<span>Booking Status</span>
|
||||
<p-sortIcon field="booking_status_custom" class="p-sort-icon"></p-sortIcon>
|
||||
</th>
|
||||
<th scope="col" pSortableColumn="booking_guid">
|
||||
<span>GUID</span>
|
||||
<p-sortIcon field="booking_guid" class="p-sort-icon"></p-sortIcon>
|
||||
</th>
|
||||
<th scope="col" pSortableColumn="Action" field="Action">
|
||||
<span>Action</span>
|
||||
</th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="body" let-HotelBooking let-columns="columns">
|
||||
<tr>
|
||||
<td>{{HotelBooking.trip_id}}</td>
|
||||
<td>{{HotelBooking.booking_id}}</td>
|
||||
<td class="max-width330">{{HotelBooking.hotel_name}}</td>
|
||||
<td>{{HotelBooking.hotel_country}}</td>
|
||||
<td>{{HotelBooking.hotel_city}}</td>
|
||||
<td>{{HotelBooking.booking_date}}</td>
|
||||
<td>{{HotelBooking.checkin_date}}</td>
|
||||
<td>{{HotelBooking.checkout_date}}</td>
|
||||
<td>{{HotelBooking.no_of_nights}}</td>
|
||||
<td>{{HotelBooking.no_of_rooms}}</td>
|
||||
<td>{{HotelBooking.room_names_custom }}</td>
|
||||
<td>{{HotelBooking.lead_guest}}</td>
|
||||
<td>{{HotelBooking.guest_nationality_code}}</td>
|
||||
<td>{{HotelBooking.guest_mobile_no}}</td>
|
||||
<!-- <td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td> -->
|
||||
<td>{{HotelBooking.hotel_confirmation_number}}</td>
|
||||
<td>{{HotelBooking.total}} </td>
|
||||
<td>{{map_booking_status(HotelBooking.status_id, HotelBooking.payment_status)}}</td>
|
||||
<td>{{HotelBooking.booking_guid}}</td>
|
||||
<td>
|
||||
<div class="actionButton">
|
||||
<button mat-icon-button [matMenuTriggerFor]="menu">
|
||||
<span class="material-icons"> more_horiz </span>
|
||||
</button>
|
||||
<mat-menu #menu="matMenu">
|
||||
<button mat-menu-item class="d-flex align-center" (click)="select_booking(HotelBooking.trip_id)">
|
||||
View
|
||||
</button>
|
||||
<button mat-menu-item class="d-flex align-center" (click)="openConfirmationNumberModal(HotelBooking)">
|
||||
{{HotelBooking.hotel_confirmation_number ? 'Edit Confirmation Number' : 'Add Confirmation Number'}}
|
||||
</button>
|
||||
</mat-menu>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="emptymessage">
|
||||
<tr *ngIf="HotelBookingList === null || HotelBookingList" class="ResultNotFound">
|
||||
<td>
|
||||
No data found
|
||||
</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
</div>
|
||||
<!-- table -->
|
||||
</div>
|
||||
<!-- Add Confirmation Number -->
|
||||
<p-dialog header="Add Confirmation Number" position="top" [(visible)]="isOpenAddConfirmationNumberModal" [modal]="true"
|
||||
[style]="{ width: '30vw' }" [baseZIndex]="10000" [draggable]="false" [resizable]="false" *ngIf="confirmationForm">
|
||||
<div class="modal-body AddConfirmationModal p-0" [formGroup]="confirmationForm">
|
||||
<div formArrayName="hotel_confirmation_number">
|
||||
<div *ngFor="let room_confirmation_form of confirmationForm.controls['hotel_confirmation_number']['controls'];let i=index" [formGroupName]="i">
|
||||
<div class="formControlWrapper">
|
||||
<span class="formLabel">Room Name</span>
|
||||
<input type="text" class="formInput" readonly formControlName="room_name" placeholder="" />
|
||||
</div>
|
||||
<div class="formControlWrapper">
|
||||
<span class="formLabel">Confirmation Number</span>
|
||||
<input type="text" class="formInput" formControlName="confirmation_no" placeholder="" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="formControlWrapper">
|
||||
<span class="formLabel">Authorized Person</span>
|
||||
<input type="text" class="formInput" formControlName="hotel_confirmation_staff_name" placeholder="" />
|
||||
</div>
|
||||
<div class="formControlWrapper calenderField">
|
||||
<span class="formLabel">Date Of Confirmation</span>
|
||||
<p-calendar inputId="basic" placeholder="Select" [showIcon]="true" formControlName="hotel_confirmation_number_date" class="d-block"></p-calendar>
|
||||
</div>
|
||||
<div class="formControlWrapper">
|
||||
<span class="formLabel">Remarks</span>
|
||||
<textarea class="formInput" rows="2" placeholder=""
|
||||
formControlName="hotel_confirmation_staff_remarks"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<ng-template pTemplate="footer">
|
||||
<button class="btn btn-primary" (click)="saveConfirmationNumber()"> Submit </button>
|
||||
</ng-template>
|
||||
</p-dialog>
|
||||
<!-- End -->
|
||||
@@ -0,0 +1,560 @@
|
||||
import { Component, NgModule, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormArray, FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { Router } from '@angular/router';
|
||||
import * as moment from 'moment';
|
||||
import { CommonFunctionService } from 'src/app/core/common/common-function.service';
|
||||
import { API } from 'src/app/core/services/api.service';
|
||||
import { HotelBookingManagementService } from 'src/app/core/services/HotelServices/hotel_booking_management.service';
|
||||
import { Product } from 'src/app/core/services/product';
|
||||
import { securityFunctions } from 'src/app/core/common/security';
|
||||
|
||||
@Component({
|
||||
selector: 'hotel-booking-search',
|
||||
templateUrl: './hotel-booking-search.component.html',
|
||||
})
|
||||
export class HotelBookingSearchComponent implements OnInit {
|
||||
analyticsData;
|
||||
cols: any[];
|
||||
exportColumns;
|
||||
products: Product[];
|
||||
HotelBookingFiltersForm: FormGroup;
|
||||
confirmationForm: FormGroup;
|
||||
selectedProducts: Product[];
|
||||
Agencylist;
|
||||
Companylist;
|
||||
Entitylist;
|
||||
Countrylist;
|
||||
Citylist;
|
||||
AssignUserList=[];
|
||||
AssignSupportList=[];
|
||||
AssignUser=[];
|
||||
AssignSupport=[];
|
||||
AssignUserSearch=[];
|
||||
User_Type;
|
||||
User_Name;
|
||||
User_Id = [{user_id:'',user_name:'Assign to me'}];
|
||||
User_Id_sup = [{user_id:'',user_name:'Assign to me'}];
|
||||
HotelSupplierlist;
|
||||
HotelBookingList;
|
||||
@ViewChild('dt') myTable;
|
||||
To_Date_Start;
|
||||
AllCurrency;
|
||||
isOpenAddConfirmationNumberModal: boolean = false;
|
||||
AgencyType = [
|
||||
{ key: "B2C", value: "B2C" },
|
||||
{ key: "B2B", value: "B2B" }
|
||||
];
|
||||
Date_Type = [
|
||||
'Booking Date',
|
||||
'Check In',
|
||||
'Check Out',
|
||||
'Cancellation Deadline'
|
||||
]
|
||||
StarRating = [
|
||||
{ key: "0", value: "0 Star" },
|
||||
{ key: "1", value: "1 Star" },
|
||||
{ key: "2", value: "2 Star" },
|
||||
{ key: "3", value: "3 Star" },
|
||||
{ key: "4", value: "4 Star" },
|
||||
{ key: "5", value: "5 Star" }
|
||||
];
|
||||
BookingStatus = [
|
||||
{ key:"0", value:"In Progress"},
|
||||
{ key:"1", value:"Pending"},
|
||||
{ key:"3", value:"Confirmed"},
|
||||
{ key:"4", value:"Cancelled"},
|
||||
{ key:"6", value:"Reserved"}
|
||||
];
|
||||
PaymentStatus = [
|
||||
{ key: "PENDING", value: "Pending" },
|
||||
{ key: "FAILED", value: "Failed" },
|
||||
{ key: "PAID", value: "Paid" },
|
||||
{ key: "PARTLYPAID", value: "Partly Paid" },
|
||||
{ key: "PAID(AUTHORIZED)", value: "Paid (Authorized)" },
|
||||
];
|
||||
InvoiceStatus = [
|
||||
{ key: "INVOICED", value: "Invoiced" },
|
||||
{ key: "INVOICEFAILED", value: "Invoice Failed" },
|
||||
{ key: "INVOICEPENDING", value: "Invoice Pending" },
|
||||
{ key: "INVOICEVOID", value: "Invoice Void" },
|
||||
];
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private formBuilder: FormBuilder,
|
||||
private apiserv: API,
|
||||
private hotelBkgMgmtService: HotelBookingManagementService,
|
||||
private fb: FormBuilder,
|
||||
public commonserv: CommonFunctionService
|
||||
) { }
|
||||
ngOnInit(): void {
|
||||
// this.apiserv.setTitle('Hotel Booking');
|
||||
this.cols = [
|
||||
{ field: 'assigned_user_name', header: 'Assign User' },
|
||||
{ field: 'assigned_user_name_2', header: 'Assign Support' },
|
||||
{ field: 'trip_id', header: 'Trip Id' },
|
||||
{ field: 'booking_id', header: 'Booking Id' },
|
||||
{ field: 'payment_transaction_id', header: 'Payment Transaction Id' },
|
||||
{ field: 'hotel_name', header: 'Hotel Name' },
|
||||
{ field: 'hotel_country', header: 'Country' },
|
||||
{ field: 'hotel_city', header: 'City' },
|
||||
{ field: 'new_booking_date', header: 'Booking Date' },
|
||||
{ field: 'checkin_date', header: 'Check In Date' },
|
||||
{ field: 'checkout_date', header: 'Check Out Date' },
|
||||
{ field: 'no_of_nights', header: 'No Of Nights' },
|
||||
{ field: 'no_of_rooms', header: 'No Of Rooms' },
|
||||
{ field: 'room_names_custom', header: 'Room Name' },
|
||||
{ field: 'lead_guest', header: 'Lead Guest' },
|
||||
{ field: 'guest_nationality_code', header: 'Lead Nationality' },
|
||||
{ field: 'guest_mobile_no', header: 'Lead Mobile Number' },
|
||||
{ field: 'guest_email_address', header: 'Lead Email Address ' },
|
||||
{ field: 'supplier_name', header: 'Supplier' },
|
||||
{ field: 'supplier_ref_no', header: 'Supplier Ref no.' },
|
||||
{ field: 'agency_name', header: 'Agency' },
|
||||
{ field: 'agency_type', header: 'Agency Type' },
|
||||
{ field: 'booking_by', header: 'Booking By' },
|
||||
{ field: 'quality_check', header: 'Quality Check' },
|
||||
{ field: 'payment_status_custom', header: 'Payment Status' },
|
||||
{ field: 'promo_code', header: 'Promo Code' },
|
||||
{ field: 'payment_mode_custom', header: 'Payment Mode' },
|
||||
{ field: 'total', header: 'Total Booking Amount' },
|
||||
{ field: 'booking_status_custom', header: 'Booking Status' },
|
||||
{ field: 'thirdparty_invoice_number', header: 'Accounting Invoice No.' },
|
||||
{ field: 'thirdparty_invoice_status', header: 'AC Invoice No.' },
|
||||
{ field: "NotesStr", header: "notes" },
|
||||
];
|
||||
this.exportColumns = this.cols.map(col => ({
|
||||
title: col.header,
|
||||
dataKey: col.field
|
||||
}));
|
||||
this.User_Type = sessionStorage.getItem('userType');
|
||||
this.User_Name = sessionStorage.getItem('userName');
|
||||
this.User_Id[0]['user_id'] = sessionStorage.getItem('userId');
|
||||
this.User_Id_sup[0]['user_id'] = sessionStorage.getItem('userId');
|
||||
this.formInitialize();
|
||||
this.getAllCurrency();
|
||||
this.getCompanyList();
|
||||
this.getEntityList();
|
||||
this.getHotelSupplierListV2();
|
||||
this.getHotelCountryList();
|
||||
this.setDefaultDate();
|
||||
}
|
||||
formInitialize() {
|
||||
this.HotelBookingFiltersForm = this.formBuilder.group({
|
||||
fltr_trip_id: [''],
|
||||
fltr_booking_id: [''],
|
||||
fltr_payment_transaction_id: [''],
|
||||
fltr_company: [],
|
||||
fltr_branch: [],
|
||||
fltr_agency: [],
|
||||
fltr_agency_type: [],
|
||||
fltr_hotel_name: [''],
|
||||
fltr_country: [],
|
||||
fltr_city: [],
|
||||
fltr_star_rating: [],
|
||||
fltr_supplier: [],
|
||||
fltr_supplier_ref_no: [''],
|
||||
fltr_guest_name: [''],
|
||||
fltr_guest_contact_no: [''],
|
||||
fltr_guest_email: [''],
|
||||
fltr_booking_status: [],
|
||||
fltr_payment_status: [],
|
||||
fltr_invoice_status: [],
|
||||
fltr_date: [null],
|
||||
from_Date: [''],
|
||||
To_Date: [''],
|
||||
promo_code: [''],
|
||||
assigned_user: [''],
|
||||
under_cancel: [false],
|
||||
is_promo_code_applied: [false],
|
||||
fail_cancel: [false],
|
||||
});
|
||||
}
|
||||
|
||||
getCompanyList() {
|
||||
this.hotelBkgMgmtService.getAllCompany().subscribe((res) => {
|
||||
if (res) {
|
||||
this.Companylist = res;
|
||||
console.log(this.Companylist);
|
||||
}
|
||||
});
|
||||
}
|
||||
getHotelCountryList() {
|
||||
this.hotelBkgMgmtService.getAllHotelCountry().subscribe((res) => {
|
||||
if (res) {
|
||||
this.Countrylist = res;
|
||||
console.log(this.Countrylist);
|
||||
}
|
||||
});
|
||||
}
|
||||
getHotelCityList(country_code) {
|
||||
this.Citylist = null;
|
||||
this.hotelBkgMgmtService.getAllHotelCityByCountry(country_code).subscribe((res) => {
|
||||
if (res) {
|
||||
this.Citylist = res;
|
||||
}
|
||||
});
|
||||
}
|
||||
getEntityList() {
|
||||
this.hotelBkgMgmtService.getAllEntity().subscribe((res) => {
|
||||
if (res) {
|
||||
this.Entitylist = res;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getAllCurrency() {
|
||||
this.hotelBkgMgmtService.getAllCurrency().subscribe((res) => {
|
||||
if (res) {
|
||||
this.AllCurrency = res;
|
||||
}
|
||||
});
|
||||
}
|
||||
getHotelSupplierList() {
|
||||
this.hotelBkgMgmtService.getAllHotelSupplier().subscribe((res) => {
|
||||
if (res) {
|
||||
this.HotelSupplierlist = res;
|
||||
}
|
||||
});
|
||||
}
|
||||
getHotelSupplierListV2() {
|
||||
this.hotelBkgMgmtService.getAllHotelSupplierV2().subscribe((res) => {
|
||||
if (res) {
|
||||
this.HotelSupplierlist = res;
|
||||
}
|
||||
});
|
||||
}
|
||||
getFormatedDate(obj) {
|
||||
if (obj != null && obj != '' && obj) {
|
||||
return moment(obj).format("DD MMM YYYY");
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @Description setting the min date for To Date calender
|
||||
* @param Date From Date
|
||||
*/
|
||||
|
||||
applyToDate(date) {
|
||||
this.To_Date_Start = date
|
||||
}
|
||||
|
||||
search_bookings() {
|
||||
let form_data = this.HotelBookingFiltersForm.value;
|
||||
let VData = securityFunctions.getSessionStorage('VData') ? JSON.parse(securityFunctions.getSessionStorage('VData')) : '';
|
||||
let reqData = {
|
||||
user_time_zone: this.commonserv.GetTimeZoneGMT(),
|
||||
trip_id: form_data.fltr_trip_id,
|
||||
booking_id: form_data.fltr_booking_id,
|
||||
payment_transaction_id: form_data.fltr_payment_transaction_id,
|
||||
agency_id: form_data.fltr_agency,
|
||||
agency_type: form_data.fltr_agency_type,
|
||||
user_id: "",
|
||||
company_id: form_data.fltr_company,
|
||||
entity_id: form_data.fltr_branch,
|
||||
hotel_name: form_data.fltr_hotel_name,
|
||||
country: form_data.fltr_country,
|
||||
city: form_data.fltr_city,
|
||||
star_rating: form_data.fltr_star_rating,
|
||||
vendor_id: VData ? VData.extranet_vendor_id : '',
|
||||
supplier: '',
|
||||
supplier_ref_no: form_data.fltr_supplier_ref_no,
|
||||
guest_name: form_data.fltr_guest_name,
|
||||
contact: form_data.fltr_guest_contact_no,
|
||||
email: form_data.fltr_guest_email,
|
||||
promo_code: form_data.promo_code,
|
||||
assigned_user: form_data.assigned_user?form_data.assigned_user:'',
|
||||
is_promo_code_applied: form_data.is_promo_code_applied ? form_data.is_promo_code_applied.toString() : '',
|
||||
fail_cancel: form_data.fail_cancel,
|
||||
booking_status: form_data.fltr_booking_status,
|
||||
payment_status: form_data.fltr_payment_status === 'PAID(AUTHORIZED)' ? 'PAID' : form_data.fltr_payment_status,
|
||||
invoice_status: form_data.fltr_invoice_status,
|
||||
booking_from_date: '',
|
||||
booking_to_date: '',
|
||||
|
||||
check_in_from_date: '',
|
||||
check_in_to_date: '',
|
||||
|
||||
check_out_from_date: '',
|
||||
check_out_to_date: '',
|
||||
|
||||
cancellation_deadline_from : '',
|
||||
cancellation_deadline_to : '',
|
||||
under_cancel: form_data.under_cancel,
|
||||
is_authorized: form_data.fltr_payment_status === 'PAID(AUTHORIZED)' ? '1' : '0'
|
||||
};
|
||||
if (form_data.fltr_date == 'Booking Date') {
|
||||
reqData.booking_from_date = this.getFormatedDate(form_data.from_Date);
|
||||
reqData.booking_to_date = this.getFormatedDate(form_data.To_Date)
|
||||
}
|
||||
else if (form_data.fltr_date == 'Check In') {
|
||||
reqData.check_in_from_date = this.getFormatedDate(form_data.from_Date);
|
||||
reqData.check_in_to_date = this.getFormatedDate(form_data.To_Date);
|
||||
}
|
||||
else if (form_data.fltr_date == 'Check Out') {
|
||||
reqData.check_out_from_date = this.getFormatedDate(form_data.from_Date);
|
||||
reqData.check_out_to_date = this.getFormatedDate(form_data.To_Date);
|
||||
}
|
||||
else if (form_data.fltr_date == 'Cancellation Deadline') {
|
||||
reqData.cancellation_deadline_from = this.getFormatedDate(form_data.from_Date);
|
||||
reqData.cancellation_deadline_to = this.getFormatedDate(form_data.To_Date);
|
||||
}
|
||||
|
||||
this.hotelBkgMgmtService.getHotelBookingList(reqData).subscribe((res) => {
|
||||
if (res) {
|
||||
this.myTable.first = 0;
|
||||
this.HotelBookingList = res.map((x,i) => {
|
||||
let obj_currency = this.AllCurrency.filter(g => g.currency_code == x.currency);
|
||||
let amountFormat = obj_currency && obj_currency.length > 0 ? obj_currency[0].amount_format : '#,###,###,###.##';
|
||||
let decimalSeperator = obj_currency && obj_currency.length > 0 ? obj_currency[0].decimal_seperator : '.';
|
||||
x['total'] = x.supplier_currency + ' ' + this.commonserv.amountFormater(x.supplier_total_amount, amountFormat, decimalSeperator);
|
||||
x['custom_booking_date'] = x.booking_date;
|
||||
x['room_names_custom'] = x.room_names ? x.room_names.replaceAll(' <-> ',', ') : x.room_names;
|
||||
x["NotesStr"] = x.notes ? x.notes.join(',') : "";
|
||||
x['new_booking_date'] = moment(x.booking_date).format('DD MMM YYYY, HH:mm:ss');
|
||||
x['custom_booking_date'] = x.booking_date;
|
||||
x.booking_date = this.commonserv.UtcToLocaleTime(x.booking_date, 'DD MMM YYYY, HH:mm:ss');
|
||||
x['custom_checkin_date'] = x.checkin_date
|
||||
x.checkin_date = moment(x.checkin_date).format('DD MMM YYYY');
|
||||
x['custom_checkout_date'] = x.checkout_date
|
||||
x.checkout_date = moment(x.checkout_date).format('DD MMM YYYY');
|
||||
x['booking_status_custom'] = this.map_booking_status(x.status_id, x.payment_status);
|
||||
x['payment_status_custom'] = this.map_payment_status(x.payment_status, x.is_authorised);
|
||||
x['payment_mode_custom'] = x.payment_mode;
|
||||
x["Index"] = i;
|
||||
if(x.assigned_user){
|
||||
x.assigned_user == this.User_Id[0]['user_id']? this.User_Id[0]['user_name'] = this.User_Name :this.AssignUserList[i] = [{user_id:x.assigned_user,user_name:x.assigned_user_name}];
|
||||
}
|
||||
if(x.assigned_user_2){
|
||||
x.assigned_user_2 == this.User_Id_sup[0]['user_id']? this.User_Id_sup[0]['user_name'] = this.User_Name :this.AssignSupportList[i] = [{user_id:x.assigned_user_2,user_name:x.assigned_user_name_2}];
|
||||
}
|
||||
this.AssignUser[i] = x.assigned_user?x.assigned_user:null;
|
||||
this.AssignSupport[i] = x.assigned_user_2?x.assigned_user_2:null;
|
||||
return x;
|
||||
});
|
||||
console.log(this.HotelBookingList);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
map_payment_status(status, is_authorised) {
|
||||
if (status != null && status != "") {
|
||||
switch (status) {
|
||||
case "PAID": {
|
||||
return is_authorised ? 'Paid (Authorized)' : 'Paid';
|
||||
}
|
||||
case "PENDING": {
|
||||
return 'Pending';
|
||||
}
|
||||
case "FAILED": {
|
||||
return 'Failed';
|
||||
}
|
||||
case "PARTLYPAID": {
|
||||
return 'Partly Paid';
|
||||
}
|
||||
default : {
|
||||
return 'Not Attempt';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return 'Not Attempt';
|
||||
}
|
||||
}
|
||||
map_payment_mode(mode) {
|
||||
if (mode != null && mode != "") {
|
||||
switch (mode) {
|
||||
case "WALLET": {
|
||||
return 'Wallet';
|
||||
}
|
||||
case "CREDIT": {
|
||||
return 'Credit';
|
||||
}
|
||||
case "PAYATAGENCY": {
|
||||
return 'Pay at Agency';
|
||||
}
|
||||
case "PAYMENTGATEWAY": {
|
||||
return 'Payment Gateway';
|
||||
}
|
||||
case "PAYMENTGETWAY": {
|
||||
return 'Payment Gateway';
|
||||
}
|
||||
default : {
|
||||
return '-';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return '-';
|
||||
}
|
||||
}
|
||||
map_booking_status(booking_status, payment_status) {
|
||||
if (booking_status != null) {
|
||||
if (booking_status == 3) {
|
||||
return 'Confirmed';
|
||||
}
|
||||
else if (booking_status == 4) {
|
||||
return 'Cancelled';
|
||||
}
|
||||
else if(booking_status == 6) {
|
||||
return 'Reserved';
|
||||
}
|
||||
else if ((booking_status == 0 || booking_status == 2) && payment_status != null) {
|
||||
return 'Pending';
|
||||
}
|
||||
else {
|
||||
return 'In Progress';
|
||||
}
|
||||
} else {
|
||||
return 'In Progress';
|
||||
}
|
||||
}
|
||||
search_form_reset() {
|
||||
this.formInitialize();
|
||||
this.Citylist = null;
|
||||
}
|
||||
select_booking(trip_id) {
|
||||
let obj = {
|
||||
id: trip_id
|
||||
}
|
||||
const url = this.router.serializeUrl(
|
||||
this.router.createUrlTree(['/BookingManagement/HotelBooking/View'], { queryParams: obj })
|
||||
);
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
quality_check(trip_tbl_id) {
|
||||
this.hotelBkgMgmtService.bookingQualityCheck(trip_tbl_id).subscribe((res) => {
|
||||
if (res) {
|
||||
this.search_bookings();
|
||||
console.log(res);
|
||||
}
|
||||
});
|
||||
}
|
||||
onCountrySelect(e) {
|
||||
this.HotelBookingFiltersForm.get('fltr_city').setValue(null);
|
||||
e ? this.getHotelCityList(e.country_code) : this.Citylist = null;
|
||||
}
|
||||
|
||||
GetAssignUser(event,index){
|
||||
let Obj={
|
||||
user_type:this.User_Type,
|
||||
keyword:event.target.value
|
||||
}
|
||||
if(event.target.value.length>=3){
|
||||
this.apiserv.PostGo('/BookingManagement/GetOrgUserSearchDetails',Obj).subscribe(data=>{
|
||||
this.AssignUserList[index] = data.Result
|
||||
this.AssignSupportList[index] = data.Result
|
||||
})
|
||||
}
|
||||
}
|
||||
GetAssignUserValue(event){
|
||||
let Obj={
|
||||
user_type:this.User_Type,
|
||||
keyword:event.target.value
|
||||
}
|
||||
if(event.target.value.length>=3){
|
||||
this.apiserv.PostGo('/BookingManagement/GetOrgUserSearchDetails',Obj).subscribe(data=>{
|
||||
this.AssignUserSearch = data.Result
|
||||
})
|
||||
}
|
||||
}
|
||||
Save_User(trip_id,Value,i,update_type){
|
||||
let Obj = {
|
||||
trip_id:trip_id,
|
||||
user_id:Value?Value:'',
|
||||
user_type:this.User_Type,
|
||||
update_type: update_type
|
||||
}
|
||||
if(!Value){
|
||||
if(update_type == '1') {
|
||||
this.AssignUser[i] = null;
|
||||
} else {
|
||||
this.AssignSupport[i] = null;
|
||||
}
|
||||
}else if(Value == this.User_Id[0]['user_id'] && update_type == '1'){
|
||||
this.User_Id[0]['user_name'] = this.User_Name;
|
||||
} else if(Value == this.User_Id_sup[0]['user_id'] && update_type == '2'){
|
||||
this.User_Id_sup[0]['user_name'] = this.User_Name;
|
||||
}
|
||||
this.apiserv.PostGo('/BookingManagement/AssignTripToOrgUser',Obj).subscribe(data=>{
|
||||
// this.AssignUserList = data.Result
|
||||
this.commonserv.showMessage(data['Resp'],data['Message'])
|
||||
})
|
||||
}
|
||||
GetDatabyAgencyType() {
|
||||
this.HotelBookingFiltersForm.get('fltr_agency').setValue(null);
|
||||
}
|
||||
|
||||
// Set Default for the from date & to date
|
||||
setDefaultDate(){
|
||||
this.HotelBookingFiltersForm.get("fltr_date").setValue("Booking Date");
|
||||
let from_date = new Date(new Date().getTime() - 7 * 24 * 60 * 60 * 1000);
|
||||
let to_date = new Date();
|
||||
this.HotelBookingFiltersForm.get("from_Date").setValue(from_date);
|
||||
this.HotelBookingFiltersForm.get("To_Date").setValue(to_date);
|
||||
}
|
||||
initConfirmationForm(itinerary_data) {
|
||||
let obj = {
|
||||
booking_id: itinerary_data != null && itinerary_data.booking_id != null && itinerary_data.booking_id != '' ? itinerary_data.booking_id : "",
|
||||
// hotel_confirmation_number: itinerary_data != null && itinerary_data.hotel_confirmation_number != null && itinerary_data.hotel_confirmation_number != '' ? itinerary_data.hotel_confirmation_number.split(',') : [],
|
||||
hotel_confirmation_number_date: itinerary_data != null && itinerary_data.hotel_confirmation_number_date != null && itinerary_data.hotel_confirmation_number_date != '' ? new Date(itinerary_data.hotel_confirmation_number_date) : new Date(),
|
||||
hotel_confirmation_staff_name: itinerary_data != null && itinerary_data.hotel_confirmation_staff_name != null && itinerary_data.hotel_confirmation_staff_name != '' ? itinerary_data.hotel_confirmation_staff_name : "",
|
||||
hotel_confirmation_staff_remarks: itinerary_data != null && itinerary_data.hotel_confirmation_staff_remarks != null && itinerary_data.hotel_confirmation_staff_remarks != '' ? itinerary_data.hotel_confirmation_staff_remarks : "",
|
||||
supplier_confirmation_number: itinerary_data != null && itinerary_data.supplier_confirmation_number != null && itinerary_data.supplier_confirmation_number != '' ? itinerary_data.supplier_confirmation_number : ""
|
||||
}
|
||||
this.confirmationForm = this.fb.group({
|
||||
booking_id: [obj.booking_id],
|
||||
// hotel_confirmation_number: [obj.hotel_confirmation_number],
|
||||
hotel_confirmation_number:this.fb.array([]),
|
||||
supplier_confirmation_number:[obj.supplier_confirmation_number],
|
||||
hotel_confirmation_number_date: [obj.hotel_confirmation_number_date],
|
||||
hotel_confirmation_staff_name: [obj.hotel_confirmation_staff_name],
|
||||
hotel_confirmation_staff_remarks: [obj.hotel_confirmation_staff_remarks],
|
||||
});
|
||||
let formarray = this.confirmationForm.controls['hotel_confirmation_number'] as FormArray;
|
||||
if(itinerary_data?.room_list.length > 0){
|
||||
itinerary_data.room_list.forEach(data=>{
|
||||
formarray.push(
|
||||
this.fb.group({
|
||||
room_name:data.room_name,
|
||||
room_id:data.hotel_room_id,
|
||||
confirmation_no:data.hotel_confirmation_number,
|
||||
})
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
openConfirmationNumberModal( itinerary_data) {
|
||||
this.initConfirmationForm(itinerary_data);
|
||||
this.isOpenAddConfirmationNumberModal = true;
|
||||
}
|
||||
|
||||
saveConfirmationNumber() {
|
||||
let obj = this.confirmationForm.value;
|
||||
let postdata = {
|
||||
booking_id:obj.booking_id,
|
||||
supplier_confirmation_number:obj.supplier_confirmation_number,
|
||||
hotel_confirmation_number_date:obj.hotel_confirmation_number_date,
|
||||
hotel_confirmation_staff_name:obj.hotel_confirmation_staff_name,
|
||||
hotel_confirmation_staff_remarks:obj.hotel_confirmation_staff_remarks,
|
||||
hotel_rooms:[]
|
||||
}
|
||||
let hotel_confirm_number = [];
|
||||
obj.hotel_confirmation_number.forEach(data=>{
|
||||
hotel_confirm_number.push(
|
||||
{
|
||||
hotel_room_id:data.room_id,
|
||||
hotel_confirmation_number:data.confirmation_no
|
||||
}
|
||||
);
|
||||
})
|
||||
postdata.hotel_rooms = hotel_confirm_number;
|
||||
this.hotelBkgMgmtService.saveConfirmationNumber(postdata).subscribe((data) => {
|
||||
if(data?.resp){
|
||||
this.isOpenAddConfirmationNumberModal = false;
|
||||
this.search_bookings();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,594 @@
|
||||
<div class="ng-backbtn mb-10">
|
||||
<a href="javascript:void(0)" (click)="back_to_listing()">
|
||||
<svg class="ng-backsvg" fill="#000" focusable="false" viewBox="0 0 24 24" aria-hidden="true" role="presentation">
|
||||
<path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"></path>
|
||||
</svg>
|
||||
<span class="ng-backtext">Back</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="ng-card custom-shadow">
|
||||
<div class="ng-cardHead">
|
||||
<div class="ng-cardLabel">
|
||||
<h3 class="ng-cardTitle">Booking Details</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ng-searchBody" *ngIf="booking_customer_data">
|
||||
<div class="app-BkGrid2">
|
||||
<div class="bookingBorderCard">
|
||||
<div class="listView">
|
||||
<h5 class="w-40 tripId m-0">Trip ID</h5>
|
||||
<p class="w-60 text-start app-text mobi-w60">{{ booking_customer_data.trip_id }}</p>
|
||||
</div>
|
||||
<div class="listView">
|
||||
<h5 class="w-40 tripId m-0">Booking Date</h5>
|
||||
<p class="w-60 text-start app-text mobi-w60">{{ booking_customer_data.booking_date }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bookingBorderCard">
|
||||
<div class="listView" *ngIf="
|
||||
booking_customer_data.customer_id != null &&
|
||||
booking_customer_data.customer_id != ''
|
||||
">
|
||||
<h5 class="w-40 tripId m-0">Customer ID</h5>
|
||||
<p class="w-60 text-start app-text mobi-w60">{{ booking_customer_data.customer_id }}</p>
|
||||
</div>
|
||||
<div class="listView" *ngIf="
|
||||
booking_customer_data.customer_id != null &&
|
||||
booking_customer_data.customer_id != ''
|
||||
">
|
||||
<h5 class="w-40 tripId m-0">Cutomer Contact</h5>
|
||||
<p class="w-60 text-start app-text mobi-w60">{{ booking_customer_data.customer_contact }}</p>
|
||||
</div>
|
||||
<div class="listView" *ngIf="
|
||||
booking_customer_data.customer_id != null &&
|
||||
booking_customer_data.customer_id != ''
|
||||
">
|
||||
<h5 class="w-40 tripId m-0">Customer Email</h5>
|
||||
<p class="w-60 text-start app-text mobi-w60">{{ booking_customer_data.customer_email }}</p>
|
||||
</div>
|
||||
<div class="listView" *ngIf="
|
||||
booking_customer_data.customer_id != null &&
|
||||
booking_customer_data.customer_id != ''
|
||||
">
|
||||
<h5 class="w-40 tripId m-0">Customer Profile Status</h5>
|
||||
<p class="w-60 text-start app-text mobi-w60">
|
||||
<span class="status"
|
||||
[ngClass]="{'status-success':booking_customer_data.customer_profile_status ,'status-failed':!booking_customer_data.customer_profile_status }">
|
||||
{{booking_customer_data.customer_profile_status?'Active':'Deactive'}}
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class="listView">
|
||||
<h5 class="w-40 tripId m-0">Lead Guest</h5>
|
||||
<p class="w-60 text-start app-text mobi-w60">{{ booking_customer_data.lead_guest }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ng-tab custom-shadow hotelTab_Wrapper">
|
||||
<p-tabView (onChange)="tabClick($event)">
|
||||
<!-- Itinerary tab -->
|
||||
<p-tabPanel header="Itinerary">
|
||||
<div *ngIf="tab_data_status.itinerary == 'success'" [formGroup]="StatusGroup">
|
||||
<div class=" Itinerary_Details" formArrayName="statusArr"
|
||||
*ngFor="let itinerary of itinerary_tab_data;let i = index">
|
||||
<div class="bookingMngmnt_gridWrap">
|
||||
<div class="bookingMngmnt_border">
|
||||
<div class="app-comCol">
|
||||
<h5 class="app-bgtext">Hotel Name</h5>
|
||||
<p class="app-text"> {{ itinerary.hotel_name }} ({{ itinerary.hotel_star_category }} Star) <span *ngIf="itinerary.default_hotel_name">, {{itinerary.default_hotel_name}}</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class="app-comCol">
|
||||
<h5 class="app-bgtext">Hotel Address</h5>
|
||||
<p class="app-text">{{ itinerary.hotel_address }} <span *ngIf="itinerary.default_hotel_address">, {{itinerary.default_hotel_address}}</span></p>
|
||||
</div>
|
||||
<div class="app-comCol" *ngIf="cityList">
|
||||
<h5 class="app-bgtext">City Name</h5>
|
||||
<p class="app-text"> {{cityList[i].cityName}} </p>
|
||||
</div>
|
||||
<div class="app-comCol" *ngIf="cityList">
|
||||
<h5 class="app-bgtext">Country Name</h5>
|
||||
<p class="app-text"> {{cityList[i].country}} </p>
|
||||
</div>
|
||||
<div class="app-comCol">
|
||||
<h5 class="app-bgtext">Check In</h5>
|
||||
<p class="app-text"> {{ itinerary.checkin_date | date: "dd MMM yyyy" }} </p>
|
||||
</div>
|
||||
<div class="app-comCol">
|
||||
<h5 class="app-bgtext">Check Out</h5>
|
||||
<p class="app-text"> {{ itinerary.checkout_date | date: "dd MMM yyyy" }} </p>
|
||||
</div>
|
||||
<div class="app-comCol">
|
||||
<h5 class="app-bgtext">No of Nights</h5>
|
||||
<p class="app-text">{{ itinerary.no_of_nights }}</p>
|
||||
</div>
|
||||
<div class="app-comCol">
|
||||
<h5 class="app-bgtext">No of Rooms</h5>
|
||||
<p class="app-text">{{ itinerary.no_of_rooms }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="app-comCol">
|
||||
<h5 class="app-bgtext"> Booking ID </h5>
|
||||
<p class="app-text"> {{ itinerary.booking_id }} </p>
|
||||
</div>
|
||||
<div class="app-comCol">
|
||||
<h5 class="app-bgtext">Booking Status</h5>
|
||||
<p class="app-text" [ngClass]="
|
||||
map_booking_status(
|
||||
itinerary.status_id,
|
||||
itinerary.payment_status
|
||||
) == 'Confirmed'
|
||||
? 'text-success'
|
||||
: 'text-danger'
|
||||
">{{ map_booking_status( itinerary.status_id, itinerary.payment_status ) }} {{itinerary.status_id == '6' && itinerary.fail_cancel ? '('+ 'Auto Cancellation Failed'+')' :''}}</p>
|
||||
</div>
|
||||
<div class="app-comCol">
|
||||
<h5 class="app-bgtext">Confirmation Number</h5>
|
||||
<p class="app-text">{{itinerary.hotel_confirmation_number}}</p>
|
||||
<a class="bookingListHotel mb-0 pr-0" (click)="
|
||||
openConfirmationNumberModal(
|
||||
addConfirmationNumber,
|
||||
itinerary
|
||||
)
|
||||
">
|
||||
<u>
|
||||
<span *ngIf="
|
||||
itinerary.hotel_confirmation_number == null ||
|
||||
itinerary.hotel_confirmation_number == ''
|
||||
">Add</span>
|
||||
<span *ngIf="
|
||||
itinerary.hotel_confirmation_number != null &&
|
||||
itinerary.hotel_confirmation_number != ''
|
||||
">Edit</span>
|
||||
</u>
|
||||
</a>
|
||||
</div>
|
||||
<div class="app-comCol">
|
||||
<h5 class="app-bgtext"> Vendor Total Amount </h5>
|
||||
<p class="app-text">{{itinerary.supplier_currency}} {{itinerary.supplier_total_amount}}</p>
|
||||
</div>
|
||||
<div class="app-comCol" *ngIf="itinerary.supplier_cancellation_currency">
|
||||
<h5 class="app-bgtext"> Total Original Booking Rate </h5>
|
||||
<p class="app-text">{{itinerary.supplier_currency}} {{itinerary.supplier_total_amount}}</p>
|
||||
</div>
|
||||
<div class="app-comCol" *ngIf="itinerary.supplier_cancellation_currency">
|
||||
<h5 class="app-bgtext"> Total Vendor Cancellation Rate </h5>
|
||||
<p class="app-text">{{itinerary.supplier_cancellation_currency}} {{itinerary.supplier_cancellation_amount}}</p>
|
||||
</div>
|
||||
<div class="app-comCol">
|
||||
<h5 class="app-bgtext">Policy</h5>
|
||||
<a class="bookingListHotel mb-0" (click)="OpenCancellationPolicyModal(itinerary, true)">
|
||||
<u> Cancellation Policy </u>
|
||||
</a>
|
||||
</div>
|
||||
<div class="app-comCol">
|
||||
<h5 class="app-bgtext">Session ID </h5>
|
||||
<p class="app-text"> {{ itinerary.booking_guid }} </p>
|
||||
</div>
|
||||
<div class="app-comCol pb-0" *ngIf="itinerary.lan && itinerary.lon">
|
||||
<h5 class="app-bgtext"> Latitude | Longitude </h5>
|
||||
<div class="d-flex gap-8">
|
||||
<p class="app-text =">{{itinerary.lan +' '}}</p>
|
||||
<h5 class="app-bgtext">|</h5>
|
||||
<p class="app-text ml-5">{{''+itinerary.lon}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="overflow-auto mt-20">
|
||||
<table class="table table-bordered mb-0 Bk_Mg-Tbl">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>Room No.</th>
|
||||
<th>Room Name</th>
|
||||
<th>Confirmation Number</th>
|
||||
<th>Meal Type</th>
|
||||
<th>Guest</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let i = index; let room; of: itinerary.room_list">
|
||||
<td>{{ i + 1 }}</td>
|
||||
<td>{{ room.room_name }}</td>
|
||||
<td>{{ room.room_supplier_confirmation_number }}</td>
|
||||
<td>{{ room.meal_plan }}</td>
|
||||
<td> {{ room.adt }} Adult<span *ngIf="room.chd > 0">, {{ room.chd }} Child</span>
|
||||
</td>
|
||||
<td>{{ map_room_status(room.room_booking_status) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="!itinerary_tab_data" style="display: flex; justify-content: center">
|
||||
<p>Itinerary Data not found</p>
|
||||
</div>
|
||||
</div>
|
||||
</p-tabPanel>
|
||||
<!-- Passengers tab -->
|
||||
<p-tabPanel header="Passengers">
|
||||
<div *ngIf="tab_data_status.passenger == 'success'">
|
||||
<div *ngFor="let bkg of guest_tab_data" class="ng-bookingDetail">
|
||||
<div class="app-mainGrid2">
|
||||
<div class="border-right">
|
||||
<div class="app-comCol">
|
||||
<h5 class="app-bgtext">Booking ID</h5>
|
||||
<p class="app-text"> {{ bkg.booking_id }}</p>
|
||||
</div>
|
||||
<div class="app-comCol">
|
||||
<h5 class="app-bgtext">Booking Status</h5>
|
||||
<p class="app-text" [ngClass]="
|
||||
map_booking_status(bkg.status_id, bkg.payment_status) ==
|
||||
'Confirmed'
|
||||
? 'text-success'
|
||||
: 'text-danger'
|
||||
"> {{ map_booking_status(bkg.status_id, bkg.payment_status) }}</p>
|
||||
</div>
|
||||
<div class="app-comCol">
|
||||
<h5 class="app-bgtext">Booking Date</h5>
|
||||
<p class="app-text"> {{ bkg.booking_date }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="overflow-auto mt-20">
|
||||
<table class="table table-bordered mb-0 Bk_Mg-Tbl">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>Room No.</th>
|
||||
<th>Room Name</th>
|
||||
<th>Meal Type</th>
|
||||
<th>Guest</th>
|
||||
<th>Guest Name</th>
|
||||
<th>Guest Nationality</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let i = index; let room; of: bkg.room_list">
|
||||
<td>{{ i + 1 }}</td>
|
||||
<td class="passengerRoomName">
|
||||
<span>{{ room.room_name }}</span>
|
||||
</td>
|
||||
<td>{{ room.meal_plan }}</td>
|
||||
<td> {{ room.adt }} Adult<span *ngIf="room.chd > 0">, {{ room.chd }} Child</span>
|
||||
</td>
|
||||
<td class="passengerRoomName">
|
||||
<div *ngFor="let guest of room.guest_list">
|
||||
<span *ngIf="
|
||||
guest.guest_name != null && guest.guest_name != ''
|
||||
">{{ guest.guest_name }}</span>
|
||||
<span *ngIf="
|
||||
guest.guest_name == null ||
|
||||
guest.guest_name.trim() == ''
|
||||
">TBA</span>
|
||||
<span *ngIf="guest.guest_type == 2"> ({{ guest.guest_age }} years)</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>{{itinerary_tab_data ? itinerary_tab_data[0].guest_nationality : ''}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="app-comCol">
|
||||
<table class="table table-bordered mb-0 Bk_Mg-Tbl">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th class="app-bgtext text-left">Special Request:-</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="app-comCol">
|
||||
<tr class="app-text ml-2">
|
||||
<span *ngIf="bkg.special_request != null && bkg.special_request != ''
|
||||
">{{ bkg.special_request }}</span><span *ngIf="
|
||||
bkg.special_request == null || bkg.special_request == ''
|
||||
">N/A</span>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="tab_data_status.passenger == 'failed'" style="display: flex; justify-content: center">
|
||||
<p>Passenger Data not found</p>
|
||||
</div>
|
||||
</p-tabPanel>
|
||||
<!-- Vendor Costing tab -->
|
||||
<p-tabPanel header="Vendor Costing">
|
||||
<div *ngIf="tab_data_status.costing == 'success'">
|
||||
<div class="ng-bookingDetail" *ngFor="let bkg of costing_tab_data.booking_list; let a = index">
|
||||
<div class="bookingMngmnt_gridWrap">
|
||||
<div class="border-right">
|
||||
<div class="app-comCol">
|
||||
<h5 class="app-bgtext">Trip Id</h5>
|
||||
<p class="app-text">{{ costing_tab_data.trip_id }}</p>
|
||||
</div>
|
||||
<div class="app-comCol">
|
||||
<h5 class="app-bgtext">Booking Id</h5>
|
||||
<p class="app-text">{{ bkg.booking_id }}</p>
|
||||
</div>
|
||||
<!-- <div class="app-comCol">
|
||||
<h5 class="app-bgtext">Vendor Name</h5>
|
||||
<p class="app-text">Amaan</p>
|
||||
</div> -->
|
||||
<div class="app-comCol" *ngIf="bkg.Contract">
|
||||
<h5 class="app-bgtext">Contract Name</h5>
|
||||
<p class="app-text">{{ bkg.Contract }}</p>
|
||||
</div>
|
||||
<div class="app-comCol">
|
||||
<h5 class="app-bgtext" *ngIf="bkg.Offer">Offer Details:</h5>
|
||||
<p class="app-text">{{ bkg.Offer }}</p>
|
||||
</div>
|
||||
<div class="app-comCol" *ngIf="bkg.Supplement">
|
||||
<h5 class="app-bgtext">Supplements:</h5>
|
||||
<p class="app-text">{{ bkg.Supplement }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="app-comCol">
|
||||
<h5 class="app-bgtext">Vendor Invoice</h5>
|
||||
<a class="bookinglink mb-0 pr-0"> {{bkg.invoice_no ? bkg.invoice_no : ''}}
|
||||
<span (click)="openVendorInvoiceNumberModal(bkg.booking_id,bkg.invoice_no)">{{bkg.invoice_no ? ' Edit' :'Add'}}</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="app-comCol">
|
||||
<h5 class="app-bgtext">Currency</h5>
|
||||
<p class="app-text">{{ bkg.supplier_currency }}</p>
|
||||
</div>
|
||||
<div class="app-comCol">
|
||||
<h5 class="app-bgtext">Vendor Total</h5>
|
||||
<p class="app-text">{{ bkg.supplier_amount }}</p>
|
||||
</div>
|
||||
<!-- <div class="app-comCol">
|
||||
<h5 class="app-bgtext">Adjustment</h5>
|
||||
<p class="app-text">0.23</p>
|
||||
</div> -->
|
||||
</div>
|
||||
<!-- <div class="view-action-btnWrapper text-left">
|
||||
<button class="btn btn-primary" [matMenuTriggerFor]="menu">Action</button>
|
||||
<mat-menu #menu="matMenu">
|
||||
<button mat-menu-item>Action</button>
|
||||
</mat-menu>
|
||||
</div> -->
|
||||
</div>
|
||||
<div *ngFor="let Room_Details of bkg.room_details_list;let i=index">
|
||||
<div class="overflow-auto mt-20">
|
||||
<table class="table table-bordered mb-0 Bk_Mg-Tbl">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>Room No.</th>
|
||||
<th>Room</th>
|
||||
<th>Meal Type</th>
|
||||
<th>Guest Count</th>
|
||||
<th>Lead Guest</th>
|
||||
<th>Confirmation Number</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{{i+1}}</td>
|
||||
<td>{{Room_Details.room_name}}</td>
|
||||
<td>{{Room_Details.meal_plan}}</td>
|
||||
<td>{{ Room_Details.adt }} Adult<span *ngIf="Room_Details.chd > 0">, {{ Room_Details.chd }} Child</span></td>
|
||||
<td>{{Room_Details.lead_guest}}</td>
|
||||
<td>{{Room_Details.hotel_confirmation_number}}
|
||||
<a class="bookinglink mb-0">
|
||||
<span (click)="openConfirmationNumberModal( addConfirmationNumber,
|
||||
Room_Details)"> {{ Room_Details.hotel_confirmation_number ? 'Edit' : 'Add'}} </span>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="overflow-auto mt-20" *ngIf="Room_Details.Room_Allocation_Data && Room_Details.Room_Allocation_Data.Date.length > 0">
|
||||
<table class="table table-bordered mb-0 Bk_Mg-Tbl">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th class="text-left">Date</th>
|
||||
<th class="text-left" *ngFor="let Date of Room_Details.Room_Allocation_Data.Date">{{Date}}</th>
|
||||
<!-- <th>Thur 05 Sep</th>
|
||||
<th>Fri 06 Sep</th>
|
||||
<th>Sat 07 Sep</th>
|
||||
<th>Sun 08 Sep</th>
|
||||
<th>Mon 09 Sep</th>
|
||||
<th>Tue 10 Sep</th> -->
|
||||
<th>Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="text-left">Price</td>
|
||||
<td class="text-left" *ngFor="let Price of Room_Details.Room_Allocation_Data.Price">{{Price}}</td>
|
||||
<td class="text-right">{{Room_Details.Room_Allocation_Data.total}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-left">Allocation</td>
|
||||
<td class="text-left" *ngFor="let allocation of Room_Details.Room_Allocation_Data.Allocation">{{allocation}}</td>
|
||||
<td class="text-right">-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-left">Booked</td>
|
||||
<td class="text-left" *ngFor="let booked of Room_Details.Room_Allocation_Data.Booked">{{booked}}</td>
|
||||
<td class="text-right">-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-left">Available after booking</td>
|
||||
<td class="text-left" *ngFor="let book_avail of Room_Details.Room_Allocation_Data.Available_after_booking">{{book_avail}}</td>
|
||||
<td class="text-right">-</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</p-tabPanel>
|
||||
<!-- Vendor Notes tab -->
|
||||
<p-tabPanel header="Vendor Notes">
|
||||
<div class="text-right mb-3">
|
||||
<button class="btn btn-primary" (click)="openSendAddNote()"> Add Notes </button>
|
||||
</div>
|
||||
<div class="overflow-auto">
|
||||
<table class="table table-bordered mb-0 Bk_Mg-Tbl">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>Sr No</th>
|
||||
<th>Note</th>
|
||||
<th>Note By</th>
|
||||
<th>Noted On</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let note of note_tab_data; let i = index">
|
||||
<td>{{ i + 1 }}</td>
|
||||
<td class="max-width330">{{ note.note }}</td>
|
||||
<td>{{ note.note_by }}</td>
|
||||
<td>{{ note.noted_on }}</td>
|
||||
</tr>
|
||||
<ng-template pTemplate="emptymessage">
|
||||
<tr *ngIf="note_tab_data.length == 0" class="ResultNotFound">
|
||||
<td>
|
||||
No data found
|
||||
</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</p-tabPanel>
|
||||
</p-tabView>
|
||||
</div>
|
||||
|
||||
<!-- Notes Modal -->
|
||||
<p-dialog header="Add Note" position="top" [(visible)]="isOpenAddNote" [modal]="true" [style]="{width: '35vw'}"
|
||||
[baseZIndex]="10000" [draggable]="false" [resizable]="false">
|
||||
<div class="modal-body p-0 overflow-auto">
|
||||
<div class="formControlWrapper" [formGroup]="notesform">
|
||||
<span class="formLabel">Note</span>
|
||||
<textarea class="form-control val-NotRequired" formControlName="Note" rows="4" placeholder=" "
|
||||
[ngClass]="{'errorInput': validationServ.onBlur(notesform.get('Note'), 'required')}"></textarea>
|
||||
<span class="errorspan" *ngIf="validationServ.onBlur(notesform.get('Note'), 'required')">Please
|
||||
enter note </span>
|
||||
</div>
|
||||
</div>
|
||||
<ng-template pTemplate="footer">
|
||||
<button class="btn btn-primary" (click)="saveNotes()">
|
||||
Submit
|
||||
</button>
|
||||
</ng-template>
|
||||
</p-dialog>
|
||||
<!-- End -->
|
||||
<!-- Cancellation Policy -->
|
||||
<div class="cancellationpolicy_Modal">
|
||||
<p-dialog header="Cancellation Policy" position="top" [(visible)]="isOpenCancellationPolicyModal" [modal]="true"
|
||||
[style]="{ width: '37vw' }" [baseZIndex]="10000" [draggable]="false" [resizable]="false">
|
||||
<div>
|
||||
<div *ngFor="let c_p_room of selectedItinerary">
|
||||
<div class=" mb-3">
|
||||
<div *ngIf="is_roomwise_policy" class="app-modalHead mb-2">
|
||||
<span>{{ c_p_room.room_name }}</span>
|
||||
</div>
|
||||
<div class="tableWrapper" *ngIf="c_p_room.supplier_cancellation_policy">
|
||||
<h6 class="fw-400 mt-0">Supplier Cancellation Policy</h6>
|
||||
<div class=" mt-1" *ngIf="c_p_room.supplier_cancellation_policy.format_type != 'Text'">
|
||||
<li class="book-TableData" *ngFor="let can_p of c_p_room.supplier_cancellation_policy.policy"> From {{ can_p.from_date }} to {{ can_p.to_date }} charge of
|
||||
<span *ngIf="can_p.format_type == 'Flat' || can_p.format_type == 'Percentage'">{{ can_p.currency == '%' ?
|
||||
can_p.amount + can_p.currency : can_p.currency + ' ' +can_p.amount }}</span>
|
||||
<span *ngIf="can_p.format_type == 'Night' || can_p.format_type == 'Nights'">{{can_p.amount + ' ' +can_p.currency}}</span>
|
||||
</li>
|
||||
</div>
|
||||
<div class=" mt-10" *ngIf="c_p_room.supplier_cancellation_policy.format_type == 'Text'">
|
||||
<p *ngFor="let can_p of c_p_room.supplier_cancellation_policy.policy"> {{can_p.text}} </p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<h6 class="mt-0">Cancellation Policy Timezone: {{selectedItinerary && selectedItinerary.length > 0 ? selectedItinerary[0].timezone : ''}} {{cityList ? '(' + cityList[0].cityName + ')' : ''}}</h6>
|
||||
<ng-template pTemplate="footer">
|
||||
<button mat-flat-button color="primary" (click)="isOpenCancellationPolicyModal = false"> Ok </button>
|
||||
</ng-template>
|
||||
</div>
|
||||
</p-dialog>
|
||||
</div>
|
||||
<!-- End -->
|
||||
<!-- Add Confirmation Number -->
|
||||
<p-dialog header="Add Confirmation Number" position="top" [(visible)]="isOpenAddConfirmationNumberModal" [modal]="true"
|
||||
[style]="{ width: '30vw' }" [baseZIndex]="10000" [draggable]="false" [resizable]="false" *ngIf="confirmationForm">
|
||||
<div class="modal-body AddConfirmationModal p-0" [formGroup]="confirmationForm">
|
||||
<div formArrayName="hotel_confirmation_number">
|
||||
<div *ngFor="let room_confirmation_form of confirmationForm.controls['hotel_confirmation_number']['controls'];let i=index" [formGroupName]="i">
|
||||
<div class="formControlWrapper">
|
||||
<span class="formLabel">Room Name</span>
|
||||
<input type="text" class="form-control" readonly formControlName="room_name" placeholder="" />
|
||||
</div>
|
||||
<div class="formControlWrapper">
|
||||
<span class="formLabel">Confirmation Number</span>
|
||||
<input type="text" class="form-control" formControlName="confirmation_no" placeholder="" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="formControlWrapper">
|
||||
<span class="formLabel">Authorized Person</span>
|
||||
<input type="text" class="form-control" formControlName="hotel_confirmation_staff_name" placeholder="" />
|
||||
</div>
|
||||
<div class="formControlWrapper calenderField">
|
||||
<span class="formLabel">Date Of Confirmation</span>
|
||||
<p-calendar inputId="basic" placeholder="Select" [showIcon]="true" formControlName="hotel_confirmation_number_date" class="d-block"></p-calendar>
|
||||
</div>
|
||||
<div class="formControlWrapper">
|
||||
<span class="formLabel">Remarks</span>
|
||||
<textarea class="form-control" rows="2" placeholder=""
|
||||
formControlName="hotel_confirmation_staff_remarks"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<ng-template pTemplate="footer">
|
||||
<button class="btn btn-primary" (click)="saveConfirmationNumber()"> Submit </button>
|
||||
</ng-template>
|
||||
</p-dialog>
|
||||
<!-- End -->
|
||||
<!-- Add Invoice Number -->
|
||||
<p-dialog header="Add Invoice Number" position="top" [(visible)]="isOpenAddInvoiceNumberModal" [modal]="true"
|
||||
[style]="{ width: '30vw' }" [baseZIndex]="10000" [draggable]="false" [resizable]="false">
|
||||
<div class="modal-body AddConfirmationModal p-0">
|
||||
<div class="formControlWrapper">
|
||||
<span class="formLabel">Invoice Number</span>
|
||||
<input type="text" class="form-control" placeholder="" />
|
||||
</div>
|
||||
<div class="formControlWrapper">
|
||||
<span class="formLabel">Authorized Person</span>
|
||||
<input type="text" class="form-control" placeholder="" />
|
||||
</div>
|
||||
<div class="formControlWrapper calenderField">
|
||||
<span class="formLabel">Date of Invoice Issue</span>
|
||||
<p-calendar inputId="basic" placeholder="Select" [showIcon]="true" class="d-block"></p-calendar>
|
||||
</div>
|
||||
<div class="formControlWrapper">
|
||||
<span class="formLabel">Remarks</span>
|
||||
<textarea class="form-control" rows="2" placeholder=""></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<ng-template pTemplate="footer">
|
||||
<button class="btn btn-primary mr-0"> Submit </button>
|
||||
</ng-template>
|
||||
</p-dialog>
|
||||
<!-- End -->
|
||||
<!-- Add Invoice Number -->
|
||||
<p-dialog header="Add Invoice Number" position="top" [(visible)]="isOpenAddVendorInvoiceNumberModal" [modal]="true"
|
||||
[style]="{ width: '30vw' }" [baseZIndex]="10000" [draggable]="false" [resizable]="false">
|
||||
<div>
|
||||
<div class="formControlWrapper" [formGroup]="VendorInvoiceForm" [ngClass]="{'errorInput': validationServ.onBlur(VendorInvoiceForm.get('vendor_invoice_number'), 'required')}">
|
||||
<span class="formLabel">Invoice Number</span>
|
||||
<input type="text" formControlName="vendor_invoice_number" class="form-control" placeholder="" />
|
||||
<span class="errorspan" *ngIf="validationServ.onBlur(VendorInvoiceForm.get('vendor_invoice_number'), 'required')">Please
|
||||
enter invoice number </span>
|
||||
</div>
|
||||
</div>
|
||||
<ng-template pTemplate="footer">
|
||||
<button class="btn btn-primary mr-0" (click)="SaveInvoiceNumber()"> Submit </button>
|
||||
</ng-template>
|
||||
</p-dialog>
|
||||
<!-- End -->
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
<hotel-booking-search></hotel-booking-search>
|
||||
@@ -0,0 +1,14 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-hotel-booking',
|
||||
templateUrl: './hotel-booking.component.html',
|
||||
})
|
||||
export class HotelBookingComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
import { InputMaskModule } from 'primeng/inputmask';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatTabsModule } from '@angular/material/tabs';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { NgSelectModule } from '@ng-select/ng-select';
|
||||
import { ButtonModule } from 'primeng/button';
|
||||
import { CalendarModule } from 'primeng/calendar';
|
||||
import { DialogModule } from 'primeng/dialog';
|
||||
import { TableModule } from "primeng/table";
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { InputTextModule } from "primeng/inputtext";
|
||||
import { RippleModule } from 'primeng/ripple';
|
||||
import { ToastModule } from 'primeng/toast';
|
||||
import { ToolbarModule } from "primeng/toolbar";
|
||||
import { ConfirmationService, MessageService } from 'primeng/api';
|
||||
import { HotelBookingSearchComponent } from './hotel-booking-search/hotel-booking-search.component';
|
||||
import { HotelBookingComponent } from './hotel-booking.component';
|
||||
import { InputNumberModule } from 'primeng/inputnumber';
|
||||
import { TreeModule } from 'primeng/tree';
|
||||
import { RatingModule } from 'primeng/rating';
|
||||
import { HotelBookingViewComponent } from './hotel-booking-view/hotel-booking-view.component';
|
||||
import { TabViewModule } from 'primeng/tabview';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { HotelBookingManagementService } from 'src/app/core/services/HotelServices/hotel_booking_management.service';
|
||||
//
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: 'Search',
|
||||
component: HotelBookingSearchComponent,
|
||||
},
|
||||
{
|
||||
path: 'View',
|
||||
component: HotelBookingViewComponent,
|
||||
},
|
||||
{
|
||||
path: '',
|
||||
pathMatch: 'full',
|
||||
redirectTo: 'Search',
|
||||
},
|
||||
];
|
||||
@NgModule({
|
||||
declarations: [HotelBookingComponent, HotelBookingSearchComponent,HotelBookingViewComponent],
|
||||
imports: [
|
||||
CommonModule,
|
||||
NgSelectModule,
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
CalendarModule,
|
||||
InputTextModule,
|
||||
InputNumberModule,
|
||||
TreeModule,
|
||||
RatingModule,
|
||||
ButtonModule,
|
||||
ToolbarModule,
|
||||
InputMaskModule,
|
||||
MatCheckboxModule,
|
||||
TableModule,
|
||||
// angular material
|
||||
DialogModule,
|
||||
RippleModule,
|
||||
ToastModule,
|
||||
TabViewModule,
|
||||
MatMenuModule,
|
||||
MatTabsModule,
|
||||
MatButtonModule,
|
||||
RouterModule.forChild(routes),
|
||||
],
|
||||
providers: [ MessageService, ConfirmationService, HotelBookingManagementService],
|
||||
})
|
||||
export class HotelBookingModule {}
|
||||
@@ -0,0 +1,20 @@
|
||||
<ul class="submenu submenu2">
|
||||
<li *ngFor="let item of menuItems"
|
||||
[ngClass]="{'parent-menu-active' : item.expanded && item.items, 'SidebarMenulink': item.expanded && !item.items}">
|
||||
<a *ngIf="!item.items" [routerLink]="item.routerLink"
|
||||
(click)="isMobile ? checkSidebar.SideBar('IsActive') : ''">
|
||||
<i *ngIf="item.icon" class="{{ item.icon }}"></i>
|
||||
<span>{{ item.label }}</span>
|
||||
</a>
|
||||
<div *ngIf="item.items">
|
||||
<a (click)="toggleSubMenu(item)">
|
||||
<i *ngIf="item.icon" class="{{ item.icon }}"></i>
|
||||
<span>{{ item.label }}</span>
|
||||
<i class="pi" [class.pi-chevron-down]="!item.expanded" [class.pi-chevron-up]="item.expanded"></i>
|
||||
</a>
|
||||
<ul class="submenu" [@submenuAnimation]="item.expanded ? 'open' : 'closed'">
|
||||
<custom-sidebar-item [menuItems]="item.items" [isMobile]="isMobile"></custom-sidebar-item>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -0,0 +1,38 @@
|
||||
import { trigger, state, style, transition, animate } from '@angular/animations';
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { ActiveSidebarService } from 'src/app/core/services/active-sidebar.service';
|
||||
|
||||
@Component({
|
||||
selector: 'custom-sidebar-item',
|
||||
templateUrl: './custom-sidebar-item.component.html',
|
||||
animations: [
|
||||
trigger('submenuAnimation', [
|
||||
state('closed', style({
|
||||
height: '0px',
|
||||
opacity: 0,
|
||||
overflow: 'hidden',
|
||||
})),
|
||||
state('open', style({
|
||||
height: '*',
|
||||
opacity: 1,
|
||||
overflow: 'hidden',
|
||||
})),
|
||||
transition('closed => open', [
|
||||
animate('300ms ease-in-out')
|
||||
]),
|
||||
transition('open => closed', [
|
||||
animate('200ms ease-in-out')
|
||||
])
|
||||
])
|
||||
]
|
||||
})
|
||||
export class CustomSidebarItemComponent {
|
||||
@Input() menuItems: any[] = []; // Input for the nested menu items
|
||||
@Input() isMobile: boolean = false; // Input for the nested menu items
|
||||
|
||||
constructor(public checkSidebar: ActiveSidebarService) { }
|
||||
|
||||
toggleSubMenu(item: any) {
|
||||
item.expanded = !item.expanded; // Toggle the 'isOpen' property
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<div *ngIf="!MobileBreakpoints.checkMob()" class="ng-aside-brand"
|
||||
[ngClass]="{'ng-asidebar-active': ChcekSidebar.activeSide == 'IsActive', 'ng-asidebar-inactive': ChcekSidebar.activeSide != 'IsActive'}">
|
||||
<div class="ng-brand-logo" [ngStyle]="{'height.px': headerHeight}">
|
||||
<img class="aside-logo" [src]="commonF.logo" #logoImage (load)="adjustHeaderSize()" />
|
||||
</div>
|
||||
<div class="ng-asideToggle" (click)="ChcekSidebar.SideBar('IsActive')">
|
||||
<span>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24px" height="24px"
|
||||
viewBox="0 0 24 24" version="1.1" class="kt-svg-icon">
|
||||
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<polygon points="0 0 24 0 24 24 0 24"></polygon>
|
||||
<path
|
||||
d="M5.29288961,6.70710318 C4.90236532,6.31657888 4.90236532,5.68341391 5.29288961,5.29288961 C5.68341391,4.90236532 6.31657888,4.90236532 6.70710318,5.29288961 L12.7071032,11.2928896 C13.0856821,11.6714686 13.0989277,12.281055 12.7371505,12.675721 L7.23715054,18.675721 C6.86395813,19.08284 6.23139076,19.1103429 5.82427177,18.7371505 C5.41715278,18.3639581 5.38964985,17.7313908 5.76284226,17.3242718 L10.6158586,12.0300721 L5.29288961,6.70710318 Z"
|
||||
fill="var(--primary-theme)" fill-rule="nonzero"
|
||||
transform="translate(8.999997, 11.999999) scale(-1, 1) translate(-8.999997, -11.999999) "></path>
|
||||
<path
|
||||
d="M10.7071009,15.7071068 C10.3165766,16.0976311 9.68341162,16.0976311 9.29288733,15.7071068 C8.90236304,15.3165825 8.90236304,14.6834175 9.29288733,14.2928932 L15.2928873,8.29289322 C15.6714663,7.91431428 16.2810527,7.90106866 16.6757187,8.26284586 L22.6757187,13.7628459 C23.0828377,14.1360383 23.1103407,14.7686056 22.7371482,15.1757246 C22.3639558,15.5828436 21.7313885,15.6103465 21.3242695,15.2371541 L16.0300699,10.3841378 L10.7071009,15.7071068 Z"
|
||||
fill="var(--primary-theme)" fill-rule="nonzero" opacity="0.3"
|
||||
transform="translate(15.999997, 11.999999) scale(-1, 1) rotate(-270.000000) translate(-15.999997, -11.999999) ">
|
||||
</path>
|
||||
</g>
|
||||
</svg>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ng-AsideBar"
|
||||
[ngClass]="{'ng-asidebar-active': ChcekSidebar.activeSide == 'IsActive', 'DvSide': ChcekSidebar.activeSide != 'IsActive'}">
|
||||
<ul class="menu">
|
||||
<li *ngFor="let item of asideItems" class="p-panelmenu-panel" [ngClass]="{'parent-menu-active' : item.expanded}">
|
||||
<a *ngIf="!item.items" [routerLink]="item.routerLink" (click)="isMobile ? ChcekSidebar.SideBar('IsActive') : ''">
|
||||
<img class="asidebarIcons" *ngIf="item.icon" [src]="commonF.environmentObj.cdnBaseUrl + item.icon" alt="">
|
||||
<!-- <p *ngIf="" class="{{ item.icon }}"></p> -->
|
||||
<span>{{ item.label }}</span>
|
||||
</a>
|
||||
<div *ngIf="item.items">
|
||||
<a (click)="toggleSubMenu(item)">
|
||||
<img class="asidebarIcons" *ngIf="item.icon" [src]="commonF.environmentObj.cdnBaseUrl + item.icon" alt="">
|
||||
<!-- <p *ngIf="" class="{{ item.icon }}"></p> -->
|
||||
<span>{{ item.label }}</span>
|
||||
<i class="pi" [class.pi-chevron-down]="!item.expanded" [class.pi-chevron-up]="item.expanded"></i>
|
||||
</a>
|
||||
<ul class="submenu" [@submenuAnimation]="item.expanded ? 'open' : 'closed'">
|
||||
<custom-sidebar-item [menuItems]="item.items" [isMobile]="isMobile"></custom-sidebar-item>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -0,0 +1,212 @@
|
||||
import { ChangeDetectorRef, Component, ElementRef, Renderer2, ViewChild } from '@angular/core';
|
||||
import { CommonFunctionService } from 'src/app/core/common/common-function.service';
|
||||
import { ActiveSidebarService } from 'src/app/core/services/active-sidebar.service';
|
||||
import { API } from 'src/app/core/services/api.service';
|
||||
import { BreakpointsService } from 'src/app/core/services/breakpoints.services';
|
||||
import { MenuItem } from 'primeng/api';
|
||||
import { securityFunctions } from 'src/app/core/common/security';
|
||||
import { trigger, state, style, transition, animate } from '@angular/animations';
|
||||
import { filter } from 'rxjs';
|
||||
import { NavigationEnd, Router } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'custom-sidebar',
|
||||
templateUrl: './custom-sidebar.component.html',
|
||||
animations: [
|
||||
trigger('submenuAnimation', [
|
||||
state('closed', style({
|
||||
height: '0px',
|
||||
opacity: 0,
|
||||
overflow: 'hidden',
|
||||
})),
|
||||
state('open', style({
|
||||
height: '*',
|
||||
opacity: 1,
|
||||
overflow: 'hidden',
|
||||
})),
|
||||
transition('closed => open', [
|
||||
animate('300ms ease-in-out')
|
||||
]),
|
||||
transition('open => closed', [
|
||||
animate('200ms ease-in-out')
|
||||
])
|
||||
])
|
||||
]
|
||||
})
|
||||
export class CustomSidebarComponent {
|
||||
@ViewChild('logoImage') logoImage: ElementRef<HTMLImageElement>;
|
||||
flag: boolean = true;
|
||||
// mobile resposive start
|
||||
isMobile = false;
|
||||
// mobile resposive end
|
||||
constructor(
|
||||
public ChcekSidebar: ActiveSidebarService,
|
||||
public MobileBreakpoints: BreakpointsService,
|
||||
private cd: ChangeDetectorRef, // mobile resposive end,
|
||||
private ApiSer: API,
|
||||
public commonF: CommonFunctionService,
|
||||
private renderer: Renderer2,
|
||||
public router: Router
|
||||
) {
|
||||
// mobile resposive start
|
||||
this.MobileBreakpoints.IsMobile.subscribe({
|
||||
next: (val) => {
|
||||
this.isMobile = val;
|
||||
},
|
||||
});
|
||||
// mobile resposive end
|
||||
}
|
||||
|
||||
asideItems!: MenuItem[];
|
||||
ngOnInit(): void {
|
||||
this.isMobile == true
|
||||
? (this.ChcekSidebar.activeSide = '')
|
||||
: (this.ChcekSidebar.activeSide = 'IsActive');
|
||||
this.getMenus().subscribe(res => {
|
||||
if (res) {
|
||||
this.commonF.CheckActiveTabMenus(res);
|
||||
this.BindMenu(res);
|
||||
const currentUrl = this.router.url;
|
||||
this.expandAndActivateRecursive(this.asideItems, currentUrl, true);
|
||||
}
|
||||
})
|
||||
this.router.events
|
||||
.pipe(filter(event => event instanceof NavigationEnd)) // Filter to get NavigationEnd event
|
||||
.subscribe((data) => {
|
||||
this.resetMenuItems(this.asideItems);
|
||||
// this.expandAndActivateRecursive(this.asideItems, this.router.url, true);
|
||||
});
|
||||
this.cd.detectChanges();
|
||||
|
||||
}
|
||||
getMenuss() {
|
||||
let LoginUserData = securityFunctions.getSessionStorage('LoginUserData') ? JSON.parse(securityFunctions.getSessionStorage('LoginUserData')) : null;
|
||||
return this.ApiSer.AdminGet(`/MenuMasterNew/GetMenuMasterNewsByOrgId/2405170833594899108/${LoginUserData.user_id}`)
|
||||
}
|
||||
getMenus() {
|
||||
let LoginUserData = securityFunctions.getSessionStorage('LoginUserData') ? JSON.parse(securityFunctions.getSessionStorage('LoginUserData')) : null;
|
||||
return this.ApiSer.AdminGet('/MenuMasterNew/GetAllMenuByUserId/' + LoginUserData.user_id + '/2405170833594899108')
|
||||
}
|
||||
BindMenu(list) {
|
||||
let aisemenu = [];
|
||||
let FliterList = list.sort(function (a, b) { return a.sequence - b.sequence; });
|
||||
let AllParentlist = list.filter(e => e.parent_id == '');
|
||||
AllParentlist.forEach(e => {
|
||||
if (e.menu_type == '2305170833594899101' && !e.is_tab_wise_menu) {
|
||||
aisemenu.push({
|
||||
label: e.menu_name,
|
||||
icon: e.ng_icon == null ? 'pi pi-fw pi-pencil' : '' + e.ng_icon,
|
||||
items: []
|
||||
});
|
||||
} else if (!e.is_hide_in_side_menu) {
|
||||
aisemenu.push({ label: e.menu_name, icon: ' ', page_data: e.page_data ? JSON.parse(e.page_data) : [], routerLink: '/' + e.ui_controller + '/' + e.ui_action, command: (event) => { this.isMobile ? this.ChcekSidebar.SideBar('IsActive') : '' } });
|
||||
}
|
||||
let index = aisemenu.length - 1;
|
||||
let submenu = FliterList.filter(s => s.parent_id == e.menu_id);
|
||||
if (submenu.length > 0) {
|
||||
this.subMenu(aisemenu[index], submenu, FliterList);
|
||||
}
|
||||
});
|
||||
this.asideItems = aisemenu;
|
||||
};
|
||||
|
||||
subMenu(menu, FilterSubmenu, Allmenu) {
|
||||
if (FilterSubmenu.length > 0) {
|
||||
FilterSubmenu.forEach(e => {
|
||||
if (e.menu_type == '2305170833594899101' && !e.is_tab_wise_menu) {
|
||||
menu.items.push({
|
||||
label: e.menu_name,
|
||||
icon: 'pi pi-fw pi-pencil',
|
||||
items: []
|
||||
});
|
||||
} else if (!e.is_hide_in_side_menu) {
|
||||
menu.items.push(
|
||||
{ label: e.menu_name, icon: ' ', page_data: e.page_data ? JSON.parse(e.page_data) : [], routerLink: '/' + e.ui_controller + '/' + e.ui_action, command: (event) => { this.isMobile ? this.ChcekSidebar.SideBar('IsActive') : '' } }
|
||||
);
|
||||
}
|
||||
let index = menu.items.length - 1;
|
||||
let submenu = Allmenu.filter(a => a.parent_id == e.menu_id && !e.is_tab_wise_menu);
|
||||
if (submenu.length > 0) {
|
||||
this.subMenu(menu.items[index], submenu, Allmenu);
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
headerHeight; // Default height
|
||||
isHeightSet: boolean = false; // Flag to check if actual height is set
|
||||
adjustHeaderSize() {
|
||||
requestAnimationFrame(() => {
|
||||
this.headerHeight = this.commonF.getHeaderSize(this.logoImage);
|
||||
if (this.headerHeight > 0) { // Check if the height is valid
|
||||
this.isHeightSet = true;
|
||||
}
|
||||
this.cd.detectChanges(); // Trigger change detection
|
||||
});
|
||||
}
|
||||
|
||||
toggleSubMenu(selectedItem: any) {
|
||||
this.asideItems.forEach(item => item.expanded = item.label === selectedItem.label ? !item.expanded : false);
|
||||
}
|
||||
|
||||
private expandAndActivateRecursive(items: MenuItem[], targetUrl: string, isBeforeActive: boolean = true): boolean {
|
||||
let menu = true;
|
||||
if (items) {
|
||||
for (const [i, item] of items.entries()) {
|
||||
if (item.routerLink) {
|
||||
if (item['page_data'].some(z => targetUrl.includes(z.page_url.replaceAll('/$', '')))) {
|
||||
item.expanded = true;
|
||||
item.styleClass = 'SidebarMenulink';
|
||||
menu = false;
|
||||
for (let ind = i + 1; ind < items.length; ind++) {
|
||||
if (items[ind].items) {
|
||||
items[ind].items.forEach(sub_item => sub_item.styleClass = '')
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} else if (item.items) {
|
||||
if (this.expandAndActivateRecursive(item.items, targetUrl, isBeforeActive)) {
|
||||
item.expanded = true;
|
||||
item.styleClass = 'parent-menu-active';
|
||||
for (let ind = i + 1; ind < items.length; ind++) {
|
||||
if (items[ind].items) {
|
||||
items[ind].items.forEach(sub_item => sub_item.styleClass = '')
|
||||
}
|
||||
}
|
||||
// this.RemoveSubmenuActive(items,index+1);
|
||||
return true;
|
||||
} else {
|
||||
item.styleClass = '';
|
||||
}
|
||||
}
|
||||
if (menu) {
|
||||
item.styleClass = 'submenu-before-active';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Get the active panel (the expanded one)
|
||||
const activePanel = document.querySelector('.menu');
|
||||
const selected_panel = activePanel.querySelector('.active-panel')
|
||||
selected_panel?.classList.remove("active-panel")
|
||||
const panel = activePanel.querySelector('.p-highlight')?.closest('.p-panelmenu-panel');
|
||||
|
||||
// Add 'active-panel' class to the currently active panel
|
||||
if (panel) {
|
||||
this.renderer.addClass(panel, 'active-panel');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private resetMenuItems(items: MenuItem[]) {
|
||||
if (items) {
|
||||
for (const [index, item] of items.entries()) {
|
||||
item.expanded = false;
|
||||
item.expanded = false; // Reset expanded state
|
||||
item.styleClass = ''; // Clear any existing style classes
|
||||
if (item.items) {
|
||||
this.resetMenuItems(item.items); // Recursively reset child items
|
||||
}
|
||||
}
|
||||
this.expandAndActivateRecursive(items, this.router.url, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
7
src/app/modules/common/footer/footer.component.html
Normal file
7
src/app/modules/common/footer/footer.component.html
Normal file
@@ -0,0 +1,7 @@
|
||||
<div class="ng-footer">
|
||||
<div class="ng-footerBody">
|
||||
<div>
|
||||
<p class="ng-footerCopy">©{{date}} {{venderGroupName}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
24
src/app/modules/common/footer/footer.component.ts
Normal file
24
src/app/modules/common/footer/footer.component.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Component } from "@angular/core";
|
||||
import * as moment from "moment";
|
||||
import { securityFunctions } from "src/app/core/common/security";
|
||||
|
||||
@Component({
|
||||
templateUrl: './footer.component.html',
|
||||
selector: 'app-footer'
|
||||
})
|
||||
export class FooterComponent {
|
||||
date;
|
||||
venderGroupName = '';
|
||||
ngOnInit(): void {
|
||||
this.getyear();
|
||||
}
|
||||
agencyData
|
||||
getyear() {
|
||||
const d = new Date();
|
||||
this.date = moment(d).format('YYYY');
|
||||
this.agencyData = securityFunctions.getSessionStorage('VData');
|
||||
if (this.agencyData) {
|
||||
this.venderGroupName = JSON.parse(this.agencyData).vendor_group_name;
|
||||
}
|
||||
};
|
||||
}
|
||||
119
src/app/modules/common/header/header.component.html
Normal file
119
src/app/modules/common/header/header.component.html
Normal file
@@ -0,0 +1,119 @@
|
||||
<div class="headerWrapper">
|
||||
<!-- <div class="header-bar" [ngStyle]="{'height.px': headerHeight}" [ngClass]="{'logo': ChcekSidebar.activeSide == 'IsActive'}" *ngIf="MobileHide">
|
||||
<img [src]="commonF.logo" />
|
||||
</div> -->
|
||||
<div class="d-flex align-items-center h-100" *ngIf="MobileShow">
|
||||
<button class="MenuBtn" *ngIf="ChcekSidebar.activeSide != 'IsActive'"
|
||||
(click)="ChcekSidebar.SideBar('IsActive')"><span class="material-icons">
|
||||
menu </span>
|
||||
</button>
|
||||
<button class="MenuBtn" *ngIf="ChcekSidebar.activeSide =='IsActive'" (click)="ChcekSidebar.SideBar('IsActive')">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="26" viewBox="0 -960 960 960" width="26">
|
||||
<path d="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z">
|
||||
</path>
|
||||
</svg>
|
||||
</button>
|
||||
<img [src]="orgLogo" />
|
||||
</div>
|
||||
<div class="MobIcon_wrapper" *ngIf="MobileShow">
|
||||
<div class="User_loginDetailMob" *ngIf="ChcekSidebar.activeSide != 'IsActive'"
|
||||
[ngClass]="{'loginDetailMob_Toggle':topBarMenu}" (click)="topBar()">
|
||||
<button class="btn-icon">
|
||||
<span class="profile-svg">
|
||||
<svg width="24px" height="24px" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg" fill="#fff"
|
||||
class="active">
|
||||
<title>ionicons-v5-j</title>
|
||||
<path
|
||||
d="M332.64,64.58C313.18,43.57,286,32,256,32c-30.16,0-57.43,11.5-76.8,32.38-19.58,21.11-29.12,49.8-26.88,80.78C156.76,206.28,203.27,256,256,256s99.16-49.71,103.67-110.82C361.94,114.48,352.34,85.85,332.64,64.58Z">
|
||||
</path>
|
||||
<path
|
||||
d="M432,480H80A31,31,0,0,1,55.8,468.87c-6.5-7.77-9.12-18.38-7.18-29.11C57.06,392.94,83.4,353.61,124.8,326c36.78-24.51,83.37-38,131.2-38s94.42,13.5,131.2,38c41.4,27.6,67.74,66.93,76.18,113.75,1.94,10.73-.68,21.34-7.18,29.11A31,31,0,0,1,432,480Z">
|
||||
</path>
|
||||
</svg>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="User_DetalWrapper" *ngIf="topBarMenu">
|
||||
<div class="">
|
||||
<div class="logout_DropdownLinks">
|
||||
<div class="links_Item">
|
||||
<span class="self-center">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" viewBox="0 0 19 19" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M5.54651 1C5.87403 1 6.13954 1.26551 6.13954 1.59302V2.1961C6.663 2.18604 7.23971 2.18604 7.87399 2.18605H11.126C11.7603 2.18604 12.337 2.18604 12.8605 2.1961V1.59302C12.8605 1.26551 13.126 1 13.4535 1C13.781 1 14.0465 1.26551 14.0465 1.59302V2.247C14.252 2.26267 14.4467 2.28237 14.6308 2.30713C15.5579 2.43176 16.3082 2.69437 16.9 3.2861C17.4917 3.87783 17.7543 4.62816 17.8789 5.55519C17.9187 5.85146 17.9454 6.17479 17.9634 6.52703C17.9871 6.59107 18 6.6603 18 6.73256C18 6.78737 17.9926 6.84044 17.9787 6.89082C18 7.52492 18 8.245 18 9.06006V10.686C18 11.0136 17.7345 11.2791 17.407 11.2791C17.0795 11.2791 16.814 11.0136 16.814 10.686V9.10465C16.814 8.4294 16.8137 7.84167 16.8036 7.32558H2.1964C2.1863 7.84167 2.18605 8.4294 2.18605 9.10465V10.686C2.18605 12.1937 2.1873 13.2649 2.29655 14.0775C2.4035 14.8729 2.60408 15.3313 2.93871 15.6659C3.27334 16.0006 3.73167 16.2012 4.52718 16.3081C5.33975 16.4173 6.41089 16.4186 7.9186 16.4186H11.0814C11.4089 16.4186 11.6744 16.6841 11.6744 17.0116C11.6744 17.3391 11.4089 17.6047 11.0814 17.6047H7.874C6.42089 17.6047 5.26992 17.6047 4.36915 17.4836C3.44212 17.3589 2.69179 17.0963 2.10005 16.5046C1.50832 15.9129 1.24572 15.1625 1.12109 14.2355C0.999977 13.3347 0.999985 12.1838 1 10.7306V9.06006C0.999992 8.24493 0.999985 7.52492 1.02136 6.89083C1.00744 6.84045 1 6.78737 1 6.73256C1 6.6603 1.01292 6.59106 1.03659 6.52702C1.05452 6.17478 1.08125 5.85145 1.12109 5.55519C1.24572 4.62816 1.50832 3.87783 2.10005 3.2861C2.69179 2.69437 3.44212 2.43176 4.36915 2.30713C4.55332 2.28237 4.74795 2.26267 4.95349 2.247V1.59302C4.95349 1.26551 5.219 1 5.54651 1ZM2.25063 6.13954H16.7494C16.7367 5.98978 16.7215 5.84795 16.7034 5.71323C16.5965 4.91772 16.3959 4.45939 16.0613 4.12476C15.7267 3.79013 15.2683 3.58955 14.4729 3.4826C13.6603 3.37335 12.5891 3.37209 11.0814 3.37209H7.9186C6.41089 3.37209 5.33975 3.37335 4.52718 3.4826C3.73167 3.58955 3.27334 3.79013 2.93871 4.12476C2.60408 4.45939 2.4035 4.91772 2.29655 5.71323C2.27844 5.84795 2.2633 5.98978 2.25063 6.13954Z" fill="#1C274C"></path><path d="M14.8768 13.225V14.7186H13.9806M17.5651 14.7186C17.5651 16.2033 16.3615 17.407 14.8768 17.407C13.392 17.407 12.1884 16.2033 12.1884 14.7186C12.1884 13.2338 13.392 12.0302 14.8768 12.0302C16.3615 12.0302 17.5651 13.2338 17.5651 14.7186Z" stroke="#1C274C" stroke-width="0.7" stroke-linecap="round" stroke-linejoin="round"></path></svg>
|
||||
</span>
|
||||
<div class="LastLogin_links_Item">
|
||||
<span>Last login:</span>
|
||||
<span>{{lastLogin}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="links_Item" (click)="commonF.loginOut()">
|
||||
<span class="material-icons"> logout </span>
|
||||
<span>Log Out</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="UserDetail" *ngIf="MobileHide">
|
||||
<button mat-button class="ng-header-button" [matMenuTriggerFor]="menu">
|
||||
<div class="menu-dropdown">
|
||||
<span>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" focusable="false" color="inherit" fill="currentcolor"
|
||||
aria-hidden="true" role="presentation" viewBox="0 0 85 85" preserveAspectRatio="xMidYMid meet" size="35"
|
||||
width="35" height="35">
|
||||
<defs>
|
||||
<path id="a"
|
||||
d="M42.5 0C65.972 0 85 19.028 85 42.5S65.972 85 42.5 85 0 65.972 0 42.5 19.028 0 42.5 0zm-.09 7.352c-19.362 0-35.058 15.696-35.058 35.058 0 19.362 15.696 35.058 35.058 35.058 19.362 0 35.058-15.696 35.058-35.058 0-19.362-15.696-35.058-35.058-35.058z">
|
||||
</path>
|
||||
</defs>
|
||||
<g fill="none" fill-rule="evenodd">
|
||||
<use xmlns="http://www.w3.org/2000/svg" fill="#E7412A" opacity=".1"></use>
|
||||
<path fill="var(--primary-theme)" fill-rule="nonzero" stroke="var(--primary-theme)" stroke-width="1.063"
|
||||
d="M42.5 10.625c-17.578 0-31.875 14.297-31.875 31.875S24.922 74.375 42.5 74.375 74.375 60.078 74.375 42.5 60.078 10.625 42.5 10.625zm0 2.198c16.363 0 29.677 13.314 29.677 29.677S58.863 72.177 42.5 72.177 12.823 58.863 12.823 42.5 26.137 12.823 42.5 12.823zm-.48 4.405a25.368 25.368 0 00-17.394 7.394C19.852 29.401 17.22 35.746 17.22 42.5s2.627 13.1 7.402 17.878c.215.21.498.322.777.322a1.102 1.102 0 00.781-1.88 22.596 22.596 0 01-1.425-1.568c.013-.021.039-.038.051-.064 2.465-5.07 6.823-8.565 11.833-9.703 1.64 1.631 3.658 2.709 5.861 2.709s4.225-1.078 5.86-2.71c5.015 1.134 9.373 4.633 11.838 9.704.013.026.03.047.043.069a23.51 23.51 0 01-1.421 1.563 1.102 1.102 0 001.558 1.558c4.775-4.779 7.402-11.124 7.402-17.878s-2.627-13.1-7.402-17.878a26.468 26.468 0 00-2.301-2.04 1.105 1.105 0 00-1.546.19 1.093 1.093 0 00.19 1.54 23.724 23.724 0 012.099 1.868c4.362 4.358 6.762 10.155 6.762 16.32 0 4.633-1.357 9.055-3.881 12.816-2.64-4.843-6.883-8.286-11.782-9.708 1.533-2.245 2.473-4.993 2.473-7.505v-2.198c0-5.453-4.44-9.892-9.892-9.892-5.453 0-9.892 4.44-9.892 9.892v2.198c0 2.512.936 5.26 2.473 7.505-4.9 1.422-9.145 4.865-11.782 9.708-2.524-3.761-3.88-8.183-3.88-12.816 0-6.165 2.4-11.962 6.761-16.32 5.217-5.22 12.688-7.638 19.99-6.47a1.094 1.094 0 001.259-.91 1.102 1.102 0 00-.91-1.262 24.917 24.917 0 00-4.5-.31zm.48 10.983c4.242 0 7.694 3.452 7.694 7.694v2.198c0 4.363-3.624 9.893-7.694 9.893s-7.694-5.53-7.694-9.893v-2.198c0-4.242 3.452-7.694 7.694-7.694z">
|
||||
</path>
|
||||
<path
|
||||
d="M42.5 10.625c-17.578 0-31.875 14.297-31.875 31.875S24.922 74.375 42.5 74.375 74.375 60.078 74.375 42.5 60.078 10.625 42.5 10.625z">
|
||||
</path>
|
||||
<path
|
||||
d="M42.5 12.823c16.363 0 29.677 13.314 29.677 29.677S58.863 72.177 42.5 72.177 12.823 58.863 12.823 42.5 26.137 12.823 42.5 12.823z">
|
||||
</path>
|
||||
<path
|
||||
d="M42.019 17.228a25.368 25.368 0 00-17.393 7.394C19.852 29.401 17.22 35.746 17.22 42.5s2.627 13.1 7.402 17.878c.215.21.498.322.777.322a1.102 1.102 0 00.781-1.88 22.596 22.596 0 01-1.425-1.568c.013-.021.039-.038.051-.064 2.465-5.07 6.823-8.565 11.833-9.703 1.64 1.631 3.658 2.709 5.861 2.709s4.225-1.078 5.86-2.71c5.015 1.134 9.373 4.633 11.838 9.704.013.026.03.047.043.069a23.51 23.51 0 01-1.421 1.563 1.102 1.102 0 001.558 1.558c4.775-4.779 7.402-11.124 7.402-17.878s-2.627-13.1-7.402-17.878a26.468 26.468 0 00-2.301-2.04 1.105 1.105 0 00-1.546.19 1.093 1.093 0 00.19 1.54 23.724 23.724 0 012.099 1.868c4.362 4.358 6.762 10.155 6.762 16.32 0 4.633-1.357 9.055-3.881 12.816-2.64-4.843-6.883-8.286-11.782-9.708 1.533-2.245 2.473-4.993 2.473-7.505v-2.198c0-5.453-4.44-9.892-9.892-9.892-5.453 0-9.892 4.44-9.892 9.892v2.198c0 2.512.936 5.26 2.473 7.505-4.9 1.422-9.145 4.865-11.782 9.708-2.524-3.761-3.88-8.183-3.88-12.816 0-6.165 2.4-11.962 6.761-16.32 5.217-5.22 12.688-7.638 19.99-6.47a1.094 1.094 0 001.259-.91 1.102 1.102 0 00-.91-1.262 24.917 24.917 0 00-4.5-.31z">
|
||||
</path>
|
||||
<path
|
||||
d="M42.5 28.211c4.242 0 7.694 3.452 7.694 7.694v2.198c0 4.363-3.624 9.893-7.694 9.893s-7.694-5.53-7.694-9.893v-2.198c0-4.242 3.452-7.694 7.694-7.694z">
|
||||
</path>
|
||||
<path fill="var(--primary-theme)"
|
||||
d="M31.645 58.995a1.092 1.092 0 00-1.087.541l-1.1 1.906a1.097 1.097 0 001.898 1.099l1.1-1.906a1.097 1.097 0 00-.812-1.64zm21.158 0a1.1 1.1 0 00-.812 1.645l1.1 1.902a1.092 1.092 0 001.498.399c.528-.3.704-.975.399-1.499l-1.1-1.902a1.1 1.1 0 00-1.085-.545zm-16.281 2.143c-.421.06-.79.365-.91.807l-.567 2.125a1.098 1.098 0 002.124.567l.568-2.125a1.096 1.096 0 00-.773-1.344c-.15-.043-.3-.052-.442-.03zm11.403 0a1.029 1.029 0 00-.442.03 1.1 1.1 0 00-.777 1.344l.57 2.125c.134.49.576.816 1.061.816a1.1 1.1 0 001.065-1.383l-.567-2.125a1.108 1.108 0 00-.91-.807zm-5.702.721c-.605 0-1.099.494-1.099 1.099v2.198c0 .606.494 1.1 1.1 1.1a1.1 1.1 0 001.098-1.1v-2.198c0-.605-.493-1.1-1.099-1.1zm8.697-43.115a1.1 1.1 0 00-.34 2.13c.782.292 1.559.63 2.306 1.004a1.1 1.1 0 001.481-.485c.27-.54.052-1.202-.49-1.477-.82-.412-1.67-.781-2.528-1.103a1.138 1.138 0 00-.43-.069z">
|
||||
</path>
|
||||
</g>
|
||||
</svg>
|
||||
</span>
|
||||
<span>Hi, {{userName}}</span>
|
||||
<span class="material-icons"> arrow_drop_down </span>
|
||||
</div>
|
||||
</button>
|
||||
<mat-menu #menu="matMenu">
|
||||
<div class="logout_DropdownLinks">
|
||||
<div class="links_Item">
|
||||
<span class="self-center">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" viewBox="0 0 19 19" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M5.54651 1C5.87403 1 6.13954 1.26551 6.13954 1.59302V2.1961C6.663 2.18604 7.23971 2.18604 7.87399 2.18605H11.126C11.7603 2.18604 12.337 2.18604 12.8605 2.1961V1.59302C12.8605 1.26551 13.126 1 13.4535 1C13.781 1 14.0465 1.26551 14.0465 1.59302V2.247C14.252 2.26267 14.4467 2.28237 14.6308 2.30713C15.5579 2.43176 16.3082 2.69437 16.9 3.2861C17.4917 3.87783 17.7543 4.62816 17.8789 5.55519C17.9187 5.85146 17.9454 6.17479 17.9634 6.52703C17.9871 6.59107 18 6.6603 18 6.73256C18 6.78737 17.9926 6.84044 17.9787 6.89082C18 7.52492 18 8.245 18 9.06006V10.686C18 11.0136 17.7345 11.2791 17.407 11.2791C17.0795 11.2791 16.814 11.0136 16.814 10.686V9.10465C16.814 8.4294 16.8137 7.84167 16.8036 7.32558H2.1964C2.1863 7.84167 2.18605 8.4294 2.18605 9.10465V10.686C2.18605 12.1937 2.1873 13.2649 2.29655 14.0775C2.4035 14.8729 2.60408 15.3313 2.93871 15.6659C3.27334 16.0006 3.73167 16.2012 4.52718 16.3081C5.33975 16.4173 6.41089 16.4186 7.9186 16.4186H11.0814C11.4089 16.4186 11.6744 16.6841 11.6744 17.0116C11.6744 17.3391 11.4089 17.6047 11.0814 17.6047H7.874C6.42089 17.6047 5.26992 17.6047 4.36915 17.4836C3.44212 17.3589 2.69179 17.0963 2.10005 16.5046C1.50832 15.9129 1.24572 15.1625 1.12109 14.2355C0.999977 13.3347 0.999985 12.1838 1 10.7306V9.06006C0.999992 8.24493 0.999985 7.52492 1.02136 6.89083C1.00744 6.84045 1 6.78737 1 6.73256C1 6.6603 1.01292 6.59106 1.03659 6.52702C1.05452 6.17478 1.08125 5.85145 1.12109 5.55519C1.24572 4.62816 1.50832 3.87783 2.10005 3.2861C2.69179 2.69437 3.44212 2.43176 4.36915 2.30713C4.55332 2.28237 4.74795 2.26267 4.95349 2.247V1.59302C4.95349 1.26551 5.219 1 5.54651 1ZM2.25063 6.13954H16.7494C16.7367 5.98978 16.7215 5.84795 16.7034 5.71323C16.5965 4.91772 16.3959 4.45939 16.0613 4.12476C15.7267 3.79013 15.2683 3.58955 14.4729 3.4826C13.6603 3.37335 12.5891 3.37209 11.0814 3.37209H7.9186C6.41089 3.37209 5.33975 3.37335 4.52718 3.4826C3.73167 3.58955 3.27334 3.79013 2.93871 4.12476C2.60408 4.45939 2.4035 4.91772 2.29655 5.71323C2.27844 5.84795 2.2633 5.98978 2.25063 6.13954Z" fill="#1C274C"></path><path d="M14.8768 13.225V14.7186H13.9806M17.5651 14.7186C17.5651 16.2033 16.3615 17.407 14.8768 17.407C13.392 17.407 12.1884 16.2033 12.1884 14.7186C12.1884 13.2338 13.392 12.0302 14.8768 12.0302C16.3615 12.0302 17.5651 13.2338 17.5651 14.7186Z" stroke="#1C274C" stroke-width="0.7" stroke-linecap="round" stroke-linejoin="round"></path></svg>
|
||||
</span>
|
||||
<div class="LastLogin_links_Item">
|
||||
<span>Last login:</span>
|
||||
<span>{{lastLogin}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="links_Item" (click)="commonF.loginOut()">
|
||||
<span class="self-center">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">
|
||||
<path opacity="0.978" fill-rule="evenodd" clip-rule="evenodd" d="M2.02953 0.0020799C3.94819 -0.00346636 5.86679 0.0020799 7.78539 0.0187153C8.01785 0.1121 8.12875 0.284001 8.1181 0.534414C8.11391 0.843717 7.95863 1.02671 7.65231 1.08338C5.82241 1.09447 3.99251 1.10557 2.16261 1.11666C1.49815 1.30426 1.13772 1.74232 1.0813 2.43086C1.05912 6.02411 1.05912 9.61737 1.0813 13.2106C1.13772 13.8992 1.49815 14.3372 2.16261 14.5248C4.04947 14.5254 5.9348 14.5476 7.81866 14.5914C8.11544 14.7808 8.19862 15.0415 8.06819 15.3732C8.01829 15.4675 7.94619 15.5396 7.85193 15.5895C6.87796 15.6279 5.90202 15.6446 4.92409 15.6394C3.91379 15.6442 2.90455 15.6275 1.89644 15.5895C0.871665 15.3078 0.245064 14.6479 0.0166363 13.6099C-0.00554543 9.75045 -0.00554543 5.89103 0.0166363 2.0316C0.272187 0.938749 0.943151 0.262242 2.02953 0.0020799Z" fill="#1C274C"/>
|
||||
<path opacity="0.977" fill-rule="evenodd" clip-rule="evenodd" d="M11.6448 3.39572C11.7919 3.40737 11.925 3.45727 12.0441 3.54544C13.3139 4.81529 14.5837 6.08511 15.8536 7.35496C16.0593 7.68417 16.0483 8.00577 15.8203 8.31982C14.5616 9.57855 13.3028 10.8373 12.0441 12.0961C11.7276 12.2821 11.4448 12.2433 11.1957 11.9796C11.0878 11.7806 11.0878 11.5809 11.1957 11.3807C12.1993 10.3771 13.203 9.3734 14.2067 8.36972C11.0903 8.35864 7.97394 8.34753 4.85756 8.33645C4.50562 8.15689 4.41136 7.88516 4.57475 7.52131C4.65008 7.42373 4.74437 7.35163 4.85756 7.30505C7.97394 7.29397 11.0903 7.28286 14.2067 7.27178C13.203 6.2681 12.1993 5.26445 11.1957 4.26076C11.0218 3.79873 11.1715 3.51041 11.6448 3.39572Z" fill="#1C274C"/>
|
||||
</svg>
|
||||
</span>
|
||||
<span>Log Out</span>
|
||||
</div>
|
||||
</div>
|
||||
</mat-menu>
|
||||
</div>
|
||||
</div>
|
||||
127
src/app/modules/common/header/header.component.ts
Normal file
127
src/app/modules/common/header/header.component.ts
Normal file
@@ -0,0 +1,127 @@
|
||||
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
||||
import { ChangeDetectorRef, Component, ElementRef, OnInit, Renderer2, ViewChild } from '@angular/core';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
import { PrimeNGConfig } from 'primeng/api';
|
||||
import { Subject, takeUntil } from 'rxjs';
|
||||
import { CommonFunctionService } from 'src/app/core/common/common-function.service';
|
||||
import { ActiveSidebarService } from 'src/app/core/services/active-sidebar.service';
|
||||
import { API } from 'src/app/core/services/api.service';
|
||||
import { BreakpointsService } from 'src/app/core/services/breakpoints.services';
|
||||
|
||||
@Component({
|
||||
templateUrl: './header.component.html',
|
||||
selector: 'app-header',
|
||||
})
|
||||
export class HeaderComponent implements OnInit {
|
||||
@ViewChild('logoImage') logoImage: ElementRef<HTMLImageElement>;
|
||||
|
||||
isMobile!: boolean;
|
||||
destroyed = new Subject<void>();
|
||||
MobileShow = true;
|
||||
MobileHide = true;
|
||||
topBarMenu = false;
|
||||
activeAside;
|
||||
|
||||
constructor(
|
||||
public ChcekSidebar: ActiveSidebarService,
|
||||
// mobile resposive start
|
||||
breakpointObserver: BreakpointObserver,
|
||||
public MobileBreakpoints: BreakpointsService,
|
||||
private cd: ChangeDetectorRef,
|
||||
public commonF: CommonFunctionService,
|
||||
private ApiSer: API,
|
||||
private renderer: Renderer2,
|
||||
public titleService: Title
|
||||
// mobile resposive end
|
||||
) {
|
||||
// mobile resposive start
|
||||
this.MobileBreakpoints.IsMobile.subscribe({
|
||||
next: (val) => {
|
||||
this.isMobile = val;
|
||||
},
|
||||
});
|
||||
breakpointObserver.observe([Breakpoints.XSmall, Breakpoints.Small])
|
||||
.pipe(takeUntil(this.destroyed))
|
||||
.subscribe((result) => {
|
||||
if (
|
||||
result.breakpoints["(max-width: 599.98px)"] ||
|
||||
result.breakpoints["(min-width: 600px) and (max-width: 959.98px)"]
|
||||
) {
|
||||
this.isMobile = true;
|
||||
this.MobileShow = true;
|
||||
this.MobileHide = false;
|
||||
} else {
|
||||
this.isMobile = false;
|
||||
this.MobileShow = false;
|
||||
this.MobileHide = true;
|
||||
}
|
||||
});
|
||||
// mobile resposive end
|
||||
}
|
||||
|
||||
// topBar() {
|
||||
// this.ChcekSidebartopBarMenu = !this.topBarMenu;
|
||||
// }
|
||||
userName;
|
||||
lastLogin;
|
||||
ngOnInit(): void {
|
||||
this.userName = sessionStorage.getItem('userName')
|
||||
this.lastLogin = sessionStorage.getItem('lastLogin');
|
||||
this.isMobile == true
|
||||
? (this.ChcekSidebar.activeSide = '') : (this.ChcekSidebar.activeSide = 'IsActive'); this.cd.detectChanges();
|
||||
if (sessionStorage.getItem("logo")) {
|
||||
const favicon = document.getElementById('favIcon') as HTMLLinkElement;
|
||||
let res = JSON.parse(sessionStorage.getItem("logo"));
|
||||
if (res != null) if (res["logo"] != null) {
|
||||
this.orgLogo = res["logo"];
|
||||
this.commonF.logo = this.orgLogo
|
||||
sessionStorage.setItem("logo", JSON.stringify(res));
|
||||
this.titleService.setTitle('Inventory Management | ' + res.org_name)
|
||||
document.documentElement.style.setProperty('--primary-theme', res['primary_color']);
|
||||
document.documentElement.style.setProperty('--secondary-theme', res['secondary_color']);
|
||||
this.renderer.setAttribute(favicon, 'href', res['favicon'] ? res['favicon'] : './assets/images/TMC.svg');
|
||||
} else {
|
||||
this.orgLogo = "https://cdn-aos.b-cdn.net/Static/Email/TMC.svg";
|
||||
this.commonF.logo = this.orgLogo
|
||||
}
|
||||
} else {
|
||||
this.getLogo()
|
||||
}
|
||||
|
||||
}
|
||||
orgLogo
|
||||
getLogo() {
|
||||
const favicon = this.renderer.selectRootElement('link[rel="icon"]', true);
|
||||
this.ApiSer.AdminGet('/ForgotPassword/GetOrgLogo').subscribe((res) => {
|
||||
if (res != null) if (res["logo"] != null) {
|
||||
this.orgLogo = res["logo"];
|
||||
this.commonF.logo = this.orgLogo
|
||||
sessionStorage.setItem("logo", JSON.stringify(res));
|
||||
this.titleService.setTitle('Inventory Management | ' + res.org_name)
|
||||
document.documentElement.style.setProperty('--primary-theme', res['primary_color']);
|
||||
document.documentElement.style.setProperty('--secondary-theme', res['secondary_color']);
|
||||
this.renderer.setAttribute(favicon, 'href', res['favicon'] ? res['favicon'] : './assets/images/TMC.svg');
|
||||
} else {
|
||||
this.orgLogo = "https://cdn-aos.b-cdn.net/Static/Email/TMC.svg";
|
||||
this.commonF.logo = this.orgLogo
|
||||
}
|
||||
})
|
||||
}
|
||||
asideBar(ele) {
|
||||
this.activeAside = ele;
|
||||
}
|
||||
topBar() {
|
||||
this.topBarMenu = !this.topBarMenu;
|
||||
}
|
||||
headerHeight; // Default height
|
||||
isHeightSet: boolean = false; // Flag to check if actual height is set
|
||||
adjustHeaderSize() {
|
||||
requestAnimationFrame(() => {
|
||||
this.headerHeight = this.commonF.getHeaderSize(this.logoImage);
|
||||
if (this.headerHeight > 0) { // Check if the height is valid
|
||||
this.isHeightSet = true;
|
||||
}
|
||||
this.cd.detectChanges(); // Trigger change detection
|
||||
});
|
||||
}
|
||||
}
|
||||
37
src/app/modules/common/sidebar/sidebar.component.html
Normal file
37
src/app/modules/common/sidebar/sidebar.component.html
Normal file
@@ -0,0 +1,37 @@
|
||||
<div class="app-aside">
|
||||
<div>
|
||||
<div *ngIf="!MobileBreakpoints.checkMob()" class="ng-aside-brand" [ngClass]="{'ng-asidebar-active': ChcekSidebar.activeSide == 'IsActive', 'ng-asidebar-inactive': ChcekSidebar.activeSide != 'IsActive'}">
|
||||
<div class="ng-brand-logo" [ngStyle]="{'height.px': headerHeight}">
|
||||
<img class="aside-logo" [src]="commonF.logo" #logoImage (load)="adjustHeaderSize()" />
|
||||
</div>
|
||||
<div class="ng-asideToggle" (click)="ChcekSidebar.SideBar('IsActive')">
|
||||
<span>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24px" height="24px"
|
||||
viewBox="0 0 24 24" version="1.1" class="kt-svg-icon">
|
||||
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<polygon points="0 0 24 0 24 24 0 24"></polygon>
|
||||
<path
|
||||
d="M5.29288961,6.70710318 C4.90236532,6.31657888 4.90236532,5.68341391 5.29288961,5.29288961 C5.68341391,4.90236532 6.31657888,4.90236532 6.70710318,5.29288961 L12.7071032,11.2928896 C13.0856821,11.6714686 13.0989277,12.281055 12.7371505,12.675721 L7.23715054,18.675721 C6.86395813,19.08284 6.23139076,19.1103429 5.82427177,18.7371505 C5.41715278,18.3639581 5.38964985,17.7313908 5.76284226,17.3242718 L10.6158586,12.0300721 L5.29288961,6.70710318 Z"
|
||||
fill="var(--primary-theme)" fill-rule="nonzero"
|
||||
transform="translate(8.999997, 11.999999) scale(-1, 1) translate(-8.999997, -11.999999) "></path>
|
||||
<path
|
||||
d="M10.7071009,15.7071068 C10.3165766,16.0976311 9.68341162,16.0976311 9.29288733,15.7071068 C8.90236304,15.3165825 8.90236304,14.6834175 9.29288733,14.2928932 L15.2928873,8.29289322 C15.6714663,7.91431428 16.2810527,7.90106866 16.6757187,8.26284586 L22.6757187,13.7628459 C23.0828377,14.1360383 23.1103407,14.7686056 22.7371482,15.1757246 C22.3639558,15.5828436 21.7313885,15.6103465 21.3242695,15.2371541 L16.0300699,10.3841378 L10.7071009,15.7071068 Z"
|
||||
fill="var(--primary-theme)" fill-rule="nonzero" opacity="0.3"
|
||||
transform="translate(15.999997, 11.999999) scale(-1, 1) rotate(-270.000000) translate(-15.999997, -11.999999) ">
|
||||
</path>
|
||||
</g>
|
||||
</svg>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ng-asidebar MobSideBar" [ngClass]="{
|
||||
'ng-asidebar-active': ChcekSidebar.activeSide == 'IsActive'}">
|
||||
<p-panelMenu [multiple]="false" [model]="asideItems"> </p-panelMenu>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="Overlay" *ngIf="MobileBreakpoints.checkMob()" (click)="ChcekSidebar.SideBar('IsActive')"
|
||||
[ngClass]="{ show: ChcekSidebar.activeSide == 'IsActive' }"></div>
|
||||
<!-- MobileBreakpoints.checkMob() for mobile show -->
|
||||
<!-- !MobileBreakpoints.checkMob() for mobile Hide -->
|
||||
193
src/app/modules/common/sidebar/sidebar.component.ts
Normal file
193
src/app/modules/common/sidebar/sidebar.component.ts
Normal file
@@ -0,0 +1,193 @@
|
||||
import { ChangeDetectorRef, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { MenuItem } from 'primeng/api';
|
||||
import { ActiveSidebarService } from 'src/app/core/services/active-sidebar.service';
|
||||
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
||||
import { Subject, takeUntil } from 'rxjs';
|
||||
import { BreakpointsService } from 'src/app/core/services/breakpoints.services';
|
||||
import { API } from 'src/app/core/services/api.service';
|
||||
import { securityFunctions } from 'src/app/core/common/security';
|
||||
import { CommonFunctionService } from 'src/app/core/common/common-function.service';
|
||||
@Component({
|
||||
templateUrl: './sidebar.component.html',
|
||||
selector: 'side-bar',
|
||||
})
|
||||
export class SideBarComponent implements OnInit {
|
||||
@ViewChild('logoImage') logoImage: ElementRef<HTMLImageElement>;
|
||||
|
||||
router: any;
|
||||
flag: boolean = true;
|
||||
// mobile resposive start
|
||||
isMobile = false;
|
||||
// mobile resposive end
|
||||
constructor(
|
||||
public ChcekSidebar: ActiveSidebarService,
|
||||
public MobileBreakpoints: BreakpointsService,
|
||||
private cd: ChangeDetectorRef, // mobile resposive end,
|
||||
private ApiSer: API,
|
||||
public commonF: CommonFunctionService,
|
||||
) {
|
||||
// mobile resposive start
|
||||
this.MobileBreakpoints.IsMobile.subscribe({
|
||||
next: (val) => {
|
||||
this.isMobile = val;
|
||||
},
|
||||
});
|
||||
// mobile resposive end
|
||||
}
|
||||
|
||||
asideItems!: MenuItem[];
|
||||
ngOnInit(): void {
|
||||
|
||||
// this.asideItems = [
|
||||
// {
|
||||
// label: 'Bookings',
|
||||
// icon: 'pi pi-pw pi-file',
|
||||
// items: [
|
||||
// {
|
||||
// label: 'Search Hotel Booking',
|
||||
// icon: 'pi',
|
||||
// routerLink: '/BookingManagement/HotelBooking/Search',
|
||||
// },
|
||||
// {
|
||||
// label: 'Search Experience Booking',
|
||||
// icon: 'pi',
|
||||
// routerLink: '/BookingManagement/ExperienceBooking/Search',
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// {
|
||||
// label: 'Services',
|
||||
// icon: 'pi pi-fw pi-th-large',
|
||||
// items: [
|
||||
// {
|
||||
// label: 'Hotels',
|
||||
// icon: 'pi ',
|
||||
// routerLink: '/Services/HotelServices/Search',
|
||||
// },
|
||||
// {
|
||||
// label: 'Activity',
|
||||
// icon: 'pi ',
|
||||
// items: [
|
||||
// {
|
||||
// label: 'Experience',
|
||||
// icon: 'pi ',
|
||||
// routerLink: '/Services/ActivityServices/ExpServices/Search',
|
||||
// },
|
||||
// {
|
||||
// label: 'Hotel Zone',
|
||||
// icon: 'pi ',
|
||||
// routerLink: '/Services/ActivityServices/HotelZone/Search',
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// {
|
||||
// label: 'Flights',
|
||||
// icon: 'pi ',
|
||||
// routerLink: '/Services/FlightServices/Search',
|
||||
// },
|
||||
// {
|
||||
// label: 'Flight Inventory',
|
||||
// icon: 'pi ',
|
||||
// routerLink: '/Services/FlightInventory/Search',
|
||||
// },
|
||||
// {
|
||||
// label: 'Flight Inventory Report',
|
||||
// icon: 'pi ',
|
||||
// routerLink: 'Services/FlightInventoryReport/Search',
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// {
|
||||
// label: 'User Configuration',
|
||||
// icon: 'pi pi-fw pi-users',
|
||||
// items: [
|
||||
// {
|
||||
// label: 'Role Management',
|
||||
// icon: 'pi ',
|
||||
// routerLink: '/UserConfiguration/RoleManagement/Search',
|
||||
// },
|
||||
// {
|
||||
// label: 'User Management',
|
||||
// icon: 'pi ',
|
||||
// routerLink: '/UserConfiguration/UserManagement/Search',
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// ];
|
||||
this.isMobile == true
|
||||
? (this.ChcekSidebar.activeSide = '')
|
||||
: (this.ChcekSidebar.activeSide = 'IsActive');
|
||||
this.getMenus().subscribe(res => {
|
||||
if (res) {
|
||||
this.commonF.CheckActiveTabMenus(res);
|
||||
this.BindMenu(res);
|
||||
}
|
||||
})
|
||||
this.cd.detectChanges();
|
||||
|
||||
}
|
||||
getMenuss() {
|
||||
let LoginUserData = securityFunctions.getSessionStorage('LoginUserData') ? JSON.parse(securityFunctions.getSessionStorage('LoginUserData')) : null;
|
||||
return this.ApiSer.AdminGet(`/MenuMasterNew/GetMenuMasterNewsByOrgId/2405170833594899108/${LoginUserData.user_id}`)
|
||||
}
|
||||
getMenus() {
|
||||
let LoginUserData = securityFunctions.getSessionStorage('LoginUserData') ? JSON.parse(securityFunctions.getSessionStorage('LoginUserData')) : null;
|
||||
return this.ApiSer.AdminGet('/MenuMasterNew/GetAllMenuByUserId/' + LoginUserData.user_id + '/2405170833594899108')
|
||||
}
|
||||
BindMenu(list) {
|
||||
let aisemenu = [];
|
||||
let FliterList = list.sort(function (a, b) { return a.sequence - b.sequence; });
|
||||
let AllParentlist = list.filter(e => e.parent_id == '');
|
||||
AllParentlist.forEach(e => {
|
||||
if (e.menu_type == '2305170833594899101' && !e.is_tab_wise_menu) {
|
||||
aisemenu.push({
|
||||
label: e.menu_name,
|
||||
icon: e.ng_icon == null ? 'pi pi-fw pi-pencil' : 'pi pi-fw ' + e.ng_icon,
|
||||
items: []
|
||||
});
|
||||
} else if(!e.is_hide_in_side_menu){
|
||||
aisemenu.push({ label: e.menu_name, icon: ' ', routerLink: '/' + e.ui_controller + '/' + e.ui_action, command: (event) => { this.isMobile ? this.ChcekSidebar.SideBar('IsActive') : '' } });
|
||||
}
|
||||
let index = aisemenu.length - 1;
|
||||
let submenu = FliterList.filter(s => s.parent_id == e.menu_id);
|
||||
if (submenu.length > 0) {
|
||||
this.subMenu(aisemenu[index], submenu, FliterList);
|
||||
}
|
||||
});
|
||||
this.asideItems = aisemenu;
|
||||
};
|
||||
|
||||
subMenu(menu, FilterSubmenu, Allmenu) {
|
||||
if (FilterSubmenu.length > 0) {
|
||||
FilterSubmenu.forEach(e => {
|
||||
if (e.menu_type == '2305170833594899101' && !e.is_tab_wise_menu) {
|
||||
menu.items.push({
|
||||
label: e.menu_name,
|
||||
icon: 'pi pi-fw pi-pencil',
|
||||
items: []
|
||||
});
|
||||
} else if(!e.is_hide_in_side_menu){
|
||||
menu.items.push(
|
||||
{ label: e.menu_name, icon: ' ', routerLink: '/' + e.ui_controller + '/' + e.ui_action, command: (event) => { this.isMobile ? this.ChcekSidebar.SideBar('IsActive') : '' } }
|
||||
);
|
||||
}
|
||||
let index = menu.items.length - 1;
|
||||
let submenu = Allmenu.filter(a => a.parent_id == e.menu_id && !e.is_tab_wise_menu);
|
||||
if (submenu.length > 0) {
|
||||
this.subMenu(menu.items[index], submenu, Allmenu);
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
headerHeight; // Default height
|
||||
isHeightSet: boolean = false; // Flag to check if actual height is set
|
||||
adjustHeaderSize() {
|
||||
requestAnimationFrame(() => {
|
||||
this.headerHeight = this.commonF.getHeaderSize(this.logoImage);
|
||||
if (this.headerHeight > 0) { // Check if the height is valid
|
||||
this.isHeightSet = true;
|
||||
}
|
||||
this.cd.detectChanges(); // Trigger change detection
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,231 @@
|
||||
<div class="ng-backbtn mb-10">
|
||||
<a (click)="BackButton()">
|
||||
<svg class="ng-backsvg" fill="#000" focusable="false" viewBox="0 0 24 24" aria-hidden="true" role="presentation">
|
||||
<path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"></path>
|
||||
</svg>
|
||||
<span class="ng-backtext">Back</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="ng-card" [formGroup]="AddOnForm">
|
||||
<div class="ng-cardHead">
|
||||
<div class="ng-cardLabel">
|
||||
<h3 class="ng-cardTitle">Add Activity Add-On</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ng-searchBody">
|
||||
<div class="row">
|
||||
<!-- Add-On Name -->
|
||||
<div class="col-lg-4">
|
||||
<div class="formControlWrapper" [ngClass]="{ 'ErrorWrapper': validServ.onBlur(AddOnForm.controls['addOn'], 'required') }">
|
||||
<label class="formLabel">Add-On<small class="astrick">*</small></label>
|
||||
<input class="formInput" type="text" formControlName="addOn">
|
||||
<span class="errorspan" *ngIf="validServ.onBlur(AddOnForm.controls['addOn'], 'required')">
|
||||
Please enter add-on name
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Default Language -->
|
||||
<div class="col-lg-4">
|
||||
<div class="formControlWrapper" [ngClass]="{ 'ErrorWrapper': validServ.onBlur(AddOnForm.controls['defaultLanguageCode'], 'required') }">
|
||||
<label class="formLabel">Default Language<small class="astrick">*</small></label>
|
||||
<ng-select class="is-invalid" placeholder="Select" formControlName="defaultLanguageCode">
|
||||
<ng-template ng-header-tmp>
|
||||
<div class="temp_mobileBack">
|
||||
<div class="temp_mobileHead">
|
||||
<div class="temp_mobileTitle">
|
||||
<h4>Default Language</h4>
|
||||
</div>
|
||||
<button class="temp_mobileBackButton">
|
||||
<i class="material-icons">close</i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
<ng-option *ngFor="let lang of AllLang" [value]="lang.LanguageCode">
|
||||
{{ lang.LanguageName }}
|
||||
</ng-option>
|
||||
</ng-select>
|
||||
<span class="errorspan" *ngIf="validServ.onBlur(AddOnForm.controls['defaultLanguageCode'], 'required')">
|
||||
Please select default language
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Description -->
|
||||
<div class="col-lg-4">
|
||||
<div class="formControlWrapper">
|
||||
<label class="formLabel">Description</label>
|
||||
<textarea class="formInput" formControlName="description"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Add-On Image -->
|
||||
<div class="col-lg-4">
|
||||
<div class="customDropzone customMultiDropzone mb-20">
|
||||
<span class="formLabel mb-0">Add-On Image</span>
|
||||
<p-fileUpload #fileUpload name="demo[]" url="./upload.php" [showCancelButton]="false"
|
||||
[showUploadButton]="true" class="fileUploadElem" accept="image/jpeg,image/png"
|
||||
[maxFileSize]="1048576" invalidFileSizeMessageSummary="Maximum upload size is 1 Mb."
|
||||
(onSelect)="SelectImage($event, fileUpload, 'addonImage')">
|
||||
<ng-template pTemplate="toolbar">
|
||||
<div class="uploadReq">
|
||||
<span class="shortNote">
|
||||
<span>Note:</span> Upload JPEG/PNG under 1MB.
|
||||
</span>
|
||||
</div>
|
||||
</ng-template>
|
||||
</p-fileUpload>
|
||||
|
||||
<!-- Preview -->
|
||||
<div class="p-fileupload-files ng-star-inserted" *ngIf="AddOnForm.get('addonImageUrl').value">
|
||||
<div class="d-flex">
|
||||
<div class="p-fileupload-row">
|
||||
<div><img [src]="AddOnForm.get('addonImageUrl').value" width="50"></div>
|
||||
<div class="p-fileupload-filename">Preview</div>
|
||||
<div><button type="button" pButton icon="pi pi-times"
|
||||
(click)="RemoveImage()"></button></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Apply Rate On -->
|
||||
<div class="col-lg-4">
|
||||
<div class="formControlWrapper" [ngClass]="{ 'ErrorWrapper': validServ.onBlur(AddOnForm.controls['applyRateOn'], 'required') }">
|
||||
<label class="formLabel">Apply Rate On<small class="astrick">*</small></label>
|
||||
<ng-select class="is-invalid" placeholder="Select" formControlName="applyRateOn" (change)="HandleApplyRateOn($event)">
|
||||
<ng-template ng-header-tmp>
|
||||
<div class="temp_mobileBack">
|
||||
<div class="temp_mobileHead">
|
||||
<div class="temp_mobileTitle">
|
||||
<h4>Apply Rate On</h4>
|
||||
</div>
|
||||
<button class="temp_mobileBackButton">
|
||||
<i class="material-icons">close</i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
<ng-option value="">Select</ng-option>
|
||||
<ng-option *ngFor="let opt of applyRateOnList" [value]="opt.value">{{ opt.key }}</ng-option>
|
||||
</ng-select>
|
||||
<span class="errorspan" *ngIf="validServ.onBlur(AddOnForm.controls['applyRateOn'], 'required')">
|
||||
Please select apply rate option
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Currency -->
|
||||
<div class="col-lg-4">
|
||||
<div class="formControlWrapper" [ngClass]="{ 'ErrorWrapper': validServ.onBlur(AddOnForm.controls['currency'], 'required') }">
|
||||
<label class="formLabel">Currency<small class="astrick">*</small></label>
|
||||
<ng-select class="is-invalid" placeholder="Select" formControlName="currency">
|
||||
<ng-template ng-header-tmp>
|
||||
<div class="temp_mobileBack">
|
||||
<div class="temp_mobileHead">
|
||||
<div class="temp_mobileTitle">
|
||||
<h4>Currency</h4>
|
||||
</div>
|
||||
<button class="temp_mobileBackButton">
|
||||
<i class="material-icons">close</i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
<ng-option *ngFor="let curr of currencyList" [value]="curr.currency_code">{{ curr.currency_code }}</ng-option>
|
||||
</ng-select>
|
||||
<span class="errorspan" *ngIf="validServ.onBlur(AddOnForm.controls['currency'], 'required')">
|
||||
Please select currency
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Adult -->
|
||||
<div class="col-lg-4" *ngIf="AddOnForm.get('adult')">
|
||||
<div class="formControlWrapper" [ngClass]="{ 'ErrorWrapper': validServ.onBlur(AddOnForm.controls['adult'], 'required') }">
|
||||
<label class="formLabel">Adult<small class="astrick">*</small></label>
|
||||
<input class="formInput" type="text" formControlName="adult">
|
||||
<span class="errorspan" *ngIf="validServ.onBlur(AddOnForm.controls['adult'], 'required')">
|
||||
Please enter adult rate
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Child -->
|
||||
<div class="col-lg-4" *ngIf="AddOnForm.get('child')">
|
||||
<div class="formControlWrapper" [ngClass]="{ 'ErrorWrapper': validServ.onBlur(AddOnForm.controls['child'], 'required') }">
|
||||
<label class="formLabel">Child<small class="astrick">*</small></label>
|
||||
<input class="formInput" type="text" formControlName="child">
|
||||
<span class="errorspan" *ngIf="validServ.onBlur(AddOnForm.controls['child'], 'required')">
|
||||
Please enter child rate
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Youth -->
|
||||
<div class="col-lg-4" *ngIf="AddOnForm.get('youth')">
|
||||
<div class="formControlWrapper" [ngClass]="{ 'ErrorWrapper': validServ.onBlur(AddOnForm.controls['youth'], 'required') }">
|
||||
<label class="formLabel">Youth<small class="astrick">*</small></label>
|
||||
<input class="formInput" type="text" formControlName="youth">
|
||||
<span class="errorspan" *ngIf="validServ.onBlur(AddOnForm.controls['youth'], 'required')">
|
||||
Please enter youth rate
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Senior -->
|
||||
<div class="col-lg-4" *ngIf="AddOnForm.get('senior')">
|
||||
<div class="formControlWrapper" [ngClass]="{ 'ErrorWrapper': validServ.onBlur(AddOnForm.controls['senior'], 'required') }">
|
||||
<label class="formLabel">Senior<small class="astrick">*</small></label>
|
||||
<input class="formInput" type="text" formControlName="senior">
|
||||
<span class="errorspan" *ngIf="validServ.onBlur(AddOnForm.controls['senior'], 'required')">
|
||||
Please enter senior
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Amount -->
|
||||
<div class="col-lg-4" *ngIf="AddOnForm.get('amount')">
|
||||
<div class="formControlWrapper" [ngClass]="{ 'ErrorWrapper': validServ.onBlur(AddOnForm.controls['amount'], 'required') }">
|
||||
<label class="formLabel">Amount</label>
|
||||
<input class="formInput" type="text" formControlName="amount">
|
||||
<span class="errorspan" *ngIf="validServ.onBlur(AddOnForm.controls['senior'], 'required')">
|
||||
Please enter amount
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Vendor -->
|
||||
<div class="col-lg-4">
|
||||
<div class="formControlWrapper">
|
||||
<label class="formLabel">Vendor</label>
|
||||
<ng-select class="is-invalid" placeholder="Select" formControlName="activityAddonVendorId">
|
||||
<ng-template ng-header-tmp>
|
||||
<div class="temp_mobileBack">
|
||||
<div class="temp_mobileHead">
|
||||
<div class="temp_mobileTitle">
|
||||
<h4>Vendor</h4>
|
||||
</div>
|
||||
<button class="temp_mobileBackButton">
|
||||
<i class="material-icons">close</i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
<ng-option *ngFor="let data of vendorList" [value]="data.vehicleVendorId">{{data.vehicleVendorName}}</ng-option>
|
||||
</ng-select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ng-Cardfooter text-right">
|
||||
<button type="button" class="btn btn-primary" (click)="SaveUpdateAddOn()">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p-toast></p-toast>
|
||||
@@ -0,0 +1,244 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import * as moment from 'moment';
|
||||
import { of } from 'rxjs';
|
||||
import { CommonFunctionService } from 'src/app/core/common/common-function.service';
|
||||
import { ValidationService } from 'src/app/core/common/validation.service';
|
||||
import { API } from 'src/app/core/services/api.service';
|
||||
import { environment } from 'src/environments/environment';
|
||||
|
||||
@Component({
|
||||
selector: 'app-activity-add-on-add',
|
||||
templateUrl: './activity-add-on-add.component.html',
|
||||
})
|
||||
export class ActivityAddOnAddComponent {
|
||||
Edit_Id: string;
|
||||
AddOnForm: FormGroup;
|
||||
AllLang: any[] = [];
|
||||
currencyList: any[] = [];
|
||||
applyRateOnList = [
|
||||
{ key: 'Per Person', value: 'PERPERSON' },
|
||||
{ key: 'Per Service', value: 'PERSERVICE' },
|
||||
];
|
||||
vendorList: any[] = [];
|
||||
fileInfo = [];
|
||||
fileArr = [];
|
||||
editResp: any;
|
||||
|
||||
constructor(
|
||||
private fb: FormBuilder,
|
||||
public validServ: ValidationService,
|
||||
private apiserv: API,
|
||||
private commonMasterSer: CommonFunctionService,
|
||||
private router: Router,
|
||||
private activateRoute: ActivatedRoute
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.Edit_Id = this.activateRoute.snapshot.paramMap.get('RuleId') as string;
|
||||
this.initForm();
|
||||
this.getAllLanguages();
|
||||
this.getCurrencyList();
|
||||
this.getVendorList();
|
||||
if (this.Edit_Id) {
|
||||
this.getById();
|
||||
}
|
||||
}
|
||||
|
||||
getAllLanguages() {
|
||||
this.apiserv.AdminGet('/LanguageMapping/GetLanguagesByOrgId').subscribe(data => {
|
||||
if (data) {
|
||||
this.AllLang = data;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getCurrencyList() {
|
||||
// Replace with actual API if needed
|
||||
this.apiserv.AdminGet('/CurrencyMaster/GetAllCurrencies').subscribe(d => {
|
||||
if (d) this.currencyList = d;
|
||||
});
|
||||
}
|
||||
|
||||
getVendorList() {
|
||||
this.apiserv.Get('/ActivityVehicle/GetVehicleVendor').subscribe(res => {
|
||||
if (res && res.status) {
|
||||
this.vendorList = res.data;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
initForm() {
|
||||
this.AddOnForm = this.fb.group({
|
||||
addOn: this.validServ.required,
|
||||
defaultLanguageCode: this.validServ.required,
|
||||
description: '',
|
||||
addonImage: '',
|
||||
addonImageUrl: '',
|
||||
applyRateOn: this.validServ.required,
|
||||
currency: this.validServ.required,
|
||||
activityAddonVendorId: ''
|
||||
});
|
||||
}
|
||||
|
||||
SelectImage(event: any, fileUpload: any, controlName: string) {
|
||||
const file = event.currentFiles[0];
|
||||
if (file && file.size < 1048576 && ['image/jpeg', 'image/png'].includes(file.type)) {
|
||||
const reader = new FileReader();
|
||||
reader.readAsText(file); // Check for script tags
|
||||
reader.onload = (e) => {
|
||||
const binaryString = e.target?.result as string;
|
||||
const hasScript = this.commonMasterSer.hasScriptTagInBinary(binaryString);
|
||||
if (hasScript) {
|
||||
fileUpload.clear();
|
||||
this.commonMasterSer.showMessage(false, 'Invalid file (contains script tag)');
|
||||
return;
|
||||
}
|
||||
|
||||
// Set file and preview URL
|
||||
this.AddOnForm.get(controlName).setValue(file);
|
||||
const urlReader = new FileReader();
|
||||
urlReader.readAsDataURL(file);
|
||||
urlReader.onload = () => {
|
||||
this.AddOnForm.get('addonImageUrl').setValue(urlReader.result?.toString());
|
||||
};
|
||||
};
|
||||
} else {
|
||||
this.commonMasterSer.showMessage(false, 'File must be JPG/PNG under 1MB');
|
||||
fileUpload.clear();
|
||||
}
|
||||
}
|
||||
|
||||
RemoveImage() {
|
||||
this.AddOnForm.get('addonImage').setValue('');
|
||||
this.AddOnForm.get('addonImageUrl').setValue('');
|
||||
}
|
||||
|
||||
getById() {
|
||||
this.apiserv.Get(`/ActivityAddon/GetById/${this.Edit_Id}`).subscribe(res => {
|
||||
if (res && res.status) {
|
||||
this.editResp = res.data;
|
||||
this.HandleApplyRateOn(this.editResp.applyRateOn)
|
||||
this.AddOnForm.get('addOn').setValue(this.editResp.activityAddonDetails.addOn);
|
||||
this.AddOnForm.get('defaultLanguageCode').setValue(this.editResp.defaultLanguageCode);
|
||||
this.AddOnForm.get('description').setValue(this.editResp.activityAddonDetails.description);
|
||||
this.AddOnForm.get('applyRateOn').setValue(this.editResp.applyRateOn);
|
||||
this.AddOnForm.get('currency').setValue(this.editResp.currency);
|
||||
this.AddOnForm.get('adult')?.setValue(this.editResp.adult);
|
||||
this.AddOnForm.get('child')?.setValue(this.editResp.child);
|
||||
this.AddOnForm.get('youth')?.setValue(this.editResp.youth);
|
||||
this.AddOnForm.get('senior')?.setValue(this.editResp.senior);
|
||||
this.AddOnForm.get('amount')?.setValue(this.editResp.amount);
|
||||
this.AddOnForm.get('activityAddonVendorId').setValue(this.editResp.activityAddonVendorId || '');
|
||||
|
||||
if (this.editResp.addonImage) {
|
||||
this.AddOnForm.get('addonImage').setValue(this.editResp.addonImage);
|
||||
this.AddOnForm.get('addonImageUrl').setValue(this.editResp.addonImage);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
SaveUpdateAddOn() {
|
||||
if (this.AddOnForm.invalid) {
|
||||
this.validServ.showValidationsMsg(this.AddOnForm);
|
||||
setTimeout(() => this.validServ.scrollToError(), 50);
|
||||
return;
|
||||
}
|
||||
|
||||
const formVal = this.AddOnForm.getRawValue();
|
||||
const postData = {
|
||||
activityAddonId: this.Edit_Id ?? '',
|
||||
defaultLanguageCode: formVal.defaultLanguageCode,
|
||||
applyRateOn: formVal.applyRateOn,
|
||||
currency: formVal.currency,
|
||||
adult: formVal.adult,
|
||||
child: formVal.child,
|
||||
youth: formVal.youth,
|
||||
senior: formVal.senior,
|
||||
amount: formVal.amount,
|
||||
activityAddonVendorId: formVal.activityAddonVendorId,
|
||||
activityAddonDetails: {
|
||||
addOn: formVal.addOn,
|
||||
description: formVal.description,
|
||||
languageCode: formVal.defaultLanguageCode,
|
||||
activityAddonId: this.Edit_Id ?? '',
|
||||
activityAddonDetailId: this.editResp?.activityAddonDetails?.activityAddonDetailId || ''
|
||||
}
|
||||
};
|
||||
|
||||
let addonImageUrl = '';
|
||||
if (formVal.addonImage && typeof formVal.addonImage === 'object') {
|
||||
const ext = formVal.addonImage.name.split('.').pop();
|
||||
this.fileArr.push(formVal.addonImage);
|
||||
this.fileInfo.push({
|
||||
fileName: `Extranet/Activity/AddOn/ActivityAddonId/addonImage.${ext}`,
|
||||
pathToSave: 'OrganizationData/ORGID'
|
||||
});
|
||||
addonImageUrl = `${environment.cdnFileUrl}OrganizationData/ORGID/Extranet/Activity/AddOn/ActivityAddonId/addonImage.${ext}?t=${moment().format('yyMMddHHmmssfffffff')}`;
|
||||
} else {
|
||||
addonImageUrl = formVal.addonImage;
|
||||
}
|
||||
|
||||
postData['addonImage'] = addonImageUrl;
|
||||
|
||||
const url = this.Edit_Id ? 'Update' : 'Save';
|
||||
this.apiserv.Post(`/ActivityAddon/${url}`, postData).subscribe(resp => {
|
||||
if (resp?.status) {
|
||||
if (this.fileInfo.length > 0) {
|
||||
this.saveImg(this.fileInfo, this.fileArr, resp.data).subscribe(uploadRes => {
|
||||
if (uploadRes?.resp) {
|
||||
this.BackButton();
|
||||
}
|
||||
this.commonMasterSer.showMessage(uploadRes.resp, uploadRes.respMsg || 'Saved successfully');
|
||||
});
|
||||
} else {
|
||||
this.BackButton();
|
||||
}
|
||||
this.commonMasterSer.showMessage(true, resp.message);
|
||||
} else {
|
||||
this.commonMasterSer.showMessage(false, resp?.message || 'Save failed');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
saveImg(fileInfo: any[], fileArr: File[], edit_id: string) {
|
||||
if (!fileInfo.length || !fileArr.length) {
|
||||
return of({ resp: true, respMsg: 'No files to upload' });
|
||||
}
|
||||
|
||||
const formData = new FormData();
|
||||
fileArr.forEach(file => formData.append('files', file));
|
||||
const processedFileInfo = JSON.stringify(fileInfo).replace(/ActivityAddonId/g, edit_id);
|
||||
formData.append('fileInfo', processedFileInfo);
|
||||
|
||||
return this.apiserv.PostFile('/FileUpload/SaveFile', formData);
|
||||
}
|
||||
|
||||
BackButton() {
|
||||
this.router.navigateByUrl('ActivityConfiguration/ActivityAddOn/Search');
|
||||
}
|
||||
|
||||
HandleApplyRateOn(value){
|
||||
if(value === "PERPERSON"){
|
||||
this.AddOnForm.addControl('adult', this.fb.control('', Validators.required));
|
||||
this.AddOnForm.addControl('child', this.fb.control('', Validators.required));
|
||||
this.AddOnForm.addControl('youth', this.fb.control('', Validators.required));
|
||||
this.AddOnForm.addControl('senior', this.fb.control('', Validators.required));
|
||||
this.AddOnForm.removeControl('amount');
|
||||
}else if(value === "PERSERVICE"){
|
||||
this.AddOnForm.addControl('amount', this.fb.control('', Validators.required));
|
||||
this.AddOnForm.removeControl('child');
|
||||
this.AddOnForm.removeControl('youth');
|
||||
this.AddOnForm.removeControl('adult');
|
||||
this.AddOnForm.removeControl('senior');
|
||||
}else {
|
||||
this.AddOnForm.removeControl('child');
|
||||
this.AddOnForm.removeControl('youth');
|
||||
this.AddOnForm.removeControl('adult');
|
||||
this.AddOnForm.removeControl('amount');
|
||||
this.AddOnForm.removeControl('senior');
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user