appointment changes
This commit is contained in:
parent
c30cd6712b
commit
13077edf1c
20664
ng-seed/package-lock.json
generated
20664
ng-seed/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -82,6 +82,8 @@ export class AppoinmentsListComponent implements OnInit {
|
||||
if (res.status == 200) {
|
||||
this.isLoading = false
|
||||
this.appoinmentsList = res.data;
|
||||
localStorage.setItem('busId', res.data[0].busId
|
||||
)
|
||||
console.log(this.appoinmentsList)
|
||||
this.appointmentListLength = res.data.length;
|
||||
console.log(this.appointmentListLength)
|
||||
|
||||
@ -10,7 +10,8 @@ import { DialogBoxComponent } from './dialog-box/dialog-box.component';
|
||||
import { DemoMaterialModule } from 'app/shared/demo.module';
|
||||
import { NgScrollbarModule } from 'ngx-scrollbar';
|
||||
import { NotifierModule, NotifierOptions } from 'angular-notifier';
|
||||
import { DataTableModule } from 'ornamentum'
|
||||
import { DataTableModule } from 'ornamentum';
|
||||
import { AppointmentAddcustomerComponent } from './appointment-addcustomer/appointment-addcustomer.component'
|
||||
// import CalendarTodayIcon from '@material-ui/icons/CalendarToday';
|
||||
|
||||
|
||||
@ -58,7 +59,8 @@ const customNotifierOptions: NotifierOptions = {
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppoinmentsListComponent,
|
||||
DialogBoxComponent
|
||||
DialogBoxComponent,
|
||||
AppointmentAddcustomerComponent
|
||||
],
|
||||
imports: [
|
||||
DemoMaterialModule,
|
||||
|
||||
@ -0,0 +1,39 @@
|
||||
|
||||
<mat-card class="cardDesign2" >
|
||||
<form [formGroup]="form" (ngSubmit)="submit()">
|
||||
<div class="pad">
|
||||
<h6 class="new">+ New Customer <button mat-icon-button type="button" matTooltip="Close" class="button" matTooltipPosition="above" ><mat-icon>close</mat-icon></button></h6>
|
||||
|
||||
<mat-form-field appearance="outline" class="card-mat-pane">
|
||||
<mat-label>Name</mat-label>
|
||||
<input placeholder=" Name" formControlName="name" matInput>
|
||||
<!-- <mat-error *ngIf="myError('cusName', 'required')">Name is required</mat-error>
|
||||
<mat-error *ngIf="myError('cusName', 'maxlength')">Limit exceed</mat-error> -->
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="card-mat-pane">
|
||||
<mat-label>Email</mat-label>
|
||||
<input type="email" placeholder=" Email" formControlName="email" matInput >
|
||||
<!-- <mat-error *ngIf="!form.get('email')?.errors?.required && (form.get('email')?.errors?.pattern)">
|
||||
Please enter a valid email address
|
||||
</mat-error>
|
||||
<mat-error *ngIf="myError('email', 'required')">email is required</mat-error>
|
||||
<mat-error *ngIf="form.get('email')?.invalid && (form.get('email')?.dirty || form.get('email')?.touched) && form.get('email')?.errors?.required">
|
||||
Email is required
|
||||
</mat-error> -->
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="card-mat-pane">
|
||||
<mat-label>Phone</mat-label>
|
||||
<input placeholder=" Phone" matInput formControlName="phoneNo">
|
||||
<!-- <mat-error *ngIf="myError('phoneNo', 'required')">Contact No is required</mat-error>
|
||||
<mat-error *ngIf="myError('phoneNo', 'pattern')">Invalid Contact No </mat-error>
|
||||
<mat-error *ngIf="myError('phoneNo', 'minlength')"> Contact No must be at least 10 characters</mat-error>
|
||||
<mat-error *ngIf="myError('phoneNo', 'maxlength')">Limit exceed</mat-error> -->
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="popup-button">
|
||||
<!-- <span class="buttons cancel" (click)="close()">Cancel</span> -->
|
||||
<button type="button"class="buttons cancel" (click)="close()" >Cancel</button>
|
||||
<button type="submit"class="buttons add" (click)="save()" >Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</mat-card>
|
||||
@ -0,0 +1,252 @@
|
||||
$color_red_orange_approx: #107c14;
|
||||
$white: #fff;
|
||||
$black_10: rgba(0, 0, 0, 0.1);
|
||||
$black_30: rgba(0, 0, 0, 0.3);
|
||||
$icon-size: 3rem;
|
||||
$icon-color: #D8D8D8;
|
||||
$main-color: #f44336;
|
||||
$tem-color : #217e69;
|
||||
.mat-pane{
|
||||
width: 27rem;
|
||||
}
|
||||
.button{
|
||||
margin-bottom: 1rem;
|
||||
background-color: #ffff!important;
|
||||
margin-top: -1rem;
|
||||
position: absolute;
|
||||
right: 20px;
|
||||
}
|
||||
::ng-deep .mat-card.settings-panel {
|
||||
position: inherit;
|
||||
bottom: 0px;
|
||||
right: 0px;
|
||||
width: 100%;
|
||||
z-index: 9;
|
||||
top: 58px;
|
||||
}
|
||||
|
||||
::ng-deep body .mat-card {
|
||||
box-shadow:none!important;
|
||||
}
|
||||
|
||||
// @include media-breakpoint-down(lg) {
|
||||
// padding-top: 150px;
|
||||
// }
|
||||
// @include media-breakpoint-down(md) {
|
||||
// padding-top: 100px;
|
||||
// }
|
||||
// @include media-breakpoint-down(sm) {
|
||||
// padding-top: 100px;
|
||||
// }
|
||||
|
||||
|
||||
// @media only screen and (max-width: 600px) {
|
||||
// .cdk-overlay-pane{
|
||||
// width: 90%!important;
|
||||
// }
|
||||
// }
|
||||
|
||||
@media (max-width: 959px){
|
||||
.cdk-overlay-pane{
|
||||
width: 90%!important;
|
||||
}
|
||||
}
|
||||
|
||||
.field{
|
||||
display: flex;
|
||||
}
|
||||
.label-container{
|
||||
flex: 1;
|
||||
color: #666;
|
||||
position: relative;
|
||||
text-transform: capitalize;
|
||||
width: 100px;
|
||||
flex: none;
|
||||
margin-right: 20px;
|
||||
align-self: flex-start;
|
||||
padding-top: 20px;
|
||||
box-sizing: border-box;
|
||||
line-height: 15px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.Date-container{
|
||||
margin-right: 40px!important;
|
||||
}
|
||||
// ::ng-deep .mat-form-field-appearance-outline .mat-form-field-wrapper {
|
||||
// margin: 0.25em 0;
|
||||
// width: 175%!important;
|
||||
// }
|
||||
.mate{
|
||||
width: 43% !important;
|
||||
}
|
||||
.date-marge{
|
||||
margin-left: 1.5rem;
|
||||
}
|
||||
.field-inline{
|
||||
display: inline-flex;
|
||||
}
|
||||
// ::ng-deep .swal2-height-auto {
|
||||
// // height: auto!important;
|
||||
// }
|
||||
::ng-deep .mat-dialog-content {
|
||||
max-height: 75vh!important;
|
||||
overflow: unset!important;
|
||||
// overflow: hidden!important;
|
||||
}
|
||||
::ng-deep .mat-dialog-container{
|
||||
overflow: hidden!important;
|
||||
}
|
||||
.scrollHV {
|
||||
height: calc(100vh - 190px);
|
||||
}
|
||||
.notes{
|
||||
margin-left: 7.5rem;
|
||||
margin-top: 2rem;
|
||||
color: #666;
|
||||
}
|
||||
//popup
|
||||
.card {
|
||||
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
|
||||
transition: 0.3s;
|
||||
width: 100%;
|
||||
// padding: 10px;
|
||||
}
|
||||
.topnav {
|
||||
overflow: hidden;
|
||||
background: #52518F;
|
||||
color: #ffff;
|
||||
text-align: center;
|
||||
padding: 15px;
|
||||
// display: flex;
|
||||
}
|
||||
.days{
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
border-bottom: 1px solid #ccc;
|
||||
padding: 5px;
|
||||
}
|
||||
// .flexxx{
|
||||
|
||||
// display: flex;
|
||||
// // margin-top: 1rem;
|
||||
// // border-top:1px solid #ccc;
|
||||
// }
|
||||
// .date-time{
|
||||
// position: absolute;
|
||||
// // top: -11px;
|
||||
// bottom: 0px;
|
||||
// }
|
||||
// .date-position{
|
||||
// position: relative;
|
||||
// }
|
||||
.add-customer{
|
||||
padding: 5px;
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.navStyle{
|
||||
width: 100%;
|
||||
height: 3rem;
|
||||
background-color: #227f6e;
|
||||
color: #fff;
|
||||
}
|
||||
.innerdivs{
|
||||
width:100%;
|
||||
// float:left;
|
||||
}
|
||||
.innerdivs2{
|
||||
width:100%;
|
||||
// float:left;
|
||||
text-align: center;
|
||||
margin-bottom: 1rem !important;
|
||||
}
|
||||
.cardDesign{
|
||||
border: 1px solid #e8edef;
|
||||
width: 89%;
|
||||
background-color: #227f6e21;
|
||||
// box-shadow: 0 2px 0 rgb(0 0 0 / 3%)
|
||||
}
|
||||
.hoverButton{
|
||||
background: $white;
|
||||
// box-shadow: 0 2px 6px $tem-color;
|
||||
transition: all 0.1s ease-in-out 0s;
|
||||
&:hover {
|
||||
box-shadow: 0 0 8px $tem-color;
|
||||
|
||||
transform: scale(1.05);
|
||||
}
|
||||
}
|
||||
.primary{
|
||||
background-color: #00866e00;
|
||||
color: brown;
|
||||
width: auto;
|
||||
border: 1px solid brown;
|
||||
cursor: pointer;
|
||||
}
|
||||
.clickedSlot{
|
||||
color: white !important;
|
||||
background-color: brown !important;
|
||||
cursor: pointer !important;
|
||||
width: auto;
|
||||
}
|
||||
.bookedSlot{
|
||||
background-color: darkgrey;
|
||||
color: white;
|
||||
width: 6rem;
|
||||
cursor: no-drop !important;
|
||||
}
|
||||
.newCustomer{
|
||||
color: #227f6e;
|
||||
text-align: center;
|
||||
border: 1px solid #e8edef;
|
||||
}
|
||||
|
||||
.cardDesign2{
|
||||
border: 1px dashed #227f6e;
|
||||
width: 75%;
|
||||
height: 348px;
|
||||
margin-left: 3rem;
|
||||
background-color: #fcfcfc;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
.card-mat-pane{
|
||||
width: 20rem;
|
||||
}
|
||||
.new{
|
||||
color: #227f6e;
|
||||
margin-top: 0px !important;
|
||||
}
|
||||
.popup-button {
|
||||
// margin-top: 2rem;
|
||||
width: 100%;
|
||||
}
|
||||
.cancel {
|
||||
background: #F5F5F5;
|
||||
color: #111;
|
||||
float: left;
|
||||
cursor: pointer;
|
||||
}
|
||||
.buttons {
|
||||
width: 50%;
|
||||
background: #FFF;
|
||||
color: #111;
|
||||
font-size: 15px;
|
||||
// font-family: zohopuvi-medium;
|
||||
text-align: center;
|
||||
border-top: 1px solid #E2E2E2;
|
||||
padding: 10px;
|
||||
-webkit-transition: all .2s ease-in;
|
||||
-moz-transition: all .2s ease-in;
|
||||
transition: all .2s ease-in;
|
||||
}
|
||||
.add {
|
||||
background-color: #4caf50;
|
||||
color: #FFF;
|
||||
border-top: 1px solid #4caf50;
|
||||
float: left;
|
||||
cursor: pointer;
|
||||
}
|
||||
.pad{
|
||||
padding: 20px !important;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AppointmentAddcustomerComponent } from './appointment-addcustomer.component';
|
||||
|
||||
describe('AppointmentAddcustomerComponent', () => {
|
||||
let component: AppointmentAddcustomerComponent;
|
||||
let fixture: ComponentFixture<AppointmentAddcustomerComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ AppointmentAddcustomerComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AppointmentAddcustomerComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,52 @@
|
||||
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
|
||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { AppointmentsService } from '../appointments-service/appointments.service';
|
||||
import { CustomersService } from 'app/appoinment/customers/customers-service/customers.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-appointment-addcustomer',
|
||||
templateUrl: './appointment-addcustomer.component.html',
|
||||
styleUrls: ['./appointment-addcustomer.component.scss']
|
||||
})
|
||||
export class AppointmentAddcustomerComponent implements OnInit {
|
||||
form: FormGroup;
|
||||
@Output() childButtonEvent = new EventEmitter();
|
||||
constructor(public _app:AppointmentsService,public _cus:CustomersService) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.form = new FormGroup({
|
||||
name: new FormControl('', [Validators.required]),
|
||||
email: new FormControl('', [Validators.required]),
|
||||
phoneNo: new FormControl('', [Validators.required]),
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
save(){
|
||||
|
||||
}
|
||||
close(){
|
||||
|
||||
}
|
||||
submit(){
|
||||
|
||||
console.log(this.form.value)
|
||||
|
||||
|
||||
|
||||
let form ={
|
||||
"cusName":this.form.value.name,
|
||||
"email":this.form.value.email,
|
||||
"phoneNo":this.form.value.phoneNo,
|
||||
"busId":localStorage.getItem('busId')
|
||||
|
||||
}
|
||||
this._cus.addFormDetails(form).subscribe(res => {
|
||||
if (res.status == 200) {
|
||||
this.childButtonEvent.emit(res);
|
||||
// this._app.customerlist.next(res)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,14 +1,16 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { environment } from 'environments/environment';
|
||||
import { Observable } from 'rxjs';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AppointmentsService {
|
||||
|
||||
|
||||
public customerlist:BehaviorSubject<any> = new BehaviorSubject<any>([]);
|
||||
public customerlist_observable$ = this.customerlist.asObservable();
|
||||
private apiUrl = environment.apiEndpoint;
|
||||
constructor(private _http: HttpClient) { }
|
||||
|
||||
@ -33,6 +35,10 @@ export class AppointmentsService {
|
||||
// catchError(this.handleError('role', []))
|
||||
// )
|
||||
}
|
||||
getSlots(Params){
|
||||
|
||||
return this._http.post(this.apiUrl + 'getSlots', Params)
|
||||
}
|
||||
|
||||
|
||||
handleError(arg0: string, arg1: undefined[]): (err: any, caught: Observable<any>) => import("rxjs").ObservableInput<any> {
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
<ng-scrollbar class="scrollHV">
|
||||
<div mat-dialog-content class="my-table">
|
||||
|
||||
<mat-form-field appearance="outline" class="mat-pane">
|
||||
<!-- <mat-form-field appearance="outline" class="mat-pane">
|
||||
<mat-label>Business</mat-label>
|
||||
<mat-select placeholder="Select Business" formControlName="busname" required>
|
||||
<mat-option *ngFor="let business of name" [value]="business.busname">
|
||||
@ -15,21 +15,28 @@
|
||||
</mat-select>
|
||||
<mat-error *ngIf="service.hasError('required')">Please choose an Business</mat-error>
|
||||
<mat-error *ngIf="service.hasError('invalidValue')">Please choose any other</mat-error>
|
||||
</mat-form-field>
|
||||
</mat-form-field> -->
|
||||
|
||||
<mat-form-field appearance="outline" class="mat-pane">
|
||||
<mat-label>Business</mat-label>
|
||||
<input matInput placeholder="Business" name="Business" formControlName="busname" readonly>
|
||||
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="mat-pane">
|
||||
<mat-label>Service</mat-label>
|
||||
<mat-select placeholder="Select Service" formControlName="service" required>
|
||||
<mat-option>--</mat-option>
|
||||
<mat-option *ngFor="let business of select" [value]="business.service">
|
||||
{{business.service}}
|
||||
<mat-option *ngFor="let business of servicesList_array" (click)="serviceData(business)" [value]="business.serviceId
|
||||
">
|
||||
{{business.servicesName}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="service.hasError('required')">Please choose an Service</mat-error>
|
||||
<mat-error *ngIf="service.hasError('invalidValue')">Please choose any other</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="mat-pane">
|
||||
<!-- <mat-form-field appearance="outline" class="mat-pane">
|
||||
<mat-label>Practitioner</mat-label>
|
||||
<mat-select placeholder="Select Practitioner" formControlName="practitioner" required>
|
||||
<mat-option>--</mat-option>
|
||||
@ -39,7 +46,12 @@
|
||||
</mat-select>
|
||||
<mat-error *ngIf="service.hasError('required')">Please choose an Practitioner</mat-error>
|
||||
<mat-error *ngIf="service.hasError('invalidValue')">Please choose any other</mat-error>
|
||||
</mat-form-field>
|
||||
</mat-form-field> -->
|
||||
<mat-form-field appearance="outline" class="mat-pane">
|
||||
<mat-label>Practitioner</mat-label>
|
||||
<input matInput placeholder="practitioner" name="practitioner" formControlName="practitioner" readonly>
|
||||
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="mate">
|
||||
<mat-label>Choose a date</mat-label>
|
||||
@ -49,7 +61,7 @@
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="mate date-marge" (click)="toggle()" id="bt">
|
||||
<mat-label>Choose a Time</mat-label>
|
||||
<input matInput placeholder="Select Time" name="week" formControlName="appoinmentTime">
|
||||
<input matInput placeholder="Select Time" name="week" [readonly]="!form.get('service').value" formControlName="appoinmentTime">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-card class="cardDesign" *ngIf="show">
|
||||
@ -58,8 +70,8 @@
|
||||
</div>
|
||||
<div class="innerdivs2" >
|
||||
<!-- <button *ngFor="let slot of slots;let i=index" mat-raised-button class="mr-1 mt-1 hoverButton" [ngClass]="{'primary':slotIndex != i,'clickedSlot':slotIndex == i } " (click)="toggleActive($event,slot,i)" >{{slot | date:'shortTime'}}</button> -->
|
||||
<button mat-raised-button class="mr-1 mt-1 hoverButton buttontimeline" >09:30am</button>
|
||||
<button mat-raised-button class="mr-1 mt-1 hoverButton buttontimeline" >09:45am</button>
|
||||
<button type="button" *ngFor="let slot of slots;let i=index" mat-raised-button class="mr-1 mt-1 hoverButton buttontimeline" (click)="toggleActive($event,slot,i)">{{slot | date:'shortTime'}}</button>
|
||||
<!-- <button mat-raised-button class="mr-1 mt-1 hoverButton buttontimeline" >09:45am</button>
|
||||
<button mat-raised-button class="mr-1 mt-1 hoverButton buttontimeline" >10:00am</button>
|
||||
<button mat-raised-button class="mr-1 mt-1 hoverButton buttontimeline" >10:15am</button>
|
||||
<button mat-raised-button class="mr-1 mt-1 hoverButton buttontimeline" >10:30am</button>
|
||||
@ -67,7 +79,7 @@
|
||||
<button mat-raised-button class="mr-1 mt-1 hoverButton buttontimeline" >11:00am</button>
|
||||
<button mat-raised-button class="mr-1 mt-1 hoverButton buttontimeline" >11:15am</button>
|
||||
<button mat-raised-button class="mr-1 mt-1 hoverButton buttontimeline" >11:30am</button>
|
||||
<button mat-raised-button class="mr-1 mt-1 hoverButton buttontimeline" >11:45am</button>
|
||||
<button mat-raised-button class="mr-1 mt-1 hoverButton buttontimeline" >11:45am</button> -->
|
||||
</div>
|
||||
</mat-card>
|
||||
|
||||
@ -76,54 +88,22 @@
|
||||
<mat-select placeholder="Select Customer" formControlName="customer" required>
|
||||
<!-- <div class="add-customer"> Add customer</div> -->
|
||||
<mat-option class="newCustomer" (click)="addCustomerList(1)">+ New Customer</mat-option>
|
||||
<mat-option *ngFor="let business of customers" [value]="business.customer">
|
||||
{{business.customer}}
|
||||
<mat-option *ngFor="let business of customersList" [value]="business.id" (click)="customerIdvalue(business.id)" >
|
||||
{{business.cusName
|
||||
}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<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>
|
||||
|
||||
<mat-card class="cardDesign2" *ngIf="customerCard == 1">
|
||||
<div class="pad">
|
||||
<h6 class="new">+ New Customer <button mat-icon-button type="button" matTooltip="Close" class="button" matTooltipPosition="above" (click)="addCustomerList(0)"><mat-icon>close</mat-icon></button></h6>
|
||||
<mat-form-field appearance="outline" class="card-mat-pane">
|
||||
<mat-label>Name</mat-label>
|
||||
<input placeholder=" Name" matInput>
|
||||
<!-- <mat-error *ngIf="myError('cusName', 'required')">Name is required</mat-error>
|
||||
<mat-error *ngIf="myError('cusName', 'maxlength')">Limit exceed</mat-error> -->
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="card-mat-pane">
|
||||
<mat-label>Email</mat-label>
|
||||
<input type="email" placeholder=" Email" matInput >
|
||||
<!-- <mat-error *ngIf="!form.get('email')?.errors?.required && (form.get('email')?.errors?.pattern)">
|
||||
Please enter a valid email address
|
||||
</mat-error>
|
||||
<mat-error *ngIf="myError('email', 'required')">email is required</mat-error>
|
||||
<mat-error *ngIf="form.get('email')?.invalid && (form.get('email')?.dirty || form.get('email')?.touched) && form.get('email')?.errors?.required">
|
||||
Email is required
|
||||
</mat-error> -->
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="card-mat-pane">
|
||||
<mat-label>Phone</mat-label>
|
||||
<input placeholder=" Phone" matInput >
|
||||
<!-- <mat-error *ngIf="myError('phoneNo', 'required')">Contact No is required</mat-error>
|
||||
<mat-error *ngIf="myError('phoneNo', 'pattern')">Invalid Contact No </mat-error>
|
||||
<mat-error *ngIf="myError('phoneNo', 'minlength')"> Contact No must be at least 10 characters</mat-error>
|
||||
<mat-error *ngIf="myError('phoneNo', 'maxlength')">Limit exceed</mat-error> -->
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="popup-button">
|
||||
<span class="buttons cancel" (click)="close()">Cancel</span>
|
||||
<span (click)="save()" class="buttons add">Save</span>
|
||||
</div>
|
||||
</mat-card>
|
||||
|
||||
<mat-form-field appearance="outline" class="mat-pane">
|
||||
<app-appointment-addcustomer (childButtonEvent)="receivedMessageHandler($event)"
|
||||
(onInitEvent)="receiveAutoMsgHandler($event)" *ngIf="customerCard == 1"></app-appointment-addcustomer>
|
||||
|
||||
<!-- <mat-form-field appearance="outline" class="mat-pane">
|
||||
<mat-label>Customer</mat-label>
|
||||
<mat-label>Description</mat-label>
|
||||
<textarea matInput rows="5" cols="40" placeholder="Description" formControlName="note"></textarea>
|
||||
</mat-form-field>
|
||||
</mat-form-field> -->
|
||||
|
||||
<div class="notes">
|
||||
<input type="checkbox" id="scales" name="scales" checked>
|
||||
@ -141,4 +121,5 @@
|
||||
<button mat-button type="submit" class="mat-green" mat-raised-button >{{action}}</button>
|
||||
<button mat-button (click)="closeDialog()" >Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
<notifier-container></notifier-container>
|
||||
@ -165,7 +165,7 @@ $tem-color : #217e69;
|
||||
border: 1px solid #e8edef;
|
||||
width: 89%;
|
||||
background-color: #227f6e21;
|
||||
box-shadow: 0 2px 0 rgb(0 0 0 / 3%)
|
||||
// box-shadow: 0 2px 0 rgb(0 0 0 / 3%)
|
||||
}
|
||||
.hoverButton{
|
||||
background: $white;
|
||||
|
||||
@ -2,6 +2,12 @@ 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';
|
||||
import { AppointmentsService } from '../appointments-service/appointments.service';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { ConsultantService } from 'app/appoinment/consultant-setting/consultant-service/consultant.service';
|
||||
import { CustomersService } from 'app/appoinment/customers/customers-service/customers.service';
|
||||
import { EndUserService } from 'app/end-user/end-user.service';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
export interface UsersData {
|
||||
// id: number;
|
||||
busname: string;
|
||||
@ -78,28 +84,30 @@ export class DialogBoxComponent implements OnInit {
|
||||
{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'},
|
||||
];
|
||||
slots:any =[];
|
||||
|
||||
clicks:any = 0;
|
||||
customerCard: any;
|
||||
constructor(private router: Router,private formBuilder: FormBuilder,
|
||||
public dialogRef: MatDialogRef<DialogBoxComponent>,
|
||||
@Optional() @Inject(MAT_DIALOG_DATA) public data: UsersData) {
|
||||
slot_array: any;
|
||||
date: any;
|
||||
servicesList_array: any[];
|
||||
servicesList_data: any;
|
||||
assignService: any=[];
|
||||
duration: any;
|
||||
userData: any;
|
||||
appoinmentsIds: any=[];
|
||||
customersList: any;
|
||||
customerId: any;
|
||||
slotsResult: any;
|
||||
ServiceId: any;
|
||||
constructor(private notifierService: NotifierService,private router: Router,private formBuilder: FormBuilder, public _cus:CustomersService,
|
||||
public dialogRef: MatDialogRef<DialogBoxComponent>,public _api:ConsultantService, public _con:ConsultantService,
|
||||
@Inject(MAT_DIALOG_DATA) public data: UsersData,public _app:AppointmentsService,public end_user:EndUserService) {
|
||||
console.log(data);
|
||||
this.local_data = {...data};
|
||||
this.action = this.local_data.action;
|
||||
|
||||
|
||||
}
|
||||
get f(){
|
||||
return this.form.controls;
|
||||
@ -139,6 +147,20 @@ export class DialogBoxComponent implements OnInit {
|
||||
|
||||
|
||||
ngOnInit() {
|
||||
// this._app.customerlist_observable$.subscribe((res) => {
|
||||
// console.log('cus', res);
|
||||
|
||||
// if(res){
|
||||
|
||||
|
||||
// }
|
||||
|
||||
// })
|
||||
this.getSlots()
|
||||
let userId = localStorage.getItem('user_id')
|
||||
let busId = localStorage.getItem('busId')
|
||||
this.getServicesList(userId, busId)
|
||||
this.getApiData()
|
||||
this.form = new FormGroup({
|
||||
busname: new FormControl('', [Validators.required]),
|
||||
service: new FormControl('', [Validators.required]),
|
||||
@ -146,23 +168,63 @@ export class DialogBoxComponent implements OnInit {
|
||||
appoinmentDate: new FormControl('', [Validators.required]),
|
||||
appoinmentTime: new FormControl('', [Validators.required]),
|
||||
customer: new FormControl('', [Validators.required]),
|
||||
note: new FormControl('', [Validators.required]),
|
||||
// note: new FormControl('', [Validators.required]),
|
||||
|
||||
workspace: new FormControl('', [Validators.required]),
|
||||
staff: new FormControl('', [Validators.required]),
|
||||
slot: new FormControl('', [Validators.required]),
|
||||
|
||||
|
||||
|
||||
appoinmentSlots: new FormControl('', [Validators.required]),
|
||||
|
||||
});
|
||||
console.log(this.local_data, this.selects)
|
||||
// this.form.controls['note'].setValue('Sample')
|
||||
this.form.patchValue(this.local_data)
|
||||
let id = localStorage.getItem('user_id')
|
||||
console.log(id)
|
||||
this._con.getUsersListDetails(id).subscribe(res => {
|
||||
if (res.status == 200) {
|
||||
console.log(res)
|
||||
|
||||
this.userData = res.data[0]
|
||||
this.form.controls['busname'].setValue( this.userData.BusinessDetails[0].busName
|
||||
);
|
||||
|
||||
this.form.controls['practitioner'].setValue( this.userData.userName);
|
||||
}
|
||||
})
|
||||
}
|
||||
public myError = (controlName: string, errorName: string) =>{
|
||||
return this.form.controls[controlName].hasError(errorName);
|
||||
}
|
||||
submit(){
|
||||
console.log(this.form.value);
|
||||
|
||||
let paramsmap= {
|
||||
"serviceId": ""+this.ServiceId+"",
|
||||
"userId":localStorage.getItem('user_id'),
|
||||
"busId": localStorage.getItem('busId')
|
||||
}
|
||||
this.end_user.CreatecusServicesMapDetails(paramsmap).subscribe(res => {
|
||||
if (res.status == 200) {
|
||||
let serviceMap = res['data'][0].id
|
||||
let paramsData= {
|
||||
"busId": localStorage.getItem('busId'),
|
||||
"cusId": this.customerId,
|
||||
"appoinmentDate": this.form.value.appoinmentDate,
|
||||
"appoinmentTime": this.form.value.appoinmentTime,
|
||||
"serviceMap":serviceMap,
|
||||
"appoinmentSlots": this.slotsResult,
|
||||
//"servicemap" :this.bookedAppointment_servicemap
|
||||
}
|
||||
console.log(paramsData)
|
||||
this._app.addFormDetails(paramsData).subscribe(res => {
|
||||
if (res.status == 200) {
|
||||
this.notifierService.notify('success', 'Appointment Added Successfully');
|
||||
this.dialogRef.close();
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -189,4 +251,149 @@ export class DialogBoxComponent implements OnInit {
|
||||
save(){
|
||||
|
||||
}
|
||||
|
||||
getSlots(){
|
||||
let id = localStorage.getItem('user_id')
|
||||
let params ={"id": id}
|
||||
this._app.getSlots(params).subscribe((res:any) => {
|
||||
if (res.status == 200) {
|
||||
console.log(res)
|
||||
let data = res['data'];
|
||||
this.slots = data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
toggleActive(event:any,param:any,i:any){
|
||||
console.log(event,param,i)
|
||||
this.slot_array =[];
|
||||
// debugger;
|
||||
// // event.preventDefault();
|
||||
// this.slotIndex = i
|
||||
// this.slotTime = param
|
||||
let resultDate = new DatePipe('en-US').transform(param, 'shortTime')
|
||||
this.form.controls['appoinmentTime'].setValue(resultDate)
|
||||
this.date= param
|
||||
console.log(this.date,param,this.duration)
|
||||
let thirtyMinutes = this.duration * 60 * 1000; // convert 30 minutes to milliseconds
|
||||
let date1 = new Date(param);
|
||||
let date2 = new Date(date1.getTime() + thirtyMinutes);
|
||||
console.log(date1);
|
||||
console.log(date2);
|
||||
const currentTime = new Date(); // Get the current time
|
||||
//const filteredTimes = this.slots.filter(time => new Date(time) > date1);
|
||||
|
||||
const rangeDate = new Date(date2);
|
||||
|
||||
const resultArray = this.slots.filter(slot => {
|
||||
const date = new Date(slot);
|
||||
return date >= rangeDate;
|
||||
});
|
||||
|
||||
const firstSlt = new Date(date1);
|
||||
const lastSlt = new Date( resultArray[0]);
|
||||
const filteredTimes = this.slots.filter(time => new Date(time) >= firstSlt && new Date(time) <= lastSlt);
|
||||
|
||||
console.log(resultArray,filteredTimes);
|
||||
let result = filteredTimes.pop();
|
||||
console.log(result);
|
||||
this.slotsResult = filteredTimes
|
||||
this.show = false;
|
||||
// this.slots.forEach(element => {
|
||||
// if(element <date2){
|
||||
// console.log(element);
|
||||
// }
|
||||
// });
|
||||
|
||||
this.slot_array.push({date:this.date,slots:filteredTimes})
|
||||
}
|
||||
|
||||
getServicesList(id,busId) {
|
||||
this.servicesList_array = []
|
||||
//this._pd.getTabStatusPdDetails(this.tabStatus)
|
||||
this._api.getServicesListDetails(id,busId).subscribe(res => {
|
||||
if (res.status == 200) {
|
||||
this.servicesList_data = res.data;
|
||||
res['data'].forEach(element => {
|
||||
// tmp.push(element.service)
|
||||
element.service.forEach(e => {
|
||||
console.log(e)
|
||||
this.servicesList_array.push(e)
|
||||
this.assignService.push(e.servicesName)
|
||||
});
|
||||
});
|
||||
console.log(this.servicesList_array)
|
||||
}
|
||||
// this.getAssignedList(this.usersList.busId)
|
||||
});
|
||||
// this.assignService = this.checkedArray
|
||||
}
|
||||
serviceData(data){
|
||||
this.ServiceId = data.serviceId
|
||||
|
||||
this.duration = data.duration
|
||||
|
||||
}
|
||||
|
||||
getApiData(){
|
||||
this._app.getAppoinmentsListDetails().subscribe(res => {
|
||||
if (res.status == 200) {
|
||||
let appoinmentsList = res.data;
|
||||
let id = localStorage.getItem('user_id')
|
||||
console.log(id)
|
||||
console.log(appoinmentsList)
|
||||
let filter = appoinmentsList.filter(arr=>{return arr["ServicesMapDetail.userId"]
|
||||
== id})
|
||||
console.log(filter)
|
||||
filter.forEach(element => {
|
||||
this.appoinmentsIds.push( element.customer[0].id)
|
||||
});
|
||||
this.getCustomerDetails()
|
||||
}
|
||||
})
|
||||
}
|
||||
getCustomerDetails(){
|
||||
this._cus.getCustomersListDetails().subscribe(res => {
|
||||
if (res.status == 200) {
|
||||
|
||||
this.customersList = res.data;
|
||||
|
||||
|
||||
console.log(this.customersList,this.appoinmentsIds)
|
||||
let user_role = localStorage.getItem('user_role');
|
||||
if(user_role == 'PRACTITIONER'){
|
||||
const activeIds = this.appoinmentsIds
|
||||
const serviceList = this.customersList
|
||||
console.log(activeIds,serviceList)
|
||||
|
||||
const result = serviceList.filter(({id}) => activeIds.includes(id));
|
||||
console.log(result)
|
||||
this.customersList = result
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
receivedMessageHandler(res) {
|
||||
|
||||
console.log(res)
|
||||
this.customersList.push(res.data)
|
||||
this.customerId = res.data.id
|
||||
this.form.controls['customer'].setValue( res.data.id);
|
||||
this.customerCard = 0
|
||||
}
|
||||
|
||||
receiveAutoMsgHandler(p) {
|
||||
console.log(p)
|
||||
}
|
||||
customerIdvalue(id){
|
||||
console.log(id)
|
||||
this.customerId = id
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@
|
||||
<div class="container mt-1">
|
||||
<div fxLayout="row wrap" dir="ltr" fxLayoutAlign="center center">
|
||||
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100" class="m-gap p-gap flx">
|
||||
<mat-card class="card-mat"> <ng-scrollbar class="scrollHV">
|
||||
<mat-card class="card-mat">
|
||||
<div fxLayout="row wrap mt-2">
|
||||
<div fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50" class="p-gap">
|
||||
<h4> Slot Availability</h4>
|
||||
@ -74,30 +74,21 @@
|
||||
<p class="param"><img src="assets/images/information.svg" alt="Avatar" class="img"> Service </p>
|
||||
<span class="span-text"> {{servicesName.servicesName}} ({{servicesName.duration
|
||||
}} Mins)</span>
|
||||
<!-- <p class="text-color d-flex align-items-start" >
|
||||
<p class="text-color d-flex align-items-start" >
|
||||
<img src="assets/images/information.svg" alt="Avatar" class="img" />
|
||||
<span>Date:{{date | date:'longDate'}}</span><br />
|
||||
<span style="margin-left: 10px;">Time :{{slotTime | date:'shortTime'}}</span>
|
||||
</p> -->
|
||||
<p class="param"><img src="assets/images/Languages.svg" alt="Avatar" class="img">Date : </p>
|
||||
<span class="span-text"> {{date | date:'longDate'}}</span>
|
||||
<p class="param"><img src="assets/images/Time-Icon.svg" alt="Avatar" class="img">Time : </p>
|
||||
<span class="span-text">{{slotTime | date:'shortTime'}}</span>
|
||||
<p class="param"><img src="assets/images/Location.svg" alt="Avatar" class="img">Amount : </p>
|
||||
<span class="span-text"><span class="ex" style="font-size: 17px;padding-bottom: 10px;line-height: 17px;">₹</span> {{user.practitionerInfos[0].days}}</span>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div style="border: 1px solid #ccc;" fxFlex.md="1"></div>
|
||||
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="64" fxFlex.lg="64" fxFlex.xl="64" class="p-gap d-flex">
|
||||
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="64" fxFlex.lg="64" fxFlex.xl="64" class="p-gap d-flex">
|
||||
<div >
|
||||
<div class="innerdivs" > <mat-card class="navStyle" fxLayoutAlign="center center"> <button mat-raised-button (click)="goToSlotBooking2()" style="background-color: #7fffd400;box-shadow: none;color:#fff" ><mat-icon style="cursor: pointer;">keyboard_arrow_left</mat-icon></button><span style="width: 150px;text-align: center;">{{check(days) | date:'fullDate'}}</span><button mat-raised-button (click)="goToSlotBooking()" *ngIf="clicks < 5" style="background-color: #7fffd400;box-shadow: none;color:#fff" ><mat-icon style="cursor: pointer;">keyboard_arrow_right</mat-icon></button></mat-card></div>
|
||||
<div class="innerdivs" > <div style="margin: 1%;">
|
||||
<button *ngFor="let slot of slots;let i=index" mat-raised-button mat-button-sm class="mr-1 mt-1 hoverButton" [ngClass]="{'primary':slotIndex != i,'clickedSlot':slotIndex == i } " (click)="toggleActive($event,slot,i)" >{{slot | date:'shortTime'}}</button>
|
||||
</div> </div>
|
||||
|
||||
<div class="innerdivs" >
|
||||
<button mat-raised-button mat-button-sm class="mr-1 mb-1 mt-1 btn-red" [ngStyle]="{'background':slot_array.length ==0 ? '#ccc':'#4caf50' }" [disabled]="slot_array.length ==0" (click)="submit()">PROCEED</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@ -193,8 +184,10 @@
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</ng-scrollbar></mat-card>
|
||||
<div class="d-flex justify-content-center mt-3">
|
||||
<button mat-raised-button mat-button-sm class="mr-1 mb-1 mt-1 btn-red" [ngStyle]="{'background':slot_array.length ==0 ? '#ccc':'#4caf50' }" [disabled]="slot_array.length ==0" (click)="submit()">PROCEED</button>
|
||||
</div>
|
||||
</mat-card>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user