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
3c399baf
Commit
3c399baf
authored
Sep 09, 2025
by
sawit
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Institution menu
parent
ba43d131
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
372 additions
and
2 deletions
+372
-2
institution.model.ts
src/app/portal-manage/models/institution.model.ts
+26
-0
institution.component.css
.../company-department/institution/institution.component.css
+0
-0
institution.component.html
...company-department/institution/institution.component.html
+0
-0
institution.component.spec.ts
...pany-department/institution/institution.component.spec.ts
+28
-0
institution.component.ts
...b/company-department/institution/institution.component.ts
+256
-0
myjob.module.ts
src/app/portal-manage/myjob/myjob.module.ts
+5
-0
institution.service.ts
src/app/portal-manage/services/institution.service.ts
+50
-0
nav.service.ts
src/app/shared/services/nav.service.ts
+1
-0
en.json
src/assets/i18n/en.json
+3
-1
th.json
src/assets/i18n/th.json
+3
-1
No files found.
src/app/portal-manage/models/institution.model.ts
0 → 100644
View file @
3c399baf
import
{
TranslateService
}
from
"@ngx-translate/core"
;
import
{
BaseModel
,
baseGetName
,
checkData
}
from
"./base.model"
;
export
interface
InstitutionModel
{
institutionId
:
string
thName
:
string
engName
:
string
chinaName
:
string
}
export
class
InstitutionModel
extends
BaseModel
implements
InstitutionModel
{
institutionId
:
string
thName
:
string
engName
:
string
chinaName
:
string
constructor
(
data
?:
Partial
<
InstitutionModel
>
,
translateService
?:
TranslateService
)
{
super
(
data
,
translateService
)
this
.
institutionId
=
checkData
(
data
?.
institutionId
)
this
.
thName
=
checkData
(
data
?.
thName
)
this
.
engName
=
checkData
(
data
?.
engName
)
this
.
chinaName
=
checkData
(
data
?.
chinaName
)
}
getName
()
{
return
baseGetName
(
this
.
thName
,
this
.
engName
,
this
.
translateService
?.
currentLang
)
}
}
src/app/portal-manage/myjob/company-department/institution/institution.component.css
0 → 100644
View file @
3c399baf
src/app/portal-manage/myjob/company-department/institution/institution.component.html
0 → 100644
View file @
3c399baf
This diff is collapsed.
Click to expand it.
src/app/portal-manage/myjob/company-department/institution/institution.component.spec.ts
0 → 100644
View file @
3c399baf
/* tslint:disable:no-unused-variable */
import
{
async
,
ComponentFixture
,
TestBed
}
from
'@angular/core/testing'
;
import
{
By
}
from
'@angular/platform-browser'
;
import
{
DebugElement
}
from
'@angular/core'
;
import
{
InstitutionComponent
}
from
'./institution.component'
;
describe
(
'InstitutionComponent'
,
()
=>
{
let
component
:
InstitutionComponent
;
let
fixture
:
ComponentFixture
<
InstitutionComponent
>
;
beforeEach
(
async
(()
=>
{
TestBed
.
configureTestingModule
({
declarations
:
[
InstitutionComponent
]
})
.
compileComponents
();
}));
beforeEach
(()
=>
{
fixture
=
TestBed
.
createComponent
(
InstitutionComponent
);
component
=
fixture
.
componentInstance
;
fixture
.
detectChanges
();
});
it
(
'should create'
,
()
=>
{
expect
(
component
).
toBeTruthy
();
});
});
src/app/portal-manage/myjob/company-department/institution/institution.component.ts
0 → 100644
View file @
3c399baf
import
{
Component
,
ElementRef
,
ViewChild
}
from
'@angular/core'
;
import
{
DomSanitizer
,
SafeHtml
}
from
'@angular/platform-browser'
;
import
{
Router
,
RouterModule
}
from
'@angular/router'
;
import
{
SharedModule
}
from
'../../../../shared/shared.module'
;
import
{
TranslateModule
,
TranslateService
}
from
'@ngx-translate/core'
;
import
swal
from
'sweetalert'
;
import
{
MatPaginator
}
from
'@angular/material/paginator'
;
import
{
FormsModule
}
from
'@angular/forms'
;
import
{
NgSelectModule
}
from
'@ng-select/ng-select'
;
import
{
CommonModule
}
from
'@angular/common'
;
import
{
FileUploadModule
}
from
'ng2-file-upload'
;
import
{
FileItem
,
FileUploader
,
ParsedResponseHeaders
}
from
"ng2-file-upload"
;
import
{
environment
}
from
'../../../../../environments/environment'
;
import
{
TokenService
}
from
'../../../../shared/services/token.service'
import
{
QuillModule
}
from
'ngx-quill'
;
import
{
MatDialog
,
MatDialogModule
}
from
'@angular/material/dialog'
;
import
{
InstitutionModel
}
from
'../../../models/institution.model'
;
import
{
InstitutionService
}
from
'../../../services/institution.service'
;
@
Component
({
selector
:
'app-institution'
,
templateUrl
:
'./institution.component.html'
,
styleUrls
:
[
'./institution.component.css'
],
standalone
:
true
,
imports
:
[
CommonModule
,
SharedModule
,
TranslateModule
,
NgSelectModule
,
FormsModule
,
MatPaginator
,
RouterModule
,
FileUploadModule
,
QuillModule
,
MatDialogModule
],
})
export
class
InstitutionComponent
{
quillConfig
=
{
toolbar
:
[
[
'link'
],
// เพิ่มปุ่มลิงก์
[
'bold'
,
'italic'
,
'underline'
,
'strike'
],
// toggled buttons
[
'blockquote'
,
'code-block'
],
[{
'header'
:
1
},
{
'header'
:
2
}],
// custom button values
[{
'list'
:
'ordered'
},
{
'list'
:
'bullet'
}],
[{
'script'
:
'sub'
},
{
'script'
:
'super'
}],
// superscript/subscript
[{
'indent'
:
'-1'
},
{
'indent'
:
'+1'
}],
// outdent/indent
[{
'direction'
:
'rtl'
}],
// text direction
[{
'size'
:
[
'small'
,
false
,
'large'
,
'huge'
]
}],
// custom dropdown
[{
'header'
:
[
1
,
2
,
3
,
4
,
5
,
6
,
false
]
}],
[{
'color'
:
[]
},
{
'background'
:
[]
}],
// dropdown with defaults from theme
[{
'align'
:
[]
}],
[
'clean'
],
// remove formatting button
]
};
@
ViewChild
(
'closeModal'
)
public
childModal
?:
ElementRef
;
@
ViewChild
(
'modalDetail'
)
public
modalDetail
?:
ElementRef
;
@
ViewChild
(
"InstitutionModel"
)
InstitutionModel
:
any
;
@
ViewChild
(
'profileChangeInput'
)
profileChangeInputRef
!
:
ElementRef
;
dialogRef
:
any
currentContentTab
:
number
=
1
;
currentExcerptTab
:
number
=
1
;
action
=
"new"
;
allSelected
=
false
;
someSelected
=
false
;
itemsList
:
InstitutionModel
[]
=
[];
filterList
:
InstitutionModel
[]
=
[];
selectModel
:
InstitutionModel
=
new
InstitutionModel
();
selectedItems
=
new
Map
<
string
,
boolean
>
();
// empList: InstitutionModel[] = [];
// descName = 'engName';
pageIndex
=
0
;
uploaderProfile
:
FileUploader
|
undefined
;
uploadErrorMsg
:
string
=
""
;
modalStatus
:
"add"
|
"edit"
=
"add"
get
searchTerm
():
string
{
return
this
.
_searchTerm
;
}
set
searchTerm
(
val
:
string
)
{
this
.
pageIndex
=
0
;
this
.
allSelected
=
false
;
this
.
_searchTerm
=
val
;
if
(
val
!=
''
)
{
this
.
filterList
=
this
.
filter
(
val
);
}
else
{
this
.
updatePagedItems
();
}
}
_searchTerm
=
""
;
constructor
(
private
institution
:
InstitutionService
,
public
translate
:
TranslateService
,
private
tokenService
:
TokenService
,
private
router
:
Router
,
private
dialog
:
MatDialog
,
)
{
}
getInstitution
()
{
this
.
institution
.
getList
().
subscribe
({
next
:
(
response
:
InstitutionModel
[])
=>
{
this
.
itemsList
=
response
.
map
((
x
:
any
)
=>
new
InstitutionModel
(
x
,
this
.
translate
));
// console.log('ข้อมูลตำแหน่ง (itemsList)', this.itemsList);
this
.
updatePagedItems
();
},
error
:
(
error
)
=>
{
console
.
error
(
'error cant get position'
,
error
);
swal
(
"ข้อผิดพลาด"
,
"ไม่สามารถดึงข้อมูลตำแหน่งได้"
,
"error"
);
}
});
}
ngOnInit
():
void
{
this
.
getInstitution
();
}
filter
(
v
:
string
)
{
return
this
.
itemsList
?.
filter
(
(
x
)
=>
x
.
institutionId
?.
toLowerCase
().
indexOf
(
v
.
toLowerCase
())
!==
-
1
||
x
.
thName
?.
toLowerCase
().
indexOf
(
v
.
toLowerCase
())
!==
-
1
||
x
.
engName
?.
toLowerCase
().
indexOf
(
v
.
toLowerCase
())
!==
-
1
||
x
.
chinaName
?.
toLowerCase
().
indexOf
(
v
.
toLowerCase
())
!==
-
1
);
}
delete
(
item
:
InstitutionModel
)
{
swal
({
title
:
"คุณแน่ใจหรือไม่?"
,
text
:
"คุณจะไม่สามารถกู้คืนข้อมูลนี้ได้!"
,
icon
:
"warning"
,
dangerMode
:
true
,
buttons
:
[
"ยกเลิก"
,
"ใช่, ลบเลย!"
],
})
.
then
((
willDelete
:
any
)
=>
{
if
(
willDelete
)
{
const
newInstitution
=
new
InstitutionModel
(
item
)
this
.
institution
.
deleteInstitution
(
newInstitution
).
subscribe
(
result
=>
{
swal
(
"ลบสำเร็จ!!"
,
"ลบข้อมูลสำเร็จ"
,
"success"
);
this
.
ngOnInit
();
},
error
=>
{
console
.
error
(
"เกิดข้อผิดพลาดในการลบ:"
,
error
);
swal
(
"ข้อผิดพลาด!!"
,
"ไม่สามารถลบข้อมูลได้"
,
"error"
);
});
}
});
}
new
()
{
this
.
action
=
'add'
;
this
.
selectModel
=
new
InstitutionModel
();
// this.selectModel.status = 1;
this
.
selectModel
.
institutionId
=
""
;
this
.
selectModel
.
thName
=
""
;
this
.
selectModel
.
engName
=
""
;
this
.
selectModel
.
chinaName
=
""
;
}
view
(
item
:
InstitutionModel
)
{
this
.
action
=
'edit'
;
this
.
selectModel
=
new
InstitutionModel
(
item
);
console
.
log
(
this
.
selectModel
);
}
save
()
{
console
.
log
(
'Before Save, selectModel is:'
,
this
.
selectModel
);
swal
({
title
:
"คุณแน่ใจหรือไม่?"
,
text
:
"คุณต้องการบันทึกหรือไม่"
,
icon
:
"warning"
,
dangerMode
:
false
,
buttons
:
[
"ยกเลิก"
,
"ยืนยัน"
],
})
.
then
((
willSave
:
any
)
=>
{
if
(
willSave
)
{
this
.
institution
.
postInstitution
(
this
.
selectModel
).
subscribe
(
result
=>
{
console
.
log
(
result
);
swal
(
"บันทึกสำเร็จ!!"
,
"บันทึกข้อมูลสมาชิก"
,
"success"
);
this
.
ngOnInit
();
this
.
childModal
?.
nativeElement
.
click
();
},
error
=>
{
console
.
error
(
"เกิดข้อผิดพลาดในการบันทึก/อัปเดต:"
,
error
);
swal
(
"ข้อผิดพลาด!!"
,
"ไม่สามารถบันทึก/อัปเดตข้อมูลได้"
,
"error"
);
});
}
});
}
updatePagedItems
()
{
const
startIndex
=
this
.
pageIndex
*
10
;
const
endIndex
=
startIndex
+
10
;
this
.
filterList
=
this
.
itemsList
.
slice
(
startIndex
,
endIndex
);
}
toggleAll
(
event
:
any
)
{
this
.
allSelected
=
event
.
target
.
checked
;
this
.
selectedItems
.
clear
();
this
.
itemsList
.
forEach
(
item
=>
{
this
.
selectedItems
.
set
(
item
.
institutionId
,
this
.
allSelected
);
});
this
.
someSelected
=
this
.
itemsList
.
some
(
item
=>
this
.
selectedItems
.
get
(
item
.
institutionId
));
}
onCheckboxChange
(
institutionId
:
string
)
{
const
isSelected
=
this
.
selectedItems
.
get
(
institutionId
)
||
false
;
this
.
selectedItems
.
set
(
institutionId
,
!
isSelected
);
this
.
allSelected
=
this
.
itemsList
.
every
(
item
=>
this
.
selectedItems
.
get
(
item
.
institutionId
));
this
.
someSelected
=
this
.
itemsList
.
some
(
item
=>
this
.
selectedItems
.
get
(
item
.
institutionId
));
}
deleteSelect
()
{
let
employeeInfo
=
''
;
this
.
selectedItems
.
forEach
((
isSelected
,
institutionId
)
=>
{
if
(
isSelected
)
{
const
user
=
this
.
itemsList
.
find
(
user
=>
user
.
institutionId
===
institutionId
);
if
(
user
)
{
employeeInfo
+=
`
${
this
.
translate
.
instant
(
'thName'
)}
:
${
user
.
thName
}
\n`
;
}
}
});
swal
({
title
:
"Are you sure?"
,
text
:
employeeInfo
,
icon
:
"warning"
,
dangerMode
:
true
,
buttons
:
[
"Cancel"
,
"Yes, Delete it!"
],
})
.
then
((
willDelete
:
any
)
=>
{
if
(
willDelete
)
{
this
.
selectedItems
.
forEach
((
isSelected
,
institutionId
)
=>
{
if
(
isSelected
)
{
const
user
=
this
.
itemsList
.
find
(
user
=>
user
.
institutionId
===
institutionId
);
if
(
user
)
{
const
newInstitution
=
new
InstitutionModel
(
user
)
this
.
institution
.
deleteInstitution
(
newInstitution
).
subscribe
(
result
=>
{
swal
(
"Save Success!!"
,
"บันทึกข้อมูลสำเร็จ"
,
"success"
);
this
.
ngOnInit
();
});
}
}
});
}
});
}
}
src/app/portal-manage/myjob/myjob.module.ts
View file @
3c399baf
...
...
@@ -185,6 +185,11 @@ export const myjob: Routes = [
loadComponent
:
()
=>
import
(
'./company-department/career-cluster/career-cluster.component'
).
then
((
m
)
=>
m
.
CareerClusterComponent
),
},
{
path
:
'institution'
,
loadComponent
:
()
=>
import
(
'./company-department/institution/institution.component'
).
then
((
m
)
=>
m
.
InstitutionComponent
),
},
...
portalRoutes
],
}
...
...
src/app/portal-manage/services/institution.service.ts
0 → 100644
View file @
3c399baf
import
{
HttpClient
,
HttpHeaders
}
from
'@angular/common/http'
;
import
{
Injectable
}
from
'@angular/core'
;
import
{
Observable
}
from
'rxjs'
;
import
{
environment
}
from
"../../../environments/environment"
;
import
{
InstitutionModel
}
from
'../models/institution.model'
;
@
Injectable
({
providedIn
:
'root'
})
export
class
InstitutionService
{
api
=
"/institution"
urlApi
=
environment
.
baseUrl
+
"/institution"
constructor
(
private
http
:
HttpClient
)
{
}
getById
(
institutionId
:
string
):
Observable
<
InstitutionModel
>
{
return
this
.
http
.
get
<
InstitutionModel
>
(
this
.
urlApi
+
"/"
+
institutionId
)
}
getList
():
Observable
<
InstitutionModel
[]
>
{
return
this
.
http
.
get
<
InstitutionModel
[]
>
(
this
.
urlApi
+
"/lists"
)
}
postInstitution
(
body
:
InstitutionModel
):
Observable
<
any
>
{
return
this
.
http
.
post
(
this
.
urlApi
,
body
)
}
deleteInstitution
(
body
:
InstitutionModel
)
{
const
options
=
{
headers
:
new
HttpHeaders
({
"Content-Type"
:
"application/json"
,
}),
body
:
body
,
};
return
this
.
http
.
delete
(
this
.
urlApi
,
options
)
}
deleteInstitutionById
(
institutionId
:
string
)
{
const
options
=
{
headers
:
new
HttpHeaders
({
"Content-Type"
:
"application/json"
,
}),
body
:
{
institutionId
:
institutionId
},
};
return
this
.
http
.
delete
(
this
.
urlApi
,
options
)
}
}
src/app/shared/services/nav.service.ts
View file @
3c399baf
...
...
@@ -295,6 +295,7 @@ export class NavService implements OnDestroy {
{
path
:
'/myjob/degree-manage'
,
title
:
'จัดการระดับการศึกษา'
,
type
:
'link'
},
{
path
:
'/myjob/country-registration'
,
title
:
'จัดการประเทศ'
,
type
:
'link'
},
{
path
:
'/myjob/provinces'
,
title
:
'จัดการจังหวัด'
,
type
:
'link'
},
{
path
:
'/myjob/institution'
,
title
:
'จัดการสถาบันการศึกษา'
,
type
:
'link'
},
],
},
...
this
.
createPortalMenu
(
'myjob'
)
...
...
src/assets/i18n/en.json
View file @
3c399baf
...
...
@@ -123,5 +123,7 @@
"Management"
:
"Management"
,
"Excerpt"
:
"Excerpt"
,
"Article Contents"
:
"Article Contents"
,
"Publication End Date"
:
"Publication End Date"
"Publication End Date"
:
"Publication End Date"
,
"Institution ID"
:
"Institution ID"
,
"Institution Information"
:
"Institution Information"
}
src/assets/i18n/th.json
View file @
3c399baf
...
...
@@ -123,6 +123,8 @@
"Management"
:
"การจัดการ"
,
"Excerpt"
:
"บทความเเบบย่อ"
,
"Article Contents"
:
"เนื้อหาบทความ"
,
"Publication End Date"
:
"วันที่สิ้นสุดการเผยเเพร่"
"Publication End Date"
:
"วันที่สิ้นสุดการเผยเเพร่"
,
"Institution ID"
:
"รหัสสถาบันการศึกษา"
,
"Institution Information"
:
"ข้อมูลสถาบันการศึกษา"
}
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