calender
This commit is contained in:
parent
1e82c698a7
commit
6865e50991
Binary file not shown.
@ -21,7 +21,7 @@ export const AppRoutes: Routes = [{
|
||||
loadChildren: () => import('./appoinment/business/business.module').then(m => m.BusinessModule)
|
||||
},
|
||||
{
|
||||
path: 'appoinments',
|
||||
path: 'appointments',
|
||||
loadChildren: () => import('./appoinment/appoinments/appoinments.module').then(m => m.AppoinmentsModule)
|
||||
|
||||
},
|
||||
|
||||
@ -13,10 +13,13 @@
|
||||
{{details.userName}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<!-- <div class="calender ">
|
||||
<i style="font-size:24px" class="fa" [routerLink]="['/appoinment/calendar-list']"></i>
|
||||
</div> -->
|
||||
</mat-form-field>
|
||||
<mat-button-toggle-group name="fontStyle" aria-label="Font Style">
|
||||
<mat-button-toggle value="List">List</mat-button-toggle>
|
||||
<mat-button-toggle value="Calender" (click)="onClickCalender()">Calender</mat-button-toggle>
|
||||
</mat-button-toggle-group>
|
||||
|
||||
<!-- <a><i style="font-size:24px" class="fa" (click)="onClickCalender()"></i></a> -->
|
||||
<button mat-button (click)="openDialog('Add',{})" class="button">Add Appointment</button>
|
||||
|
||||
|
||||
|
||||
@ -134,4 +134,12 @@ tr.mat-header-row {
|
||||
.cancelStatus {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
::ng-deep .mat-button-toggle-appearance-standard .mat-button-toggle-label-content {
|
||||
line-height: 0px !important;
|
||||
}
|
||||
|
||||
::ng-deep .mat-button-toggle-button {
|
||||
padding: 5px 7px !important;
|
||||
}
|
||||
@ -9,6 +9,7 @@ import { environment } from 'environments/environment';
|
||||
import Swal from 'sweetalert2';
|
||||
import { AppointmentsService } from '../appointments-service/appointments.service';
|
||||
import { DialogBoxComponent } from '../dialog-box/dialog-box.component';
|
||||
import { Router } from '@angular/router';
|
||||
export interface UsersData {
|
||||
busId: number;
|
||||
appoinmentTime: string;
|
||||
@ -58,7 +59,7 @@ export class AppoinmentsListComponent implements OnInit {
|
||||
consultants: any = [];
|
||||
selectPractitioner:any = [];
|
||||
user_role: any=[];
|
||||
constructor(private notifierService: NotifierService,public dialog: MatDialog, public _app:AppointmentsService) { }
|
||||
constructor(private router: Router,private notifierService: NotifierService,public dialog: MatDialog, public _app:AppointmentsService) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.recordStatus=false;
|
||||
@ -267,7 +268,7 @@ export class AppoinmentsListComponent implements OnInit {
|
||||
});
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
console.log(result)
|
||||
if(result == 0){
|
||||
if(result.data == 0){
|
||||
if(this.user_role != 'FRONTDESK'){
|
||||
let param ={"busId":localStorage.getItem('busId'),"userId":localStorage.getItem('user_id')}
|
||||
console.log(param)
|
||||
@ -407,5 +408,9 @@ export class AppoinmentsListComponent implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
onClickCalender(){
|
||||
this.router.navigate(['appointments/calender-view']);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { AppoinmentsListComponent } from './appoinments-list/appoinments-list.component';
|
||||
import { CalendarListComponent } from '../calendars/calendar-list/calendar-list.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
@ -8,6 +9,10 @@ const routes: Routes = [
|
||||
path: '',
|
||||
component: AppoinmentsListComponent
|
||||
|
||||
},
|
||||
{
|
||||
path: 'calender-view',
|
||||
component: CalendarListComponent
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
@ -11,7 +11,12 @@ import { DemoMaterialModule } from 'app/shared/demo.module';
|
||||
import { NgScrollbarModule } from 'ngx-scrollbar';
|
||||
import { NotifierModule, NotifierOptions } from 'angular-notifier';
|
||||
import { DataTableModule } from 'ornamentum';
|
||||
import { AppointmentAddcustomerComponent } from './appointment-addcustomer/appointment-addcustomer.component'
|
||||
import { AppointmentAddcustomerComponent } from './appointment-addcustomer/appointment-addcustomer.component';
|
||||
|
||||
import { CalendarModule, DateAdapter } from 'angular-calendar';
|
||||
import { adapterFactory } from 'angular-calendar/date-adapters/date-fns';
|
||||
import { CalendarListComponent } from '../calendars/calendar-list/calendar-list.component';
|
||||
import { CalendardialogComponent } from '../calendars/calendardialog/calendardialog.component';
|
||||
// import CalendarTodayIcon from '@material-ui/icons/CalendarToday';
|
||||
|
||||
|
||||
@ -60,7 +65,9 @@ const customNotifierOptions: NotifierOptions = {
|
||||
declarations: [
|
||||
AppoinmentsListComponent,
|
||||
DialogBoxComponent,
|
||||
AppointmentAddcustomerComponent
|
||||
AppointmentAddcustomerComponent,
|
||||
CalendarListComponent,
|
||||
CalendardialogComponent
|
||||
],
|
||||
imports: [
|
||||
DemoMaterialModule,
|
||||
@ -71,7 +78,15 @@ const customNotifierOptions: NotifierOptions = {
|
||||
// ScrollingModule,
|
||||
NgScrollbarModule,
|
||||
NotifierModule.withConfig(customNotifierOptions),
|
||||
DataTableModule.forRoot()
|
||||
DataTableModule.forRoot(),
|
||||
CalendarModule.forRoot({
|
||||
provide: DateAdapter,
|
||||
useFactory: adapterFactory
|
||||
}),
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
]
|
||||
})
|
||||
|
||||
@ -478,7 +478,8 @@ export class DialogBoxComponent implements OnInit {
|
||||
}else{
|
||||
this.notifierService.notify('success', 'Appointment Added Successfully');
|
||||
}
|
||||
this.dialogRef.close(0);
|
||||
let param = {data:0,response:res}
|
||||
this.dialogRef.close(param);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -15,28 +15,33 @@
|
||||
</mat-card>
|
||||
</mat-card-content>
|
||||
</mat-card> -->
|
||||
|
||||
<h3>
|
||||
|
||||
<!-- <button class="btn btn-primary pull-right" (click)="addEvent()">
|
||||
Add new
|
||||
</button> -->
|
||||
<mat-button-toggle-group name="fontStyle" aria-label="Font Style">
|
||||
<mat-button-toggle value="List" (click)="onClickList()">List</mat-button-toggle>
|
||||
<mat-button-toggle value="Calender">Calender</mat-button-toggle>
|
||||
</mat-button-toggle-group>
|
||||
<button class="btn btn-primary pull-right" (click)="openDialog('Add',{})" mat-raised-button >Add Appoinment</button>
|
||||
<div class="clearfix"></div>
|
||||
</h3>
|
||||
|
||||
<ng-scrollbar class="scrollHV">
|
||||
<mat-toolbar color="primary">
|
||||
<span fxFlex fxHide="false" fxHide.gt-xs>{{ viewDate | calendarDate:(view + 'ViewTitle'):'en' }}</span>
|
||||
<span fxFlex fxShow="false" fxShow.gt-xs>{{ viewDate | calendarDate:(view + 'ViewTitle'):'en' }}</span>
|
||||
<!-- <span fxFlex fxShow="false" fxShow.gt-xs>{{ viewDate | calendarDate:(view + 'ViewTitle'):'en' }}</span> -->
|
||||
<div fxShow="false" fxShow.gt-xs>
|
||||
<button mat-button (click)="view = 'month'" [class.active]="view === 'month'">Month</button>
|
||||
<button mat-button (click)="view = 'week'" [class.active]="view === 'week'">Week</button>
|
||||
<button mat-button (click)="view = 'day'" [class.active]="view === 'day'">Day</button>
|
||||
</div>
|
||||
<div fxHide="false" fxHide.gt-xs>
|
||||
<!-- <div fxHide="false" fxHide.gt-xs>
|
||||
<button mat-icon-button (click)="view = 'month'" [class.active]="view === 'month'"><mat-icon>view_module</mat-icon></button>
|
||||
<button mat-icon-button (click)="view = 'week'" [class.active]="view === 'week'"><mat-icon>view_week</mat-icon></button>
|
||||
<button mat-icon-button (click)="view = 'day'" [class.active]="view === 'day'"><mat-icon>view_day</mat-icon></button>
|
||||
</div>
|
||||
</div> -->
|
||||
<span fxFlex fxHide="false" fxHide.gt-xs></span>
|
||||
<button mat-icon-button mwlCalendarPreviousView [view]="view" [(viewDate)]="viewDate"><mat-icon>chevron_left</mat-icon></button>
|
||||
<button mat-icon-button mwlCalendarToday [(viewDate)]="viewDate"><mat-icon>today</mat-icon></button>
|
||||
@ -51,4 +56,5 @@
|
||||
<mwl-calendar-day-view *ngSwitchCase="'day'" [viewDate]="viewDate" [events]="events" [refresh]="refresh" (eventClicked)="handleEvent('Clicked', $event.event)" (eventTimesChanged)="eventTimesChanged($event)">
|
||||
</mwl-calendar-day-view>
|
||||
</div>
|
||||
</mat-card>
|
||||
</mat-card>
|
||||
</ng-scrollbar>
|
||||
@ -16,4 +16,15 @@ mat-card {
|
||||
.btn{
|
||||
background-color: #4caf50!important;
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
.scrollHV{
|
||||
height: calc(100vh - 190px);
|
||||
}
|
||||
|
||||
::ng-deep .mat-button-toggle-appearance-standard .mat-button-toggle-label-content {
|
||||
line-height: 0px !important;
|
||||
}
|
||||
|
||||
::ng-deep .mat-button-toggle-button {
|
||||
padding: 5px 7px !important;
|
||||
}
|
||||
@ -7,6 +7,14 @@ import { Subject } from 'rxjs';
|
||||
import { CalendarEvent, CalendarEventAction, CalendarEventTimesChangedEvent } from 'angular-calendar';
|
||||
import { CalendardialogComponent } from '../calendardialog/calendardialog.component';
|
||||
import { DialogBoxComponent } from 'app/appoinment/appoinments/dialog-box/dialog-box.component';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { MatTable, MatTableDataSource } from '@angular/material/table';
|
||||
import { environment } from 'environments/environment';
|
||||
import { PageEvent } from '@angular/material/paginator';
|
||||
import { Router } from '@angular/router';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
import { AppointmentsService } from 'app/appoinment/appoinments/appointments-service/appointments.service';
|
||||
import Swal from 'sweetalert2';
|
||||
|
||||
const colors: any = {
|
||||
red: {
|
||||
@ -28,6 +36,27 @@ const colors: any = {
|
||||
styleUrls: ['./calendar-list.component.scss']
|
||||
})
|
||||
export class CalendarListComponent implements OnInit {
|
||||
push: any;
|
||||
displayedColumns: string[] = ['id','ClientName','datetime','phoneNo','email','status', 'action'];
|
||||
public appointmentListLength: number;
|
||||
// pagination variable details
|
||||
length = 5;
|
||||
pageIndex = 0;
|
||||
pageSize = 10;
|
||||
pageEvent: PageEvent;
|
||||
appoinmentsList: any = [];
|
||||
private apiUrl = environment.apiEndpoint;
|
||||
// dataSource: any;
|
||||
appointmentListSource:any = []
|
||||
// dataSource: any = new MatTableDataSource(ELEMENT_DATA);
|
||||
// @ViewChild(MatPaginator) paginator: MatPaginator;
|
||||
addFormData: any;
|
||||
|
||||
pipe = new DatePipe('en-US');
|
||||
isLoading = true
|
||||
consultants: any = [];
|
||||
selectPractitioner:any = [];
|
||||
user_role: any=[];
|
||||
dataSource: any;
|
||||
private yesterday: Date;
|
||||
dialogRef: MatDialogRef<CalendardialogComponent>;
|
||||
@ -107,84 +136,378 @@ export class CalendarListComponent implements OnInit {
|
||||
|
||||
activeDayIsOpen = false;
|
||||
table: any;
|
||||
|
||||
constructor(public dialog: MatDialog) {
|
||||
recordStatus: boolean;
|
||||
bookedDetails: any = [];
|
||||
constructor(public dialog: MatDialog,private router: Router,private notifierService: NotifierService, public _app:AppointmentsService) {
|
||||
this.initializeYesterday();
|
||||
this.initializeEvents();
|
||||
}
|
||||
|
||||
|
||||
|
||||
ngOnInit(): void {
|
||||
this.recordStatus=false;
|
||||
this.user_role = localStorage.getItem('user_role');
|
||||
if(this.user_role != 'FRONTDESK'){
|
||||
let param ={"busId":localStorage.getItem('busId'),"userId":localStorage.getItem('user_id')}
|
||||
console.log(param)
|
||||
this.getAppoinmentsList(param)
|
||||
}else{
|
||||
let param ={"busId": localStorage.getItem('busId')}
|
||||
console.log(param)
|
||||
this.getAppoinmentsList(param)
|
||||
this.getCosultantList()
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// ngAfterViewInit() {
|
||||
// this.appointmentListSource.paginator = this.paginator;
|
||||
// console.log(this.appointmentListSource,this.paginator)
|
||||
// this.appointmentListSource.sort = this.sort;
|
||||
// }
|
||||
|
||||
applyFilter(filterValue: string) {
|
||||
filterValue = filterValue.trim(); // Remove whitespace
|
||||
filterValue = filterValue.toLowerCase(); // Datasource defaults to lowercase matches
|
||||
this.appointmentListSource.filter = filterValue;
|
||||
console.log(this.appointmentListSource)
|
||||
}
|
||||
|
||||
getCosultantList() {
|
||||
let param ={"busId": localStorage.getItem('busId')}
|
||||
console.log(param)
|
||||
this._app.getCosultantListDetails(param).subscribe(res => {
|
||||
if (res.status == 200) {
|
||||
console.log(res.data)
|
||||
let consultantsList = res.data;
|
||||
this.consultants = consultantsList.filter(val => val.role == 'PRACTITIONER')
|
||||
console.log(this.consultants)
|
||||
}
|
||||
else{
|
||||
this.consultants=[];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
allPractitioner(){
|
||||
let param ={"busId": localStorage.getItem('busId')}
|
||||
console.log(param)
|
||||
this.getAppoinmentsList(param)
|
||||
}
|
||||
|
||||
getPractitioner(selectedPractititoner){
|
||||
console.log(selectedPractititoner)
|
||||
this.appoinmentsList=[]
|
||||
// {"busId":abc123,userId:"2"} or param = {"busId":abc123}
|
||||
let param = {"busId": selectedPractititoner.busId,"userId":selectedPractititoner.id}
|
||||
this.getAppoinmentsList(param)
|
||||
}
|
||||
|
||||
getAppoinmentsList(param) {
|
||||
this.appoinmentsList=[]
|
||||
let user_role = localStorage.getItem('user_role');
|
||||
console.log(param)
|
||||
this._app.getAppoinmentsListDetails(param).subscribe(res => {
|
||||
|
||||
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)
|
||||
this.appointmentListSource['data'] = this.appoinmentsList;
|
||||
console.log(this.appointmentListSource)
|
||||
|
||||
console.log(this.appoinmentsList)
|
||||
|
||||
this.appoinmentsList.forEach(element => {
|
||||
console.log(element)
|
||||
element.appoinmentSlots = JSON.parse(element.appoinmentSlots)
|
||||
});
|
||||
console.log(this.appoinmentsList)
|
||||
this.events = []
|
||||
|
||||
if(user_role == 'PRACTITIONER'){
|
||||
console.log('if ')
|
||||
let id = localStorage.getItem('user_id')
|
||||
console.log(id)
|
||||
this.appointmentListSource['data'] = this.appoinmentsList;
|
||||
this.appointmentListSource
|
||||
console.log(this.appointmentListSource)
|
||||
let filter = this.appointmentListSource['data'].filter(arr=>{return arr["ServicesMapDetail.userId"] == id})
|
||||
console.log(filter)
|
||||
filter.sort((a: any, b: any) => {
|
||||
return b.id - a.id;
|
||||
});
|
||||
filter.forEach((element, index) => {
|
||||
element.index = index
|
||||
|
||||
});
|
||||
this.appointmentListSource['data'] = filter
|
||||
|
||||
filter.forEach(element => {
|
||||
console.log(element.appoinmentSlots[element.appoinmentSlots.length-1])
|
||||
this.addEvent(element.appoinmentSlots[0],element.appoinmentSlots[element.appoinmentSlots.length-1],element.bookingId)
|
||||
});
|
||||
this.appointmentListLength = filter.length;
|
||||
console.log(this.appointmentListSource)
|
||||
this.recordStatus=false;
|
||||
|
||||
} else {
|
||||
console.log('else')
|
||||
this.appointmentListLength = res.data.length;
|
||||
console.log(this.appointmentListLength)
|
||||
this.appoinmentsList.sort((a: any, b: any) => {
|
||||
return b.id - a.id;
|
||||
});
|
||||
this.appoinmentsList.forEach((element, index) => {
|
||||
element.index = index
|
||||
|
||||
|
||||
});
|
||||
this.appointmentListSource['data'] = this.appoinmentsList;
|
||||
|
||||
this.appoinmentsList.forEach(element => {
|
||||
console.log(element.appoinmentSlots[element.appoinmentSlots.length-1])
|
||||
this.addEvent( element.appoinmentSlots[0],element.appoinmentSlots[element.appoinmentSlots.length-1],element.bookingId)
|
||||
});
|
||||
|
||||
// this.appoinmentsList.forEach(element => {
|
||||
// element.appoinmentSlots = JSON.parse(element.appoinmentSlots)
|
||||
|
||||
// this.addEvent( element.appoinmentSlots[0])
|
||||
// });
|
||||
|
||||
|
||||
console.log(this.appointmentListSource)
|
||||
|
||||
}
|
||||
this.recordStatus=false;
|
||||
}
|
||||
else{
|
||||
this.isLoading = false
|
||||
this.appoinmentsList=[];
|
||||
this.appointmentListLength= null;
|
||||
this.recordStatus=true;
|
||||
}
|
||||
}, error => this.isLoading = false)
|
||||
|
||||
}
|
||||
|
||||
|
||||
pageChange(e) {
|
||||
console.log(e);
|
||||
}
|
||||
|
||||
|
||||
confirmBox(event,element){
|
||||
console.log(event,element)
|
||||
Swal.fire({
|
||||
title: 'Are you sure want to Delete?',
|
||||
text: 'You will not be able to recover this Appointment!',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Yes, delete it!',
|
||||
cancelButtonText: 'No, keep it'
|
||||
}).then((result) => {
|
||||
if (result.value) {
|
||||
console.log('entry')
|
||||
// this.deleteRowData(element);
|
||||
this.formAddUpdateAndDelete(event,element)
|
||||
Swal.fire(
|
||||
'Deleted!',
|
||||
'Your Appointment has been deleted.',
|
||||
'success'
|
||||
)
|
||||
} else if (result.dismiss === Swal.DismissReason.cancel) {
|
||||
Swal.fire(
|
||||
'Cancelled',
|
||||
'Your Appointment is safe :)',
|
||||
'error'
|
||||
)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
openDialog(action,obj) {
|
||||
obj.action = action;
|
||||
const dialogRef = this.dialog.open(DialogBoxComponent, {
|
||||
width: '40%',
|
||||
height: '100%',
|
||||
// maxWidth: '38vw',
|
||||
position: { right: '0' },
|
||||
data:obj
|
||||
});
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
console.log(result)
|
||||
this.bookedDetails = result.response['data'][0]
|
||||
if(result.data == 0){
|
||||
if(this.user_role != 'FRONTDESK'){
|
||||
let param ={"busId":localStorage.getItem('busId'),"userId":localStorage.getItem('user_id')}
|
||||
console.log(param)
|
||||
this.getAppoinmentsList(param)
|
||||
}else{
|
||||
let param ={"busId": localStorage.getItem('busId')}
|
||||
console.log(param)
|
||||
this.getAppoinmentsList(param)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
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,
|
||||
paymentStatus: row_obj.paymentStatus,
|
||||
status: row_obj.status,
|
||||
appoinmentDate: row_obj.appoinmentDate,
|
||||
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
|
||||
}
|
||||
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;
|
||||
if(this.user_role != 'FRONTDESK'){
|
||||
let param ={"busId":localStorage.getItem('busId'),"userId":localStorage.getItem('user_id')}
|
||||
console.log(param)
|
||||
this.getAppoinmentsList(param)
|
||||
}else{
|
||||
let param ={"busId": localStorage.getItem('busId')}
|
||||
console.log(param)
|
||||
this.getAppoinmentsList(param)
|
||||
}
|
||||
if(result.event == 'Add'){
|
||||
this.notifierService.notify('success', 'Appointment Added Successfully');
|
||||
}else if(result.event == 'Update'){
|
||||
this.notifierService.notify('success', 'Appointment Updated Successfully');
|
||||
} else if(result == 'Delete'){
|
||||
this.notifierService.notify('success', 'Appointment Deleted Successfully');
|
||||
}
|
||||
}
|
||||
else{
|
||||
this.notifierService.notify('warning', res.message);
|
||||
}
|
||||
}
|
||||
// , error => {this.errorMessage = <any> error});
|
||||
,error => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
getData(param){
|
||||
console.log(param)
|
||||
|
||||
}
|
||||
|
||||
onClickList(){
|
||||
this.router.navigate(['appointments']);
|
||||
}
|
||||
|
||||
|
||||
private initializeYesterday() {
|
||||
this.yesterday = new Date();
|
||||
this.yesterday.setDate(this.yesterday.getDate() - 1);
|
||||
console.log( this.yesterday )
|
||||
}
|
||||
private initializeEvents() {
|
||||
let date = new Date("2023-02-26T11:26:30.882Z")
|
||||
// let date = new Date("2023-02-26T11:26:30.882Z")
|
||||
this.events = [
|
||||
{
|
||||
title: 'Editable event',
|
||||
color: colors.yellow,
|
||||
start: this.yesterday,
|
||||
actions: [
|
||||
{
|
||||
label: '<i class="fa fa-fw fa-pencil"></i>',
|
||||
onClick: ({ event }: { event: CalendarEvent }): void => {
|
||||
console.log('Edit event', event);
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'Editable event',
|
||||
color: colors.yellow,
|
||||
start: date,
|
||||
actions: [
|
||||
{
|
||||
label: '<i class="fa fa-fw fa-pencil"></i>',
|
||||
onClick: ({ event }: { event: CalendarEvent }): void => {
|
||||
console.log('Edit event', event);
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'Deletable event',
|
||||
color: colors.blue,
|
||||
start: date,
|
||||
actions: [
|
||||
{
|
||||
label: '<i class="fa fa-fw fa-times"></i>',
|
||||
onClick: ({ event }: { event: CalendarEvent }): void => {
|
||||
this.events = this.events.filter((iEvent) => iEvent !== event);
|
||||
console.log('Event deleted', event);
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'Non editable and deletable event',
|
||||
color: colors.red,
|
||||
start: this.yesterday,
|
||||
},
|
||||
// {
|
||||
// title: 'Editable event',
|
||||
// color: colors.yellow,
|
||||
// start: this.yesterday,
|
||||
// actions: [
|
||||
// {
|
||||
// label: '<i class="fa fa-fw fa-pencil"></i>',
|
||||
// onClick: ({ event }: { event: CalendarEvent }): void => {
|
||||
// console.log('Edit event', event);
|
||||
// },
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// {
|
||||
// title: 'Editable event',
|
||||
// color: colors.yellow,
|
||||
// start: date,
|
||||
// actions: [
|
||||
// {
|
||||
// label: '<i class="fa fa-fw fa-pencil"></i>',
|
||||
// onClick: ({ event }: { event: CalendarEvent }): void => {
|
||||
// console.log('Edit event', event);
|
||||
// },
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// {
|
||||
// title: 'Deletable event',
|
||||
// color: colors.blue,
|
||||
// start: date,
|
||||
// actions: [
|
||||
// {
|
||||
// label: '<i class="fa fa-fw fa-times"></i>',
|
||||
// onClick: ({ event }: { event: CalendarEvent }): void => {
|
||||
// this.events = this.events.filter((iEvent) => iEvent !== event);
|
||||
// console.log('Event deleted', event);
|
||||
// },
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// {
|
||||
// title: 'Non editable and deletable event',
|
||||
// color: colors.red,
|
||||
// start: this.yesterday,
|
||||
// },
|
||||
];
|
||||
console.log( this.events )
|
||||
}
|
||||
|
||||
dayClicked({date, events}: {date: Date, events: CalendarEvent[]}): void {
|
||||
console.log(date, events)
|
||||
this.openDialog('Add', {date:date})
|
||||
// this.openDialog('calender', {date:date})
|
||||
this.addEvent(date)
|
||||
if (isSameMonth(date, this.viewDate)) {
|
||||
if (
|
||||
(isSameDay(this.viewDate, date) && this.activeDayIsOpen === true) ||
|
||||
events.length === 0
|
||||
) {
|
||||
this.activeDayIsOpen = false;
|
||||
} else {
|
||||
this.activeDayIsOpen = true;
|
||||
this.viewDate = date;
|
||||
}
|
||||
}
|
||||
console.log(date, events)
|
||||
//this.openDialog('Add', {date:date})
|
||||
// this.openDialog('calender', {date:date})
|
||||
// this.addEvent(date)
|
||||
if (isSameMonth(date, this.viewDate)) {
|
||||
if (
|
||||
(isSameDay(this.viewDate, date) && this.activeDayIsOpen === true) ||
|
||||
events.length === 0
|
||||
) {
|
||||
this.activeDayIsOpen = false;
|
||||
} else {
|
||||
this.activeDayIsOpen = true;
|
||||
this.viewDate = date;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
eventTimesChanged({event, newStart, newEnd}: CalendarEventTimesChangedEvent): void {
|
||||
@ -203,115 +526,26 @@ this.addEvent(date)
|
||||
this.dialogRef = null;
|
||||
});
|
||||
}
|
||||
openDialog(action,obj) {
|
||||
console.log(obj, action)
|
||||
if(action=='calender'){
|
||||
|
||||
}else{
|
||||
obj.action = action;
|
||||
}
|
||||
|
||||
const dialogRef = this.dialog.open(DialogBoxComponent, {
|
||||
width: '40%',
|
||||
height: '100%',
|
||||
// maxWidth: '38vw',
|
||||
position: { right: '0' },
|
||||
data:obj
|
||||
});
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
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,
|
||||
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.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;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
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)
|
||||
}
|
||||
addEvent(dates): void {
|
||||
|
||||
addEvent(dates,enddate,bookingId): void {
|
||||
console.log(dates,enddate)
|
||||
console.log(startOfDay(new Date()));
|
||||
console.log(endOfDay(new Date()))
|
||||
this.events.push({
|
||||
title: 'New event',
|
||||
// start: startOfDay(new Date()),
|
||||
start: startOfDay(new Date(dates)),
|
||||
end: endOfDay(new Date(dates)),
|
||||
color: colors.red,
|
||||
draggable: true,
|
||||
resizable: {
|
||||
beforeStart: true,
|
||||
afterEnd: true
|
||||
}
|
||||
});
|
||||
title: bookingId,
|
||||
// start: startOfDay(new Date()),
|
||||
start: startOfDay(new Date(dates)),
|
||||
end: endOfDay(new Date(enddate)),
|
||||
color: colors.red,
|
||||
draggable: true,
|
||||
resizable: {
|
||||
beforeStart: true,
|
||||
afterEnd: true
|
||||
}
|
||||
});
|
||||
this.refresh.next();
|
||||
}
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// @Component({
|
||||
// selector: 'app-calendar-dialog',
|
||||
// template: `
|
||||
// <h5 class="mt-0">Event action occurred</h5>
|
||||
// <div>
|
||||
// Action:
|
||||
// <pre>{{ data?.action }}</pre>
|
||||
// </div>
|
||||
// <div>
|
||||
// Action:
|
||||
// <pre>{{ data?.action }}</pre>
|
||||
// </div>
|
||||
// <button mat-button type="button" (click)="dialogRef.close()">Close dialog</button>`
|
||||
// })
|
||||
// export class CalendarDialogComponent {
|
||||
// constructor(
|
||||
// public dialogRef: MatDialogRef<CalendarDialogComponent>,
|
||||
// @Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||
// }
|
||||
|
||||
|
||||
@ -10,17 +10,10 @@ import { DemoMaterialModule } from 'app/shared/demo.module';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
CalendarListComponent,
|
||||
CalendardialogComponent
|
||||
|
||||
],
|
||||
imports: [
|
||||
DemoMaterialModule,
|
||||
CommonModule,
|
||||
CalendarsRoutingModule,
|
||||
CalendarModule.forRoot({
|
||||
provide: DateAdapter,
|
||||
useFactory: adapterFactory
|
||||
}),
|
||||
|
||||
]
|
||||
})
|
||||
export class CalendarsModule { }
|
||||
|
||||
@ -149,4 +149,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</ng-scrollbar>
|
||||
</div>
|
||||
</div>
|
||||
<footer>
|
||||
<p>
|
||||
© 2023 Venba Information Technology Pvt Ltd. All Rights Reserved
|
||||
</p>
|
||||
</footer>
|
||||
@ -54,4 +54,12 @@ mat-toolbar{
|
||||
|
||||
.scrollHV {
|
||||
height: calc(100vh - 110px);
|
||||
}
|
||||
|
||||
footer {
|
||||
background-color: #d1d1d1;
|
||||
height:50px;
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
}
|
||||
@ -62,28 +62,28 @@
|
||||
</div>
|
||||
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50" class="p-gap" fxLayoutAlign="center center">
|
||||
<mat-form-field style="width: 80%">
|
||||
<input matInput placeholder="Address" type="text" name="address" formControlName="address_1">
|
||||
<input matInput placeholder="Address" type="text" name="address" formControlName="address_1" required>
|
||||
<mat-error *ngIf="myError('address_1', 'required')">Address is required</mat-error>
|
||||
<mat-error *ngIf="myError('address_1', 'maxlength')">Limit exceed</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50" class="p-gap" fxLayoutAlign="center center">
|
||||
<mat-form-field style="width: 80%" class="mb-1">
|
||||
<input matInput placeholder="State" type="text" name="state" formControlName="state">
|
||||
<input matInput placeholder="State" type="text" name="state" formControlName="state" required>
|
||||
<mat-error *ngIf="myError('state', 'required')">State is required</mat-error>
|
||||
<mat-error *ngIf="myError('state', 'maxlength')">Limit exceed</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50" class="p-gap" fxLayoutAlign="center center">
|
||||
<mat-form-field style="width: 80%" class="mb-1">
|
||||
<input matInput placeholder="City" type="text" name="city" formControlName="city">
|
||||
<input matInput placeholder="City" type="text" name="city" formControlName="city" required>
|
||||
<mat-error *ngIf="myError('city', 'required')">City is required</mat-error>
|
||||
<mat-error *ngIf="myError('city', 'maxlength')">Limit exceed</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50" class="p-gap" fxLayoutAlign="center center">
|
||||
<mat-form-field style="width: 80%" class="mb-1">
|
||||
<input matInput placeholder="Pincode" type="text" name="pincode" formControlName="pincode">
|
||||
<input matInput placeholder="Pincode" type="text" name="pincode" formControlName="pincode" required>
|
||||
<mat-error *ngIf="myError('pincode', 'required')">City is required</mat-error>
|
||||
<mat-error *ngIf="myError('pincode', 'maxlength')">Limit exceed</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
@ -151,4 +151,12 @@ mat-toolbar{
|
||||
.mat-dialog-container{
|
||||
overflow: hidden !important;
|
||||
padding: 32px !important;
|
||||
}
|
||||
|
||||
footer {
|
||||
background-color: #d1d1d1;
|
||||
height:50px;
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
}
|
||||
@ -52,6 +52,9 @@
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<footer>
|
||||
<p>
|
||||
© 2023 Venba Information Technology Pvt Ltd. All Rights Reserved
|
||||
</p>
|
||||
</footer>
|
||||
|
||||
|
||||
@ -48,4 +48,11 @@ mat-toolbar{
|
||||
}
|
||||
.mat-toolbar-single-row {
|
||||
display: block !important;
|
||||
}
|
||||
}
|
||||
footer {
|
||||
background-color: #d1d1d1;
|
||||
height:50px;
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
}
|
||||
@ -23,7 +23,7 @@
|
||||
<img *ngIf="getUserData.role == 'SADMIN'" src="assets/images/userpic.png" class="rad-full mb-1" width="100" height="100" alt="">
|
||||
<img *ngIf="getUserData.role != 'SADMIN'" [src]="getUserData.logo != '' ? image_view(getUserData.logo) : 'assets/images/userpic.png'" class="rad-full mb-1" width="100" height="100" alt="">
|
||||
<div> <span>{{getUserData.userName}}</span></div>
|
||||
<div> <span>({{getUserData.role}})</span></div>
|
||||
<div> <span>{{getUserData.role}}</span></div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="most-used text-center">
|
||||
|
||||
@ -10,8 +10,8 @@ export class RoleMenuItemsPipe implements PipeTransform {
|
||||
// // this is for horizontal menu filter
|
||||
// if(type=="1"){
|
||||
switch(localStorage.getItem('user_role')){
|
||||
case 'SADMIN': return value.filter(val=>val.state!="appoinments" && val.state!="customers" && val.state != "consultant-setting" && val.state!="consultants" && val.state!="services" && val.state!= "consultant-list" && val.state!= "mail-log");
|
||||
case 'BIZADMIN': return value.filter(val=>val.state !="business" && val.state!="consultants" && val.state!="appoinments" && val.state!= "consultant-list");
|
||||
case 'SADMIN': return value.filter(val=>val.state!="appointments" && val.state!="customers" && val.state != "consultant-setting" && val.state!="consultants" && val.state!="services" && val.state!= "consultant-list" && val.state!= "mail-log");
|
||||
case 'BIZADMIN': return value.filter(val=>val.state !="business" && val.state!="consultants" && val.state!="appointments" && val.state!= "consultant-list");
|
||||
case 'PRACTITIONER': return value.filter(val=>val.state !="business" && val.state!="consultants" && val.state!="users" && val.state!="services" && val.state!= "consultant-list" && val.state!= "mail-log");
|
||||
case 'FRONTDESK': return value.filter(val=>val.state !="business" && val.state!="consultants" && val.state!="users" && val.state != "home" && val.state!="customers" && val.state!= "consultant-list" && val.state!= "mail-log");
|
||||
// case 'PRACTITIONER':
|
||||
|
||||
@ -29,7 +29,7 @@ const HORIZONTALMENUITEMS = [
|
||||
icon: 'explore'
|
||||
},
|
||||
{
|
||||
state: 'appoinments',
|
||||
state: 'appointments',
|
||||
name: 'Appoinments',
|
||||
type: 'link',
|
||||
icon: 'developer_board',
|
||||
|
||||
@ -38,7 +38,7 @@ const MENUITEMS : Menu[] = [
|
||||
// ]
|
||||
},
|
||||
{
|
||||
state: 'appoinments',
|
||||
state: 'appointments',
|
||||
name: 'Appoinments',
|
||||
type: 'link',
|
||||
icon: 'developer_board',
|
||||
|
||||
@ -10,9 +10,9 @@ export const environment = {
|
||||
// apiEndpoint:'http://192.168.1.19:8080/api/',
|
||||
// apiEndpoint:'https://api.venbait.in/api/',
|
||||
// apiEndpoint:'http://venbainfotech.com:5000/api/',
|
||||
// apiEndpoint:'http://192.168.1.19:8080/api/',
|
||||
apiEndpoint:'http://192.168.1.17:8080/api/',
|
||||
|
||||
apiEndpoint:'https://api.venbait.in/api/',
|
||||
// apiEndpoint:'https://api.venbait.in/api/',
|
||||
|
||||
//EndUser URL
|
||||
endUserUrl: window.location.origin+'/#/customer/',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user