Commit 937f7353 by DESKTOP-HF0LVOG\myhr

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

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