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
67e6377e
Commit
67e6377e
authored
Nov 26, 2024
by
Nattana Chaiyamat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ทะเบียนบริษัท
parent
9d7c4558
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
236 additions
and
63 deletions
+236
-63
department-register.component.html
...it/department-register/department-register.component.html
+91
-23
department-register.component.ts
...unit/department-register/department-register.component.ts
+43
-37
dashboard.module.ts
src/app/components/dashboard/dashboard.module.ts
+13
-2
bu1.model.ts
src/app/shared/model/bu1.model.ts
+17
-0
bu1.service.ts
src/app/shared/services/bu1.service.ts
+29
-0
http-request.interceptor.ts
src/app/shared/services/http-request.interceptor.ts
+40
-0
style.css
src/assets/css/style.css
+2
-1
environment.ts
src/environments/environment.ts
+1
-0
No files found.
src/app/components/company-registration/branch-business-unit/department-register/department-register.component.html
View file @
67e6377e
This diff is collapsed.
Click to expand it.
src/app/components/company-registration/branch-business-unit/department-register/department-register.component.ts
View file @
67e6377e
import
{
Component
,
EventEmitter
,
Input
,
Output
}
from
'@angular/core'
;
import
{
Component
,
EventEmitter
,
Input
,
OnInit
,
}
from
'@angular/core'
;
import
{
Bu1Model
,
MyBu1Model
}
from
'src/app/shared/model/bu1.model'
;
import
{
Bu1Service
}
from
'src/app/shared/services/bu1.service'
;
@
Component
({
selector
:
'app-department-register'
,
templateUrl
:
'./department-register.component.html'
,
styleUrls
:
[
'./department-register.component.scss'
]
})
export
class
DepartmentRegisterComponent
{
modalOptions
:
{
[
nameModal
:
string
]:
{
// ชื่อตรวจสอบการเปิดปิด
isModalOpen
:
boolean
;
// เปิด/ปิด
modalSize
:
string
;
// ขนาดของ Modal (s,m,l,vw10-vw100 )
backdropClose
:
boolean
;
// (คลิก Backdrop แล้ว true ปิด false ไม่ปิด )
}
}
=
{
"add"
:
{
isModalOpen
:
false
,
modalSize
:
'm'
,
backdropClose
:
true
,
},
"edit"
:
{
isModalOpen
:
false
,
modalSize
:
'm'
,
backdropClose
:
true
,
}
}
openModal
(
name
:
string
,
size
:
string
,
closeOnBackdrop
?:
boolean
)
{
this
.
modalOptions
[
name
].
modalSize
=
size
;
this
.
modalOptions
[
name
].
backdropClose
=
closeOnBackdrop
||
false
;
this
.
modalOptions
[
name
].
isModalOpen
=
true
;
document
.
body
.
style
.
overflow
=
'hidden'
;
// ล็อก Scroll
export
class
DepartmentRegisterComponent
implements
OnInit
{
currentPage
=
1
page
=
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
);
bu1List
:
Bu1Model
[]
=
[]
bu1
:
Bu1Model
=
new
MyBu1Model
({})
search
=
""
constructor
(
private
bu1Service
:
Bu1Service
)
{
}
ngOnInit
():
void
{
this
.
getBu1List
()
}
closeModal
(
name
:
string
)
{
this
.
modalOptions
[
name
].
isModalOpen
=
false
;
// ตรวจสอบว่ามี Modal อื่นเปิดอยู่หรือไม่
if
(
!
this
.
isAnyModalOpen
())
{
document
.
body
.
style
.
overflow
=
''
;
// คืนค่าการ Scroll เฉพาะเมื่อ Modal ทั้งหมดปิดแล้ว
}
getBu1List
()
{
this
.
bu1Service
.
getList
().
subscribe
(
response
=>
{
this
.
bu1List
=
response
this
.
searchChange
()
})
}
isAnyModalOpen
():
boolean
{
// Logic ตรวจสอบว่า Modal อื่นยังเปิดอยู่หรือไม่
return
Object
.
values
(
this
.
modalOptions
).
some
(
modal
=>
modal
.
isModalOpen
);
// หากไม่มี Modal อื่นเปิด
searchChange
()
{
this
.
currentPage
=
1
this
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
bu1ListFilter
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
}
bu1ListFilter
()
{
return
this
.
bu1List
.
filter
(
x
=>
x
.
bu1id
.
toLowerCase
().
includes
(
this
.
search
)
||
x
.
tdesc
.
toLowerCase
().
includes
(
this
.
search
)
||
x
.
edesc
.
toLowerCase
().
includes
(
this
.
search
))
}
selectBu1
(
bu1
:
Bu1Model
)
{
this
.
bu1
=
new
MyBu1Model
(
bu1
)
}
addBu1
()
{
// this.bu1Service.post(this.bu1).subscribe((response:any) => {
// if (response.success) {
// this.getBu1List()
// }
// })
}
deleteBu1
(
bu1
:
Bu1Model
)
{
// this.bu1Service.delete(new MyBu1Model(bu1)).subscribe((response:any) => {
// if (response.success) {
// this.getBu1List()
// }
// })
}
}
src/app/components/dashboard/dashboard.module.ts
View file @
67e6377e
...
...
@@ -24,8 +24,8 @@ import { CompanyRegistrationComponent } from '../company-registration/company-re
import
{
DepartmentRegisterComponent
}
from
'../company-registration/branch-business-unit/department-register/department-register.component'
;
import
{
BranchBusinessUnitComponent
}
from
'../company-registration/branch-business-unit/branch-business-unit.component'
;
import
{
DepartmentListComponent
}
from
'../company-registration/branch-business-unit/department-list/department-list.component'
;
import
{
SubDepartmentOneComponent
}
from
'../company-registration/branch-business-unit/sub-department-one/sub-department-one.component'
;
import
{
SubDepartmentThreeComponent
}
from
'../company-registration/branch-business-unit/sub-department-three/sub-department-three.component'
;
import
{
SubDepartmentOneComponent
}
from
'../company-registration/branch-business-unit/sub-department-one/sub-department-one.component'
;
import
{
SubDepartmentThreeComponent
}
from
'../company-registration/branch-business-unit/sub-department-three/sub-department-three.component'
;
import
{
SubDepartmentTwoComponent
}
from
'../company-registration/branch-business-unit/sub-department-two/sub-department-two.component'
;
import
{
SubDepartmentFourComponent
}
from
'../company-registration/branch-business-unit/sub-department-four/sub-department-four.component'
;
import
{
SectionRegistrationComponent
}
from
'../company-registration/branch-business-unit/section-registration/section-registration.component'
;
...
...
@@ -37,6 +37,10 @@ import { AccountSettingsComponent } from '../account-settings/account-settings.c
import
{
UserSettingsComponent
}
from
'../account-settings/user-settings/user-settings.component'
;
import
{
EmployeeLevel
}
from
'../job-description/employee-level/employee-level.component'
;
import
{
SetAPasswordComponent
}
from
'../account-settings/set-a-password/set-a-password.component'
;
import
{
HttpClientModule
,
HTTP_INTERCEPTORS
}
from
'@angular/common/http'
;
import
{
Bu1Service
}
from
'src/app/shared/services/bu1.service'
;
import
{
HttpRequestInterceptor
}
from
'src/app/shared/services/http-request.interceptor'
;
import
{
FormsModule
}
from
'@angular/forms'
;
@
NgModule
({
declarations
:
[
...
...
@@ -81,6 +85,13 @@ import { SetAPasswordComponent } from '../account-settings/set-a-password/set-a-
SharedModule
,
NgxChartsModule
,
NgSelectModule
,
HttpClientModule
,
FormsModule
],
providers
:
[
Bu1Service
,
{
provide
:
HTTP_INTERCEPTORS
,
useClass
:
HttpRequestInterceptor
,
multi
:
true
,
},]
})
export
class
DashboardModule
{
}
src/app/shared/model/bu1.model.ts
0 → 100644
View file @
67e6377e
export
interface
Bu1Model
{
bu1id
:
string
;
tdesc
:
string
;
edesc
:
string
;
}
export
class
MyBu1Model
implements
Bu1Model
{
bu1id
:
string
;
tdesc
:
string
;
edesc
:
string
;
constructor
(
data
:
Partial
<
Bu1Model
>
)
{
this
.
bu1id
=
data
.
bu1id
||
""
this
.
tdesc
=
data
.
tdesc
||
""
this
.
edesc
=
data
.
edesc
||
""
}
}
src/app/shared/services/bu1.service.ts
0 → 100644
View file @
67e6377e
import
{
HttpClient
,
HttpHeaders
}
from
'@angular/common/http'
;
import
{
Injectable
}
from
'@angular/core'
;
import
{
Observable
}
from
'rxjs'
;
import
{
environment
}
from
'src/environments/environment'
;
import
{
Bu1Model
}
from
'../model/bu1.model'
;
@
Injectable
({
providedIn
:
'root'
})
export
class
Bu1Service
{
api
=
"/bu1"
urlApi
=
environment
.
baseUrl
+
this
.
api
constructor
(
private
http
:
HttpClient
)
{
}
getList
():
Observable
<
Bu1Model
[]
>
{
return
this
.
http
.
get
<
Bu1Model
[]
>
(
this
.
urlApi
+
"/lists"
)
}
// 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)
// }
}
src/app/shared/services/http-request.interceptor.ts
0 → 100644
View file @
67e6377e
import
{
Injectable
}
from
'@angular/core'
;
import
{
HttpRequest
,
HttpHandler
,
HttpEvent
,
HttpInterceptor
,
HttpErrorResponse
}
from
'@angular/common/http'
;
import
{
Observable
,
of
,
throwError
}
from
'rxjs'
;
import
{
catchError
,
tap
}
from
'rxjs/operators'
;
@
Injectable
()
export
class
HttpRequestInterceptor
{
responseCache
=
new
Map
()
constructor
()
{
}
intercept
(
req
:
HttpRequest
<
any
>
,
next
:
HttpHandler
):
Observable
<
HttpEvent
<
any
>>
{
if
(
req
.
url
.
startsWith
(
"./"
))
{
return
next
.
handle
(
req
);
}
else
{
const
authHeader
=
'Bearer '
+
"eyJhbGciOiJIUzI1NiJ9.eyJzY2hlbWEiOiJkYm8iLCJlbmNvZGUiOiIyIiwic3ViIjoiQXV0aCIsImNvbXBhbnlOYW1lIjoi4Lia4Lij4Li04Lip4Lix4LiXIOC4oeC4suC4ouC5gOC4reC4iuC4reC4suC4o-C5jCDguIjguLPguIHguLHguJQiLCJkYk5hbWUiOiJNWUhSUExVUyIsInJvbGVzIjpbIlVTRVIiXSwid29ya2FyZWEiOiJUS1ciLCJpc3MiOiJDb21wdXRlciBTY2llbmNlIENvcnBvcmF0aW9uIExpbWl0ZWQiLCJ6bWxvZ2luIjoiZmFsc2UiLCJyb2xlX2xldmVsIjoiNiIsImVtcGxveWVlaWQiOiIxMDAwMDA4MiIsImJyYW5jaCI6Im15aHIzIiwiZW1wX3Bvc2l0aW9uIjoiMDk3IiwidXNlcl9yb2xlIjoiQWxsIiwidWlkIjoiMTAwMDAwODIiLCJjb21wYW55aWQiOiIxMDAiLCJhY3RvcmlkIjoiMTAwMDAwODIiLCJsYW5nIjoidGgiLCJhZCI6ImZhbHNlIiwiZmlyc3Rsb2dpbiI6ImZhbHNlIiwidXJsX215aHIiOiJodHRwOi8vaHJwbHVzLXN0ZC5teWhyLmNvLnRoL2hyIiwiYXBwX25hbWUiOiJteWhyIiwicmVnaW9uYWxsdHkiOiJFTkciLCJ0b2tlbl96ZWVtZSI6IiIsInVzZXJfbGV2ZWwiOiJNWUhSIiwiZnVsbG5hbWUiOiLguJnguLLguKLguK3guJ7guLTguKPguLHguJXguJnguYwgIOC4l-C4lOC4quC4reC4miIsImNvbWlkIjoiIiwiam9iIjoiMDk3LTI0NjkiLCJ1c2VyIjoibXlociIsInptX3VzZXIiOiIiLCJ1c2VybmFtZSI6Im15aHIiLCJtZW1iZXJpZCI6IiJ9.5VUk7ZilGchdTTm-5YC0xIL53cEYX6AkfEW4d8Xd-1g"
;
const
overideReq
=
{
headers
:
req
.
headers
.
set
(
'Authorization'
,
authHeader
),
url
:
req
.
url
,
};
const
authReq
=
req
.
clone
(
overideReq
);
return
next
.
handle
(
authReq
).
pipe
(
tap
(
response
=>
{
this
.
responseCache
.
set
(
req
.
urlWithParams
,
response
)
}));
}
}
}
src/assets/css/style.css
View file @
67e6377e
...
...
@@ -3352,7 +3352,8 @@ select option:active,
}
}
.ti-pagination
li
.page-link.active
{
background-color
:
rgb
(
var
(
--color-primary
));
/* background-color: rgb(var(--color-primary)); */
background-color
:
rgb
(
var
(
--color-secondary
));
--tw-text-opacity
:
1
;
color
:
rgb
(
255
255
255
/
var
(
--tw-text-opacity
));
}
...
...
src/environments/environment.ts
View file @
67e6377e
...
...
@@ -12,6 +12,7 @@ export const environment = {
appId
:
'********************************'
,
measurementId
:
'********************************'
,
},
baseUrl
:
'https://hrplus-std.myhr.co.th/plus'
,
};
/*
...
...
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