Commit 749dd2e3 by Your Name

update1

parent d0f3a000
......@@ -60,8 +60,12 @@ export class AdminEquirmentComponent implements OnInit {
}
ngOnInit() {
this.listEquirmentModel = this.equirmentService.getListEquirment();
this.listRoomModel = this.roomService.getListRoom();
this.equirmentService.getListEquirment().subscribe( result => {
this.listEquirmentModel = result;
});
this.roomService.getListRoom().subscribe( result => {
this.listRoomModel = result;
});
this.collectionSizeListRoom = this.listRoomModel.length
this.collectionSize = this.listEquirmentModel.length
this.myFormRoom = new FormGroup({
......
......@@ -209,8 +209,12 @@ export class AdminPendingComponent implements OnInit {
myFormEquir: FormGroup;
ngOnInit(): void {
this.listItemDetail = this.ItemDetailService.getListItemDetail();
this.listRoomDetail = this.RoomDetailService.getListRoomDetail();
this.ItemDetailService.getListItemDetail().subscribe( result => {
this.listItemDetail = result;
});;
this.RoomDetailService.getListRoomDetail().subscribe( result => {
this.listRoomDetail = result;
});;
this.collectionSizeListRoom = this.listItemDetail.length;
}
......
......@@ -62,8 +62,12 @@ export class EquipmentComponent implements OnInit {
}
ngOnInit() {
this.listEquirmentModel = this.equirmentService.getListEquirment();
this.listRoomModel = this.roomService.getListRoom();
this.equirmentService.getListEquirment().subscribe( result => {
this.listEquirmentModel = result;
});
this.roomService.getListRoom().subscribe( result => {
this.listRoomModel = result;
});
this.collectionSizeListRoom = this.listRoomModel.length
this.collectionSize = this.listEquirmentModel.length
this.myFormRoom = new FormGroup({
......
......@@ -204,8 +204,12 @@ export class HomePageComponent implements OnInit {
setTimeout(function () {
window.dispatchEvent(new Event('resize'))
}, 1)
this.listItemDetail = this.ItemDetailService.getListItemDetail();
this.listRoomDetail = this.RoomDetailService.getListRoomDetail();
this.ItemDetailService.getListItemDetail().subscribe( result => {
this.listItemDetail = result;
});;
this.RoomDetailService.getListRoomDetail().subscribe( result => {
this.listRoomDetail = result;
});;
for (let i = 0; i < this.listRoomDetail.length; i++) {
if (this.listRoomDetail[i].rStatus == 0) {
this.eventRoom.push({
......
......@@ -209,8 +209,12 @@ export class PendingComponent implements OnInit {
}
ngOnInit() {
this.listItemDetail = this.ItemDetailService.getListItemDetail();
this.listRoomDetail = this.RoomDetailService.getListRoomDetail();
this.ItemDetailService.getListItemDetail() .subscribe( result => {
this.listItemDetail = result;
});;
this.RoomDetailService.getListRoomDetail() .subscribe( result => {
this.listRoomDetail = result;
});;
this.collectionSizeListRoom = this.listRoomDetail.length;
}
......
......@@ -2,167 +2,20 @@ import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Equirment, SearchEquirmentModel } from '../models/equirment.model';
import { ItemDetail } from '../models/itemDetail.model';
import { Observable } from 'rxjs';
@Injectable({ providedIn: 'root' })
export class EquirmentService {
constructor(private http: HttpClient) { }
url: string = " http://abe9-115-87-232-117.ngrok.io";
listEquirment: Equirment[] = [
{
eqId: 1,
eqName: "จอคอมพิวเตอร์",
eqDesc: "หน้าจอขนาด 22 นิ้ว",
eqType: "it",
eqPic: "assets/img/mo1.jpg"
},
{
eqId: 2,
eqName: "เมาส์",
eqDesc: "...",
eqType: "it",
eqPic: "assets/img/mou.jpg"
},
{
eqId: 3,
eqName: "โน๊ตบุ๊ค",
eqDesc: "หน้าจอขนาด 20 นิ้ว",
eqType: "it",
eqPic: "assets/img/notebook.jpg"
},
{
eqId: 4,
eqName: "คีย์บอร์ด",
eqDesc: "...",
eqType: "it",
eqPic: "assets/img/keyboard.png"
},
{
eqId: 5,
eqName: "จอคอมพิวเตอร์",
eqDesc: "หน้าจอขนาด 22 นิ้ว",
eqType: "it",
eqPic: "assets/img/mo1.jpg"
},
{
eqId: 6,
eqName: "เมาส์",
eqDesc: "...",
eqType: "it",
eqPic: "assets/img/mou.jpg"
},
{
eqId: 7,
eqName: "โน๊ตบุ๊ค",
eqDesc: "หน้าจอขนาด 20 นิ้ว",
eqType: "it",
eqPic: "assets/img/notebook.jpg"
},
{
eqId: 8,
eqName: "คีย์บอร์ด",
eqDesc: "...",
eqType: "it",
eqPic: "assets/img/keyboard.png"
},
{
eqId: 9,
eqName: "จอคอมพิวเตอร์",
eqDesc: "หน้าจอขนาด 22 นิ้ว",
eqType: "it",
eqPic: "assets/img/mo1.jpg"
},
{
eqId: 10,
eqName: "เมาส์",
eqDesc: "...",
eqType: "it",
eqPic: "assets/img/mou.jpg"
},
{
eqId: 11,
eqName: "โน๊ตบุ๊ค",
eqDesc: "หน้าจอขนาด 20 นิ้ว",
eqType: "it",
eqPic: "assets/img/notebook.jpg"
},
{
eqId: 12,
eqName: "คีย์บอร์ด",
eqDesc: "...",
eqType: "it",
eqPic: "assets/img/keyboard.png"
},
{
eqId: 13,
eqName: "จอคอมพิวเตอร์",
eqDesc: "หน้าจอขนาด 22 นิ้ว",
eqType: "it",
eqPic: "assets/img/mo1.jpg"
},
{
eqId: 14,
eqName: "เมาส์",
eqDesc: "...",
eqType: "it",
eqPic: "assets/img/mou.jpg"
},
{
eqId: 15,
eqName: "โน๊ตบุ๊ค",
eqDesc: "หน้าจอขนาด 20 นิ้ว",
eqType: "it",
eqPic: "assets/img/notebook.jpg"
},
{
eqId: 16,
eqName: "คีย์บอร์ด",
eqDesc: "...",
eqType: "it",
eqPic: "assets/img/keyboard.png"
},
{
eqId: 17,
eqName: "จอคอมพิวเตอร์",
eqDesc: "หน้าจอขนาด 22 นิ้ว",
eqType: "it",
eqPic: "assets/img/mo1.jpg"
},
{
eqId: 18,
eqName: "เมาส์",
eqDesc: "...",
eqType: "it",
eqPic: "assets/img/mou.jpg"
},
{
eqId: 19,
eqName: "โน๊ตบุ๊ค",
eqDesc: "หน้าจอขนาด 20 นิ้ว",
eqType: "it",
eqPic: "assets/img/notebook.jpg"
},
{
eqId: 20,
eqName: "คีย์บอร์ด",
eqDesc: "...",
eqType: "it",
eqPic: "assets/img/keyboard.png"
},
]
url: string = "http://11f3-49-0-64-28.ngrok.io";
listEquirment: Equirment[] = []
addEquirment(model: Equirment) {
// this.listEquirment.push(model);
console.log("model", model)
this.http.post(this.url + "/eqment/", {
"eqId": 1,
"eqName": "หูฟัง",
"eqDesc": "...",
"eqType": "it",
"eqPic": "assets/img/mou.jpg"
}).subscribe(response => {
this.http.post(this.url + "/eqment/", model).subscribe(response => {
console.log(response);
})
}
......@@ -170,8 +23,17 @@ export class EquirmentService {
// this.listEquirment.push(models);
// }
getListEquirment() {
return this.listEquirment;
// getListEquirment() {
// this.http.get(this.url + "/eqment/lists").subscribe((response: Equirment[]) => {
// // this.listEquirment = response;
// console.log("...",response);
// return response;
// })
// }
getListEquirment(): Observable<Equirment[]> {
return this.http.get<Equirment[]>(this.url + "/eqment/lists");
}
getListRoom() {
......@@ -203,7 +65,7 @@ export class EquirmentService {
// }
deleteEquirment(EquirmentModel: Equirment) {
this.http.delete(this.url + "/" + EquirmentModel.eqId).subscribe(response => {
this.http.delete(this.url + "/eqment/" + EquirmentModel.eqId).subscribe(response => {
console.log(response);
this.getListRoom()
alert("ลบข้อมูลอุปกรณ์สำเร็จ")
......
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { ItemDetail, SearchItemDetailModel } from '../models/itemDetail.model';
import { Observable } from 'rxjs';
@Injectable({ providedIn: 'root' })
export class ItemDetailService {
constructor(private http: HttpClient) { }
url: string;
listItemDetail: ItemDetail[] = [
{
id : 1,
equirment : {
eqId: 2,
eqName: "เมาส์",
eqDesc: "...",
eqType: "it",
eqPic: "assets/img/mou.jpg"
},
userName: 'เกม',
sDate: '2021-12-09',
eDate: '2021-12-15',
sTime: '22:30',
eTime: '22:30',
eStatus: 0,
Quantity: '1',
eTelephone: '0123456789',
email: 'qwerty@qwerty',
remark: 'test',
allDay: false,
returnItem: true
},
{
id : 2,
equirment : {
eqId: 3,
eqName: "โน๊ตบุ๊ค",
eqDesc: "หน้าจอขนาด 20 นิ้ว",
eqType: "it",
eqPic: "assets/img/notebook.jpg"
},
userName: 'แป๊ะ',
sDate: '2021-12-09',
eDate: '',
sTime: '22:30',
eTime: '22:30',
eStatus: 1,
Quantity: '1',
eTelephone: '0123456789',
email: 'qwerty@qwerty',
remark: 'test',
allDay: false,
returnItem: true
},
]
url: string = "http://11f3-49-0-64-28.ngrok.io";
listItemDetail: ItemDetail[] = []
addItemDetail(model: ItemDetail) {
console.log(this.listItemDetail);
......@@ -63,10 +18,9 @@ export class ItemDetailService {
getListItemDetail() {
return this.listItemDetail;
getListItemDetail() : Observable<ItemDetail[]> {
return this.http.get<ItemDetail[]>(this.url + "/lend/lists");
}
// getListItemDetail() {
// this.http.get(this.url).subscribe((response: any) => {
// console.log(response);
......
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { RoomDetail, SearchRoomDetailModel } from '../models/RoomDetail.model';
import { Observable } from 'rxjs';
import { Equirment } from '../models/equirment.model';
@Injectable({ providedIn: 'root' })
export class RoomDetailService {
constructor(private http: HttpClient) { }
url: string;
listRoomDetail: RoomDetail[] = [
{
id: 1,
room: {
rId: 1,
rName: "ห้องเดียว",
rType: "ห้อง",
rPic: "assets/img/room.jpg",
roomLimit: 25,
rDesc: "จำนวนคน 25 คน",
},
userName: 'เกม',
sDate: '2021-12-16',
eDate: '2021-12-16',
sTime: '22:30',
eTime: '22:30',
rStatus: 0,
rTelephone: '0123456789',
email: 'qwerty@qwerty',
remark: 'test',
allDay: true
},
{
id: 2,
room: {
rId: 1,
rName: "ห้องเดียว",
rType: "ห้อง",
rPic: "assets/img/room.jpg",
roomLimit: 25,
rDesc: "จำนวนคน 25 คน",
},
userName: 'ริว',
sDate: '2021-12-16',
eDate: '2021-12-16',
sTime: '22:30',
eTime: '22:30',
rStatus: 0,
rTelephone: '0123456789',
email: 'qwerty@qwerty',
remark: 'test',
allDay: false
},
{
id: 3,
room: {
rId: 2,
rName: "ห้องคู่",
rType: "ห้อง",
rPic: "assets/img/room.jpg",
roomLimit: 50,
rDesc: "จำนวนคน 50 คน",
},
userName: 'แป๊ะ',
sDate: '2021-12-15',
eDate: '2021-12-15',
sTime: '22:30',
eTime: '22:30',
rStatus: 1,
rTelephone: '0123456789',
email: 'qwerty@qwerty',
remark: 'test',
allDay: true
},
]
url: string = " http://11f3-49-0-64-28.ngrok.io";
listRoomDetail: RoomDetail[] = []
editRoomDetail(model: RoomDetail) {
this.listRoomDetail.push(model)
......@@ -100,9 +37,9 @@ export class RoomDetailService {
}
getListRoomDetail() {
return this.listRoomDetail;
}
getListRoomDetail() : Observable<RoomDetail[]> {
return this.http.get<RoomDetail[]>(this.url + "/book/lists");
}
......
......@@ -7,192 +7,8 @@ import { RoomDetail } from '../models/RoomDetail.model';
export class RoomService {
constructor(private http: HttpClient) { }
url: string = ' http://abe9-115-87-232-117.ngrok.io';
listRoomModel: Room[] = [
{
rId: 1,
rName: "ห้องเดียว",
rType : "ห้อง",
rPic: "assets/img/room.jpg",
roomLimit: 25,
rDesc: "จำนวนคน 25 คน",
},
{
rId: 2,
rName: "ห้องคู่",
rType : "ห้อง",
rPic: "assets/img/room.jpg",
roomLimit: 50,
rDesc: "จำนวนคน 50 คน",
},
{
rId: 3,
rName: "ห้องรวม",
rType : "ห้อง",
rPic: "assets/img/room.jpg",
roomLimit: 100,
rDesc: "จำนวนคน 100 คน",
},
{
rId: 4,
rName: "รถ",
rType : "รถ",
rPic: "assets/img/car.jpg",
roomLimit: 0,
rDesc: "รถ",
}
,
{
rId: 5,
rName: "ห้องคู่",
rType : "ห้อง",
rPic: "assets/img/room.jpg",
roomLimit: 50,
rDesc: "จำนวนคน 50 คน",
},
{
rId: 6,
rName: "ห้องรวม",
rType : "ห้อง",
rPic: "assets/img/room.jpg",
roomLimit: 100,
rDesc: "จำนวนคน 100 คน",
},
{
rId: 7,
rName: "รถ",
rType : "รถ",
rPic: "assets/img/car.jpg",
roomLimit: 0,
rDesc: "รถ",
}
,
{
rId: 8,
rName: "ห้องคู่",
rType : "ห้อง",
rPic: "assets/img/room.jpg",
roomLimit: 50,
rDesc: "จำนวนคน 50 คน",
},
{
rId: 9,
rName: "ห้องรวม",
rType : "ห้อง",
rPic: "assets/img/room.jpg",
roomLimit: 100,
rDesc: "จำนวนคน 100 คน",
},
{
rId: 10,
rName: "รถ",
rType : "รถ",
rPic: "assets/img/car.jpg",
roomLimit: 0,
rDesc: "รถ",
}
,
{
rId: 11,
rName: "ห้องคู่",
rType : "ห้อง",
rPic: "assets/img/room.jpg",
roomLimit: 50,
rDesc: "จำนวนคน 50 คน",
},
{
rId: 12,
rName: "ห้องรวม",
rType : "ห้อง",
rPic: "assets/img/room.jpg",
roomLimit: 100,
rDesc: "จำนวนคน 100 คน",
},
{
rId: 13,
rName: "รถ",
rType : "รถ",
rPic: "assets/img/car.jpg",
roomLimit: 0,
rDesc: "รถ",
}
,
{
rId: 14,
rName: "ห้องคู่",
rType : "ห้อง",
rPic: "assets/img/room.jpg",
roomLimit: 50,
rDesc: "จำนวนคน 50 คน",
},
{
rId: 15,
rName: "ห้องรวม",
rType : "ห้อง",
rPic: "assets/img/room.jpg",
roomLimit: 100,
rDesc: "จำนวนคน 100 คน",
},
{
rId: 16,
rName: "รถ",
rType : "รถ",
rPic: "assets/img/car.jpg",
roomLimit: 0,
rDesc: "รถ",
}
,
{
rId: 17,
rName: "ห้องคู่",
rType : "ห้อง",
rPic: "assets/img/room.jpg",
roomLimit: 50,
rDesc: "จำนวนคน 50 คน",
},
{
rId: 18,
rName: "ห้องรวม",
rType : "ห้อง",
rPic: "assets/img/room.jpg",
roomLimit: 100,
rDesc: "จำนวนคน 100 คน",
},
{
rId: 19,
rName: "รถ",
rType : "รถ",
rPic: "assets/img/car.jpg",
roomLimit: 0,
rDesc: "รถ",
}
,
{
rId: 20,
rName: "ห้องคู่",
rType : "ห้อง",
rPic: "assets/img/room.jpg",
roomLimit: 50,
rDesc: "จำนวนคน 50 คน",
},
{
rId: 21,
rName: "ห้องรวม",
rType : "ห้อง",
rPic: "assets/img/room.jpg",
roomLimit: 100,
rDesc: "จำนวนคน 100 คน",
},
{
rId: 22,
rName: "รถ",
rType : "รถ",
rPic: "assets/img/car.jpg",
roomLimit: 0,
rDesc: "รถ",
}
]
url: string = 'http://11f3-49-0-64-28.ngrok.io';
listRoomModel: Room[] = []
listRoomSearch: Room[] = [];
editroom(model: Room) {
......@@ -201,27 +17,14 @@ export class RoomService {
addRoom(model: Room) {
console.log("model", model)
this.http.post(this.url + "/room/", {
"rName": "wewewe",
"rPic": "assets/img/room.jpg",
"roomLimit": 30,
"rDesc": "จำนวนคน 30 คน",
"rType": "ห้อง"
}).subscribe(response => {
this.http.post(this.url + "/room/", model).subscribe(response => {
console.log(response);
})
}
getListRoom() {
return this.listRoomModel;
// this.http.get(this.url).subscribe((response: any) => {
// console.log(response);
// this.listRoomModel = response.content;
// }, error => {
// console.log(error)
// // alert("ไม่สามารถดึงข้อมูลห้องประชุมได้ เนื่องจาก :\n" + error.message)
// })
return this.http.get<Room[]>(this.url + "/room/lists");
}
searchListRoom(searchModel: SearchRoomModel) {
......
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