Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
portal-apps-manage
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
portal-apps-manage
Commits
53515310
Commit
53515310
authored
Sep 27, 2025
by
Sirasit.y
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mylearn จัดการบริษัท - เพิ่มสร้างบริษัทโดยไม่ต้อง sync ข้อมูลจาก zeeme
parent
b42f9b15
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
207 additions
and
45 deletions
+207
-45
myhrcompany.model.ts
src/app/portal-manage/models/mylearn/myhrcompany.model.ts
+3
-0
myhrcompany.component.html
...tal-manage/mylearn/myhrcompany/myhrcompany.component.html
+97
-2
myhrcompany.component.ts
...ortal-manage/mylearn/myhrcompany/myhrcompany.component.ts
+97
-30
myhrcompany.service.ts
...app/portal-manage/services/mylearn/myhrcompany.service.ts
+10
-13
No files found.
src/app/portal-manage/models/mylearn/myhrcompany.model.ts
View file @
53515310
...
...
@@ -6,6 +6,7 @@ export interface HrcompanyModel {
companyId
:
string
;
companyCode
:
string
;
companyName
:
string
;
companySource
:
string
;
branchId
:
string
;
branchName
:
string
;
pictureUrl
:
string
;
...
...
@@ -30,6 +31,7 @@ export class MyHrcompanyModel extends BaseModel implements HrcompanyModel {
companyId
:
string
;
companyCode
:
string
;
companyName
:
string
;
companySource
:
string
;
branchId
:
string
;
branchName
:
string
;
pictureUrl
:
string
;
...
...
@@ -54,6 +56,7 @@ export class MyHrcompanyModel extends BaseModel implements HrcompanyModel {
this
.
companyId
=
data
?.
companyId
!
this
.
companyCode
=
data
?.
companyCode
!
this
.
companyName
=
data
?.
companyName
!
this
.
companySource
=
data
?.
companySource
!
this
.
branchId
=
data
?.
branchId
!
this
.
branchName
=
data
?.
branchName
!
this
.
pictureUrl
=
data
?.
pictureUrl
!
...
...
src/app/portal-manage/mylearn/myhrcompany/myhrcompany.component.html
View file @
53515310
...
...
@@ -30,6 +30,14 @@
(click)="deleteSelect()"><i class="ri-delete-bin-line font-semibold align-middle"></i>{{ 'Delete' |
translate}}
</a> -->
<div>
<a
href=
"javascript:void(0);"
class=
"hs-dropdown-toggle ti-btn ti-btn-primary-full me-2"
(
click
)="
newHrcompanyModel
()"
data-hs-overlay=
"#modal-detail"
>
<i
class=
"ri-add-line font-semibold align-middle"
>
</i>
{{ 'Create' | translate}}
</a>
</div>
<div>
<input
class=
"form-control form-control"
type=
"text"
placeholder=
"ค้นหาบริษัท"
aria-label=
".form-control-sm example"
[(
ngModel
)]='
searchTerm
'
>
...
...
@@ -49,6 +57,7 @@
<th
scope=
"col"
class=
"text-start"
>
{{"รหัสบริษัท"|translate}}
</th>
<th
scope=
"col"
class=
"text-start"
>
{{"ชื่อบริษัท"|translate}}
</th>
<th
scope=
"col"
class=
"text-start"
>
{{"หน่วยงาน" | translate}}
</th>
<th
scope=
"col"
class=
"text-start"
>
{{"แหล่งที่มาบริษัท" | translate}}
</th>
<th
scope=
"col"
class=
"text-start"
>
{{"การจัดการคอร์ส"|translate}}
</th>
</tr>
</thead>
...
...
@@ -92,6 +101,13 @@
</div>
</td>
<td>
<div>
<span
class=
"block mb-1"
>
{{item.companySource}}
</span>
</div>
</td>
<td>
<div
class=
"flex flex-row items-center !gap-2 "
>
<a
aria-label=
"anchor"
(
click
)="
goToDetail
(
item
.
companyId
)"
class=
"ti-btn ti-btn-wave !gap-0 !m-0 bg-info/10 text-info hover:bg-info hover:text-white hover:border-info cursor-pointer"
>
...
...
@@ -162,4 +178,84 @@
</div>
</div>
</div>
</div>
\ No newline at end of file
</div>
<!-- Start:: Create Contact -->
<div
id=
"modal-detail"
class=
"hs-overlay hidden ti-modal [--overlay-backdrop:static]"
>
<div
class=
"hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out"
>
<div
class=
"ti-modal-content"
>
<div
class=
"ti-modal-header"
>
<h6
class=
"modal-title text-[1rem] font-semibold text-defaulttextcolor"
id=
"mail-ComposeLabel"
>
{{('Datasource Table Information' | translate)}}
</h6>
<button
type=
"button"
class=
"hs-dropdown-toggle !text-[1rem] !font-semibold !text-defaulttextcolor"
data-hs-overlay=
"#modal-detail"
#
closeModal
>
<span
class=
"sr-only"
>
{{'Close' | translate}}
</span>
<i
class=
"ri-close-line"
></i>
</button>
</div>
<div
class=
"ti-modal-body px-4"
>
<div
class=
"grid grid-cols-12 gap-4"
>
<div
class=
"xl:col-span-12 col-span-12 my-2"
>
<label
for=
"companyCode"
class=
"form-label"
>
{{'รหัสบริษัท' | translate}}
</label>
<input
type=
"text"
class=
"form-control"
id=
"companyCode"
placeholder=
""
[(
ngModel
)]="
selectHrcompanyModel
.
companyCode
"
[
disabled
]="
action =
==
'
edit
'"
[
ngClass
]="{'!
bg-input-readonly
'
:action =
==
'
edit
'}"
>
<div
class=
"text-danger"
*
ngIf=
"!selectHrcompanyModel.companyCode"
>
{{'Please fill in information' | translate}}
</div>
</div>
<div
class=
"xl:col-span-12 col-span-12 my-2"
*
ngIf=
"statusHrcompanyModel=='add'"
>
<label
for=
"deal-title"
class=
"form-label"
>
{{ 'ชื่อบริษัท' | translate}}
</label>
<input
type=
"text"
class=
"form-control"
id=
"deal-title"
placeholder=
""
[(
ngModel
)]="
selectHrcompanyModel
.
companyName
"
>
<div
class=
"text-danger"
*
ngIf=
"!selectHrcompanyModel.companyName"
>
{{'Please fill in information' | translate}}
</div>
</div>
<div
class=
"xl:col-span-12 col-span-12 my-2"
*
ngIf=
"statusHrcompanyModel=='add'"
>
<label
for=
"deal-title"
class=
"form-label"
>
{{ 'ที่อยู่บริษัท' | translate}}
</label>
<input
type=
"text"
class=
"form-control"
id=
"deal-title"
placeholder=
""
[(
ngModel
)]="
selectHrcompanyModel
.
companyAddr
"
>
</div>
<div
class=
"xl:col-span-12 col-span-12 my-2"
*
ngIf=
"statusHrcompanyModel=='add'"
>
<label
for=
"deal-title"
class=
"form-label"
>
{{ 'เบอร์ติดต่อบริษัท' | translate}}
</label>
<input
type=
"text"
class=
"form-control"
id=
"deal-title"
placeholder=
""
[(
ngModel
)]="
selectHrcompanyModel
.
companyTel
"
>
</div>
<div
class=
"xl:col-span-12 col-span-12 my-2"
*
ngIf=
"statusHrcompanyModel=='add'"
>
<label
for=
"deal-title"
class=
"form-label"
>
{{ 'โลโก้บริษัท' | translate}}
</label>
<input
type=
"text"
class=
"form-control"
id=
"deal-title"
placeholder=
""
[(
ngModel
)]="
selectHrcompanyModel
.
logo
"
>
</div>
<div
class=
"xl:col-span-12 col-span-12 my-2"
*
ngIf=
"statusHrcompanyModel=='add'"
>
<label
for=
"deal-title"
class=
"form-label"
>
{{ 'รหัสหน่วยงาน' | translate}}
</label>
<input
type=
"text"
class=
"form-control"
id=
"deal-title"
placeholder=
""
[(
ngModel
)]="
selectHrcompanyModel
.
branchId
"
>
</div>
<div
class=
"xl:col-span-12 col-span-12 my-2"
*
ngIf=
"statusHrcompanyModel=='add'"
>
<label
for=
"deal-title"
class=
"form-label"
>
{{ 'ชื่อหน่วยงาน' | translate}}
</label>
<input
type=
"text"
class=
"form-control"
id=
"deal-title"
placeholder=
""
[(
ngModel
)]="
selectHrcompanyModel
.
branchName
"
>
</div>
<div
class=
"xl:col-span-12 col-span-12 my-2"
*
ngIf=
"statusHrcompanyModel=='add'"
>
<label
for=
"deal-title"
class=
"form-label"
>
{{ 'แหล่งที่มาบริษัท' | translate}}
</label>
<select
class=
"form-control"
[(
ngModel
)]="
selectHrcompanyModel
.
companySource
"
id=
"companySource"
disabled
>
<option
value=
"ZeeMe"
>
ZeeMe
</option>
<option
value=
"MyLearn"
>
MyLearn
</option>
</select>
<div
class=
"text-danger"
*
ngIf=
"!selectHrcompanyModel.companySource"
>
{{'Please fill in information' | translate}}
</div>
</div>
</div>
<div
class=
"ti-modal-footer"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-btn ti-btn-light align-middle"
data-hs-overlay=
"#modal-detail"
>
{{'Cancel' | translate}}
</button>
<button
type=
"button"
(
click
)="
saveHrcompanyModel
()"
class=
"ti-btn bg-primary text-white !font-medium"
[
class
.
ti-btn-disabled
]="!
selectHrcompanyModel
.
companyCode
||!
selectHrcompanyModel
.
companyName
"
[
disabled
]="!
selectHrcompanyModel
.
companyCode
||!
selectHrcompanyModel
.
companyName
"
>
{{'Save' | translate}}
</button>
</div>
</div>
</div>
src/app/portal-manage/mylearn/myhrcompany/myhrcompany.component.ts
View file @
53515310
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
Component
,
ElementRef
,
OnInit
,
ViewChild
}
from
'@angular/core'
;
import
{
SharedModule
}
from
'../../../shared/shared.module'
;
import
{
CommonModule
}
from
'@angular/common'
;
import
{
TranslateModule
,
TranslateService
}
from
'@ngx-translate/core'
;
import
{
HrcompanyModel
,
MyHrcompanyModel
,
}
from
'../../models/mylearn/myhrcompany.model'
;
import
{
HrcompanyModel
,
MyHrcompanyModel
,
}
from
'../../models/mylearn/myhrcompany.model'
;
import
{
MyhrcompanyService
}
from
'../../services/mylearn/myhrcompany.service'
;
import
swal
from
'sweetalert'
;
import
{
FormsModule
}
from
'@angular/forms'
;
...
...
@@ -13,23 +16,22 @@ import { Router } from '@angular/router';
templateUrl
:
'./myhrcompany.component.html'
,
styleUrls
:
[
'./myhrcompany.component.scss'
],
standalone
:
true
,
imports
:
[
CommonModule
,
SharedModule
,
TranslateModule
,
FormsModule
,
],
imports
:
[
CommonModule
,
SharedModule
,
TranslateModule
,
FormsModule
],
})
export
class
MyhrcompanyComponent
implements
OnInit
{
HrcompanyList
:
HrcompanyModel
[]
=
[];
filterList
:
HrcompanyModel
[]
=
[];
MyhrcompanyList
:
MyHrcompanyModel
[]
=
[];
companyId
:
string
;
@
ViewChild
(
'closeModal'
)
public
childModal
?:
ElementRef
;
@
ViewChild
(
'modalDetail'
)
public
modalDetail
?:
ElementRef
;
selectHrcompanyModel
:
HrcompanyModel
=
new
MyHrcompanyModel
();
statusHrcompanyModel
:
'add'
|
'edit'
=
'add'
;
companyId
:
string
;
_searchTerm
=
""
;
action
=
'new'
;
_searchTerm
=
''
;
pageIndex
=
0
;
allSelected
=
false
;
someSelected
=
false
;
...
...
@@ -51,26 +53,33 @@ export class MyhrcompanyComponent implements OnInit {
constructor
(
private
myhrcompanyservice
:
MyhrcompanyService
,
public
translate
:
TranslateService
,
private
router
:
Router
,
)
{
}
private
router
:
Router
)
{}
ngOnInit
()
{
this
.
getMyHRCompany
();
ngOnInit
()
:
void
{
this
.
get
List
MyHRCompany
();
}
onCheckboxChange
(
companyId
:
string
)
{
const
isSelected
=
this
.
selectedItems
.
get
(
companyId
)
||
false
;
this
.
selectedItems
.
set
(
companyId
,
!
isSelected
);
this
.
allSelected
=
this
.
HrcompanyList
.
every
(
item
=>
this
.
selectedItems
.
get
(
item
.
companyId
));
this
.
someSelected
=
this
.
HrcompanyList
.
some
(
item
=>
this
.
selectedItems
.
get
(
item
.
companyId
));
this
.
allSelected
=
this
.
HrcompanyList
.
every
((
item
)
=>
this
.
selectedItems
.
get
(
item
.
companyId
)
);
this
.
someSelected
=
this
.
HrcompanyList
.
some
((
item
)
=>
this
.
selectedItems
.
get
(
item
.
companyId
)
);
}
toggleAll
(
event
:
any
)
{
this
.
allSelected
=
event
.
target
.
checked
;
this
.
selectedItems
.
clear
();
this
.
HrcompanyList
.
forEach
(
item
=>
{
this
.
HrcompanyList
.
forEach
(
(
item
)
=>
{
this
.
selectedItems
.
set
(
item
.
companyId
,
this
.
allSelected
);
});
this
.
someSelected
=
this
.
HrcompanyList
.
some
(
item
=>
this
.
selectedItems
.
get
(
item
.
companyId
));
this
.
someSelected
=
this
.
HrcompanyList
.
some
((
item
)
=>
this
.
selectedItems
.
get
(
item
.
companyId
)
);
}
filter
(
v
:
string
)
{
...
...
@@ -88,7 +97,7 @@ export class MyhrcompanyComponent implements OnInit {
this
.
filterList
=
this
.
HrcompanyList
.
slice
(
startIndex
,
endIndex
);
}
getMyHRCompany
()
{
get
List
MyHRCompany
()
{
this
.
myhrcompanyservice
.
getList
().
subscribe
({
next
:
(
response
:
HrcompanyModel
[])
=>
{
this
.
MyhrcompanyList
=
response
.
map
(
...
...
@@ -100,12 +109,13 @@ export class MyhrcompanyComponent implements OnInit {
},
error
:
(
error
)
=>
{
console
.
error
(
'error cant get article'
,
error
);
swal
(
"ข้อผิดพลาด"
,
"ไม่สามารถดึงข้อมูลบริษัทได้"
,
"error"
);
}
swal
(
'ข้อผิดพลาด'
,
'ไม่สามารถดึงข้อมูลบริษัทได้'
,
'error'
);
}
,
});
}
getMyHRCompanyExternal
()
{
const
externalCompanyId
=
"5f3c2b6e-8d7a-4b2f-a3e6-9f1d8c4e7b0a"
;
const
externalCompanyId
=
'5f3c2b6e-8d7a-4b2f-a3e6-9f1d8c4e7b0a'
;
this
.
myhrcompanyservice
.
getByCompany
(
externalCompanyId
).
subscribe
({
next
:
(
response
:
HrcompanyModel
)
=>
{
const
company
=
new
MyHrcompanyModel
(
response
,
this
.
translate
);
...
...
@@ -114,25 +124,82 @@ export class MyhrcompanyComponent implements OnInit {
},
error
:
(
error
)
=>
{
console
.
error
(
"error can't get external company"
,
error
);
swal
(
"เกิดข้อผิดพลาด"
,
"ไม่สามารถดึงข้อมูล external company ได้"
,
"error"
);
}
swal
(
'เกิดข้อผิดพลาด'
,
'ไม่สามารถดึงข้อมูล external company ได้'
,
'error'
);
},
});
}
getMyHRCompanyById
()
{
this
.
myhrcompanyservice
.
getByCompany
(
this
.
companyId
).
subscribe
({
next
:
(
response
:
HrcompanyModel
)
=>
{
const
company
=
new
MyHrcompanyModel
(
response
,
this
.
translate
)
const
company
=
new
MyHrcompanyModel
(
response
,
this
.
translate
)
;
},
error
:
(
error
)
=>
{
console
.
error
(
"error can't get myhrcompany by Id"
)
swal
(
"เกิดข้อผิดพลาด"
,
"ไม่สามารถดึงข้อมูลบริษัทได้"
,
"error"
)
}
})
console
.
error
(
"error can't get myhrcompany by Id"
)
;
swal
(
'เกิดข้อผิดพลาด'
,
'ไม่สามารถดึงข้อมูลบริษัทได้'
,
'error'
);
}
,
})
;
}
goToDetail
(
companyId
:
string
)
{
this
.
router
.
navigate
([
'/mylearn/myhrcompany/manage-course'
,
companyId
]);
}
newHrcompanyModel
()
{
this
.
action
=
'add'
;
this
.
statusHrcompanyModel
=
'add'
;
this
.
selectHrcompanyModel
=
new
MyHrcompanyModel
();
this
.
selectHrcompanyModel
.
companyId
=
''
;
this
.
selectHrcompanyModel
.
companyCode
=
''
;
this
.
selectHrcompanyModel
.
companyName
=
''
;
this
.
selectHrcompanyModel
.
companySource
=
'MyLearn'
;
// default
this
.
selectHrcompanyModel
.
branchId
=
''
;
this
.
selectHrcompanyModel
.
branchName
=
''
;
this
.
selectHrcompanyModel
.
logo
=
''
;
this
.
selectHrcompanyModel
.
pictureUrl
=
''
;
this
.
selectHrcompanyModel
.
companyAddr
=
''
;
this
.
selectHrcompanyModel
.
companyTel
=
''
;
this
.
selectHrcompanyModel
.
companyTax
=
''
;
this
.
selectHrcompanyModel
.
myhrCode
=
''
;
this
.
selectHrcompanyModel
.
myhrUrl
=
''
;
this
.
selectHrcompanyModel
.
database
=
''
;
this
.
selectHrcompanyModel
.
role
=
'user'
;
this
.
selectHrcompanyModel
.
prefix
=
''
;
this
.
selectHrcompanyModel
.
lastNumber
=
''
;
this
.
selectHrcompanyModel
.
number
=
''
;
this
.
selectHrcompanyModel
.
receiptSignature1
=
''
;
this
.
selectHrcompanyModel
.
receiptSignature2
=
''
;
}
saveHrcompanyModel
()
{
console
.
log
(
'Before Save, selectHrcompanyModel is:'
,
this
.
selectHrcompanyModel
);
swal
({
title
:
'คุณแน่ใจหรือไม่?'
,
text
:
'คุณต้องการบันทึกหรือไม่'
,
icon
:
'warning'
,
dangerMode
:
false
,
buttons
:
[
'ยกเลิก'
,
'ยืนยัน'
],
}).
then
((
willSave
:
any
)
=>
{
if
(
willSave
)
{
this
.
myhrcompanyservice
.
postMyHRcompany
(
this
.
selectHrcompanyModel
)
.
subscribe
(
(
result
)
=>
{
console
.
log
(
result
);
swal
(
'บันทึกสำเร็จ!!'
,
'บันทึกข้อมูลสมาชิก'
,
'success'
);
this
.
ngOnInit
();
this
.
childModal
?.
nativeElement
.
click
();
},
(
error
)
=>
{
console
.
error
(
'เกิดข้อผิดพลาดในการบันทึก/อัปเดต:'
,
error
);
swal
(
'ข้อผิดพลาด!!'
,
'ไม่สามารถบันทึก/อัปเดตข้อมูลได้'
,
'error'
);
}
);
}
});
}
}
src/app/portal-manage/services/mylearn/myhrcompany.service.ts
View file @
53515310
...
...
@@ -3,19 +3,18 @@ import { Injectable } from '@angular/core';
import
{
Observable
}
from
'rxjs'
;
import
{
environment
}
from
'../../../../environments/environment'
;
import
{
HrcompanyModel
}
from
'../../models/mylearn/myhrcompany.model'
;
import
{
AlertModel
}
from
'../../models/alert.model'
;
@
Injectable
({
providedIn
:
'root'
providedIn
:
'root'
,
})
export
class
MyhrcompanyService
{
api
=
"/myhrcompany"
urlApi
=
environment
.
baseUrlMylearn
+
"/myhrcompany"
constructor
(
private
http
:
HttpClient
)
{
}
api
=
'/myhrcompany'
;
urlApi
=
environment
.
baseUrlMylearn
+
'/myhrcompany'
;
constructor
(
private
http
:
HttpClient
)
{}
get
c
ompany
()
{
return
this
.
http
.
get
<
HrcompanyModel
>
(
this
.
urlApi
)
get
C
ompany
()
{
return
this
.
http
.
get
<
HrcompanyModel
>
(
this
.
urlApi
)
;
}
getByCompany
(
companyId
:
string
):
Observable
<
HrcompanyModel
>
{
...
...
@@ -23,12 +22,10 @@ export class MyhrcompanyService {
}
getList
():
Observable
<
HrcompanyModel
[]
>
{
return
this
.
http
.
get
<
HrcompanyModel
[]
>
(
this
.
urlApi
+
"/lists"
)
return
this
.
http
.
get
<
HrcompanyModel
[]
>
(
this
.
urlApi
+
'/lists'
);
}
postMyHRcompany
(
body
:
Partial
<
HrcompanyModel
>
):
Observable
<
any
>
{
return
this
.
http
.
post
(
this
.
urlApi
,
body
)
postMyHRcompany
(
body
:
HrcompanyModel
):
Observable
<
AlertModel
>
{
return
this
.
http
.
post
<
AlertModel
>
(
this
.
urlApi
,
body
);
}
}
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