slot fixs
This commit is contained in:
parent
902304a3b0
commit
56b8c9abf0
@ -16,7 +16,7 @@
|
||||
<mat-label>Business</mat-label>
|
||||
<mat-select placeholder="Select Business" formControlName="businessselect" required>
|
||||
<mat-option>--</mat-option>
|
||||
<mat-option *ngFor="let business of businessList" [value]="business.busId">
|
||||
<mat-option *ngFor="let business of businessList" (click)="bus(business.busId)" [value]="business.busId">
|
||||
{{business.busName}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
|
||||
@ -30,12 +30,14 @@ export class AddUserComponent implements OnInit {
|
||||
imageViewStatus: boolean;
|
||||
formData:any=[];
|
||||
private apiUrl = environment.apiEndpoint;
|
||||
busId: any;
|
||||
constructor(private notifierService: NotifierService,private router: Router,private formBuilder: FormBuilder,
|
||||
public dialogRef: MatDialogRef<AddUserComponent>,
|
||||
@Optional() @Inject(MAT_DIALOG_DATA) public data: UsersData,public _bus:BusinessService) {
|
||||
console.log(data);
|
||||
this.local_data = {...data};
|
||||
|
||||
console.log( this.local_data)
|
||||
// this.local_data.busId = localStorage.getItem('busNameID')
|
||||
this.action = this.local_data.action;
|
||||
this.formData= new FormData();
|
||||
this.getBusinessList()
|
||||
@ -60,9 +62,7 @@ export class AddUserComponent implements OnInit {
|
||||
createdBy:new FormControl(userrole,null),
|
||||
});
|
||||
console.log(this.local_data);
|
||||
if(this.action == 'Update'){
|
||||
this.local_data.businessselect = this.local_data.busId
|
||||
}
|
||||
|
||||
|
||||
this.form.patchValue(this.local_data)
|
||||
setTimeout(() => {
|
||||
@ -105,8 +105,18 @@ export class AddUserComponent implements OnInit {
|
||||
// this.form.controls['businessselect'].setValue(data)
|
||||
console.log(this.businessList)
|
||||
console.log(this.form['value'].businessselect)
|
||||
this.local_data.businessselect = this.local_data.busId
|
||||
|
||||
// this.local_data.businessselect = this.local_data.busId
|
||||
console.log(localStorage.getItem('busNameID'), localStorage.getItem('go_admin'))
|
||||
if( localStorage.getItem('go_admin') =='0'){
|
||||
this.local_data.businessselect = localStorage.getItem('busNameID')
|
||||
this.form.controls['businessselect'].setValue(localStorage.getItem('busNameID'))
|
||||
}
|
||||
//localStorage.setItem('busNameID',getData.busId)
|
||||
|
||||
if(this.action == 'Update'){
|
||||
this.local_data.businessselect = this.local_data.busId
|
||||
}
|
||||
console.log( this.local_data)
|
||||
this.form.patchValue(this.local_data)
|
||||
}
|
||||
}
|
||||
@ -139,10 +149,14 @@ export class AddUserComponent implements OnInit {
|
||||
let tmp = this.form.value
|
||||
tmp.id = this.local_data.id
|
||||
console.log(this.formData.getAll('image'));
|
||||
if(this.busId == null){
|
||||
this.busId = localStorage.getItem('busNameID') || null
|
||||
}
|
||||
if(this.action == 'Update'){
|
||||
this.formData.append('id', tmp.id);
|
||||
this.formData.append('busId', this.local_data.busId);
|
||||
this.formData.append('busId', this.busId);
|
||||
}
|
||||
this.formData.append('busId', this.busId);
|
||||
this.formData.append('userName', tmp.userName);
|
||||
this.formData.append('password', tmp.password);
|
||||
this.formData.append('role', tmp.role);
|
||||
@ -183,5 +197,10 @@ export class AddUserComponent implements OnInit {
|
||||
image_view(image){
|
||||
return this.apiUrl+'imageViewer?img_name='+image;
|
||||
}
|
||||
bus(data){
|
||||
this.busId = data
|
||||
console.log(data)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ export class UserListComponent implements OnInit {
|
||||
let open_go_admin = localStorage.getItem('go_admin')
|
||||
if(open_go_admin == '0'){
|
||||
this.openDialog('Add',{})
|
||||
localStorage.setItem('go_admin','1')
|
||||
// localStorage.setItem('go_admin','1')
|
||||
}
|
||||
|
||||
}
|
||||
@ -166,6 +166,7 @@ export class UserListComponent implements OnInit {
|
||||
|
||||
}
|
||||
openDialog(action,obj) {
|
||||
// localStorage.setItem('busNameID',null)
|
||||
obj.action = action;
|
||||
const dialogRef = this.dialog.open(AddUserComponent, {
|
||||
// width: '30%',
|
||||
@ -234,6 +235,8 @@ export class UserListComponent implements OnInit {
|
||||
console.log(formValue[0])
|
||||
this._use.addFormDetails(formValue[0]).subscribe(res => {
|
||||
if (res.status == 200) {
|
||||
localStorage.setItem('go_admin','1')
|
||||
localStorage.setItem('busNameID',null)
|
||||
// this.usersList = res.data;
|
||||
this.getUsersList()
|
||||
if(result.event == 'Add'){
|
||||
|
||||
@ -72,15 +72,15 @@ export class CustomerInfoComponent implements OnInit {
|
||||
city: row_obj.city,
|
||||
};
|
||||
|
||||
// this._cus.addCusDetails(addFormData).subscribe(res => {
|
||||
// if (res.status == 200) {
|
||||
// console.log(res)
|
||||
this._cus.addCusDetails(addFormData).subscribe(res => {
|
||||
if (res.status == 200) {
|
||||
console.log(res)
|
||||
|
||||
// let URL = this.router.url;
|
||||
// console.log(URL)
|
||||
// this.router.navigate([URL+"/"+res['data'].id+"/pt"])
|
||||
// }
|
||||
// });
|
||||
let URL = this.router.url;
|
||||
console.log(URL)
|
||||
this.router.navigate([URL+"/"+res['data'].id+"/pt"])
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -84,17 +84,23 @@
|
||||
</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">
|
||||
|
||||
<mat-tab-group mat-stretch-tabs="false" mat-align-tabs="start">
|
||||
<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:'longDate'}}</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>
|
||||
|
||||
|
||||
<!-- <mat-tab-group mat-stretch-tabs="false" mat-align-tabs="start">
|
||||
<mat-tab [label]="tab | date:'longDate' " *ngFor="let tab of days">
|
||||
<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>
|
||||
</mat-tab>
|
||||
<!-- <mat-tab *ngFor="let day of days" label="{{day}}">{{day}}</mat-tab> -->
|
||||
<!-- <mat-tab label="Second">Content 2</mat-tab>
|
||||
<mat-tab label="Third">Content 3</mat-tab> -->
|
||||
</mat-tab-group>
|
||||
|
||||
</mat-tab-group> -->
|
||||
<!-- <div class="p-gap daytime">
|
||||
<div class="activeday" (click)="showdays(1)" [class.phase-active]="activeButton === 1">
|
||||
<span class="today-days">Today</span>
|
||||
|
||||
@ -398,4 +398,20 @@ footer {
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.navStyle{
|
||||
width: 100%;
|
||||
height: 3rem;
|
||||
background-color: #227f6e;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#container{
|
||||
width:500px;
|
||||
}
|
||||
.innerdivs
|
||||
{
|
||||
width:100%;
|
||||
float:left;
|
||||
}
|
||||
|
||||
|
||||
@ -25,6 +25,7 @@ export class SlotBookingDetailsComponent implements OnInit {
|
||||
selected: Date | null;
|
||||
name = 'Angular';
|
||||
date = new Date();
|
||||
clicks:any = 0;
|
||||
control = new FormControl(
|
||||
{
|
||||
from: this.date,
|
||||
@ -200,6 +201,23 @@ export class SlotBookingDetailsComponent implements OnInit {
|
||||
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.slots.forEach(element => {
|
||||
if(element <date2){
|
||||
console.log(element);
|
||||
@ -258,5 +276,30 @@ export class SlotBookingDetailsComponent implements OnInit {
|
||||
})
|
||||
|
||||
}
|
||||
goToSlotBooking(){
|
||||
// this.days[]
|
||||
if( this.clicks <5){
|
||||
this.clicks += 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
goToSlotBooking2(){
|
||||
// this.days[]
|
||||
if( this.clicks >0){
|
||||
this.clicks -= 1;
|
||||
}
|
||||
console.log( this.clicks)
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
check(param){
|
||||
return param[this.clicks];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user