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
de605352
Commit
de605352
authored
Dec 16, 2021
by
DESKTOP-HF0LVOG\myhr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update calendar
parent
e31a1e11
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
41 deletions
+72
-41
app.component.ts
src/app/app.component.ts
+2
-0
home-page.component.ts
src/app/pages/home-page/home-page.component.ts
+70
-41
No files found.
src/app/app.component.ts
View file @
de605352
...
...
@@ -7,4 +7,5 @@ import { Component } from "@angular/core";
})
export
class
AppComponent
{
title
=
"BookingManagement"
;
}
\ No newline at end of file
src/app/pages/home-page/home-page.component.ts
View file @
de605352
import
{
Component
,
OnInit
,
ViewChild
}
from
'@angular/core'
;
import
{
FullCalendarComponent
,
CalendarOptions
}
from
'@fullcalendar/angular'
;
import
{
NgbDate
,
NgbCalendar
,
NgbDateParserFormatter
,
NgbNavChangeEvent
}
from
'@ng-bootstrap/ng-bootstrap'
;
interface
Country
{
id
?:
number
;
catagory
:
string
;
type
:
string
;
detail
:
string
;
name
:
string
;
sdate
:
string
;
edate
:
string
;
status
:
string
;
}
import
{
Equirment
}
from
'src/app/models/equirment.model'
;
import
{
ItemDetail
}
from
'src/app/models/itemDetail.model'
;
import
{
RoomDetailService
}
from
'src/app/service/room-detail.service'
;
import
{
ItemDetailService
}
from
'src/app/service/item-detail.service'
;
import
{
MyRoom
}
from
'src/app/models/rooms.model'
;
import
{
EquirmentService
}
from
'src/app/service/equirment.service'
;
import
{
RoomService
}
from
'src/app/service/room.service'
;
import
{
RoomDetail
}
from
'src/app/models/RoomDetail.model'
;
@
Component
({
selector
:
'app-home-page'
,
...
...
@@ -52,51 +49,79 @@ export class HomePageComponent implements OnInit {
pageSize
=
10
;
@
ViewChild
(
'calendarBook'
)
calendarBook
:
FullCalendarComponent
listItemDetail
:
ItemDetail
[]
=
[];
listRoomDetail
:
RoomDetail
[]
=
[];
modelEquirment
=
new
Equirment
();
modelRoom
=
new
MyRoom
();
modelItemDetail
=
new
ItemDetail
();
modelRoomDetail
=
new
RoomDetail
();
hoveredDate
:
NgbDate
|
null
=
null
;
fromDate
:
NgbDate
|
null
;
toDate
:
NgbDate
|
null
;
countries
:
Country
[]
=
[
{
catagory
:
'string'
,
type
:
'string'
,
detail
:
'Moniter'
,
name
:
'a'
,
sdate
:
'2021-11-25'
,
edate
:
'2021-11-25'
,
status
:
'waiting'
,
},
{
catagory
:
'string'
,
type
:
'string'
,
detail
:
'Mouse'
,
name
:
'b'
,
sdate
:
'2021-11-25'
,
edate
:
'2021-11-25'
,
status
:
'waiting'
,
}
];
calendarOptions
:
CalendarOptions
;
showBook
=
false
;
calendarOptions
:
CalendarOptions
=
{
initialView
:
'dayGridMonth'
,
dateClick
:
this
.
handleDateClick
.
bind
(
this
),
// bind is important!
locale
:
"th"
,
events
:
[
{
id
:
'1'
,
title
:
'ห้องเดียว'
,
start
:
'2021-12-16T10:30:00'
,
end
:
'2021-12-16T11:30:00'
,
extendedProps
:
{
Id
:
1
,
room
:
{
rId
:
1
,
rName
:
"ห้องเดียว"
,
rType
:
"ห้อง"
,
rPic
:
"assets/img/room.jpg"
,
roomLimit
:
25
,
rDesc
:
"จำนวนคน 25 คน"
,
},
userName
:
'เกม'
,
sDate
:
'2021/12/15'
,
eDate
:
'2021/12/15'
,
sTime
:
'22:30'
,
eTime
:
'22:30'
,
rStatus
:
0
,
rTelephone
:
'0123456789'
,
email
:
'qwerty@qwerty'
,
Remark
:
'test'
,
},
description
:
'เกมส์ (0123456789)'
,
color
:
'rgb(900,0,0)'
,
}
]
};
handleDateClick
(
arg
)
{
alert
(
'date click! '
+
arg
.
dateStr
)
}
constructor
(
private
calendar
:
NgbCalendar
,
public
formatter
:
NgbDateParserFormatter
)
{
dateKub
()
{
return
this
.
listRoomDetail
.
length
}
toggleWeekends
()
{
this
.
calendarOptions
.
weekends
=
!
this
.
calendarOptions
.
weekends
// toggle the boolean!
}
constructor
(
private
calendar
:
NgbCalendar
,
public
formatter
:
NgbDateParserFormatter
,
private
ItemDetailService
:
ItemDetailService
,
private
RoomDetailService
:
RoomDetailService
,
private
equirmentService
:
EquirmentService
,
private
roomService
:
RoomService
)
{
this
.
fromDate
=
calendar
.
getToday
();
this
.
toDate
=
calendar
.
getNext
(
calendar
.
getToday
(),
'd'
,
10
);
this
.
refreshCountries
();
}
refreshCountries
()
{
this
.
countries
=
this
.
countries
.
map
((
country
,
i
)
=>
({
id
:
i
+
1
,
...
country
}))
.
slice
((
this
.
page
-
1
)
*
this
.
pageSize
,
(
this
.
page
-
1
)
*
this
.
pageSize
+
this
.
pageSize
);
}
onDateSelection
(
date
:
NgbDate
)
{
if
(
!
this
.
fromDate
&&
!
this
.
toDate
)
{
this
.
fromDate
=
date
;
...
...
@@ -129,16 +154,20 @@ export class HomePageComponent implements OnInit {
setTimeout
(
function
()
{
window
.
dispatchEvent
(
new
Event
(
'resize'
))
},
1
)
this
.
listItemDetail
=
this
.
ItemDetailService
.
getListItemDetail
();
this
.
listRoomDetail
=
this
.
RoomDetailService
.
getListRoomDetail
();
}
onNavChange
(
changeEvent
:
NgbNavChangeEvent
)
{
setTimeout
(
function
()
{
window
.
dispatchEvent
(
new
Event
(
'resize'
))
},
250
);
},
250
);
}
}
export
class
NgbdDropdownBasic
{
...
...
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