Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
myAppraisal
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
angular
myAppraisal
Commits
c86e6a62
Commit
c86e6a62
authored
Dec 04, 2024
by
Natthaphat Pankiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
api กลุ่มพนักงาน
parent
b1c90c4b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
201 additions
and
24 deletions
+201
-24
dashboard.module.ts
src/app/components/dashboard/dashboard.module.ts
+2
-1
employee-group-unit.component.html
...on/employee-group-unit/employee-group-unit.component.html
+86
-21
employee-group-unit.component.ts
...tion/employee-group-unit/employee-group-unit.component.ts
+59
-2
emp_group.model.ts
src/app/shared/model/emp_group.model.ts
+21
-0
emp_group.service.ts
src/app/shared/services/emp_group.service.ts
+33
-0
No files found.
src/app/components/dashboard/dashboard.module.ts
View file @
c86e6a62
...
...
@@ -47,6 +47,7 @@ import { Bu4Service } from 'src/app/shared/services/bu4.service';
import
{
Bu5Service
}
from
'src/app/shared/services/bu5.service'
;
import
{
Bu6Service
}
from
'src/app/shared/services/bu6.service'
;
import
{
Bu7Service
}
from
'src/app/shared/services/bu7.service'
;
import
{
EmpGroupService
}
from
'src/app/shared/services/emp_group.service'
;
@
NgModule
({
declarations
:
[
...
...
@@ -94,7 +95,7 @@ import { Bu7Service } from 'src/app/shared/services/bu7.service';
HttpClientModule
,
FormsModule
],
providers
:
[
Bu1Service
,
Bu2Service
,
Bu3Service
,
Bu4Service
,
Bu5Service
,
Bu6Service
,
Bu7Service
,{
providers
:
[
Bu1Service
,
Bu2Service
,
Bu3Service
,
Bu4Service
,
Bu5Service
,
Bu6Service
,
Bu7Service
,
EmpGroupService
,
{
provide
:
HTTP_INTERCEPTORS
,
useClass
:
HttpRequestInterceptor
,
multi
:
true
,
...
...
src/app/components/job-description/employee-group-unit/employee-group-unit.component.html
View file @
c86e6a62
...
...
@@ -2,7 +2,8 @@
<div
class=
"px-1"
>
<div
class=
"relative shadow-md"
>
<input
type=
"text"
id=
"hs-leading-icon"
name=
"hs-leading-icon"
class=
"ti-form-input ltr:pl-11 rtl:pr-11 focus:z-10 "
placeholder=
"Search by No. or Name"
>
class=
"ti-form-input ltr:pl-11 rtl:pr-11 focus:z-10 "
placeholder=
"Search by No. or Name"
[(
ngModel
)]="
search
"
(
ngModelChange
)="
searchChange
()"
>
<div
class=
"absolute inset-y-0 ltr:left-0 rtl:right-0 flex items-center pointer-events-none z-20 ltr:pl-4 rtl:pr-4"
>
<i
class=
"ri-search-line text-gray"
></i>
...
...
@@ -65,29 +66,54 @@
</ng-container>
</tr>
</thead>
<tbody>
<tr
*
ngFor=
"let item of[
['PG005', 'Chair Man', 'Chair Man'],
['PG004', 'Managing Director', 'Managing Director'],
['PG003', 'Sr.Director', 'Sr.Director'],
['PG002', 'General Manager', 'General Manager'],
['PG001', 'Manager', 'Manager'],
['RG005', 'Suoervisor', 'Suoervisor'],
['RG004', 'Leader', 'Leader']];let i = index"
>
<td
style=
"font-size: 12px;"
class=
"flex justify-center"
>
<tbody
*
ngIf=
"!emp_groupListFilter().length"
>
<tr>
<td
class=
"text-center"
colspan=
"100%"
>
ไม่พบข้อมูล
</td>
</tr>
</tbody>
<tbody
*
ngIf=
"emp_groupListFilter().length"
>
<tr
*
ngFor=
"let item of emp_groupListFilter() | slice:((currentPage-1) * 10) : (((currentPage-1) * 10) + 10);let i = index"
>
<td
class=
"flex justify-center"
>
<input
type=
"checkbox"
style=
"margin-right: 20px; transform:scale(0.7)"
>
{{item
[0]
}}
{{item
.groupId
}}
</td>
<td
style=
"text-align: center; font-size: 12px;"
>
{{item[1]
}}
</td>
<td
style=
"text-align: center; font-size: 12px;"
>
{{item[2]
}}
</td>
<td
class=
"text-center"
>
{{item.tdesc
}}
</td>
<td
class=
"text-center"
>
{{item.edesc
}}
</td>
<td
class=
"flex justify-center"
>
<i
class=
"ti ti-edit cursor-pointer i-gray fs-l px-1"
data-hs-overlay=
"#employee-group-unit-component-modal-edit"
></i>
<i
class=
"ti ti-trash cursor-pointer i-gray fs-l px-1"
></i>
<i
class=
"ti ti-edit cursor-pointer i-gray fs-l px-1"
(
click
)="
selectEmp_group
(
item
)"
data-hs-overlay=
"#employee-group-unit-component-modal-edit"
></i>
<i
class=
"ti ti-trash cursor-pointer i-gray fs-l px-1"
(
click
)="
deleteEmp_group
(
item
)"
></i>
</td>
</tr>
</tbody>
</table>
</div>
<nav
class=
"pagination-style-3 overflow-auto my-5"
*
ngIf=
"page.length"
>
<ul
class=
"ti-pagination"
>
<li>
<a
aria-label=
"anchor"
class=
"page-link"
href=
"javascript:void(0);"
(
click
)="
currentPage =
(currentPage-1
||
1
)"
>
<i
class=
"ri-arrow-left-s-line align-middle rtl:rotate-180"
></i>
</a>
</li>
<li
*
ngFor=
"let item of page"
>
<a
class=
"page-link"
href=
"javascript:void(0);"
[
class
.
active
]="
item=
=currentPage"
(
click
)="
currentPage=
item"
>
{{item}}
</a>
<!-- <a aria-label="anchor" class="page-link" href="javascript:void(0);"><i class="ri-more-line"></i>
</a> -->
</li>
<li>
<a
aria-label=
"anchor"
class=
"page-link"
href=
"javascript:void(0);"
(
click
)="
currentPage =
(currentPage
>
page.length-1 ? currentPage: currentPage+1 )">
<i
class=
"ri-arrow-right-s-line align-middle rtl:rotate-180"
></i>
</a>
</li>
</ul>
</nav>
</div>
</div>
...
...
@@ -144,7 +170,8 @@
data-hs-overlay=
"#employee-group-unit-component-modal-add"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#employee-group-unit-component-alert-modal"
>
บันทึกข้อมูล
</a>
</div>
...
...
@@ -193,18 +220,19 @@
</div>
<div
class=
"ti-modal-body "
style=
"margin-top: 40px;"
>
<label
for=
"input-label"
class=
"ti-form-label mt-2rem"
>
รหัสกลุ่มพนักงาน
</label>
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input w-1/2 bg-input-readonly"
value=
"01"
readonly
style=
"background-color: #B3B3B3;"
>
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input w-1/2 bg-input-readonly"
style=
"background-color: #B3B3B3;"
[(
ngModel
)]="
emp_group
.
groupId
"
readonly
>
<label
for=
"detail_th"
class=
"ti-form-label mt-2rem"
>
รายละเอียดฝ่าย (ไทย)
</label>
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input"
value=
"กลุ่ม 1
"
>
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input"
[(
ngModel
)]="
emp_group
.
tdesc
"
>
<label
for=
"detail_eng"
class=
"ti-form-label mt-2rem"
>
รายละเอียดฝ่าย (อังกฤษ)
</label>
<input
type=
"text"
id=
"detail_eng"
class=
"ti-form-input"
placeholder=
"
"
>
<input
type=
"text"
id=
"detail_eng"
class=
"ti-form-input"
[(
ngModel
)]="
emp_group
.
edesc
"
>
<div
class=
"flex justify-end mt-2rem mb-1rem"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay=
"#employee-group-unit-component-modal-edit"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#employee-group-unit-component-alert-modal"
>
บันทึกข้อมูล
</a>
</div>
...
...
@@ -212,6 +240,43 @@
</div>
</div>
</div>
<div
id=
"employee-group-unit-component-alert-modal"
class=
"hs-overlay hidden ti-modal"
>
<div
class=
"hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)] flex items-center"
>
<div
class=
"max-h-full overflow-hidden ti-modal-content w-full"
>
<div
class=
"ti-modal-header"
>
<h3
class=
"text-xxl font-bold text-primary"
>
แจ้งเตือน
</h3>
<div
class=
"flex justify-end"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#employee-group-unit-component-alert-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
</div>
</div>
<div
class=
"ti-modal-body "
>
<p
class=
"mt-1 text-gray-800 dark:text-white/70"
>
ยืนยันการบันทึกข้อมูลหรือไม่
</p>
<div
class=
"flex justify-end mt-2rem mb-1rem"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay=
"#employee-group-unit-component-alert-modal"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#employee-group-unit-component-alert-modal"
(
click
)="
addEmp_group
()"
>
บันทึกข้อมูล
</a>
</div>
</div>
</div>
</div>
</div>
<div
id=
"employee-group-unit-component-modal-upload"
class=
"hs-overlay hidden ti-modal"
>
<div
class=
"hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)]"
>
<div
class=
"max-h-full overflow-hidden ti-modal-content-upload"
>
...
...
src/app/components/job-description/employee-group-unit/employee-group-unit.component.ts
View file @
c86e6a62
import
{
Component
,
EventEmitter
,
Input
,
Output
}
from
'@angular/core'
;
import
{
Component
,
EventEmitter
,
Input
,
OnInit
,
Output
}
from
'@angular/core'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
EmpGroupModel
,
MyEmpGroupModel
}
from
'src/app/shared/model/emp_group.model'
;
import
{
EmpGroupService
}
from
'src/app/shared/services/emp_group.service'
;
@
Component
({
selector
:
'app-employee-group-unit'
,
templateUrl
:
'./employee-group-unit.component.html'
,
styleUrls
:
[
'./employee-group-unit.component.scss'
]
})
export
class
EmployeeGroupUnit
{
export
class
EmployeeGroupUnit
implements
OnInit
{
@
Input
()
pathTitle
=
[
'การจัดการข้อมูลองค์กร'
,
'ข้อมูลลักษณะงาน'
,
'กลุ่มพนักงาน'
]
@
Output
()
sendPathTitle
:
EventEmitter
<
string
[]
>
=
new
EventEmitter
<
string
[]
>
();
activeTab
:
string
=
'tab1'
;
// กำหนด tab เริ่มต้น
...
...
@@ -15,6 +18,19 @@ export class EmployeeGroupUnit {
this
.
sendPathTitle
.
emit
([
'การจัดการข้อมูลองค์กร'
,
'ข้อมูลลักษณะงาน'
,
tab
.
text
])
this
.
activeTab
=
tab
.
id
;
}
currentPage
=
1
page
=
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
);
emp_groupList
:
EmpGroupModel
[]
=
[]
emp_group
:
EmpGroupModel
=
new
MyEmpGroupModel
({})
search
=
""
constructor
(
private
EmpGroupService
:
EmpGroupService
,
private
toastr
:
ToastrService
)
{
}
ngOnInit
():
void
{
this
.
getEmpGroupList
()
}
modalOptions
:
{
[
nameModal
:
string
]:
{
// ชื่อตรวจสอบการเปิดปิด
isModalOpen
:
boolean
;
// เปิด/ปิด
...
...
@@ -58,5 +74,46 @@ export class EmployeeGroupUnit {
// Logic ตรวจสอบว่า Modal อื่นยังเปิดอยู่หรือไม่
return
Object
.
values
(
this
.
modalOptions
).
some
(
modal
=>
modal
.
isModalOpen
);
// หากไม่มี Modal อื่นเปิด
}
getEmpGroupList
()
{
this
.
EmpGroupService
.
getList
().
subscribe
(
response
=>
{
this
.
emp_groupList
=
response
this
.
searchChange
()
})
}
searchChange
()
{
this
.
currentPage
=
1
this
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
emp_groupListFilter
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
}
emp_groupListFilter
()
{
return
this
.
emp_groupList
.
filter
(
x
=>
x
.
groupId
.
toLowerCase
().
includes
(
this
.
search
)
||
x
.
tdesc
.
toLowerCase
().
includes
(
this
.
search
)
||
x
.
edesc
.
toLowerCase
().
includes
(
this
.
search
))
}
selectEmp_group
(
emp_group
:
EmpGroupModel
)
{
// this.showSuccess()
this
.
emp_group
=
new
MyEmpGroupModel
(
emp_group
)
}
showSuccess
()
{
this
.
toastr
.
success
(
'This is an example of tip'
,
'TIP'
,
{
timeOut
:
3000
,
positionClass
:
'toast-top-right'
,
});
}
addEmp_group
()
{
// this.emp_groupService.post(this.emp_group).subscribe((response:any) => {
// if (response.success) {
// this.getemp_groupList()
// }
// })
}
deleteEmp_group
(
emp_group
:
EmpGroupModel
)
{
// this.emp_groupService.delete(new MyEmpGroupModel(emp_group)).subscribe((response:any) => {
// if (response.success) {
// this.getemp_groupList()
// }
// })
}
}
src/app/shared/model/emp_group.model.ts
0 → 100644
View file @
c86e6a62
export
interface
EmpGroupModel
{
groupId
:
string
;
tdesc
:
string
;
edesc
:
string
;
companyId
:
string
;
}
export
class
MyEmpGroupModel
implements
EmpGroupModel
{
groupId
:
string
;
tdesc
:
string
;
edesc
:
string
;
companyId
:
string
;
constructor
(
data
:
Partial
<
EmpGroupModel
>
)
{
this
.
groupId
=
data
.
groupId
||
""
this
.
tdesc
=
data
.
tdesc
||
""
this
.
edesc
=
data
.
edesc
||
""
this
.
companyId
=
data
.
companyId
||
""
}
}
src/app/shared/services/emp_group.service.ts
0 → 100644
View file @
c86e6a62
import
{
HttpClient
,
HttpHeaders
}
from
'@angular/common/http'
;
import
{
Injectable
}
from
'@angular/core'
;
import
{
Observable
}
from
'rxjs'
;
import
{
environment
}
from
'src/environments/environment'
;
import
{
EmpGroupModel
}
from
'../model/emp_group.model'
;
@
Injectable
({
providedIn
:
'root'
})
export
class
EmpGroupService
{
api
=
"/emp-group"
urlApi
=
environment
.
baseUrl
+
this
.
api
constructor
(
private
http
:
HttpClient
)
{
}
getList
():
Observable
<
EmpGroupModel
[]
>
{
return
this
.
http
.
get
<
EmpGroupModel
[]
>
(
this
.
urlApi
+
"/lists"
)
}
getById
(
groupId
:
string
):
Observable
<
EmpGroupModel
>
{
return
this
.
http
.
get
<
EmpGroupModel
>
(
this
.
urlApi
+
"/"
+
groupId
)
}
// post(body: Bu1Model) {
// return this.http.post(this.urlApi, body)
// }
// delete(body: Bu1Model) {
// const options = {
// headers: new HttpHeaders({
// "Content-Type": "application/json",
// }),
// body: body
// };
// return this.http.delete(this.urlApi, options)
// }
}
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