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)
}
}
......
......@@ -20,10 +20,11 @@
<div class="card-body">
<button class="btn btn-lg btn-outline-primary"
(click)="Ropen(contentroom)">เพิ่มรายการ</button>
(click)="addroom(contentroom)">เพิ่มรายการ</button>
<div class="row">
<div class="col-sm-3" *ngFor="let item of listRoomModel">
<div class="col-sm-3"
*ngFor="let item of listRoomModel|slice: (pageListRoom-1) * pageSizeListRoom :(pageListRoom-1) * pageSizeListRoom + pageSizeListRoom ;let i = index">
<div class="card" style="
padding: 10px;">
<div class="card-body">
......@@ -38,8 +39,9 @@
<div class="text-center">
<div class="d-grid gap-2 a-md-flex justify-content-md-end ">
<button class="btn btn-sm btn-outline-primary"
(click)="bookRoom(editroom,item)">แก้ไข</button>
<button class="btn btn-sm btn-danger" type="button.dispose" (click)="modal.close()">ลบ</button>
(click)="Ropen(editroom,((pageListRoom-1) * pageSizeListRoom)+i)">แก้ไข</button>
<button class="btn btn-sm btn-danger" type="button.dispose"
(click)="modal.close()">ลบ</button>
</div>
</div>
</div>
......@@ -48,12 +50,14 @@
</div>
<div class="d-flex justify-content-between p-2">
<ngb-pagination [collectionSize]="collectionSize" [(page)]="page" [pageSize]="pageSize"
(pageChange)="refreshCountries()">
<ngb-pagination [collectionSize]="collectionSizeListRoom" [(page)]="pageListRoom"
[pageSize]="pageSizeListRoom">
<ng-template ngbPaginationPrevious>Previous</ng-template>
<ng-template ngbPaginationNext>Next</ng-template>
</ngb-pagination>
<select class="custom-select" style="width: auto" [(ngModel)]="pageSize"
(ngModelChange)="refreshCountries()">
<select class="custom-select" style="width: auto" [(ngModel)]="pageSizeListRoom"
(ngModelChange)="pageListRoom=1">
<option [ngValue]="10">10 items per page</option>
<option [ngValue]="50">50 items per page</option>
<option [ngValue]="100">100 items per page</option>
......@@ -74,10 +78,11 @@
<div class="">
<div class="card-body">
<button class="btn btn-lg btn-outline-primary"
(click)="Eopen(contentequirment)">เพิ่มรายการ</button>
(click)="addequirment(contentequirment)">เพิ่มรายการ</button>
<div class="row">
<div class="col-sm-3" *ngFor="let item of listEquirmentModel">
<div class="col-sm-3"
*ngFor="let item of listEquirmentModel|slice: (page-1) * pageSize :(page-1) * pageSize + pageSize ;let i = index">
<div class="card" style="
padding: 10px;">
<div class="card-body">
......@@ -93,8 +98,9 @@
<div class="text-center">
<div class="d-grid gap-2 a-md-flex justify-content-md-end">
<button class="btn btn-sm btn-outline-primary"
(click)="bookEquir(editLend,item)">แก้ไข</button>
<button class="btn btn-sm btn-danger" type="button.dispose">ลบ</button>
(click)="Eopen(editLend,((page-1) * pageSize)+i)">แก้ไข</button>
<button class="btn btn-sm btn-danger"
type="button.dispose">ลบ</button>
</div>
</div>
</div>
......@@ -103,12 +109,13 @@
</div>
<div class="d-flex justify-content-between p-2">
<ngb-pagination [collectionSize]="collectionSize" [(page)]="page" [pageSize]="pageSize"
(pageChange)="refreshCountries()">
<ngb-pagination [collectionSize]="collectionSize" [(page)]="page" [pageSize]="pageSize">
<ng-template ngbPaginationPrevious>Previous</ng-template>
<ng-template ngbPaginationNext>Next</ng-template>
</ngb-pagination>
<select class="custom-select" style="width: auto" [(ngModel)]="pageSize"
(ngModelChange)="refreshCountries()">
(ngModelChange)="page=1">
<option [ngValue]="10">10 items per page</option>
<option [ngValue]="50">50 items per page</option>
<option [ngValue]="100">100 items per page</option>
......@@ -124,10 +131,10 @@
<div [ngbNavOutlet]="nav"></div>
</div>
<ng-template #contentroom let-modal >
<ng-template #contentroom let-modal>
<div class=" col-md-12" style="padding: 0; ">
<div class="card" style="margin: 0; ">
<div class=" card-header">
<div class="card-header">
<h5 class=" title">Add Equirment</h5>
</div>
<div class=" card-body">
......@@ -145,7 +152,8 @@
<div class=" form-group">
<label> ประเภท </label>
<br>
<select class="form-select" aria-label="Default select example" [(ngModel)]="modelRoom.rType">
<select class="form-select" aria-label="Default select example"
[(ngModel)]="modelRoom.rType">
<option selected>เลือกประเภท</option>
<option value="1">ห้อง</option>
<option value="2">รถ</option>
......@@ -168,13 +176,14 @@
</div>
<div class=" card-footer">
<button class=" btn btn-fill btn-danger" type="submit" (click)="saveRoom()">Save</button>
<button class=" btn btn-fill btn-danger" type="cancel" (click)="modal.dismiss('Cross click')">Cancel</button>
<button class=" btn btn-fill btn-danger" type="cancel"
(click)="modal.dismiss('Cross click')">Cancel</button>
</div>
</div>
</div>
</ng-template>
<ng-template #contentequirment let-modal >
<ng-template #contentequirment let-modal>
<div class=" col-md-12" style="padding: 0; ">
<div class="card" style="margin: 0; ">
<div class=" card-header">
......@@ -186,8 +195,8 @@
<div class=" col-md-12">
<div class=" form-group">
<label> ชื่อ </label>
<input class=" form-control" placeholder="" type="text" [(ngModel)]="modelEquirment.eqName"
value="" />
<input class=" form-control" placeholder="" type="text"
[(ngModel)]="modelEquirment.eqName" value="" />
</div>
</div>
</div>
......@@ -196,8 +205,8 @@
<div class=" form-group">
<label> หมวดหมู่ </label>
<br>
<select class="form-select"
aria-label="Default select example" [(ngModel)]="modelEquirment.eqType">
<select class="form-select" aria-label="Default select example"
[(ngModel)]="modelEquirment.eqType">
<option selected>เลือกหมวดหมู่</option>
<option value="4">IT</option>
<option value="5">Company</option>
......@@ -209,113 +218,91 @@
<div class=" col-md-12">
<div class=" form-group">
<label> รายละเอียด</label>
<textarea class="form-control"
id="exampleFormControlTextarea1" rows="3"
<textarea class="form-control" id="exampleFormControlTextarea1" rows="3"
placeholder="......" [(ngModel)]="modelEquirment.eqDesc"></textarea>
</div>
</div>
</div>
<label for="exampleFormControlFile">แนบไฟล์รูปภาพ</label>
<input type="file" class="form-control-file"
id="exampleFormControlFile">
<input type="file" class="form-control-file" id="exampleFormControlFile">
</form>
</div>
<div class=" card-footer">
<button class=" btn btn-fill btn-danger" type="submit" (click)="saveEquirment()">Save</button>
<button class=" btn btn-fill btn-danger" type="cancel" (click)="modal.dismiss('Cross click')">Cancel</button>
<button class=" btn btn-fill btn-danger" type="cancel"
(click)="modal.dismiss('Cross click')">Cancel</button>
</div>
</div>
</div>
</ng-template>
<ng-template #editroom let-modal >
<ng-template #editroom let-modal>
<div class=" col-md-12" style="padding: 0; ">
<div class="card" style="margin: 0; ">
<div class=" card-header">
<h5 class=" title">แก้ไขข้อมูล</h5>
</div>
<div class=" card-body">
<form>
<div class=" row">
<div class=" col-md-12">
<div class=" form-group">
<label> ชื่อ </label>
<input class=" form-control" type="text" [(ngModel)]="modelroomDetail.room.rName">
</div>
<label>ชื่อ</label>
<input class=" form-control" type="text" [(ngModel)]="listRoomModelEdit.rName">
</div>
</div>
<div class=" row">
<div class=" col-md-12">
<div class=" form-group">
<label> ประเภท </label>
<input class=" form-control" type="text" [(ngModel)]="modelroomDetail.room.rType">
</div>
<label>ประเภท</label>
<input class=" form-control" type="text" [(ngModel)]="listRoomModelEdit.rType">
</div>
</div>
<div class=" row">
<div class=" col-md-12">
<div class=" form-group">
<label> รายละเอียด</label>
<textarea class="form-control" id="exampleFormControlTextarea1" rows="3"
[value]="modelroomDetail.room.rDesc"></textarea>
</div>
<label>รายละเอียด</label>
<input class=" form-control" type="text" [(ngModel)]="listRoomModelEdit.rDesc">
</div>
</div>
</form>
</div>
<div class=" card-footer">
<button class=" btn btn-fill btn-danger" type="submit" (click)="editRoom()">Save</button>
<button class=" btn btn-fill btn-danger" type="cancel" (click)="modal.dismiss('Cross click')">Cancel</button>
<button class=" btn btn-fill btn-danger" type="update"
(click)="updateRoomProfile();modal.dismiss()">Save</button>
<button class=" btn btn-fill btn-danger" type="cancel" (click)="modal.dismiss()">Cancel</button>
</div>
</div>
</div>
</ng-template>
<ng-template #editLend let-modal >
<ng-template #editLend let-modal>
<div class=" col-md-12" style="padding: 0; ">
<div class="card" style="margin: 0; ">
<div class=" card-header">
<h5 class=" title">แก้ไขข้อมูล</h5>
</div>
<div class=" card-body">
<form>
<div class=" row">
<div class=" col-md-12">
<div class=" form-group">
<label> ชื่อ </label>
<input class=" form-control" type="text" [(ngModel)]="modelitemDetail.equirment.eqName">
</div>
</div>
<div class=" row">
<div class=" col-md-12">
<label>ชื่ออุปกรณ์</label>
<input class=" form-control" type="text" [(ngModel)]="listEquirmentModelEdit.eqName">
</div>
<div class=" row">
<div class=" col-md-6 mb-2">
<div class=" form-group">
<label> ประเภท </label>
<br>
<input class=" form-control" type="text" [value]="modelitemDetail.equirment.eqType">
</div>
</div>
<div class=" col-md-12">
<label>ประเภทอุปกรณ์</label>
<input class=" form-control" type="text" [(ngModel)]="listEquirmentModelEdit.eqType">
</div>
<div class=" row">
<div class=" col-md-12">
<div class=" form-group">
<label> รายละเอียด</label>
<textarea class="form-control" id="exampleFormControlTextarea1" rows="3"
[value]="modelitemDetail.equirment.eqDesc"></textarea>
</div>
</div>
<div class=" col-md-12">
<label>รายละเอียดอุปกรณ์</label>
<input class=" form-control" type="text" [(ngModel)]="listEquirmentModelEdit.eqDesc">
</div>
</form>
</div>
</div>
<div class=" card-footer">
<button class=" btn btn-fill btn-danger" type="submit" (click)="saveEquirment()">Save</button>
<button class=" btn btn-fill btn-danger" type="cancel" (click)="modal.dismiss('Cross click')">Cancel</button>
<button class=" btn btn-fill btn-danger" type="update"
(click)="updateItemProfile();modal.dismiss()">Save</button>
<button class=" btn btn-fill btn-danger" type="cancel" (click)="modal.dismiss()">Cancel</button>
</div>
</div>
</div>
</ng-template>
<ng-template #Room let-modal >
<!-- <ng-template #Room let-modal >
<div class=" col-md-12" style="padding: 0; ">
<div class="card" style="margin: 0; ">
<div class=" card-header">
......@@ -388,9 +375,9 @@
</div>
</div>
</div>
</ng-template>
</ng-template> -->
<ng-template #Lend let-modal>
<!-- <ng-template #Lend let-modal>
<div class=" col-md-12" style="padding: 0; ">
<div class="card" style="margin: 0; ">
<div class=" card-header">
......@@ -470,4 +457,4 @@
</div>
</div>
</div>
</ng-template>
\ No newline at end of file
</ng-template> -->
\ No newline at end of file
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)}`;
});
}
Eopen(contentequirment) {
this.modelEquirment = new Equirment();
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)}`;
});
}
Ropen(contentroom) {
this.modelRoom = new Room();
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
// 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
}
}
......@@ -85,12 +85,12 @@
</tr>
</thead>
<tbody>
<tr *ngFor="let item of listroomDetail">
<tr *ngFor="let item of listRoomDetail">
<th scope="row">{{ item.Id }}</th>
<td>{{ item.room.rName }}</td>
<td>{{ item.room.rDesc }}</td>
<td>{{ item.userName }}</td>
<td>{{ item.sDate | date:'dd-MM-yyyy' }} {{ item.sTime.hour }}:{{
<td>{{ item.sDate}} {{ item.sTime.hour }}:{{
item.sTime.minute }}</td>
<td>{{ item.eDate | date:'dd-MM-yyyy' }} {{ item.eTime.hour }}:{{
item.eTime.minute }}</td>
......@@ -144,7 +144,7 @@
</tr>
</thead>
<tbody>
<tr *ngFor="let item of listitemDetail">
<tr *ngFor="let item of listItemDetail">
<th scope="row">{{ item.Id }}</th>
<td>{{ item.equirment.eqType }}</td>
<td>{{ item.equirment.eqName }}</td>
......@@ -199,7 +199,7 @@
<div class=" form-group">
<label> ชื่อผู้จอง </label>
<input readonly class=" form-control" placeholder="" type="text"
value="{{modelroomDetail.userName}}" />
value="{{modelRoomDetail.userName}}" />
</div>
</div>
</div>
......@@ -214,37 +214,37 @@
<div class="row">
<div class="col-sm-12 mb-1">
<label for="exampleFormControlSelect1">ชื่อห้อง</label>
<input readonly class="form-control" type="text" value="{{modelroomDetail.room.rName}}">
<input readonly class="form-control" type="text" value="{{modelRoomDetail.room.rName}}">
</div>
</div>
<div class="row">
<div class="col-sm-12 mb-1">
<label for="exampleFormControlSelect1">รายละเอียด</label>
<input readonly class="form-control" type="text" value="{{modelroomDetail.room.rDesc}}">
<input readonly class="form-control" type="text" value="{{modelRoomDetail.room.rDesc}}">
</div>
</div>
<div class="row">
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">วันที่เริ่มต้น</label>
<input readonly type="text" class="form-control"
value="{{modelroomDetail.sDate | date:'dd-MM-yyyy'}}">
value="{{modelRoomDetail.sDate | date:'dd-MM-yyyy'}}">
</div>
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">วันที่สิ้นสุด</label>
<input readonly type="text" class="form-control"
value="{{modelroomDetail.eDate | date:'dd-MM-yyyy'}}">
value="{{modelRoomDetail.eDate | date:'dd-MM-yyyy'}}">
</div>
</div>
<div class="row">
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">เวลาที่เริ่มต้น</label>
<input readonly class="form-control" type="text"
value="{{modelroomDetail.sTime.hour}} {{modelroomDetail.sTime.minute}}">
value="{{modelRoomDetail.sTime.hour}} {{modelRoomDetail.sTime.minute}}">
</div>
<div class="col-6 mb-1">
<label [readonly] for="exampleFormControlSelect1">เวลาที่สิ้นสุด</label>
<input readonly class="form-control" type="text"
value="{{modelroomDetail.eTime.hour}} {{modelroomDetail.eTime.minute}}">
value="{{modelRoomDetail.eTime.hour}} {{modelRoomDetail.eTime.minute}}">
</div>
</div>
<div class=" row">
......@@ -252,7 +252,7 @@
<div class=" form-group">
<label> หมายเหตุ </label>
<textarea readonly class="form-control" id="exampleFormControlTextarea1" rows="3"
placeholder="......" value="{{modelroomDetail.Remark}}"></textarea>
placeholder="......" value="{{modelRoomDetail.Remark}}"></textarea>
</div>
</div>
</div>
......@@ -279,7 +279,7 @@
<div class=" form-group">
<label> ชื่อผู้จอง </label>
<input readonly class=" form-control" placeholder="" type="text"
value="{{modelitemDetail.userName}}" />
value="{{modelItemDetail.userName}}" />
</div>
</div>
</div>
......@@ -295,45 +295,45 @@
<div class="col-sm-12 mb-1">
<label for="exampleFormControlSelect1">ชื่ออุปกรณ์</label>
<input readonly class="form-control" type="text"
value="{{modelitemDetail.equirment.eqName}}">
value="{{modelItemDetail.equirment.eqName}}">
</div>
</div>
<div class="row">
<div class="col-sm-12 mb-1">
<label for="exampleFormControlSelect1">รายละเอียดอุปกรณ์</label>
<input readonly class="form-control" type="text"
value="{{modelitemDetail.equirment.eqDesc}}">
value="{{modelItemDetail.equirment.eqDesc}}">
</div>
</div>
<div class="row">
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">วันที่เริ่มต้น</label>
<input readonly type="text" class="form-control"
value="{{modelitemDetail.sDate | date:'dd-MM-yyyy'}}">
value="{{modelItemDetail.sDate | date:'dd-MM-yyyy'}}">
</div>
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">วันที่สิ้นสุด</label>
<input readonly type="text" class="form-control"
value="{{modelitemDetail.eDate | date:'dd-MM-yyyy'}}">
value="{{modelItemDetail.eDate | date:'dd-MM-yyyy'}}">
</div>
</div>
<div class="row">
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">เวลาที่เริ่มต้น</label>
<input readonly class="form-control" type="text"
value="{{modelitemDetail.sTime.hour}} {{modelitemDetail.sTime.minute}}">
value="{{modelItemDetail.sTime.hour}} {{modelItemDetail.sTime.minute}}">
</div>
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">เวลาที่สิ้นสุด</label>
<input readonly class="form-control" type="text"
value="{{modelitemDetail.eTime.hour}} {{modelitemDetail.eTime.minute}}">
value="{{modelItemDetail.eTime.hour}} {{modelItemDetail.eTime.minute}}">
</div>
</div>
<div class=" row">
<div class=" col-sm-6 mb-1">
<label for="changequantity">จำนวน</label>
<input readonly id="changequantity" type="number" class="form-control form-control-sm"
value="{{modelitemDetail.Quantity}}" />
value="{{modelItemDetail.Quantity}}" />
</div>
</div>
<div class=" row">
......@@ -341,7 +341,7 @@
<div class=" form-group">
<label> หมายเหตุ </label>
<textarea readonly class="form-control" id="exampleFormControlTextarea1" rows="3"
placeholder="......" value="{{modelitemDetail.Remark}}"></textarea>
placeholder="......" value="{{modelItemDetail.Remark}}"></textarea>
</div>
</div>
</div>
......
......@@ -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);
}
......
......@@ -124,9 +124,9 @@
<ng-template #contentequirment let-modal style="padding: 0; ">
<div class=" col-md-12">
<div class="card">
<ng-template #contentequirment let-modal>
<div class=" col-md-12" style="padding: 0; ">
<div class="card" style="margin: 0; ">
<div class=" card-header">
<h5 class=" title">Add Equirment</h5>
</div>
......@@ -178,9 +178,9 @@
</div>
</ng-template>
<ng-template #contentroom let-modal style="padding: 0; ">
<div class=" col-md-12">
<div class="card">
<ng-template #contentroom let-modal>
<div class=" col-md-12" style="padding: 0; ">
<div class="card" style="margin: 0; ">
<div class=" card-header">
<h5 class=" title">Add Equirment</h5>
</div>
......@@ -228,9 +228,9 @@
</div>
</ng-template>
<ng-template #Room let-modal style="padding: 0; ">
<div class=" col-md-12">
<div class="card">
<ng-template #Room let-modal>
<div class=" col-md-12" style="padding: 0; ">
<div class="card" style="margin: 0; ">
<div class=" card-header">
<h5 class=" title">การจอง</h5>
</div>
......@@ -240,7 +240,7 @@
<div class=" col-md-12">
<div class=" form-group">
<label> ชื่อผู้จอง </label>
<input class=" form-control" placeholder="" type="text" value="" [(ngModel)]="modelroomDetail.userName"/>
<input class=" form-control" placeholder="" type="text" value="" [(ngModel)]="modelRoomDetail.userName"/>
</div>
</div>
</div>
......@@ -248,40 +248,40 @@
<div class=" col-md-12">
<div class=" form-group">
<label> เบอร์โทร </label>
<input class=" form-control" placeholder="" type="text" value="" />
<input class=" form-control" placeholder="" type="text" value="" [(ngModel)]="modelRoomDetail.rTelephone" />
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12 mb-1">
<label for="exampleFormControlSelect1">ชื่อห้อง</label>
<input readonly class="form-control" type="text" [value]="modelroomDetail.room.rName">
<input readonly class="form-control" type="text" [value]="modelRoomDetail.room.rName">
</div>
</div>
<div class="row">
<div class="col-sm-12 mb-1">
<label for="exampleFormControlSelect1">รายละเอียด</label>
<input readonly class="form-control" type="text" [value]="modelroomDetail.room.rDesc">
<input readonly class="form-control" type="text" [value]="modelRoomDetail.room.rDesc">
</div>
</div>
<div class="row">
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">วันที่เริ่มต้น</label>
<input type="date" class="form-control" value="" [(ngModel)]="modelroomDetail.sDate">
<input type="date" class="form-control" value="" [(ngModel)]="modelRoomDetail.sDate">
</div>
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">วันที่สิ้นสุด</label>
<input type="date" class="form-control" value="" [(ngModel)]="modelroomDetail.eDate">
<input type="date" class="form-control" value="" [(ngModel)]="modelRoomDetail.eDate">
</div>
</div>
<div class="row">
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">เวลาที่เริ่มต้น</label>
<ngb-timepicker [(ngModel)]="modelroomDetail.sTime"></ngb-timepicker>
<ngb-timepicker [(ngModel)]="modelRoomDetail.sTime"></ngb-timepicker>
</div>
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">เวลาที่สิ้นสุด</label>
<ngb-timepicker [(ngModel)]="modelroomDetail.etime"></ngb-timepicker>
<ngb-timepicker [(ngModel)]="modelRoomDetail.etime"></ngb-timepicker>
</div>
</div>
<div class=" row">
......@@ -289,7 +289,7 @@
<div class=" form-group">
<label> หมายเหตุ </label>
<textarea class="form-control" id="exampleFormControlTextarea1" rows="3"
placeholder="......" [(ngModel)]="modelroomDetail.Remark"></textarea>
placeholder="......" [(ngModel)]="modelRoomDetail.Remark"></textarea>
</div>
</div>
</div>
......@@ -303,9 +303,9 @@
</div>
</ng-template>
<ng-template #Lend let-modal style="padding: 0; ">
<div class=" col-md-12">
<div class="card">
<ng-template #Lend let-modal>
<div class=" col-md-12" style="padding: 0; ">
<div class="card" style="margin: 0; ">
<div class=" card-header">
<h5 class=" title">เบิกอุปกรณ์</h5>
</div>
......@@ -315,7 +315,7 @@
<div class=" col-sm-12 mb-1">
<div class=" form-group">
<label> ชื่อผู้เบิก </label>
<input class=" form-control" placeholder="" type="text" value="" [(ngModel)]="modelitemDetail.userName"/>
<input class=" form-control" placeholder="" type="text" value="" [(ngModel)]="modelItemDetail.userName"/>
</div>
</div>
</div>
......@@ -323,47 +323,47 @@
<div class=" col-md-12">
<div class=" form-group">
<label> เบอร์โทร </label>
<input class=" form-control" placeholder="" type="text" value="" />
<input class=" form-control" placeholder="" type="text" value="" [(ngModel)]="modelItemDetail.eTelephone"/>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12 mb-1">
<label for="exampleFormControlSelect1">ชื่ออุปกรณ์</label>
<input readonly class="form-control" type="text" [value]="modelitemDetail.equirment.eqName" >
<input readonly class="form-control" type="text" [value]="modelItemDetail.equirment.eqName" >
</div>
</div>
<div class="row">
<div class="col-sm-12 mb-1">
<label for="exampleFormControlSelect1">รายละเอียดอุปกรณ์</label>
<input readonly class="form-control" type="text" [value]="modelitemDetail.equirment.eqDesc">
<input readonly class="form-control" type="text" [value]="modelItemDetail.equirment.eqDesc">
</div>
</div>
<div class="row">
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">วันที่เริ่มต้น</label>
<input type="date" class="form-control" value="" [(ngModel)]="modelitemDetail.sDate">
<input type="date" class="form-control" value="" [(ngModel)]="modelItemDetail.sDate">
</div>
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">วันที่สิ้นสุด</label>
<input type="date" class="form-control" value="" [(ngModel)]="modelitemDetail.eDate">
<input type="date" class="form-control" value="" [(ngModel)]="modelItemDetail.eDate">
</div>
</div>
<div class="row">
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">เวลาที่เริ่มต้น</label>
<ngb-timepicker [(ngModel)]="modelitemDetail.sTime"></ngb-timepicker>
<ngb-timepicker [(ngModel)]="modelItemDetail.sTime"></ngb-timepicker>
</div>
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">เวลาที่สิ้นสุด</label>
<ngb-timepicker [(ngModel)]="modelitemDetail.eTime"></ngb-timepicker>
<ngb-timepicker [(ngModel)]="modelItemDetail.eTime"></ngb-timepicker>
</div>
</div>
<div class=" row">
<div class=" col-sm-6 mb-1">
<label for="changequantity">จำนวน</label>
<input id="changequantity" type="number" class="form-control form-control-sm"
[(ngModel)]="modelitemDetail.Quantity" />
[(ngModel)]="modelItemDetail.Quantity" />
</div>
</div>
<div class=" row">
......@@ -371,7 +371,7 @@
<div class=" form-group">
<label> หมายเหตุ </label>
<textarea class="form-control" id="exampleFormControlTextarea1" rows="3"
placeholder="......" [(ngModel)]="modelitemDetail.Remark"></textarea>
placeholder="......" [(ngModel)]="modelItemDetail.Remark"></textarea>
</div>
</div>
</div>
......
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() { }
......
......@@ -85,7 +85,7 @@
</tr>
</thead>
<tbody>
<tr *ngFor="let item of listroomDetail">
<tr *ngFor="let item of listRoomDetail">
<th scope="row">{{ item.Id }}</th>
<td>{{ item.room.rName }}</td>
<td>{{ item.room.rDesc }}</td>
......@@ -142,7 +142,7 @@
</tr>
</thead>
<tbody>
<tr *ngFor="let item of listitemDetail">
<tr *ngFor="let item of listItemDetail">
<th scope="row">{{ item.Id }}</th>
<td>{{ item.equirment.eqType }}</td>
<td>{{ item.equirment.eqName }}</td>
......@@ -194,7 +194,7 @@
<div class=" col-md-12">
<div class=" form-group">
<label> ชื่อผู้จอง </label>
<input readonly class=" form-control" placeholder="" type="text" value="{{modelroomDetail.userName}}" />
<input readonly class=" form-control" placeholder="" type="text" value="{{modelRoomDetail.userName}}" />
</div>
</div>
</div>
......@@ -209,33 +209,33 @@
<div class="row">
<div class="col-sm-12 mb-1">
<label for="exampleFormControlSelect1">ชื่อห้อง</label>
<input readonly class="form-control" type="text" value="{{modelroomDetail.room.rName}}">
<input readonly class="form-control" type="text" value="{{modelRoomDetail.room.rName}}">
</div>
</div>
<div class="row">
<div class="col-sm-12 mb-1">
<label for="exampleFormControlSelect1">รายละเอียด</label>
<input readonly class="form-control" type="text" value="{{modelroomDetail.room.rDesc}}">
<input readonly class="form-control" type="text" value="{{modelRoomDetail.room.rDesc}}">
</div>
</div>
<div class="row">
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">วันที่เริ่มต้น</label>
<input readonly type="text" class="form-control" value="{{modelroomDetail.sDate | date:'dd-MM-yyyy'}}">
<input readonly type="text" class="form-control" value="{{modelRoomDetail.sDate | date:'dd-MM-yyyy'}}">
</div>
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">วันที่สิ้นสุด</label>
<input readonly type="text" class="form-control" value="{{modelroomDetail.eDate | date:'dd-MM-yyyy'}}">
<input readonly type="text" class="form-control" value="{{modelRoomDetail.eDate | date:'dd-MM-yyyy'}}">
</div>
</div>
<div class="row">
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">เวลาที่เริ่มต้น</label>
<input readonly class="form-control" type="text" value="{{modelroomDetail.sTime.hour}} {{modelroomDetail.sTime.minute}}">
<input readonly class="form-control" type="text" value="{{modelRoomDetail.sTime.hour}} {{modelRoomDetail.sTime.minute}}">
</div>
<div class="col-6 mb-1">
<label [readonly] for="exampleFormControlSelect1">เวลาที่สิ้นสุด</label>
<input readonly class="form-control" type="text" value="{{modelroomDetail.eTime.hour}} {{modelroomDetail.eTime.minute}}">
<input readonly class="form-control" type="text" value="{{modelRoomDetail.eTime.hour}} {{modelRoomDetail.eTime.minute}}">
</div>
</div>
<div class=" row">
......@@ -243,7 +243,7 @@
<div class=" form-group">
<label> หมายเหตุ </label>
<textarea readonly class="form-control" id="exampleFormControlTextarea1" rows="3"
placeholder="......" value="{{modelroomDetail.Remark}}"></textarea>
placeholder="......" value="{{modelRoomDetail.Remark}}"></textarea>
</div>
</div>
</div>
......@@ -265,7 +265,7 @@
<div class=" col-sm-12 mb-1">
<div class=" form-group">
<label> ชื่อผู้จอง </label>
<input readonly class=" form-control" placeholder="" type="text" value="{{modelitemDetail.userName}}" />
<input readonly class=" form-control" placeholder="" type="text" value="{{modelItemDetail.userName}}" />
</div>
</div>
</div>
......@@ -280,39 +280,39 @@
<div class="row">
<div class="col-sm-12 mb-1">
<label for="exampleFormControlSelect1">ชื่ออุปกรณ์</label>
<input readonly class="form-control" type="text" value="{{modelitemDetail.equirment.eqName}}">
<input readonly class="form-control" type="text" value="{{modelItemDetail.equirment.eqName}}">
</div>
</div>
<div class="row">
<div class="col-sm-12 mb-1">
<label for="exampleFormControlSelect1">รายละเอียดอุปกรณ์</label>
<input readonly class="form-control" type="text" value="{{modelitemDetail.equirment.eqDesc}}">
<input readonly class="form-control" type="text" value="{{modelItemDetail.equirment.eqDesc}}">
</div>
</div>
<div class="row">
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">วันที่เริ่มต้น</label>
<input readonly type="text" class="form-control" value="{{modelitemDetail.sDate | date:'dd-MM-yyyy'}}">
<input readonly type="text" class="form-control" value="{{modelItemDetail.sDate | date:'dd-MM-yyyy'}}">
</div>
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">วันที่สิ้นสุด</label>
<input readonly type="text" class="form-control" value="{{modelitemDetail.eDate | date:'dd-MM-yyyy'}}">
<input readonly type="text" class="form-control" value="{{modelItemDetail.eDate | date:'dd-MM-yyyy'}}">
</div>
</div>
<div class="row">
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">เวลาที่เริ่มต้น</label>
<input readonly class="form-control" type="text" value="{{modelitemDetail.sTime.hour}} {{modelitemDetail.sTime.minute}}">
<input readonly class="form-control" type="text" value="{{modelItemDetail.sTime.hour}} {{modelItemDetail.sTime.minute}}">
</div>
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">เวลาที่สิ้นสุด</label>
<input readonly class="form-control" type="text" value="{{modelitemDetail.eTime.hour}} {{modelitemDetail.eTime.minute}}">
<input readonly class="form-control" type="text" value="{{modelItemDetail.eTime.hour}} {{modelItemDetail.eTime.minute}}">
</div>
</div>
<div class=" row">
<div class=" col-sm-6 mb-1">
<label for="changequantity">จำนวน</label>
<input readonly id="changequantity" type="number" class="form-control form-control-sm" value="{{modelitemDetail.Quantity}}" />
<input readonly id="changequantity" type="number" class="form-control form-control-sm" value="{{modelItemDetail.Quantity}}" />
</div>
</div>
<div class=" row">
......@@ -320,7 +320,7 @@
<div class=" form-group">
<label> หมายเหตุ </label>
<textarea readonly class="form-control" id="exampleFormControlTextarea1" rows="3"
placeholder="......" value="{{modelitemDetail.Remark}}" ></textarea>
placeholder="......" value="{{modelItemDetail.Remark}}" ></textarea>
</div>
</div>
</div>
......
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