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
31cfe643
Commit
31cfe643
authored
Dec 02, 2021
by
DESKTOP-HF0LVOG\myhr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add เพิ่มรายการ หน้าการจอง
parent
186fb8d6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
158 additions
and
119 deletions
+158
-119
equipment.component.html
src/app/pages/equipment/equipment.component.html
+17
-17
equipment.component.ts
src/app/pages/equipment/equipment.component.ts
+34
-10
equirment.service.ts
src/app/service/equirment.service.ts
+88
-79
room.service.ts
src/app/service/room.service.ts
+19
-13
No files found.
src/app/pages/equipment/equipment.component.html
View file @
31cfe643
...
...
@@ -20,7 +20,7 @@
<div
class=
"card-body"
>
<button
class=
"btn btn-lg btn-outline-primary"
(
click
)="
open
(
content
)"
>
เพิ่มรายการ
</button>
(
click
)="
R
open
(
content
)"
>
เพิ่มรายการ
</button>
<div
class=
"row"
>
<div
class=
"col-sm-3"
*
ngFor=
"let item of listRoomModel"
>
...
...
@@ -28,11 +28,11 @@
padding: 10px;"
>
<div
class=
"card-body"
>
<img
style=
"height: 200px;
width: 200px;"
[
src
]="
item
.
r
p
ic
"
class=
"nav justify-content-center"
width: 200px;"
[
src
]="
item
.
r
P
ic
"
class=
"nav justify-content-center"
alt=
"..."
>
<br>
<p
class=
"text-left"
>
ชื่อ : {{item.r
n
ame}}
</p>
<p
class=
"text-left"
>
รายละเอียด : {{item.r
d
esc}}
</p>
<p
class=
"text-left"
>
ชื่อ : {{item.r
N
ame}}
</p>
<p
class=
"text-left"
>
รายละเอียด : {{item.r
D
esc}}
</p>
</div>
<div
class=
"text-center"
>
...
...
@@ -119,27 +119,27 @@
</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"
>
Cancel
</button>
<button
class=
" btn btn-fill btn-danger"
type=
"cancel"
(
click
)="
modal
.
dismiss
('
Cross
click
')"
>
Cancel
</button>
</div>
</div>
</div>
</ng-template>
<button
class=
"btn btn-lg btn-outline-primary"
(
click
)="
open
(
content
)"
>
เพิ่มรายการ
</button>
(
click
)="
Eq
open
(
content
)"
>
เพิ่มรายการ
</button>
<div
class=
"row"
>
<div
class=
"col-sm-3"
*
ngFor=
"let item of listEquirment"
>
<div
class=
"col-sm-3"
*
ngFor=
"let item of listEquirment
Model
"
>
<div
class=
"card"
style=
"
padding: 10px;"
>
<div
class=
"card-body"
>
<img
style=
"height: 200px;
width: 200px;"
[
src
]="
item
.
p
ic
"
class=
"nav justify-content-center"
width: 200px;"
[
src
]="
item
.
eqP
ic
"
class=
"nav justify-content-center"
alt=
"..."
>
<br>
<p
class=
"text-left"
>
ชื่อ : {{item.eq
n
ame}}
</p>
<p
class=
"text-left"
>
รายละเอียด : {{item.eq
d
esc}}
</p>
<p
class=
"text-left"
>
ประเภท : {{item.eq
t
ype}}
</p>
<p
class=
"text-left"
>
ชื่อ : {{item.eq
N
ame}}
</p>
<p
class=
"text-left"
>
รายละเอียด : {{item.eq
D
esc}}
</p>
<p
class=
"text-left"
>
ประเภท : {{item.eq
T
ype}}
</p>
</div>
<div
class=
"text-center"
>
...
...
@@ -188,7 +188,7 @@
<div
class=
" col-md-12"
>
<div
class=
" form-group"
>
<label>
ชื่อ
</label>
<input
class=
" form-control"
placeholder=
""
type=
"text"
[(
ngModel
)]="
modelRoom
.
rName
"
value=
""
/
>
<input
class=
" form-control"
placeholder=
""
type=
"text"
[(
ngModel
)]="
modelRoom
.
rName
"
>
</div>
</div>
</div>
...
...
@@ -220,7 +220,7 @@
</div>
<div
class=
" card-footer"
>
<button
class=
" btn btn-fill btn-danger"
type=
"submit"
(
click
)="
saveRoom
()"
>
Save
</button>
<button
class=
" btn btn-fill btn-danger"
type=
"cancel"
>
Cancel
</button>
<button
class=
" btn btn-fill btn-danger"
type=
"cancel"
(
click
)="
modal
.
dismiss
('
Cross
click
')"
>
Cancel
</button>
</div>
</div>
</div>
...
...
@@ -253,13 +253,13 @@
<div
class=
"row"
>
<div
class=
"col-sm-12 mb-1"
>
<label
for=
"exampleFormControlSelect1"
>
ชื่อห้อง
</label>
<input
readonly
class=
"form-control"
type=
"text"
value=
"{{item.r
n
ame}}"
>
<input
readonly
class=
"form-control"
type=
"text"
value=
"{{item.r
N
ame}}"
>
</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.r
d
ecs}}"
>
<input
readonly
class=
"form-control"
type=
"text"
value=
"{{item.r
D
ecs}}"
>
</div>
</div>
<div
class=
"row"
>
...
...
@@ -328,13 +328,13 @@
<div
class=
"row"
>
<div
class=
"col-sm-12 mb-1"
>
<label
for=
"exampleFormControlSelect1"
>
ชื่ออุปกรณ์
</label>
<input
readonly
class=
"form-control"
type=
"text"
value=
"{{item.r
n
ame}}"
>
<input
readonly
class=
"form-control"
type=
"text"
value=
"{{item.r
N
ame}}"
>
</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.r
d
ecs}}"
>
<input
readonly
class=
"form-control"
type=
"text"
value=
"{{item.r
D
ecs}}"
>
</div>
</div>
<div
class=
"row"
>
...
...
src/app/pages/equipment/equipment.component.ts
View file @
31cfe643
...
...
@@ -2,6 +2,9 @@ import { Component, OnInit } from '@angular/core';
import
{
NgbModal
,
ModalDismissReasons
}
from
'@ng-bootstrap/ng-bootstrap'
;
import
{
Equirment
}
from
'src/app/models/equirment.model'
;
import
{
Room
}
from
'src/app/models/rooms.model'
;
import
{
EquirmentService
}
from
'src/app/service/equirment.service'
;
import
{
RoomService
}
from
'src/app/service/room.service'
;
@
Component
({
selector
:
'app-equipment'
,
...
...
@@ -9,22 +12,28 @@ import { Room } from 'src/app/models/rooms.model';
styleUrls
:
[
'./equipment.component.scss'
]
})
export
class
EquipmentComponent
implements
OnInit
{
time
=
{
hour
:
13
,
minute
:
30
};
time
=
{
hour
:
13
,
minute
:
30
};
page
=
1
;
pageSize
=
10
;
closeResult
=
''
;
listEquirmentModel
:
Equirment
[]
=
[];
listRoomModel
:
Room
[]
=
[];
collectionSize
=
this
.
listEquirmentModel
.
length
;
modelEquirment
=
new
Equirment
();
modelRoom
=
new
Room
();
constructor
(
private
modalService
:
NgbModal
)
{
}
constructor
(
private
modalService
:
NgbModal
,
private
equirmentService
:
EquirmentService
,
private
roomService
:
RoomService
)
{
}
ngOnInit
():
void
{
ngOnInit
()
{
this
.
listEquirmentModel
=
this
.
equirmentService
.
getListEquirment
();
this
.
listRoomModel
=
this
.
roomService
.
getListRoom
();
}
open
(
content
)
{
Eqopen
(
content
)
{
this
.
modelEquirment
=
new
Equirment
();
this
.
modalService
.
open
(
content
,
{
ariaLabelledBy
:
'modal-basic-title'
}).
result
.
then
((
result
)
=>
{
this
.
closeResult
=
`Closed with:
${
result
}
`
;
},
(
reason
)
=>
{
...
...
@@ -32,6 +41,16 @@ export class EquipmentComponent implements OnInit {
});
}
Ropen
(
content
)
{
this
.
modelRoom
=
new
Room
();
this
.
modalService
.
open
(
content
,
{
ariaLabelledBy
:
'modal-basic-title'
}).
result
.
then
((
result
)
=>
{
this
.
closeResult
=
`Closed with:
${
result
}
`
;
},
(
reason
)
=>
{
this
.
closeResult
=
`Dismissed
${
this
.
getDismissReason
(
reason
)}
`
;
});
}
private
getDismissReason
(
reason
:
any
):
string
{
if
(
reason
===
ModalDismissReasons
.
ESC
)
{
return
'by pressing ESC'
;
...
...
@@ -43,23 +62,28 @@ export class EquipmentComponent implements OnInit {
}
refreshCountries
()
{
this
.
listEquirmentModel
=
this
.
listEquirmentModel
this
.
listRoomModel
=
this
.
listRoomModel
.
map
((
item
,
i
)
=>
({
id
:
i
+
1
,
...
item
}))
.
slice
((
this
.
page
-
1
)
*
this
.
pageSize
,
(
this
.
page
-
1
)
*
this
.
pageSize
+
this
.
pageSize
);
}
NgbdTimepickerBasic
()
{
}
saveEquirment
(){
console
.
log
(
this
.
modelEquirment
);
saveEquirment
()
{
this
.
equirmentService
.
addEquirment
(
this
.
modelEquirment
);
this
.
modalService
.
dismissAll
();
this
.
ngOnInit
();
}
saveRoom
(){
saveRoom
()
{
console
.
log
(
this
.
modelRoom
);
this
.
roomService
.
addRoom
(
this
.
modelRoom
);
this
.
modalService
.
dismissAll
();
this
.
ngOnInit
();
}
}
...
...
src/app/service/equirment.service.ts
View file @
31cfe643
...
...
@@ -5,85 +5,93 @@ import { Equirment, SearchEquirmentModel } from '../models/equirment.model';
@
Injectable
({
providedIn
:
'root'
})
export
class
EquirmentService
{
constructor
(
private
http
:
HttpClient
)
{
}
url
:
string
;
listEquirment
:
Equirment
[]
=
[
{
eqId
:
1
,
eqName
:
"จอคอมพิวเตอร์"
,
eqDesc
:
"หน้าจอขนาด 22 นิ้ว"
,
eqType
:
"it"
,
eqPic
:
"assets/img/mo1.jpg"
},
{
eqId
:
2
,
eqName
:
"เมาส์"
,
eqDesc
:
"..."
,
eqType
:
"it"
,
eqPic
:
"assets/img/mou.jpg"
},
{
eqId
:
3
,
eqName
:
"โน๊ตบุ๊ค"
,
eqDesc
:
"หน้าจอขนาด 20 นิ้ว"
,
eqType
:
"it"
,
eqPic
:
"assets/img/notebook.jpg"
},
{
eqId
:
4
,
eqName
:
"คีย์บอร์ด"
,
eqDesc
:
"..."
,
eqType
:
"it"
,
eqPic
:
"assets/img/keyboard.png"
}
]
listEquirmentModel
:
Equirment
[]
=
[];
constructor
(
private
http
:
HttpClient
)
{
}
url
:
string
;
listEquirment
:
Equirment
[]
=
[
{
eqId
:
1
,
eqName
:
"จอคอมพิวเตอร์"
,
eqDesc
:
"หน้าจอขนาด 22 นิ้ว"
,
eqType
:
"it"
,
eqPic
:
"assets/img/mo1.jpg"
},
{
eqId
:
2
,
eqName
:
"เมาส์"
,
eqDesc
:
"..."
,
eqType
:
"it"
,
eqPic
:
"assets/img/mou.jpg"
},
{
eqId
:
3
,
eqName
:
"โน๊ตบุ๊ค"
,
eqDesc
:
"หน้าจอขนาด 20 นิ้ว"
,
eqType
:
"it"
,
eqPic
:
"assets/img/notebook.jpg"
},
{
eqId
:
4
,
eqName
:
"คีย์บอร์ด"
,
eqDesc
:
"..."
,
eqType
:
"it"
,
eqPic
:
"assets/img/keyboard.png"
}
]
getListRoom
()
{
this
.
http
.
get
(
this
.
url
).
subscribe
((
response
:
any
)
=>
{
console
.
log
(
response
);
this
.
listEquirmentModel
=
response
.
content
;
},
error
=>
{
console
.
log
(
error
)
// alert("ไม่สามารถดึงข้อมูลห้องประชุมได้ เนื่องจาก :\n" + error.message)
})
}
searchListRoom
(
searchModel
:
SearchEquirmentModel
)
{
this
.
http
.
get
(
this
.
url
+
'&startDate='
+
searchModel
.
sdate
.
split
(
"-"
)[
2
]
+
'-'
+
searchModel
.
sdate
.
split
(
"-"
)[
1
]
+
'-'
+
searchModel
.
sdate
.
split
(
"-"
)[
0
]
+
'&endDate='
+
searchModel
.
edate
.
split
(
"-"
)[
2
]
+
'-'
+
searchModel
.
edate
.
split
(
"-"
)[
1
]
+
'-'
+
searchModel
.
edate
.
split
(
"-"
)[
0
]
+
'&startTime='
+
searchModel
.
stime
+
':00'
+
'&endTime='
+
searchModel
.
etime
+
':00'
).
subscribe
((
response
:
any
)
=>
{
console
.
log
(
response
);
this
.
listEquirmentModel
=
response
;
},
error
=>
{
console
.
log
(
error
)
alert
(
"ไม่สามารถค้นหาอุปกรณ์ที่ว่างได้ เนื่องจาก :
\
n"
+
error
.
message
)
})
}
addRoom
(
EquirmentModel
:
Equirment
)
{
this
.
http
.
post
(
this
.
url
,
EquirmentModel
).
subscribe
(
response
=>
{
console
.
log
(
response
);
})
}
deleteRoom
(
EquirmentModel
:
Equirment
)
{
this
.
http
.
delete
(
this
.
url
+
"/"
+
EquirmentModel
.
eqId
).
subscribe
(
response
=>
{
console
.
log
(
response
);
this
.
getListRoom
()
alert
(
"ลบข้อมูลอุปกรณ์สำเร็จ"
)
})
}
updateRoom
(
EquirmentModel
:
Equirment
)
{
this
.
http
.
put
(
this
.
url
+
"/"
+
EquirmentModel
.
eqId
,
EquirmentModel
).
subscribe
(
response
=>
{
console
.
log
(
response
);
alert
(
"อัพเดทข้อมูลอุปกรณ์สำเร็จ"
)
})
}
EquirmentModel
(
eqId
:
string
)
{
}
addEquirment
(
model
:
Equirment
)
{
this
.
listEquirment
.
push
(
model
);
}
getListEquirment
()
{
return
this
.
listEquirment
;
}
getListRoom
()
{
this
.
http
.
get
(
this
.
url
).
subscribe
((
response
:
any
)
=>
{
console
.
log
(
response
);
this
.
listEquirment
=
response
.
content
;
},
error
=>
{
console
.
log
(
error
)
// alert("ไม่สามารถดึงข้อมูลห้องประชุมได้ เนื่องจาก :\n" + error.message)
})
}
searchListEquirment
(
searchModel
:
SearchEquirmentModel
)
{
this
.
http
.
get
(
this
.
url
+
'&startDate='
+
searchModel
.
sdate
.
split
(
"-"
)[
2
]
+
'-'
+
searchModel
.
sdate
.
split
(
"-"
)[
1
]
+
'-'
+
searchModel
.
sdate
.
split
(
"-"
)[
0
]
+
'&endDate='
+
searchModel
.
edate
.
split
(
"-"
)[
2
]
+
'-'
+
searchModel
.
edate
.
split
(
"-"
)[
1
]
+
'-'
+
searchModel
.
edate
.
split
(
"-"
)[
0
]
+
'&startTime='
+
searchModel
.
stime
+
':00'
+
'&endTime='
+
searchModel
.
etime
+
':00'
).
subscribe
((
response
:
any
)
=>
{
console
.
log
(
response
);
this
.
listEquirment
=
response
;
},
error
=>
{
console
.
log
(
error
)
alert
(
"ไม่สามารถค้นหาอุปกรณ์ที่ว่างได้ เนื่องจาก :
\
n"
+
error
.
message
)
})
}
// addEquirment(EquirmentModel: Equirment) {
// this.http.post(this.url, EquirmentModel).subscribe(response => {
// console.log(response);
// })
// }
deleteEquirment
(
EquirmentModel
:
Equirment
)
{
this
.
http
.
delete
(
this
.
url
+
"/"
+
EquirmentModel
.
eqId
).
subscribe
(
response
=>
{
console
.
log
(
response
);
this
.
getListRoom
()
alert
(
"ลบข้อมูลอุปกรณ์สำเร็จ"
)
})
}
updateEquirment
(
EquirmentModel
:
Equirment
)
{
this
.
http
.
put
(
this
.
url
+
"/"
+
EquirmentModel
.
eqId
,
EquirmentModel
).
subscribe
(
response
=>
{
console
.
log
(
response
);
alert
(
"อัพเดทข้อมูลอุปกรณ์สำเร็จ"
)
})
}
EquirmentModel
(
eqId
:
string
)
{
}
}
\ No newline at end of file
src/app/service/room.service.ts
View file @
31cfe643
...
...
@@ -44,14 +44,20 @@ export class RoomService {
]
listRoomSearch
:
Room
[]
=
[];
addRoom
(
model
:
Room
){
this
.
listRoomModel
.
push
(
model
);
}
getListRoom
()
{
this
.
http
.
get
(
this
.
url
).
subscribe
((
response
:
any
)
=>
{
console
.
log
(
response
);
this
.
listRoomModel
=
response
.
content
;
},
error
=>
{
console
.
log
(
error
)
// alert("ไม่สามารถดึงข้อมูลห้องประชุมได้ เนื่องจาก :\n" + error.message)
})
return
this
.
listRoomModel
;
// this.http.get(this.url).subscribe((response: any) => {
// console.log(response);
// this.listRoomModel = response.content;
// }, error => {
// console.log(error)
// // alert("ไม่สามารถดึงข้อมูลห้องประชุมได้ เนื่องจาก :\n" + error.message)
// })
}
searchListRoom
(
searchModel
:
SearchRoomModel
)
{
...
...
@@ -64,14 +70,14 @@ export class RoomService {
})
}
addRoom
(
roomModel
:
Room
)
{
this
.
http
.
post
(
this
.
url
,
roomModel
).
subscribe
(
response
=>
{
console
.
log
(
response
);
// //
addRoom(roomModel: Room) {
// //
this.http.post(this.url, roomModel).subscribe(response => {
// //
console.log(response);
})
// // })
// }
}
deleteRoom
(
roomModel
:
Room
)
{
this
.
http
.
delete
(
this
.
url
+
"/"
+
roomModel
.
rId
).
subscribe
(
response
=>
{
console
.
log
(
response
);
...
...
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