Commit bb2ef4af by Chanachai

Add ปุ่มค้นหาสามารถเอาข้อมูลมา

parent 2886356c
...@@ -23,6 +23,8 @@ import { AdminPendingComponent } from './pages/admin-pending/admin-pending.compo ...@@ -23,6 +23,8 @@ import { AdminPendingComponent } from './pages/admin-pending/admin-pending.compo
import { PendingComponent } from './pages/pending/pending.component'; import { PendingComponent } from './pages/pending/pending.component';
import { AdminEquirmentComponent } from './pages/admin-equirment/admin-equirment.component'; import { AdminEquirmentComponent } from './pages/admin-equirment/admin-equirment.component';
import { ReactiveFormsModule } from '@angular/forms';
FullCalendarModule.registerPlugins([ // register FullCalendar plugins FullCalendarModule.registerPlugins([ // register FullCalendar plugins
dayGridPlugin, dayGridPlugin,
interactionPlugin interactionPlugin
...@@ -39,6 +41,7 @@ FullCalendarModule.registerPlugins([ // register FullCalendar plugins ...@@ -39,6 +41,7 @@ FullCalendarModule.registerPlugins([ // register FullCalendar plugins
AppRoutingModule, AppRoutingModule,
ToastrModule.forRoot(), ToastrModule.forRoot(),
FullCalendarModule, FullCalendarModule,
ReactiveFormsModule,
], ],
declarations: [AppComponent, AdminLayoutComponent, AuthLayoutComponent, HomePageComponent, EquipmentComponent, CalenRoomComponent, AdminPendingComponent, PendingComponent, AdminEquirmentComponent], declarations: [AppComponent, AdminLayoutComponent, AuthLayoutComponent, HomePageComponent, EquipmentComponent, CalenRoomComponent, AdminPendingComponent, PendingComponent, AdminEquirmentComponent],
providers: [], providers: [],
......
...@@ -11,6 +11,7 @@ export class Room { ...@@ -11,6 +11,7 @@ export class Room {
Object.assign(this, init); Object.assign(this, init);
this.rId = 0; this.rId = 0;
this.rName = ''; this.rName = '';
this.rType = '';
this.rPic = ''; this.rPic = '';
this.roomLimit = 0; this.roomLimit = 0;
this.rDesc = ''; this.rDesc = '';
......
...@@ -39,7 +39,8 @@ ...@@ -39,7 +39,8 @@
<div class="d-grid gap-2 a-md-flex justify-content-md-end "> <div class="d-grid gap-2 a-md-flex justify-content-md-end ">
<button class="btn btn-sm btn-outline-primary" <button class="btn btn-sm btn-outline-primary"
(click)="bookRoom(editroom,item)">แก้ไข</button> (click)="bookRoom(editroom,item)">แก้ไข</button>
<button class="btn btn-sm btn-danger" type="button.dispose" (click)="modal.close()">ลบ</button> <button class="btn btn-sm btn-danger" type="button.dispose"
(click)="modal.close()">ลบ</button>
</div> </div>
</div> </div>
</div> </div>
...@@ -94,7 +95,8 @@ ...@@ -94,7 +95,8 @@
<div class="d-grid gap-2 a-md-flex justify-content-md-end"> <div class="d-grid gap-2 a-md-flex justify-content-md-end">
<button class="btn btn-sm btn-outline-primary" <button class="btn btn-sm btn-outline-primary"
(click)="bookEquir(editLend,item)">แก้ไข</button> (click)="bookEquir(editLend,item)">แก้ไข</button>
<button class="btn btn-sm btn-danger" type="button.dispose">ลบ</button> <button class="btn btn-sm btn-danger"
type="button.dispose">ลบ</button>
</div> </div>
</div> </div>
</div> </div>
...@@ -114,7 +116,6 @@ ...@@ -114,7 +116,6 @@
<option [ngValue]="100">100 items per page</option> <option [ngValue]="100">100 items per page</option>
</select> </select>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
...@@ -124,7 +125,7 @@ ...@@ -124,7 +125,7 @@
<div [ngbNavOutlet]="nav"></div> <div [ngbNavOutlet]="nav"></div>
</div> </div>
<ng-template #contentroom let-modal > <ng-template #contentroom let-modal>
<div class=" col-md-12" style="padding: 0; "> <div class=" col-md-12" style="padding: 0; ">
<div class="card" style="margin: 0; "> <div class="card" style="margin: 0; ">
<div class=" card-header"> <div class=" card-header">
...@@ -145,7 +146,8 @@ ...@@ -145,7 +146,8 @@
<div class=" form-group"> <div class=" form-group">
<label> ประเภท </label> <label> ประเภท </label>
<br> <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 selected>เลือกประเภท</option>
<option value="1">ห้อง</option> <option value="1">ห้อง</option>
<option value="2">รถ</option> <option value="2">รถ</option>
...@@ -168,13 +170,14 @@ ...@@ -168,13 +170,14 @@
</div> </div>
<div class=" card-footer"> <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="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> </div>
</div> </div>
</ng-template> </ng-template>
<ng-template #contentequirment let-modal > <ng-template #contentequirment let-modal>
<div class=" col-md-12" style="padding: 0; "> <div class=" col-md-12" style="padding: 0; ">
<div class="card" style="margin: 0; "> <div class="card" style="margin: 0; ">
<div class=" card-header"> <div class=" card-header">
...@@ -186,8 +189,8 @@ ...@@ -186,8 +189,8 @@
<div class=" col-md-12"> <div class=" col-md-12">
<div class=" form-group"> <div class=" form-group">
<label> ชื่อ </label> <label> ชื่อ </label>
<input class=" form-control" placeholder="" type="text" [(ngModel)]="modelEquirment.eqName" <input class=" form-control" placeholder="" type="text"
value="" /> [(ngModel)]="modelEquirment.eqName" value="" />
</div> </div>
</div> </div>
</div> </div>
...@@ -196,8 +199,8 @@ ...@@ -196,8 +199,8 @@
<div class=" form-group"> <div class=" form-group">
<label> หมวดหมู่ </label> <label> หมวดหมู่ </label>
<br> <br>
<select class="form-select" <select class="form-select" aria-label="Default select example"
aria-label="Default select example" [(ngModel)]="modelEquirment.eqType"> [(ngModel)]="modelEquirment.eqType">
<option selected>เลือกหมวดหมู่</option> <option selected>เลือกหมวดหมู่</option>
<option value="4">IT</option> <option value="4">IT</option>
<option value="5">Company</option> <option value="5">Company</option>
...@@ -209,26 +212,25 @@ ...@@ -209,26 +212,25 @@
<div class=" col-md-12"> <div class=" col-md-12">
<div class=" form-group"> <div class=" form-group">
<label> รายละเอียด</label> <label> รายละเอียด</label>
<textarea class="form-control" <textarea class="form-control" id="exampleFormControlTextarea1" rows="3"
id="exampleFormControlTextarea1" rows="3"
placeholder="......" [(ngModel)]="modelEquirment.eqDesc"></textarea> placeholder="......" [(ngModel)]="modelEquirment.eqDesc"></textarea>
</div> </div>
</div> </div>
</div> </div>
<label for="exampleFormControlFile">แนบไฟล์รูปภาพ</label> <label for="exampleFormControlFile">แนบไฟล์รูปภาพ</label>
<input type="file" class="form-control-file" <input type="file" class="form-control-file" id="exampleFormControlFile">
id="exampleFormControlFile">
</form> </form>
</div> </div>
<div class=" card-footer"> <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="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> </div>
</div> </div>
</ng-template> </ng-template>
<ng-template #editroom let-modal > <ng-template #editroom let-modal>
<div class=" col-md-12" style="padding: 0; "> <div class=" col-md-12" style="padding: 0; ">
<div class="card" style="margin: 0; "> <div class="card" style="margin: 0; ">
<div class=" card-header"> <div class=" card-header">
...@@ -240,7 +242,8 @@ ...@@ -240,7 +242,8 @@
<div class=" col-md-12"> <div class=" col-md-12">
<div class=" form-group"> <div class=" form-group">
<label> ชื่อ </label> <label> ชื่อ </label>
<input class=" form-control" type="text" [(ngModel)]="modelroomDetail.room.rName"> <input class=" form-control" type="text" [(ngModel)]="modelroomDetail.room.rName"
value="" />
</div> </div>
</div> </div>
</div> </div>
...@@ -261,17 +264,32 @@ ...@@ -261,17 +264,32 @@
</div> </div>
</div> </div>
</div> </div>
<form [formGroup]="myForm">
Value: {{ myForm.value | json }}
<hr>
<input placeholder="First name" formControlName="firstName">
<input placeholder="Last name" formControlName="lastName">
<input placeholder="email" formControlName="email">
<input placeholder="phone" formControlName="phone">
<div formGroupName="address">
<input placeholder="house number, road" formControlName="address1">
<input placeholder="sub districe, district" formControlName="address2">
<input placeholder="province" formControlName="province">
<input placeholder="postalCode" formControlName="postalCode">
</div>
</form>
</form> </form>
</div> </div>
<div class=" card-footer"> <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="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="cancel"
(click)="modal.dismiss('Cross click')">Cancel</button>
</div> </div>
</div> </div>
</div> </div>
</ng-template> </ng-template>
<ng-template #editLend let-modal > <ng-template #editLend let-modal>
<div class=" col-md-12" style="padding: 0; "> <div class=" col-md-12" style="padding: 0; ">
<div class="card" style="margin: 0; "> <div class="card" style="margin: 0; ">
<div class=" card-header"> <div class=" card-header">
...@@ -309,13 +327,14 @@ ...@@ -309,13 +327,14 @@
</div> </div>
<div class=" card-footer"> <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="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> </div>
</div> </div>
</ng-template> </ng-template>
<ng-template #Room let-modal > <ng-template #Room let-modal>
<div class=" col-md-12" style="padding: 0; "> <div class=" col-md-12" style="padding: 0; ">
<div class="card" style="margin: 0; "> <div class="card" style="margin: 0; ">
<div class=" card-header"> <div class=" card-header">
......
...@@ -7,6 +7,7 @@ import { Room } from 'src/app/models/rooms.model'; ...@@ -7,6 +7,7 @@ import { Room } from 'src/app/models/rooms.model';
import { EquirmentService } from 'src/app/service/equirment.service'; import { EquirmentService } from 'src/app/service/equirment.service';
import { RoomService } from 'src/app/service/room.service'; import { RoomService } from 'src/app/service/room.service';
import { roomDetailService } from 'src/app/service/room-detail.service'; import { roomDetailService } from 'src/app/service/room-detail.service';
import { FormBuilder, FormGroup } from '@angular/forms';
@Component({ @Component({
selector: 'app-admin-equirment', selector: 'app-admin-equirment',
...@@ -14,6 +15,7 @@ import { roomDetailService } from 'src/app/service/room-detail.service'; ...@@ -14,6 +15,7 @@ import { roomDetailService } from 'src/app/service/room-detail.service';
styleUrls: ['./admin-equirment.component.scss'] styleUrls: ['./admin-equirment.component.scss']
}) })
export class AdminEquirmentComponent implements OnInit { export class AdminEquirmentComponent implements OnInit {
myForm: FormGroup;
time = { hour: 13, minute: 30 }; time = { hour: 13, minute: 30 };
page = 1; page = 1;
pageSize = 10; pageSize = 10;
...@@ -33,8 +35,21 @@ export class AdminEquirmentComponent implements OnInit { ...@@ -33,8 +35,21 @@ export class AdminEquirmentComponent implements OnInit {
modelitemDetail = new itemDetail(); modelitemDetail = new itemDetail();
modelroomDetail = new roomDetail(); modelroomDetail = new roomDetail();
constructor(private modalService: NgbModal, private equirmentService: EquirmentService, private roomService: RoomService, private roomDetailService : roomDetailService) { constructor(private modalService: NgbModal, private equirmentService: EquirmentService, private roomService: RoomService, private roomDetailService: roomDetailService, private fb: FormBuilder
) {
this.myForm = this.fb.group({
firstName: '',
lastName: '',
email: '',
phone: '',
address: this.fb.group({
address1: '',
address2: '',
province: '',
postalCode: ''
})
});
this.myForm.valueChanges.subscribe(console.log);
} }
ngOnInit() { ngOnInit() {
...@@ -144,7 +159,7 @@ export class AdminEquirmentComponent implements OnInit { ...@@ -144,7 +159,7 @@ export class AdminEquirmentComponent implements OnInit {
} }
editRoom() { editRoom() {
this.roomService.editroom(this.modelRoom); this.roomDetailService.editroomDetail(this.modelroomDetail);
this.modalService.dismissAll(); this.modalService.dismissAll();
this.ngOnInit(); this.ngOnInit();
} }
......
...@@ -90,14 +90,15 @@ ...@@ -90,14 +90,15 @@
<td>{{ item.room.rName }}</td> <td>{{ item.room.rName }}</td>
<td>{{ item.room.rDesc }}</td> <td>{{ item.room.rDesc }}</td>
<td>{{ item.userName }}</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> 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> item.eTime.minute }}</td>
<td>{{ item.eStatus }}</td> <td>{{ item.eStatus }}</td>
<div class="text-center"> <div class="text-center">
<button type="button" class="btn btn-info btn-sm btn-circle " style="line-height: 0px" <button type="button" class="btn btn-info btn-sm btn-circle "
(click)="openRoomDetail(Room,item)"><i class="fa fa-search"></i> </button> style="line-height: 0px" (click)="openRoomDetail(Room,item)"><i
class="fa fa-search"></i> </button>
</div> </div>
</tr> </tr>
</tbody> </tbody>
...@@ -150,15 +151,16 @@ ...@@ -150,15 +151,16 @@
<td>{{ item.equirment.eqName }}</td> <td>{{ item.equirment.eqName }}</td>
<td>{{ item.equirment.eqDesc }}</td> <td>{{ item.equirment.eqDesc }}</td>
<td>{{ item.userName }}</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> 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> item.eTime.minute }}</td>
<td>{{ item.Quantity }}</td> <td>{{ item.Quantity }}</td>
<td>{{ item.eStatus }}</td> <td>{{ item.eStatus }}</td>
<div class="text-center"> <div class="text-center">
<button type="button" class="btn btn-info btn-sm btn-circle " style="line-height: 0px" <button type="button" class="btn btn-info btn-sm btn-circle "
(click)="openRoomDetail(Room,item)"><i class="fa fa-search"></i> </button> style="line-height: 0px" (click)="openItemDetail(lend,item)"><i
class="fa fa-search"></i> </button>
</div> </div>
</tr> </tr>
</tbody> </tbody>
...@@ -193,13 +195,12 @@ ...@@ -193,13 +195,12 @@
<h5 class=" title">การจอง</h5> <h5 class=" title">การจอง</h5>
</div> </div>
<div class=" card-body"> <div class=" card-body">
<form>
<div class=" row"> <div class=" row">
<div class=" col-md-12"> <div class=" col-md-12">
<div class=" form-group"> <div class=" form-group">
<label> ชื่อผู้จอง </label> <label> ชื่อผู้จอง </label>
<input readonly class=" form-control" placeholder="" type="text" <input class=" form-control" placeholder="" type="text"
value="{{modelroomDetail.userName}}" /> [(ngModel)]="modelroomDetail.userName" />
</div> </div>
</div> </div>
</div> </div>
...@@ -207,60 +208,68 @@ ...@@ -207,60 +208,68 @@
<div class=" col-md-12"> <div class=" col-md-12">
<div class=" form-group"> <div class=" form-group">
<label> เบอร์โทร </label> <label> เบอร์โทร </label>
<input readonly class=" form-control" placeholder="" type="text" value="" /> <input class=" form-control" placeholder="" type="text" value="" />
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-sm-12 mb-1"> <div class="col-sm-12 mb-1">
<label for="exampleFormControlSelect1">ชื่อห้อง</label> <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> </div>
<div class="row"> <div class="row">
<div class="col-sm-12 mb-1"> <div class="col-sm-12 mb-1">
<label for="exampleFormControlSelect1">รายละเอียด</label> <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> </div>
<div class="row"> <div class="row">
<div class="col-6 mb-1"> <div class="col-6 mb-1">
<label for="exampleFormControlSelect1">วันที่เริ่มต้น</label> <label for="exampleFormControlSelect1">วันที่เริ่มต้น</label>
<input readonly type="text" class="form-control" <input type="date" class="form-control" [(ngModel)]="sDate" (ngModelChange)="rDate(sDate,'sdate')">
value="{{modelroomDetail.sDate | date:'dd-MM-yyyy'}}">
</div> </div>
<div class="col-6 mb-1"> <div class="col-6 mb-1">
<label for="exampleFormControlSelect1">วันที่สิ้นสุด</label> <label for="exampleFormControlSelect1">วันที่สิ้นสุด</label>
<input readonly type="text" class="form-control" <input type="date" class="form-control" [(ngModel)]="eDate" (ngModelChange)="rDate(eDate,'edate')">
value="{{modelroomDetail.eDate | date:'dd-MM-yyyy'}}">
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-6 mb-1"> <div class="col-6 mb-1">
<label for="exampleFormControlSelect1">เวลาที่เริ่มต้น</label> <label for="exampleFormControlSelect1">เวลาที่เริ่มต้น</label>
<input readonly class="form-control" type="text" <input class="form-control" type="time"
value="{{modelroomDetail.sTime.hour}} {{modelroomDetail.sTime.minute}}"> [(ngModel)]="thStime" (ngModelChange)="thtimeChange(thStime,modelroomDetail.sTime)">
</div> </div>
<div class="col-6 mb-1"> <div class="col-6 mb-1">
<label [readonly] for="exampleFormControlSelect1">เวลาที่สิ้นสุด</label> <label for="exampleFormControlSelect1">เวลาที่สิ้นสุด</label>
<input readonly class="form-control" type="text" <input class="form-control" type="time"
value="{{modelroomDetail.eTime.hour}} {{modelroomDetail.eTime.minute}}"> [(ngModel)]="thEtime" (ngModelChange)="thtimeChange(thEtime,modelroomDetail.eTime)">
</div> </div>
</div> </div>
<div class=" row"> <div class=" row">
<div class=" col-md-12"> <div class=" col-md-12">
<div class=" form-group"> <div class=" form-group">
<label> หมายเหตุ </label> <label> หมายเหตุ </label>
<textarea readonly class="form-control" id="exampleFormControlTextarea1" rows="3" <textarea class="form-control" id="exampleFormControlTextarea1" rows="3"
placeholder="......" value="{{modelroomDetail.Remark}}"></textarea> placeholder="......" value="{{modelroomDetail.Remark}}"></textarea>
</div> </div>
</div> </div>
</div> </div>
<div class=" card-footer"> <div class=" card-footer">
<button class=" btn btn-fill btn-danger" type="submit" (click)="saveEquirment()">อนุมัติ</button> <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> </div>
</form>
</div> </div>
</div> </div>
</div> </div>
...@@ -273,13 +282,12 @@ ...@@ -273,13 +282,12 @@
<h5 class=" title">Lend Equirment</h5> <h5 class=" title">Lend Equirment</h5>
</div> </div>
<div class=" card-body"> <div class=" card-body">
<form>
<div class=" row"> <div class=" row">
<div class=" col-sm-12 mb-1"> <div class=" col-sm-12 mb-1">
<div class=" form-group"> <div class=" form-group">
<label> ชื่อผู้จอง </label> <label> ชื่อผู้จอง </label>
<input readonly class=" form-control" placeholder="" type="text" <input class=" form-control" placeholder="" type="text"
value="{{modelitemDetail.userName}}" /> [(ngModel)]="modelitemDetail.userName">
</div> </div>
</div> </div>
</div> </div>
...@@ -287,52 +295,48 @@ ...@@ -287,52 +295,48 @@
<div class=" col-md-12"> <div class=" col-md-12">
<div class=" form-group"> <div class=" form-group">
<label> เบอร์โทร </label> <label> เบอร์โทร </label>
<input readonly class=" form-control" placeholder="" type="text" value="" /> <input class=" form-control" placeholder="" type="text" value="" />
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-sm-12 mb-1"> <div class="col-sm-12 mb-1">
<label for="exampleFormControlSelect1">ชื่ออุปกรณ์</label> <label for="exampleFormControlSelect1">ชื่ออุปกรณ์</label>
<input readonly class="form-control" type="text" <input class="form-control" type="text" [(ngModel)]="modelitemDetail.equirment.eqName">
value="{{modelitemDetail.equirment.eqName}}">
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-sm-12 mb-1"> <div class="col-sm-12 mb-1">
<label for="exampleFormControlSelect1">รายละเอียดอุปกรณ์</label> <label for="exampleFormControlSelect1">รายละเอียดอุปกรณ์</label>
<input readonly class="form-control" type="text" <input class="form-control" type="text" [(ngModel)]="modelitemDetail.equirment.eqDesc">
value="{{modelitemDetail.equirment.eqDesc}}">
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-6 mb-1"> <div class="col-6 mb-1">
<label for="exampleFormControlSelect1">วันที่เริ่มต้น</label> <label for="exampleFormControlSelect1">วันที่เริ่มต้น</label>
<input readonly type="text" class="form-control" <input type="date" class="form-control" [(ngModel)]="sDate" (ngModelChange)="rDate(sDate,'sdate')">
value="{{modelitemDetail.sDate | date:'dd-MM-yyyy'}}">
</div> </div>
<div class="col-6 mb-1"> <div class="col-6 mb-1">
<label for="exampleFormControlSelect1">วันที่สิ้นสุด</label> <label for="exampleFormControlSelect1">วันที่สิ้นสุด</label>
<input readonly type="text" class="form-control" <input type="date" class="form-control" [(ngModel)]="eDate" (ngModelChange)="rDate(eDate,'edate')">
value="{{modelitemDetail.eDate | date:'dd-MM-yyyy'}}">
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-6 mb-1"> <div class="col-6 mb-1">
<label for="exampleFormControlSelect1">เวลาที่เริ่มต้น</label> <label for="exampleFormControlSelect1">เวลาที่เริ่มต้น</label>
<input readonly class="form-control" type="text" <input class="form-control" type="time"
value="{{modelitemDetail.sTime.hour}} {{modelitemDetail.sTime.minute}}"> [(ngModel)]="thStime" (ngModelChange)="thtimeChange(thStime,modelitemDetail.sTime)">
</div> </div>
<div class="col-6 mb-1"> <div class="col-6 mb-1">
<label for="exampleFormControlSelect1">เวลาที่สิ้นสุด</label> <label for="exampleFormControlSelect1">เวลาที่สิ้นสุด</label>
<input readonly class="form-control" type="text" <input class="form-control" type="text"
value="{{modelitemDetail.eTime.hour}} {{modelitemDetail.eTime.minute}}"> [(ngModel)]="thEtime" (ngModelChange)="thtimeChange(thStime,modelitemDetail.eTime)">
</div> </div>
</div> </div>
<div class=" row"> <div class=" row">
<div class=" col-sm-6 mb-1"> <div class=" col-sm-6 mb-1">
<label for="changequantity">จำนวน</label> <label for="changequantity">จำนวน</label>
<input readonly id="changequantity" type="number" class="form-control form-control-sm" <input id="changequantity" type="number" class="form-control form-control-sm"
value="{{modelitemDetail.Quantity}}" /> value="{{modelitemDetail.Quantity}}" />
</div> </div>
</div> </div>
...@@ -340,12 +344,11 @@ ...@@ -340,12 +344,11 @@
<div class=" col-md-12"> <div class=" col-md-12">
<div class=" form-group"> <div class=" form-group">
<label> หมายเหตุ </label> <label> หมายเหตุ </label>
<textarea readonly class="form-control" id="exampleFormControlTextarea1" rows="3" <textarea class="form-control" id="exampleFormControlTextarea1" rows="3"
placeholder="......" value="{{modelitemDetail.Remark}}"></textarea> placeholder="......" value="{{modelitemDetail.Remark}}"></textarea>
</div> </div>
</div> </div>
</div> </div>
</form>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -60,6 +60,16 @@ export class AdminPendingComponent implements OnInit { ...@@ -60,6 +60,16 @@ export class AdminPendingComponent implements OnInit {
fromDate: NgbDate | null; fromDate: NgbDate | null;
toDate: NgbDate | null; toDate: NgbDate | null;
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) { constructor(private calendar: NgbCalendar, public formatter: NgbDateParserFormatter, private modalService: NgbModal, private itemDetailService: itemDetailService, private roomDetailService: roomDetailService) {
this.fromDate = calendar.getToday(); this.fromDate = calendar.getToday();
this.toDate = calendar.getNext(calendar.getToday(), 'd', 10); this.toDate = calendar.getNext(calendar.getToday(), 'd', 10);
...@@ -90,10 +100,20 @@ export class AdminPendingComponent implements OnInit { ...@@ -90,10 +100,20 @@ export class AdminPendingComponent implements OnInit {
this.closeResult = `Dismissed ${this.getDismissReason(reason)}`; this.closeResult = `Dismissed ${this.getDismissReason(reason)}`;
}); });
} }
date='10-12-2561'
show(a:string){
console.log(a)
}
sDate = ""
eDate = ""
openItemDetail(content : string ,item : itemDetail) { openItemDetail(content : string ,item : itemDetail) {
this.modelitemDetail = item ; this.modelitemDetail = item ;
console.log(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.modalService.open(content, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
this.closeResult = `Closed with: ${result}`; this.closeResult = `Closed with: ${result}`;
}, (reason) => { }, (reason) => {
...@@ -101,9 +121,27 @@ export class AdminPendingComponent implements OnInit { ...@@ -101,9 +121,27 @@ export class AdminPendingComponent implements OnInit {
}); });
} }
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) { openRoomDetail(content : string ,item : roomDetail) {
this.modelroomDetail = item ; this.modelroomDetail = item ;
console.log(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.modalService.open(content, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
this.closeResult = `Closed with: ${result}`; this.closeResult = `Closed with: ${result}`;
}, (reason) => { }, (reason) => {
......
...@@ -13,7 +13,7 @@ export class roomDetailService { ...@@ -13,7 +13,7 @@ export class roomDetailService {
room: { room: {
rId: 1, rId: 1,
rName: "ห้องเดียว", rName: "ห้องเดียว",
rType : "ห้อง", rType: "ห้อง",
rPic: "assets/img/room.jpg", rPic: "assets/img/room.jpg",
roomLimit: 25, roomLimit: 25,
rDesc: "จำนวนคน 25 คน", rDesc: "จำนวนคน 25 คน",
...@@ -39,7 +39,7 @@ export class roomDetailService { ...@@ -39,7 +39,7 @@ export class roomDetailService {
room: { room: {
rId: 2, rId: 2,
rName: "ห้องคู่", rName: "ห้องคู่",
rType : "ห้อง", rType: "ห้อง",
rPic: "assets/img/room.jpg", rPic: "assets/img/room.jpg",
roomLimit: 50, roomLimit: 50,
rDesc: "จำนวนคน 50 คน", rDesc: "จำนวนคน 50 คน",
......
...@@ -3,8 +3,6 @@ import { HttpClient, HttpHeaders } from '@angular/common/http'; ...@@ -3,8 +3,6 @@ import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Room, SearchRoomModel } from '../models/rooms.model'; import { Room, SearchRoomModel } from '../models/rooms.model';
import { roomDetail } from '../models/roomDetail.model'; import { roomDetail } from '../models/roomDetail.model';
@Injectable({ providedIn: 'root' }) @Injectable({ providedIn: 'root' })
export class RoomService { 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