Commit faf1a29a authored by Sai Krishna Jonnala 's avatar Sai Krishna Jonnala

chnges

parent 52dcbec8

<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<ng-container *menuButton="'9Jjg3M'">
<button *ngIf="!loading && assessmentType && assessmentType.length" type="button" class="btn btn-primary btn-sm" (click)="onOpenModel(templateWord)"><i class="fe-plus mr-1"></i> Add Assessment Type</button>
</ng-container>
<!--<button *ngIf="!loading && !filters.applied && generalAdvices && generalAdvices.length" type="button" class="btn btn-secondary btn-sm ml-1" (click)="onShowFilters()"><i class="fe-filter mr-1"></i> Filters</button>-->
</div>
<h4 class="page-title">Assessment Type</h4>
</div>
</div>
</div>
<div class="row" *ngIf="loading">
<div class="col-12">
<div class="d-flex align-items-center">
<span class="spinner-grow text-warning" role="status" aria-hidden="true"></span>
<span class="ml-2">Please wait while loading Assessment Type ...</span>
</div>
</div>
</div>
<div class="row" *ngIf="!loading && (!assessmentType || !assessmentType.length)">
<div class="col-12 mh-400">
<div class="no-data">
<img src="assets/images/no-data.png" alt="No data" />
<h4 class="title">Oops! No Assessment Type found<span *ngIf="filters.applied"> based on your filters criteria</span>.</h4>
<p class="sub-title">There is no data to show you right now.</p>
<button type="button" class="btn btn-primary btn-sm" (click)="onOpenModel(templateWord)"><i class="fe-plus mr-1"></i> Add Assessment Type</button>
</div>
</div>
</div>
<div class="row" *ngIf="!loading && assessmentType && assessmentType.length">
<div class="col-12">
<div class="card mb-0">
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-centered table-sm table-striped table-borderless mb-0">
<thead>
<tr>
<th>Assessment Type Name</th>
<th>Created Date</th>
<!--<th>Modified By</th>-->
<th>Modified Date & Time</th>
<th class="text-right">Actions</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of assessmentType;">
<td [textContent]="item.name"></td>
<td [textContent]="item.createdDate | date:'dd-MM-yyyy, hh:mm a'"></td>
<!--<td [textContent]="item.modifiedByName"></td>-->
<td [textContent]="(item.modifiedDate | date:'dd-MM-yyyy, hh:mm a') || '---'"></td>
<td>
<div class="d-flex align-items-center justify-content-end">
<a href="javascript:;" class="action-icon text-primary mr-1" placement="left" ngbTooltip="Edit" (click)="onOpenModel(templateWord, item)"><i class="fe-edit"></i></a>
<a href="javascript:;" class="action-icon text-danger" placement="left" ngbTooltip="Delete" (click)="onDelete(item)"><i class="fe-trash-2"></i></a>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<nav class="d-flex align-items-center justify-content-between p-2" *ngIf="pagination.totalPages > 1">
<p class="mb-0 font-13">
<span class="text-dark">Page <span [textContent]="pagination.currentPage"></span> of <span [textContent]="pagination.totalPages"></span></span>
<span class="ml-1">
<span>(Showing <span [textContent]="pagination.currentItems - assessmentType.length + 1"></span> - <span [textContent]="pagination.currentItems"></span> of <span [textContent]="pagination.totalItems"></span> Assessment Type )</span>
</span>
</p>
<!--<ngb-pagination class="pagination justify-content-end" [maxSize]="5" [rotate]="false" [ellipses]="false" [(page)]="pagination.pageIndex" [pageSize]="pagination.pageSize" (pageChange)="onNextPage()" [collectionSize]="pagination.totalItems">
<ng-template ngbPaginationPrevious><i class="fe-arrow-left"></i></ng-template>
<ng-template ngbPaginationNext><i class="fe-arrow-right"></i></ng-template>
</ngb-pagination>-->
</nav>
</div>
</div>
</div>
</div>
</div>
</div>
<ng-template #templateWord>
<div class="modal-header">
<h4 class="modal-title"><i class="mdi mdi-mother-nurse mr-1"></i>{{assessmentTypeForm.value.assessmentTypeId === 0 ? 'Add' : 'Edit'}} Assessment Type</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" (click)="onCloseModal();">×</button>
</div>
<form [formGroup]="assessmentTypeForm" (ngSubmit)="onSubmit()">
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<div class="form-group mb-3">
<label class="mb-1">Assessment Type Name <code>*</code></label>
<div class="form-group">
<input tabindex="1" type="text" block maxlength="150" autofocus formControlName="name" autocomplete="nope" class="form-control" [ngClass]="{ 'is-invalid': (submitted && form.name.errors) }" placeholder="Enter assessment name" />
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-light btn-sm mr-1" (click)="onCloseModal();">Cancel</button>
<button type="submit" [disabled]="submitting" class="btn btn-primary btn-sm">
<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>
</div>
</form>
</ng-template>
import { Component, OnDestroy, OnInit, ViewEncapsulation, TemplateRef } from "@angular/core";
import { ApiResources, UtilHelper } from "@shared/helpers";
import { AppData, HttpService, NotifyService } from "@shared/services";
import { takeUntil, finalize } from "rxjs/operators";
import { HttpErrorResponse } from "@angular/common/http";
import { NgbModal, NgbModalRef } from "@ng-bootstrap/ng-bootstrap";
import { FormGroup, Validators, FormBuilder } from "@angular/forms";
import { Page, IUserAccount, Pagination, } from "@shared/models";
import { AssessmentType } from "@shared/entities/assessment-type.entity";
import { WhiteSpaceValidator } from "../../../../../shared/validators";
class TrackBy {
assessmentType(item: AssessmentType) {
return item.assessmentTypeId;
}
}
class FilterOptions {
name: string = null;
assessmentTypeId: number;
}
class Filters {
options: FilterOptions;
applied: boolean;
constructor() {
this.init();
}
init() {
this.options = new FilterOptions();
this.applied = undefined;
}
}
@Component({
templateUrl: "./assessment-type.html",
encapsulation: ViewEncapsulation.None
})
export class AssessmentTypePage implements OnInit, OnDestroy {
page: Page;
filters: Filters;
trackBy: TrackBy;
pagination: Pagination;
assessmentTypeForm: FormGroup;
loading: boolean;
assessmentType: Array<AssessmentType>;
selectedAssessmentType: AssessmentType
modalRef: NgbModalRef;
submitting: boolean;
submitted: boolean;
modifying: boolean;
modifyingContent: string;
constructor(
private readonly appData: AppData,
private readonly modalService: NgbModal,
private readonly formBuilder: FormBuilder,
private readonly notifyService: NotifyService,
private readonly httpService: HttpService
) {
this.loading = true;
this.page = new Page();
this.filters = new Filters();
this.trackBy = new TrackBy();
this.initPagination();
}
private initPagination() {
this.pagination = new Pagination();
this.pagination.pageIndex = 1;
this.pagination.pageSize = 10;
}
private buildForm() {
this.assessmentTypeForm = this.formBuilder.group({
assessmentTypeId: 0,
name: [null, [Validators.required, WhiteSpaceValidator.isValid]]
});
}
onOpenModel(content: TemplateRef<any>, assessmentType?: AssessmentType) {
this.buildForm();
if (assessmentType) {
this.selectedAssessmentType = assessmentType;
this.updateForm();
}
this.modalRef = this.modalService.open(content, {
backdrop: "static",
keyboard: false,
centered: true,
windowClass: "custom-modal effect-scale"
});
}
fetchAddAssessmentType() {
this.loading = true;
const request = Object.assign(UtilHelper.clone(this.filters.options), UtilHelper.clone(this.pagination));
this.httpService
.post<Array<AssessmentType>>(ApiResources.getURI(ApiResources.assessmentType.base, ApiResources.assessmentType.fetch), request)
.pipe(takeUntil(this.page.unSubscribe))
.pipe(finalize(() => this.loading = false))
.subscribe(
(response: Array<AssessmentType>) => {
this.assessmentType = response;
UtilHelper.applyPagination(this.assessmentType, this.pagination);
},
() => {
this.assessmentType = [];
}
);
}
onNextPage() {
$("body,html").animate({ scrollTop: 0 });
this.fetchAddAssessmentType();
}
onSubmit() {
this.submitted = true;
if (!this.assessmentTypeForm.valid) {
return;
}
this.submitting = true;
const request = Object.assign(UtilHelper.clone(this.assessmentTypeForm.getRawValue()));
if (Number(this.assessmentTypeForm.value.assessmentTypeId) === 0) {
request.createdBy = this.page.userAccount.accountId;
request.createdByName = this.page.userAccount.fullName;
this.httpService.post(ApiResources.getURI(ApiResources.assessmentType.base, ApiResources.assessmentType.add), request)
.pipe(takeUntil(this.page.unSubscribe))
.pipe(finalize(() => {
this.submitting = false;
this.submitted = false;
}))
.subscribe(() => {
this.onCloseModal();
this.fetchAddAssessmentType();
this.notifyService.success("Assessment Type has been added successfully.");
}, (error: HttpErrorResponse) => {
const errorMessage = UtilHelper.handleError(error);
if (errorMessage) {
this.notifyService.warning(errorMessage);
} else {
this.notifyService.defaultError();
}
});
} else {
request.modifiedBy = this.page.userAccount.accountId;
request["modifiedByName"] = this.page.userAccount.fullName;
request["createdBy"] = this.page.userAccount.accountId;
delete request.type;
this.httpService.put(ApiResources.getURI(ApiResources.assessmentType.base, ApiResources.assessmentType.update), request)
.pipe(takeUntil(this.page.unSubscribe))
.pipe(finalize(() => {
this.submitting = false;
this.submitted = false;
}))
.subscribe(() => {
this.onCloseModal();
this.fetchAddAssessmentType();
this.notifyService.success("Assessment Type details has been updated successfully.");
}, (error: HttpErrorResponse) => {
const errorMessage = UtilHelper.handleError(error);
if (errorMessage) {
this.notifyService.warning(errorMessage);
} else {
this.notifyService.defaultError();
}
});
}
}
get form() {
return this.assessmentTypeForm.controls;
}
private updateForm() {
this.assessmentTypeForm.patchValue({
assessmentTypeId: this.selectedAssessmentType.assessmentTypeId,
name: this.selectedAssessmentType.name
});
}
onDelete(assessmentType: AssessmentType) {
this.notifyService.delete(() => {
this.httpService
.post(ApiResources.getURI(ApiResources.assessmentType.base, ApiResources.assessmentType.delete), {
assessmentTypeId: assessmentType.assessmentTypeId, modifiedByName: this.page.userAccount.fullName,
createdBy: this.page.userAccount.accountId,
modifiedBy: this.page.userAccount.accountId })
.pipe(takeUntil(this.page.unSubscribe))
.pipe(finalize(() => { }))
.subscribe(
() => {
this.notifyService.success("Assessment Type deleted successfully.");
this.fetchAddAssessmentType();
}
);
}, () => { });
}
onCloseModal() {
try {
this.modalRef.close();
this.modalRef = undefined;
} catch (e) {
// ignored;
}
this.loading = false;
this.submitting = undefined;
this.submitted = undefined;
}
ngOnInit() {
this.appData.userAccount
.pipe(takeUntil(this.page.unSubscribe))
.subscribe((userAccount: IUserAccount) => {
if (userAccount) {
this.page.userAccount = userAccount;
this.fetchAddAssessmentType();
} else {
this.page.userAccount = undefined;
}
});
}
ngOnDestroy() {
this.onCloseModal();
this.page.unsubscribeAll();
}
}
\ No newline at end of file
import { OnInit, OnDestroy, TemplateRef, Component, ViewEncapsulation } from "@angular/core";
import { Page, IUserAccount } from "../../../../../shared/models";
import { FormBuilder, Validators, FormGroup } from "@angular/forms";
import { WhiteSpaceValidator } from "../../../../../shared/validators";
import { NgbModalRef, NgbModal } from "@ng-bootstrap/ng-bootstrap";
import { AppData } from "../../../../../app.data";
import { takeUntil, finalize } from "rxjs/operators";
import { ApiResources } from "../../../../../shared/helpers";
import { CaseType } from "../../../../../shared/entities/case-type.entity";
import { HttpErrorResponse } from "@angular/common/http";
import { HttpService, NotifyService } from "../../../../../shared/services";
@Component({
templateUrl: "./case-type.html",
encapsulation: ViewEncapsulation.None
})
export class CaseTypePage implements OnInit, OnDestroy{
page: Page;
modalRef: NgbModalRef;
submitting: boolean;
submitted: boolean;
caseTypeForm: FormGroup;
loading: boolean;
records: Array<CaseType>;
constructor(
private readonly formBuilder: FormBuilder,
private readonly modalService: NgbModal,
private readonly appData: AppData,
private readonly httpService: HttpService,
private readonly notifyService: NotifyService,
) {
this.page = new Page();
this.loading = true;
this.records = new Array<CaseType>();
}
private buildForm() {
this.caseTypeForm = this.formBuilder.group({
caseTypeId:0,
caseTypeName: [null, [Validators.required, Validators.maxLength(250), WhiteSpaceValidator.isValid, Validators.pattern('^[a-zA-Z]*$')]],
code: [null, [Validators.required, Validators.maxLength(250), WhiteSpaceValidator.isValid]],
})
}
changeStatus(item: CaseType, status: boolean) {
this.notifyService.confirm(`You want to ${status ? 'Activate' : 'Deactivate'} this cast type?`, () => {
const request = {
caseTypeId: item.caseTypeId,
caseTypeName: item.caseTypeName,
code: item.code,
modifiedBy: this.page.userAccount.accountId,
loginRoleId: this.page.userAccount.roleId,
modifiedByName: this.page.userAccount.fullName,
active: status
};
var url = ApiResources.getURI(ApiResources.caseType.base, ApiResources.caseType.modifyStatus);
this.httpService.post(url, request)
.subscribe(
(response: number) => {
if (response > 0) {
this.notifyService.successToast(`Record ${request["caseTypeId"] > 0 ? 'updated' : 'added'} successfully.`);
this.fetchAll();
}
if (response === -1) {
this.notifyService.warningToast("This caseType Name already exists.");
return;
}
},
(error: HttpErrorResponse) => {
this.notifyService.errorToast(error.error);
}
);
})
}
onOpenModel(content: TemplateRef<any>, record?: CaseType) {
this.buildForm();
if (record) {
this.caseTypeForm.patchValue({
caseTypeId: record.caseTypeId,
caseTypeName: record.caseTypeName,
code: record.code,
});
}
this.modalRef = this.modalService.open(content, {
backdrop: "static",
keyboard: false,
centered: false,
size: 'lg',
windowClass: "custom-modal effect-scale"
});
}
get form() { return this.caseTypeForm.controls; }
onSubmit() {
this.submitted = true;
if (this.caseTypeForm.invalid) {
return;
}
this.submitting = true;
const request = {
...this.caseTypeForm.getRawValue(),
createdBy: this.page.userAccount.accountId,
loginRoleId: this.page.userAccount.roleId,
createdByName: this.page.userAccount.fullName
};
console.log("The case type request is : " + JSON.stringify(request));
var url = ApiResources.getURI(ApiResources.caseType.base, ApiResources.caseType.insert);
if (request["caseTypeId"] > 0) {
url = ApiResources.getURI(ApiResources.caseType.base, ApiResources.caseType.update);
}
this.httpService.post(url, request)
.pipe(takeUntil(this.page.unSubscribe))
.pipe(finalize(() => this.submitted = this.submitting = false))
.subscribe(
(response: number) => {
if (response > 0) {
this.notifyService.successToast(`Record ${request["caseTypeId"] > 0 ? 'updated' : 'added'} successfully.`);
this.fetchAll();
}
if (response === -1) {
this.notifyService.warningToast("This caseType Name already exists.");
return;
}
this.onCloseModal();
},
//(error: HttpErrorResponse) => {
// // this.onError(error);
//}
);
}
private fetchAll() {
this.loading = true;
const request = {
};
this.httpService.post(ApiResources.getURI(ApiResources.caseType.base, ApiResources.caseType.fetch), request)
.pipe(takeUntil(this.page.unSubscribe))
.pipe(finalize(() => this.loading = false))
.subscribe(
(response: Array<CaseType>) => {
this.records = response;
//UtilHelper.applyPagination(this.records);
},
//(error: HttpErrorResponse) => {
// this.onError(error)
//}
);
}
ngOnInit() {
this.appData.userAccount
.pipe(takeUntil(this.page.unSubscribe))
.subscribe((userAccount: IUserAccount) => {
if (userAccount) {
this.page.userAccount = userAccount;
this.fetchAll();
} else {
this.page.userAccount = undefined;
}
});
}
ngOnDestroy() {
this.page.unsubscribeAll();
}
onCloseModal() {
try {
this.modalRef.close();
this.modalRef = undefined;
} catch (e) {
// ignored;
}
this.loading = false;
this.submitting = undefined;
this.submitted = undefined;
}
}
\ No newline at end of file
import { RepeatType } from "../../../../services/models/repeat-type.model";
import { AutomaticType } from "../../../../services/models/automatic-type.model";
export interface IChargeModel {
chargeId: number;
chargeName: string;
chargeGroupId: number;
chargeGroupName: string;
departmentId: number;
departmentName: string;
cost: number;
opCost: number;
modulesMasterId?: number;
unit: number;
repeatTypeId: RepeatType;
repeatTypeName: string;
automaticTypeId: AutomaticType;
automaticTypeName: string;
chargeTypeId: AutomaticType;
chargeTypeName: string;
chargeTypeMainId: number;
chargeTypeMainName: number;
active: boolean;
status: boolean;
deleting: boolean;
totalItems: number;
}
\ No newline at end of file
export interface IFilterModel {
id: number;
name: string;
departmentId?: number;
chargeGroupId?: number;
departmentName?: string;
chargeGroupName?: string;
chargeName?: string;
}
\ No newline at end of file

<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<ng-container *menuButton="'WAl8J5'">
<button *ngIf="!loading && chargeTypes && chargeTypes.length" type="button" class="btn btn-primary btn-sm" (click)="onOpenModel(templateWord)"><i class="fe-plus mr-1"></i> Add Charge Type</button>
<!--<button *ngIf="!loading && !filters.applied && generalAdvices && generalAdvices.length" type="button" class="btn btn-secondary btn-sm ml-1" (click)="onShowFilters()"><i class="fe-filter mr-1"></i> Filters</button>-->
</ng-container>
</div>
<h4 class="page-title">Charge Type</h4>
</div>
</div>
</div>
<div class="row" *ngIf="loading">
<div class="col-12">
<div class="d-flex align-items-center">
<span class="spinner-grow text-warning" role="status" aria-hidden="true"></span>
<span class="ml-2">Please wait while loading Charge Types ...</span>
</div>
</div>
</div>
<div class="row" *ngIf="!loading && (!chargeTypes || !chargeTypes.length)">
<div class="col-12 mh-400">
<div class="no-data">
<img src="assets/images/no-data.png" alt="No data" />
<h4 class="title">Oops! No Charge Types found<span *ngIf="filters.applied"> based on your filters criteria</span>.</h4>
<p class="sub-title">There is no data to show you right now.</p>
<button type="button" class="btn btn-primary btn-sm" (click)="onOpenModel(templateWord)"><i class="fe-plus mr-1"></i> Add Charge Type</button>
</div>
</div>
</div>
<div class="row" *ngIf="!loading && chargeTypes && chargeTypes.length">
<div class="col-12">
<div class="card mb-0">
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-centered table-sm table-striped table-borderless mb-0">
<thead>
<tr>
<th>Charge Name</th>
<th>Created Date</th>
<!--<th>Modified By</th>-->
<th>Modified Date & Time</th>
<th>Active</th>
<th class="text-right">Actions</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of chargeTypes; ">
<td [textContent]="item.chargeName"></td>
<td [textContent]="item.createdDate | date:'short'"></td>
<!--<td [textContent]="item.modifiedByName"></td>-->
<td [textContent]="(item.modifiedDate | date:'dd-MM-yyyy, hh:mm a') || '---'"></td>
<td>
<span class="badge badge-soft-success" *ngIf="item.active == true">Active</span>
<span class="badge badge-soft-danger" *ngIf="item.active == false">Inactive</span>
</td>
<td>
<div class="d-flex align-items-center justify-content-end">
<a href="javascript:;" class="action-icon text-primary mr-1" placement="left" ngbTooltip="Edit" (click)="onOpenModel(templateWord, item)"><i class="fe-edit"></i></a>
<a href="javascript:;" class="action-icon text-danger" placement="left" ngbTooltip="Delete" (click)="onDelete(item)"><i class="fe-trash-2"></i></a>
<a href="javascript:;" class="btn btn-sm btn-outline-success" *ngIf="item.active == true" title="Active" (click)=" onModifyStatus(item, false)">
<i class="fe-check-square"></i>
</a>
<a href="javascript:;" class="btn btn-sm btn-outline-warning" *ngIf="item.active == false" title="Inactive" (click)="onModifyStatus(item, true)">
<i class="fe-x-square"></i>
</a>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<nav class="d-flex align-items-center justify-content-between p-2" *ngIf="pagination.totalPages > 1">
<p class="mb-0 font-13">
<span class="text-dark">Page <span [textContent]="pagination.currentPage"></span> of <span [textContent]="pagination.totalPages"></span></span>
<span class="ml-1">
<span>(Showing <span [textContent]="pagination.currentItems - chargeTypes.length + 1"></span> - <span [textContent]="pagination.currentItems"></span> of <span [textContent]="pagination.totalItems"></span> Charge Types )</span>
</span>
</p>
<!--<ngb-pagination class="pagination justify-content-end" [maxSize]="5" [rotate]="false" [ellipses]="false" [(page)]="pagination.pageIndex" [pageSize]="pagination.pageSize" (pageChange)="onNextPage()" [collectionSize]="pagination.totalItems">
<ng-template ngbPaginationPrevious><i class="fe-arrow-left"></i></ng-template>
<ng-template ngbPaginationNext><i class="fe-arrow-right"></i></ng-template>
</ngb-pagination>-->
</nav>
</div>
</div>
</div>
</div>
</div>
</div>
<ng-template #templateWord>
<div class="modal-header">
<h4 class="modal-title"><i class="mdi mdi-mother-nurse mr-1"></i>{{chargeTypesForm.value.chargeTypesId === 0 ? 'Add' : 'Edit'}} Charge Type</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" (click)="onCloseModal();">×</button>
</div>
<form [formGroup]="chargeTypesForm" (ngSubmit)="onSubmit()">
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<div class="form-group mb-3">
<label class="mb-1">Charge Name <code>*</code></label>
<div class="form-group">
<input tabindex="1" type="text" block maxlength="150" autofocus formControlName="chargeName" autocomplete="nope" textOnly class="form-control" [ngClass]="{ 'is-invalid': (submitted && form.chargeName.errors) }" placeholder="Enter charge name" />
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-light btn-sm mr-1" (click)="onCloseModal();">Cancel</button>
<button type="submit" [disabled]="submitting" class="btn btn-primary btn-sm">
<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>
</div>
</form>
</ng-template>

