Commit ab1e7546 by Your Name

Update eventClick

parent ef6be6ab
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
<a ngbNavLink>ปฏิทินการจองห้อง</a> <a ngbNavLink>ปฏิทินการจองห้อง</a>
<ng-template ngbNavContent> <ng-template ngbNavContent>
<full-calendar #calendarBook [options]="calendarRoom" style=" <full-calendar #calendarBook [options]="calendarRoom" style="
margin-top: 20px;" (eventClick)="eventShow(showRoom)"></full-calendar> margin-top: 20px;"></full-calendar>
</ng-template> </ng-template>
</li> </li>
<li [ngbNavItem]="2"> <li [ngbNavItem]="2">
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
</div> </div>
</div> </div>
<ng-template #showRoom let-modal> <!-- <ng-template #showRoom let-modal>
<div class=" col-md-12" style="padding: 0; "> <div class=" col-md-12" style="padding: 0; ">
<div class="card" style="margin: 0; "> <div class="card" style="margin: 0; ">
<div class=" card-header"> <div class=" card-header">
...@@ -118,4 +118,4 @@ ...@@ -118,4 +118,4 @@
</div> </div>
</div> </div>
</div> </div>
</ng-template> </ng-template> -->
\ No newline at end of file \ No newline at end of file
import { Component, OnInit, ViewChild } from '@angular/core'; import { Component, Input, OnInit, ViewChild } from '@angular/core';
import { FullCalendarComponent, CalendarOptions } from '@fullcalendar/angular'; import { FullCalendarComponent, CalendarOptions } from '@fullcalendar/angular';
import { NgbDate, NgbCalendar, NgbDateParserFormatter, NgbNavChangeEvent, NgbModal, ModalDismissReasons } from '@ng-bootstrap/ng-bootstrap'; import { NgbDate, NgbCalendar, NgbDateParserFormatter, NgbNavChangeEvent, NgbModal, ModalDismissReasons, NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { Equirment } from 'src/app/models/equirment.model'; import { Equirment } from 'src/app/models/equirment.model';
import { ItemDetail } from 'src/app/models/itemDetail.model'; import { ItemDetail } from 'src/app/models/itemDetail.model';
import { RoomDetailService } from 'src/app/service/room-detail.service'; import { RoomDetailService } from 'src/app/service/room-detail.service';
...@@ -11,6 +11,45 @@ import { RoomService } from 'src/app/service/room.service'; ...@@ -11,6 +11,45 @@ import { RoomService } from 'src/app/service/room.service';
import { RoomDetail } from 'src/app/models/RoomDetail.model'; import { RoomDetail } from 'src/app/models/RoomDetail.model';
@Component({ @Component({
selector: 'ngbd-modal-content',
template: `
<div class=" col-md-12" style="padding: 0; ">
<div class="card" style="margin: 0; ">
<div class=" card-header">
<h5 class=" title">รายละเอียดการจอง</h5>
</div>
<div class=" card-body">
<div class="row">
<div class="col-md-12">
<label> ชื่อผู้จอง </label>
<input readonly class="form-control" placeholder="" type="text" value="listRoomDetail.userName" />
</div>
</div>
<div class=" row">
<div class="col-md-12">
<label> เบอร์โทร </label>
<input readonly class="form-control" placeholder="" type="text" />
</div>
</div>
<div class="row">
<div class="col-sm-12">
<label for="exampleFormControlSelect1">ชื่อห้อง</label>
<input readonly class="form-control" placeholder="" type="text" />
</div>
</div>
</div>
</div>
</div>
`
})
export class NgbdModalContent {
@Input() name;
constructor(public activeModal: NgbActiveModal) { }
}
@Component({
selector: 'app-home-page', selector: 'app-home-page',
templateUrl: './home-page.component.html', templateUrl: './home-page.component.html',
styleUrls: ['./home-page.component.scss'], styleUrls: ['./home-page.component.scss'],
...@@ -38,7 +77,7 @@ import { RoomDetail } from 'src/app/models/RoomDetail.model'; ...@@ -38,7 +77,7 @@ import { RoomDetail } from 'src/app/models/RoomDetail.model';
.custom-day.faded { .custom-day.faded {
background-color: rgba(2, 117, 216, 0.5); background-color: rgba(2, 117, 216, 0.5);
} }
`] `],
}) })
...@@ -69,8 +108,8 @@ export class HomePageComponent implements OnInit { ...@@ -69,8 +108,8 @@ export class HomePageComponent implements OnInit {
showModal: boolean; showModal: boolean;
title = 'ngularfullcalendarbootstrap'; title = 'ngularfullcalendarbootstrap';
name:string; name: string;
date:string; date: string;
closeResult = ''; closeResult = '';
...@@ -89,7 +128,10 @@ export class HomePageComponent implements OnInit { ...@@ -89,7 +128,10 @@ export class HomePageComponent implements OnInit {
}; };
handleDateClick(arg) { handleDateClick(arg) {
alert('date click! ' + arg.dateStr) // alert('date click! ' + arg.dateStr)
this.selectedRoomDetail = arg.event.extendedProps;
console.log(this.selectedRoomDetail)
this.eventShow();
} }
dateKub() { dateKub() {
...@@ -159,7 +201,7 @@ export class HomePageComponent implements OnInit { ...@@ -159,7 +201,7 @@ export class HomePageComponent implements OnInit {
end: '2021-12-16T11:30:00', end: '2021-12-16T11:30:00',
extendedProps: this.listRoomDetail[i], extendedProps: this.listRoomDetail[i],
description: this.listRoomDetail[i].remark, description: this.listRoomDetail[i].remark,
allDay : this.listRoomDetail[i].allDay allDay: this.listRoomDetail[i].allDay
} }
) )
} }
...@@ -189,18 +231,17 @@ export class HomePageComponent implements OnInit { ...@@ -189,18 +231,17 @@ export class HomePageComponent implements OnInit {
dayMaxEventRows: true, dayMaxEventRows: true,
locale: "th", locale: "th",
events: this.eventRoom, events: this.eventRoom,
eventClick: function(info) { eventClick: this.handleDateClick.bind(this),
// this.selectedRoomDetail = info.event.extendedProps;
this.selectedRoomDetail = info.event.extendedProps ; // console.log(this.selectedRoomDetail)
console.log(this.selectedRoomDetail) // this.test();
// alert('Event: ' + info.event.title); // // alert('Coordinates: ' + info.jsEvent.pageX + ',' + info.jsEvent.pageY);
// alert('Coordinates: ' + info.jsEvent.pageX + ',' + info.jsEvent.pageY); // // alert('View: ' + info.view.type);
// alert('View: ' + info.view.type);
// // change the border color just for fun // // // change the border color just for fun
// info.el.style.borderColor = 'red'; // // info.el.style.borderColor = 'red';
} // }
}; };
this.calendarEquirment = { this.calendarEquirment = {
...@@ -212,6 +253,9 @@ export class HomePageComponent implements OnInit { ...@@ -212,6 +253,9 @@ export class HomePageComponent implements OnInit {
}; };
} }
test(){
alert("sssssssss");
}
onNavChange(changeEvent: NgbNavChangeEvent) { onNavChange(changeEvent: NgbNavChangeEvent) {
setTimeout(function () { setTimeout(function () {
...@@ -220,13 +264,9 @@ export class HomePageComponent implements OnInit { ...@@ -220,13 +264,9 @@ export class HomePageComponent implements OnInit {
} }
eventShow(showRoom) { eventShow() {
const modalRef = this.modalService.open(NgbdModalContent);
modalRef.componentInstance.name = 'World';
this.modalService.open(showRoom, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
this.closeResult = `Closed with: ${result}`;
}, (reason) => {
this.closeResult = `Dismissed ${this.getDismissReason(reason)}`;
});
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment