Commit b0670726 by DESKTOP-HF0LVOG\myhr

Update หน้ารายการ และหน้ารายการadmin เหลือแปลง date หลังแก้

parent 217ff232
...@@ -22,6 +22,7 @@ import { CalenRoomComponent } from './pages/calen-room/calen-room.component'; ...@@ -22,6 +22,7 @@ import { CalenRoomComponent } from './pages/calen-room/calen-room.component';
import { AdminPendingComponent } from './pages/admin-pending/admin-pending.component'; import { AdminPendingComponent } from './pages/admin-pending/admin-pending.component';
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 { ContactAdminComponent } from './pages/contact-admin/contact-admin.component'
FullCalendarModule.registerPlugins([ // register FullCalendar plugins FullCalendarModule.registerPlugins([ // register FullCalendar plugins
...@@ -42,7 +43,7 @@ FullCalendarModule.registerPlugins([ // register FullCalendar plugins ...@@ -42,7 +43,7 @@ FullCalendarModule.registerPlugins([ // register FullCalendar plugins
FullCalendarModule, FullCalendarModule,
ReactiveFormsModule ReactiveFormsModule
], ],
declarations: [AppComponent, AdminLayoutComponent, AuthLayoutComponent, HomePageComponent, EquipmentComponent, CalenRoomComponent, AdminPendingComponent, PendingComponent, AdminEquirmentComponent], declarations: [AppComponent, AdminLayoutComponent, AuthLayoutComponent, HomePageComponent, EquipmentComponent, CalenRoomComponent, AdminPendingComponent, PendingComponent, AdminEquirmentComponent, ContactAdminComponent],
providers: [], providers: [],
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })
......
...@@ -45,8 +45,8 @@ export const ROUTES: RouteInfo[] = [ ...@@ -45,8 +45,8 @@ export const ROUTES: RouteInfo[] = [
}, },
{ {
path: "/lend-page", path: "/contact-admin",
title: "รายการดำเนินการ", title: "ติดต่อแอดมิน",
rtlTitle: "", rtlTitle: "",
icon: "icon-bag-16", icon: "icon-bag-16",
class: "" class: ""
......
...@@ -11,8 +11,8 @@ import { HomePageComponent } from "src/app/pages/home-page/home-page.component"; ...@@ -11,8 +11,8 @@ import { HomePageComponent } from "src/app/pages/home-page/home-page.component";
import { EquipmentComponent } from "src/app/pages/equipment/equipment.component"; import { EquipmentComponent } from "src/app/pages/equipment/equipment.component";
import { AdminPendingComponent } from "src/app/pages/admin-pending/admin-pending.component"; import { AdminPendingComponent } from "src/app/pages/admin-pending/admin-pending.component";
import { PendingComponent } from "src/app/pages/pending/pending.component"; import { PendingComponent } from "src/app/pages/pending/pending.component";
import { LendPageComponent } from "src/app/pages/lend-page/lend-page.component";
import { AdminEquirmentComponent } from "src/app/pages/admin-equirment/admin-equirment.component"; import { AdminEquirmentComponent } from "src/app/pages/admin-equirment/admin-equirment.component";
import { ContactAdminComponent } from "src/app/pages/contact-admin/contact-admin.component";
// import { RtlComponent } from "../../pages/rtl/rtl.component"; // import { RtlComponent } from "../../pages/rtl/rtl.component";
export const AdminLayoutRoutes: Routes = [ export const AdminLayoutRoutes: Routes = [
...@@ -21,7 +21,7 @@ export const AdminLayoutRoutes: Routes = [ ...@@ -21,7 +21,7 @@ export const AdminLayoutRoutes: Routes = [
{ path: "admin-equirment", component: AdminEquirmentComponent }, { path: "admin-equirment", component: AdminEquirmentComponent },
{ path: "admin-pending", component: AdminPendingComponent }, { path: "admin-pending", component: AdminPendingComponent },
{ path: "pending", component: PendingComponent }, { path: "pending", component: PendingComponent },
{ path: "lend-page", component: LendPageComponent }, { path: "contact-admin", component: ContactAdminComponent },
{ path: "dashboard", component: DashboardComponent }, { path: "dashboard", component: DashboardComponent },
{ path: "icons", component: IconsComponent }, { path: "icons", component: IconsComponent },
{ path: "maps", component: MapComponent }, { path: "maps", component: MapComponent },
......
...@@ -6,16 +6,8 @@ export class ItemDetail { ...@@ -6,16 +6,8 @@ export class ItemDetail {
userName: string; userName: string;
sDate: string; sDate: string;
eDate: string; eDate: string;
sTime: { sTime: string;
hour: number; eTime: string;
minute: number;
second: number;
};
eTime: {
hour: number;
minute: number;
second: number;
};
eStatus: number; eStatus: number;
Quantity: string; Quantity: string;
eTelephone: string; eTelephone: string;
......
import { Room } from "./rooms.model"; import { Room } from "./rooms.model";
export class RoomDetail { export class RoomDetail {
Id?: number; Id?: number;
room: Room; room: Room;
userName: string; userName: string;
sDate: string; sDate: string;
eDate: string; eDate: string;
sTime: { sTime: string;
hour: number; eTime: string;
minute: number;
second: number;
};
eTime: {
hour: number;
minute: number;
second: number;
};
rStatus: number; rStatus: number;
rTelephone: string; rTelephone: string;
email: string; email: string;
......
...@@ -76,26 +76,29 @@ ...@@ -76,26 +76,29 @@
<thead> <thead>
<tr> <tr>
<th scope="col">#</th> <th scope="col">#</th>
<th scope="col">ชื่อห้อง</th> <th scope="col">หมวดหมู่</th>
<th scope="col">ชื่อการจอง</th>
<th scope="col">รายละเอียด</th> <th scope="col">รายละเอียด</th>
<th scope="col">ชื่อผู้เบิก</th> <th scope="col">ชื่อผู้จอง</th>
<th scope="col">วันที่เริ่มต้น</th> <th scope="col">วันที่เริ่มต้น</th>
<th scope="col">วันที่สิ้นสุด</th> <th scope="col">วันที่สิ้นสุด</th>
<th scope="col">สถานะ</th> <th scope="col">สถานะ</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let item of listroomDetail"> <tr *ngFor="let item of listRoomDetail">
<th scope="row">{{ item.Id }}</th> <th scope="row">{{ item.Id }}</th>
<td>{{ item.room.rType }}</td>
<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 | date : 'dd/MM/yyyy' }} {{ item.sTime }}</td>
item.sTime.minute }}</td> <td>{{ item.eDate | date : 'dd/MM/yyyy' }} {{ item.eTime }}</td>
<td>{{ item.eDate | date : 'dd/MM/yyyy' }} {{ item.eTime.hour }}:{{ <td *ngIf="item.rStatus==0">รอดำเนินการ</td>
item.eTime.minute }}</td> <td *ngIf="item.rStatus==1">อนุมัติ</td>
<td>{{ item.rStatus==0 ? "รอดำเนินการ" : "อนุมัติ" }}</td> <td *ngIf="item.rStatus==2">ยกเลิก</td>
<div class="text-center"> <td *ngIf="item.rStatus==3">สำเร็จแล้ว</td>
<div class="col-auto align-self-sm-center">
<button type="button" class="btn btn-info btn-sm btn-circle " <button type="button" class="btn btn-info btn-sm btn-circle "
style="line-height: 0px" (click)="openRoomDetail(Room,item)"><i style="line-height: 0px" (click)="openRoomDetail(Room,item)"><i
class="fa fa-search"></i> </button> class="fa fa-search"></i> </button>
...@@ -136,9 +139,9 @@ ...@@ -136,9 +139,9 @@
<tr> <tr>
<th scope="col">#</th> <th scope="col">#</th>
<th scope="col">หมวดหมู่</th> <th scope="col">หมวดหมู่</th>
<th scope="col">ประเภท</th> <th scope="col">ชื่ออุปกรณ์</th>
<th scope="col">รายละเอียด</th> <th scope="col">รายละเอียด</th>
<th scope="col">ชื่อ</th> <th scope="col">ชื่อผู้เบิก</th>
<th scope="col">วันที่เริ่มใช้</th> <th scope="col">วันที่เริ่มใช้</th>
<th scope="col">วันที่สิ้นสุด</th> <th scope="col">วันที่สิ้นสุด</th>
<th scope="col">จำนวน</th> <th scope="col">จำนวน</th>
...@@ -146,19 +149,20 @@ ...@@ -146,19 +149,20 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let item of listitemDetail"> <tr *ngFor="let item of listItemDetail">
<th scope="row">{{ item.Id }}</th> <th scope="row">{{ item.Id }}</th>
<td>{{ item.equirment.eqType }}</td> <td>{{ item.equirment.eqType }}</td>
<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.replaceAll("/","-")}} {{ item.sTime.hour }}:{{ <td>{{ item.sDate | date : 'dd/MM/yyyy' }} {{ item.sTime }}</td>
item.sTime.minute }}</td> <td>{{ item.eDate | date : 'dd/MM/yyyy' }} {{ item.eTime }}</td>
<td>{{ item.eDate.replaceAll("/","-")}} {{ item.eTime.hour }}:{{
item.eTime.minute }}</td>
<td>{{ item.Quantity }}</td> <td>{{ item.Quantity }}</td>
<td>{{ item.eStatus==0 ? "รอดำเนินการ" : "อนุมัติ" }}</td> <td *ngIf="item.eStatus==0">รอดำเนินการ</td>
<div class="text-center"> <td *ngIf="item.eStatus==1">อนุมัติ</td>
<td *ngIf="item.eStatus==2">ยกเลิก</td>
<td *ngIf="item.eStatus==3">สำเร็จแล้ว</td>
<div class="col-auto align-self-sm-center">
<button type="button" class="btn btn-info btn-sm btn-circle " <button type="button" class="btn btn-info btn-sm btn-circle "
style="line-height: 0px" (click)="openItemDetail(lend,item)"><i style="line-height: 0px" (click)="openItemDetail(lend,item)"><i
class="fa fa-search"></i> </button> class="fa fa-search"></i> </button>
...@@ -232,7 +236,7 @@ ...@@ -232,7 +236,7 @@
<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 class="form-control" type="text" formControlName="rName" /> <input readonly class="form-control" type="text" formControlName="rName" />
<div style="color: red;" *ngIf="myFormRoom.controls.rName.status=='INVALID'"> <div style="color: red;" *ngIf="myFormRoom.controls.rName.status=='INVALID'">
กรุณากรอกชื่อห้อง.</div> กรุณากรอกชื่อห้อง.</div>
</div> </div>
...@@ -240,7 +244,7 @@ ...@@ -240,7 +244,7 @@
<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 class="form-control" type="text" formControlName="rDesc" /> <input readonly class="form-control" type="text" formControlName="rDesc" />
<div style="color: red;" *ngIf="myFormRoom.controls.rDesc.status=='INVALID'"> <div style="color: red;" *ngIf="myFormRoom.controls.rDesc.status=='INVALID'">
กรุณากรอกรายละเอียดการจอง.</div> กรุณากรอกรายละเอียดการจอง.</div>
</div> </div>
...@@ -249,14 +253,14 @@ ...@@ -249,14 +253,14 @@
<div class="col-6 mb-1"> <div class="col-6 mb-1">
<label for="exampleFormControlSelect1">วันที่เริ่มต้น</label> <label for="exampleFormControlSelect1">วันที่เริ่มต้น</label>
<input type="date" class="form-control" [(ngModel)]="sDate" <input type="date" class="form-control" [(ngModel)]="sDate"
(ngModelChange)="rDate(sDate,'sdate')" formControlName="sDate" /> formControlName="sDate" />
<div style="color: red;" *ngIf="myFormRoom.controls.sDate.status=='INVALID'"> <div style="color: red;" *ngIf="myFormRoom.controls.sDate.status=='INVALID'">
กรุณากรอกวันที่เริ่มต้นการจอง.</div> กรุณากรอกวันที่เริ่มต้นการจอง.</div>
</div> </div>
<div class="col-6 mb-1"> <div class="col-6 mb-1">
<label for="exampleFormControlSelect1">วันที่สิ้นสุด</label> <label for="exampleFormControlSelect1">วันที่สิ้นสุด</label>
<input type="date" class="form-control" [(ngModel)]="eDate" <input type="date" class="form-control" [(ngModel)]="eDate"
(ngModelChange)="rDate(eDate,'edate')" formControlName="eDate" /> formControlName="eDate" />
<div style="color: red;" *ngIf="myFormRoom.controls.eDate.status=='INVALID'"> <div style="color: red;" *ngIf="myFormRoom.controls.eDate.status=='INVALID'">
กรุณากรอกวันที่สิ้นสุดการจอง.</div> กรุณากรอกวันที่สิ้นสุดการจอง.</div>
</div> </div>
...@@ -264,15 +268,15 @@ ...@@ -264,15 +268,15 @@
<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 class="form-control" type="time" [(ngModel)]="thStime" <input class="form-control" type="time"
(ngModelChange)="thtimeChange(thStime,modelRoomDetail.sTime)" formControlName="sTime" /> formControlName="sTime" />
<div style="color: red;" *ngIf="myFormRoom.controls.sTime.status=='INVALID'"> <div style="color: red;" *ngIf="myFormRoom.controls.sTime.status=='INVALID'">
กรุณากรอกเวลาที่เริ่มต้นการจอง.</div> กรุณากรอกเวลาที่เริ่มต้นการจอง.</div>
</div> </div>
<div class="col-6 mb-1"> <div class="col-6 mb-1">
<label for="exampleFormControlSelect1">เวลาที่สิ้นสุด</label> <label for="exampleFormControlSelect1">เวลาที่สิ้นสุด</label>
<input class="form-control" type="time" [(ngModel)]="thEtime" <input class="form-control" type="time"
(ngModelChange)="thtimeChange(thEtime,modelRoomDetail.eTime)" formControlName="eTime" /> formControlName="eTime" />
<div style="color: red;" *ngIf="myFormRoom.controls.eTime.status=='INVALID'"> <div style="color: red;" *ngIf="myFormRoom.controls.eTime.status=='INVALID'">
กรุณากรอกเวลาที่สิ้นสุดการจอง</div> กรุณากรอกเวลาที่สิ้นสุดการจอง</div>
</div> </div>
...@@ -289,9 +293,9 @@ ...@@ -289,9 +293,9 @@
<div class=" row"> <div class=" row">
<div class=" col-md-6 mb-2"> <div class=" col-md-6 mb-2">
<label> สถานะ </label> <label> สถานะ </label>
<select class="form-select form-control" aria-label="Default select example" <select class="custom-select form-control" aria-label="Default select example"
formControlName="rStatus"> formControlName="rStatus">
<option value="0" style="color: black;">รอดำเนินการ</option> <option value="0" selected style="color: black;">รอดำเนินการ</option>
<option value="1" style="color: black;">อนุมัติ</option> <option value="1" style="color: black;">อนุมัติ</option>
<option value="2" style="color: black;">ยกเลิก</option> <option value="2" style="color: black;">ยกเลิก</option>
<option value="3" style="color: black;">สำเร็จแล้ว</option> <option value="3" style="color: black;">สำเร็จแล้ว</option>
...@@ -300,7 +304,7 @@ ...@@ -300,7 +304,7 @@
</div> </div>
</form> </form>
<div class=" card-footer"> <div class=" card-footer">
<button class=" btn btn-fill btn-danger" type="submit" (click)="saveStatus()">บันทึก</button> <button class=" btn btn-fill btn-danger" type="submit" (click)="saveStatusRoom()">บันทึก</button>
<button class=" btn btn-fill btn-danger" type="cancel" <button class=" btn btn-fill btn-danger" type="cancel"
(click)="modal.dismiss('Cross click')">ยกเลิก</button> (click)="modal.dismiss('Cross click')">ยกเลิก</button>
</div> </div>
...@@ -322,7 +326,7 @@ ...@@ -322,7 +326,7 @@
<div class=" form-group"> <div class=" form-group">
<label> ชื่อผู้จอง </label> <label> ชื่อผู้จอง </label>
<input class=" form-control" placeholder="" type="text" <input class=" form-control" placeholder="" type="text"
[(ngModel)]="modelItemDetail.userName" formControlName="userNameForm" /> formControlName="userNameForm" />
<div style="color: red;" *ngIf="myFormEquir.controls.userNameForm.status=='INVALID'"> <div style="color: red;" *ngIf="myFormEquir.controls.userNameForm.status=='INVALID'">
กรุณากรอกชื่อผู้จอง.</div> กรุณากรอกชื่อผู้จอง.</div>
</div> </div>
...@@ -333,7 +337,7 @@ ...@@ -333,7 +337,7 @@
<div class=" form-group"> <div class=" form-group">
<label> อีเมล </label> <label> อีเมล </label>
<input class=" form-control" placeholder="" type="text" <input class=" form-control" placeholder="" type="text"
[(ngModel)]="modelItemDetail.email" formControlName="email" /> formControlName="email" />
<div style="color: red;" *ngIf="myFormEquir.controls.email.status=='INVALID'"> <div style="color: red;" *ngIf="myFormEquir.controls.email.status=='INVALID'">
กรุณากรอกอีเมล.</div> กรุณากรอกอีเมล.</div>
</div> </div>
...@@ -344,7 +348,7 @@ ...@@ -344,7 +348,7 @@
<div class=" form-group"> <div class=" form-group">
<label> เบอร์โทร </label> <label> เบอร์โทร </label>
<input class=" form-control" placeholder="" type="text" <input class=" form-control" placeholder="" type="text"
[(ngModel)]="modelItemDetail.eTelephone" formControlName="eTelephone" /> formControlName="eTelephone" />
<div style="color: red;" *ngIf="myFormEquir.controls.eTelephone.status=='INVALID'"> <div style="color: red;" *ngIf="myFormEquir.controls.eTelephone.status=='INVALID'">
กรุณากรอกหมายเลขโทรศัพท์</div> กรุณากรอกหมายเลขโทรศัพท์</div>
</div> </div>
...@@ -353,7 +357,7 @@ ...@@ -353,7 +357,7 @@
<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 class="form-control" type="text" [(ngModel)]="modelItemDetail.equirment.eqName" <input readonly class="form-control" type="text"
formControlName="eqName" /> formControlName="eqName" />
<div style="color: red;" *ngIf="myFormEquir.controls.eqName.status=='INVALID'"> <div style="color: red;" *ngIf="myFormEquir.controls.eqName.status=='INVALID'">
กรุณากรอกชื่ออุปกรณ์.</div> กรุณากรอกชื่ออุปกรณ์.</div>
...@@ -362,7 +366,7 @@ ...@@ -362,7 +366,7 @@
<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 class="form-control" type="text" [(ngModel)]="modelItemDetail.equirment.eqDesc" <input readonly class="form-control" type="text"
formControlName="eqDesc" /> formControlName="eqDesc" />
<div style="color: red;" *ngIf="myFormEquir.controls.eqDesc.status=='INVALID'"> <div style="color: red;" *ngIf="myFormEquir.controls.eqDesc.status=='INVALID'">
กรุณากรอกรายละเอียดการเบิก.</div> กรุณากรอกรายละเอียดการเบิก.</div>
...@@ -387,15 +391,15 @@ ...@@ -387,15 +391,15 @@
<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 class="form-control" type="time" [(ngModel)]="thStime" <input class="form-control" type="time"
(ngModelChange)="thtimeChange(thStime,modelItemDetail.sTime)" formControlName="sTime" /> formControlName="sTime" />
<div style="color: red;" *ngIf="myFormEquir.controls.sTime.status=='INVALID'"> <div style="color: red;" *ngIf="myFormEquir.controls.sTime.status=='INVALID'">
กรุณากรอกเวลาที่เริ่มต้นการเบิก</div> กรุณากรอกเวลาที่เริ่มต้นการเบิก</div>
</div> </div>
<div class="col-6 mb-1"> <div class="col-6 mb-1">
<label for="exampleFormControlSelect1">เวลาที่สิ้นสุด</label> <label for="exampleFormControlSelect1">เวลาที่สิ้นสุด</label>
<input class="form-control" type="time" [(ngModel)]="thEtime" <input class="form-control" type="time"
(ngModelChange)="thtimeChange(thStime,modelItemDetail.eTime)" formControlName="eTime" /> formControlName="eTime" />
<div style="color: red;" *ngIf="myFormEquir.controls.eTime.status=='INVALID'"> <div style="color: red;" *ngIf="myFormEquir.controls.eTime.status=='INVALID'">
กรุณากรอกเวลาที่สิ้นสุดการเบิก</div> กรุณากรอกเวลาที่สิ้นสุดการเบิก</div>
</div> </div>
...@@ -404,7 +408,7 @@ ...@@ -404,7 +408,7 @@
<div class=" col-sm-6 mb-1"> <div class=" col-sm-6 mb-1">
<label for="changequantity">จำนวน</label> <label for="changequantity">จำนวน</label>
<input id="changequantity" type="number" class="form-control form-control-sm" <input id="changequantity" type="number" class="form-control form-control-sm"
[(ngModel)]="modelItemDetail.Quantity" formControlName="Quantity" /> formControlName="Quantity" />
<div style="color: red;" *ngIf="myFormEquir.controls.Quantity.status=='INVALID'"> <div style="color: red;" *ngIf="myFormEquir.controls.Quantity.status=='INVALID'">
กรุณากรอกจำนวนการเบิก.</div> กรุณากรอกจำนวนการเบิก.</div>
</div> </div>
...@@ -436,7 +440,7 @@ ...@@ -436,7 +440,7 @@
</div> </div>
</form> </form>
<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)="saveStatusEquirment()">บันทึก</button>
<button class=" btn btn-fill btn-danger" type="cancel" <button class=" btn btn-fill btn-danger" type="cancel"
(click)="modal.dismiss('Cross click')">ยกเลิก</button> (click)="modal.dismiss('Cross click')">ยกเลิก</button>
</div> </div>
......
...@@ -56,8 +56,8 @@ export class AdminPendingComponent implements OnInit { ...@@ -56,8 +56,8 @@ export class AdminPendingComponent implements OnInit {
closeResult = ''; closeResult = '';
listitemDetail: ItemDetail[] = []; listItemDetail: ItemDetail[] = [];
listroomDetail: RoomDetail[] = []; listRoomDetail: RoomDetail[] = [];
modelEquirment = new Equirment(); modelEquirment = new Equirment();
modelRoom = new MyRoom(); modelRoom = new MyRoom();
...@@ -69,15 +69,6 @@ export class AdminPendingComponent implements OnInit { ...@@ -69,15 +69,6 @@ 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])
}
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
, private equirmentService: EquirmentService, private roomService: RoomService) { , private equirmentService: EquirmentService, private roomService: RoomService) {
this.fromDate = calendar.getToday(); this.fromDate = calendar.getToday();
...@@ -86,7 +77,7 @@ export class AdminPendingComponent implements OnInit { ...@@ -86,7 +77,7 @@ export class AdminPendingComponent implements OnInit {
} }
refreshitemDetail() { refreshitemDetail() {
this.listitemDetail = this.listitemDetail this.listItemDetail = this.listItemDetail
.map((country, i) => ({ id: i + 1, ...country })) .map((country, i) => ({ id: i + 1, ...country }))
.slice((this.page - 1) * this.pageSize, (this.page - 1) * this.pageSize + this.pageSize); .slice((this.page - 1) * this.pageSize, (this.page - 1) * this.pageSize + this.pageSize);
} }
...@@ -115,8 +106,7 @@ export class AdminPendingComponent implements OnInit { ...@@ -115,8 +106,7 @@ export class AdminPendingComponent implements OnInit {
eDate = "" eDate = ""
openItemDetail(content: string, item: ItemDetail) { openItemDetail(content: string, item: ItemDetail) {
this.modelItemDetail = item; 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('/') let sDate = this.modelItemDetail.sDate.split('/')
this.sDate = sDate[0] + "-" + sDate[1] + "-" + sDate[2] this.sDate = sDate[0] + "-" + sDate[1] + "-" + sDate[2]
let eDate = this.modelItemDetail.eDate.split('/') let eDate = this.modelItemDetail.eDate.split('/')
...@@ -145,26 +135,25 @@ export class AdminPendingComponent implements OnInit { ...@@ -145,26 +135,25 @@ export class AdminPendingComponent implements OnInit {
} }
rDate(item: string, item2: string) { rDate(item: string, item2: string) {
let Dates = item.split("-") let Dates = item.split("/")
let dates = Dates[0] + "/" + Dates[1] + "/" + Dates[2] let dates = Dates[0] + "-" + Dates[1] + "-" + Dates[2]
if (item2 == "sdate") { if (item2 == "sdate") {
this.modelItemDetail.sDate = dates this.modelRoomDetail.sDate = dates
} }
if (item2 == "edate") { if (item2 == "edate") {
this.modelItemDetail.eDate = dates this.modelRoomDetail.eDate = dates
} }
} }
openRoomDetail(content: string, item: RoomDetail) { openRoomDetail(content: string, item: RoomDetail) {
this.modelRoomDetail = item; 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[0] + "-" + SDate[1] + "-" + SDate[2]
let EDate = this.modelRoomDetail.eDate.split('/')
this.eDate = EDate[0] + "-" + EDate[1] + "-" + EDate[2]
let sDate = this.modelRoomDetail.sDate.split('/')
this.sDate = sDate[0] + "-" + sDate[1] + "-" + sDate[2]
let eDate = this.modelRoomDetail.eDate.split('/')
this.eDate = eDate[0] + "-" + eDate[1] + "-" + eDate[2]
console.log(this.modelRoomDetail)
this.myFormRoom = new FormGroup({ this.myFormRoom = new FormGroup({
userNameForm: new FormControl(this.modelRoomDetail.userName, [Validators.required]), userNameForm: new FormControl(this.modelRoomDetail.userName, [Validators.required]),
...@@ -174,8 +163,8 @@ export class AdminPendingComponent implements OnInit { ...@@ -174,8 +163,8 @@ export class AdminPendingComponent implements OnInit {
rDesc: new FormControl(this.modelRoomDetail.room.rDesc, [Validators.required]), rDesc: new FormControl(this.modelRoomDetail.room.rDesc, [Validators.required]),
rType: new FormControl(this.modelRoomDetail.room.rType, [Validators.required]), rType: new FormControl(this.modelRoomDetail.room.rType, [Validators.required]),
sDate: new FormControl(this.modelRoomDetail.sDate, [Validators.required]), sDate: new FormControl(this.modelRoomDetail.sDate, [Validators.required]),
eDate: new FormControl(this.modelRoomDetail.sTime, [Validators.required]), eDate: new FormControl(this.modelRoomDetail.eDate, [Validators.required]),
sTime: new FormControl(this.modelRoomDetail.eDate, [Validators.required]), sTime: new FormControl(this.modelRoomDetail.sTime, [Validators.required]),
eTime: new FormControl(this.modelRoomDetail.eTime, [Validators.required]), eTime: new FormControl(this.modelRoomDetail.eTime, [Validators.required]),
Remark: new FormControl(this.modelRoomDetail.Remark), Remark: new FormControl(this.modelRoomDetail.Remark),
rStatus: new FormControl(this.modelRoomDetail.rStatus) rStatus: new FormControl(this.modelRoomDetail.rStatus)
...@@ -218,39 +207,10 @@ export class AdminPendingComponent implements OnInit { ...@@ -218,39 +207,10 @@ export class AdminPendingComponent implements OnInit {
myFormEquir: FormGroup; myFormEquir: FormGroup;
ngOnInit(): void { ngOnInit(): void {
this.listitemDetail = this.ItemDetailService.getListItemDetail(); this.listItemDetail = this.ItemDetailService.getListItemDetail();
this.listroomDetail = this.RoomDetailService.getListRoomDetail(); this.listRoomDetail = this.RoomDetailService.getListRoomDetail();
this.collectionSizeListRoom = this.listitemDetail.length; this.collectionSizeListRoom = this.listItemDetail.length;
this.myFormRoom = new FormGroup({
userNameForm: new FormControl('', [Validators.required]),
rTelephone: new FormControl('', [Validators.required]),
email: new FormControl('', [Validators.required, Validators.email]),
rName: new FormControl('', [Validators.required]),
rDesc: new FormControl('', [Validators.required]),
rType: new FormControl('', [Validators.required]),
sDate: new FormControl('', [Validators.required]),
eDate: new FormControl('', [Validators.required]),
sTime: new FormControl('', [Validators.required]),
eTime: new FormControl('', [Validators.required]),
Remark: new FormControl(),
rStatus: new FormControl()
});
this.myFormEquir = new FormGroup({
userNameForm: new FormControl('', [Validators.required]),
eTelephone: new FormControl('', [Validators.required]),
email: new FormControl('', [Validators.required, Validators.email]),
eqName: new FormControl('', [Validators.required]),
eqDesc: new FormControl('', [Validators.required]),
eqType: new FormControl('', [Validators.required]),
eqPic: new FormControl('', [Validators.required]),
sDate: new FormControl('', [Validators.required]),
eDate: new FormControl('', [Validators.required]),
sTime: new FormControl('', [Validators.required]),
eTime: new FormControl('', [Validators.required]),
Quantity: new FormControl('', [Validators.required]),
Remark: new FormControl(),
eStatus: new FormControl()
})
} }
saveEquirment() { saveEquirment() {
...@@ -265,15 +225,50 @@ export class AdminPendingComponent implements OnInit { ...@@ -265,15 +225,50 @@ export class AdminPendingComponent implements OnInit {
this.ngOnInit(); this.ngOnInit();
} }
saveStatus() { saveStatusRoom() {
console.log("this.modelRoomDetail", this.modelRoomDetail)
console.log("form", this.myFormRoom)
this.modelRoomDetail.userName = this.myFormRoom.value.userNameForm;
this.modelRoomDetail.rTelephone = this.myFormRoom.value.rTelephone
this.modelRoomDetail.email = this.myFormRoom.value.email
this.modelRoomDetail.room.rName = this.myFormRoom.value.rName
this.modelRoomDetail.room.rDesc = this.myFormRoom.value.rDesc
this.modelRoomDetail.room.rType = this.myFormRoom.value.rType
this.modelRoomDetail.sDate = this.myFormRoom.value.sDate
this.modelRoomDetail.eDate = this.myFormRoom.value.eDate
this.modelRoomDetail.sTime = this.myFormRoom.value.sTime
this.modelRoomDetail.eTime = this.myFormRoom.value.eTime
this.modelRoomDetail.Remark = this.myFormRoom.value.Remark
this.modelRoomDetail.rStatus = this.myFormRoom.value.rStatus
console.log("this.modelRoomDetail", this.modelRoomDetail)
this.RoomDetailService.updateRoomDetail(this.modelRoomDetail) this.RoomDetailService.updateRoomDetail(this.modelRoomDetail)
this.modalService.dismissAll(); this.modalService.dismissAll();
this.ngOnInit(); this.ngOnInit();
console.log(this.modelRoomDetail)
} }
saveStatusEquirment() {
console.log("this.modelItemDetail", this.modelItemDetail)
console.log("form", this.myFormEquir)
this.modelItemDetail.userName = this.myFormEquir.value.userNameForm;
this.modelItemDetail.eTelephone = this.myFormEquir.value.eTelephone
this.modelItemDetail.email = this.myFormEquir.value.email
this.modelItemDetail.equirment.eqName = this.myFormEquir.value.eqName
this.modelItemDetail.equirment.eqDesc = this.myFormEquir.value.eqDesc
this.modelItemDetail.equirment.eqType = this.myFormEquir.value.eqType
this.modelItemDetail.sDate = this.myFormEquir.value.sDate
this.modelItemDetail.eDate = this.myFormEquir.value.eDate
this.modelItemDetail.sTime = this.myFormEquir.value.sTime
this.modelItemDetail.eTime = this.myFormEquir.value.eTime
this.modelItemDetail.Remark = this.myFormEquir.value.Remark
this.modelItemDetail.eStatus = this.myFormEquir.value.eStatus
console.log("this.modelItemDetail", this.modelItemDetail)
this.ItemDetailService.updateItemDetail(this.modelItemDetail)
this.modalService.dismissAll();
this.ngOnInit();
}
}
export class NgbdDropdownBasic {
} }
<div class="content">
</div>
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { LendPageComponent } from './lend-page.component'; import { ContactAdminComponent } from './contact-admin.component';
describe('LendPageComponent', () => { describe('ContactAdminComponent', () => {
let component: LendPageComponent; let component: ContactAdminComponent;
let fixture: ComponentFixture<LendPageComponent>; let fixture: ComponentFixture<ContactAdminComponent>;
beforeEach(async () => { beforeEach(async () => {
await TestBed.configureTestingModule({ await TestBed.configureTestingModule({
declarations: [ LendPageComponent ] declarations: [ ContactAdminComponent ]
}) })
.compileComponents(); .compileComponents();
}); });
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(LendPageComponent); fixture = TestBed.createComponent(ContactAdminComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
}); });
......
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ItemDetail } from 'src/app/models/itemDetail.model';
@Component({ @Component({
selector: 'app-lend-page', selector: 'app-contact-admin',
templateUrl: './lend-page.component.html', templateUrl: './contact-admin.component.html',
styleUrls: ['./lend-page.component.scss'] styleUrls: ['./contact-admin.component.scss']
}) })
export class LendPageComponent implements OnInit { export class ContactAdminComponent implements OnInit {
item: ItemDetail[] = [];
collectionSize = this.item.length;
constructor() { } constructor() { }
......
...@@ -321,8 +321,8 @@ ...@@ -321,8 +321,8 @@
<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>
<ngb-timepicker [(ngModel)]="modelRoomDetail.sTime" formControlName="sTime"> <input class="form-control" type="time" [(ngModel)]="modelRoomDetail.sTime" formControlName="sTime" />
</ngb-timepicker>
<div style="color: red;" *ngIf="myFormRoom.controls.sTime.status=='INVALID'"> <div style="color: red;" *ngIf="myFormRoom.controls.sTime.status=='INVALID'">
กรุณากรอกเวลาที่เริ่มต้นการจอง. กรุณากรอกเวลาที่เริ่มต้นการจอง.
</div> </div>
...@@ -330,8 +330,8 @@ ...@@ -330,8 +330,8 @@
</div> </div>
<div class="col-6 mb-1"> <div class="col-6 mb-1">
<label for="exampleFormControlSelect1">เวลาที่สิ้นสุด</label> <label for="exampleFormControlSelect1">เวลาที่สิ้นสุด</label>
<ngb-timepicker [(ngModel)]="modelRoomDetail.eTime" formControlName="eTime"> <input class="form-control" type="time" [(ngModel)]="modelRoomDetail.eTime" formControlName="eTime" />
</ngb-timepicker>
<div style="color: red;" *ngIf="myFormRoom.controls.eTime.status=='INVALID'"> <div style="color: red;" *ngIf="myFormRoom.controls.eTime.status=='INVALID'">
กรุณากรอกเวลาที่สิ้นสุดการจอง. กรุณากรอกเวลาที่สิ้นสุดการจอง.
</div> </div>
...@@ -436,16 +436,16 @@ ...@@ -436,16 +436,16 @@
<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>
<ngb-timepicker [(ngModel)]="modelItemDetail.sTime" formControlName="sTime"> <input class="form-control" type="time" [(ngModel)]="modelItemDetail.sTime" formControlName="sTime" />
</ngb-timepicker>
<div style="color: red;" *ngIf="myFormEquir.controls.sTime.status=='INVALID'"> <div style="color: red;" *ngIf="myFormEquir.controls.sTime.status=='INVALID'">
กรุณากรอกเวลาที่เริ่มต้นการเบิก. กรุณากรอกเวลาที่เริ่มต้นการเบิก.
</div> </div>
</div> </div>
<div class="col-6 mb-1"> <div class="col-6 mb-1">
<label for="exampleFormControlSelect1">เวลาที่สิ้นสุด</label> <label for="exampleFormControlSelect1">เวลาที่สิ้นสุด</label>
<ngb-timepicker [(ngModel)]="modelItemDetail.eTime" formControlName="eTime"> <input class="form-control" type="time" [(ngModel)]="modelItemDetail.eTime" formControlName="eTime" />
</ngb-timepicker>
<div style="color: red;" *ngIf="myFormEquir.controls.eTime.status=='INVALID'"> <div style="color: red;" *ngIf="myFormEquir.controls.eTime.status=='INVALID'">
กรุณากรอกเวลาที่สิ้นสุดการเบิก. กรุณากรอกเวลาที่สิ้นสุดการเบิก.
</div> </div>
......
...@@ -194,6 +194,7 @@ export class EquipmentComponent implements OnInit { ...@@ -194,6 +194,7 @@ export class EquipmentComponent implements OnInit {
this.modelRoomDetail.sDate = this.modelRoomDetail.sDate.split("-")[0]+"/"+this.modelRoomDetail.sDate.split("-")[1]+"/"+this.modelRoomDetail.sDate.split("-")[2]; this.modelRoomDetail.sDate = this.modelRoomDetail.sDate.split("-")[0]+"/"+this.modelRoomDetail.sDate.split("-")[1]+"/"+this.modelRoomDetail.sDate.split("-")[2];
this.modelRoomDetail.eDate = this.modelRoomDetail.eDate.split("-")[0]+"/"+this.modelRoomDetail.eDate.split("-")[1]+"/"+this.modelRoomDetail.eDate.split("-")[2]; this.modelRoomDetail.eDate = this.modelRoomDetail.eDate.split("-")[0]+"/"+this.modelRoomDetail.eDate.split("-")[1]+"/"+this.modelRoomDetail.eDate.split("-")[2];
this.modelRoomDetail.rStatus = 0 ; this.modelRoomDetail.rStatus = 0 ;
console.log("save",this.modelRoomDetail)
this.RoomDetailService.addRoomDetail(this.modelRoomDetail); this.RoomDetailService.addRoomDetail(this.modelRoomDetail);
this.modalService.dismissAll(); this.modalService.dismissAll();
this.ngOnInit(); this.ngOnInit();
......
<div class="content">
<div class="row">
<div class="col-sm-12">
<div class="card">
<div class="card-body">
<table class="table table-striped">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">หมวดหมู่</th>
<th scope="col">ประเภท</th>
<th scope="col">รายละเอียด</th>
<th scope="col">ชื่อ</th>
<th scope="col">วันที่เริ่มต้น</th>
<th scope="col">วันที่สิ้นสุด</th>
<th scope="col">จำนวน</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let country of countries">
<th scope="row">{{ country.id }}</th>
<td>{{ country.catagory }}</td>
<td>{{ country.type }}</td>
<td>{{ country.detail }}</td>
<td>{{ country.name }}</td>
<td>{{ country.sdate | date:'dd-MM-yyyy' }}</td>
<td>{{ country.edate | date:'dd-MM-yyyy' }}</td>
<td>
<button class="btn btn-primary btn-sm"
(click)="_increamentQTY(item.productId._id,1)">+</button>
{{ country.quantity }}
<button class="btn btn-primary btn-sm">-</button>
</td>
</tr>
</tbody>
</table>
<div class="text-center">
<div class="d-grid gap-2 a-md-flex justify-content-md-end ">
<button class="btn btn-sm btn-primary" type="button">ยืม</button>
<button class="btn btn-sm btn-primary" type="button">ยกเลิก</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
...@@ -76,9 +76,10 @@ ...@@ -76,9 +76,10 @@
<thead> <thead>
<tr> <tr>
<th scope="col">#</th> <th scope="col">#</th>
<th scope="col">ชื่อห้อง</th> <th scope="col">หมวดหมู่</th>
<th scope="col">ชื่อการจอง</th>
<th scope="col">รายละเอียด</th> <th scope="col">รายละเอียด</th>
<th scope="col">ชื่อผู้เบิก</th> <th scope="col">ชื่อผู้จอง</th>
<th scope="col">วันที่เริ่มต้น</th> <th scope="col">วันที่เริ่มต้น</th>
<th scope="col">วันที่สิ้นสุด</th> <th scope="col">วันที่สิ้นสุด</th>
<th scope="col">สถานะ</th> <th scope="col">สถานะ</th>
...@@ -87,14 +88,16 @@ ...@@ -87,14 +88,16 @@
<tbody> <tbody>
<tr *ngFor="let item of listRoomDetail"> <tr *ngFor="let item of listRoomDetail">
<th scope="row">{{ item.Id }}</th> <th scope="row">{{ item.Id }}</th>
<td>{{ item.room.rType }}</td>
<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 | date : 'dd/MM/yyyy' }} {{ item.sTime }}</td>
item.sTime.minute }}</td> <td>{{ item.eDate | date : 'dd/MM/yyyy' }} {{ item.eTime }}</td>
<td>{{ item.eDate | date : 'dd/MM/yyyy' }} {{ item.eTime.hour }}:{{ <td *ngIf="item.rStatus==0">รอดำเนินการ</td>
item.eTime.minute }}</td> <td *ngIf="item.rStatus==1">อนุมัติ</td>
<td>{{ item.rStatus==0 ? "รอดำเนินการ" : "อนุมัติ" }}</td> <td *ngIf="item.rStatus==2">ยกเลิก</td>
<td *ngIf="item.rStatus==3">สำเร็จแล้ว</td>
<div class="col-auto align-self-sm-center"> <div class="col-auto align-self-sm-center">
<button type="button" class="btn btn-info btn-sm btn-circle " <button type="button" class="btn btn-info btn-sm btn-circle "
style="line-height: 0px" (click)="openRoomDetail(Room,item)"><i style="line-height: 0px" (click)="openRoomDetail(Room,item)"><i
...@@ -137,9 +140,9 @@ ...@@ -137,9 +140,9 @@
<tr> <tr>
<th scope="col">#</th> <th scope="col">#</th>
<th scope="col">หมวดหมู่</th> <th scope="col">หมวดหมู่</th>
<th scope="col">ประเภท</th> <th scope="col">ชื่ออุปกรณ์</th>
<th scope="col">รายละเอียด</th> <th scope="col">รายละเอียด</th>
<th scope="col">ชื่อ</th> <th scope="col">ชื่อผู้เบิก</th>
<th scope="col">วันที่เริ่มใช้</th> <th scope="col">วันที่เริ่มใช้</th>
<th scope="col">วันที่สิ้นสุด</th> <th scope="col">วันที่สิ้นสุด</th>
<th scope="col">จำนวน</th> <th scope="col">จำนวน</th>
...@@ -153,12 +156,13 @@ ...@@ -153,12 +156,13 @@
<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 | date : 'dd/MM/yyyy' }} {{ item.sTime }}</td>
item.sTime.minute }}</td> <td>{{ item.eDate | date : 'dd/MM/yyyy' }} {{ item.eTime }}</td>
<td>{{ item.eDate | date : 'dd/MM/yyyy' }} {{ item.eTime.hour }}:{{
item.eTime.minute }}</td>
<td>{{ item.Quantity }}</td> <td>{{ item.Quantity }}</td>
<td>{{ item.eStatus==0 ? "รอดำเนินการ" : "อนุมัติ" }}</td> <td *ngIf="item.eStatus==0">รอดำเนินการ</td>
<td *ngIf="item.eStatus==1">อนุมัติ</td>
<td *ngIf="item.eStatus==2">ยกเลิก</td>
<td *ngIf="item.eStatus==3">สำเร็จแล้ว</td>
<div class="col-auto align-self-sm-center"> <div class="col-auto align-self-sm-center">
<button type="button" class="btn btn-info btn-sm btn-circle " <button type="button" class="btn btn-info btn-sm btn-circle "
style="line-height: 0px" (click)="openItemDetail(lend,item)"><i style="line-height: 0px" (click)="openItemDetail(lend,item)"><i
...@@ -241,25 +245,21 @@ ...@@ -241,25 +245,21 @@
<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="date" class="form-control" [(ngModel)]="sDate" <input readonly type="date" class="form-control" [(ngModel)]="sDate">
(ngModelChange)="rDate(sDate,'sdate')">
</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="date" class="form-control" [(ngModel)]="eDate" <input readonly type="date" class="form-control" [(ngModel)]="eDate">
(ngModelChange)="rDate(eDate,'edate')">
</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="time" [(ngModel)]="thStime" <input readonly class="form-control" type="time" [(ngModel)]="modelRoomDetail.sTime">
(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 [readonly] for="exampleFormControlSelect1">เวลาที่สิ้นสุด</label>
<input readonly class="form-control" type="time" [(ngModel)]="thEtime" <input readonly class="form-control" type="time" [(ngModel)]="modelRoomDetail.eTime">
(ngModelChange)="thtimeChange(thEtime,modelroomDetail.eTime)">
</div> </div>
</div> </div>
<div class=" row"> <div class=" row">
...@@ -326,24 +326,24 @@ ...@@ -326,24 +326,24 @@
<div class="col-6 mb-1"> <div class="col-6 mb-1">
<label for="exampleFormControlSelect1">วันที่เริ่มต้น</label> <label for="exampleFormControlSelect1">วันที่เริ่มต้น</label>
<input readonly type="date" class="form-control" [(ngModel)]="sDate" <input readonly type="date" class="form-control" [(ngModel)]="sDate"
(ngModelChange)="rDate(sDate,'sdate')"> >
</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="date" class="form-control" [(ngModel)]="eDate" <input readonly type="date" class="form-control" [(ngModel)]="eDate"
(ngModelChange)="rDate(eDate,'edate')"> >
</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="time" [(ngModel)]="thStime" <input readonly class="form-control" type="time" [(ngModel)]="modelItemDetail.sTime"
(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="time" [(ngModel)]="thEtime" <input readonly class="form-control" type="time" [(ngModel)]="modelItemDetail.sTime"
(ngModelChange)="thtimeChange(thEtime,modelItemDetail.eTime)"> >
</div> </div>
</div> </div>
<div class=" row"> <div class=" row">
......
...@@ -7,6 +7,7 @@ import { RoomDetail } from 'src/app/models/RoomDetail.model'; ...@@ -7,6 +7,7 @@ import { RoomDetail } from 'src/app/models/RoomDetail.model';
import { RoomDetailService } from 'src/app/service/room-detail.service'; import { RoomDetailService } from 'src/app/service/room-detail.service';
import { Equirment } from 'src/app/models/equirment.model'; import { Equirment } from 'src/app/models/equirment.model';
import { MyRoom, Room } from 'src/app/models/rooms.model'; import { MyRoom, Room } from 'src/app/models/rooms.model';
import { FormControl, FormGroup, Validators } from '@angular/forms';
@Component({ @Component({
selector: 'app-pending', selector: 'app-pending',
...@@ -65,14 +66,8 @@ export class PendingComponent implements OnInit { ...@@ -65,14 +66,8 @@ export class PendingComponent implements OnInit {
fromDate: NgbDate | null; fromDate: NgbDate | null;
toDate: NgbDate | null; toDate: NgbDate | null;
thStime: string; myFormRoom: FormGroup;
thEtime: string; myFormEquir: FormGroup;
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();
...@@ -112,14 +107,29 @@ export class PendingComponent implements OnInit { ...@@ -112,14 +107,29 @@ export class PendingComponent implements OnInit {
eDate = "" eDate = ""
openItemDetail(content : string ,item : ItemDetail) { openItemDetail(content : string ,item : ItemDetail) {
this.modelItemDetail = item ; 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('/') let sDate = this.modelItemDetail.sDate.split('/')
this.sDate = sDate[0]+"-"+sDate[1]+"-"+sDate[2] this.sDate = sDate[0]+"-"+sDate[1]+"-"+sDate[2]
let eDate = this.modelItemDetail.eDate.split('/') let eDate = this.modelItemDetail.eDate.split('/')
this.eDate = eDate[0]+"-"+eDate[1]+"-"+eDate[2] this.eDate = eDate[0]+"-"+eDate[1]+"-"+eDate[2]
console.log(item);
this.myFormEquir = new FormGroup({
userNameForm: new FormControl(this.modelItemDetail.userName, [Validators.required]),
eTelephone: new FormControl(this.modelItemDetail.eTelephone, [Validators.required]),
email: new FormControl(this.modelItemDetail.email, [Validators.required, Validators.email]),
eqName: new FormControl(this.modelItemDetail.equirment.eqName, [Validators.required]),
eqDesc: new FormControl(this.modelItemDetail.equirment.eqDesc, [Validators.required]),
eqType: new FormControl(this.modelItemDetail.equirment.eqType, [Validators.required]),
sDate: new FormControl(this.modelItemDetail.sDate, [Validators.required]),
eDate: new FormControl(this.modelItemDetail.eDate, [Validators.required]),
sTime: new FormControl(this.modelItemDetail.sTime, [Validators.required]),
eTime: new FormControl(this.modelItemDetail.eTime, [Validators.required]),
Quantity: new FormControl(this.modelItemDetail.Quantity, [Validators.required]),
Remark: new FormControl(this.modelItemDetail.Remark),
eStatus: new FormControl(this.modelItemDetail.eStatus)
})
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) => {
...@@ -129,12 +139,27 @@ export class PendingComponent implements OnInit { ...@@ -129,12 +139,27 @@ export class PendingComponent implements OnInit {
openRoomDetail(content : string ,item : RoomDetail) { openRoomDetail(content : string ,item : RoomDetail) {
this.modelRoomDetail = item ; 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('/') let sDate = this.modelRoomDetail.sDate.split('/')
this.sDate = sDate[0]+"-"+sDate[1]+"-"+sDate[2] this.sDate = sDate[0]+"-"+sDate[1]+"-"+sDate[2]
let eDate = this.modelRoomDetail.eDate.split('/') let eDate = this.modelRoomDetail.eDate.split('/')
this.eDate = eDate[0]+"-"+eDate[1]+"-"+eDate[2] this.eDate = eDate[0]+"-"+eDate[1]+"-"+eDate[2]
this.myFormRoom = new FormGroup({
userNameForm: new FormControl(this.modelRoomDetail.userName, [Validators.required]),
rTelephone: new FormControl(this.modelRoomDetail.rTelephone, [Validators.required]),
email: new FormControl(this.modelRoomDetail.email, [Validators.required, Validators.email]),
rName: new FormControl(this.modelRoomDetail.room.rName, [Validators.required]),
rDesc: new FormControl(this.modelRoomDetail.room.rDesc, [Validators.required]),
rType: new FormControl(this.modelRoomDetail.room.rType, [Validators.required]),
sDate: new FormControl(this.modelRoomDetail.sDate, [Validators.required]),
eDate: new FormControl(this.modelRoomDetail.eDate, [Validators.required]),
sTime: new FormControl(this.modelRoomDetail.sTime, [Validators.required]),
eTime: new FormControl(this.modelRoomDetail.eTime, [Validators.required]),
Remark: new FormControl(this.modelRoomDetail.Remark),
rStatus: new FormControl(this.modelRoomDetail.rStatus)
});
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) => {
...@@ -187,7 +212,6 @@ export class PendingComponent implements OnInit { ...@@ -187,7 +212,6 @@ export class PendingComponent implements OnInit {
this.listItemDetail = this.ItemDetailService.getListItemDetail(); this.listItemDetail = this.ItemDetailService.getListItemDetail();
this.listRoomDetail = this.RoomDetailService.getListRoomDetail(); this.listRoomDetail = this.RoomDetailService.getListRoomDetail();
this.collectionSizeListRoom = this.listRoomDetail.length; this.collectionSizeListRoom = this.listRoomDetail.length;
console.log(this.listRoomDetail);
} }
} }
......
...@@ -20,16 +20,8 @@ export class ItemDetailService { ...@@ -20,16 +20,8 @@ export class ItemDetailService {
userName: 'เกม', userName: 'เกม',
sDate: '2021/12/09', sDate: '2021/12/09',
eDate: '2021/12/15', eDate: '2021/12/15',
sTime: { sTime: '22:30',
hour: 22, eTime: '22:30',
minute: 30,
second: 0
},
eTime: {
hour: 22,
minute: 30,
second: 0
},
eStatus: 0, eStatus: 0,
Quantity: '1', Quantity: '1',
eTelephone: '0123456789', eTelephone: '0123456789',
...@@ -48,16 +40,8 @@ export class ItemDetailService { ...@@ -48,16 +40,8 @@ export class ItemDetailService {
userName: 'แป๊ะ', userName: 'แป๊ะ',
sDate: '2021/12/09', sDate: '2021/12/09',
eDate: '2021/12/13', eDate: '2021/12/13',
sTime: { sTime: '22:30',
hour: 22, eTime: '22:30',
minute: 30,
second: 0
},
eTime: {
hour: 22,
minute: 30,
second: 0
},
eStatus: 1, eStatus: 1,
Quantity: '1', Quantity: '1',
eTelephone: '0123456789', eTelephone: '0123456789',
...@@ -73,6 +57,8 @@ export class ItemDetailService { ...@@ -73,6 +57,8 @@ export class ItemDetailService {
this.listItemDetail.reverse this.listItemDetail.reverse
} }
getListItemDetail() { getListItemDetail() {
return this.listItemDetail; return this.listItemDetail;
} }
...@@ -113,12 +99,21 @@ export class ItemDetailService { ...@@ -113,12 +99,21 @@ export class ItemDetailService {
}) })
} }
updateItemDetail(ItemDetailModel: ItemDetail) { // updateItemDetail(ItemDetailModel: ItemDetail) {
this.http.put(this.url + "/" +ItemDetailModel.Id, ItemDetailModel).subscribe(response => { // this.http.put(this.url + "/" +ItemDetailModel.Id, ItemDetailModel).subscribe(response => {
console.log(response); // console.log(response);
alert("อัพเดทข้อมูลอุปกรณ์สำเร็จ") // alert("อัพเดทข้อมูลอุปกรณ์สำเร็จ")
}) // })
// }
updateItemDetail(row_obj: ItemDetail) {
this.listItemDetail = this.listItemDetail.filter((value, key) => {
if (value.Id === row_obj.Id) {
value = row_obj;
} }
return true;
});
}
ItemDetailModel(eqId: string) { ItemDetailModel(eqId: string) {
......
...@@ -21,16 +21,8 @@ export class RoomDetailService { ...@@ -21,16 +21,8 @@ export class RoomDetailService {
userName: 'เกม', userName: 'เกม',
sDate: '2021/12/15', sDate: '2021/12/15',
eDate: '2021/12/15', eDate: '2021/12/15',
sTime: { sTime: '22:30',
hour: 22, eTime: '22:30',
minute: 30,
second: 0
},
eTime: {
hour: 22,
minute: 30,
second: 0
},
rStatus: 0, rStatus: 0,
rTelephone: '0123456789', rTelephone: '0123456789',
email: 'qwerty@qwerty', email: 'qwerty@qwerty',
...@@ -49,16 +41,8 @@ export class RoomDetailService { ...@@ -49,16 +41,8 @@ export class RoomDetailService {
userName: 'แป๊ะ', userName: 'แป๊ะ',
sDate: '2021/12/15', sDate: '2021/12/15',
eDate: '2021/12/15', eDate: '2021/12/15',
sTime: { sTime: '22:30',
hour: 22, eTime: '22:30',
minute: 30,
second: 0
},
eTime: {
hour: 22,
minute: 30,
second: 0
},
rStatus: 1, rStatus: 1,
rTelephone: '0123456789', rTelephone: '0123456789',
email: 'qwerty@qwerty', email: 'qwerty@qwerty',
...@@ -75,12 +59,22 @@ export class RoomDetailService { ...@@ -75,12 +59,22 @@ export class RoomDetailService {
this.listRoomDetail.push(model); this.listRoomDetail.push(model);
} }
updateRoomDetail(model: RoomDetail){ // updateRoomDetail(model: RoomDetail){
let temp = this.listRoomDetail.filter( x => // let temp = this.listRoomDetail.filter( x =>
x.Id == model.Id // x.Id == model.Id
) // )
console.log("temp",temp); // console.log("temp",temp);
// }
updateRoomDetail(row_obj: RoomDetail) {
this.listRoomDetail = this.listRoomDetail.filter((value, key) => {
if (value.Id === row_obj.Id) {
value = row_obj;
} }
return true;
});
}
getListRoomDetail() { getListRoomDetail() {
return this.listRoomDetail; return this.listRoomDetail;
......
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