Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
myhr-portal
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
myhr-portal
Commits
daa88ded
Commit
daa88ded
authored
Jun 19, 2024
by
Nakarin Luankla
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UPDATE รายการผ่านการอนุมัติ
parent
8750d346
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
396 additions
and
17 deletions
+396
-17
angular.json
angular.json
+1
-1
approve-course.component.html
src/app/apps/approve-course/approve-course.component.html
+4
-1
approve-course.component.ts
src/app/apps/approve-course/approve-course.component.ts
+21
-0
approve-doc.component.html
src/app/apps/approve-doc/approve-doc.component.html
+4
-1
approve-doc.component.ts
src/app/apps/approve-doc/approve-doc.component.ts
+19
-0
approve-excel.component.html
src/app/apps/approve-excel/approve-excel.component.html
+2
-1
approve-excel.component.ts
src/app/apps/approve-excel/approve-excel.component.ts
+19
-0
approved-list.component.html
src/app/apps/approved-list/approved-list.component.html
+26
-0
approved-list.component.scss
src/app/apps/approved-list/approved-list.component.scss
+0
-0
approved-list.component.spec.ts
src/app/apps/approved-list/approved-list.component.spec.ts
+25
-0
approved-list.component.ts
src/app/apps/approved-list/approved-list.component.ts
+82
-0
apps.module.ts
src/app/apps/apps.module.ts
+3
-1
apps.routing.ts
src/app/apps/apps.routing.ts
+45
-0
list-doc.component.ts
src/app/apps/list-doc/list-doc.component.ts
+0
-1
list-excell.component.ts
src/app/apps/list-excell/list-excell.component.ts
+0
-1
portal-category-list-approve.component.ts
...ry-list-approve/portal-category-list-approve.component.ts
+2
-1
view-list-course.component.html
...app/apps/view-list-course/view-list-course.component.html
+5
-1
view-list-course.component.ts
src/app/apps/view-list-course/view-list-course.component.ts
+26
-2
view-list-doc.component.html
src/app/apps/view-list-doc/view-list-doc.component.html
+5
-1
view-list-doc.component.ts
src/app/apps/view-list-doc/view-list-doc.component.ts
+28
-1
view-list-excel.component.html
src/app/apps/view-list-excel/view-list-excel.component.html
+5
-1
view-list-excel.component.ts
src/app/apps/view-list-excel/view-list-excel.component.ts
+25
-1
excel-content.model.ts
src/app/model/excel-content.model.ts
+2
-1
course.service.ts
src/app/service/course.service.ts
+12
-0
document.service.ts
src/app/service/document.service.ts
+12
-0
excel.service.ts
src/app/service/excel.service.ts
+12
-0
vertical-menu-items.ts
src/app/shared/vertical-sidebar/vertical-menu-items.ts
+11
-1
No files found.
angular.json
View file @
daa88ded
...
...
@@ -23,7 +23,7 @@
"build"
:
{
"builder"
:
"@angular-devkit/build-angular:browser"
,
"options"
:
{
"outputPath"
:
"dist
/xtreme-admin-angular
"
,
"outputPath"
:
"dist"
,
"index"
:
"src/index.html"
,
"main"
:
"src/main.ts"
,
"polyfills"
:
"src/polyfills.ts"
,
...
...
src/app/apps/approve-course/approve-course.component.html
View file @
daa88ded
...
...
@@ -22,7 +22,7 @@
</thead>
<tbody>
<tr
*
ngIf=
"listCourse.length == 0"
>
<td
colspan=
"
8
"
class=
"text-center"
>
ไม่พบข้อมูล
</td>
<td
colspan=
"
9
"
class=
"text-center"
>
ไม่พบข้อมูล
</td>
</tr>
<tr
*
ngFor=
"let data of filterListCourse() | slice: (page-1) * pageSize : (page-1) * pageSize + pageSize ; let i = index"
>
<td
class=
"text-center"
>
{{i+1}}
</td>
...
...
@@ -52,6 +52,9 @@
<td>
<button
type=
"button"
class=
"btn btn-circle btn-success rounded-circle btn-sm mr-2"
(
click
)="
onApprove
(
data
)"
><i
class=
"fa fa-check"
></i></button>
<button
type=
"button"
class=
"btn btn-circle btn-danger rounded-circle btn-sm mr-2"
(
click
)="
onCancelApprove
(
data
)"
><i
class=
"fas fa-times"
></i></button>
<button
type=
"button"
class=
"btn btn-circle btn-danger rounded-circle btn-sm mr-2"
(
click
)="
deleteFile
(
data
)"
placement=
"top"
ngbTooltip=
"ลบ"
>
<i
class=
"fas fa-trash-alt"
></i>
</button>
</td>
</tr>
</tbody>
...
...
src/app/apps/approve-course/approve-course.component.ts
View file @
daa88ded
...
...
@@ -84,6 +84,27 @@ export class ApproveCourseComponent implements OnInit {
this
.
getListCourse
();
}
deleteFile
(
item
:
CourseModel
){
const
modalRef
=
this
.
modalService
.
open
(
ConfirmModalComponent
,
{
centered
:
true
,
backdrop
:
'static'
,
})
modalRef
.
componentInstance
.
message
=
'คุณต้องการลบข้อมูลหรือไม่'
modalRef
.
result
.
then
(
result
=>
{
this
.
courseService
.
deleteCourse
(
item
).
subscribe
(
result
=>
{
if
(
result
)
{
this
.
openAlertModal
(
'ลบข้อมูลสำเร็จ'
)
this
.
getListCourse
();
}
else
{
this
.
openAlertModal
(
'ไม่สามารถลบข้อมูลได้'
)
}
},
error
=>
{
this
.
openAlertModal
(
error
.
message
)
})
},
reject
=>
{
})
}
openAlertModal
(
message
?:
string
)
{
const
modalRef
=
this
.
modalService
.
open
(
AlertModalComponent
,
{
centered
:
true
,
...
...
src/app/apps/approve-doc/approve-doc.component.html
View file @
daa88ded
...
...
@@ -23,7 +23,7 @@
</thead>
<tbody>
<tr
*
ngIf=
"listDoc.length == 0"
>
<td
colspan=
"
8
"
class=
"text-center"
>
ไม่พบข้อมูล
</td>
<td
colspan=
"
9
"
class=
"text-center"
>
ไม่พบข้อมูล
</td>
</tr>
<tr
*
ngFor=
"let data of filterListDoc() | slice: (page-1) * pageSize : (page-1) * pageSize + pageSize ; let i = index"
>
<td
class=
"text-center"
>
{{i+1}}
</td>
...
...
@@ -54,6 +54,9 @@
<td>
<button
type=
"button"
class=
"btn btn-circle btn-success rounded-circle btn-sm mr-2"
(
click
)="
onApprove
(
data
)"
><i
class=
"fa fa-check"
></i></button>
<button
type=
"button"
class=
"btn btn-circle btn-danger rounded-circle btn-sm mr-2"
(
click
)="
onCancelApprove
(
data
)"
><i
class=
"fas fa-times"
></i></button>
<button
type=
"button"
class=
"btn btn-circle btn-danger rounded-circle btn-sm mr-2"
(
click
)="
deleteFile
(
data
)"
placement=
"top"
ngbTooltip=
"ลบ"
>
<i
class=
"fas fa-trash-alt"
></i>
</button>
</td>
</tr>
</tbody>
...
...
src/app/apps/approve-doc/approve-doc.component.ts
View file @
daa88ded
...
...
@@ -86,6 +86,25 @@ export class ApproveDocComponent implements OnInit {
ngOnInit
()
{
this
.
getListDoc
();
}
deleteFile
(
item
:
DocumentModel
){
const
modalRef
=
this
.
modalService
.
open
(
ConfirmModalComponent
,
{
centered
:
true
,
backdrop
:
'static'
,
})
modalRef
.
componentInstance
.
message
=
'คุณต้องการลบข้อมูลหรือไม่'
modalRef
.
result
.
then
(
result
=>
{
this
.
documentService
.
deleteExcel
(
item
).
subscribe
(
result
=>
{
if
(
result
)
{
this
.
openAlertModal
(
'ลบข้อมูลสำเร็จ'
)
this
.
getListDoc
();
}
else
{
this
.
openAlertModal
(
'ไม่สามารถลบข้อมูลได้'
)
}
},
error
=>
{
this
.
openAlertModal
(
error
.
message
)
})
},
reject
=>
{
})
}
openAlertModal
(
message
?:
string
)
{
const
modalRef
=
this
.
modalService
.
open
(
AlertModalComponent
,
{
...
...
src/app/apps/approve-excel/approve-excel.component.html
View file @
daa88ded
...
...
@@ -22,7 +22,7 @@
</thead>
<tbody>
<tr
*
ngIf=
"listExcel.length == 0"
>
<td
colspan=
"
7
"
class=
"text-center"
>
ไม่พบข้อมูล
</td>
<td
colspan=
"
8
"
class=
"text-center"
>
ไม่พบข้อมูล
</td>
</tr>
<tr
*
ngFor=
"let data of filterListExcel() | slice: (page-1) * pageSize : (page-1) * pageSize + pageSize ; let i = index"
>
<td
class=
"text-center"
>
{{i+1}}
</td>
...
...
@@ -52,6 +52,7 @@
<td>
<button
type=
"button"
class=
"btn btn-circle btn-success rounded-circle btn-sm mr-2"
(
click
)="
onApprove
(
data
)"
><i
class=
"fa fa-check"
></i></button>
<button
type=
"button"
class=
"btn btn-circle btn-danger rounded-circle btn-sm mr-2"
(
click
)="
onCancelApprove
(
data
)"
><i
class=
"fas fa-times"
></i></button>
<button
type=
"button"
class=
"btn btn-circle btn-danger rounded-circle btn-sm mr-2"
(
click
)="
deleteFile
(
data
)"
placement=
"top"
ngbTooltip=
"ลบ"
><i
class=
"fas fa-trash-alt"
></i></button>
</td>
</tr>
</tbody>
...
...
src/app/apps/approve-excel/approve-excel.component.ts
View file @
daa88ded
...
...
@@ -83,6 +83,25 @@ export class ApproveExcelComponent implements OnInit {
ngOnInit
()
{
this
.
getListExcel
();
}
deleteFile
(
item
:
ExcelModel
){
const
modalRef
=
this
.
modalService
.
open
(
ConfirmModalComponent
,
{
centered
:
true
,
backdrop
:
'static'
,
})
modalRef
.
componentInstance
.
message
=
'คุณต้องการลบข้อมูลหรือไม่'
modalRef
.
result
.
then
(
result
=>
{
this
.
excelService
.
deleteExcel
(
item
).
subscribe
(
result
=>
{
if
(
result
)
{
this
.
openAlertModal
(
'ลบข้อมูลสำเร็จ'
)
this
.
getListExcel
();
}
else
{
this
.
openAlertModal
(
'ไม่สามารถลบข้อมูลได้'
)
}
},
error
=>
{
this
.
openAlertModal
(
error
.
message
)
})
},
reject
=>
{
})
}
openAlertModal
(
message
?:
string
)
{
const
modalRef
=
this
.
modalService
.
open
(
AlertModalComponent
,
{
...
...
src/app/apps/approved-list/approved-list.component.html
0 → 100644
View file @
daa88ded
<div
class=
"row"
>
<div
class=
"col-12"
>
<div
class=
"card card-body"
>
<h4
class=
"card-title"
>
รายการเอกสาร
</h4>
<div
class=
"row justify-content-center"
>
<div
class=
"col-md-4 "
*
ngFor=
"let c of testdata|slice: (page-1) * pageSize : (page-1) * pageSize + pageSize"
>
<div
class=
"card border border-2"
>
<div
class=
"card-body text-center"
>
<img
src=
"{{ c.img }}"
class=
"rounded-circle border p-1"
width=
"100"
>
<h3
class=
"card-title mt-3 mb-0"
>
{{c.name}}
</h3>
</div>
<div
class=
"d-flex justify-content-between bg-light border-top p-3"
>
<div>
<span
class=
"align-middle"
>
จำนวนเอกสาร {{ c.document }} ฉบับ
</span>
</div>
<div
>
<button
class=
"btn btn-info btn-sm text-nowrap"
(
click
)="
openView
(
c
.
id
)"
>
รายละเอียด
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
src/app/apps/approved-list/approved-list.component.scss
0 → 100644
View file @
daa88ded
src/app/apps/approved-list/approved-list.component.spec.ts
0 → 100644
View file @
daa88ded
import
{
ComponentFixture
,
TestBed
}
from
'@angular/core/testing'
;
import
{
ApprovedListComponent
}
from
'./approved-list.component'
;
describe
(
'ApprovedListComponent'
,
()
=>
{
let
component
:
ApprovedListComponent
;
let
fixture
:
ComponentFixture
<
ApprovedListComponent
>
;
beforeEach
(
async
()
=>
{
await
TestBed
.
configureTestingModule
({
declarations
:
[
ApprovedListComponent
]
})
.
compileComponents
();
});
beforeEach
(()
=>
{
fixture
=
TestBed
.
createComponent
(
ApprovedListComponent
);
component
=
fixture
.
componentInstance
;
fixture
.
detectChanges
();
});
it
(
'should create'
,
()
=>
{
expect
(
component
).
toBeTruthy
();
});
});
src/app/apps/approved-list/approved-list.component.ts
0 → 100644
View file @
daa88ded
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
Router
}
from
'@angular/router'
;
import
{
CourseService
}
from
'src/app/service/course.service'
;
import
{
DocumentService
}
from
'src/app/service/document.service'
;
import
{
ExcelService
}
from
'src/app/service/excel.service'
;
@
Component
({
selector
:
'app-approved-list'
,
templateUrl
:
'./approved-list.component.html'
,
styleUrls
:
[
'./approved-list.component.scss'
]
})
export
class
ApprovedListComponent
implements
OnInit
{
constructor
(
private
routes
:
Router
,
private
excelService
:
ExcelService
,
private
documentService
:
DocumentService
,
private
courseService
:
CourseService
)
{}
page
=
1
;
pageSize
=
10
;
testdata
:
{
id
:
string
;
img
:
String
;
name
:
String
;
details
:
String
;
document
:
String
;
}[]
=
[];
ngOnInit
()
{
this
.
testdata
=
[
{
id
:
'1'
,
img
:
"assets/images/icon/excel.png"
,
name
:
"Excel"
,
details
:
"xxxxxxxxxxxxxxxxxxxxxxxxxxx"
,
document
:
"0"
},
{
id
:
'2'
,
img
:
"assets/images/icon/document.png"
,
name
:
"Document"
,
details
:
"xxxxxxxxxxxxxxxxxxxxxxxxxxx"
,
document
:
"0"
},
{
id
:
'3'
,
img
:
"assets/images/icon/course.png"
,
name
:
"Course"
,
details
:
"xxxxxxxxxxxxxxxxxxxxxxxxxxx"
,
document
:
"0"
},
];
this
.
getListCount
();
}
async
getListCount
(){
try
{
const
countExcel
=
await
this
.
excelService
.
getCountContent
().
toPromise
();
const
countDoc
=
await
this
.
documentService
.
getCountContent
().
toPromise
();
const
countCourse
=
await
this
.
courseService
.
getCountContent
().
toPromise
();
this
.
testdata
.
forEach
((
x
,
i
)
=>
{
if
(
i
==
0
){
x
.
document
=
countExcel
.
toString
()
}
else
if
(
i
==
1
){
x
.
document
=
countDoc
.
toString
()
}
else
if
(
i
==
2
){
x
.
document
=
countCourse
.
toString
()
}
})
}
catch
(
error
)
{
console
.
error
(
'Error loading data:'
,
error
);
}
}
openView
(
id
:
string
){
if
(
id
==
'1'
){
this
.
routes
.
navigate
([
'apps/view-list-excel/1'
]);
}
else
if
(
id
==
'2'
){
this
.
routes
.
navigate
([
'apps/view-list-doc/1'
]);
}
else
if
(
id
==
'3'
){
this
.
routes
.
navigate
([
'apps/view-list-course/1'
]);
}
}
}
src/app/apps/apps.module.ts
View file @
daa88ded
...
...
@@ -94,6 +94,7 @@ import { ViewListExcelComponent } from './view-list-excel/view-list-excel.compon
import
{
ViewListDocComponent
}
from
'./view-list-doc/view-list-doc.component'
;
import
{
ViewListCourseComponent
}
from
'./view-list-course/view-list-course.component'
;
import
{
TagInputModule
}
from
'ngx-chips'
;
import
{
ApprovedListComponent
}
from
'./approved-list/approved-list.component'
;
@
NgModule
({
...
...
@@ -165,7 +166,8 @@ import { TagInputModule } from 'ngx-chips';
ApproveCourseComponent
,
ViewListExcelComponent
,
ViewListDocComponent
,
ViewListCourseComponent
ViewListCourseComponent
,
ApprovedListComponent
],
providers
:
[
ContactService
,
...
...
src/app/apps/apps.routing.ts
View file @
daa88ded
...
...
@@ -46,6 +46,7 @@ import { ApproveCourseComponent } from "./approve-course/approve-course.componen
import
{
ViewListCourseComponent
}
from
"./view-list-course/view-list-course.component"
;
import
{
ViewListExcelComponent
}
from
"./view-list-excel/view-list-excel.component"
;
import
{
ViewListDocComponent
}
from
"./view-list-doc/view-list-doc.component"
;
import
{
ApprovedListComponent
}
from
"./approved-list/approved-list.component"
;
export
const
AppsRoutes
:
Routes
=
[
{
path
:
""
,
...
...
@@ -231,6 +232,17 @@ export const AppsRoutes: Routes = [
},
},
{
path
:
"approved-list"
,
component
:
ApprovedListComponent
,
data
:
{
title
:
"รายการเอกสารผ่านการอนุมัติ"
,
urls
:
[
{
title
:
"รายการเอกสารผ่านการอนุมัติ"
,
url
:
"apps/portal-category-list-approve"
},
{
title
:
"อนุมัติหลักสูตร"
},
],
},
},
{
path
:
"portal-template-approve"
,
component
:
PortalTemplateApproveComponent
,
data
:
{
...
...
@@ -262,6 +274,17 @@ export const AppsRoutes: Routes = [
},
},
{
path
:
"view-list-excel/:type"
,
component
:
ViewListExcelComponent
,
data
:
{
title
:
"รายการ Excel"
,
urls
:
[
{
title
:
"รายการเอกสาร"
,
url
:
"apps/portal-category-list"
},
{
title
:
"รายการ Excel"
}
],
},
},
{
path
:
"view-list-doc"
,
component
:
ViewListDocComponent
,
data
:
{
...
...
@@ -273,6 +296,17 @@ export const AppsRoutes: Routes = [
},
},
{
path
:
"view-list-doc/:type"
,
component
:
ViewListDocComponent
,
data
:
{
title
:
"รายการเอกสาร"
,
urls
:
[
{
title
:
"รายการเอกสาร"
,
url
:
"apps/portal-category-list"
},
{
title
:
"รายการเอกสาร"
}
],
},
},
{
path
:
"view-list-course"
,
component
:
ViewListCourseComponent
,
data
:
{
...
...
@@ -284,6 +318,17 @@ export const AppsRoutes: Routes = [
},
},
{
path
:
"view-list-course/:type"
,
component
:
ViewListCourseComponent
,
data
:
{
title
:
"รายการหลักสูตร"
,
urls
:
[
{
title
:
"รายการเอกสาร"
,
url
:
"apps/portal-category-list"
},
{
title
:
"รายการหลักสูตร"
}
],
},
},
{
path
:
"portal-template-list"
,
component
:
PortalTemplateListComponent
,
data
:
{
...
...
src/app/apps/list-doc/list-doc.component.ts
View file @
daa88ded
...
...
@@ -94,7 +94,6 @@ export class ListDocComponent implements OnInit {
this
.
openAlertModal
(
error
.
message
)
})
},
reject
=>
{
})
}
openAlertModal
(
message
?:
string
)
{
const
modalRef
=
this
.
modalService
.
open
(
AlertModalComponent
,
{
...
...
src/app/apps/list-excell/list-excell.component.ts
View file @
daa88ded
...
...
@@ -102,7 +102,6 @@ export class ListExcelComponent implements OnInit {
this
.
openAlertModal
(
error
.
message
)
})
},
reject
=>
{
})
}
openAlertModal
(
message
?:
string
)
{
const
modalRef
=
this
.
modalService
.
open
(
AlertModalComponent
,
{
...
...
src/app/apps/portal-category-list-approve/portal-category-list-approve.component.ts
View file @
daa88ded
...
...
@@ -55,6 +55,8 @@ export class PortalCategoryListApproveComponent implements OnInit {
document
:
"0"
},
];
this
.
getListCount
();
}
openView
(
id
:
string
){
if
(
id
==
'1'
){
...
...
@@ -64,7 +66,6 @@ export class PortalCategoryListApproveComponent implements OnInit {
}
else
if
(
id
==
'3'
){
this
.
router
.
navigate
([
'apps/approve-course'
]);
}
this
.
getListCount
();
}
async
getListCount
(){
try
{
...
...
src/app/apps/view-list-course/view-list-course.component.html
View file @
daa88ded
...
...
@@ -17,11 +17,12 @@
<th
scope=
"col"
>
ลิงค์
</th>
<th
scope=
"col"
>
สถานะ
</th>
<th
scope=
"col"
class=
"text-center"
>
จำนวนดาวน์โหลด
</th>
<th
scope=
"col"
*
ngIf=
"checkType == '1'"
></th>
</tr>
</thead>
<tbody>
<tr
*
ngIf=
"listCourse.length == 0"
>
<td
colspan=
"
8
"
class=
"text-center"
>
ไม่พบข้อมูล
</td>
<td
colspan=
"
{{checkType == '1' ? '9' : '8'}}
"
class=
"text-center"
>
ไม่พบข้อมูล
</td>
</tr>
<tr
*
ngFor=
"let data of filterListCourse() | slice: (page-1) * pageSize : (page-1) * pageSize + pageSize ; let i = index"
>
<td
class=
"text-center"
>
{{i+1}}
</td>
...
...
@@ -32,6 +33,9 @@
<td
class=
"text-center"
><i
class=
"fas fa-link pointer"
(
click
)="
openLink
(
data
.
link1
)"
></i></td>
<td
class=
"text-center"
>
<i
class=
"fas fa-download pointer"
(
click
)="
downloadFile
(
data
.
courseId
)"
></i></td>
<td
class=
"text-center"
>
{{data.dwTime}} ครั้ง
</td>
<td
*
ngIf=
"checkType == '1'"
>
<button
type=
"button"
class=
"btn btn-circle btn-danger rounded-circle btn-sm mr-2"
(
click
)="
deleteFile
(
data
)"
placement=
"top"
ngbTooltip=
"ลบ"
><i
class=
"fas fa-trash-alt"
></i></button>
</td>
</tr>
</tbody>
</table>
...
...
src/app/apps/view-list-course/view-list-course.component.ts
View file @
daa88ded
...
...
@@ -4,6 +4,8 @@ import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import
{
CourseService
}
from
'src/app/service/course.service'
;
import
{
CourseModel
}
from
'src/app/model/course.model'
;
import
{
CourseContentModel
}
from
'src/app/model/course-content.model'
;
import
{
ActivatedRoute
}
from
'@angular/router'
;
import
{
ConfirmModalComponent
}
from
'../confirm-modal/confirm-modal.component'
;
declare
var
require
:
any
const
FileSaver
=
require
(
'file-saver'
);
@
Component
({
...
...
@@ -16,7 +18,11 @@ export class ViewListCourseComponent implements OnInit {
pageSize
=
10
;
listCourse
:
CourseContentModel
[]
=
[]
search
:
string
=
''
constructor
(
private
modalService
:
NgbModal
,
private
courseService
:
CourseService
)
{
checkType
:
string
=
'0'
constructor
(
private
modalService
:
NgbModal
,
private
courseService
:
CourseService
,
private
activatedRoute
:
ActivatedRoute
)
{
this
.
activatedRoute
.
paramMap
.
subscribe
(
result
=>
{
this
.
checkType
=
result
.
get
(
"type"
)
!
;
});
}
async
downloadFile
(
logId
:
string
){
try
{
...
...
@@ -40,7 +46,25 @@ export class ViewListCourseComponent implements OnInit {
console
.
error
(
'Error loading data:'
,
error
);
}
}
deleteFile
(
item
:
CourseContentModel
){
const
modalRef
=
this
.
modalService
.
open
(
ConfirmModalComponent
,
{
centered
:
true
,
backdrop
:
'static'
,
})
modalRef
.
componentInstance
.
message
=
'คุณต้องการลบข้อมูลหรือไม่'
modalRef
.
result
.
then
(
result
=>
{
this
.
courseService
.
deleteCourseContent
(
item
).
subscribe
(
result
=>
{
if
(
result
)
{
this
.
openAlertModal
(
'ลบข้อมูลสำเร็จ'
)
this
.
getListCourse
();
}
else
{
this
.
openAlertModal
(
'ไม่สามารถลบข้อมูลได้'
)
}
},
error
=>
{
this
.
openAlertModal
(
error
.
message
)
})
},
reject
=>
{
})
}
ngOnInit
()
{
this
.
getListCourse
();
}
...
...
src/app/apps/view-list-doc/view-list-doc.component.html
View file @
daa88ded
...
...
@@ -18,11 +18,12 @@
<th
scope=
"col"
class=
"text-center"
>
ไฟล์ (ไทย)
</th>
<th
scope=
"col"
class=
"text-center"
>
ไฟล์ (อังกฤษ)
</th>
<th
scope=
"col"
class=
"text-center"
>
จำนวนดาวน์โหลด
</th>
<th
scope=
"col"
*
ngIf=
"checkType == '1'"
></th>
</tr>
</thead>
<tbody>
<tr
*
ngIf=
"listDoc.length == 0"
>
<td
colspan=
"
7
"
class=
"text-center"
>
ไม่พบข้อมูล
</td>
<td
colspan=
"
{{checkType == '1' ? '9' : '10'}}
"
class=
"text-center"
>
ไม่พบข้อมูล
</td>
</tr>
<tr
*
ngFor=
"let data of filterListDoc() | slice: (page-1) * pageSize : (page-1) * pageSize + pageSize ; let i = index"
>
<td
class=
"text-center"
>
{{i+1}}
</td>
...
...
@@ -34,6 +35,9 @@
<td
class=
"text-center"
>
<i
class=
"fas fa-download pointer"
(
click
)="
downloadFile
(
data
.
docId
,'
tha
')"
></i></td>
<td
class=
"text-center"
>
<i
class=
"fas fa-download pointer"
(
click
)="
downloadFile
(
data
.
docId
,'
eng
')"
></i></td>
<td
class=
"text-center"
>
{{data.dwTime}} ครั้ง
</td>
<td
*
ngIf=
"checkType == '1'"
>
<button
type=
"button"
class=
"btn btn-circle btn-danger rounded-circle btn-sm mr-2"
(
click
)="
deleteFile
(
data
)"
placement=
"top"
ngbTooltip=
"ลบ"
><i
class=
"fas fa-trash-alt"
></i></button>
</td>
</tr>
</tbody>
</table>
...
...
src/app/apps/view-list-doc/view-list-doc.component.ts
View file @
daa88ded
...
...
@@ -3,6 +3,8 @@ import { AlertModalComponent } from '../alert-modal/alert-modal.component';
import
{
NgbModal
}
from
'@ng-bootstrap/ng-bootstrap'
;
import
{
DocumentService
}
from
'src/app/service/document.service'
;
import
{
DocumentContentModel
}
from
'src/app/model/document-content.model'
;
import
{
ActivatedRoute
}
from
'@angular/router'
;
import
{
ConfirmModalComponent
}
from
'../confirm-modal/confirm-modal.component'
;
declare
var
require
:
any
const
FileSaver
=
require
(
'file-saver'
);
@
Component
({
...
...
@@ -15,8 +17,33 @@ export class ViewListDocComponent implements OnInit {
pageSize
=
10
;
listDoc
:
DocumentContentModel
[]
=
[]
search
:
string
=
''
constructor
(
private
modalService
:
NgbModal
,
private
documentService
:
DocumentService
)
{
checkType
:
string
=
'0'
constructor
(
private
modalService
:
NgbModal
,
private
documentService
:
DocumentService
,
private
activatedRoute
:
ActivatedRoute
)
{
this
.
activatedRoute
.
paramMap
.
subscribe
(
result
=>
{
this
.
checkType
=
result
.
get
(
"type"
)
!
;
});
}
deleteFile
(
item
:
DocumentContentModel
){
const
modalRef
=
this
.
modalService
.
open
(
ConfirmModalComponent
,
{
centered
:
true
,
backdrop
:
'static'
,
})
modalRef
.
componentInstance
.
message
=
'คุณต้องการลบข้อมูลหรือไม่'
modalRef
.
result
.
then
(
result
=>
{
this
.
documentService
.
deleteExcelContent
(
item
).
subscribe
(
result
=>
{
if
(
result
)
{
this
.
openAlertModal
(
'ลบข้อมูลสำเร็จ'
)
this
.
getListDoc
();
}
else
{
this
.
openAlertModal
(
'ไม่สามารถลบข้อมูลได้'
)
}
},
error
=>
{
this
.
openAlertModal
(
error
.
message
)
})
},
reject
=>
{
})
}
async
downloadFile
(
logId
:
string
,
lang
:
string
){
try
{
const
data
=
await
this
.
documentService
.
downloadFileContent
(
logId
,
lang
).
toPromise
();
...
...
src/app/apps/view-list-excel/view-list-excel.component.html
View file @
daa88ded
...
...
@@ -17,11 +17,12 @@
<th
scope=
"col"
class=
"text-center"
>
ลิงค์
</th>
<th
scope=
"col"
class=
"text-center"
>
ไฟล์
</th>
<th
scope=
"col"
class=
"text-center"
>
จำนวนดาวน์โหลด
</th>
<th
scope=
"col"
*
ngIf=
"checkType == '1'"
></th>
</tr>
</thead>
<tbody>
<tr
*
ngIf=
"listExcel.length == 0"
>
<td
colspan=
"
7
"
class=
"text-center"
>
ไม่พบข้อมูล
</td>
<td
colspan=
"
{{checkType == '1' ? '8' : '7'}}
"
class=
"text-center"
>
ไม่พบข้อมูล
</td>
</tr>
<tr
*
ngFor=
"let data of filterListExcel() | slice: (page-1) * pageSize : (page-1) * pageSize + pageSize ; let i = index"
>
<td
class=
"text-center"
>
{{i+1}}
</td>
...
...
@@ -32,6 +33,9 @@
<td
class=
"text-center"
><i
class=
"fas fa-link pointer"
(
click
)="
openLink
(
data
.
link1
)"
></i></td>
<td
class=
"text-center"
>
<i
class=
"fas fa-download pointer"
(
click
)="
downloadFile
(
data
.
excelId
)"
></i></td>
<td
class=
"text-center"
>
{{data.dwTime}} ครั้ง
</td>
<td
*
ngIf=
"checkType == '1'"
>
<button
type=
"button"
class=
"btn btn-circle btn-danger rounded-circle btn-sm mr-2"
(
click
)="
deleteFile
(
data
)"
placement=
"top"
ngbTooltip=
"ลบ"
><i
class=
"fas fa-trash-alt"
></i></button>
</td>
</tr>
</tbody>
</table>
...
...
src/app/apps/view-list-excel/view-list-excel.component.ts
View file @
daa88ded
...
...
@@ -4,6 +4,7 @@ import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import
{
ExcelService
}
from
'src/app/service/excel.service'
;
import
{
AlertModalComponent
}
from
'../alert-modal/alert-modal.component'
;
import
{
ExcelContentModel
}
from
'src/app/model/excel-content.model'
;
import
{
ActivatedRoute
}
from
'@angular/router'
;
declare
var
require
:
any
const
FileSaver
=
require
(
'file-saver'
);
@
Component
({
...
...
@@ -16,7 +17,30 @@ export class ViewListExcelComponent implements OnInit {
pageSize
=
10
;
listExcel
:
ExcelContentModel
[]
=
[]
search
:
string
=
''
constructor
(
private
modalService
:
NgbModal
,
private
excelService
:
ExcelService
)
{
checkType
:
string
=
'0'
constructor
(
private
modalService
:
NgbModal
,
private
excelService
:
ExcelService
,
private
activatedRoute
:
ActivatedRoute
,)
{
this
.
activatedRoute
.
paramMap
.
subscribe
(
result
=>
{
this
.
checkType
=
result
.
get
(
"type"
)
!
;
});
}
deleteFile
(
item
:
ExcelContentModel
){
const
modalRef
=
this
.
modalService
.
open
(
ConfirmModalComponent
,
{
centered
:
true
,
backdrop
:
'static'
,
})
modalRef
.
componentInstance
.
message
=
'คุณต้องการลบข้อมูลหรือไม่'
modalRef
.
result
.
then
(
result
=>
{
this
.
excelService
.
deleteExcelContent
(
item
).
subscribe
(
result
=>
{
if
(
result
)
{
this
.
openAlertModal
(
'ลบข้อมูลสำเร็จ'
)
this
.
getListExcel
();
}
else
{
this
.
openAlertModal
(
'ไม่สามารถลบข้อมูลได้'
)
}
},
error
=>
{
this
.
openAlertModal
(
error
.
message
)
})
},
reject
=>
{
})
}
async
downloadFile
(
logId
:
string
){
try
{
...
...
src/app/model/excel-content.model.ts
View file @
daa88ded
import
{
environment
}
from
"src/environments/environment"
export
interface
ExcelContentModel
{
excelId
:
string
export
interface
ExcelContentModel
{
excelId
:
string
thName
:
string
engName
:
string
thDesc
:
string
...
...
src/app/service/course.service.ts
View file @
daa88ded
...
...
@@ -57,6 +57,18 @@ export class CourseService {
}
return
this
.
http
.
delete
<
any
>
(
this
.
url
+
'course-center/upload'
,
option
)
}
deleteCourseContent
(
model
:
CourseContentModel
):
Observable
<
any
>
{
let
body
=
{
courseId
:
model
.
courseId
}
let
option
=
{
headers
:
new
HttpHeaders
({
"Content-Type"
:
"application/json"
,
}),
body
:
body
}
return
this
.
http
.
delete
<
any
>
(
this
.
url
+
'course-center/content'
,
option
)
}
approve
(
model
:
CourseModel
):
Observable
<
any
>
{
let
body
=
{
logId
:
model
.
logId
,
...
...
src/app/service/document.service.ts
View file @
daa88ded
...
...
@@ -57,6 +57,18 @@ export class DocumentService {
}
return
this
.
http
.
delete
<
any
>
(
this
.
url
+
'document-center/upload'
,
option
)
}
deleteExcelContent
(
model
:
DocumentContentModel
):
Observable
<
any
>
{
let
body
=
{
docId
:
model
.
docId
}
let
option
=
{
headers
:
new
HttpHeaders
({
"Content-Type"
:
"application/json"
,
}),
body
:
body
}
return
this
.
http
.
delete
<
any
>
(
this
.
url
+
'document-center/content'
,
option
)
}
approve
(
model
:
DocumentModel
):
Observable
<
any
>
{
let
body
=
{
logId
:
model
.
logId
,
...
...
src/app/service/excel.service.ts
View file @
daa88ded
...
...
@@ -58,6 +58,18 @@ export class ExcelService {
}
return
this
.
http
.
delete
<
any
>
(
this
.
url
+
'excel-center/upload'
,
option
)
}
deleteExcelContent
(
model
:
ExcelContentModel
):
Observable
<
any
>
{
let
body
=
{
excelId
:
model
.
excelId
}
let
option
=
{
headers
:
new
HttpHeaders
({
"Content-Type"
:
"application/json"
,
}),
body
:
body
}
return
this
.
http
.
delete
<
any
>
(
this
.
url
+
'excel-center/content'
,
option
)
}
approve
(
model
:
ExcelModel
):
Observable
<
any
>
{
let
body
=
{
logId
:
model
.
logId
,
...
...
src/app/shared/vertical-sidebar/vertical-menu-items.ts
View file @
daa88ded
...
...
@@ -53,7 +53,17 @@ export const ROUTES: RouteInfo[] = [
submenu
:
[
{
path
:
'/apps/portal-category-list-approve'
,
title
:
'รายการอนุมัติ'
,
title
:
'รายการรอการอนุมัติ'
,
icon
:
''
,
class
:
''
,
label
:
""
,
labelClass
:
""
,
extralink
:
false
,
submenu
:
[]
},
{
path
:
'/apps/approved-list'
,
title
:
'รายการผ่านการอนุมัติ'
,
icon
:
''
,
class
:
''
,
label
:
""
,
...
...
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