Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
BookingMyHrManagement
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chanachai
BookingMyHrManagement
Commits
12cd07db
Commit
12cd07db
authored
Dec 09, 2021
by
DESKTOP-HF0LVOG\myhr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Validator หน้าอุปกรณ์ และ admin
parent
591bb041
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
240 additions
and
274 deletions
+240
-274
admin-equirment.component.html
src/app/pages/admin-equirment/admin-equirment.component.html
+85
-199
admin-equirment.component.ts
src/app/pages/admin-equirment/admin-equirment.component.ts
+37
-15
admin-pending.component.ts
src/app/pages/admin-pending/admin-pending.component.ts
+32
-0
equipment.component.html
src/app/pages/equipment/equipment.component.html
+81
-58
equipment.component.ts
src/app/pages/equipment/equipment.component.ts
+5
-2
No files found.
src/app/pages/admin-equirment/admin-equirment.component.html
View file @
12cd07db
...
...
@@ -20,7 +20,7 @@
<div
class=
"card-body"
>
<button
class=
"btn btn-lg btn-outline-primary"
(
click
)="
addroom
(
contentroom
)"
>
เพิ่มรายการ
</button>
(
click
)="
openRoomDetail
(
contentroom
)"
>
เพิ่มรายการ
</button>
<div
class=
"row"
>
<div
class=
"col-sm-3"
...
...
@@ -78,7 +78,7 @@
<div
class=
""
>
<div
class=
"card-body"
>
<button
class=
"btn btn-lg btn-outline-primary"
(
click
)="
addequirment
(
contentequirment
)"
>
เพิ่มรายการ
</button>
(
click
)="
openItemDetail
(
contentequirment
)"
>
เพิ่มรายการ
</button>
<div
class=
"row"
>
<div
class=
"col-sm-3"
...
...
@@ -131,33 +131,40 @@
<div
[
ngbNavOutlet
]="
nav
"
></div>
</div>
<ng-template
#
content
room
let-modal
>
<ng-template
#
content
equirment
let-modal
>
<div
class=
" col-md-12"
style=
"padding: 0; "
>
<div
class=
"card"
style=
"margin: 0; "
>
<div
class=
"card-header"
>
<div
class=
"
card-header"
>
<h5
class=
" title"
>
Add Equirment
</h5>
</div>
<div
class=
" card-body"
>
<form>
<form
[
formGroup
]="
myFormEquir
"
class=
"needs-validation"
>
<div
class=
" row"
>
<div
class=
" col-md-12"
>
<div
class=
" form-group"
>
<label>
ชื่อ
</label>
<input
class=
" form-control"
placeholder=
""
type=
"text"
[(
ngModel
)]="
modelRoom
.
rName
"
>
<input
class=
" form-control"
placeholder=
""
type=
"text"
[(
ngModel
)]="
modelEquirment
.
eqName
"
value=
""
formControlName=
"eqName"
/>
<div
style=
"color: red;"
*
ngIf=
"myFormEquir.controls.eqName.status=='INVALID'"
>
Invalid
Equirment Name.
</div>
</div>
</div>
</div>
<div
class=
" row"
>
<div
class=
" col-md-6 mb-2"
>
<div
class=
" form-group"
>
<label>
ประเภท
</label>
<label>
หมวดหมู่
</label>
<br>
<select
class=
"form-select"
aria-label=
"Default select example"
[(
ngModel
)]="
model
Room
.
r
Type
"
>
<option
selected
>
เลือก
ประเภท
</option>
<option
value=
"
1"
>
ห้อง
</option>
<option
value=
"
2"
>
รถ
</option>
[(
ngModel
)]="
model
Equirment
.
eqType
"
formControlName=
"eq
Type"
>
<option
selected
>
เลือก
หมวดหมู่
</option>
<option
value=
"
4"
>
IT
</option>
<option
value=
"
5"
>
Company
</option>
</select>
<div
style=
"color: red;"
*
ngIf=
"myFormEquir.controls.eqType.status=='INVALID'"
>
Invalid
Equirment Type.
</div>
</div>
</div>
</div>
...
...
@@ -166,16 +173,21 @@
<div
class=
" form-group"
>
<label>
รายละเอียด
</label>
<textarea
class=
"form-control"
id=
"exampleFormControlTextarea1"
rows=
"3"
placeholder=
"......"
[(
ngModel
)]="
modelRoom
.
rDesc
"
></textarea>
placeholder=
"......"
[(
ngModel
)]="
modelEquirment
.
eqDesc
"
formControlName=
"eqDesc"
></textarea>
<div
style=
"color: red;"
*
ngIf=
"myFormEquir.controls.eqDesc.status=='INVALID'"
>
Invalid
Equirment Desc.
</div>
</div>
</div>
</div>
<label
for=
"exampleFormControlFile"
>
แนบไฟล์รูปภาพ
</label>
<input
type=
"file"
class=
"form-control-file"
id=
"exampleFormControlFile"
>
<input
type=
"file"
class=
"form-control-file"
id=
"exampleFormControlFile"
formControlName=
"eqPic"
>
</form>
</div>
<div
class=
" card-footer"
>
<button
class=
" btn btn-fill btn-danger"
type=
"submit"
(
click
)="
save
Room
()"
>
Save
</button>
<button
class=
" btn btn-fill btn-danger"
type=
"submit"
(
click
)="
save
Equirment
()"
>
Save
</button>
<button
class=
" btn btn-fill btn-danger"
type=
"cancel"
(
click
)="
modal
.
dismiss
('
Cross
click
')"
>
Cancel
</button>
</div>
...
...
@@ -183,34 +195,39 @@
</div>
</ng-template>
<ng-template
#
content
equirment
let-modal
>
<ng-template
#
content
room
let-modal
>
<div
class=
" col-md-12"
style=
"padding: 0; "
>
<div
class=
"card"
style=
"margin: 0; "
>
<div
class=
" card-header"
>
<h5
class=
" title"
>
Add Equirment
</h5>
<h5
class=
" title"
>
เพิ่มรายการ
</h5>
</div>
<div
class=
" card-body"
>
<form>
<form
[
formGroup
]="
myFormRoom
"
class=
"needs-validation"
>
<div
class=
" row"
>
<div
class=
" col-md-12"
>
<div
class=
" form-group"
>
<label>
ชื่อ
</label>
<input
class=
" form-control"
placeholder=
""
type=
"text"
[(
ngModel
)]="
modelEquirment
.
eqName
"
value=
""
/>
<input
class=
" form-control"
placeholder=
""
type=
"text"
[(
ngModel
)]="
modelRoom
.
rName
"
formControlName=
"rName"
>
<div
style=
"color: red;"
*
ngIf=
"myFormRoom.controls.rName.status=='INVALID'"
>
Invalid
Name.
</div>
</div>
</div>
</div>
<div
class=
" row"
>
<div
class=
" col-md-6 mb-2"
>
<div
class=
" form-group"
>
<label>
หมวดหมู่
</label>
<label>
ประเภท
</label>
<br>
<select
class=
"form-select"
aria-label=
"Default select example"
[(
ngModel
)]="
modelEquirment
.
eqType
"
>
<option
selected
>
เลือกหมวดหมู่
</option>
<option
value=
"4"
>
IT
</option>
<option
value=
"5"
>
Company
</option>
[(
ngModel
)]="
modelRoom
.
rType
"
formControlName=
"rType"
>
<option
value=
"1"
>
ห้อง
</option>
<option
value=
"2"
>
รถ
</option>
</select>
<div
style=
"color: red;"
*
ngIf=
"myFormRoom.controls.rType.status=='INVALID'"
>
Invalid
Type.
</div>
</div>
</div>
</div>
...
...
@@ -219,7 +236,11 @@
<div
class=
" form-group"
>
<label>
รายละเอียด
</label>
<textarea
class=
"form-control"
id=
"exampleFormControlTextarea1"
rows=
"3"
placeholder=
"......"
[(
ngModel
)]="
modelEquirment
.
eqDesc
"
></textarea>
placeholder=
"......"
[(
ngModel
)]="
modelRoom
.
rDesc
"
formControlName=
"rDesc"
></textarea>
<div
style=
"color: red;"
*
ngIf=
"myFormRoom.controls.rDesc.status=='INVALID'"
>
Invalid
Desc.
</div>
</div>
</div>
</div>
...
...
@@ -228,7 +249,7 @@
</form>
</div>
<div
class=
" card-footer"
>
<button
class=
" btn btn-fill btn-danger"
type=
"submit"
(
click
)="
save
Equirment
()"
>
Save
</button>
<button
class=
" btn btn-fill btn-danger"
type=
"submit"
(
click
)="
save
Room
()"
>
Save
</button>
<button
class=
" btn btn-fill btn-danger"
type=
"cancel"
(
click
)="
modal
.
dismiss
('
Cross
click
')"
>
Cancel
</button>
</div>
...
...
@@ -243,23 +264,34 @@
<h5
class=
" title"
>
แก้ไขข้อมูล
</h5>
</div>
<div
class=
" card-body"
>
<form
[
formGroup
]="
myFormRoom
"
class=
"needs-validation"
>
<div
class=
" row"
>
<div
class=
" col-md-12"
>
<label>
ชื่อ
</label>
<input
class=
" form-control"
type=
"text"
[(
ngModel
)]="
listRoomModelEdit
.
rName
"
>
<input
class=
" form-control"
type=
"text"
[(
ngModel
)]="
listRoomModelEdit
.
rName
"
formControlName=
"rName"
>
<div
style=
"color: red;"
*
ngIf=
"myFormRoom.controls.rName.status=='INVALID'"
>
Invalid
Name.
</div>
</div>
<div
class=
" col-md-12"
>
<label>
ประเภท
</label>
<input
class=
" form-control"
type=
"text"
[(
ngModel
)]="
listRoomModelEdit
.
rType
"
>
<input
class=
" form-control"
type=
"text"
[(
ngModel
)]="
listRoomModelEdit
.
rType
"
formControlName=
"rType"
>
<div
style=
"color: red;"
*
ngIf=
"myFormRoom.controls.rType.status=='INVALID'"
>
Invalid
Type.
</div>
</div>
<div
class=
" col-md-12"
>
<label>
รายละเอียด
</label>
<input
class=
" form-control"
type=
"text"
[(
ngModel
)]="
listRoomModelEdit
.
rDesc
"
>
<input
class=
" form-control"
type=
"text"
[(
ngModel
)]="
listRoomModelEdit
.
rDesc
"
formControlName=
"rDesc"
>
<div
style=
"color: red;"
*
ngIf=
"myFormRoom.controls.rDesc.status=='INVALID'"
>
Invalid
Desc.
</div>
</div>
</div>
</form>
</div>
<div
class=
" card-footer"
>
...
...
@@ -278,183 +310,37 @@
<h5
class=
" title"
>
แก้ไขข้อมูล
</h5>
</div>
<div
class=
" card-body"
>
<div
class=
" row"
>
<div
class=
" col-md-12"
>
<label>
ชื่ออุปกรณ์
</label>
<input
class=
" form-control"
type=
"text"
[(
ngModel
)]="
listEquirmentModelEdit
.
eqName
"
>
</div>
<div
class=
" col-md-12"
>
<label>
ประเภทอุปกรณ์
</label>
<input
class=
" form-control"
type=
"text"
[(
ngModel
)]="
listEquirmentModelEdit
.
eqType
"
>
</div>
<div
class=
" col-md-12"
>
<label>
รายละเอียดอุปกรณ์
</label>
<input
class=
" form-control"
type=
"text"
[(
ngModel
)]="
listEquirmentModelEdit
.
eqDesc
"
>
</div>
</div>
</div>
<div
class=
" card-footer"
>
<button
class=
" btn btn-fill btn-danger"
type=
"update"
(
click
)="
updateItemProfile
();
modal
.
dismiss
()"
>
Save
</button>
<button
class=
" btn btn-fill btn-danger"
type=
"cancel"
(
click
)="
modal
.
dismiss
()"
>
Cancel
</button>
</div>
</div>
</div>
</ng-template>
<!-- <ng-template #Room let-modal >
<div class=" col-md-12" style="padding: 0; ">
<div class="card" style="margin: 0; ">
<div class=" card-header">
<h5 class=" title">การจอง</h5>
</div>
<div class=" card-body">
<form>
<div class=" row">
<div class=" col-md-12">
<div class=" form-group">
<label> ชื่อผู้จอง </label>
<input class=" form-control" placeholder="" type="text" value="" />
</div>
</div>
</div>
<div class=" row">
<div class=" col-md-12">
<div class=" form-group">
<label> เบอร์โทร </label>
<input class=" form-control" placeholder="" type="text" value="" />
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12 mb-1">
<label for="exampleFormControlSelect1">ชื่อห้อง</label>
<input readonly class="form-control" type="text" value="{{item.rName}}">
</div>
</div>
<div class="row">
<div class="col-sm-12 mb-1">
<label for="exampleFormControlSelect1">รายละเอียด</label>
<input readonly class="form-control" type="text" value="{{item.rDecs}}">
</div>
</div>
<div class="row">
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">วันที่เริ่มต้น</label>
<input type="date" class="form-control" value="">
</div>
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">วันที่สิ้นสุด</label>
<input type="date" class="form-control" value="">
</div>
</div>
<div class="row">
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">เวลาที่เริ่มต้น</label>
<ngb-timepicker [(ngModel)]="stime"></ngb-timepicker>
</div>
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">เวลาที่สิ้นสุด</label>
<ngb-timepicker [(ngModel)]="etime"></ngb-timepicker>
</div>
</div>
<form
[
formGroup
]="
myFormEquir
"
class=
"needs-validation"
>
<div
class=
" row"
>
<div
class=
" col-md-12"
>
<div class=" form-group">
<label> หมายเหตุ </label>
<textarea class="form-control" id="exampleFormControlTextarea1" rows="3"
placeholder="......"></textarea>
</div>
</div>
</div>
</form>
</div>
<div class=" card-footer">
<button class=" btn btn-fill btn-danger" type="submit">Save</button>
<button class=" btn btn-fill btn-danger" type="close">Cancel</button>
</div>
</div>
</div>
</ng-template> -->
<!-- <ng-template #Lend let-modal>
<div class=" col-md-12" style="padding: 0; ">
<div class="card" style="margin: 0; ">
<div class=" card-header">
<h5 class=" title">Lend Equirment</h5>
</div>
<div class=" card-body">
<form>
<div class=" row">
<div class=" col-sm-12 mb-1">
<div class=" form-group">
<label> ชื่อผู้จอง </label>
<input class=" form-control" placeholder="" type="text" value="" />
</div>
<label>
ชื่ออุปกรณ์
</label>
<input
class=
" form-control"
type=
"text"
[(
ngModel
)]="
listEquirmentModelEdit
.
eqName
"
formControlName=
"eqName"
>
<div
style=
"color: red;"
*
ngIf=
"myFormEquir.controls.eqName.status=='INVALID'"
>
Invalid
Desc.
</div>
</div>
</div>
<div class=" row">
<div
class=
" col-md-12"
>
<div class=" form-group">
<label> เบอร์โทร </label>
<input class=" form-control" placeholder="" type="text" value="" />
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12 mb-1">
<label for="exampleFormControlSelect1">ชื่ออุปกรณ์</label>
<input readonly class="form-control" type="text" value="{{item.rName}}">
</div>
</div>
<div class="row">
<div class="col-sm-12 mb-1">
<label for="exampleFormControlSelect1">รายละเอียดอุปกรณ์</label>
<input readonly class="form-control" type="text" value="{{item.rDecs}}">
</div>
</div>
<div class="row">
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">วันที่เริ่มต้น</label>
<input type="date" class="form-control" value="">
</div>
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">วันที่สิ้นสุด</label>
<input type="date" class="form-control" value="">
<label>
ประเภทอุปกรณ์
</label>
<input
class=
" form-control"
type=
"text"
[(
ngModel
)]="
listEquirmentModelEdit
.
eqType
"
formControlName=
"eqType"
>
<div
style=
"color: red;"
*
ngIf=
"myFormEquir.controls.eqType.status=='INVALID'"
>
Invalid
Desc.
</div>
</div>
</div>
<div class="row">
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">เวลาที่เริ่มต้น</label>
<ngb-timepicker [(ngModel)]="stime"></ngb-timepicker>
</div>
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">เวลาที่สิ้นสุด</label>
<ngb-timepicker [(ngModel)]="etime"></ngb-timepicker>
</div>
</div>
<div class=" row">
<div class=" col-sm-6 mb-1">
<label for="changequantity">จำนวน</label>
<input id="changequantity" type="number" class="form-control form-control-sm"
[(ngModel)]="quantity" />
</div>
</div>
<div class=" row">
<div
class=
" col-md-12"
>
<
div class=" form-group"
>
<label> หมายเหตุ </label
>
<textarea class="form-control" id="exampleFormControlTextarea1" rows="3"
placeholder="......"></textarea>
</div>
<
label>
รายละเอียดอุปกรณ์
</label
>
<input
class=
" form-control"
type=
"text"
[(
ngModel
)]="
listEquirmentModelEdit
.
eqDesc
"
formControlName=
"eqDesc"
>
<div
style=
"color: red;"
*
ngIf=
"myFormEquir.controls.eqDesc.status=='INVALID'"
>
Invalid
Desc.
</div>
</div>
</div>
</form>
</div>
<div
class=
" card-footer"
>
<button class=" btn btn-fill btn-danger" type="submit">Save</button>
<button class=" btn btn-fill btn-danger" type="close">Cancel</button>
<button
class=
" btn btn-fill btn-danger"
type=
"update"
(
click
)="
updateItemProfile
();
modal
.
dismiss
()"
>
Save
</button>
<button
class=
" btn btn-fill btn-danger"
type=
"cancel"
(
click
)="
modal
.
dismiss
()"
>
Cancel
</button>
</div>
</div>
</div>
</ng-template> -->
\ No newline at end of file
</ng-template>
\ No newline at end of file
src/app/pages/admin-equirment/admin-equirment.component.ts
View file @
12cd07db
...
...
@@ -52,15 +52,11 @@ export class AdminEquirmentComponent implements OnInit {
rDesc
:
new
FormControl
(
''
)
});
myFormRoom
:
FormGroup
;
myFormEquir
:
FormGroup
;
constructor
(
private
modalService
:
NgbModal
,
private
equirmentService
:
EquirmentService
,
private
roomService
:
RoomService
,
private
RoomDetailService
:
RoomDetailService
,
private
fb
:
FormBuilder
)
{
console
.
log
()
this
.
RoomForm
=
this
.
fb
.
group
({
rName
:
[
""
,],
rType
:
[
""
,],
rDesc
:
[
""
,]
});
this
.
RoomForm
.
valueChanges
.
subscribe
(
console
.
log
);
}
ngOnInit
()
{
...
...
@@ -68,6 +64,34 @@ export class AdminEquirmentComponent implements OnInit {
this
.
listRoomModel
=
this
.
roomService
.
getListRoom
();
this
.
collectionSizeListRoom
=
this
.
listRoomModel
.
length
console
.
log
(
"listRoom"
,
this
.
listRoomModel
)
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
()
});
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
(
''
,[
Validators
.
required
]),
})
}
bookEquir
(
editLend
,
item
:
Equirment
)
{
...
...
@@ -168,20 +192,18 @@ export class AdminEquirmentComponent implements OnInit {
});
}
openItemDetail
(
content
:
string
,
item
:
ItemDetail
)
{
this
.
modelItemDetail
=
item
;
console
.
log
(
item
);
this
.
modalService
.
open
(
content
,
{
ariaLabelledBy
:
'modal-basic-title'
}).
result
.
then
((
result
)
=>
{
openItemDetail
(
contentequirment
)
{
this
.
modelEquirment
=
new
Equirment
();
this
.
modalService
.
open
(
contentequirment
,
{
ariaLabelledBy
:
'modal-basic-title'
}).
result
.
then
((
result
)
=>
{
this
.
closeResult
=
`Closed with:
${
result
}
`
;
},
(
reason
)
=>
{
this
.
closeResult
=
`Dismissed
${
this
.
getDismissReason
(
reason
)}
`
;
});
}
openRoomDetail
(
content
:
string
,
item
:
RoomDetail
)
{
this
.
modelRoomDetail
=
item
;
console
.
log
(
item
);
this
.
modalService
.
open
(
content
,
{
ariaLabelledBy
:
'modal-basic-title'
}).
result
.
then
((
result
)
=>
{
openRoomDetail
(
contentroom
)
{
this
.
modelRoom
=
new
MyRoom
();
this
.
modalService
.
open
(
contentroom
,
{
ariaLabelledBy
:
'modal-basic-title'
}).
result
.
then
((
result
)
=>
{
this
.
closeResult
=
`Closed with:
${
result
}
`
;
},
(
reason
)
=>
{
this
.
closeResult
=
`Dismissed
${
this
.
getDismissReason
(
reason
)}
`
;
...
...
src/app/pages/admin-pending/admin-pending.component.ts
View file @
12cd07db
...
...
@@ -9,6 +9,7 @@ import { RoomDetailService } from 'src/app/service/room-detail.service';
import
{
MyRoom
,
Room
}
from
'src/app/models/rooms.model'
;
import
{
EquirmentService
}
from
'src/app/service/equirment.service'
;
import
{
RoomService
}
from
'src/app/service/room.service'
;
import
{
FormControl
,
FormGroup
,
Validators
}
from
'@angular/forms'
;
@
Component
({
selector
:
'app-admin-pending'
,
...
...
@@ -185,11 +186,42 @@ export class AdminPendingComponent implements OnInit {
return
parsed
&&
this
.
calendar
.
isValid
(
NgbDate
.
from
(
parsed
))
?
NgbDate
.
from
(
parsed
)
:
currentValue
;
}
myFormRoom
:
FormGroup
;
myFormEquir
:
FormGroup
;
ngOnInit
():
void
{
this
.
listitemDetail
=
this
.
ItemDetailService
.
getListItemDetail
();
this
.
listroomDetail
=
this
.
RoomDetailService
.
getListRoomDetail
();
this
.
collectionSizeListRoom
=
this
.
listitemDetail
.
length
;
console
.
log
(
this
.
listitemDetail
);
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
()
});
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
(
''
,[
Validators
.
required
]),
})
}
saveEquirment
()
{
...
...
src/app/pages/equipment/equipment.component.html
View file @
12cd07db
...
...
@@ -131,43 +131,54 @@
<h5
class=
" title"
>
Add Equirment
</h5>
</div>
<div
class=
" card-body"
>
<div
class=
" row"
>
<div
class=
" col-md-12"
>
<div
class=
" form-group"
>
<label>
ชื่อ
</label>
<input
class=
" form-control"
placeholder=
""
type=
"text"
[(
ngModel
)]="
modelEquirment
.
eqName
"
value=
""
/>
<form
[
formGroup
]="
myFormEquir
"
class=
"needs-validation"
>
<div
class=
" row"
>
<div
class=
" col-md-12"
>
<div
class=
" form-group"
>
<label>
ชื่อ
</label>
<input
class=
" form-control"
placeholder=
""
type=
"text"
[(
ngModel
)]="
modelEquirment
.
eqName
"
value=
""
formControlName=
"eqName"
/>
<div
style=
"color: red;"
*
ngIf=
"myFormEquir.controls.eqName.status=='INVALID'"
>
Invalid
Equirment Name.
</div>
</div>
</div>
</div>
</div>
<div
class=
" row"
>
<div
class=
" col-md-6 mb-2"
>
<div
class=
" form-group"
>
<label>
หมวดหมู่
</label>
<br>
<select
class=
"form-select"
aria-label=
"Default select example"
[(
ngModel
)]="
modelEquirment
.
eqType
"
>
<option
selected
>
เลือกหมวดหมู่
</option>
<option
value=
"4"
>
IT
</option>
<option
value=
"5"
>
Company
</option>
</select>
<div
class=
" row"
>
<div
class=
" col-md-6 mb-2"
>
<div
class=
" form-group"
>
<label>
หมวดหมู่
</label>
<br>
<select
class=
"form-select"
aria-label=
"Default select example"
[(
ngModel
)]="
modelEquirment
.
eqType
"
formControlName=
"eqType"
>
<option
selected
>
เลือกหมวดหมู่
</option>
<option
value=
"4"
>
IT
</option>
<option
value=
"5"
>
Company
</option>
</select>
<div
style=
"color: red;"
*
ngIf=
"myFormEquir.controls.eqType.status=='INVALID'"
>
Invalid
Equirment Type.
</div>
</div>
</div>
</div>
</div>
<div
class=
" row"
>
<div
class=
" col-md-12"
>
<div
class=
" form-group"
>
<label>
รายละเอียด
</label>
<textarea
class=
"form-control"
id=
"exampleFormControlTextarea1"
rows=
"3"
placeholder=
"......"
[(
ngModel
)]="
modelEquirment
.
eqDesc
"
></textarea>
<div
class=
" row"
>
<div
class=
" col-md-12"
>
<div
class=
" form-group"
>
<label>
รายละเอียด
</label>
<textarea
class=
"form-control"
id=
"exampleFormControlTextarea1"
rows=
"3"
placeholder=
"......"
[(
ngModel
)]="
modelEquirment
.
eqDesc
"
formControlName=
"eqDesc"
></textarea>
<div
style=
"color: red;"
*
ngIf=
"myFormEquir.controls.eqDesc.status=='INVALID'"
>
Invalid
Equirment Desc.
</div>
</div>
</div>
</div>
</div>
<label
for=
"exampleFormControlFile"
>
แนบไฟล์รูปภาพ
</label>
<input
type=
"file"
class=
"form-control-file"
id=
"exampleFormControlFile"
>
<label
for=
"exampleFormControlFile"
>
แนบไฟล์รูปภาพ
</label>
<input
type=
"file"
class=
"form-control-file"
id=
"exampleFormControlFile"
formControlName=
"eqPic"
>
</form>
</div>
<div
class=
" card-footer"
>
<button
class=
" btn btn-fill btn-danger"
type=
"submit"
(
click
)="
saveEquirment
()"
>
Save
</button>
<button
class=
" btn btn-fill btn-danger"
type=
"cancel"
...
...
@@ -181,42 +192,54 @@
<div
class=
" col-md-12"
style=
"padding: 0; "
>
<div
class=
"card"
style=
"margin: 0; "
>
<div
class=
" card-header"
>
<h5
class=
" title"
>
Add Equirment
</h5>
<h5
class=
" title"
>
เพิ่มรายการ
</h5>
</div>
<div
class=
" card-body"
>
<div
class=
" row"
>
<div
class=
" col-md-12"
>
<div
class=
" form-group"
>
<label>
ชื่อ
</label>
<input
class=
" form-control"
placeholder=
""
type=
"text"
[(
ngModel
)]="
modelRoom
.
rName
"
>
<form
[
formGroup
]="
myFormRoom
"
class=
"needs-validation"
>
<div
class=
" row"
>
<div
class=
" col-md-12"
>
<div
class=
" form-group"
>
<label>
ชื่อ
</label>
<input
class=
" form-control"
placeholder=
""
type=
"text"
[(
ngModel
)]="
modelRoom
.
rName
"
formControlName=
"rName"
>
<div
style=
"color: red;"
*
ngIf=
"myFormRoom.controls.rName.status=='INVALID'"
>
Invalid
Name.
</div>
</div>
</div>
</div>
</div>
<div
class=
" row"
>
<div
class=
" col-md-6 mb-2"
>
<div
class=
" form-group"
>
<label>
ประเภท
</label>
<br>
<select
class=
"form-select"
aria-label=
"Default select example"
[(
ngModel
)]="
modelRoom
.
rType
"
>
<option
selected
>
เลือกประเภท
</option>
<option
value=
"1"
>
ห้อง
</option>
<option
value=
"2"
>
รถ
</option>
</select>
<div
class=
" row"
>
<div
class=
" col-md-6 mb-2"
>
<div
class=
" form-group"
>
<label>
ประเภท
</label>
<br>
<select
class=
"form-select"
aria-label=
"Default select example"
[(
ngModel
)]="
modelRoom
.
rType
"
formControlName=
"rType"
>
<option
value=
"1"
>
ห้อง
</option>
<option
value=
"2"
>
รถ
</option>
</select>
<div
style=
"color: red;"
*
ngIf=
"myFormRoom.controls.rType.status=='INVALID'"
>
Invalid
Type.
</div>
</div>
</div>
</div>
</div>
<div
class=
" row"
>
<div
class=
" col-md-12"
>
<div
class=
" form-group"
>
<label>
รายละเอียด
</label>
<textarea
class=
"form-control"
id=
"exampleFormControlTextarea1"
rows=
"3"
placeholder=
"......"
[(
ngModel
)]="
modelRoom
.
rDesc
"
></textarea>
<div
class=
" row"
>
<div
class=
" col-md-12"
>
<div
class=
" form-group"
>
<label>
รายละเอียด
</label>
<textarea
class=
"form-control"
id=
"exampleFormControlTextarea1"
rows=
"3"
placeholder=
"......"
[(
ngModel
)]="
modelRoom
.
rDesc
"
formControlName=
"rDesc"
></textarea>
<div
style=
"color: red;"
*
ngIf=
"myFormRoom.controls.rDesc.status=='INVALID'"
>
Invalid
Desc.
</div>
</div>
</div>
</div>
</div
>
<label
for=
"exampleFormControlFile"
>
แนบไฟล์รูปภาพ
</label
>
<
input
type=
"file"
class=
"form-control-file"
id=
"exampleFormControlFile"
>
<label
for=
"exampleFormControlFile"
>
แนบไฟล์รูปภาพ
</label
>
<input
type=
"file"
class=
"form-control-file"
id=
"exampleFormControlFile"
>
<
/form
>
</div>
<div
class=
" card-footer"
>
<button
class=
" btn btn-fill btn-danger"
type=
"submit"
(
click
)="
saveRoom
()"
>
Save
</button>
...
...
src/app/pages/equipment/equipment.component.ts
View file @
12cd07db
...
...
@@ -59,8 +59,9 @@ export class EquipmentComponent implements OnInit {
userNameForm
:
new
FormControl
(
''
,[
Validators
.
required
]),
rTelephone
:
new
FormControl
(
''
,[
Validators
.
required
]),
email
:
new
FormControl
(
''
,[
Validators
.
required
,
Validators
.
email
]),
rName
:
new
FormControl
(),
rDesc
:
new
FormControl
(),
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
]),
...
...
@@ -73,6 +74,8 @@ export class EquipmentComponent implements OnInit {
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
]),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment