Commit a1386f08 by DESKTOP-HF0LVOG\myhr

updae code

parents 937f7353 bb2ef4af
......@@ -23,6 +23,8 @@ import { AdminPendingComponent } from './pages/admin-pending/admin-pending.compo
import { PendingComponent } from './pages/pending/pending.component';
import { AdminEquirmentComponent } from './pages/admin-equirment/admin-equirment.component';
import { ReactiveFormsModule } from '@angular/forms';
FullCalendarModule.registerPlugins([ // register FullCalendar plugins
dayGridPlugin,
interactionPlugin
......
......@@ -2,11 +2,11 @@ import { Component, OnInit } from '@angular/core';
import { NgbDate, NgbCalendar, NgbDateParserFormatter } from '@ng-bootstrap/ng-bootstrap';
import { NgbModal, ModalDismissReasons } from '@ng-bootstrap/ng-bootstrap';
import { Equirment } from 'src/app/models/equirment.model';
import { ItemDetail } from 'src/app/models/ItemDetail.model';
import { ItemDetailService } from 'src/app/service/item-detail.service';
import { RoomDetail } from 'src/app/models/RoomDetail.model';
import { RoomDetailService } from 'src/app/service/room-detail.service';
import { MyRoom, Room } from 'src/app/models/rooms.model';
import { itemDetail } from 'src/app/models/itemDetail.model';
import { itemDetailService } from 'src/app/service/item-detail.service';
import { roomDetail } from 'src/app/models/roomDetail.model';
import { roomDetailService } from 'src/app/service/room-detail.service';
import { Room } from 'src/app/models/rooms.model';
@Component({
selector: 'app-admin-pending',
......@@ -46,28 +46,38 @@ export class AdminPendingComponent implements OnInit {
closeResult = '';
listItemDetail : ItemDetail[] = [];
listRoomDetail : RoomDetail[] = [];
listitemDetail : itemDetail[] = [];
listroomDetail : roomDetail[] = [];
modelEquirment = new Equirment();
modelRoom = new MyRoom();
modelItemDetail = new ItemDetail();
modelRoomDetail = new RoomDetail();
modelRoom = new Room();
modelitemDetail = new itemDetail();
modelroomDetail = new roomDetail();
collectionSize = this.listItemDetail.length;
collectionSize = this.listitemDetail.length;
hoveredDate: NgbDate | null = null;
fromDate: NgbDate | null;
toDate: NgbDate | null;
constructor(private calendar: NgbCalendar, public formatter: NgbDateParserFormatter, private modalService: NgbModal, private ItemDetailService: ItemDetailService, private RoomDetailService: RoomDetailService) {
thStime: string;
thEtime: string;
thtimeChange (time:string,item:any){
let timeSplit = time.split(":")
item.hour = parseInt(timeSplit[0])
item.minute = parseInt(timeSplit[1])
console.log(this.modelroomDetail)
}
constructor(private calendar: NgbCalendar, public formatter: NgbDateParserFormatter, private modalService: NgbModal, private itemDetailService: itemDetailService, private roomDetailService: roomDetailService) {
this.fromDate = calendar.getToday();
this.toDate = calendar.getNext(calendar.getToday(), 'd', 10);
this.refreshItemDetail();
this.refreshitemDetail();
}
refreshItemDetail() {
this.listItemDetail = this.listItemDetail
refreshitemDetail() {
this.listitemDetail = this.listitemDetail
.map((country, i) => ({ id: i + 1, ...country }))
.slice((this.page - 1) * this.pageSize, (this.page - 1) * this.pageSize + this.pageSize);
}
......@@ -90,10 +100,20 @@ export class AdminPendingComponent implements OnInit {
this.closeResult = `Dismissed ${this.getDismissReason(reason)}`;
});
}
openItemDetail(content : string ,item : ItemDetail) {
this.modelItemDetail = item ;
console.log(item);
date='10-12-2561'
show(a:string){
console.log(a)
}
sDate = ""
eDate = ""
openItemDetail(content : string ,item : itemDetail) {
this.modelitemDetail = item ;
this.thStime= this.modelitemDetail.sTime.hour + ':' + this.modelitemDetail.sTime.minute
this.thEtime= this.modelitemDetail.eTime.hour + ':' + this.modelitemDetail.eTime.minute
let SDate = this.modelitemDetail.sDate.split('/')
this.sDate = SDate[2]+"-"+SDate[1]+"-"+SDate[0]
let EDate = this.modelitemDetail.eDate.split('/')
this.eDate = EDate[2]+"-"+EDate[1]+"-"+EDate[0]
this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
this.closeResult = `Closed with: ${result}`;
}, (reason) => {
......@@ -101,9 +121,27 @@ export class AdminPendingComponent implements OnInit {
});
}
openRoomDetail(content : string ,item : RoomDetail) {
this.modelRoomDetail = item ;
console.log(item);
rDate(item: string, item2: string){
let Dates = item.split("-")
let dates = Dates[2]+"/"+Dates[1]+"/"+Dates[0]
if(item2=="sdate"){
this.modelitemDetail.sDate = dates
}
if(item2=="edate"){
this.modelitemDetail.eDate = dates
}
console.log(this.sDate)
}
openRoomDetail(content : string ,item : roomDetail) {
this.modelroomDetail = item ;
this.thStime= this.modelroomDetail.sTime.hour + ':' + this.modelroomDetail.sTime.minute
this.thEtime= this.modelroomDetail.eTime.hour + ':' + this.modelroomDetail.eTime.minute
let SDate = this.modelroomDetail.sDate.split('/')
this.sDate = SDate[2]+"-"+SDate[1]+"-"+SDate[0]
let EDate = this.modelroomDetail.eDate.split('/')
this.eDate = EDate[2]+"-"+EDate[1]+"-"+EDate[0]
this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
this.closeResult = `Closed with: ${result}`;
}, (reason) => {
......@@ -139,9 +177,9 @@ export class AdminPendingComponent implements OnInit {
}
ngOnInit(): void {
this.listItemDetail = this.ItemDetailService.getListItemDetail();
this.listRoomDetail = this.RoomDetailService.getListRoomDetail();
console.log(this.listItemDetail);
this.listitemDetail = this.itemDetailService.getListitemDetail();
this.listroomDetail = this.roomDetailService.getListroomDetail();
console.log(this.listitemDetail);
}
......
......@@ -13,7 +13,7 @@ export class RoomDetailService {
room: {
rId: 1,
rName: "ห้องเดียว",
rType : "ห้อง",
rType: "ห้อง",
rPic: "assets/img/room.jpg",
roomLimit: 25,
rDesc: "จำนวนคน 25 คน",
......@@ -40,7 +40,7 @@ export class RoomDetailService {
room: {
rId: 2,
rName: "ห้องคู่",
rType : "ห้อง",
rType: "ห้อง",
rPic: "assets/img/room.jpg",
roomLimit: 50,
rDesc: "จำนวนคน 50 คน",
......
......@@ -3,8 +3,6 @@ import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Room, SearchRoomModel } from '../models/rooms.model';
import { RoomDetail } from '../models/RoomDetail.model';
@Injectable({ providedIn: 'root' })
export class RoomService {
......
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