service
This commit is contained in:
parent
5e1a71546f
commit
17c24f685a
19990
ng-seed/package-lock.json
generated
19990
ng-seed/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
<h3>Appoinment Details</h3>
|
||||
<h3>Appointment Details</h3>
|
||||
<mat-form-field>
|
||||
<mat-label>Filter</mat-label>
|
||||
<input matInput (keyup)="applyFilter($event)" placeholder="Ex. Mia" #input>
|
||||
@ -6,7 +6,7 @@
|
||||
<div class="calender ">
|
||||
<i style="font-size:24px" class="fa" [routerLink]="['/appoinment/calendar-list']"></i>
|
||||
</div>
|
||||
<button mat-button (click)="openDialog('Add',{})" class="button">Add Appoinment</button>
|
||||
<button mat-button (click)="openDialog('Add',{})" class="button">Add Appointment</button>
|
||||
<mat-sidenav-container class="app-inner background-none shadow-none mail-db">
|
||||
<div class="main-content" fxLayout="row" fxLayoutAlign="center start">
|
||||
<div fxFlex.gt-sm="90" fxFlex.gt-xs="95" fxFlex="100">
|
||||
@ -15,18 +15,22 @@
|
||||
<mat-expansion-panel>
|
||||
<mat-expansion-panel-header >
|
||||
<div class="example-container mat-elevation-z8 ">
|
||||
<table mat-table [dataSource]="dataSource" #mytable class="my-table mat-elevation-z8 len-table">
|
||||
<!-- <ng-container matColumnDef="id">
|
||||
<th mat-header-cell *matHeaderCellDef class="font-color"> S.NO </th>
|
||||
<td mat-cell *matCellDef="let element" class="element-spc"> {{element.id}} </td>
|
||||
</ng-container> -->
|
||||
<table mat-table [dataSource]="appoinmentsList" #mytable class="my-table mat-elevation-z8 len-table">
|
||||
<ng-container matColumnDef="busId">
|
||||
<th mat-header-cell *matHeaderCellDef class="font-color"> BusId </th>
|
||||
<td mat-cell *matCellDef="let element" class="element-spc"> {{element.busId}} </td>
|
||||
</ng-container>
|
||||
<!-- <ng-container matColumnDef="picker">
|
||||
<th mat-header-cell *matHeaderCellDef class="font-color"> Date & Time </th>
|
||||
<td mat-cell *matCellDef="let element"> {{element.picker}} </td>
|
||||
</ng-container> -->
|
||||
<ng-container matColumnDef="time">
|
||||
<th mat-header-cell *matHeaderCellDef class="font-color">Time </th>
|
||||
<td mat-cell *matCellDef="let element"> <div class="label">{{element.date | date:'mediumDate'}}</div> <br> {{element.time}} </td>
|
||||
<td mat-cell *matCellDef="let element"> <div class="label">{{element.appoinmentDate | date:'mediumDate'}}</div> <br> {{element.appoinmentTime}} </td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="slots">
|
||||
<th mat-header-cell *matHeaderCellDef class="font-color"> Slots</th>
|
||||
<td mat-cell *matCellDef="let element"> <br>{{element.appoinmentSlots}} </td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="booking">
|
||||
<th mat-header-cell *matHeaderCellDef class="font-color"> Booking ID </th>
|
||||
@ -50,7 +54,7 @@
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="payment">
|
||||
<th mat-header-cell *matHeaderCellDef class="font-color"> Payment </th>
|
||||
<td mat-cell *matCellDef="let element"> <br>{{element.payment}} </td>
|
||||
<td mat-cell *matCellDef="let element"> <br>{{element.paymentStatus}} </td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="status">
|
||||
<th mat-header-cell *matHeaderCellDef class="font-color"> Status </th>
|
||||
|
||||
@ -3,32 +3,34 @@ import { MatDialog } from '@angular/material/dialog';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatTable, MatTableDataSource } from '@angular/material/table';
|
||||
import Swal from 'sweetalert2';
|
||||
import { AppointmentsService } from '../appointments-service/appointments.service';
|
||||
import { DialogBoxComponent } from '../dialog-box/dialog-box.component';
|
||||
export interface UsersData {
|
||||
// id: number;
|
||||
time: string;
|
||||
busId: number;
|
||||
appoinmentTime: string;
|
||||
booking: string;
|
||||
workspace: string;
|
||||
service: string;
|
||||
staff: string;
|
||||
customer: string;
|
||||
payment: string;
|
||||
paymentStatus: string;
|
||||
status: string;
|
||||
date: string;
|
||||
appoinmentDate: string;
|
||||
note: string;
|
||||
appoinmentSlots: string;
|
||||
}
|
||||
const ELEMENT_DATA: UsersData[] = [
|
||||
{time: '11:00', booking: '#SA-00001', workspace: 'Sample', service: 'Hospital', staff: 'Kumar.S', customer:'A', payment:'Free', status: 'Pending', date:'01 Mar 2023', note: 'Financial statement footnotes are used as additional information by individuals reading financial statements.'},
|
||||
{time: '12:00', booking: '#SA-00002', workspace: 'Test', service: 'School', staff: 'Devi.k', customer:'B', payment:'Paid', status: 'Completed', date:'22 Feb 2023', note: 'Financial statement footnotes are used as additional information by individuals reading financial statements.'},
|
||||
{time: '13:00', booking: '#SA-00003', workspace: 'Sample', service: 'Sports', staff: 'Kumar.S', customer:'C', payment:'Free', status: 'Pending', date:'21 Feb 2023', note: 'Financial statement footnotes are used as additional information by individuals reading financial statements.'},
|
||||
{time: '14:00', booking: '#SA-00004', workspace: 'Test', service: 'Hospital', staff: 'Devi.k', customer:'A', payment:'Paid', status: 'Completed', date:'20 Feb 2023', note: 'Financial statement footnotes are used as additional information by individuals reading financial statements.'},
|
||||
{time: '15:00', booking: '#SA-00005', workspace: 'Sample', service: 'School', staff: 'Kumar.S', customer:'B', payment:'Free', status: 'Pending', date:'17 Feb 2023', note: 'Financial statement footnotes are used as additional information by individuals reading financial statements.'},
|
||||
{time: '16:00', booking: '#SA-00006', workspace: 'Test', service: 'Sports', staff: 'Devi.k', customer:'C', payment:'Paid', status: 'Completed', date:'16 Feb 2023', note: 'Financial statement footnotes are used as additional information by individuals reading financial statements.'},
|
||||
{time: '17:00', booking: '#SA-00007', workspace: 'Sample', service: 'Hospital', staff: 'Kumar.S', customer:'A', payment:'Free', status: 'Pending', date:'15 Feb 2023', note: 'Financial statement footnotes are used as additional information by individuals reading financial statements.'},
|
||||
{time: '18:00', booking: '#SA-00008', workspace: 'Test', service: 'School', staff: 'Devi.k', customer:'B', payment:'Paid', status: 'Completed', date:'14 Feb 2023', note: 'Financial statement footnotes are used as additional information by individuals reading financial statements.'},
|
||||
{time: '10:00', booking: '#SA-00009', workspace: 'Sample', service: 'Sports', staff: 'Kumar.S', customer:'C', payment:'Free', status: 'Pending', date:'13 Feb 2023', note: 'Financial statement footnotes are used as additional information by individuals reading financial statements.'},
|
||||
{time: '09:00', booking: '#SA-000010', workspace: 'Test', service: 'Hospital', staff: 'Devi.k', customer:'A', payment:'Paid', status: 'Completed', date:'12 Feb 2023', note: 'Financial statement footnotes are used as additional information by individuals reading financial statements.'},
|
||||
{time: '08:00', booking: '#SA-000011', workspace: 'Sample', service: 'School', staff: 'Kumar.S', customer:'B', payment:'Free', status: 'Pending', date:'11 Feb 2023', note: 'Financial statement footnotes are used as additional information by individuals reading financial statements.'},
|
||||
{busId: 1 , appoinmentSlots: '"start": "09:00",', appoinmentTime: '11:00', booking: '#SA-00001', workspace: 'Sample', service: 'Hospital', staff: 'Kumar.S', customer:'A', paymentStatus:'Free', status: 'Pending', appoinmentDate:'01 Mar 2023', note: 'Financial statement footnotes are used as additional information by individuals reading financial statements.'},
|
||||
{busId: 2 ,appoinmentSlots: '"start": "09:00",', appoinmentTime: '12:00', booking: '#SA-00002', workspace: 'Test', service: 'School', staff: 'Devi.k', customer:'B', paymentStatus:'Paid', status: 'Completed', appoinmentDate:'22 Feb 2023', note: 'Financial statement footnotes are used as additional information by individuals reading financial statements.'},
|
||||
{busId: 3 ,appoinmentSlots: '"start": "09:00",', appoinmentTime: '13:00', booking: '#SA-00003', workspace: 'Sample', service: 'Sports', staff: 'Kumar.S', customer:'C', paymentStatus:'Free', status: 'Pending', appoinmentDate:'21 Feb 2023', note: 'Financial statement footnotes are used as additional information by individuals reading financial statements.'},
|
||||
{busId: 4 ,appoinmentSlots: '"start": "09:00",', appoinmentTime: '14:00', booking: '#SA-00004', workspace: 'Test', service: 'Hospital', staff: 'Devi.k', customer:'A', paymentStatus:'Paid', status: 'Completed', appoinmentDate:'20 Feb 2023', note: 'Financial statement footnotes are used as additional information by individuals reading financial statements.'},
|
||||
{busId: 5 ,appoinmentSlots: '"start": "09:00",', appoinmentTime: '15:00', booking: '#SA-00005', workspace: 'Sample', service: 'School', staff: 'Kumar.S', customer:'B', paymentStatus:'Free', status: 'Pending', appoinmentDate:'17 Feb 2023', note: 'Financial statement footnotes are used as additional information by individuals reading financial statements.'},
|
||||
{busId: 6 ,appoinmentSlots: '"start": "09:00",', appoinmentTime: '16:00', booking: '#SA-00006', workspace: 'Test', service: 'Sports', staff: 'Devi.k', customer:'C', paymentStatus:'Paid', status: 'Completed', appoinmentDate:'16 Feb 2023', note: 'Financial statement footnotes are used as additional information by individuals reading financial statements.'},
|
||||
{busId: 7 ,appoinmentSlots: '"start": "09:00",', appoinmentTime: '17:00', booking: '#SA-00007', workspace: 'Sample', service: 'Hospital', staff: 'Kumar.S', customer:'A', paymentStatus:'Free', status: 'Pending', appoinmentDate:'15 Feb 2023', note: 'Financial statement footnotes are used as additional information by individuals reading financial statements.'},
|
||||
{busId: 8 ,appoinmentSlots: '"start": "09:00",', appoinmentTime: '18:00', booking: '#SA-00008', workspace: 'Test', service: 'School', staff: 'Devi.k', customer:'B', paymentStatus:'Paid', status: 'Completed', appoinmentDate:'14 Feb 2023', note: 'Financial statement footnotes are used as additional information by individuals reading financial statements.'},
|
||||
{busId: 9 ,appoinmentSlots: '"start": "09:00",', appoinmentTime: '10:00', booking: '#SA-00009', workspace: 'Sample', service: 'Sports', staff: 'Kumar.S', customer:'C', paymentStatus:'Free', status: 'Pending', appoinmentDate:'13 Feb 2023', note: 'Financial statement footnotes are used as additional information by individuals reading financial statements.'},
|
||||
{busId: 10 ,appoinmentSlots: '"start": "09:00",', appoinmentTime: '09:00', booking: '#SA-000010', workspace: 'Test', service: 'Hospital', staff: 'Devi.k', customer:'A', paymentStatus:'Paid', status: 'Completed', appoinmentDate:'12 Feb 2023', note: 'Financial statement footnotes are used as additional information by individuals reading financial statements.'},
|
||||
{busId: 11 ,appoinmentSlots: '"start": "09:00",', appoinmentTime: '08:00', booking: '#SA-000011', workspace: 'Sample', service: 'School', staff: 'Kumar.S', customer:'B', paymentStatus:'Free', status: 'Pending', appoinmentDate:'11 Feb 2023', note: 'Financial statement footnotes are used as additional information by individuals reading financial statements.'},
|
||||
|
||||
];
|
||||
@Component({
|
||||
@ -39,26 +41,64 @@ const ELEMENT_DATA: UsersData[] = [
|
||||
export class AppoinmentsListComponent implements OnInit {
|
||||
|
||||
push: any;
|
||||
displayedColumns: string[] = [ 'time', 'booking', 'workspace', 'service', 'staff', 'customer', 'payment', 'status','action'];
|
||||
dataSource: any;
|
||||
displayedColumns: string[] = ['busId', 'time', 'slots', 'action'];
|
||||
// dataSource: any;
|
||||
public appoinmentsList:any = new MatTableDataSource();
|
||||
// dataSource: any = new MatTableDataSource(ELEMENT_DATA);
|
||||
@ViewChild(MatTable,{static:true}) table: MatTable<any>;
|
||||
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||
recordStatus: boolean;
|
||||
addFormData: any;
|
||||
|
||||
|
||||
constructor(public dialog: MatDialog, public _app:AppointmentsService) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
// this.dataSource = new MatTableDataSource(ELEMENT_DATA)
|
||||
this.getAppoinmentsList()
|
||||
}
|
||||
getAppoinmentsList() {
|
||||
//this._pd.getTabStatusPdDetails(this.tabStatus)
|
||||
this._app.getAppoinmentsListDetails().subscribe(res => {
|
||||
if (res.status == 200) {
|
||||
this.appoinmentsList = res.data;
|
||||
// console.log(this.appoinmentsList)
|
||||
// this.dataSource = res.data.length;
|
||||
// console.log(this.dataSource)
|
||||
// this.dataSource.data = this.appoinmentsList;
|
||||
// console.log(this.dataSource.data)
|
||||
// this.recordStatus=false;
|
||||
}
|
||||
else{
|
||||
// this.appoinmentsList=[];
|
||||
// this.dataSource = null;
|
||||
// this.recordStatus=true;
|
||||
}
|
||||
}
|
||||
,error => {
|
||||
// this.errorMessage.push(error);
|
||||
// this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||
// alert(error.html_format);
|
||||
});
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.appoinmentsList.paginator = this.paginator;
|
||||
}
|
||||
applyFilter(event: Event) {
|
||||
const filterValue = (event.target as HTMLInputElement).value;
|
||||
this.dataSource.filter = filterValue.trim().toLowerCase();
|
||||
if (this.dataSource.paginator) {
|
||||
this.dataSource.paginator.firstPage();
|
||||
this.appoinmentsList.filter = filterValue.trim().toLowerCase();
|
||||
if (this.appoinmentsList.paginator) {
|
||||
this.appoinmentsList.paginator.firstPage();
|
||||
}
|
||||
}
|
||||
constructor(public dialog: MatDialog) { }
|
||||
pageChange(e) {
|
||||
console.log(e);
|
||||
}
|
||||
|
||||
confirmBox(name,element){
|
||||
console.log(name,element)
|
||||
|
||||
confirmBox(event,element){
|
||||
console.log(event,element)
|
||||
Swal.fire({
|
||||
title: 'Are you sure want to remove?',
|
||||
text: 'You will not be able to recover this file!',
|
||||
@ -68,7 +108,8 @@ export class AppoinmentsListComponent implements OnInit {
|
||||
cancelButtonText: 'No, keep it'
|
||||
}).then((result) => {
|
||||
if (result.value) {
|
||||
this.deleteRowData(element);
|
||||
// this.deleteRowData(element);
|
||||
this.formAddUpdateAndDelete(event,element)
|
||||
Swal.fire(
|
||||
'Deleted!',
|
||||
'Your imaginary file has been deleted.',
|
||||
@ -95,64 +136,117 @@ export class AppoinmentsListComponent implements OnInit {
|
||||
});
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
console.log(result)
|
||||
if(result.event == 'Add'){
|
||||
this.addRowData(result.data);
|
||||
}else if(result.event == 'Update'){
|
||||
this.updateRowData(result.data);
|
||||
}else if(result.event == 'Delete'){
|
||||
this.deleteRowData(result.data);
|
||||
}
|
||||
this.formAddUpdateAndDelete(result,result.data)
|
||||
// if(result.event == 'Add'){
|
||||
// this.addRowData(result.data);
|
||||
// }else if(result.event == 'Update'){
|
||||
// this.updateRowData(result.data);
|
||||
// }else if(result.event == 'Delete'){
|
||||
// this.deleteRowData(result.data);
|
||||
// }
|
||||
});
|
||||
}
|
||||
addRowData(row_obj){
|
||||
var d = this.dataSource.data.length+1
|
||||
console.log(this.dataSource)
|
||||
console.log(row_obj)
|
||||
this.dataSource.data.push
|
||||
({
|
||||
id: d,
|
||||
time: row_obj.time,
|
||||
formAddUpdateAndDelete(result,row_obj){
|
||||
console.log(result,row_obj)
|
||||
let formValue = []
|
||||
if(result.event == 'Add'){
|
||||
console.log('add')
|
||||
let addFormData = {
|
||||
busId: row_obj.busId,
|
||||
appoinmentTime: row_obj.appoinmentTime,
|
||||
booking: row_obj.booking,
|
||||
workspace: row_obj.workspace,
|
||||
service: row_obj.service,
|
||||
staff: row_obj.staff,
|
||||
customer: row_obj.customer,
|
||||
payment: row_obj.payment,
|
||||
paymentStatus: row_obj.paymentStatus,
|
||||
status: row_obj.status,
|
||||
date: row_obj.date,
|
||||
appoinmentDate: row_obj.appoinmentDate,
|
||||
note: row_obj.note,
|
||||
|
||||
});
|
||||
this.table.renderRows();
|
||||
}
|
||||
updateRowData(row_obj){
|
||||
console.log(row_obj)
|
||||
this.dataSource = this.dataSource.data.filter((value,key)=>{
|
||||
if(value.id == row_obj.id){
|
||||
value.time = row_obj.time;
|
||||
value.booking = row_obj.booking;
|
||||
value.workspace = row_obj.workspace;
|
||||
value.service = row_obj.service;
|
||||
value.staff = row_obj.staff;
|
||||
value.customer = row_obj.customer;
|
||||
value.payment = row_obj.payment;
|
||||
value.status = row_obj.status;
|
||||
value.date = row_obj.date;
|
||||
value.note = row_obj.note;
|
||||
appoinmentSlots: row_obj.appoinmentSlots,
|
||||
};
|
||||
formValue.push(addFormData);
|
||||
}else if(result.event == 'Update'){
|
||||
console.log('Update')
|
||||
formValue.push(row_obj);
|
||||
}
|
||||
else if(result == 'Delete'){
|
||||
console.log('delete')
|
||||
let val = {
|
||||
isActive:0,
|
||||
id: row_obj.id
|
||||
}
|
||||
return true;
|
||||
formValue.push(val);
|
||||
}
|
||||
|
||||
// var d = this.appoinmentsList.length+1
|
||||
console.log(formValue[0])
|
||||
this._app.addFormDetails(formValue[0]).subscribe(res => {
|
||||
if (res.status == 200) {
|
||||
// this.appoinmentsList = res.data;
|
||||
this.getAppoinmentsList()
|
||||
}
|
||||
else{
|
||||
// this.appoinmentsList=[];
|
||||
// this.dataSource = null;
|
||||
// this.recordStatus=true;
|
||||
}
|
||||
}
|
||||
// , error => {this.errorMessage = <any> error});
|
||||
,error => {
|
||||
// this.errorMessage.push(error);
|
||||
// this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||
// alert(error.html_format);
|
||||
});
|
||||
}
|
||||
deleteRowData(row_obj){
|
||||
console.log(this.dataSource.data,row_obj)
|
||||
this.dataSource.data = this.dataSource.data.filter((value,key)=>{
|
||||
return value.booking != row_obj.booking
|
||||
});
|
||||
console.log(this.dataSource)
|
||||
}
|
||||
ngOnInit(): void {
|
||||
this.dataSource = new MatTableDataSource(ELEMENT_DATA)
|
||||
}
|
||||
// addRowData(row_obj){
|
||||
// var d = this.appoinmentsList.data.length+1
|
||||
// console.log(this.appoinmentsList)
|
||||
// console.log(row_obj)
|
||||
// this.appoinmentsList.data.push
|
||||
// ({
|
||||
// id: d,
|
||||
// time: row_obj.time,
|
||||
// booking: row_obj.booking,
|
||||
// workspace: row_obj.workspace,
|
||||
// service: row_obj.service,
|
||||
// staff: row_obj.staff,
|
||||
// customer: row_obj.customer,
|
||||
// payment: row_obj.payment,
|
||||
// status: row_obj.status,
|
||||
// date: row_obj.date,
|
||||
// note: row_obj.note,
|
||||
|
||||
// });
|
||||
// this.table.renderRows();
|
||||
// }
|
||||
// updateRowData(row_obj){
|
||||
// console.log(row_obj)
|
||||
// this.appoinmentsList = this.appoinmentsList.data.filter((value,key)=>{
|
||||
// if(value.id == row_obj.id){
|
||||
// value.time = row_obj.time;
|
||||
// value.booking = row_obj.booking;
|
||||
// value.workspace = row_obj.workspace;
|
||||
// value.service = row_obj.service;
|
||||
// value.staff = row_obj.staff;
|
||||
// value.customer = row_obj.customer;
|
||||
// value.payment = row_obj.payment;
|
||||
// value.status = row_obj.status;
|
||||
// value.date = row_obj.date;
|
||||
// value.note = row_obj.note;
|
||||
// }
|
||||
// return true;
|
||||
// });
|
||||
// }
|
||||
// deleteRowData(row_obj){
|
||||
// console.log(this.appoinmentsList.data,row_obj)
|
||||
// this.appoinmentsList.data = this.appoinmentsList.data.filter((value,key)=>{
|
||||
// return value.booking != row_obj.booking
|
||||
// });
|
||||
// console.log(this.appoinmentsList)
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { ScrollingModule } from '@angular/cdk/scrolling';
|
||||
import { DialogBoxComponent } from './dialog-box/dialog-box.component';
|
||||
import { DemoMaterialModule } from 'app/shared/demo.module';
|
||||
import { NgScrollbarModule } from 'ngx-scrollbar';
|
||||
// import CalendarTodayIcon from '@material-ui/icons/CalendarToday';
|
||||
|
||||
@NgModule({
|
||||
@ -21,7 +22,8 @@ import { DemoMaterialModule } from 'app/shared/demo.module';
|
||||
AppoinmentsRoutingModule,
|
||||
MatSidenavModule,
|
||||
MatFormFieldModule,
|
||||
ScrollingModule,
|
||||
// ScrollingModule,
|
||||
NgScrollbarModule
|
||||
|
||||
]
|
||||
})
|
||||
|
||||
@ -1,9 +1,34 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { environment } from 'environments/environment';
|
||||
import { Observable } from 'rxjs';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AppointmentsService {
|
||||
|
||||
private apiUrl = environment.apiEndpoint;
|
||||
constructor(private _http: HttpClient) { }
|
||||
|
||||
constructor() { }
|
||||
getAppoinmentsListDetails(): Observable<any> {
|
||||
console.log('IN')
|
||||
return this._http.get<any[]>(this.apiUrl + "getAppoinmentsDetails")
|
||||
// .pipe(
|
||||
// catchError(this.handleError('role', []))
|
||||
// )
|
||||
}
|
||||
|
||||
addFormDetails(addParams): Observable<any> {
|
||||
return this._http.post(this.apiUrl + 'CreateAppoinments', addParams)
|
||||
// .pipe(
|
||||
// catchError(this.handleError('role', []))
|
||||
// )
|
||||
}
|
||||
|
||||
|
||||
handleError(arg0: string, arg1: undefined[]): (err: any, caught: Observable<any>) => import("rxjs").ObservableInput<any> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
<mat-icon>close</mat-icon>
|
||||
</button>
|
||||
</h5>
|
||||
<ng-scrollbar class="scrollHV">
|
||||
<div mat-dialog-content class="my-table">
|
||||
<form [formGroup]="form" (ngSubmit)="submit()">
|
||||
<div class="field">
|
||||
@ -38,7 +39,7 @@
|
||||
<mat-error *ngIf="service.hasError('invalidValue')">Please choose any other</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="field">
|
||||
<!-- <div class="field">
|
||||
<label for="name-field" class="label-container">
|
||||
Assign Staff
|
||||
</label>
|
||||
@ -52,6 +53,21 @@
|
||||
<mat-error *ngIf="staff.hasError('required')">Please choose an Staff</mat-error>
|
||||
<mat-error *ngIf="staff.hasError('invalidValue')">Please choose any other</mat-error>
|
||||
</mat-form-field>
|
||||
</div> -->
|
||||
<div class="field">
|
||||
<label for="name-field" class="label-container">
|
||||
Slots
|
||||
</label>
|
||||
<mat-form-field appearance="outline" class="mat-pane">
|
||||
<mat-select placeholder="Select Slot" formControlName="appoinmentSlots" required>
|
||||
<mat-option>--</mat-option>
|
||||
<mat-option *ngFor="let business of slots" [value]="business.appoinmentSlots">
|
||||
{{business.appoinmentSlots}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="appoinmentSlots.hasError('required')">Please choose an Slots</mat-error>
|
||||
<mat-error *ngIf="appoinmentSlots.hasError('invalidValue')">Please choose any other</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="name-field" class="label-container">
|
||||
@ -60,13 +76,15 @@
|
||||
<mat-form-field appearance="outline" class="mate">
|
||||
<mat-datepicker #picker4></mat-datepicker>
|
||||
<mat-datepicker-toggle matPrefix [for]="picker4"></mat-datepicker-toggle>
|
||||
<input matInput [matDatepicker]="picker4" placeholder="Choose a date" formControlName="date">
|
||||
<input matInput [matDatepicker]="picker4" placeholder="Choose a date" formControlName="appoinmentDate" >
|
||||
<!-- {{business.appoinmentDate}} -->
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="mate date-marge">
|
||||
<input type="time" matInput name="week" min="09:00" max="18:00" formControlName="time" />
|
||||
<input type="time" matInput name="week" min="09:00" max="18:00" formControlName="appoinmentTime" />
|
||||
<!-- {{business.appoinmentTime}} -->
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="field">
|
||||
<!-- <div class="field">
|
||||
<label for="name-field" class="label-container">
|
||||
Customer
|
||||
</label>
|
||||
@ -80,13 +98,14 @@
|
||||
<mat-error *ngIf="customer.hasError('required')">Please choose an Customer</mat-error>
|
||||
<mat-error *ngIf="customer.hasError('invalidValue')">Please choose any other</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="field-inline">
|
||||
<label for="name-field" class="label-container">Notes</label>
|
||||
<textarea rows="5" cols="41" name="comment" formControlName="note"></textarea>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</ng-scrollbar>
|
||||
<ng-template #elseTemplate>
|
||||
Sure to delete <b>{{local_data.name}}</b>?
|
||||
</ng-template>
|
||||
|
||||
@ -69,10 +69,10 @@
|
||||
width: 175%!important;
|
||||
}
|
||||
.mate{
|
||||
width: 18%!important;
|
||||
width: 15% !important;
|
||||
}
|
||||
.date-marge{
|
||||
margin-left: 6rem;
|
||||
margin-left: 5.5rem;
|
||||
}
|
||||
.field-inline{
|
||||
display: inline-flex;
|
||||
@ -82,8 +82,12 @@
|
||||
}
|
||||
::ng-deep .mat-dialog-content {
|
||||
max-height: 75vh!important;
|
||||
overflow: hidden!important;
|
||||
overflow: unset!important;
|
||||
// overflow: hidden!important;
|
||||
}
|
||||
::ng-deep .mat-dialog-container{
|
||||
overflow: hidden!important;
|
||||
}
|
||||
.scrollHV {
|
||||
height: calc(100vh - 190px);
|
||||
}
|
||||
@ -4,7 +4,7 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { Router } from '@angular/router';
|
||||
export interface UsersData {
|
||||
// id: number;
|
||||
time: string;
|
||||
appoinmentTime: string;
|
||||
booking: string;
|
||||
workspace: string;
|
||||
service: string;
|
||||
@ -12,7 +12,8 @@ export interface UsersData {
|
||||
customer: string;
|
||||
payment: string;
|
||||
status: string;
|
||||
date: Date;
|
||||
appoinmentDate: Date;
|
||||
appoinmentSlots: string;
|
||||
}
|
||||
@Component({
|
||||
selector: 'app-dialog-box',
|
||||
@ -44,6 +45,21 @@ export class DialogBoxComponent implements OnInit {
|
||||
{staff: 'Kumar.S'},
|
||||
{staff: 'Devi.k'},
|
||||
];
|
||||
appoinmentSlots = new FormControl('', [Validators.required]);
|
||||
slots = [
|
||||
{appoinmentSlots: '9AM - 9.30AM'},
|
||||
{appoinmentSlots: '10AM - 10.30AM'},
|
||||
{appoinmentSlots: '11AM - 11.30AM'},
|
||||
{appoinmentSlots: '12AM - 12.30AM'},
|
||||
{appoinmentSlots: '01PM - 01.30PM'},
|
||||
{appoinmentSlots: '02PM - 02.30PM'},
|
||||
{appoinmentSlots: '03PM - 03.30PM'},
|
||||
{appoinmentSlots: '04PM - 04.30PM'},
|
||||
{appoinmentSlots: '05PM - 05.30PM'},
|
||||
{appoinmentSlots: '06PM - 06.30PM'},
|
||||
{appoinmentSlots: '07PM - 07.30PM'},
|
||||
];
|
||||
|
||||
customer = new FormControl('', [Validators.required]);
|
||||
customers = [
|
||||
{customer: 'A'},
|
||||
@ -91,8 +107,10 @@ export class DialogBoxComponent implements OnInit {
|
||||
workspace: new FormControl('', [Validators.required]),
|
||||
service: new FormControl('', [Validators.required]),
|
||||
staff: new FormControl('', [Validators.required]),
|
||||
date: new FormControl('', [Validators.required]),
|
||||
time: new FormControl('', [Validators.required]),
|
||||
slot: new FormControl('', [Validators.required]),
|
||||
appoinmentDate: new FormControl('', [Validators.required]),
|
||||
appoinmentTime: new FormControl('', [Validators.required]),
|
||||
appoinmentSlots: new FormControl('', [Validators.required]),
|
||||
customer: new FormControl('', [Validators.required]),
|
||||
note: new FormControl('', [Validators.required]),
|
||||
});
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
<h5 mat-dialog-title> <strong>{{action}} Services</strong>
|
||||
<button mat-icon-button type="button" matTooltip="Close" class="button" matTooltipPosition="above" (click)="close()"
|
||||
><mat-icon>close</mat-icon></button></h5>
|
||||
<form [formGroup]="form" (ngSubmit)="submit()">
|
||||
<div mat-dialog-content class="my-table">
|
||||
|
||||
<mat-form-field appearance="outline" *ngIf="action != 'Delete'; else elseTemplate" class="mat-pane">
|
||||
<input placeholder="servicesName" matInput formControlName="servicesName">
|
||||
<mat-error *ngIf="myError('servicesName', 'required')">ServiceName is required</mat-error>
|
||||
<mat-error *ngIf="myError('servicesName', 'maxlength')">Limit exceed</mat-error>
|
||||
</mat-form-field>
|
||||
<ng-template #elseTemplate>
|
||||
Sure to delete <b>{{local_data.servicesName}}</b>?
|
||||
</ng-template>
|
||||
</div>
|
||||
<div mat-dialog-actions>
|
||||
<button mat-button type="submit" class="mat-green" mat-raised-button >{{action}}</button>
|
||||
<button mat-button (click)="closeDialog()" >Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
@ -0,0 +1,11 @@
|
||||
.button{
|
||||
// float: right;
|
||||
margin-bottom: 1rem;
|
||||
background-color: #ffff;
|
||||
margin-top: -1rem;
|
||||
// margin-left: 6rem;
|
||||
float: right;
|
||||
}
|
||||
.mat-pane{
|
||||
width: 20rem;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DialogBoxComponent } from './dialog-box.component';
|
||||
|
||||
describe('DialogBoxComponent', () => {
|
||||
let component: DialogBoxComponent;
|
||||
let fixture: ComponentFixture<DialogBoxComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ DialogBoxComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DialogBoxComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,55 @@
|
||||
import { Component, Inject, OnInit, Optional } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { Router } from '@angular/router';
|
||||
export interface UsersData {
|
||||
servicesName: string;
|
||||
id: number;
|
||||
}
|
||||
@Component({
|
||||
selector: 'app-dialog-box',
|
||||
templateUrl: './dialog-box.component.html',
|
||||
styleUrls: ['./dialog-box.component.scss']
|
||||
})
|
||||
export class DialogBoxComponent implements OnInit {
|
||||
form: FormGroup;
|
||||
local_data:any;
|
||||
action:string;
|
||||
constructor(private router: Router,private formBuilder: FormBuilder,
|
||||
public dialogRef: MatDialogRef<DialogBoxComponent>,
|
||||
@Optional() @Inject(MAT_DIALOG_DATA) public data: UsersData) {
|
||||
console.log(data);
|
||||
this.local_data = {...data};
|
||||
this.action = this.local_data.action;
|
||||
}
|
||||
get f(){
|
||||
return this.form.controls;
|
||||
}
|
||||
|
||||
close() {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
closeDialog(){
|
||||
this.dialogRef.close({event:'Cancel'});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.form = new FormGroup({
|
||||
servicesName: new FormControl('', [Validators.required, Validators.maxLength(20)]),
|
||||
});
|
||||
this.form.patchValue(this.local_data)
|
||||
}
|
||||
|
||||
public myError = (controlName: string, errorName: string) =>{
|
||||
return this.form.controls[controlName].hasError(errorName);
|
||||
}
|
||||
|
||||
submit(){
|
||||
console.log(this.form.value);
|
||||
let tmp = this.form.value
|
||||
tmp.serviceId = this.local_data.serviceId
|
||||
this.dialogRef.close({event:this.action,data:tmp});
|
||||
console.log(this.form.value);
|
||||
console.log(this.action,this.local_data)
|
||||
}
|
||||
}
|
||||
@ -1,9 +1,34 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { environment } from 'environments/environment';
|
||||
import { Observable } from 'rxjs';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ApiServiceService {
|
||||
|
||||
constructor() { }
|
||||
private apiUrl = environment.apiEndpoint;
|
||||
constructor(private _http: HttpClient) { }
|
||||
|
||||
getServicesListDetails(): Observable<any> {
|
||||
console.log('IN')
|
||||
return this._http.get<any[]>(this.apiUrl + "getServicesDetails ")
|
||||
// .pipe(
|
||||
// catchError(this.handleError('role', []))
|
||||
// )
|
||||
}
|
||||
|
||||
addFormDetails(addParams): Observable<any> {
|
||||
return this._http.post(this.apiUrl + 'CreateService', addParams)
|
||||
// .pipe(
|
||||
// catchError(this.handleError('role', []))
|
||||
// )
|
||||
}
|
||||
|
||||
|
||||
handleError(arg0: string, arg1: undefined[]): (err: any, caught: Observable<any>) => import("rxjs").ObservableInput<any> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,11 +4,13 @@ import { CommonModule } from '@angular/common';
|
||||
import { ServiceListRoutingModule } from './service-list-routing.module';
|
||||
import { ServiceListComponent } from './service-list/service-list.component';
|
||||
import { DemoMaterialModule } from 'app/shared/demo.module';
|
||||
import { DialogBoxComponent } from './dialog-box/dialog-box.component';
|
||||
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
ServiceListComponent
|
||||
ServiceListComponent,
|
||||
DialogBoxComponent
|
||||
],
|
||||
imports: [
|
||||
DemoMaterialModule,
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<button mat-button (click)="openDialog('Add',{})" class="button">Add Services</button><br>
|
||||
<div fxLayout="row wrap" >
|
||||
<div fxFlex.xs="100" fxFlex.sm="50" fxFlex.md="50" class="m-gap p-gap flx" *ngFor="let serviceListDetails of serviceData">
|
||||
<div fxFlex.xs="100" fxFlex.sm="50" fxFlex.md="50" class="m-gap p-gap flx" *ngFor="let serviceListDetails of servicesList">
|
||||
<div class="Specialties-list-card">
|
||||
<mat-card class="mb-2 example-card d-flex Specialties-spContent">
|
||||
<div class="consultant-card-cover">
|
||||
@ -10,12 +11,16 @@
|
||||
</div>
|
||||
</div>
|
||||
<mat-card-title-group>
|
||||
<mat-card-title class="service-info mb">{{serviceListDetails.serviceName}}</mat-card-title>
|
||||
<mat-card-title class="service-info mb">{{serviceListDetails.servicesName}}</mat-card-title>
|
||||
<mat-card-title class="info service-list">{{serviceListDetails.info}}</mat-card-title>
|
||||
<span class="Specialties-rightArrow"><img src="https://newassets.apollo247.com/images/ic_arrow_right.svg" alt="Arrow Right - Online Doctor Consultation"></span>
|
||||
<a (click)="openDialog('Update',serviceListDetails)" class="Specialties-rightUpdate"><span class="material-icons edit-color">edit</span></a>
|
||||
<a (click)="confirmBox('Delete',serviceListDetails)" class="Specialties-rightArrow"><span class="material-icons edit-color delete">delete</span></a>
|
||||
<!-- <span class="Specialties-rightArrow"><img src="https://newassets.apollo247.com/images/ic_arrow_right.svg" alt="Arrow Right - Online Doctor Consultation"></span> -->
|
||||
<mat-card-subtitle class="service-Specialties">{{serviceListDetails.specialties}}</mat-card-subtitle>
|
||||
</mat-card-title-group>
|
||||
|
||||
</mat-card-title-group>
|
||||
</mat-card>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -47,11 +47,11 @@ $black_30: rgba(0, 0, 0, 0.3);
|
||||
font-weight: 600;
|
||||
color: #02475b;
|
||||
padding: 10px 0 0;
|
||||
border-top: 1px solid rgba(2,71,91,.3);
|
||||
// border-top: 1px solid rgba(2,71,91,.3);
|
||||
}
|
||||
|
||||
.Specialties-rightArrow{
|
||||
top: 1.5rem;
|
||||
top: 1rem;
|
||||
right: 0;
|
||||
position: absolute;
|
||||
padding-right: 0.5rem;
|
||||
@ -74,5 +74,26 @@ $black_30: rgba(0, 0, 0, 0.3);
|
||||
::ng-deep body .mat-card .mat-card-subtitle {
|
||||
padding-left: 0rem!important;
|
||||
}
|
||||
|
||||
|
||||
.button{
|
||||
float: right;
|
||||
background-color: #4caf50;
|
||||
color: #ffff;
|
||||
}
|
||||
.edit-color{
|
||||
color: rgba(0, 0, 0, 0.54);
|
||||
}
|
||||
.edit-color:hover {
|
||||
color: #4caf50;
|
||||
}
|
||||
.delete:hover {
|
||||
color:#ff0000;
|
||||
}
|
||||
.icon-lft{
|
||||
margin-left: 6rem;
|
||||
}
|
||||
.Specialties-rightUpdate{
|
||||
top: 1rem;
|
||||
right: 0;
|
||||
position: absolute;
|
||||
padding-right: 2.5rem;
|
||||
}
|
||||
|
||||
@ -1,4 +1,9 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import Swal from 'sweetalert2';
|
||||
import { DialogBoxComponent } from '../dialog-box/dialog-box.component';
|
||||
import { ApiServiceService } from '../service-api-services/api-service.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-service-list',
|
||||
@ -7,18 +12,24 @@ import { Component, OnInit } from '@angular/core';
|
||||
})
|
||||
export class ServiceListComponent implements OnInit {
|
||||
// doctors = ['Dr. Sanjeev', 'Dr. Gopi', 'Dr. Surendar', 'Dr. Kamali', 'Dr. Venkatadesh', 'Dr.Javeed', 'Dr.Cyril'];
|
||||
serviceName = ['Allergist and Clinical Immunologist', 'Bariatrics', 'Breast surgery','Cardiology','Cardiothoracic & Vascular Surgery','Cold, Cough and Fever', 'Colorectal Surgery'];
|
||||
// serviceId = ['1', '2', '3'];
|
||||
servicesName = ['Allergist and Clinical Immunologist', 'Bariatrics', 'Breast surgery','Cardiology','Cardiothoracic & Vascular Surgery','Cold, Cough and Fever', 'Colorectal Surgery'];
|
||||
info = ['Manage allergies and treat immunity', 'For obesity-related disorders', 'For breast tissue removal', 'For heart and blood pressure problems', 'For surgical treatments of thoracic organs', 'For common health concerns', 'For disorders of rectum, anus, and colon'];
|
||||
specialties = ['Recurring infections, Immunity deficiency', 'Overweight, BMI over 30', 'Breast tissue surgery & removal, Mastectomy', 'Chest pain, Heart Failure, Cholesterol', 'Heart & lung disease, Cardiac transplantation','Fever, Eye Infection, Stomach Ache, Headache', 'Inflammatory bowel disease, Fistula, Intestinal blockage'];
|
||||
serviceData: any = [];
|
||||
constructor() { }
|
||||
addFormData: any;
|
||||
push: any;
|
||||
id: number;
|
||||
serviceId: number;
|
||||
public servicesList:any = new MatTableDataSource();
|
||||
constructor(public _api:ApiServiceService, public dialog: MatDialog) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
|
||||
for (let i = 0; i < 7; i++) {
|
||||
const random = i % 7;
|
||||
const obj: any = {
|
||||
serviceName: this.serviceName[random],
|
||||
servicesName: this.servicesName[random],
|
||||
// isFavourite: i % 5 === 0 ? true : false,
|
||||
// doctors: this.doctors,
|
||||
info: this.info[random],
|
||||
@ -27,8 +38,130 @@ export class ServiceListComponent implements OnInit {
|
||||
// state: state[i % 4],
|
||||
//version: this.dropdown[0].name,
|
||||
};
|
||||
this.serviceData.push(obj);
|
||||
// this.serviceData.push(obj);
|
||||
}
|
||||
this.getServicesList()
|
||||
}
|
||||
|
||||
getServicesList() {
|
||||
//this._pd.getTabStatusPdDetails(this.tabStatus)
|
||||
this._api.getServicesListDetails().subscribe(res => {
|
||||
if (res.status == 200) {
|
||||
this.servicesList = res.data;
|
||||
// console.log(this.servicesList)
|
||||
// this.dataSource = res.data.length;
|
||||
// console.log(this.dataSource)
|
||||
// this.dataSource.data = this.servicesList;
|
||||
// console.log(this.dataSource.data)
|
||||
// this.recordStatus=false;
|
||||
}
|
||||
else{
|
||||
// this.servicesList=[];
|
||||
// this.dataSource = null;
|
||||
// this.recordStatus=true;
|
||||
}
|
||||
}
|
||||
,error => {
|
||||
// this.errorMessage.push(error);
|
||||
// this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||
// alert(error.html_format);
|
||||
});
|
||||
}
|
||||
|
||||
confirmBox(event,element){
|
||||
console.log(event,element)
|
||||
Swal.fire({
|
||||
title: 'Are you sure want to remove?',
|
||||
text: 'You will not be able to recover this file!',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Yes, delete it!',
|
||||
cancelButtonText: 'No, keep it'
|
||||
}).then((result) => {
|
||||
if (result.value) {
|
||||
// this.deleteRowData(element);
|
||||
this.formAddUpdateAndDelete(event,element)
|
||||
Swal.fire(
|
||||
'Deleted!',
|
||||
'Your imaginary file has been deleted.',
|
||||
'success'
|
||||
)
|
||||
} else if (result.dismiss === Swal.DismissReason.cancel) {
|
||||
Swal.fire(
|
||||
'Cancelled',
|
||||
'Your imaginary file is safe :)',
|
||||
'error'
|
||||
)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
openDialog(action,obj) {
|
||||
obj.action = action;
|
||||
const dialogRef = this.dialog.open(DialogBoxComponent, {
|
||||
width: '39%',
|
||||
height: '100%',
|
||||
// maxWidth: '38vw',
|
||||
position: { right: '0' },
|
||||
data:obj
|
||||
});
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
if(result != undefined){
|
||||
console.log(result)
|
||||
this.formAddUpdateAndDelete(result,result.data)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
formAddUpdateAndDelete(result,row_obj){
|
||||
console.log(result,row_obj)
|
||||
let formValue = []
|
||||
if(result.event == 'Add'){
|
||||
console.log('add')
|
||||
let addFormData = {
|
||||
// busId: 'abc123',
|
||||
// id: row_obj.id,
|
||||
|
||||
serviceId: row_obj.serviceId,
|
||||
servicesName: row_obj.servicesName
|
||||
};
|
||||
formValue.push(addFormData);
|
||||
}else if(result.event == 'Update'){
|
||||
console.log(row_obj)
|
||||
console.log('Update')
|
||||
let updatevalue = { serviceId: row_obj.serviceId,
|
||||
servicesName: row_obj.servicesName }
|
||||
formValue.push(updatevalue);
|
||||
}
|
||||
else if(result == 'Delete'){
|
||||
console.log('delete')
|
||||
let val = {
|
||||
isActive:0,
|
||||
serviceId: row_obj.serviceId
|
||||
}
|
||||
formValue.push(val);
|
||||
}
|
||||
|
||||
// var d = this.customersList.length+1
|
||||
console.log(formValue[0])
|
||||
this._api.addFormDetails(formValue[0]).subscribe(res => {
|
||||
if (res.status == 200) {
|
||||
// this.customersList = res.data;
|
||||
this.getServicesList()
|
||||
}
|
||||
else{
|
||||
// this.customersList=[];
|
||||
// this.dataSource = null;
|
||||
// this.recordStatus=true;
|
||||
}
|
||||
}
|
||||
// , error => {this.errorMessage = <any> error});
|
||||
,error => {
|
||||
// this.errorMessage.push(error);
|
||||
// this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||
// alert(error.html_format);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user