Commit 937f7353 by DESKTOP-HF0LVOG\myhr

Update หน้าต่างแก้ไขรายละเอียด เพิ่มเบอร์โทร

parent 2886356c
import { BrowserAnimationsModule } from "@angular/platform-browser/animations"; import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { NgModule } from "@angular/core"; import { NgModule } from "@angular/core";
import { FormsModule } from "@angular/forms"; import { FormsModule, ReactiveFormsModule } from "@angular/forms";
import { HttpClientModule } from "@angular/common/http"; import { HttpClientModule } from "@angular/common/http";
import { RouterModule } from "@angular/router"; import { RouterModule } from "@angular/router";
import { ToastrModule } from 'ngx-toastr'; import { ToastrModule } from 'ngx-toastr';
...@@ -39,6 +39,7 @@ FullCalendarModule.registerPlugins([ // register FullCalendar plugins ...@@ -39,6 +39,7 @@ FullCalendarModule.registerPlugins([ // register FullCalendar plugins
AppRoutingModule, AppRoutingModule,
ToastrModule.forRoot(), ToastrModule.forRoot(),
FullCalendarModule, FullCalendarModule,
ReactiveFormsModule
], ],
declarations: [AppComponent, AdminLayoutComponent, AuthLayoutComponent, HomePageComponent, EquipmentComponent, CalenRoomComponent, AdminPendingComponent, PendingComponent, AdminEquirmentComponent], declarations: [AppComponent, AdminLayoutComponent, AuthLayoutComponent, HomePageComponent, EquipmentComponent, CalenRoomComponent, AdminPendingComponent, PendingComponent, AdminEquirmentComponent],
providers: [], providers: [],
......
import { CategoryModel } from "./itemDetail.model"; import { CategoryModel } from "./ItemDetail.model";
export class Equirment { export class Equirment {
eqId: number; eqId: number;
......
import { Equirment } from "./equirment.model"; import { Equirment } from "./equirment.model";
export class itemDetail { export class ItemDetail {
Id?: number; Id?: number;
equirment : Equirment; equirment : Equirment;
userName: string; userName: string;
...@@ -18,8 +18,9 @@ export class itemDetail { ...@@ -18,8 +18,9 @@ export class itemDetail {
}; };
eStatus: string; eStatus: string;
Quantity: string; Quantity: string;
eTelephone: number;
Remark: string; Remark: string;
constructor(init?: itemDetail) { constructor(init?: ItemDetail) {
Object.assign(this, init); Object.assign(this, init);
this.Id = 1; this.Id = 1;
this.equirment = this.equirment; this.equirment = this.equirment;
...@@ -28,19 +29,20 @@ export class itemDetail { ...@@ -28,19 +29,20 @@ export class itemDetail {
this.eDate = ''; this.eDate = '';
this.eStatus = ''; this.eStatus = '';
this.Quantity = ''; this.Quantity = '';
this.eTelephone = undefined;
this.Remark = ''; this.Remark = '';
} }
} }
export interface SearchitemDetailModel { export interface SearchItemDetailModel {
sDate: string; sDate: string;
eDate: string; eDate: string;
sTime: string; sTime: string;
eTime: string; eTime: string;
} }
export class SearchitemDetailModel { export class SearchItemDetailModel {
constructor(init?: SearchitemDetailModel) { constructor(init?: SearchItemDetailModel) {
Object.assign(this, init); Object.assign(this, init);
this.sDate = '', this.sDate = '',
this.eDate = '', this.eDate = '',
......
import { Room } from "./rooms.model"; import { Room } from "./rooms.model";
export class roomDetail { export class RoomDetail {
Id?: number; Id?: number;
room : Room; room: Room;
userName: string; userName: string;
sDate: string; sDate: string;
eDate: string; eDate: string;
...@@ -16,29 +16,31 @@ export class roomDetail { ...@@ -16,29 +16,31 @@ export class roomDetail {
minute: number; minute: number;
second: number; second: number;
}; };
eStatus: string; rStatus: string;
rTelephone: number;
Remark: string; Remark: string;
constructor(init?: roomDetail) { constructor(init?: RoomDetail) {
Object.assign(this, init); Object.assign(this, init);
this.Id = 1; this.Id = 1;
this.room = this.room; this.room = this.room;
this.userName = ''; this.userName = '';
this.sDate = ''; this.sDate = '';
this.eDate = ''; this.eDate = '';
this.eStatus = ''; this.rStatus = '';
this.rTelephone = undefined;
this.Remark = ''; this.Remark = '';
} }
} }
export interface SearchroomDetailModel { export interface SearchRoomDetailModel {
sDate: string; sDate: string;
eDate: string; eDate: string;
sTime: string; sTime: string;
eTime: string; eTime: string;
} }
export class SearchroomDetailModel { export class SearchRoomDetailModel {
constructor(init?: SearchroomDetailModel) { constructor(init?: SearchRoomDetailModel) {
Object.assign(this, init); Object.assign(this, init);
this.sDate = '', this.sDate = '',
this.eDate = '', this.eDate = '',
......
import { roomDetail } from "./roomDetail.model" import { RoomDetail } from "./RoomDetail.model"
export interface Room {
export class Room {
rId: number; rId: number;
rName: string; rName: string;
rType : string; rType : string;
rPic: string; rPic: string;
roomLimit: number; roomLimit: number;
rDesc: string; rDesc: string;
}
export class MyRoom implements Room{
rId: number;
rName: string;
rType : string;
rPic: string;
roomLimit: number;
rDesc: string;
static rName: any;
constructor(init?: Room) { constructor(init?: Room) {
Object.assign(this, init); // Object.assign(this, init);
this.rId = 0; this.rId = init?.rId!;
this.rName = ''; this.rName = init?.rName!;
this.rPic = ''; this.rPic = '';
this.roomLimit = 0; this.roomLimit = 0;
this.rDesc = ''; this.rDesc = '';
console.log("sssssssssssss",init)
} }
} }
......
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { NgbModal, ModalDismissReasons } from '@ng-bootstrap/ng-bootstrap'; import { NgbModal, ModalDismissReasons } 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 { roomDetail } from 'src/app/models/roomDetail.model'; import { RoomDetail } from 'src/app/models/RoomDetail.model';
import { Room } from 'src/app/models/rooms.model'; import { MyRoom, Room } from 'src/app/models/rooms.model';
import { EquirmentService } from 'src/app/service/equirment.service'; import { EquirmentService } from 'src/app/service/equirment.service';
import { RoomService } from 'src/app/service/room.service'; import { RoomService } from 'src/app/service/room.service';
import { roomDetailService } from 'src/app/service/room-detail.service'; import { RoomDetailService } from 'src/app/service/room-detail.service';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
@Component({ @Component({
selector: 'app-admin-equirment', selector: 'app-admin-equirment',
...@@ -14,39 +15,66 @@ import { roomDetailService } from 'src/app/service/room-detail.service'; ...@@ -14,39 +15,66 @@ import { roomDetailService } from 'src/app/service/room-detail.service';
styleUrls: ['./admin-equirment.component.scss'] styleUrls: ['./admin-equirment.component.scss']
}) })
export class AdminEquirmentComponent implements OnInit { export class AdminEquirmentComponent implements OnInit {
myForm: FormGroup;
time = { hour: 13, minute: 30 }; time = { hour: 13, minute: 30 };
page = 1;
pageSize = 10;
closeResult = ''; closeResult = '';
listEquirmentModel: Equirment[] = []; listEquirmentModel: Equirment[] = [];
listRoomModel: Room[] = []; listRoomModel: Room[] = [];
listitemDetail: itemDetail[] = []; listItemDetail: ItemDetail[] = [];
listroomDetail: roomDetail[] = []; listRoomDetail: RoomDetail[] = [];
collectionSize = this.listEquirmentModel.length; listEquirmentModelEdit: Equirment | undefined;
listRoomModelEdit: Room | undefined;
page = 1;
pageSize = 10;
collectionSize = 0;
pageListRoom = 1;
pageSizeListRoom = 10;
collectionSizeListRoom = 0;
modelEquirment = new Equirment(); modelEquirment = new Equirment();
modelRoom = new Room(); modelRoom: Room
modelitemDetail = new itemDetail(); modelItemDetail = new ItemDetail();
modelroomDetail = new roomDetail(); modelRoomDetail = new RoomDetail();
constructor(private modalService: NgbModal, private equirmentService: EquirmentService, private roomService: RoomService, private roomDetailService : roomDetailService) { RoomForm = new FormGroup({
rId: new FormControl(''),
rName: new FormControl(''),
rType: new FormControl(''),
rPic: new FormControl(''),
roomLimit: new FormControl(''),
rDesc: new FormControl('')
});
constructor(private modalService: NgbModal, private equirmentService: EquirmentService, private roomService: RoomService, private RoomDetailService: RoomDetailService
, private fb: FormBuilder) {
console.log()
this.RoomForm = this.fb.group({
rName: ["",],
rType: ["",],
rDesc: ["",]
});
this.RoomForm.valueChanges.subscribe(console.log);
} }
ngOnInit() { ngOnInit() {
this.listEquirmentModel = this.equirmentService.getListEquirment(); this.listEquirmentModel = this.equirmentService.getListEquirment();
this.listRoomModel = this.roomService.getListRoom(); this.listRoomModel = this.roomService.getListRoom();
this.collectionSizeListRoom = this.listRoomModel.length
console.log("listRoom", this.listRoomModel)
} }
bookEquir(editLend, item: Equirment) { bookEquir(editLend, item: Equirment) {
this.modelitemDetail = new itemDetail(); this.modelItemDetail = new ItemDetail();
this.modelitemDetail.equirment = item; this.modelItemDetail.equirment = item;
console.log("item", this.modelitemDetail); console.log("item", this.modelItemDetail);
this.modalService.open(editLend, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => { this.modalService.open(editLend, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
this.closeResult = `Closed with: ${result}`; this.closeResult = `Closed with: ${result}`;
...@@ -57,28 +85,82 @@ export class AdminEquirmentComponent implements OnInit { ...@@ -57,28 +85,82 @@ export class AdminEquirmentComponent implements OnInit {
bookRoom(editroom, item: Room) { bookRoom(editroom, item: Room) {
this.modelroomDetail = new roomDetail(); // this.modelRoom = new MyRoom({
this.modelroomDetail.room = item; // "rId": 2,
console.log("room", this.modelroomDetail); // "rName": "ห้องคู่",
// "rType": "ห้อง",
// "rPic": "assets/img/room.jpg",
// "roomLimit": 50,
// "rDesc": "จำนวนคน 50 คน"
// });
// this.modelRoom = new MyRoom(item);
console.log("room", this.modelRoom);
this.modalService.open(editroom, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => { this.modalService.open(editroom, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
console.log("RESUT", result)
this.closeResult = `Closed with: ${result}`;
}, (reason) => {
console.log("reason", reason)
this.closeResult = `Dismissed ${this.getDismissReason(reason)}`;
});
}
addroom(contentroom,item : Room) {
this.modelRoom = new MyRoom;
this.modelRoom = item;
this.modalService.open(contentroom, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
console.log("RESUT", result)
this.closeResult = `Closed with: ${result}`;
}, (reason) => {
console.log("reason", reason)
this.closeResult = `Dismissed ${this.getDismissReason(reason)}`;
});
}
addequirment(contentequirment,item : Equirment) {
this.modelEquirment = new Equirment;
this.modelEquirment = item;
this.modalService.open(contentequirment, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
console.log("RESUT", result)
this.closeResult = `Closed with: ${result}`; this.closeResult = `Closed with: ${result}`;
}, (reason) => { }, (reason) => {
console.log("reason", reason)
this.closeResult = `Dismissed ${this.getDismissReason(reason)}`; this.closeResult = `Dismissed ${this.getDismissReason(reason)}`;
}); });
} }
Eopen(contentequirment) { Eopen(contentequirment, index?: number) {
this.modelEquirment = new Equirment(); this.index = index;
let temp = {
eqName: this.listEquirmentModel[this.index].eqName,
eqType: this.listEquirmentModel[this.index].eqType,
eqDesc: this.listEquirmentModel[this.index].eqDesc,
eqId: this.listEquirmentModel[this.index].eqId,
eqPic: this.listEquirmentModel[this.index].eqPic,
}
this.listEquirmentModelEdit = temp
// this.modelEquirment = new Equirment();
this.modalService.open(contentequirment, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => { this.modalService.open(contentequirment, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
this.closeResult = `Closed with: ${result}`; this.closeResult = `Closed with: ${result}`;
}, (reason) => { }, (reason) => {
this.closeResult = `Dismissed ${this.getDismissReason(reason)}`; this.closeResult = `Dismissed ${this.getDismissReason(reason)}`;
}); });
} }
index = -1;
Ropen(contentroom, index?: number) {
this.index = index;
let temp = {
rName: this.listRoomModel[this.index].rName,
rType: this.listRoomModel[this.index].rType,
rDesc: this.listRoomModel[this.index].rDesc,
rId: this.listRoomModel[this.index].rId,
rPic: this.listRoomModel[this.index].rPic,
roomLimit: this.listRoomModel[this.index].roomLimit,
}
this.listRoomModelEdit = temp
Ropen(contentroom) { // this.modelRoom = new MyRoom();
this.modelRoom = new Room();
this.modalService.open(contentroom, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => { this.modalService.open(contentroom, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
this.closeResult = `Closed with: ${result}`; this.closeResult = `Closed with: ${result}`;
}, (reason) => { }, (reason) => {
...@@ -86,8 +168,8 @@ export class AdminEquirmentComponent implements OnInit { ...@@ -86,8 +168,8 @@ export class AdminEquirmentComponent implements OnInit {
}); });
} }
openItemDetail(content: string, item: itemDetail) { openItemDetail(content: string, item: ItemDetail) {
this.modelitemDetail = item; this.modelItemDetail = item;
console.log(item); console.log(item);
this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => { this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
this.closeResult = `Closed with: ${result}`; this.closeResult = `Closed with: ${result}`;
...@@ -96,8 +178,8 @@ export class AdminEquirmentComponent implements OnInit { ...@@ -96,8 +178,8 @@ export class AdminEquirmentComponent implements OnInit {
}); });
} }
openRoomDetail(content: string, item: roomDetail) { openRoomDetail(content: string, item: RoomDetail) {
this.modelroomDetail = item; this.modelRoomDetail = item;
console.log(item); console.log(item);
this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => { this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
this.closeResult = `Closed with: ${result}`; this.closeResult = `Closed with: ${result}`;
...@@ -148,4 +230,32 @@ export class AdminEquirmentComponent implements OnInit { ...@@ -148,4 +230,32 @@ export class AdminEquirmentComponent implements OnInit {
this.modalService.dismissAll(); this.modalService.dismissAll();
this.ngOnInit(); this.ngOnInit();
} }
onSubmit() {
// TODO: Use EventEmitter with form value
console.warn(this.RoomForm.value);
}
updateRoomProfile() {
let temp = {
rName: this.listRoomModelEdit.rName,
rType: this.listRoomModelEdit.rType,
rDesc: this.listRoomModelEdit.rDesc,
rId: this.listRoomModelEdit.rId,
rPic: this.listRoomModelEdit.rPic,
roomLimit: this.listRoomModelEdit.roomLimit,
}
this.listRoomModel[this.index] = temp
}
updateItemProfile() {
let temp = {
eqName: this.listEquirmentModelEdit.eqName,
eqType: this.listEquirmentModelEdit.eqType,
eqDesc: this.listEquirmentModelEdit.eqDesc,
eqId: this.listEquirmentModelEdit.eqId,
eqPic: this.listEquirmentModelEdit.eqPic,
}
this.listEquirmentModel[this.index] = temp
}
} }
...@@ -2,11 +2,11 @@ import { Component, OnInit } from '@angular/core'; ...@@ -2,11 +2,11 @@ import { Component, OnInit } from '@angular/core';
import { NgbDate, NgbCalendar, NgbDateParserFormatter } from '@ng-bootstrap/ng-bootstrap'; import { NgbDate, NgbCalendar, NgbDateParserFormatter } from '@ng-bootstrap/ng-bootstrap';
import { NgbModal, ModalDismissReasons } from '@ng-bootstrap/ng-bootstrap'; import { NgbModal, ModalDismissReasons } 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 { 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 { RoomDetail } from 'src/app/models/RoomDetail.model';
import { roomDetailService } from 'src/app/service/room-detail.service'; import { RoomDetailService } from 'src/app/service/room-detail.service';
import { Room } from 'src/app/models/rooms.model'; import { MyRoom, Room } from 'src/app/models/rooms.model';
@Component({ @Component({
selector: 'app-admin-pending', selector: 'app-admin-pending',
...@@ -46,28 +46,28 @@ export class AdminPendingComponent implements OnInit { ...@@ -46,28 +46,28 @@ export class AdminPendingComponent implements OnInit {
closeResult = ''; closeResult = '';
listitemDetail : itemDetail[] = []; listItemDetail : ItemDetail[] = [];
listroomDetail : roomDetail[] = []; listRoomDetail : RoomDetail[] = [];
modelEquirment = new Equirment(); modelEquirment = new Equirment();
modelRoom = new Room(); modelRoom = new MyRoom();
modelitemDetail = new itemDetail(); modelItemDetail = new ItemDetail();
modelroomDetail = new roomDetail(); modelRoomDetail = new RoomDetail();
collectionSize = this.listitemDetail.length; collectionSize = this.listItemDetail.length;
hoveredDate: NgbDate | null = null; hoveredDate: NgbDate | null = null;
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, private roomDetailService: roomDetailService) { 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();
} }
refreshitemDetail() { refreshItemDetail() {
this.listitemDetail = this.listitemDetail this.listItemDetail = this.listItemDetail
.map((country, i) => ({ id: i + 1, ...country })) .map((country, i) => ({ id: i + 1, ...country }))
.slice((this.page - 1) * this.pageSize, (this.page - 1) * this.pageSize + this.pageSize); .slice((this.page - 1) * this.pageSize, (this.page - 1) * this.pageSize + this.pageSize);
} }
...@@ -91,8 +91,8 @@ export class AdminPendingComponent implements OnInit { ...@@ -91,8 +91,8 @@ export class AdminPendingComponent implements OnInit {
}); });
} }
openItemDetail(content : string ,item : itemDetail) { openItemDetail(content : string ,item : ItemDetail) {
this.modelitemDetail = item ; this.modelItemDetail = item ;
console.log(item); console.log(item);
this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => { this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
this.closeResult = `Closed with: ${result}`; this.closeResult = `Closed with: ${result}`;
...@@ -101,8 +101,8 @@ export class AdminPendingComponent implements OnInit { ...@@ -101,8 +101,8 @@ export class AdminPendingComponent implements OnInit {
}); });
} }
openRoomDetail(content : string ,item : roomDetail) { openRoomDetail(content : string ,item : RoomDetail) {
this.modelroomDetail = item ; this.modelRoomDetail = item ;
console.log(item); console.log(item);
this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => { this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
this.closeResult = `Closed with: ${result}`; this.closeResult = `Closed with: ${result}`;
...@@ -139,9 +139,9 @@ export class AdminPendingComponent implements OnInit { ...@@ -139,9 +139,9 @@ export class AdminPendingComponent implements OnInit {
} }
ngOnInit(): void { ngOnInit(): void {
this.listitemDetail = this.itemDetailService.getListitemDetail(); this.listItemDetail = this.ItemDetailService.getListItemDetail();
this.listroomDetail = this.roomDetailService.getListroomDetail(); this.listRoomDetail = this.RoomDetailService.getListRoomDetail();
console.log(this.listitemDetail); console.log(this.listItemDetail);
} }
......
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { NgbModal, ModalDismissReasons } from '@ng-bootstrap/ng-bootstrap'; import { NgbModal, ModalDismissReasons } 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 { roomDetail } from 'src/app/models/roomDetail.model'; import { RoomDetail } from 'src/app/models/RoomDetail.model';
import { Room } from 'src/app/models/rooms.model'; import { MyRoom, Room } from 'src/app/models/rooms.model';
import { EquirmentService } from 'src/app/service/equirment.service'; import { EquirmentService } from 'src/app/service/equirment.service';
import { itemDetailService } from 'src/app/service/item-detail.service'; import { ItemDetailService } from 'src/app/service/item-detail.service';
import { RoomService } from 'src/app/service/room.service'; import { RoomService } from 'src/app/service/room.service';
import { roomDetailService } from 'src/app/service/room-detail.service'; import { RoomDetailService } from 'src/app/service/room-detail.service';
@Component({ @Component({
...@@ -27,11 +27,11 @@ export class EquipmentComponent implements OnInit { ...@@ -27,11 +27,11 @@ export class EquipmentComponent implements OnInit {
collectionSize = this.listEquirmentModel.length; collectionSize = this.listEquirmentModel.length;
modelEquirment = new Equirment(); modelEquirment = new Equirment();
modelRoom = new Room(); modelRoom = new MyRoom();
modelitemDetail = new itemDetail(); modelItemDetail = new ItemDetail();
modelroomDetail = new roomDetail(); modelRoomDetail = new RoomDetail();
constructor(private modalService: NgbModal, private equirmentService: EquirmentService, private roomService: RoomService, private itemDetailService : itemDetailService, private roomDetailService : roomDetailService) { constructor(private modalService: NgbModal, private equirmentService: EquirmentService, private roomService: RoomService, private ItemDetailService : ItemDetailService, private RoomDetailService : RoomDetailService) {
} }
...@@ -53,9 +53,9 @@ export class EquipmentComponent implements OnInit { ...@@ -53,9 +53,9 @@ export class EquipmentComponent implements OnInit {
bookEquir(Lend,item : Equirment) { bookEquir(Lend,item : Equirment) {
this.modelitemDetail = new itemDetail(); this.modelItemDetail = new ItemDetail();
this.modelitemDetail.equirment = item ; this.modelItemDetail.equirment = item ;
console.log("item",this.modelitemDetail); console.log("item",this.modelItemDetail);
this.modalService.open(Lend, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => { this.modalService.open(Lend, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
this.closeResult = `Closed with: ${result}`; this.closeResult = `Closed with: ${result}`;
...@@ -66,9 +66,9 @@ export class EquipmentComponent implements OnInit { ...@@ -66,9 +66,9 @@ export class EquipmentComponent implements OnInit {
bookRoom(Room,item : Room) { bookRoom(Room,item : Room) {
this.modelroomDetail = new roomDetail(); this.modelRoomDetail = new RoomDetail();
this.modelroomDetail.room = item ; this.modelRoomDetail.room = item ;
console.log("room",this.modelroomDetail); console.log("room",this.modelRoomDetail);
this.modalService.open(Room, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => { this.modalService.open(Room, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
this.closeResult = `Closed with: ${result}`; this.closeResult = `Closed with: ${result}`;
...@@ -78,7 +78,7 @@ export class EquipmentComponent implements OnInit { ...@@ -78,7 +78,7 @@ export class EquipmentComponent implements OnInit {
} }
Ropen(contentroom) { Ropen(contentroom) {
this.modelRoom = new Room(); this.modelRoom = new MyRoom();
this.modalService.open(contentroom, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => { this.modalService.open(contentroom, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
this.closeResult = `Closed with: ${result}`; this.closeResult = `Closed with: ${result}`;
}, (reason) => { }, (reason) => {
...@@ -124,13 +124,13 @@ export class EquipmentComponent implements OnInit { ...@@ -124,13 +124,13 @@ export class EquipmentComponent implements OnInit {
} }
saveLend() { saveLend() {
this.itemDetailService.additemDetail(this.modelitemDetail); this.ItemDetailService.addItemDetail(this.modelItemDetail);
this.modalService.dismissAll(); this.modalService.dismissAll();
this.ngOnInit(); this.ngOnInit();
} }
saveBook() { saveBook() {
this.roomDetailService.addroomDetail(this.modelroomDetail); this.RoomDetailService.addRoomDetail(this.modelRoomDetail);
this.modalService.dismissAll(); this.modalService.dismissAll();
this.ngOnInit(); this.ngOnInit();
} }
......
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { itemDetail } from 'src/app/models/itemDetail.model'; import { ItemDetail } from 'src/app/models/ItemDetail.model';
@Component({ @Component({
selector: 'app-lend-page', selector: 'app-lend-page',
...@@ -8,7 +8,7 @@ import { itemDetail } from 'src/app/models/itemDetail.model'; ...@@ -8,7 +8,7 @@ import { itemDetail } from 'src/app/models/itemDetail.model';
}) })
export class LendPageComponent implements OnInit { export class LendPageComponent implements OnInit {
item: itemDetail[] = []; item: ItemDetail[] = [];
collectionSize = this.item.length; collectionSize = this.item.length;
constructor() { } constructor() { }
......
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { NgbDate, NgbCalendar, NgbDateParserFormatter } from '@ng-bootstrap/ng-bootstrap'; import { NgbDate, NgbCalendar, NgbDateParserFormatter } from '@ng-bootstrap/ng-bootstrap';
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 { RoomDetail } from 'src/app/models/RoomDetail.model';
import { roomDetailService } from 'src/app/service/room-detail.service'; import { RoomDetailService } from 'src/app/service/room-detail.service';
import { Equirment } from 'src/app/models/equirment.model'; import { Equirment } from 'src/app/models/equirment.model';
import { Room } from 'src/app/models/rooms.model'; import { MyRoom, Room } from 'src/app/models/rooms.model';
@Component({ @Component({
selector: 'app-pending', selector: 'app-pending',
...@@ -45,28 +45,28 @@ export class PendingComponent implements OnInit { ...@@ -45,28 +45,28 @@ export class PendingComponent implements OnInit {
closeResult = ''; closeResult = '';
listitemDetail : itemDetail[] = []; listItemDetail : ItemDetail[] = [];
listroomDetail : roomDetail[] = []; listRoomDetail : RoomDetail[] = [];
modelEquirment = new Equirment(); modelEquirment = new Equirment();
modelRoom = new Room(); modelRoom = new MyRoom();
modelitemDetail = new itemDetail(); modelItemDetail = new ItemDetail();
modelroomDetail = new roomDetail(); modelRoomDetail = new RoomDetail();
collectionSize = this.listitemDetail.length; collectionSize = this.listItemDetail.length;
hoveredDate: NgbDate | null = null; hoveredDate: NgbDate | null = null;
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, private roomDetailService: roomDetailService) { 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();
} }
refreshitemDetail() { refreshItemDetail() {
this.listitemDetail = this.listitemDetail this.listItemDetail = this.listItemDetail
.map((item, i) => ({ id: i + 1, ...item })) .map((item, i) => ({ id: i + 1, ...item }))
.slice((this.page - 1) * this.pageSize, (this.page - 1) * this.pageSize + this.pageSize); .slice((this.page - 1) * this.pageSize, (this.page - 1) * this.pageSize + this.pageSize);
} }
...@@ -90,8 +90,8 @@ export class PendingComponent implements OnInit { ...@@ -90,8 +90,8 @@ export class PendingComponent implements OnInit {
}); });
} }
openItemDetail(content : string ,item : itemDetail) { openItemDetail(content : string ,item : ItemDetail) {
this.modelitemDetail = item ; this.modelItemDetail = item ;
console.log(item); console.log(item);
this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => { this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
this.closeResult = `Closed with: ${result}`; this.closeResult = `Closed with: ${result}`;
...@@ -100,8 +100,8 @@ export class PendingComponent implements OnInit { ...@@ -100,8 +100,8 @@ export class PendingComponent implements OnInit {
}); });
} }
openRoomDetail(content : string ,item : roomDetail) { openRoomDetail(content : string ,item : RoomDetail) {
this.modelroomDetail = item ; this.modelRoomDetail = item ;
console.log(item); console.log(item);
this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => { this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
this.closeResult = `Closed with: ${result}`; this.closeResult = `Closed with: ${result}`;
...@@ -139,9 +139,9 @@ export class PendingComponent implements OnInit { ...@@ -139,9 +139,9 @@ export class PendingComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.listitemDetail = this.itemDetailService.getListitemDetail(); this.listItemDetail = this.ItemDetailService.getListItemDetail();
this.listroomDetail = this.roomDetailService.getListroomDetail(); this.listRoomDetail = this.RoomDetailService.getListRoomDetail();
console.log(this.listitemDetail); console.log(this.listItemDetail);
} }
} }
......
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 { itemDetail, SearchitemDetailModel } from '../models/itemDetail.model'; import { ItemDetail, SearchItemDetailModel } from '../models/ItemDetail.model';
@Injectable({ providedIn: 'root' }) @Injectable({ providedIn: 'root' })
export class itemDetailService { export class ItemDetailService {
constructor(private http: HttpClient) { } constructor(private http: HttpClient) { }
url: string; url: string;
listitemDetail: itemDetail[] = [ listItemDetail: ItemDetail[] = [
{ {
Id : 1, Id : 1,
equirment : { equirment : {
...@@ -32,6 +32,7 @@ export class itemDetailService { ...@@ -32,6 +32,7 @@ export class itemDetailService {
}, },
eStatus: 'รอการอนุมัติ', eStatus: 'รอการอนุมัติ',
Quantity: '1', Quantity: '1',
eTelephone: undefined,
Remark: 'test', Remark: 'test',
}, },
{ {
...@@ -58,35 +59,36 @@ export class itemDetailService { ...@@ -58,35 +59,36 @@ export class itemDetailService {
}, },
eStatus: 'รอการอนุมัติ', eStatus: 'รอการอนุมัติ',
Quantity: '1', Quantity: '1',
eTelephone: undefined,
Remark: 'test', Remark: 'test',
}, },
] ]
additemDetail(model: itemDetail) { addItemDetail(model: ItemDetail) {
console.log(this.listitemDetail); console.log(this.listItemDetail);
this.listitemDetail.push(model); this.listItemDetail.push(model);
this.listItemDetail.reverse
} }
getListitemDetail() { getListItemDetail() {
return this.listitemDetail; return this.listItemDetail;
} }
// getListitemDetail() { // getListItemDetail() {
// this.http.get(this.url).subscribe((response: any) => { // this.http.get(this.url).subscribe((response: any) => {
// console.log(response); // console.log(response);
// this.listitemDetail = response.content; // this.listItemDetail = response.content;
// }, error => { // }, error => {
// console.log(error) // console.log(error)
// // alert("ไม่สามารถดึงข้อมูลห้องประชุมได้ เนื่องจาก :\n" + error.message) // // alert("ไม่สามารถดึงข้อมูลห้องประชุมได้ เนื่องจาก :\n" + error.message)
// }) // })
// } // }
searchListitemDetail(searchModel: SearchitemDetailModel) { searchListItemDetail(searchModel: SearchItemDetailModel) {
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) => { 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); console.log(response);
this.listitemDetail = response; this.listItemDetail = response;
}, error => { }, error => {
console.log(error) console.log(error)
alert("ไม่สามารถค้นหาอุปกรณ์ที่ว่างได้ เนื่องจาก :\n" + error.message) alert("ไม่สามารถค้นหาอุปกรณ์ที่ว่างได้ เนื่องจาก :\n" + error.message)
...@@ -101,22 +103,22 @@ export class itemDetailService { ...@@ -101,22 +103,22 @@ export class itemDetailService {
// } // }
deleteitemDetail(itemDetailModel: itemDetail) { deleteItemDetail(ItemDetailModel: ItemDetail) {
this.http.delete(this.url + "/" + itemDetailModel.Id).subscribe(response => { this.http.delete(this.url + "/" + ItemDetailModel.Id).subscribe(response => {
console.log(response); console.log(response);
this.getListitemDetail() this.getListItemDetail()
alert("ลบข้อมูลอุปกรณ์สำเร็จ") alert("ลบข้อมูลอุปกรณ์สำเร็จ")
}) })
} }
updateitemDetail(itemDetailModel: itemDetail) { updateItemDetail(ItemDetailModel: ItemDetail) {
this.http.put(this.url + "/" +itemDetailModel.Id, itemDetailModel).subscribe(response => { this.http.put(this.url + "/" +ItemDetailModel.Id, ItemDetailModel).subscribe(response => {
console.log(response); console.log(response);
alert("อัพเดทข้อมูลอุปกรณ์สำเร็จ") alert("อัพเดทข้อมูลอุปกรณ์สำเร็จ")
}) })
} }
itemDetailModel(eqId: string) { ItemDetailModel(eqId: string) {
} }
......
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 { roomDetail, SearchroomDetailModel } from '../models/roomDetail.model'; import { RoomDetail, SearchRoomDetailModel } from '../models/RoomDetail.model';
@Injectable({ providedIn: 'root' }) @Injectable({ providedIn: 'root' })
export class roomDetailService { export class RoomDetailService {
constructor(private http: HttpClient) { } constructor(private http: HttpClient) { }
url: string; url: string;
listroomDetail: roomDetail[] = [ listRoomDetail: RoomDetail[] = [
{ {
Id: 1, Id: 1,
room: { room: {
...@@ -31,7 +31,8 @@ export class roomDetailService { ...@@ -31,7 +31,8 @@ export class roomDetailService {
minute: 30, minute: 30,
second: 0 second: 0
}, },
eStatus: 'รอการอนุมัติ', rStatus: 'รอการอนุมัติ',
rTelephone: undefined,
Remark: 'test', Remark: 'test',
}, },
{ {
...@@ -57,40 +58,41 @@ export class roomDetailService { ...@@ -57,40 +58,41 @@ export class roomDetailService {
minute: 30, minute: 30,
second: 0 second: 0
}, },
eStatus: 'รอการอนุมัติ', rStatus: 'รอการอนุมัติ',
rTelephone: undefined,
Remark: 'test', Remark: 'test',
}, },
] ]
editroomDetail(model: roomDetail) { editRoomDetail(model: RoomDetail) {
this.listroomDetail.push(model) this.listRoomDetail.push(model)
} }
addroomDetail(model: roomDetail) { addRoomDetail(model: RoomDetail) {
console.log(this.listroomDetail); console.log(this.listRoomDetail);
this.listroomDetail.push(model); this.listRoomDetail.push(model);
} }
getListroomDetail() { getListRoomDetail() {
return this.listroomDetail; return this.listRoomDetail;
} }
// getListroomDetail() { // getListRoomDetail() {
// this.http.get(this.url).subscribe((response: any) => { // this.http.get(this.url).subscribe((response: any) => {
// console.log(response); // console.log(response);
// this.listroomDetail = response.content; // this.listRoomDetail = response.content;
// }, error => { // }, error => {
// console.log(error) // console.log(error)
// // alert("ไม่สามารถดึงข้อมูลห้องประชุมได้ เนื่องจาก :\n" + error.message) // // alert("ไม่สามารถดึงข้อมูลห้องประชุมได้ เนื่องจาก :\n" + error.message)
// }) // })
// } // }
searchListroomDetail(searchModel: SearchroomDetailModel) { 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) => { 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); console.log(response);
this.listroomDetail = response; this.listRoomDetail = response;
}, error => { }, error => {
console.log(error) console.log(error)
alert("ไม่สามารถค้นหาอุปกรณ์ที่ว่างได้ เนื่องจาก :\n" + error.message) alert("ไม่สามารถค้นหาอุปกรณ์ที่ว่างได้ เนื่องจาก :\n" + error.message)
...@@ -105,22 +107,22 @@ export class roomDetailService { ...@@ -105,22 +107,22 @@ export class roomDetailService {
// } // }
deleteroomDetail(roomDetailModel: roomDetail) { deleteRoomDetail(RoomDetailModel: RoomDetail) {
this.http.delete(this.url + "/" + roomDetailModel.Id).subscribe(response => { this.http.delete(this.url + "/" + RoomDetailModel.Id).subscribe(response => {
console.log(response); console.log(response);
this.getListroomDetail() this.getListRoomDetail()
alert("ลบข้อมูลอุปกรณ์สำเร็จ") alert("ลบข้อมูลอุปกรณ์สำเร็จ")
}) })
} }
updateroomDetail(roomDetailModel: roomDetail) { updateRoomDetail(RoomDetailModel: RoomDetail) {
this.http.put(this.url + "/" + roomDetailModel.Id, roomDetailModel).subscribe(response => { this.http.put(this.url + "/" + RoomDetailModel.Id, RoomDetailModel).subscribe(response => {
console.log(response); console.log(response);
alert("อัพเดทข้อมูลอุปกรณ์สำเร็จ") alert("อัพเดทข้อมูลอุปกรณ์สำเร็จ")
}) })
} }
roomDetailModel(rId: string) { RoomDetailModel(rId: string) {
} }
......
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 { roomDetail } from '../models/roomDetail.model'; import { RoomDetail } from '../models/RoomDetail.model';
...@@ -43,6 +43,157 @@ export class RoomService { ...@@ -43,6 +43,157 @@ export class RoomService {
roomLimit: 0, roomLimit: 0,
rDesc: "รถ", 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: 2,
rName: "ห้องคู่",
rType : "ห้อง",
rPic: "assets/img/room.jpg",
roomLimit: 50,
rDesc: "จำนวนคน 50 คน",
},
{
rId: 20,
rName: "ห้องรวม",
rType : "ห้อง",
rPic: "assets/img/room.jpg",
roomLimit: 100,
rDesc: "จำนวนคน 100 คน",
},
{
rId: 21,
rName: "รถ",
rType : "รถ",
rPic: "assets/img/car.jpg",
roomLimit: 0,
rDesc: "รถ",
}
] ]
listRoomSearch: Room[] = []; listRoomSearch: Room[] = [];
......
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