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
611001b8
Commit
611001b8
authored
Nov 25, 2021
by
Chanachai
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://mygit.myhr.co.th/chanachai.pmg.eng/BookingMyHrManagement
parents
ad22aac6
01383093
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
139 additions
and
19 deletions
+139
-19
pending.component.html
src/app/pages/pending/pending.component.html
+55
-3
pending.component.ts
src/app/pages/pending/pending.component.ts
+84
-16
No files found.
src/app/pages/pending/pending.component.html
View file @
611001b8
...
...
@@ -3,6 +3,54 @@
<div
class=
"col-sm-12"
>
<div
class=
"card"
>
<div
class=
"card-body"
>
<form
class=
"form-inline"
>
<div
class=
"form-group hidden"
>
<div
class=
"input-group"
>
<input
name=
"datepicker"
class=
"form-control"
ngbDatepicker
#
datepicker=
"ngbDatepicker"
[
autoClose
]="'
outside
'"
(
dateSelect
)="
onDateSelection
($
event
)"
[
displayMonths
]="
2
"
[
dayTemplate
]="
t
"
outsideDays=
"hidden"
[
startDate
]="
fromDate
!"
tabindex=
"-1"
>
<ng-template
#
t
let-date
let-focused=
"focused"
>
<span
class=
"custom-day"
[
class
.
focused
]="
focused
"
[
class
.
range
]="
isRange
(
date
)"
[
class
.
faded
]="
isHovered
(
date
)
||
isInside
(
date
)"
(
mouseenter
)="
hoveredDate =
date"
(
mouseleave
)="
hoveredDate =
null"
>
{{ date.day }}
</span>
</ng-template>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"input-group"
>
<input
#
dpFromDate
class=
"form-control"
placeholder=
"yyyy-mm-dd"
name=
"dpFromDate"
[
value
]="
formatter
.
format
(
fromDate
)"
(
input
)="
fromDate =
validateInput(fromDate,
dpFromDate
.
value
)"
>
<div
class=
"input-group-append"
>
<button
class=
"btn btn-outline-secondary calendar"
(
click
)="
datepicker
.
toggle
()"
type=
"button"
></button>
</div>
</div>
</div>
<div
class=
"form-group ml-2"
>
<div
class=
"input-group"
>
<input
#
dpToDate
class=
"form-control"
placeholder=
"yyyy-mm-dd"
name=
"dpToDate"
[
value
]="
formatter
.
format
(
toDate
)"
(
input
)="
toDate =
validateInput(toDate,
dpToDate
.
value
)"
>
<div
class=
"input-group-append"
>
<button
class=
"btn btn-outline-secondary calendar"
(
click
)="
datepicker
.
toggle
()"
type=
"button"
></button>
</div>
</div>
</div>
<input
class=
"form-control"
type=
"search"
placeholder=
"Search"
aria-label=
"Search"
>
<button
class=
"btn btn-outline-success"
type=
"submit"
>
Search
</button>
</form>
</div>
</div>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-sm-12"
>
<div
class=
"card"
>
<div
class=
"card-body"
>
<table
class=
"table table-striped"
>
<thead>
<tr>
...
...
@@ -11,14 +59,17 @@
<th
scope=
"col"
>
Name
</th>
<th
scope=
"col"
>
Start-Date
</th>
<th
scope=
"col"
>
End-Date
</th>
<th
scope=
"col"
>
Status
</th>
</tr>
</thead>
<tbody>
<tr
*
ngFor=
"let country of countries"
>
<th
scope=
"row"
>
{{ country.id }}
</th>
<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>
{{ country.sdate | date:'dd-MM-yyyy' }}
</td>
<td>
{{ country.edate | date:'dd-MM-yyyy' }}
</td>
<td>
{{ country.status }}
</td>
</tr>
</tbody>
</table>
...
...
@@ -35,9 +86,9 @@
<option
[
ngValue
]="
100
"
>
100 items per page
</option>
</select>
</div>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
src/app/pages/pending/pending.component.ts
View file @
611001b8
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
NgbDate
,
NgbCalendar
,
NgbDateParserFormatter
}
from
'@ng-bootstrap/ng-bootstrap'
;
interface
Country
{
id
?:
number
;
equip
:
string
;
detail
:
string
;
name
:
string
;
sdate
:
string
;
edate
:
string
;
status
:
string
;
}
const
COUNTRIES
:
Country
[]
=
[
{
equip
:
'string'
,
name
:
'ray'
,
sdate
:
'string'
,
edate
:
'string'
}
];
@
Component
({
selector
:
'app-pending'
,
templateUrl
:
'./pending.component.html'
,
styleUrls
:
[
'./pending.component.scss'
]
styleUrls
:
[
'./pending.component.scss'
],
styles
:
[
`
.form-group.hidden {
width: 0;
margin: 0;
border: none;
padding: 0;
}
.custom-day {
text-align: center;
padding: 0.185rem 0.25rem;
display: inline-block;
height: 2rem;
width: 2rem;
}
.custom-day.focused {
background-color: #e6e6e6;
}
.custom-day.range, .custom-day:hover {
background-color: rgb(2, 117, 216);
color: white;
}
.custom-day.faded {
background-color: rgba(2, 117, 216, 0.5);
}
`
]
})
export
class
PendingComponent
implements
OnInit
{
page
=
1
;
pageSize
=
10
;
collectionSize
=
COUNTRIES
.
length
;
countries
:
Country
[];
constructor
()
{
countries
:
Country
[]
=
[
{
detail
:
'Moniter'
,
name
:
'a'
,
sdate
:
'2021-11-25'
,
edate
:
'2021-11-25'
,
status
:
'waiting'
,
},
{
detail
:
'Mouse'
,
name
:
'b'
,
sdate
:
'2021-11-25'
,
edate
:
'2021-11-25'
,
status
:
'waiting'
,
}
];
collectionSize
=
this
.
countries
.
length
;
hoveredDate
:
NgbDate
|
null
=
null
;
fromDate
:
NgbDate
|
null
;
toDate
:
NgbDate
|
null
;
constructor
(
private
calendar
:
NgbCalendar
,
public
formatter
:
NgbDateParserFormatter
)
{
this
.
fromDate
=
calendar
.
getToday
();
this
.
toDate
=
calendar
.
getNext
(
calendar
.
getToday
(),
'd'
,
10
);
this
.
refreshCountries
();
}
refreshCountries
()
{
this
.
countries
=
COUNTRIES
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
;
}
else
if
(
this
.
fromDate
&&
!
this
.
toDate
&&
date
&&
date
.
after
(
this
.
fromDate
))
{
this
.
toDate
=
date
;
}
else
{
this
.
toDate
=
null
;
this
.
fromDate
=
date
;
}
}
isHovered
(
date
:
NgbDate
)
{
return
this
.
fromDate
&&
!
this
.
toDate
&&
this
.
hoveredDate
&&
date
.
after
(
this
.
fromDate
)
&&
date
.
before
(
this
.
hoveredDate
);
}
isInside
(
date
:
NgbDate
)
{
return
this
.
toDate
&&
date
.
after
(
this
.
fromDate
)
&&
date
.
before
(
this
.
toDate
);
}
isRange
(
date
:
NgbDate
)
{
return
date
.
equals
(
this
.
fromDate
)
||
(
this
.
toDate
&&
date
.
equals
(
this
.
toDate
))
||
this
.
isInside
(
date
)
||
this
.
isHovered
(
date
);
}
validateInput
(
currentValue
:
NgbDate
|
null
,
input
:
string
):
NgbDate
|
null
{
const
parsed
=
this
.
formatter
.
parse
(
input
);
return
parsed
&&
this
.
calendar
.
isValid
(
NgbDate
.
from
(
parsed
))
?
NgbDate
.
from
(
parsed
)
:
currentValue
;
}
ngOnInit
():
void
{
}
...
...
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