Commit 1e0fa993 by DESKTOP-HF0LVOG\myhr

Update ตารางรายการจอง

parent 16d9fa3e
import { Room } from "./rooms.model";
export class roomDetail {
Id?: number;
room : Room;
userName: string;
sDate: string;
eDate: string;
sTime: {
hour: number;
minute: number;
second: number;
};
eTime: {
hour: number;
minute: number;
second: number;
};
eStatus: string;
Remark: string;
constructor(init?: roomDetail) {
Object.assign(this, init);
this.Id = 1;
this.room = this.room;
this.userName = '';
this.sDate = '';
this.eDate = '';
this.eStatus = '';
this.Remark = '';
}
}
export interface SearchroomDetailModel {
sDate: string;
eDate: string;
sTime: string;
eTime: string;
}
export class SearchroomDetailModel {
constructor(init?: SearchroomDetailModel) {
Object.assign(this, init);
this.sDate = '',
this.eDate = '',
this.sTime = '',
this.eTime = '';
}
}
\ No newline at end of file
...@@ -2,14 +2,12 @@ export class Room { ...@@ -2,14 +2,12 @@ export class Room {
rId: number; rId: number;
rName: string; rName: string;
rPic: string; rPic: string;
rType: string;
roomLimit: number; roomLimit: number;
rDesc: string; rDesc: string;
constructor(init?: Room) { constructor(init?: Room) {
Object.assign(this, init); Object.assign(this, init);
this.rId = 0; this.rId = 0;
this.rName = ''; this.rName = '';
this.rType = '';
this.rPic = ''; this.rPic = '';
this.roomLimit = 0; this.roomLimit = 0;
this.rDesc = ''; this.rDesc = '';
......
...@@ -48,7 +48,7 @@ export class EquipmentComponent implements OnInit { ...@@ -48,7 +48,7 @@ export class EquipmentComponent implements OnInit {
} }
book(contentequirment,item : Equirment) { bookEquir(contentequirment,item : Equirment) {
this.modelitemDetail = new itemDetail(); this.modelitemDetail = new itemDetail();
this.modelitemDetail.equirment = item ; this.modelitemDetail.equirment = item ;
......
...@@ -76,7 +76,6 @@ ...@@ -76,7 +76,6 @@
<thead> <thead>
<tr> <tr>
<th scope="col">#</th> <th scope="col">#</th>
<th scope="col">หมวดหมู่</th>
<th scope="col">ชื่ออุปกรณ์</th> <th scope="col">ชื่ออุปกรณ์</th>
<th scope="col">รายละเอียด</th> <th scope="col">รายละเอียด</th>
<th scope="col">ชื่อผู้เบิก</th> <th scope="col">ชื่อผู้เบิก</th>
...@@ -86,11 +85,10 @@ ...@@ -86,11 +85,10 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let item of listitemDetail"> <tr *ngFor="let item of listroomDetail">
<th scope="row">{{ item.Id }}</th> <th scope="row">{{ item.Id }}</th>
<td>{{ item.equirment.eqType }}</td> <td>{{ item.room.rName }}</td>
<td>{{ item.equirment.eqName }}</td> <td>{{ item.room.rDesc }}</td>
<td>{{ item.equirment.eqDesc }}</td>
<td>{{ item.userName }}</td> <td>{{ item.userName }}</td>
<td>{{ item.sDate | date:'dd-MM-yyyy' }} {{ item.sTime.hour }}:{{ item.sTime.minute }}</td> <td>{{ item.sDate | date:'dd-MM-yyyy' }} {{ item.sTime.hour }}:{{ item.sTime.minute }}</td>
<td>{{ item.eDate | date:'dd-MM-yyyy' }} {{ item.eTime.hour }}:{{ item.eTime.minute }}</td> <td>{{ item.eDate | date:'dd-MM-yyyy' }} {{ item.eTime.hour }}:{{ item.eTime.minute }}</td>
...@@ -146,12 +144,13 @@ ...@@ -146,12 +144,13 @@
<tbody> <tbody>
<tr *ngFor="let item of listitemDetail"> <tr *ngFor="let item of listitemDetail">
<th scope="row">{{ item.Id }}</th> <th scope="row">{{ item.Id }}</th>
<td>{{ item.Catagory }}</td> <td>{{ item.equirment.eqType }}</td>
<td>{{ item.Type }}</td> <td>{{ item.equirment.eqName }}</td>
<td>{{ item.Detail }}</td> <td>{{ item.equirment.eqDesc }}</td>
<td>{{ item.userName }}</td> <td>{{ item.userName }}</td>
<td>{{ item.sDate | date:'dd-MM-yyyy' }} {{ item.sTime.hour }}:{{ item.sTime.minute }}</td> <td>{{ item.sDate | date:'dd-MM-yyyy' }} {{ item.sTime.hour }}:{{ item.sTime.minute }}</td>
<td>{{ item.eDate | date:'dd-MM-yyyy' }} {{ item.eTime.hour }}:{{ item.eTime.minute }}</td> <td>{{ item.eDate | date:'dd-MM-yyyy' }} {{ item.eTime.hour }}:{{ item.eTime.minute }}</td>
<td>{{ item.Quantity }}</td>
<td>{{ item.eStatus }}</td> <td>{{ item.eStatus }}</td>
<div class="col-auto align-self-sm-center"> <div class="col-auto align-self-sm-center">
<button type="button" class="btn btn-info btn-sm btn-circle " <button type="button" class="btn btn-info btn-sm btn-circle "
......
...@@ -3,6 +3,8 @@ import { NgbDate, NgbCalendar, NgbDateParserFormatter } from '@ng-bootstrap/ng-b ...@@ -3,6 +3,8 @@ import { NgbDate, NgbCalendar, NgbDateParserFormatter } from '@ng-bootstrap/ng-b
import { NgbModal, ModalDismissReasons } from '@ng-bootstrap/ng-bootstrap'; import { NgbModal, ModalDismissReasons } from '@ng-bootstrap/ng-bootstrap';
import { itemDetail } from 'src/app/models/itemDetail.model'; import { itemDetail } from 'src/app/models/itemDetail.model';
import { itemDetailService } from 'src/app/service/item-detail.service'; 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';
@Component({ @Component({
selector: 'app-pending', selector: 'app-pending',
...@@ -42,6 +44,7 @@ export class PendingComponent implements OnInit { ...@@ -42,6 +44,7 @@ export class PendingComponent implements OnInit {
closeResult = ''; closeResult = '';
listitemDetail : itemDetail[] = []; listitemDetail : itemDetail[] = [];
listroomDetail : roomDetail[] = [];
collectionSize = this.listitemDetail.length; collectionSize = this.listitemDetail.length;
hoveredDate: NgbDate | null = null; hoveredDate: NgbDate | null = null;
...@@ -49,7 +52,7 @@ export class PendingComponent implements OnInit { ...@@ -49,7 +52,7 @@ export class PendingComponent implements OnInit {
fromDate: NgbDate | null; fromDate: NgbDate | null;
toDate: NgbDate | null; toDate: NgbDate | null;
constructor(private calendar: NgbCalendar, public formatter: NgbDateParserFormatter, private modalService: NgbModal, private itemDetailService: itemDetailService) { constructor(private calendar: NgbCalendar, public formatter: NgbDateParserFormatter, private modalService: NgbModal, private itemDetailService: itemDetailService, private roomDetailService: roomDetailService) {
this.fromDate = calendar.getToday(); this.fromDate = calendar.getToday();
this.toDate = calendar.getNext(calendar.getToday(), 'd', 10); this.toDate = calendar.getNext(calendar.getToday(), 'd', 10);
this.refreshitemDetail(); this.refreshitemDetail();
...@@ -109,6 +112,7 @@ export class PendingComponent implements OnInit { ...@@ -109,6 +112,7 @@ export class PendingComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.listitemDetail = this.itemDetailService.getListitemDetail(); this.listitemDetail = this.itemDetailService.getListitemDetail();
this.listroomDetail = this.roomDetailService.getListroomDetail();
console.log(this.listitemDetail); console.log(this.listitemDetail);
} }
......
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { roomDetail, SearchroomDetailModel } from '../models/roomDetail.model';
@Injectable({ providedIn: 'root' })
export class roomDetailService {
constructor(private http: HttpClient) { }
url: string;
listroomDetail: roomDetail[] = [
{
Id: 1,
room: {
rId: 1,
rName: "ห้องเดียว",
rPic: "assets/img/room.jpg",
roomLimit: 25,
rDesc: "จำนวนคน 25 คน",
},
userName: 'เกม',
sDate: '10/12/2560',
eDate: '10/11/2561',
sTime: {
hour: 22,
minute: 30,
second: 0
},
eTime: {
hour: 22,
minute: 30,
second: 0
},
eStatus: 'รอการอนุมัติ',
Remark: 'test',
},
{
Id: 2,
room: {
rId: 2,
rName: "ห้องคู่",
rPic: "assets/img/room.jpg",
roomLimit: 50,
rDesc: "จำนวนคน 50 คน",
},
userName: 'เกม',
sDate: '10/12/2560',
eDate: '10/11/2561',
sTime: {
hour: 22,
minute: 30,
second: 0
},
eTime: {
hour: 22,
minute: 30,
second: 0
},
eStatus: 'รอการอนุมัติ',
Remark: 'test',
},
]
addroomDetail(model: roomDetail) {
console.log(this.listroomDetail);
this.listroomDetail.push(model);
}
getListroomDetail() {
return this.listroomDetail;
}
// getListroomDetail() {
// this.http.get(this.url).subscribe((response: any) => {
// console.log(response);
// this.listroomDetail = response.content;
// }, error => {
// console.log(error)
// // alert("ไม่สามารถดึงข้อมูลห้องประชุมได้ เนื่องจาก :\n" + error.message)
// })
// }
searchListroomDetail(searchModel: SearchroomDetailModel) {
this.http.get(this.url + '&startDate=' + searchModel.sDate.split("-")[2] + '-' + searchModel.sDate.split("-")[1] + '-' + searchModel.sDate.split("-")[0] + '&endDate=' + searchModel.eDate.split("-")[2] + '-' + searchModel.eDate.split("-")[1] + '-' + searchModel.eDate.split("-")[0] + '&startTime=' + searchModel.sTime + ':00' + '&endTime=' + searchModel.eTime + ':00').subscribe((response: any) => {
console.log(response);
this.listroomDetail = response;
}, error => {
console.log(error)
alert("ไม่สามารถค้นหาอุปกรณ์ที่ว่างได้ เนื่องจาก :\n" + error.message)
})
}
// addEquirment(EquirmentModel: Equirment) {
// this.http.post(this.url, EquirmentModel).subscribe(response => {
// console.log(response);
// })
// }
deleteroomDetail(roomDetailModel: roomDetail) {
this.http.delete(this.url + "/" + roomDetailModel.Id).subscribe(response => {
console.log(response);
this.getListroomDetail()
alert("ลบข้อมูลอุปกรณ์สำเร็จ")
})
}
updateroomDetail(roomDetailModel: roomDetail) {
this.http.put(this.url + "/" + roomDetailModel.Id, roomDetailModel).subscribe(response => {
console.log(response);
alert("อัพเดทข้อมูลอุปกรณ์สำเร็จ")
})
}
roomDetailModel(rId: string) {
}
}
\ No newline at end of file
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http'; import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Room, SearchRoomModel } from '../models/rooms.model'; import { Room, SearchRoomModel } from '../models/rooms.model';
import { itemDetail } from '../models/itemDetail.model';
@Injectable({ providedIn: 'root' }) @Injectable({ providedIn: 'root' })
...@@ -13,7 +13,6 @@ export class RoomService { ...@@ -13,7 +13,6 @@ export class RoomService {
{ {
rId: 1, rId: 1,
rName: "ห้องเดียว", rName: "ห้องเดียว",
rType: '',
rPic: "assets/img/room.jpg", rPic: "assets/img/room.jpg",
roomLimit: 25, roomLimit: 25,
rDesc: "จำนวนคน 25 คน", rDesc: "จำนวนคน 25 คน",
...@@ -21,7 +20,7 @@ export class RoomService { ...@@ -21,7 +20,7 @@ export class RoomService {
{ {
rId: 2, rId: 2,
rName: "ห้องคู่", rName: "ห้องคู่",
rType: '',
rPic: "assets/img/room.jpg", rPic: "assets/img/room.jpg",
roomLimit: 50, roomLimit: 50,
rDesc: "จำนวนคน 50 คน", rDesc: "จำนวนคน 50 คน",
...@@ -29,7 +28,7 @@ export class RoomService { ...@@ -29,7 +28,7 @@ export class RoomService {
{ {
rId: 3, rId: 3,
rName: "ห้องรวม", rName: "ห้องรวม",
rType: '',
rPic: "assets/img/room.jpg", rPic: "assets/img/room.jpg",
roomLimit: 100, roomLimit: 100,
rDesc: "จำนวนคน 100 คน", rDesc: "จำนวนคน 100 คน",
...@@ -37,7 +36,6 @@ export class RoomService { ...@@ -37,7 +36,6 @@ export class RoomService {
{ {
rId: 4, rId: 4,
rName: "รถ", rName: "รถ",
rType: '',
rPic: "assets/img/car.jpg", rPic: "assets/img/car.jpg",
roomLimit: 0, roomLimit: 0,
rDesc: "รถ", rDesc: "รถ",
......
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