<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<button *ngIf="!loading && consultationType && consultationType.length" type="button" class="btn btn-primary btn-sm" (click)="onOpenModel(templateWord)"><i class="fe-plus mr-1"></i> Add Consultation Type</button>
<!--<button *ngIf="!loading && !filters.applied && generalAdvices && generalAdvices.length" type="button" class="btn btn-secondary btn-sm ml-1" (click)="onShowFilters()"><i class="fe-filter mr-1"></i> Filters</button>-->
</div>
<h4 class="page-title">Consultation Type</h4>
</div>
</div>
</div>
<div class="row" *ngIf="loading">
<div class="col-12">
<div class="d-flex align-items-center">
<span class="spinner-grow text-warning" role="status" aria-hidden="true"></span>
<span class="ml-2">Please wait while loading Consultation Types ...</span>
</div>
</div>
</div>
<div class="row" *ngIf="!loading && (!consultationType || !consultationType.length)">
<div class="col-12 mh-400">
<div class="no-data">
<img src="assets/images/no-data.png" alt="No data" />
<h4 class="title">Oops! No Consultation Types found<span *ngIf="filters.applied"> based on your filters criteria</span>.</h4>
<p class="sub-title">There is no data to show you right now.</p>
<button type="button" class="btn btn-primary btn-sm" (click)="onOpenModel(templateWord)"><i class="fe-plus mr-1"></i> Add Consultation Type</button>
</div>
</div>
</div>
<div class="row" *ngIf="!loading && consultationType && consultationType.length">
<div class="col-12">
<div class="card mb-0">
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-centered table-sm table-striped table-borderless mb-0">
<thead>
<tr>
<th>Name</th>
<th>Created By</th>
<th>Created Date</th>
<th>Modified By</th>
<th>Modified Date </th>
<th class="text-right">Actions</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of consultationType">
<td [textContent]="item.name"></td>
<td [textContent]="item.createdByName"></td>
<td [textContent]="item.createdDate | date:'dd-MM-yyyy, hh:mm a'"></td>
<td [textContent]="item.modifiedByName"></td>
<td [textContent]="(item.modifiedDate | date:'dd-MM-yyyy, hh:mm a') || '---'"></td>
<td>
<div class="d-flex align-items-center justify-content-end">
<a href="javascript:;" class="action-icon text-primary mr-1" placement="left" ngbTooltip="Edit" (click)="onOpenModel(templateWord, item)"><i class="fe-edit"></i></a>
<a href="javascript:;" class="action-icon text-danger" placement="left" ngbTooltip="Delete" (click)="onDelete(item)"><i class="fe-trash-2"></i></a>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<nav class="d-flex align-items-center justify-content-between p-2" *ngIf="pagination.totalPages > 1">
<p class="mb-0 font-13">
<span class="text-dark">Page <span [textContent]="pagination.currentPage"></span> of <span [textContent]="pagination.totalPages"></span></span>
<span class="ml-1">
<span>(Showing <span [textContent]="pagination.currentItems - consultationType.length + 1"></span> - <span [textContent]="pagination.currentItems"></span> of <span [textContent]="pagination.totalItems"></span> consultationType )</span>
</span>
</p>
<!--<ngb-pagination class="pagination justify-content-end" [maxSize]="5" [rotate]="false" [ellipses]="false" [(page)]="pagination.pageIndex" [pageSize]="pagination.pageSize" (pageChange)="onNextPage()" [collectionSize]="pagination.totalItems">
<ng-template ngbPaginationPrevious><i class="fe-arrow-left"></i></ng-template>
<ng-template ngbPaginationNext><i class="fe-arrow-right"></i></ng-template>
</ngb-pagination>-->
<!--<ngb-pagination class="pagination justify-content-end"
[maxSize]="5"
[rotate]="false"
[ellipses]="false"
[(page)]="pagination.pageIndex"
[pageSize]="pagination.pageSize"
(pageChange)="onNextPage()"
[collectionSize]="pagination.totalItems">
<ng-template ngbPaginationPrevious>
<i class="fe-arrow-left"></i>
</ng-template>
<ng-template ngbPaginationNext>
<i class="fe-arrow-right"></i>
</ng-template>
</ngb-pagination>-->
</nav>
</div>
</div>
</div>
</div>
</div>
</div>
<ng-template #templateWord>
<div class="modal-header">
<h4 class="modal-title"><i class="mdi mdi-mother-nurse mr-1"></i>{{consultationTypeForm.value.consultationTypeId === 0 ? 'Add' : 'Edit'}} Consultation Type</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" (click)="onCloseModal();">×</button>
</div>
<form [formGroup]="consultationTypeForm" (ngSubmit)="onSubmit()">
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<div class="form-group mb-3">
<label class="mb-1">Consultation Type Name <code>*</code></label>
<div class="form-group">
<input tabindex="1" type="text" block maxlength="150" autofocus formControlName="name" autocomplete="nope" class="form-control" [ngClass]="{ 'is-invalid': (submitted && form.name.errors) }" placeholder="Enter Consultation name" />
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-light btn-sm mr-1" (click)="onCloseModal();">Cancel</button>
<button type="submit" [disabled]="submitting" class="btn btn-primary btn-sm">
<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>
</div>
</form>
</ng-template>
import { Component, OnDestroy, OnInit, ViewEncapsulation, TemplateRef } from "@angular/core";
import { ApiResources, UtilHelper } from "@shared/helpers";
import { AppData, HttpService, NotifyService } from "@shared/services";
import { takeUntil, finalize } from "rxjs/operators";
import { HttpErrorResponse } from "@angular/common/http";
import { NgbModal, NgbModalRef } from "@ng-bootstrap/ng-bootstrap";
import { FormGroup, Validators, FormBuilder } from "@angular/forms";
import { Page, IUserAccount, Pagination } from "@shared/models";
import { ConsultationType } from "@shared/entities/consultation-type.entity";
class TrackBy {
consultationType(item: ConsultationType) {
return item.consultationTypeId;
}
}
class FilterOptions {
name: string = null;
consultationTypeId: number;
}
class Filters {
options: FilterOptions;
applied: boolean;
constructor() {
this.init();
}
init() {
this.options = new FilterOptions();
this.applied = undefined;
}
}
@Component({
templateUrl: "./consultation-type.html",
encapsulation: ViewEncapsulation.None
})
export class ConsultationTypePage implements OnInit, OnDestroy {
page: Page;
filters: Filters;
trackBy: TrackBy;
pagination: Pagination;
consultationTypeForm: FormGroup;
loading: boolean;
consultationType: Array<ConsultationType>;
selectedConsultationType: ConsultationType;
modalRef: NgbModalRef;
submitting: boolean;
submitted: boolean;
modifying: boolean;
modifyingContent: string;
constructor(
private readonly appData: AppData,
private readonly modalService: NgbModal,
private readonly formBuilder: FormBuilder,
private readonly notifyService: NotifyService,
private readonly httpService: HttpService
) {
this.loading = true;
this.page = new Page();
this.filters = new Filters();
this.trackBy = new TrackBy();
this.initPagination();
}
private initPagination() {
this.pagination = new Pagination();
this.pagination.pageIndex = 1;
this.pagination.pageSize = 10;
}
private buildForm() {
this.consultationTypeForm = this.formBuilder.group({
consultationTypeId: 0,
name: [null, [Validators.required]],
active: [true],
});
}
onOpenModel(content: TemplateRef<any>, consultationType?: ConsultationType) {
this.buildForm();
if (consultationType) {
this.selectedConsultationType = consultationType;
this.updateForm();
}
this.modalRef = this.modalService.open(content, {
backdrop: "static",
keyboard: false,
centered: true,
windowClass: "custom-modal effect-scale"
});
}
fetchAddConsultationTypes() {
this.loading = true;
const request = Object.assign(UtilHelper.clone(this.filters.options), UtilHelper.clone(this.pagination));
this.httpService
.post<Array<ConsultationType>>(ApiResources.getURI(ApiResources.consultationType.base, ApiResources.consultationType.fetch), request)
.pipe(takeUntil(this.page.unSubscribe))
.pipe(finalize(() => this.loading = false))
.subscribe(
(response: Array<ConsultationType>) => {
this.consultationType = response;
UtilHelper.applyPagination(this.consultationType, this.pagination);
},
() => {
this.consultationType = [];
}
);
}
onNextPage() {
$("body,html").animate({ scrollTop: 0 });
this.fetchAddConsultationTypes();
}
onSubmit() {
this.submitted = true;
if (!this.consultationTypeForm.valid) {
return;
}
console.log(this.consultationTypeForm.value);
this.submitting = true;
const request = Object.assign(UtilHelper.clone(this.consultationTypeForm.getRawValue()));
request["modifiedByName"] = this.page.userAccount.fullName;
request.createdBy = this.page.userAccount.accountId;
this.httpService.post(ApiResources.getURI(ApiResources.consultationType.base, ApiResources.consultationType.add), request)
.pipe(takeUntil(this.page.unSubscribe))
.pipe(finalize(() => {
this.submitting = false;
this.submitted = false;
}))
.subscribe(() => {
this.onCloseModal();
this.fetchAddConsultationTypes();
if (Number(this.consultationTypeForm.value.consultationTypeId) === 0) {
this.notifyService.success("Consultation Type has been added successfully.");
} else {
this.notifyService.success("Consultaion Type details has been updated successfully.");
}
}, (error: HttpErrorResponse) => {
const errorMessage = UtilHelper.handleError(error);
if (errorMessage) {
this.notifyService.warning(errorMessage);
} else {
this.notifyService.defaultError();
}
});
}
get form() {
return this.consultationTypeForm.controls;
}
private updateForm() {
this.consultationTypeForm.patchValue({
consultationTypeId: this.selectedConsultationType.consultationTypeId,
name: this.selectedConsultationType.name,
active: this.selectedConsultationType.active
});
}
onDelete(consultationType: ConsultationType) {
this.notifyService.delete(() => {
this.httpService
.post(ApiResources.getURI(ApiResources.consultationType.base, ApiResources.consultationType.delete), {
consultationTypeId: consultationType.consultationTypeId, modifiedByName: this.page.userAccount.fullName,
createdBy: this.page.userAccount.accountId,
modifiedBy: this.page.userAccount.accountId
})
.pipe(takeUntil(this.page.unSubscribe))
.subscribe(
() => {
this.notifyService.success("Consultation Type deleted successfully.");
this.fetchAddConsultationTypes();
}, (error: HttpErrorResponse) => {
const errorMessage = UtilHelper.handleError(error);
if (errorMessage) {
this.notifyService.warning(errorMessage);
} else {
this.notifyService.defaultError();
}
}
);
}, () => {
this.notifyService.defaultError();
});
}
onCloseModal() {
try {
this.modalRef.close();
this.modalRef = undefined;
} catch (e) {
// ignored;
}
this.loading = false;
this.submitting = undefined;
this.submitted = undefined;
}
ngOnInit() {
this.appData.userAccount
.pipe(takeUntil(this.page.unSubscribe))
.subscribe((userAccount: IUserAccount) => {
if (userAccount) {
this.page.userAccount = userAccount;
this.fetchAddConsultationTypes();
} else {
this.page.userAccount = undefined;
}
});
}
ngOnDestroy() {
this.onCloseModal();
this.page.unsubscribeAll();
}
}
\ No newline at end of file
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<ng-container *menuButton="'OqdcT9'">
<button type="button" *ngIf="!loading && discharges && discharges.length" class="btn btn-primary btn-sm" (click)="onOpenModel(templateModify)"><i class="fe-plus mr-1"></i> Add Discharge Instructions</button>
<!--<button *ngIf="!loading && !filters.applied && generalAdvices && generalAdvices.length" type="button" class="btn btn-secondary btn-sm ml-1" (click)="onShowFilters()"><i class="fe-filter mr-1"></i> Filters</button>-->
</ng-container>
</div>
<h4 class="page-title">Discharge Instructions</h4>
</div>
</div>
</div>
<div class="row" *ngIf="loading">
<div class="col-12">
<div class="d-flex align-items-center">
<span class="spinner-grow text-warning" role="status" aria-hidden="true"></span>
<span class="ml-2">Please wait while loading discharge instructions ...</span>
</div>
</div>
</div>
<div class="row" *ngIf="!loading && (!discharges || !discharges.length)">
<div class="col-12 mh-400">
<div class="no-data">
<img src="assets/images/no-data.png" alt="No data" />
<h4 class="title">Oops! No discharge instructions found<span *ngIf="filters.applied"> based on your filters criteria</span>.</h4>
<p class="sub-title">There is no data to show you right now.</p>
<button type="button" class="btn btn-primary btn-sm" (click)="onOpenModel(templateModify)"><i class="fe-plus mr-1"></i> Add Discharge Instructions</button>
</div>
</div>
</div>
<div class="row" *ngIf="!loading && discharges && discharges.length">
<div class="col-12">
<div class="card mb-0">
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-centered table-sm table-striped table-borderless">
<thead>
<tr>
<th>Discharge Instructions</th>
<th>Status</th>
<th>Created By</th>
<th>Modified By</th>
<th>Status</th>
<th class="text-right">Actions</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of discharges; trackBy: trackBy.role">
<td [textContent]="item.dischargeInstructionName"></td>
<td [textContent]="item.active === true ? 'Active' : 'InActive'"></td>
<td>
<p class="mb-0" [textContent]="item.createdByName || '-----'"></p>
<p class="mb-0" [textContent]="item.createdByRole"></p>
<p class="mb-0" [textContent]="item.createdDate | date:'dd-MM-yyyy, hh:mm a'"></p>
</td>
<td>
<p class="mb-0" [textContent]="item.modifiedByName || '-----'"></p>
<p class="mb-0" [textContent]="item.modifiedByRole"></p>
<p class="mb-0" [textContent]="(item.modifiedDate | date:'dd-MM-yyyy, hh:mm a')"></p>
</td>
<td>
<div class="media">
<span class="badge badge-success" *ngIf="item.active">Active</span>
<span class="badge badge-soft-danger" *ngIf="!item.active">Inactive</span>
</div>
</td>
<td>
<div class="d-flex align-items-center justify-content-end">
<span *ngIf="item.active">
<a href="javascript:;" class="action-icon text-primary" placement="left" ngbTooltip="Edit" (click)="onOpenModel(templateModify, item)"><i class="fe-edit"></i></a>
</span>
<span *ngIf="item.active">
<a (click)="onModifyStatus(item,false)" href="javascript:;" class="action-icon text-danger" placement="left" ngbTooltip="To Deactivate" style="margin-right:6px;">
<i class="fe-delete"></i>
</a>
</span>
<span *ngIf="!item.active">
<a (click)="onModifyStatus(item,true)" href="javascript:;" class="action-icon text-success mr-1" placement="left" ngbTooltip="To Activated">
<i class="mdi mdi-check-all"></i>
</a>
</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<nav class="d-flex align-items-center justify-content-between p-2" *ngIf="pagination.totalPages > 1">
<p class="mb-0 font-13">
<span class="text-dark">Page <span [textContent]="pagination.currentPage"></span> of <span [textContent]="pagination.totalPages"></span></span>
<span class="ml-1">
<span>(Showing <span [textContent]="pagination.currentItems - discharges.length + 1"></span> - <span [textContent]="pagination.currentItems"></span> of <span [textContent]="pagination.totalItems"></span> Discharge Instructions )</span>
</span>
</p>
<!--<ngb-pagination class="pagination justify-content-end" [maxSize]="5" [rotate]="false" [ellipses]="false" [(page)]="pagination.pageIndex" [pageSize]="pagination.pageSize" (pageChange)="onNextPage()" [collectionSize]="pagination.totalItems">
<ng-template ngbPaginationPrevious><i class="fe-arrow-left"></i></ng-template>
<ng-template ngbPaginationNext><i class="fe-arrow-right"></i></ng-template>
</ngb-pagination>-->
</nav>
</div>
</div>
</div>
</div>
</div>
</div>
<ng-template #templateModify>
<div class="modal-header">
<h4 class="modal-title"><i class="mdi mdi-mother-nurse mr-1"></i>{{dischargeForm.value.dischargeInstructionId === 0 ? 'Add' : 'Edit'}} Discharge Instructions</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" (click)="onCloseModal();">×</button>
</div>
<form [formGroup]="dischargeForm" (ngSubmit)="onSubmit()">
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<div class="form-group mb-3">
<label class="mb-1">Discharge Instruction <code>*</code></label>
<div class="form-group">
<input tabindex="1" type="text" block maxlength="150" autofocus formControlName="dischargeInstructionName" autocomplete="nope" class="form-control" [ngClass]="{ 'is-invalid': (submitted && form.dischargeInstructionName.errors) }" placeholder="Discharge instructions" />
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-light btn-sm mr-1" (click)="onCloseModal();">Cancel</button>
<button type="submit" [disabled]="submitting" class="btn btn-primary btn-sm">
<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>
</div>
</form>
</ng-template>
\ No newline at end of file
import { Component, OnDestroy, OnInit, ViewEncapsulation, TemplateRef } from "@angular/core";
import { DischargeInstructions } from "@shared/entities";
import { ApiResources, UtilHelper } from "@shared/helpers";
import { AppData, HttpService, NotifyService } from "@shared/services";
import { takeUntil, finalize } from "rxjs/operators";
import { HttpErrorResponse } from "@angular/common/http";
import { NgbModal, NgbModalRef } from "@ng-bootstrap/ng-bootstrap";
import { FormGroup, Validators, FormBuilder } from "@angular/forms";
import { Page, IUserAccount, Pagination } from "@shared/models";
import { WhiteSpaceValidator } from "../../../../../shared/validators";
class TrackBy {
role(item: DischargeInstructions) {
return item.dischargeInstructionId;
}
}
class FilterOptions {
dischargeInstructionName: string = null;
dischargeInstructionId: number;
}
class Filters {
options: FilterOptions;
applied: boolean;
constructor() {
this.init();
}
init() {
this.options = new FilterOptions();
this.applied = undefined;
}
}
@Component({
templateUrl: "./discharge-instructions.html",
encapsulation: ViewEncapsulation.None
})
export class DischargeInstructionsPage implements OnInit, OnDestroy {
page: Page;
filters: Filters;
trackBy: TrackBy;
pagination: Pagination;
loading: boolean;
discharges: Array<DischargeInstructions>;
selectedDischarges: DischargeInstructions;
modalRef: NgbModalRef;
dischargeForm: FormGroup;
submitting: boolean;
submitted: boolean;
loadingDischarges: boolean;
modifying: boolean;
modifyingContent: string;
constructor(
private readonly appData: AppData,
private readonly modalService: NgbModal,
private readonly formBuilder: FormBuilder,
private readonly notifyService: NotifyService,
private readonly httpService: HttpService
) {
this.loading = true;
this.page = new Page();
this.filters = new Filters();
this.trackBy = new TrackBy();
this.loading = true;
this.initPagination();
}
private initPagination() {
this.pagination = new Pagination();
this.pagination.pageIndex = 1;
this.pagination.pageSize = 10;
}
private fetchDischargeInstuctions() {
const request = Object.assign(UtilHelper.clone(this.filters.options), UtilHelper.clone(this.pagination));
this.httpService.post<Array<DischargeInstructions>>(ApiResources.getURI(ApiResources.discharges.base, ApiResources.discharges.fetch), request)
.pipe(takeUntil(this.page.unSubscribe))
.pipe(finalize(() => this.loading = false))
.subscribe((response: Array<DischargeInstructions>) => {
this.discharges = response;
UtilHelper.applyPagination(this.discharges, this.pagination);
});
}
private buildForm() {
this.dischargeForm = this.formBuilder.group({
dischargeInstructionId: 0,
dischargeInstructionName: [null, [Validators.required, WhiteSpaceValidator.isValid]],
active: [ true ],
});
}
private updateForm() {
this.dischargeForm.patchValue({
dischargeInstructionId: this.selectedDischarges.dischargeInstructionId,
dischargeInstructionName: this.selectedDischarges.dischargeInstructionName,
active: this.selectedDischarges.active
});
}
onOpenModel(content: TemplateRef<any>, discharge?: DischargeInstructions) {
this.buildForm();
if (discharge) {
this.selectedDischarges = discharge;
this.updateForm();
}
this.modalRef = this.modalService.open(content, {
backdrop: "static",
keyboard: false,
centered: true,
windowClass: "custom-modal effect-scale"
});
}
onSubmit() {
this.submitted = true;
if (!this.dischargeForm.valid) {
return;
}
console.log(this.dischargeForm.value);
this.submitting = true;
const request = Object.assign(UtilHelper.clone(this.dischargeForm.getRawValue()));
request["modifiedByName"] = this.page.userAccount.fullName;
request.modifiedBy = this.page.userAccount.accountId;
if (Number(this.dischargeForm.value.dischargeInstructionId) === 0) {
request.createdBy = this.page.userAccount.accountId;
this.httpService.post(ApiResources.getURI(ApiResources.discharges.base, ApiResources.discharges.add), request)
.pipe(takeUntil(this.page.unSubscribe))
.pipe(finalize(() => {
this.submitting = false;
this.submitted = false;
}))
.subscribe(() => {
this.onCloseModal();
this.fetchDischargeInstuctions();
this.notifyService.success("Discharge instructions Added successfully.");
}, (error: HttpErrorResponse) => {
const errorMessage = UtilHelper.handleError(error);
if (errorMessage) {
this.notifyService.warning(errorMessage);
} else {
this.notifyService.defaultError();
}
});
} else {
request.modifiedBy = this.page.userAccount.accountId;
request["modifiedByName"] = this.page.userAccount.fullName;
request["createdBy"] = this.page.userAccount.accountId;
delete request.type;
this.httpService.put(ApiResources.getURI(ApiResources.discharges.base, ApiResources.discharges.update), request)
.pipe(takeUntil(this.page.unSubscribe))
.pipe(finalize(() => {
this.submitting = false;
this.submitted = false;
}))
.subscribe(() => {
this.onCloseModal();
this.fetchDischargeInstuctions();
this.notifyService.success("Discharge instructions details has been updated successfully.");
}, (error: HttpErrorResponse) => {
const errorMessage = UtilHelper.handleError(error);
if (errorMessage) {
this.notifyService.warning(errorMessage);
} else {
this.notifyService.defaultError();
}
});
}
}
//onDelete(discharge: DischargeInstructions) {
// this.notifyService.delete(() => {
// this.httpService
// .post(ApiResources.getURI(ApiResources.discharges.base, ApiResources.discharges.delete), { dischargeInstructionId: discharge.dischargeInstructionId })
// .pipe(takeUntil(this.page.unSubscribe))
// .pipe(finalize(() => { }))
// .subscribe(
// () => {
// this.notifyService.success("Discharge instructions deleted successfully.");
// this.fetchDischargeInstuctions();
// }
// );
// }, () => { });
//}
onModifyStatus(item: DischargeInstructions, status: boolean) {
this.notifyService.confirm(`You want to ${status ? 'Activate' : 'Deactivate'} this Discharge Instructions ?`, () => {
const request = {
modifiedBy: this.page.userAccount.accountId,
active: status,
dischargeInstructionId: item.dischargeInstructionId,
modifiedByName: this.page.userAccount.fullName,
createdByRole: this.page.userAccount.roleName,
loginRoleId: this.page.userAccount.roleId,
dischargeInstructionName: item.dischargeInstructionName
};
this.httpService.post(ApiResources.getURI(ApiResources.discharges.base, ApiResources.discharges.modifyStatus), request)
.pipe(takeUntil(this.page.unSubscribe))
.pipe(finalize(() => { this.loading = false }))
.subscribe((response: number) => {
if (response > 0) {
this.notifyService.successToast(`${status ? 'Activated' : 'Deactivated'} successfully.`);
}
this.fetchDischargeInstuctions();
}, (error: HttpErrorResponse) => {
this.notifyService.errorToast(error.error);
});
});
}
get form() {
return this.dischargeForm.controls;
}
onCloseModal() {
try {
this.modalRef.close();
this.modalRef = undefined;
} catch (e) {
// ignored;
}
this.submitting = undefined;
this.submitted = undefined;
}
onNextPage() {
$("body,html").animate({ scrollTop: 0 });
this.fetchDischargeInstuctions();
}
ngOnInit() {
this.appData.userAccount
.pipe(takeUntil(this.page.unSubscribe))
.subscribe((userAccount: IUserAccount) => {
if (userAccount) {
this.page.userAccount = userAccount;
this.fetchDischargeInstuctions();
} else {
this.page.userAccount = undefined;
}
});
}
ngOnDestroy() {
this.onCloseModal();
this.page.unsubscribeAll();
}
}
\ No newline at end of file
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<button type="button" class="btn btn-sm btn-primary" (click)="onOpenModel(templateModify);">
<i class="mdi mdi-plus-thick mr-1"></i> Add
</button>
</div>
<h4 class="page-title">Dynamic Template</h4>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card-box p-0">
<div class="row p-2" *ngIf="loading">
<div class="col-12">
<div class="d-flex align-items-center">
<span class="spinner-grow text-warning" role="status" aria-hidden="true"></span>
<span class="ml-2">Please wait while loading Dynamic templates ...</span>
</div>
</div>
</div>
<div class="row p-2" *ngIf="!loading && (!template || !template.length)">
<div class="col-12 mh-400">
<div class="no-data">
<img src="assets/images/no-data.png" alt="No data" />
<h4 class="title">Oops! No Templates found.</h4>
<p class="sub-title">There is no data to show you right now.</p>
</div>
</div>
</div>
<div class="table-responsive" *ngIf="!loading && template.length > 0">
<table class="table table-centered table-sm table-striped table-borderless">
<tr class="table-info">
<th>Template Name</th>
<th>Created By</th>
<th>Created Date</th>
<th>Modified By</th>
<th>Modified Date</th>
<th>Action</th>
</tr>
<tbody>
<ng-template ngFor let-item [ngForOf]="template" let-i="index">
<tr>
<td>
<p class="text-truncate-line mb-0" [textContent]="item.templateName || '----'"></p>
</td>
<td>
<p class="mb-0" [textContent]="item.createdByName"></p>
<!--<small><span class="badge badge-outline-success" [textContent]="item.createdByRole"></span></small>-->
</td>
<td><span [textContent]="item.createdDate | date:'dd-MM-yyyy, hh:mm a'"></span></td>
<td>
<p class="mb-0" [textContent]="item.modifiedByName || '--'"></p>
<!--<small><span class="badge badge-outline-blue" [textContent]="item.modifiedByRole"></span></small>-->
</td>
<td><span [textContent]="(item.modifiedDate | date:'dd-MM-yyyy, hh:mm a') || '--'"></span></td>
<td>
<div class="d-flex align-items-center justify-content-center">
<a href="javascript:;" (click)="onOpenModel(templateModify, item)" title="Edit"><i class="fe-edit"></i></a>
<a href="javascript:;" title="Delete" (click)="onDeleteTemplate(item)"><i class="fe-trash-2 ml-2"></i></a>
</div>
</td>
</tr>
</ng-template>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<ng-template #templateModify>
<div class="modal-header">
<h4 class="modal-title"><i class="mdi mdi-onenote mr-1"></i>Template Creation</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" (click)="onClose();">×</button>
</div>
<div class="ml-1">
<div *ngFor="let item of rawData; let i=index">
<label class="mb-1" [textContent]="item" (click)="bindData(item)"></label>
</div>
<div *ngIf="page.loading">
<div class="card-box notes-editor card-box-sm">
<ckeditor [editor]="notesEditor" [(ngModel)]="htmlData"></ckeditor>
</div>
<div class="row">
<div class="col-6">
<div class="form-group">
<label class="mb-1">Template Name<code>*</code></label>
<input type="text" class="form-control" placeholder="Please enter Template name." [(ngModel)]="templateName" />
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-sm btn-primary" (click)="onSubmit()">
<span *ngIf="!submitting">Submit</span>
<span *ngIf="submitting">
<span class="spinner-border spinner-border-sm mr-1" role="status" aria-hidden="true"></span>
Submitting
</span>
</button>
<button type="button" class="ml-1 btn btn-sm btn-danger" (click)="onClose()">Cancel</button>
</div>
</ng-template>
<!--<div class="row mb-3">
<form>
<div class="form-group has-feedback">
<ckeditor [(ngModel)]="mycontent"
#myckeditor
id="myckeditor"
name="myckeditor"
required
[config]="ckeConfig"
debounce="500">
</ckeditor>
<div class="help-block">Required field.</div>
</div>
</form>
</div>
<div class="row mb-3">
<button class="btn btn-secondary mr-2 ml-2" (click)="addValue('chandana')">CustomerNo</button>
</div>-->
export * from "./services.page";
export * from "./pages/orders/orders.page";
export * from "./pages/receipts/receipts.page";
export * from "./pages/final-bill/final-bill.page";
export * from "./pages/discharge/discharge.page";
export * from "./pages/discharge-patient/discharge-patient.page";
export * from "./pages/gate-pass/gate-pass.page";
export * from "./pages/provisional-gate-pass/provisional-gate-pass.page";
\ No newline at end of file
export enum AutomaticType
{
BedCharges = 1,
DoctorCharges = 2
}
\ No newline at end of file
export interface IDashboardConfigModel {
dashboardConfigId: number;
dashboardConfigMasterId: number;
dashboardWidgetId: number;
dashboardWidgetTypeId: number;
dashboardWidgetCountTypeId: number;
widgetName: string;
icon: string;
rowNumber: number;
size: number;
sequenceNumber: number;
createdByName: string;
storedProcedureName: string;
countTypeName: string;
isRoleDashboard: boolean;
defaultValues: any;
}
\ 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