Commit b0670726 by DESKTOP-HF0LVOG\myhr

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

parent 217ff232
......@@ -22,6 +22,7 @@ import { CalenRoomComponent } from './pages/calen-room/calen-room.component';
import { AdminPendingComponent } from './pages/admin-pending/admin-pending.component';
import { PendingComponent } from './pages/pending/pending.component';
import { AdminEquirmentComponent } from './pages/admin-equirment/admin-equirment.component';
import { ContactAdminComponent } from './pages/contact-admin/contact-admin.component'
FullCalendarModule.registerPlugins([ // register FullCalendar plugins
......@@ -42,7 +43,7 @@ FullCalendarModule.registerPlugins([ // register FullCalendar plugins
FullCalendarModule,
ReactiveFormsModule
],
declarations: [AppComponent, AdminLayoutComponent, AuthLayoutComponent, HomePageComponent, EquipmentComponent, CalenRoomComponent, AdminPendingComponent, PendingComponent, AdminEquirmentComponent],
declarations: [AppComponent, AdminLayoutComponent, AuthLayoutComponent, HomePageComponent, EquipmentComponent, CalenRoomComponent, AdminPendingComponent, PendingComponent, AdminEquirmentComponent, ContactAdminComponent],
providers: [],
bootstrap: [AppComponent]
})
......
......@@ -45,8 +45,8 @@ export const ROUTES: RouteInfo[] = [
},
{
path: "/lend-page",
title: "รายการดำเนินการ",
path: "/contact-admin",
title: "ติดต่อแอดมิน",
rtlTitle: "",
icon: "icon-bag-16",
class: ""
......
......@@ -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 { AdminPendingComponent } from "src/app/pages/admin-pending/admin-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 { ContactAdminComponent } from "src/app/pages/contact-admin/contact-admin.component";
// import { RtlComponent } from "../../pages/rtl/rtl.component";
export const AdminLayoutRoutes: Routes = [
......@@ -21,7 +21,7 @@ export const AdminLayoutRoutes: Routes = [
{ path: "admin-equirment", component: AdminEquirmentComponent },
{ path: "admin-pending", component: AdminPendingComponent },
{ path: "pending", component: PendingComponent },
{ path: "lend-page", component: LendPageComponent },
{ path: "contact-admin", component: ContactAdminComponent },
{ path: "dashboard", component: DashboardComponent },
{ path: "icons", component: IconsComponent },
{ path: "maps", component: MapComponent },
......
......@@ -6,16 +6,8 @@ export class ItemDetail {
userName: string;
sDate: string;
eDate: string;
sTime: {
hour: number;
minute: number;
second: number;
};
eTime: {
hour: number;
minute: number;
second: number;
};
sTime: string;
eTime: string;
eStatus: number;
Quantity: string;
eTelephone: string;
......
import { Room } from "./rooms.model";
export class RoomDetail {
Id?: number;
room: Room;
userName: string;
sDate: string;
eDate: string;
sTime: {
hour: number;
minute: number;
second: number;
};
eTime: {
hour: number;
minute: number;
second: number;
};
sTime: string;
eTime: string;
rStatus: number;
rTelephone: string;
email: string;
......
......@@ -56,8 +56,8 @@ export class AdminPendingComponent implements OnInit {
closeResult = '';
listitemDetail: ItemDetail[] = [];
listroomDetail: RoomDetail[] = [];
listItemDetail: ItemDetail[] = [];
listRoomDetail: RoomDetail[] = [];
modelEquirment = new Equirment();
modelRoom = new MyRoom();
......@@ -69,15 +69,6 @@ export class AdminPendingComponent implements OnInit {
fromDate: 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
, private equirmentService: EquirmentService, private roomService: RoomService) {
this.fromDate = calendar.getToday();
......@@ -86,7 +77,7 @@ export class AdminPendingComponent implements OnInit {
}
refreshitemDetail() {
this.listitemDetail = this.listitemDetail
this.listItemDetail = this.listItemDetail
.map((country, i) => ({ id: i + 1, ...country }))
.slice((this.page - 1) * this.pageSize, (this.page - 1) * this.pageSize + this.pageSize);
}
......@@ -115,8 +106,7 @@ export class AdminPendingComponent implements OnInit {
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[0] + "-" + sDate[1] + "-" + sDate[2]
let eDate = this.modelItemDetail.eDate.split('/')
......@@ -145,26 +135,25 @@ export class AdminPendingComponent implements OnInit {
}
rDate(item: string, item2: string) {
let Dates = item.split("-")
let dates = Dates[0] + "/" + Dates[1] + "/" + Dates[2]
let Dates = item.split("/")
let dates = Dates[0] + "-" + Dates[1] + "-" + Dates[2]
if (item2 == "sdate") {
this.modelItemDetail.sDate = dates
this.modelRoomDetail.sDate = dates
}
if (item2 == "edate") {
this.modelItemDetail.eDate = dates
this.modelRoomDetail.eDate = dates
}
}
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[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({
userNameForm: new FormControl(this.modelRoomDetail.userName, [Validators.required]),
......@@ -174,8 +163,8 @@ export class AdminPendingComponent implements OnInit {
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.sTime, [Validators.required]),
sTime: new FormControl(this.modelRoomDetail.eDate, [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)
......@@ -218,39 +207,10 @@ export class AdminPendingComponent implements OnInit {
myFormEquir: FormGroup;
ngOnInit(): void {
this.listitemDetail = this.ItemDetailService.getListItemDetail();
this.listroomDetail = this.RoomDetailService.getListRoomDetail();
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()
})
this.listItemDetail = this.ItemDetailService.getListItemDetail();
this.listRoomDetail = this.RoomDetailService.getListRoomDetail();
this.collectionSizeListRoom = this.listItemDetail.length;
}
saveEquirment() {
......@@ -265,15 +225,50 @@ export class AdminPendingComponent implements OnInit {
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.modalService.dismissAll();
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 { LendPageComponent } from './lend-page.component';
import { ContactAdminComponent } from './contact-admin.component';
describe('LendPageComponent', () => {
let component: LendPageComponent;
let fixture: ComponentFixture<LendPageComponent>;
describe('ContactAdminComponent', () => {
let component: ContactAdminComponent;
let fixture: ComponentFixture<ContactAdminComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ LendPageComponent ]
declarations: [ ContactAdminComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(LendPageComponent);
fixture = TestBed.createComponent(ContactAdminComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
......
import { Component, OnInit } from '@angular/core';
import { ItemDetail } from 'src/app/models/itemDetail.model';
@Component({
selector: 'app-lend-page',
templateUrl: './lend-page.component.html',
styleUrls: ['./lend-page.component.scss']
selector: 'app-contact-admin',
templateUrl: './contact-admin.component.html',
styleUrls: ['./contact-admin.component.scss']
})
export class LendPageComponent implements OnInit {
item: ItemDetail[] = [];
collectionSize = this.item.length;
export class ContactAdminComponent implements OnInit {
constructor() { }
......
......@@ -321,8 +321,8 @@
<div class="row">
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">เวลาที่เริ่มต้น</label>
<ngb-timepicker [(ngModel)]="modelRoomDetail.sTime" formControlName="sTime">
</ngb-timepicker>
<input class="form-control" type="time" [(ngModel)]="modelRoomDetail.sTime" formControlName="sTime" />
<div style="color: red;" *ngIf="myFormRoom.controls.sTime.status=='INVALID'">
กรุณากรอกเวลาที่เริ่มต้นการจอง.
</div>
......@@ -330,8 +330,8 @@
</div>
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">เวลาที่สิ้นสุด</label>
<ngb-timepicker [(ngModel)]="modelRoomDetail.eTime" formControlName="eTime">
</ngb-timepicker>
<input class="form-control" type="time" [(ngModel)]="modelRoomDetail.eTime" formControlName="eTime" />
<div style="color: red;" *ngIf="myFormRoom.controls.eTime.status=='INVALID'">
กรุณากรอกเวลาที่สิ้นสุดการจอง.
</div>
......@@ -436,16 +436,16 @@
<div class="row">
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">เวลาที่เริ่มต้น</label>
<ngb-timepicker [(ngModel)]="modelItemDetail.sTime" formControlName="sTime">
</ngb-timepicker>
<input class="form-control" type="time" [(ngModel)]="modelItemDetail.sTime" formControlName="sTime" />
<div style="color: red;" *ngIf="myFormEquir.controls.sTime.status=='INVALID'">
กรุณากรอกเวลาที่เริ่มต้นการเบิก.
</div>
</div>
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">เวลาที่สิ้นสุด</label>
<ngb-timepicker [(ngModel)]="modelItemDetail.eTime" formControlName="eTime">
</ngb-timepicker>
<input class="form-control" type="time" [(ngModel)]="modelItemDetail.eTime" formControlName="eTime" />
<div style="color: red;" *ngIf="myFormEquir.controls.eTime.status=='INVALID'">
กรุณากรอกเวลาที่สิ้นสุดการเบิก.
</div>
......
......@@ -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.eDate = this.modelRoomDetail.eDate.split("-")[0]+"/"+this.modelRoomDetail.eDate.split("-")[1]+"/"+this.modelRoomDetail.eDate.split("-")[2];
this.modelRoomDetail.rStatus = 0 ;
console.log("save",this.modelRoomDetail)
this.RoomDetailService.addRoomDetail(this.modelRoomDetail);
this.modalService.dismissAll();
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 @@
<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>
<th scope="col">วันที่สิ้นสุด</th>
<th scope="col">สถานะ</th>
......@@ -87,14 +88,16 @@
<tbody>
<tr *ngFor="let item of listRoomDetail">
<th scope="row">{{ item.Id }}</th>
<td>{{ item.room.rType }}</td>
<td>{{ item.room.rName }}</td>
<td>{{ item.room.rDesc }}</td>
<td>{{ item.userName }}</td>
<td>{{ item.sDate | date : 'dd/MM/yyyy' }} {{ item.sTime.hour }}:{{
item.sTime.minute }}</td>
<td>{{ item.eDate | date : 'dd/MM/yyyy' }} {{ item.eTime.hour }}:{{
item.eTime.minute }}</td>
<td>{{ item.rStatus==0 ? "รอดำเนินการ" : "อนุมัติ" }}</td>
<td>{{ item.sDate | date : 'dd/MM/yyyy' }} {{ item.sTime }}</td>
<td>{{ item.eDate | date : 'dd/MM/yyyy' }} {{ item.eTime }}</td>
<td *ngIf="item.rStatus==0">รอดำเนินการ</td>
<td *ngIf="item.rStatus==1">อนุมัติ</td>
<td *ngIf="item.rStatus==2">ยกเลิก</td>
<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 "
style="line-height: 0px" (click)="openRoomDetail(Room,item)"><i
......@@ -137,9 +140,9 @@
<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>
......@@ -153,12 +156,13 @@
<td>{{ item.equirment.eqName }}</td>
<td>{{ item.equirment.eqDesc }}</td>
<td>{{ item.userName }}</td>
<td>{{ item.sDate | date : 'dd/MM/yyyy' }} {{ item.sTime.hour }}:{{
item.sTime.minute }}</td>
<td>{{ item.eDate | date : 'dd/MM/yyyy' }} {{ item.eTime.hour }}:{{
item.eTime.minute }}</td>
<td>{{ item.sDate | date : 'dd/MM/yyyy' }} {{ item.sTime }}</td>
<td>{{ item.eDate | date : 'dd/MM/yyyy' }} {{ item.eTime }}</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">
<button type="button" class="btn btn-info btn-sm btn-circle "
style="line-height: 0px" (click)="openItemDetail(lend,item)"><i
......@@ -241,25 +245,21 @@
<div class="row">
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">วันที่เริ่มต้น</label>
<input readonly type="date" class="form-control" [(ngModel)]="sDate"
(ngModelChange)="rDate(sDate,'sdate')">
<input readonly type="date" class="form-control" [(ngModel)]="sDate">
</div>
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">วันที่สิ้นสุด</label>
<input readonly type="date" class="form-control" [(ngModel)]="eDate"
(ngModelChange)="rDate(eDate,'edate')">
<input readonly type="date" class="form-control" [(ngModel)]="eDate">
</div>
</div>
<div class="row">
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">เวลาที่เริ่มต้น</label>
<input readonly class="form-control" type="time" [(ngModel)]="thStime"
(ngModelChange)="thtimeChange(thStime,modelroomDetail.sTime)">
<input readonly class="form-control" type="time" [(ngModel)]="modelRoomDetail.sTime">
</div>
<div class="col-6 mb-1">
<label [readonly] for="exampleFormControlSelect1">เวลาที่สิ้นสุด</label>
<input readonly class="form-control" type="time" [(ngModel)]="thEtime"
(ngModelChange)="thtimeChange(thEtime,modelroomDetail.eTime)">
<input readonly class="form-control" type="time" [(ngModel)]="modelRoomDetail.eTime">
</div>
</div>
<div class=" row">
......@@ -326,24 +326,24 @@
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">วันที่เริ่มต้น</label>
<input readonly 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="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="time" [(ngModel)]="thStime"
(ngModelChange)="thtimeChange(thStime,modelItemDetail.sTime)">
<input readonly class="form-control" type="time" [(ngModel)]="modelItemDetail.sTime"
>
</div>
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">เวลาที่สิ้นสุด</label>
<input readonly class="form-control" type="time" [(ngModel)]="thEtime"
(ngModelChange)="thtimeChange(thEtime,modelItemDetail.eTime)">
<input readonly class="form-control" type="time" [(ngModel)]="modelItemDetail.sTime"
>
</div>
</div>
<div class=" row">
......
......@@ -7,6 +7,7 @@ import { RoomDetail } from 'src/app/models/RoomDetail.model';
import { RoomDetailService } from 'src/app/service/room-detail.service';
import { Equirment } from 'src/app/models/equirment.model';
import { MyRoom, Room } from 'src/app/models/rooms.model';
import { FormControl, FormGroup, Validators } from '@angular/forms';
@Component({
selector: 'app-pending',
......@@ -65,14 +66,8 @@ export class PendingComponent implements OnInit {
fromDate: 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)
}
myFormRoom: FormGroup;
myFormEquir: FormGroup;
constructor(private calendar: NgbCalendar, public formatter: NgbDateParserFormatter, private modalService: NgbModal, private ItemDetailService: ItemDetailService, private RoomDetailService: RoomDetailService) {
this.fromDate = calendar.getToday();
......@@ -112,14 +107,29 @@ export class PendingComponent implements OnInit {
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[0]+"-"+sDate[1]+"-"+sDate[2]
let eDate = this.modelItemDetail.eDate.split('/')
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.closeResult = `Closed with: ${result}`;
}, (reason) => {
......@@ -129,12 +139,27 @@ export class PendingComponent implements OnInit {
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[0]+"-"+sDate[1]+"-"+sDate[2]
let eDate = this.modelRoomDetail.eDate.split('/')
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.closeResult = `Closed with: ${result}`;
}, (reason) => {
......@@ -187,7 +212,6 @@ export class PendingComponent implements OnInit {
this.listItemDetail = this.ItemDetailService.getListItemDetail();
this.listRoomDetail = this.RoomDetailService.getListRoomDetail();
this.collectionSizeListRoom = this.listRoomDetail.length;
console.log(this.listRoomDetail);
}
}
......
......@@ -20,16 +20,8 @@ export class ItemDetailService {
userName: 'เกม',
sDate: '2021/12/09',
eDate: '2021/12/15',
sTime: {
hour: 22,
minute: 30,
second: 0
},
eTime: {
hour: 22,
minute: 30,
second: 0
},
sTime: '22:30',
eTime: '22:30',
eStatus: 0,
Quantity: '1',
eTelephone: '0123456789',
......@@ -48,16 +40,8 @@ export class ItemDetailService {
userName: 'แป๊ะ',
sDate: '2021/12/09',
eDate: '2021/12/13',
sTime: {
hour: 22,
minute: 30,
second: 0
},
eTime: {
hour: 22,
minute: 30,
second: 0
},
sTime: '22:30',
eTime: '22:30',
eStatus: 1,
Quantity: '1',
eTelephone: '0123456789',
......@@ -73,6 +57,8 @@ export class ItemDetailService {
this.listItemDetail.reverse
}
getListItemDetail() {
return this.listItemDetail;
}
......@@ -113,12 +99,21 @@ export class ItemDetailService {
})
}
updateItemDetail(ItemDetailModel: ItemDetail) {
this.http.put(this.url + "/" +ItemDetailModel.Id, ItemDetailModel).subscribe(response => {
console.log(response);
alert("อัพเดทข้อมูลอุปกรณ์สำเร็จ")
})
}
// updateItemDetail(ItemDetailModel: ItemDetail) {
// this.http.put(this.url + "/" +ItemDetailModel.Id, ItemDetailModel).subscribe(response => {
// console.log(response);
// 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) {
......
......@@ -21,16 +21,8 @@ export class RoomDetailService {
userName: 'เกม',
sDate: '2021/12/15',
eDate: '2021/12/15',
sTime: {
hour: 22,
minute: 30,
second: 0
},
eTime: {
hour: 22,
minute: 30,
second: 0
},
sTime: '22:30',
eTime: '22:30',
rStatus: 0,
rTelephone: '0123456789',
email: 'qwerty@qwerty',
......@@ -49,16 +41,8 @@ export class RoomDetailService {
userName: 'แป๊ะ',
sDate: '2021/12/15',
eDate: '2021/12/15',
sTime: {
hour: 22,
minute: 30,
second: 0
},
eTime: {
hour: 22,
minute: 30,
second: 0
},
sTime: '22:30',
eTime: '22:30',
rStatus: 1,
rTelephone: '0123456789',
email: 'qwerty@qwerty',
......@@ -75,13 +59,23 @@ export class RoomDetailService {
this.listRoomDetail.push(model);
}
updateRoomDetail(model: RoomDetail){
let temp = this.listRoomDetail.filter( x =>
x.Id == model.Id
)
console.log("temp",temp);
// updateRoomDetail(model: RoomDetail){
// let temp = this.listRoomDetail.filter( x =>
// x.Id == model.Id
// )
// 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() {
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