Commit a1386f08 by DESKTOP-HF0LVOG\myhr

updae code

parents 937f7353 bb2ef4af
......@@ -23,6 +23,8 @@ import { AdminPendingComponent } from './pages/admin-pending/admin-pending.compo
import { PendingComponent } from './pages/pending/pending.component';
import { AdminEquirmentComponent } from './pages/admin-equirment/admin-equirment.component';
import { ReactiveFormsModule } from '@angular/forms';
FullCalendarModule.registerPlugins([ // register FullCalendar plugins
dayGridPlugin,
interactionPlugin
......
......@@ -85,19 +85,20 @@
</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}} {{ item.sTime.hour }}:{{
<td>{{ item.sDate.replaceAll("/","-") }} {{ item.sTime.hour }}:{{
item.sTime.minute }}</td>
<td>{{ item.eDate | date:'dd-MM-yyyy' }} {{ item.eTime.hour }}:{{
<td>{{ item.eDate.replaceAll("/","-") }} {{ item.eTime.hour }}:{{
item.eTime.minute }}</td>
<td>{{ item.eStatus }}</td>
<div class="text-center">
<button type="button" class="btn btn-info btn-sm btn-circle " style="line-height: 0px"
(click)="openRoomDetail(Room,item)"><i class="fa fa-search"></i> </button>
<button type="button" class="btn btn-info btn-sm btn-circle "
style="line-height: 0px" (click)="openRoomDetail(Room,item)"><i
class="fa fa-search"></i> </button>
</div>
</tr>
</tbody>
......@@ -144,21 +145,22 @@
</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>
<td>{{ item.equirment.eqDesc }}</td>
<td>{{ item.userName }}</td>
<td>{{ item.sDate | date:'dd-MM-yyyy' }} {{ item.sTime.hour }}:{{
<td>{{ item.sDate.replaceAll("/","-")}} {{ item.sTime.hour }}:{{
item.sTime.minute }}</td>
<td>{{ item.eDate | date:'dd-MM-yyyy' }} {{ item.eTime.hour }}:{{
<td>{{ item.eDate.replaceAll("/","-")}} {{ item.eTime.hour }}:{{
item.eTime.minute }}</td>
<td>{{ item.Quantity }}</td>
<td>{{ item.eStatus }}</td>
<div class="text-center">
<button type="button" class="btn btn-info btn-sm btn-circle " style="line-height: 0px"
(click)="openRoomDetail(Room,item)"><i class="fa fa-search"></i> </button>
<button type="button" class="btn btn-info btn-sm btn-circle "
style="line-height: 0px" (click)="openItemDetail(lend,item)"><i
class="fa fa-search"></i> </button>
</div>
</tr>
</tbody>
......@@ -193,13 +195,12 @@
<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 readonly class=" form-control" placeholder="" type="text"
value="{{modelRoomDetail.userName}}" />
<input class=" form-control" placeholder="" type="text"
[(ngModel)]="modelroomDetail.userName" />
</div>
</div>
</div>
......@@ -207,60 +208,68 @@
<div class=" col-md-12">
<div class=" form-group">
<label> เบอร์โทร </label>
<input readonly class=" form-control" placeholder="" type="text" value="" />
<input class=" form-control" placeholder="" type="text" value="" />
</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 class="form-control" type="text" [(ngModel)]="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 class="form-control" type="text" [(ngModel)]="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 type="date" class="form-control" [(ngModel)]="sDate" (ngModelChange)="rDate(sDate,'sdate')">
</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 type="date" class="form-control" [(ngModel)]="eDate" (ngModelChange)="rDate(eDate,'edate')">
</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 class="form-control" type="time"
[(ngModel)]="thStime" (ngModelChange)="thtimeChange(thStime,modelroomDetail.sTime)">
</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}}">
<label for="exampleFormControlSelect1">เวลาที่สิ้นสุด</label>
<input class="form-control" type="time"
[(ngModel)]="thEtime" (ngModelChange)="thtimeChange(thEtime,modelroomDetail.eTime)">
</div>
</div>
<div class=" row">
<div class=" col-md-12">
<div class=" form-group">
<label> หมายเหตุ </label>
<textarea readonly class="form-control" id="exampleFormControlTextarea1" rows="3"
placeholder="......" value="{{modelRoomDetail.Remark}}"></textarea>
<textarea class="form-control" id="exampleFormControlTextarea1" rows="3"
placeholder="......" value="{{modelroomDetail.Remark}}"></textarea>
</div>
</div>
</div>
<div class=" card-footer">
<button class=" btn btn-fill btn-danger" type="submit" (click)="saveEquirment()">อนุมัติ</button>
<button class=" btn btn-fill btn-danger" type="cancel" (click)="modal.dismiss('Cross click')">ยกเลิก</button>
<button class=" btn btn-fill btn-danger" type="cancel"
(click)="modal.dismiss('Cross click')">ยกเลิก</button>
<div ngbDropdown class="d-inline-block">
<button class="btn btn-sm btn-outline-primary" id="dropdownBasic1"
ngbDropdownToggle>สถานะ</button>
<div ngbDropdownMenu aria-labelledby="dropdownBasic1">
<button ngbDropdownItem>รอดำเนินการ</button>
<button ngbDropdownItem>อนุมัติ</button>
<button ngbDropdownItem>ยกเลิก</button>
<button ngbDropdownItem>สำเร็จแล้ว</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
......@@ -273,13 +282,12 @@
<h5 class=" title">Lend Equirment</h5>
</div>
<div class=" card-body">
<form>
<div class=" row">
<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 class=" form-control" placeholder="" type="text"
[(ngModel)]="modelitemDetail.userName">
</div>
</div>
</div>
......@@ -287,65 +295,60 @@
<div class=" col-md-12">
<div class=" form-group">
<label> เบอร์โทร </label>
<input readonly class=" form-control" placeholder="" type="text" value="" />
<input class=" form-control" placeholder="" type="text" value="" />
</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 class="form-control" type="text" [(ngModel)]="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 class="form-control" type="text" [(ngModel)]="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 type="date" class="form-control" [(ngModel)]="sDate" (ngModelChange)="rDate(sDate,'sdate')">
</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 type="date" class="form-control" [(ngModel)]="eDate" (ngModelChange)="rDate(eDate,'edate')">
</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 class="form-control" type="time"
[(ngModel)]="thStime" (ngModelChange)="thtimeChange(thStime,modelitemDetail.sTime)">
</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 class="form-control" type="text"
[(ngModel)]="thEtime" (ngModelChange)="thtimeChange(thStime,modelitemDetail.eTime)">
</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 id="changequantity" type="number" class="form-control form-control-sm"
value="{{modelitemDetail.Quantity}}" />
</div>
</div>
<div class=" row">
<div class=" col-md-12">
<div class=" form-group">
<label> หมายเหตุ </label>
<textarea readonly class="form-control" id="exampleFormControlTextarea1" rows="3"
placeholder="......" value="{{modelItemDetail.Remark}}"></textarea>
<textarea class="form-control" id="exampleFormControlTextarea1" rows="3"
placeholder="......" value="{{modelitemDetail.Remark}}"></textarea>
</div>
</div>
</div>
</form>
</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 { MyRoom, 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 { Room } from 'src/app/models/rooms.model';
@Component({
selector: 'app-admin-pending',
......@@ -46,28 +46,38 @@ export class AdminPendingComponent implements OnInit {
closeResult = '';
listItemDetail : ItemDetail[] = [];
listRoomDetail : RoomDetail[] = [];
listitemDetail : itemDetail[] = [];
listroomDetail : roomDetail[] = [];
modelEquirment = new Equirment();
modelRoom = new MyRoom();
modelItemDetail = new ItemDetail();
modelRoomDetail = new RoomDetail();
modelRoom = new Room();
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) {
thStime: string;
thEtime: string;
thtimeChange (time:string,item:any){
let timeSplit = time.split(":")
item.hour = parseInt(timeSplit[0])
item.minute = parseInt(timeSplit[1])
console.log(this.modelroomDetail)
}
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);
}
......@@ -90,10 +100,20 @@ export class AdminPendingComponent implements OnInit {
this.closeResult = `Dismissed ${this.getDismissReason(reason)}`;
});
}
openItemDetail(content : string ,item : ItemDetail) {
this.modelItemDetail = item ;
console.log(item);
date='10-12-2561'
show(a:string){
console.log(a)
}
sDate = ""
eDate = ""
openItemDetail(content : string ,item : itemDetail) {
this.modelitemDetail = item ;
this.thStime= this.modelitemDetail.sTime.hour + ':' + this.modelitemDetail.sTime.minute
this.thEtime= this.modelitemDetail.eTime.hour + ':' + this.modelitemDetail.eTime.minute
let SDate = this.modelitemDetail.sDate.split('/')
this.sDate = SDate[2]+"-"+SDate[1]+"-"+SDate[0]
let EDate = this.modelitemDetail.eDate.split('/')
this.eDate = EDate[2]+"-"+EDate[1]+"-"+EDate[0]
this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
this.closeResult = `Closed with: ${result}`;
}, (reason) => {
......@@ -101,9 +121,27 @@ export class AdminPendingComponent implements OnInit {
});
}
openRoomDetail(content : string ,item : RoomDetail) {
this.modelRoomDetail = item ;
console.log(item);
rDate(item: string, item2: string){
let Dates = item.split("-")
let dates = Dates[2]+"/"+Dates[1]+"/"+Dates[0]
if(item2=="sdate"){
this.modelitemDetail.sDate = dates
}
if(item2=="edate"){
this.modelitemDetail.eDate = dates
}
console.log(this.sDate)
}
openRoomDetail(content : string ,item : roomDetail) {
this.modelroomDetail = item ;
this.thStime= this.modelroomDetail.sTime.hour + ':' + this.modelroomDetail.sTime.minute
this.thEtime= this.modelroomDetail.eTime.hour + ':' + this.modelroomDetail.eTime.minute
let SDate = this.modelroomDetail.sDate.split('/')
this.sDate = SDate[2]+"-"+SDate[1]+"-"+SDate[0]
let EDate = this.modelroomDetail.eDate.split('/')
this.eDate = EDate[2]+"-"+EDate[1]+"-"+EDate[0]
this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
this.closeResult = `Closed with: ${result}`;
}, (reason) => {
......@@ -139,9 +177,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);
}
......
......@@ -13,7 +13,7 @@ export class RoomDetailService {
room: {
rId: 1,
rName: "ห้องเดียว",
rType : "ห้อง",
rType: "ห้อง",
rPic: "assets/img/room.jpg",
roomLimit: 25,
rDesc: "จำนวนคน 25 คน",
......@@ -40,7 +40,7 @@ export class RoomDetailService {
room: {
rId: 2,
rName: "ห้องคู่",
rType : "ห้อง",
rType: "ห้อง",
rPic: "assets/img/room.jpg",
roomLimit: 50,
rDesc: "จำนวนคน 50 คน",
......
......@@ -3,8 +3,6 @@ import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Room, SearchRoomModel } from '../models/rooms.model';
import { RoomDetail } from '../models/RoomDetail.model';
@Injectable({ providedIn: 'root' })
export class RoomService {
......
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