Commit 6dad94e7 authored by Sandeep Sagar Panjala's avatar Sandeep Sagar Panjala

initial commit

parent b1304615
import { Component, OnInit } from "@angular/core";
import { Title } from "@angular/platform-browser";
import { NavigationEnd, NavigationStart, Router, Event as RouterEvent } from "@angular/router";
import { NgbDatepickerConfig, NgbTooltipConfig, } from "@ng-bootstrap/ng-bootstrap";
import { AppData, IdentityService } from "@shared/services";
@Component({
selector: "app-root",
template: `
<ngx-loading-bar [color]="'#3283f6'"></ngx-loading-bar>
<router-outlet></router-outlet>
`
})
export class AppComponent implements OnInit {
constructor(
datePickerConfig: NgbDatepickerConfig,
toolTipConfig: NgbTooltipConfig,
private readonly router: Router,
private readonly titleService: Title,
private readonly identityService: IdentityService,
private readonly appData: AppData,
) {
datePickerConfig.outsideDays = "collapsed";
datePickerConfig.navigation = "select";
toolTipConfig.container = "body";
}
ngOnInit() {
this.router.events.subscribe((event: RouterEvent) => {
if (event instanceof NavigationStart) {
$("body,html").animate({ scrollTop: 0 });
}
if (event instanceof NavigationEnd) {
let root = this.router.routerState.snapshot.root;
if (this.router.url.indexOf("/encounter/") > -1) {
$("#titleEncounter").show();
$("#titleInternalMedicine").hide();
$("#titlePatient").hide();
$("#navAppointments").addClass("selected");
$("#navPatients").removeClass("selected");
}
else if (this.router.url.indexOf("/internal-medicine/") > -1 || this.router.url.indexOf("/behavioral-health/") > -1) {
$("#titleEncounter").hide();
$("#titlePatient").hide();
$("#titleInternalMedicine").show();
$("#navAppointments").addClass("selected");
$("#navPatients").removeClass("selected");
}
else if (this.router.url.indexOf("/patient/") > -1) {
$("#titleEncounter").hide();
$("#titleInternalMedicine").hide();
$("#titlePatient").show();
$("#navAppointments").removeClass("selected");
$("#navPatients").addClass("selected");
} else {
$("#titleEncounter").hide();
$("#titleInternalMedicine").hide();
$("#titlePatient").hide();
$("#navAppointments").removeClass("selected");
$("#navPatients").removeClass("selected");
}
while (root) {
if (root.children && root.children.length) {
root = root.children[0];
} else if (root.data && root.data["title"]) {
let showSidebar: boolean;
try {
showSidebar = root.parent.data["showSidebar"] || this.router.url.indexOf("/internal-medicine/") > -1;
} catch (e) {
showSidebar = false;
}
$("body").attr("data-sidebar-size", (showSidebar || this.router.url.indexOf("app") === -1) ? "default" : "condensed");
this.titleService.setTitle(root.data["title"] + " | Careaxes");
return;
} else {
return;
}
}
}
});
this.identityService.get().subscribe(userAccount => {
if (userAccount) {
this.appData.setAccount(userAccount);
}
});
}
}
\ No newline at end of file
import { HttpClient } from "@angular/common/http";
import { Injectable } from "@angular/core";
export interface IAppConfig {
maintenance: boolean;
baseURI: string;
baseWeb: string;
env: string;
envTitle: string;
version: string;
hostingUrl: string;
signalR: string;
}
@Injectable()
export class AppConfig {
static settings: IAppConfig;
constructor(private readonly http: HttpClient) {
}
load() {
const url = location.origin + location.pathname;
return this.http.get<IAppConfig>(url + "assets/settings.json", { headers: { ignoreLoadingBar: "", "Auth": "False" } })
.subscribe({
next: (response: IAppConfig) => {
localStorage.removeItem("settings");
AppConfig.settings = response;
sessionStorage.setItem("settingsUrls", JSON.stringify(response));
localStorage.setItem("settings", JSON.stringify(response));
},
error: () => {
AppConfig.settings = { maintenance: false, baseURI: "", env: "", envTitle: "", version: "", baseWeb: "", hostingUrl: "", signalR: "" };
}
});
}
getURI(base: string, endPoint: string): string {
const localSettings = localStorage.getItem("settings");
const localSettingsFromSession = sessionStorage.getItem("settingsUrls");
if (localSettings) {
const setting = (JSON.parse(localSettings) as IAppConfig);
return setting.baseURI + base + "/" + endPoint;
}
else if (localSettingsFromSession) {
const setting = (JSON.parse(localSettingsFromSession) as IAppConfig);
return setting.baseURI + base + "/" + endPoint;
} else {
return AppConfig.settings.baseURI + base + "/" + endPoint;
}
}
returnUrl() {
return AppConfig.settings.baseURI;
}
}
\ No newline at end of file
import { Injectable } from "@angular/core";
import { BehaviorSubject, Observable } from "rxjs";
import { IUserAccount } from "@shared/models";
@Injectable()
export class AppData {
private accountSource = new BehaviorSubject(null);
userAccount: Observable<IUserAccount> = this.accountSource.asObservable();
setAccount(userAccount: IUserAccount) {
this.accountSource.next(userAccount);
}
}
\ No newline at end of file
import { DatePipe } from '@angular/common';
import { APP_INITIALIZER, NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { AppComponent } from "@app/app.component";
import { AppRoutingModule, routeGuards, routePages } from "@app/app.routing.module";
import { AvatarImageComponent, SymptomsViewComponent } from "@shared/components";
import { AppConfig, AppData } from "@shared/services";
import { SharedModule } from "@shared/shared.module";
import { OTPWidget } from "@shared/widgets";
import { LayoutComponent } from './areas/layout/layout.component';
const widgets = [OTPWidget];
const components = [AvatarImageComponent, SymptomsViewComponent];
@NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule,
SharedModule.forRoot(),
AppRoutingModule
],
declarations: [
LayoutComponent,
AppComponent,
widgets,
components,
routePages
],
providers: [
AppData,
AppConfig,
routeGuards,
DatePipe,
{
provide: APP_INITIALIZER,
useFactory: (config: AppConfig) => () => config.load(),
deps: [AppConfig],
multi: true
}
],
bootstrap: [AppComponent]
})
export class AppModule {
}
\ No newline at end of file
import { ForgotPasswordPage } from "@account/forgot-password/forgot-password.page";
import { LoginPage } from "@account/login/login.page";
import { AccountsPage } from "@admin/accounts/accounts.page";
import { NgModule } from "@angular/core";
import { RouterModule, Routes } from "@angular/router";
import { NotFoundPage } from "@error/not-found/not-found.page";
import { ServerErrorPage } from "@error/server-error/server-error.page";
import { AccessGuard, AuthGuard, DeactivateGuard, TelemedicineGuard } from "@shared/guards";
import { LayoutComponent } from "./areas/layout/layout.component";
// STARTING PAGES
const startingRoutes = [
{ path: "login", canActivate: [AccessGuard], component: LoginPage, data: { title: "Login", anonymous: true } },
{ path: "forgot-password", canActivate: [AccessGuard], component: ForgotPasswordPage, data: { title: "Forgot Password", anonymous: true } }
]
const startingRouteComponents = [LoginPage, ForgotPasswordPage];
// ERROR PAGES
const errorRoutes = [
{ path: "not-found", component: NotFoundPage, data: { title: "Not Found" } },
{ path: "server-error", component: ServerErrorPage, data: { title: "Server Error" } },
]
const errorRouteComponents = [NotFoundPage, ServerErrorPage];
// HIDDEN PAGES
const hiddenPages = [
{ path: "accounts", component: AccountsPage, data: { title: "Accounts", } }
]
const hiddenPagesComponents = [AccountsPage];
const routes: Routes = [
{ path: "", redirectTo: "login", pathMatch: "full" },
...startingRoutes,
...errorRoutes,
{
path: "app",
component: LayoutComponent,
canActivate: [AuthGuard],
canActivateChild: [AuthGuard],
children: [
{ path: "", redirectTo: "dashboard", pathMatch: "full" },
...hiddenPages
]
},
{ path: "**", redirectTo: "not-found" },
];
// ----- ROUTING MODULE -----
@NgModule({
imports: [RouterModule.forRoot(routes, { useHash: true, enableTracing: false, onSameUrlNavigation: "reload" })],
exports: [RouterModule]
})
export class AppRoutingModule { }
export const routePages = [
...startingRouteComponents,
...errorRouteComponents,
...hiddenPagesComponents
];
export const routeGuards = [AccessGuard, AuthGuard, DeactivateGuard, TelemedicineGuard];
\ No newline at end of file
<div class="auth-fluid">
<div class="auth-fluid-right text-center"></div>
<div class="auth-fluid-form-box">
<div class="align-items-center d-flex h-100">
<div class="card-body">
<div class="auth-brand text-center text-lg-left">
<div class="auth-logo">
<a href="javascript:;" class="logo logo-dark text-center">
<span class="logo-lg">
<img src="assets/images/careaxesLogo.png" alt="Careaxes" height="25">
</span>
</a>
<a href="javascript:;" class="logo logo-light text-center">
<span class="logo-lg">
<!--<img src="assets/images/logo-white.png" alt="Careaxes" height="25">-->
</span>
</a>
</div>
</div>
<ng-container *ngIf="successMessage">
<div class="d-flex align-content-center align-items-center justify-content-center flex-column">
<div class="icon--success mb-4">
<svg xmlns="http://www.w3.org/2000/svg" width="72" height="72">
<g fill="none" stroke="#3283f6" stroke-width="2">
<circle cx="36" cy="36" r="35" style="stroke-dasharray: 240px, 240px; stroke-dashoffset: 480px;"></circle>
<path d="M17.417,37.778l9.93,9.909l25.444-25.393" style="stroke-dasharray: 50px, 50px; stroke-dashoffset: 0;"></path>
</g>
</svg>
</div>
<h4 class="mt-0 mb-4 font-22 text-left">Password Changed!</h4>
<div class="d-flex align-items-center justify-content-center flex-column">
<p class="mb-0 text-center">Your password has been changed successfully.</p>
<a role="button" href="javascript:;" routerLink="/login" class="btn btn-primary btn-sm mt-4"><i class="fe-arrow-left mr-1"></i>Go to Login</a>
</div>
</div>
</ng-container>
<ng-container *ngIf="!successMessage">
<form [formGroup]="forgotForm" (ngSubmit)="onSubmit()">
<ng-container *ngIf="step === 1">
<h4 class="mt-0 font-22">Forgot your password?</h4>
<p class="text-muted mb-4 font-15">Don't worry! We can help to reset your password.</p>
<div class="alert d-flex align-items-center mb-3 alert-warning" role="alert">
<i class="mdi mdi-alert-circle-outline mr-2"></i> Please enter your registered mobile number or email address below to reset your password.
</div>
<div class="form-group mb-4" [ngClass]="{ 'is-invalid': submitted && (form.username.errors || form.countryId.errors) }">
<label class="mb-1">Email/Mobile number</label>
<div class="input-group mb-0">
<div class="input-group-prepend" *ngIf="form.type.value && form.type.value === 'M'">
<select tabindex="1" class="form-control country-control" formControlName="countryId">
<option selected *ngIf="loadingCountries">...</option>
<option *ngFor="let item of countries" [textContent]="'+' + item.optionalText" [ngValue]="item.id"></option>
</select>
</div>
<input type="text" block [class.border-left-0]="form.type.value && form.type.value === 'M'" [attr.maxlength]="form.type.value && form.type.value === 'M' ? 10 : 100" tabindex="2" formControlName="username" autocomplete="nope" class="form-control" placeholder="Enter mobile number or email address" [ngClass]="{ 'is-invalid': (submitted && form.username.errors) }" />
</div>
</div>
<button type="submit" [disabled]="submitting" class="btn btn-primary btn-block">
<span *ngIf="submitting">
<span class="spinner-border spinner-border-sm mr-1" role="status" aria-hidden="true"></span>
Please wait..
</span>
<span *ngIf="!submitting">Submit</span>
</button>
</ng-container>
<ng-container *ngIf="step === 2">
<h4 class="mt-0 font-22">Forgot your password?</h4>
<p class="text-muted mb-4 font-15">Don't worry! We can help to reset your password.</p>
<otp [model]="getModel()" [otp]="otp" [otpExpiresIn]="otpExpiresIn" (validateOTPEmitter)="onValidateOTP($event)"></otp>
</ng-container>
<ng-container *ngIf="step === 3">
<h4 class="mt-0 font-22">Reset your password</h4>
<p class="text-muted mb-4 font-15">Enter new password to continue.</p>
<div class="form-group mb-3">
<div class="media">
<div class="avatar-sm mr-2">
<span class="avatar-title rounded-circle font-12 font-weight-bold text-white bg-warning" [textContent]="form.fullName.value | initials"></span>
</div>
<div class="media-body">
<h5 class="mb-0 mt-0 font-weight-normal" [textContent]="form.fullName.value"></h5>
<span *ngIf="form.type.value && form.type.value === 'M'" class="d-block text-mute font-13" [textContent]="'(+' + countryCode + ') ' + form.username.value"></span>
<span *ngIf="form.type.value && form.type.value === 'E'" class="d-block text-mute font-13" [textContent]="form.username.value"></span>
</div>
</div>
</div>
<div class="form-group mb-3">
<label class="mb-1">New Password</label>
<div class="input-group mb-0">
<input type="password" formControlName="password" block autocomplete="nope" class="form-control" [ngClass]="{ 'is-invalid': submitted && form.password.errors }" placeholder="Your new password" />
<div class="input-group-append cursor-pointer" password>
<div class="input-group-text"><span class="password-eye"></span></div>
</div>
</div>
<div *ngIf="submitted && form.password.errors" class="invalid-feedback show-must">
<div *ngIf="form.password.errors.minLength">
Password must contain minimum of 4 characters.
</div>
</div>
</div>
<div class="form-group mb-4">
<label class="mb-1">Re-enter Password</label>
<div class="input-group mb-0">
<input type="password" formControlName="confirmPassword" block autocomplete="nope" class="form-control" [ngClass]="{ 'is-invalid': submitted && form.confirmPassword.errors }" placeholder="Your password again" />
<div class="input-group-append cursor-pointer" password>
<div class="input-group-text"><span class="password-eye"></span></div>
</div>
</div>
<div *ngIf="submitted && form.confirmPassword.errors" class="invalid-feedback show-must">
<div *ngIf="form.confirmPassword.errors.minLength || form.confirmPassword.errors.notEquivalent">
Passwords are not matched
</div>
</div>
</div>
<button type="submit" [disabled]="submitting" class="btn btn-primary btn-block">
<span *ngIf="submitting">
<span class="spinner-border spinner-border-sm mr-1" role="status" aria-hidden="true"></span>
Please wait..
</span>
<span *ngIf="!submitting">Submit</span>
</button>
</ng-container>
</form>
</ng-container>
<footer class="footer footer-alt" *ngIf="!successMessage">
<p>Remember your password? <a routerLink="/login" href="javascript:;" class="ml-1"><b>Login</b></a></p>
</footer>
</div>
</div>
</div>
</div>
\ No newline at end of file
import { HttpErrorResponse } from "@angular/common/http";
import { Component, OnDestroy, OnInit, ViewEncapsulation } from "@angular/core";
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
import { ApiResources, UtilHelper } from "@shared/helpers";
import { IResource, OTPResponse, Page } from "@shared/models";
import { HttpService, NotifyService, ResourceService } from "@shared/services";
import { CompareValidator, EmailValidator, MobileValidator } from "@shared/validators";
import { finalize, takeUntil } from "rxjs/operators";
class ForgotRequest {
type: string;
username: string;
countryId: number;
password: string;
accountTypes: Array<number>;
accountId: number;
fullName: string;
}
@Component({
templateUrl: "./forgot-password.html",
encapsulation: ViewEncapsulation.None
})
export class ForgotPasswordPage implements OnInit, OnDestroy {
page: Page;
step: number;
loadingCountries: boolean;
countries: Array<IResource>;
forgotForm: FormGroup;
otp: string;
otpExpiresIn: number;
successMessage: string;
submitting: boolean;
submitted: boolean;
constructor(
private readonly httpService: HttpService,
private readonly notifyService: NotifyService,
private readonly resourceService: ResourceService,
private readonly formBuilder: FormBuilder
) {
this.page = new Page();
this.buildForm();
}
private buildForm() {
this.step = 1;
this.forgotForm = this.formBuilder.group({
type: [null],
accountId: [0],
fullName: [null],
countryId: [null, [Validators.required]],
username: ["", [Validators.required]],
password: "",
confirmPassword: ""
}, { validator: CompareValidator.compare("password", "confirmPassword") });
this.forgotForm.get("countryId").valueChanges.subscribe(() => { this.forgotForm.get("username").updateValueAndValidity(); });
this.forgotForm.get("username").valueChanges.subscribe((username: string) => {
const typeControl = this.forgotForm.get("type");
const usernameControl = this.forgotForm.get("username");
if (username) {
const type = /^[0-9]+$/.test(username) ? "M" : "E";
if (type === "M") {
usernameControl.setValidators([Validators.required, MobileValidator.isValid]);
} else {
usernameControl.setValidators([Validators.required, EmailValidator.isValid]);
}
typeControl.patchValue(type);
} else {
typeControl.patchValue(null);
usernameControl.setValidators([Validators.required]);
}
});
}
private fetchCountries() {
this.loadingCountries = true;
this.resourceService.countries()
.pipe(finalize(() => { this.loadingCountries = false }))
.pipe(takeUntil(this.page.unSubscribe))
.subscribe((response: Array<IResource>) => {
this.countries = response;
this.forgotForm.get("countryId").patchValue(response[0].id);
});
}
getModel() {
return {
username: this.forgotForm.get("username").value,
countryCode: this.forgotForm.get("type").value === "M" ? this.countries.find(m => m.id === this.forgotForm.get("countryId").value).optionalText : "",
countryId: this.forgotForm.get("type").value === "M" ? this.forgotForm.get("countryId").value : 0
}
}
get countryCode() {
return this.forgotForm.get("countryId").value ? this.countries.find(m => m.id === this.forgotForm.get("countryId").value).optionalText : "";
}
get form() {
return this.forgotForm.controls;
}
onSubmit() {
this.submitted = true;
if (!this.forgotForm.valid) {
this.notifyService.warningToast("PLEASE ENTER VALID EMAILId/ MOBILE NUMBER")
return;
}
if (this.step === 3 && (this.forgotForm.controls.password.errors || this.forgotForm.controls.confirmPassword.errors)) {
return;
}
const model = UtilHelper.clone(this.forgotForm.getRawValue()) as ForgotRequest;
model.username = model.type && model.type === "M" ? model.countryId + ":" + model.username : model.username;
//model.accountTypes = [Role.SuperAdmin, Role.Administrator, Role.Support, Role.Accountant, Role.SymptomCreator, Role.SymptomManager];
delete model.type;
delete model.countryId;
delete model.fullName;
this.successMessage = undefined;
this.submitting = true;
this.httpService
.post<string | OTPResponse>(ApiResources.getURI(ApiResources.account.base, ApiResources.account.forgotPassword), model, false)
.pipe(finalize(() => { this.submitted = false, this.submitting = false }))
.pipe(takeUntil(this.page.unSubscribe))
.subscribe({
next: (response: (string | OTPResponse)) => {
if (typeof response === "object") {
const otpResponse = response as OTPResponse;
if (otpResponse.error) {
this.notifyService.warning(otpResponse.errorDescription);
} else {
this.otp = otpResponse.otp;
this.otpExpiresIn = otpResponse.otpExpiresIn;
this.forgotForm.get("accountId").patchValue(otpResponse.accountId);
this.forgotForm.get("fullName").patchValue(otpResponse.fullName);
this.step = 2;
}
} else {
this.successMessage = response as string;
}
},
error: (error: HttpErrorResponse) => {
const errorMessage = UtilHelper.handleError(error);
if (errorMessage) {
this.notifyService.warning(errorMessage);
} else {
this.notifyService.defaultError();
}
}
});
}
onValidateOTP(validated: boolean) {
if (validated) {
this.step = 3;
const passwordControl = this.forgotForm.get("password");
passwordControl.patchValue(null);
passwordControl.setValidators([Validators.required, Validators.minLength(4)]);
passwordControl.updateValueAndValidity();
const confirmPasswordControl = this.forgotForm.get("confirmPassword");
confirmPasswordControl.patchValue(null);
confirmPasswordControl.setValidators([Validators.required, Validators.minLength(4)]);
confirmPasswordControl.updateValueAndValidity();
}
}
ngOnInit() {
this.fetchCountries();
}
ngOnDestroy() {
this.page.unsubscribeAll();
}
}
\ No newline at end of file
<style>
html,
body {
height: 100%;
margin: 0px;
}
</style>
<div class="flex-container">
<div class="div1"></div>
<div class="div2 align-items-center d-flex div2 justify-content-center">
<div class="w-100 p-4">
<div>
<div class="auth-logo">
<a href="javascript:;" class="logo logo-dark">
<span class="logo-lg">
<img [src]="logoBasics && logoBasics.imageUrl ? logoBasics.imageUrl : 'assets/images/fernandez.png'" [hidden]="loading" alt="Careaxes" width="55" />
</span>
</a>
<a href="javascript:;" class="logo logo-light">
<span class="logo-lg">
<!--<img src="assets/images/fernandez.png" alt="Careaxes" width="200">-->
<img [src]="logoBasics && logoBasics.imageUrl ? logoBasics.imageUrl : 'assets/images/fernandez.png'" [hidden]="loading" alt="Careaxes" width="200" />
</span>
</a>
</div>
</div>
<div *ngIf="env !== 'live'" class="mb-4">
<div class="badge badge- mb-1" [ngClass]="{'badge-success': env === 'uat', 'badge-blue': env === 'qa proactive', 'badge-danger': env === 'qa reactive', 'badge-warning': env === 'local'}">
<h3 class="m-0 font-22 text-white">
<span [textContent]="env" class="mr-1 text-uppercase"></span>Environment
</h3>
</div>
<h6 class="m-0 text-secondary">
<i class="mdi mid-laptop mr-1"></i><span [textContent]="envTitle" class="mr-1 text-uppercase"></span>
</h6>
</div>
<div>
<form [formGroup]="loginForm" (ngSubmit)="onSubmit()">
<h4 class="mt-0 font-22">Welcome Back :)</h4>
<p class="font-15">Sign in to access your account.</p>
<div class="form-group mb-3" [ngClass]="{ 'is-invalid': submitted && (form.username.errors || form.countryId.errors) }">
<div class="d-flex justify-content-between">
<label class="mb-1">Username</label>
<div class="text-primary" *ngIf="loadingLocationMap">
loading ...
</div>
</div>
<div class="input-group mb-0">
<div class="input-group-prepend" *ngIf="form.type.value && form.type.value === 'M'">
<select class="form-control country-control" formControlName="countryId">
<option *ngFor="let item of countries" [textContent]="'+' + item.optionalText" [ngValue]="item.id"></option>
</select>
</div>
<input tabindex="0" type="text" block [class.border-left-0]="form.type.value && form.type.value === 'M'" [attr.maxlength]="form.type.value && form.type.value === 'M' ? 10 : 100" formControlName="username" autocomplete="nope" class="form-control" [ngClass]="{ 'is-invalid': (submitted && form.username.errors) }" placeholder="Enter mobile number or email address" />
</div>
</div>
<div class="form-group">
<label class="mb-1">Password</label>
<div class="input-group password-group mb-0">
<input tabindex="0" type="password" block formControlName="password" maxlength="20" autocomplete="nope" class="form-control" [ngClass]="{ 'is-invalid': (submitted && form.password.errors) }" placeholder="Enter password" />
<div class="input-group-append cursor-pointer" password>
<div class="input-group-text">
<span class="password-eye"></span>
</div>
</div>
</div>
</div>
<div class="form-group mb-3" *ngIf="locationDropDown">
<label class="mb-1">Location</label>
<div class="input-group password-group mb-0">
<select class="form-control" tabindex="0" formControlName="locationId" [ngClass]="{ 'is-invalid': (submitted && form.locationId.errors) }">
<option selected hidden [ngValue]="null">
Select Location
</option>
<option *ngFor="let location of locations" [ngValue]="location.id" [textContent]="location.name"></option>
</select>
</div>
</div>
<a href="javascript:;" tabindex="0" routerLink="/forgot-password" class="float-right anchorFocus mb-1 onHoverUnderline"><small>Forgot your password?</small></a>
<button type="submit" [disabled]="submitting" tabindex="0" class="btn btn-primary btn-block">
<span *ngIf="submitting">
<span class="spinner-border spinner-border-sm mr-1" role="status" aria-hidden="true"></span>
Please wait..
</span>
<span *ngIf="!submitting">Sign In</span>
</button>
<a href="javascript:;" tabindex="0" routerLink="/queue" class="float-right anchorFocus mt-3 onHoverUnderline">Queue Management</a>
</form>
</div>
</div>
</div>
</div>
\ No newline at end of file
<div class="error-container bg-pattern">
<div class="error-box">
<img src="assets/images/logo.png" alt="Careaxes" height="25">
<div class="error-text-box">
<svg viewBox="0 0 600 200">
<symbol id="s-text">
<text text-anchor="middle" x="50%" y="50%" dy=".35em">404!</text>
</symbol>
<use class="text" xlink:href="#s-text"></use>
<use class="text" xlink:href="#s-text"></use>
<use class="text" xlink:href="#s-text"></use>
<use class="text" xlink:href="#s-text"></use>
<use class="text" xlink:href="#s-text"></use>
</svg>
</div>
<div class="text-center">
<h3 class="mt-0 mb-2">Whoops! Page not found </h3>
<p class="font-15 mb-3">
We're sorry, but the page you were looking for doesn't exist. You may have mistyped the address or the page may have moved.
</p>
<a href="javascript:;" routerLink="/app/dashboard" class="btn btn-primary waves-effect waves-light">Back to Dashboard</a>
</div>
</div>
</div>
\ No newline at end of file
import { Component, ViewEncapsulation } from "@angular/core";
@Component({
templateUrl: "./not-found.html",
encapsulation: ViewEncapsulation.None
})
export class NotFoundPage {
}
\ No newline at end of file
<div class="error-container bg-pattern bg-error-light">
<div class="error-box">
<img src="assets/images/logo.png" alt="Careaxes" height="25">
<div class="error-text-box">
<svg viewBox="0 0 600 200">
<symbol id="s-text">
<text text-anchor="middle" x="50%" y="50%" dy=".35em">500!</text>
</symbol>
<use class="text" xlink:href="#s-text"></use>
<use class="text" xlink:href="#s-text"></use>
<use class="text" xlink:href="#s-text"></use>
<use class="text" xlink:href="#s-text"></use>
<use class="text" xlink:href="#s-text"></use>
</svg>
</div>
<div class="text-center">
<h3 class="mt-0 mb-2">Oh no! Internal server error </h3>
<p class="font-15 mb-3">
We're sorry, there was an error please try again later. The server encountered an internal server error and was unable to complete your request.
</p>
<a href="javascript:;" routerLink="/app/dashboard" class="btn btn-danger waves-effect waves-light">Back to Dashboard</a>
</div>
</div>
</div>
\ No newline at end of file
import { Component, ViewEncapsulation } from "@angular/core";
@Component({
templateUrl: "./server-error.html",
encapsulation: ViewEncapsulation.None
})
export class ServerErrorPage {
}
\ No newline at end of file
This diff is collapsed.
import { Component, Input, AfterViewChecked, ChangeDetectorRef } from "@angular/core";
import * as moment from "moment";
@Component({
selector: "available-days",
template: `&nbsp;<span [innerHtml]="value"></span>`
})
export class AvailableDaysComponent implements AfterViewChecked {
@Input()
value: string;
constructor(private readonly cdRef: ChangeDetectorRef) { }
ngAfterViewChecked() {
if (this.value) {
const dayName = moment().format("d");
let value = this.value;
value = value.replace(/,/g, ", ");
value = value.replace(dayName, `<b class='text-primary'>${dayName}</b>`);
value = value.replace("1", "Mo");
value = value.replace("2", "Tu");
value = value.replace("3", "We");
value = value.replace("4", "Th");
value = value.replace("5", "Fr");
value = value.replace("6", "Sa");
value = value.replace("7", "Su");
this.value = value;
this.cdRef.detectChanges();
}
}
}
\ No newline at end of file
import { Component, Input, ViewEncapsulation } from "@angular/core";
@Component({
selector: "avatar-img",
encapsulation: ViewEncapsulation.None,
template: `
<img [hidden]="loading" (load)="onImageLoad()" (error)="onImageError()" [alt]="alt" [class]="cssClass" [src]="src" />
<div *ngIf="loading" class="ph-item ph-loading m-0 ph-avatar-loading">
<div class="ph-avatar mb-0 h-100"></div>
</div>
`
})
export class AvatarImageComponent {
@Input() src: string;
@Input() alt: string;
@Input() cssClass: string;
bindingSrc: string;
loading: boolean;
constructor() {
this.loading = true;
}
onImageLoad() {
this.loading = false;
}
onImageError() {
this.loading = false;
this.src = location.origin + location.pathname + "assets/images/broken.png";
}
}
\ No newline at end of file
import { DOCUMENT } from "@angular/common";
import { Component, Inject } from "@angular/core";
@Component({
selector: "full-screen",
template: `
<a class="nav-link dropdown-toggle waves-effect waves-light" [hidden]="maximized" (click)="open();" data-toggle="fullscreen" href="javascript:;">
<i class="fe-maximize noti-icon"></i>
</a>
<a class="nav-link dropdown-toggle waves-effect waves-light" [hidden]="!maximized" (click)="close();" data-toggle="fullscreen" href="javascript:;">
<i class="fe-minimize noti-icon"></i>
</a>
`
})
export class FullScreenComponent {
elem: any;
maximized: boolean;
constructor(@Inject(DOCUMENT) private readonly document: any) {
this.elem = document.documentElement;
this.maximized = false;
}
private makeFullScreenOpen() {
this.maximized = true;
}
private makeFullScreenClose() {
this.maximized = false;
}
open() {
if (this.elem.requestFullscreen) {
this.makeFullScreenOpen();
this.elem.requestFullscreen();
} else if (this.elem.mozRequestFullScreen) {
this.makeFullScreenOpen();
this.elem.mozRequestFullScreen();
} else if (this.elem.webkitRequestFullscreen) {
this.makeFullScreenOpen();
this.elem.webkitRequestFullscreen();
} else if (this.elem.msRequestFullscreen) {
this.makeFullScreenOpen();
this.elem.msRequestFullscreen();
}
}
close() {
if (this.document.exitFullscreen) {
this.makeFullScreenClose();
this.document.exitFullscreen();
} else if (this.document.mozCancelFullScreen) {
this.makeFullScreenClose();
this.document.mozCancelFullScreen();
} else if (this.document.webkitExitFullscreen) {
this.makeFullScreenClose();
this.document.webkitExitFullscreen();
} else if (this.document.msExitFullscreen) {
this.makeFullScreenClose();
this.document.msExitFullscreen();
}
}
}
\ No newline at end of file
import { Component, OnDestroy } from "@angular/core";
import { Router } from "@angular/router";
import { NgbModal, NgbModalRef } from "@ng-bootstrap/ng-bootstrap";
import { AutoResume, DEFAULT_INTERRUPTSOURCES, Idle } from "@ng-idle/core";
import { AppData, IdentityService, appUrls } from "@shared/services";
import { ProgressBarModalComponent } from "@shared/components/progress-bar-modal.component";
@Component({
selector: "idle-timeout",
template: ""
})
export class IdleComponent implements OnDestroy {
timeoutIn = 60;
modalRef: NgbModalRef;
idleTimeout: any;
idleStart: any;
constructor(
private readonly idle: Idle,
private readonly router: Router,
private readonly appData: AppData,
private readonly identityService: IdentityService,
private readonly modalService: NgbModal
) {
idle.setIdle(1200);
idle.setTimeout(this.timeoutIn);
idle.setInterrupts(DEFAULT_INTERRUPTSOURCES);
idle.setAutoResume(AutoResume.notIdle);
this.idle.onTimeout.subscribe(() => {
this.modalRef.close("logout");
});
this.idle.onIdleStart.subscribe(() => {
if (this.modalService.hasOpenModals()) {
this.modalService.dismissAll();
}
this.openModal();
});
this.idle.onTimeoutWarning.subscribe((countdown: number) => {
this.modalRef.componentInstance.countdown = countdown;
});
this.idle.watch();
}
openModal() {
this.modalRef = this.modalService.open(ProgressBarModalComponent, {
backdrop: "static",
keyboard: false,
centered: true,
windowClass: "custom-modal effect-scale idle-timeout"
});
this.modalRef.componentInstance.countdown = this.timeoutIn;
this.modalRef.result.then((result: any) => {
if (result === "logout") {
this.identityService.signOut()
.subscribe(() => {
this.appData.setAccount(null);
delete localStorage["ProviderVideoCallingSession"];
localStorage.removeItem("menus");
this.router.navigateByUrl(appUrls.login);
});
}
if (result === "stay") {
this.idle.watch();
}
});
}
ngOnDestroy() {
this.idle.stop();
this.idle.onTimeout.observers.length = 0;
this.idle.onIdleStart.observers.length = 0;
this.idle.onTimeoutWarning.observers.length = 0;
try {
this.modalService.dismissAll();
} catch (e) {
// ignored;
}
}
}
\ No newline at end of file
export * from "./available-days.component";
export * from "./avatar-image.component";
export * from "./full-screen.component";
export * from "./idle-timeout.component";
export * from "./no-data/no-data.component";
export * from "./progress-bar-modal.component";
export * from "./session-timeout.component";
export * from "./symptoms-view.component";
<div class="{{free ? 'no-data' : 'no-data position-absolute'}}">
<img src="assets/images/no-data.png" alt="No data"/>
<h4 class="title">No {{title}} found {{applied ? 'based on your filters criteria.' : '.'}}</h4>
<p class="sub-title">There is no data to show you right now.</p>
</div>
\ No newline at end of file
import { Component, Input } from "@angular/core";
@Component({
selector: "no-data",
templateUrl: "./no-data.component.html",
})
export class NoDataComponent {
@Input()
title: string;
@Input()
applied: boolean;
@Input()
free: boolean;
}
\ No newline at end of file
import { Component, Input } from "@angular/core";
import { NgbActiveModal } from "@ng-bootstrap/ng-bootstrap";
@Component({
selector: "progressbar-modal-comp",
template: `
<div class="modal-header">
<h5 class="modal-title">Idle timeout</h5>
</div>
<div class="modal-body">
<div class="row">
<div class="col-12">
<h4>
You're being timed out due to inactivity.<br />
Please choose to stay logged in or to log off.<br />
Otherwise you will be logged off automatically.
</h4>
</div>
<div class="col-12">
<div class="text-danger">
<p> Your session expires in </p>
</div>
</div>
<div class="col-12">
<div class="d-flex justify-content-center">
<div class="">
<div class="rounded-circle" style="width: 100px; height: 100px; background-color: #ff5959; color: white; text-align: center;">
<span style="margin-top: 29px !important;position: absolute; margin-left: -20px;font-size: 26px;">
<span [textContent]="countdown + 's'"></span>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-light btn-xs mr-1" (click)="logout()">Logout</button>
<button type="button" class="btn btn-primary btn-xs" (click)="stayLoggedIn()">Stay Logged In</button>
</div>
`
})
export class ProgressBarModalComponent {
@Input() countdown: number;
constructor(public activeModal: NgbActiveModal) {
}
stayLoggedIn() {
this.activeModal.close("stay");
}
logout() {
this.activeModal.close("logout");
}
}
import { Component, OnDestroy, OnInit } from "@angular/core";
import { Router } from "@angular/router";
import { AppData, appUrls, IdentityService } from "@shared/services";
import { interval, Subscription } from "rxjs";
@Component({
selector: "session-timeout",
template: ""
})
export class SessionTimeoutComponent implements OnInit, OnDestroy {
session: Subscription;
constructor(
private readonly router: Router,
private readonly identityService: IdentityService,
private readonly appData: AppData
) {
}
checkSession() {
this.identityService.get().subscribe(account => {
if (!account) {
this.router.navigateByUrl(appUrls.login);
this.appData.setAccount(null);
}
});
}
ngOnInit() {
this.session = interval(90000).subscribe(() => {
this.checkSession();
});
}
ngOnDestroy() {
this.session.unsubscribe();
}
}
\ No newline at end of file
import { Component, Input } from "@angular/core";
@Component({
selector: "symptoms-view",
template: '<ul>' +
'<li *ngFor="let node of symptomQuestions" (click)="checkFunction(node)">{{node.ChatBotMsg[0]}}' +
'<ul>' +
'<li *ngFor="let option of node.UserResponseOptions">{{option.Option}}' +
'<symptoms-view [symptomQuestions]="option.IfSelected"></symptoms-view>' +
'</li>' +
'</ul>' +
'</li>' +
'</ul>'
})
export class SymptomsViewComponent {
@Input() symptomQuestions: any;
@Input() checkFunction: any;
}
\ No newline at end of file
import { Directive, HostListener, Input, ElementRef } from '@angular/core';
@Directive({
selector: '[allowNumeric]'
})
export class AllowNumericDirective {
constructor(private el: ElementRef) { }
@Input() allowMultiLine = false;
@Input() allowNegative = false;
@Input() allowDecimal = true;
@Input() maxLength = 0;
regex: RegExp;
@HostListener('keypress', ['$event'])
onKeyPress(event: KeyboardEvent) {
this.validate(event, event.key === 'Enter' ? '\n' : event.key);
}
@HostListener('paste', ['$event'])
onPaste(event: Event) {
const pastedText = (<any>window).clipboardData && (<any>window).clipboardData.getData('Text') // If IE, use window
|| <ClipboardEvent>event && (<ClipboardEvent>event).clipboardData.getData('text/plain'); // Non-IE browsers
this.validate(event, pastedText);
}
@HostListener('cut', ['$event'])
onCut(event: Event) {
this.validate(event, '');
}
validate(event: Event, text: string) {
const txtInput = this.el.nativeElement;
const newValue = (txtInput.value.substring(0, txtInput.selectionStart)
+ text + txtInput.value.substring(txtInput.selectionEnd));
if (!this.regex) {
this.regex = <RegExp>eval('/^'
+ (this.allowNegative ? '-?' : '')
+ (this.allowDecimal ? '((\\d+\\.?)|(\\.?))\\d*' : '\\d*')
+ '$/g');
}
const lines = this.allowMultiLine ? newValue.split('\n') : [newValue];
for (const line of lines) {
const lineText = line.replace('\r', '');
if (this.maxLength && lineText.length > this.maxLength || !lineText.match(this.regex)) {
event.preventDefault();
return;
}
}
}
}
\ No newline at end of file
import { Directive, HostListener } from "@angular/core";
import { KeyCodesHelper, RegExHelper } from "@shared/helpers";
@Directive({
selector: "[alphaNumeric]"
})
export class AlphaNumericOnlyDirective {
@HostListener("keydown", ["$event"])
onKeyDown(e: KeyboardEvent) {
const keys = KeyCodesHelper.default.concat(KeyCodesHelper.alphabets).concat(KeyCodesHelper.numbers);
if (keys.indexOf(e.keyCode) === -1) {
event.preventDefault();
}
if (KeyCodesHelper.specialCharacters.indexOf(e.key) > -1) {
event.preventDefault();
return;
}
if (KeyCodesHelper.defaultNames.indexOf(e.key) === -1) {
return;
}
if (RegExHelper.alphaNumeric.test(e.key))
return;
else
event.preventDefault();
}
}
\ No newline at end of file
import { Directive, HostListener, ElementRef } from "@angular/core";
@Directive({
selector: "[autoResize]"
})
export class AutoResizeDirective {
@HostListener("input", ["$event.target"])
onInput() {
this.adjust();
}
constructor(public element: ElementRef) {
}
ngAfterContentChecked(): void {
this.adjust();
}
adjust(): void {
this.element.nativeElement.style.overflow = "hidden";
this.element.nativeElement.style.height = "auto";
this.element.nativeElement.style.height = this.element.nativeElement.scrollHeight + "px";
}
}
\ No newline at end of file
import { AfterContentInit, Directive, ElementRef, OnChanges, OnDestroy, SimpleChanges } from "@angular/core";
const baseTimerDelay = 10;
@Directive({
selector: "[autofocus]",
inputs: [
"shouldFocusElement: autofocus",
"timerDelay: autofocusDelay"
]
})
export class AutofocusDirective implements AfterContentInit, OnChanges, OnDestroy {
shouldFocusElement: any;
timerDelay: number;
private readonly elementRef: ElementRef;
private timer: any;
// I initialize the autofocus directive.
constructor(elementRef: ElementRef) {
this.elementRef = elementRef;
this.shouldFocusElement = "";
this.timer = null;
this.timerDelay = baseTimerDelay;
}
// ---
// PUBLIC METHODS.
// ---
// I get called once after the contents have been fully initialized.
ngAfterContentInit(): void {
// Because this directive can act on the stand-only "autofocus" attribute or
// the more specialized "autofocus" property, we need to check to see if the
// "shouldFocusElement" input property is the empty string. This will signify
// that the focus it not being data-driven and should be performed automatically.
if (this.shouldFocusElement === "") {
this.startFocusWorkflow();
}
}
// I get called every time the input bindings are updated.
ngOnChanges(changes: SimpleChanges): void {
// If the timer delay is being passed-in as a string (ie., someone is using
// attribute-input syntax, not property-input syntax), let's coalesce the
// attribute to a numeric value so that our type-annotations are consistent.
// ReSharper disable once TsResolvedFromInaccessibleModule
if (changes.timerDelay && (typeof (this.timerDelay) !== "number")) {
// If the coalesce fails, just fall-back to a sane value.
if (isNaN(this.timerDelay = +this.timerDelay)) {
this.timerDelay = baseTimerDelay;
}
}
// If the focus input is being data-driven, then we either need to start the
// focus work flow if focus is required; or, clear any existing work flow if focus
// is no longer required (so that we don't steal focus from another element).
// ReSharper disable once TsResolvedFromInaccessibleModule
if (changes.shouldFocusElement) {
(this.shouldFocusElement)
? this.startFocusWorkflow()
: this.stopFocusWorkflow()
;
}
}
// I get called once when the directive is being unmounted.
ngOnDestroy(): void {
this.stopFocusWorkflow();
}
// ---
// PRIVATE METHODS.
// ---
// I start the timer-based work flow that will focus the current element.
private startFocusWorkflow(): void {
// If there is already a timer running for this element, just let it play out -
// resetting it at this point will only push-out the time at which the focus is
// applied to the element.
if (this.timer) {
return;
}
this.timer = setTimeout(
(): void => {
this.timer = null;
// ReSharper disable once TsResolvedFromInaccessibleModule
this.elementRef.nativeElement.focus();
},
this.timerDelay
);
}
// I stop the timer-based work flow, preventing focus from taking place.
private stopFocusWorkflow(): void {
clearTimeout(this.timer);
this.timer = null;
}
}
\ No newline at end of file
import { Directive, OnInit, Input, ElementRef } from "@angular/core";
@Directive({
selector: "[avatar-bg]"
})
export class AvatarBgDirective implements OnInit {
@Input() index: number;
backgrounds: Array<string> = [
"bg-primary",
"bg-secondary",
"bg-success",
"bg-danger",
"bg-warning",
"bg-info",
"bg-pink",
"bg-blue"
];
constructor(private readonly el: ElementRef) { }
ngOnInit() {
this.el.nativeElement.classList.add(this.backgrounds[this.index % this.backgrounds.length]);
}
}
\ No newline at end of file
import { Directive/*, HostListener*/ } from "@angular/core";
@Directive({
selector: "[block]"
})
export class BlockCopyPasteDirective {
//@HostListener("paste", ["$event"]) blockPaste(e: KeyboardEvent) {
// e.preventDefault();
//}
//@HostListener("copy", ["$event"]) blockCopy(e: KeyboardEvent) {
// e.preventDefault();
//}
//@HostListener("cut", ["$event"]) blockCut(e: KeyboardEvent) {
// e.preventDefault();
//}
}
\ No newline at end of file
import { Directive, Input, forwardRef, HostListener, ElementRef, Renderer2 } from "@angular/core";
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from "@angular/forms";
@Directive({
selector: "input[type=checkbox][trueFalseValue]",
providers: [
{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => TrueFalseValueDirective),
multi: true
}
]
})
export class TrueFalseValueDirective implements ControlValueAccessor {
private propagateChange(_: any) { }
@Input() trueValue = true;
@Input() falseValue = false;
functions: any;
disable: boolean;
constructor(private readonly elementRef: ElementRef, private readonly renderer: Renderer2) { }
@HostListener("change", ["$event"])
onHostChange(ev) {
this.propagateChange(ev.target.checked ? this.trueValue : this.falseValue);
}
writeValue(obj: any): void {
if (obj === this.trueValue) {
this.renderer.setProperty(this.elementRef.nativeElement, "checked", true);
} else {
this.renderer.setProperty(this.elementRef.nativeElement, "checked", false);
}
}
registerOnChange(fn: any): void {
this.propagateChange = fn;
}
registerOnTouched(fn: any): void { this.functions = fn; }
setDisabledState?(isDisabled: boolean): void { this.disable = isDisabled; }
}
\ No newline at end of file
import { Directive, HostListener } from "@angular/core";
import { KeyCodesHelper, RegExHelper } from "@shared/helpers";
@Directive({
selector: "[decimalsOnly]"
})
export class DecimalsOnlyDirective {
@HostListener("keydown", ["$event"])
onKeyDown(e: KeyboardEvent) {
const keys = KeyCodesHelper.default.concat(KeyCodesHelper.numbers).concat(KeyCodesHelper.dots);
if (keys.indexOf(e.keyCode) === -1) {
event.preventDefault();
}
if (KeyCodesHelper.defaultNames.indexOf(e.key) === -1) {
return;
}
if (RegExHelper.decimalsOnly.test(e.key))
return;
else
event.preventDefault();
}
}
\ No newline at end of file
export * from "./alpha-numeric-only.directive";
export * from "./autofocus.directive";
export * from "./block.directive";
export * from "./decimals-only.directive";
export * from "./numbers-only.directive";
export * from "./text-only.directive";
export * from "./title-only.directive";
export * from "./auto-resize.directive";
export * from "./password.directive";
export * from "./avatar-bg.directive";
export * from "./numeric.directive";
export * from "./paste-only.directive";
export * from "./checkbox.directive";
export * from "./trimspace.directive";
export * from "./allow-numeric.directive";
export * from "./menu-button.directive";
\ No newline at end of file
import { Directive, Input, OnInit, TemplateRef, ViewContainerRef } from "@angular/core";
import { MenuService } from "../services";
@Directive({
selector: "[menuButton]"
})
export class MenuButtonDirective implements OnInit {
@Input() menuButton: string;
constructor(
private view: ViewContainerRef,
private template: TemplateRef<any>,
private menuService: MenuService
) {
}
ngOnInit(): void {
if(this.menuService.isMenuButtonAllowed(this.menuButton)) {
this.view.createEmbeddedView(this.template);
} else {
this.view.clear();
}
}
}
\ No newline at end of file
import { Directive, HostListener } from "@angular/core";
import { KeyCodesHelper, RegExHelper } from "@shared/helpers";
@Directive({
selector: "[numbersOnly]"
})
export class NumbersOnlyDirective {
@HostListener("keydown", ["$event"])
onKeyDown(e: KeyboardEvent) {
const keys = KeyCodesHelper.default.concat(KeyCodesHelper.numbers);
if (keys.indexOf(e.keyCode) === -1) {
event.preventDefault();
return;
}
if (KeyCodesHelper.specialCharacters.indexOf(e.key) > -1) {
event.preventDefault();
return;
}
if (KeyCodesHelper.defaultNames.indexOf(e.key) === -1) {
return;
}
if (RegExHelper.numbersOnly.test(e.key))
return;
event.preventDefault();
}
}
\ No newline at end of file
import { Directive, ElementRef, HostListener, Input } from "@angular/core";
@Directive({
selector: "[numeric]"
})
export class NumericDirective {
@Input() decimals = 0;
private check(value: string, decimals: number) {
if (decimals <= 0) {
return String(value).match(new RegExp(/^\d+$/));
} else {
const regExpString = `^\\s*((\\d+(\\.\\d{0,${decimals}})?)|((\\d*(\\.\\d{1,${decimals}}))))\\s*$`;
return String(value).match(new RegExp(regExpString));
}
}
private specialKeys = [
"Backspace", "Tab", "End", "Home", "ArrowLeft", "ArrowRight", "Delete"
];
constructor(private readonly el: ElementRef) { }
@HostListener("keydown", ["$event"])
onKeyDown(event: KeyboardEvent) {
if (this.specialKeys.indexOf(event.key) !== -1) {
return;
}
const current: string = this.el.nativeElement.value;
const next = current.concat(event.key);
if (next && !this.check(next, this.decimals)) {
event.preventDefault();
}
}
}
\ No newline at end of file
import { Directive, HostListener, ElementRef } from "@angular/core";
@Directive({
selector: "[password]"
})
export class PasswordDirective {
@HostListener("click") onClick(){
if (!$(this.element.nativeElement).hasClass("show-password")) {
$(this.element.nativeElement).siblings("input").attr("type", "text");
$(this.element.nativeElement).addClass("show-password");
} else {
$(this.element.nativeElement).siblings("input").attr("type", "password");
$(this.element.nativeElement).removeClass("show-password");
}
}
constructor(public element: ElementRef) {
}
}
\ No newline at end of file
import { Directive, HostListener } from "@angular/core";
//import { KeyCodesHelper, RegExHelper } from "@shared/helpers";
@Directive({
selector: "[pasteOnly]"
})
export class PasteOnlyDirective {
@HostListener('paste', ['$event']) onPaste(event: ClipboardEvent) {
const dataToPaste = event.clipboardData.getData('text');
console.log(dataToPaste);
// Validate 'dataToPaste' against the regex
}
//@HostListener("keydown", ["$event"])
//handleKeyboardEvent(event: KeyboardEvent) {
// console.log(event);
// let x = event.keyCode;
// if (x === 65) {
// console.log('Escape!');
// }
//}
//onKeyDown(e: KeyboardEvent) {
//
// let x = e.keyCode;
// if (x === 17) {
// console.log('Escape!');
// return;
// }
// const keys = KeyCodesHelper.default.concat(KeyCodesHelper.numbers);
// if (keys.indexOf(e.keyCode) === -1) {
// event.preventDefault();
// return;
// }
// if (KeyCodesHelper.specialCharacters.indexOf(e.key) > -1) {
// event.preventDefault();
// return;
// }
// if (KeyCodesHelper.defaultNames.indexOf(e.key) === -1) {
// return;
// }
// if (RegExHelper.numbersOnly.test(e.key))
// return;
// event.preventDefault();
//}
}
\ No newline at end of file
import { Directive, HostListener } from "@angular/core";
import { KeyCodesHelper, RegExHelper } from "@shared/helpers";
@Directive({
selector: "[textOnly]"
})
export class TextOnlyDirective {
@HostListener("keydown", ["$event"])
onKeyDown(e: KeyboardEvent) {
const keys = KeyCodesHelper.default.concat(KeyCodesHelper.alphabets);
if (keys.indexOf(e.keyCode) === -1) {
event.preventDefault();
return;
}
if (KeyCodesHelper.specialCharacters.indexOf(e.key) > -1) {
event.preventDefault();
return;
}
if (RegExHelper.textOnly.test(e.key))
return;
else
event.preventDefault();
}
}
\ No newline at end of file
import { Directive, HostListener } from "@angular/core";
import { KeyCodesHelper, RegExHelper } from "@shared/helpers";
@Directive({
selector: "[titleOnly]"
})
export class TitleOnlyDirective {
@HostListener("keydown", ["$event"])
onKeyDown(e: KeyboardEvent) {
const keys = KeyCodesHelper.default.concat(KeyCodesHelper.alphabets).concat(KeyCodesHelper.specialChars);
if (keys.indexOf(e.keyCode) === -1) {
event.preventDefault();
}
if (RegExHelper.titleOnly.test(e.key))
return;
else
event.preventDefault();
}
}
\ No newline at end of file
import { Directive, forwardRef, HostListener } from '@angular/core';
import { DefaultValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
const TRIM_VALUE_ACCESSOR: any = {
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => TrimSpaceDirective),
multi: true,
};
/**
* The trim accessor for writing trimmed value and listening to changes that is
* used by the {@link NgModel}, {@link FormControlDirective}, and
* {@link FormControlName} directives.
*/
@Directive({
// eslint-disable-next-line @angular-eslint/directive-selector
selector: "[trimSpace]",
providers: [TRIM_VALUE_ACCESSOR],
})
export class TrimSpaceDirective extends DefaultValueAccessor {
@HostListener('input', ['$event.target.value'])
ngOnChange = (val: string) => {
this.onChange(val.trim());
};
@HostListener('blur', ['$event.target.value'])
applyTrim(val: string) {
this.writeValue(val.trim());
}
override writeValue(value: any): void {
if (typeof value === 'string') {
value = value.trim();
}
super.writeValue(value);
}
}
\ No newline at end of file
export class Account {
accountId: number;
referenceId: number;
roleId: number;
roleName: string;
fullName: string;
email: string;
mobile: string;
countryId: number;
countryName: string;
countryCode: string;
lastLoginDate?: Date;
createdDate?: Date;
active?: boolean;
isLocked?: boolean;
thumbnailUrl: string;
totalItems: number;
status: string;
locationIdentifiers: string;
userName: string;
}
\ No newline at end of file
export class AdmissionTransferRequest {
admissionTransferRequestId: number;
fullName: string;
chargeCategoryName: string;
unitName: string;
createdByName: string;
modifiedByName: string;
modifiedDate: Date;
createdDate: Date;
doctorUnitMasterId: number;
admissionId: number;
active: boolean;
approvedByName: string;
approvedBy: number;
approvedDate: Date;
admissionChangeRequestTypeId: number;
chargeCategories: string;
charges: Array<string>;
changeRequestType: string;
}
\ No newline at end of file
export class Admission {
admissionId: number;
encryptedAdmissionId: string;
departmentId: number;
providerId: number;
providerName: string;
providerGender: string;
providerAge?: number;
providerThumbnailUrl: string;
practiceName: string;
patientId: number;
encryptedPatientId: string;
patientFamilyId?: number;
patientAccountId: number;
patientName: string;
patientAge?: number;
patientGender: string;
patientMobile: string;
patientEmail: string;
floorName: string;
patientThumbnailUrl: string;
patientCountryId: number;
patientCountryCode: string;
visitType: string;
roomId: number;
bedId: number;
wardId: number;
bedNumber: string;
roomName: string;
wardName: string;
surgeryTypeId: number;
isMaternity: string;
attendantName: string;
attendantRelationWithPatient: string;
attendantContactNo: string;
admissionDate: Date;
admissionTime: object;
admissionTimeString: string;
patientType: string;
admissionNo: string;
isDischarged: boolean;
dischargeDate: Date;
dischargeTime: object;
dischargeTimeString: string;
admissionNotes: string;
couponId: number;
amount: number;
discount: number;
currencySymbol: string;
total: number;
status: string;
active: boolean;
expired: boolean;
createdBy: number;
createdDate: Date;
totalItems: number;
encounterType: string;
reason: string;
paidAmount: number;
finalAmount: number;
paymentStatus: string;
isFinalBill: boolean;
umrNo: string;
cancelling: boolean;
pendingMedicines: number;
progressReportId: number;
medicationInfo: MedicationInfo;
followUpDaysForIp?: number;
editExpectedDischargeDate: boolean;
expectedDischargeDate: Date;
expectedDischargeDateView: any;
isUpdatingDischargeDate: boolean;
// dischargedBy: number;
dischargedByRole: string;
dischargedByName: string;
visitTypeId: number;
patientPriorityId: number;
locationId: number;
locationName: string;
serviceOrder: any;
bedStatusId: number;
bedStatusName: string;
floorId: number;
swap: boolean;
insuranceCompanyId: number;
admissionPayTypeId: number;
caseTypeId: number;
referralDoctorId: number;
tpaId: number;
patientOrganization: string;
bedAssociatedData: string;
surrogacyData? :SurrogacyInfo;
emergencyInfo: EmergencyInformation;
nriData: nriInfo;
chargeCatgoryId: number;
chargeCategoryName: string;
doctorUnitMasterId: number;
packageModuleId?: number;
admissionPackageId?: number;
admissionBedChangeRequestId?: number;
requestComments?: number;
chargeCategoryNames?: number;
currentRoomId?: number;
currentRoomName: string;
breakfast: object;
lunch: object;
dinner: object;
unitName: string;
}
class MedicationContentViewModel {
count: number
}
class MedicationViewModel {
missed: MedicationContentViewModel;
pending: MedicationContentViewModel;
next: MedicationContentViewModel;
}
export class MedicationInfo {
admissionId: number;
medications: MedicationViewModel;
labs: MedicationContentViewModel;
notes: MedicationContentViewModel;
}
export class SurrogacyInfo {
geneticMotherName?: string;
age?: number;
geneticFatherName?: string;
address?: string;
phoneNo?: number;
bloodGroup?: string;
rhType?: string;
fromDate?: Date;
toDate?: Date;
}
export class nriInfo {
isNri?: boolean;
memberIdcardNo?: string;
unit?: number;
policyNo?: string;
cardHolder?: string;
serviceNo?: string;
refDate?: Date;
rank?: number;
refSerialNo?: string;
insuranceCode?: string;
organisation?: string;
insuranceCo?: string;
panCardNo?: string;
passportNo?: string;
ppAddress?: string;
phoneNo?: number;
ppIssuePlace?: string;
afterDischarge?: string;
}
export class EmergencyInformation {
emergencyContactNo?: number;
emergencyTypeId?: string;
}
export class Ambulance {
ambulanceId: number;
ambulanceNo: string;
assignedNo: string;
locationId: number;
active: boolean;
createdBy: number;
createdDate: Date;
modifiedBy?: number;
modifiedDate?: Date;
createdByName: string;
createdByRole: string;
modifiedByName: string;
modifiedByRole: string;
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment