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
fddf6930
Commit
fddf6930
authored
Jan 14, 2025
by
Nakarin Luankla
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UPDATE widgets
parent
dde94786
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
300 additions
and
12 deletions
+300
-12
apps.module.ts
src/app/apps/apps.module.ts
+3
-1
apps.routing.ts
src/app/apps/apps.routing.ts
+12
-0
list-widgets.component.html
src/app/apps/list-widgets/list-widgets.component.html
+79
-2
list-widgets.component.ts
src/app/apps/list-widgets/list-widgets.component.ts
+45
-1
portal-category-list.component.ts
...ps/portal-category-list/portal-category-list.component.ts
+12
-5
portal-create-category.component.ts
...ortal-create-category/portal-create-category.component.ts
+2
-2
view-list-widgets.component.html
...p/apps/view-list-widgets/view-list-widgets.component.html
+25
-0
view-list-widgets.component.scss
...p/apps/view-list-widgets/view-list-widgets.component.scss
+0
-0
view-list-widgets.component.ts
...app/apps/view-list-widgets/view-list-widgets.component.ts
+85
-0
widgets.model.ts
src/app/model/widgets.model.ts
+30
-0
widgets.service.ts
src/app/service/widgets.service.ts
+3
-1
widget.png
src/assets/images/icon/widget.png
+0
-0
styles.scss
src/styles.scss
+4
-0
No files found.
src/app/apps/apps.module.ts
View file @
fddf6930
...
@@ -97,6 +97,7 @@ import { TagInputModule } from 'ngx-chips';
...
@@ -97,6 +97,7 @@ import { TagInputModule } from 'ngx-chips';
import
{
ApprovedListComponent
}
from
'./approved-list/approved-list.component'
;
import
{
ApprovedListComponent
}
from
'./approved-list/approved-list.component'
;
import
{
OpenImageComponent
}
from
'./open-image/open-image.component'
;
import
{
OpenImageComponent
}
from
'./open-image/open-image.component'
;
import
{
ListWidgetsComponent
}
from
'./list-widgets/list-widgets.component'
;
import
{
ListWidgetsComponent
}
from
'./list-widgets/list-widgets.component'
;
import
{
ViewListWidgetsComponent
}
from
'./view-list-widgets/view-list-widgets.component'
;
@
NgModule
({
@
NgModule
({
...
@@ -171,7 +172,8 @@ import { ListWidgetsComponent } from './list-widgets/list-widgets.component';
...
@@ -171,7 +172,8 @@ import { ListWidgetsComponent } from './list-widgets/list-widgets.component';
ViewListCourseComponent
,
ViewListCourseComponent
,
ApprovedListComponent
,
ApprovedListComponent
,
OpenImageComponent
,
OpenImageComponent
,
ListWidgetsComponent
ListWidgetsComponent
,
ViewListWidgetsComponent
],
],
providers
:
[
providers
:
[
ContactService
,
ContactService
,
...
...
src/app/apps/apps.routing.ts
View file @
fddf6930
...
@@ -48,6 +48,7 @@ import { ViewListExcelComponent } from "./view-list-excel/view-list-excel.compon
...
@@ -48,6 +48,7 @@ import { ViewListExcelComponent } from "./view-list-excel/view-list-excel.compon
import
{
ViewListDocComponent
}
from
"./view-list-doc/view-list-doc.component"
;
import
{
ViewListDocComponent
}
from
"./view-list-doc/view-list-doc.component"
;
import
{
ApprovedListComponent
}
from
"./approved-list/approved-list.component"
;
import
{
ApprovedListComponent
}
from
"./approved-list/approved-list.component"
;
import
{
ListWidgetsComponent
}
from
"./list-widgets/list-widgets.component"
;
import
{
ListWidgetsComponent
}
from
"./list-widgets/list-widgets.component"
;
import
{
ViewListWidgetsComponent
}
from
"./view-list-widgets/view-list-widgets.component"
;
export
const
AppsRoutes
:
Routes
=
[
export
const
AppsRoutes
:
Routes
=
[
{
{
path
:
""
,
path
:
""
,
...
@@ -330,6 +331,17 @@ export const AppsRoutes: Routes = [
...
@@ -330,6 +331,17 @@ export const AppsRoutes: Routes = [
},
},
},
},
{
{
path
:
"view-list-widgets"
,
component
:
ViewListWidgetsComponent
,
data
:
{
title
:
"รายการวิทเจ็ท"
,
urls
:
[
{
title
:
"รายการเอกสาร"
,
url
:
"apps/portal-category-list"
},
{
title
:
"รายการวิทเจ็ท"
}
],
},
},
{
path
:
"portal-template-list"
,
path
:
"portal-template-list"
,
component
:
PortalTemplateListComponent
,
component
:
PortalTemplateListComponent
,
data
:
{
data
:
{
...
...
src/app/apps/list-widgets/list-widgets.component.html
View file @
fddf6930
...
@@ -15,6 +15,8 @@
...
@@ -15,6 +15,8 @@
<!-- <th scope="col">รหัสเอกสาร</th> -->
<!-- <th scope="col">รหัสเอกสาร</th> -->
<th
scope=
"col"
>
ชื่อ
</th>
<th
scope=
"col"
>
ชื่อ
</th>
<th
scope=
"col"
>
รายละเอียด
</th>
<th
scope=
"col"
>
รายละเอียด
</th>
<th
scope=
"col"
class=
"text-center"
>
ลิงค์
</th>
<th
scope=
"col"
class=
"text-center"
>
ไฟล์
</th>
<th
scope=
"col"
class=
"text-center"
>
สถานะ
</th>
<th
scope=
"col"
class=
"text-center"
>
สถานะ
</th>
<th
scope=
"col"
></th>
<th
scope=
"col"
></th>
</tr>
</tr>
...
@@ -26,7 +28,8 @@
...
@@ -26,7 +28,8 @@
<!-- <td >{{data.id}}</td> -->
<!-- <td >{{data.id}}</td> -->
<td>
{{ data.widgetTname }}
</td>
<td>
{{ data.widgetTname }}
</td>
<td>
{{ data.thDesc }}
</td>
<td>
{{ data.thDesc }}
</td>
<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
.
widgetId
)"
></i></td>
<td
class=
"text-center"
>
<td
class=
"text-center"
>
<span
class=
"fa-stack rt_anim"
*
ngIf=
"data.status == '0'"
ngbTooltip=
"Private"
container=
"body"
tooltipClass=
"myhrcolor-1"
>
<span
class=
"fa-stack rt_anim"
*
ngIf=
"data.status == '0'"
ngbTooltip=
"Private"
container=
"body"
tooltipClass=
"myhrcolor-1"
>
...
@@ -121,6 +124,29 @@
...
@@ -121,6 +124,29 @@
<!-- <input type="text" class="form-control" id="nameeng" [(ngModel)]="modelDoc.langSupport"> -->
<!-- <input type="text" class="form-control" id="nameeng" [(ngModel)]="modelDoc.langSupport"> -->
</div>
</div>
</div>
</div>
<div
class=
"form-group row"
>
<label
for=
"position"
class=
"col-sm-4 col-form-label"
>
ดาต้าเบสที่รองรับ
</label>
<div
class=
"col-sm-8"
>
<select
class=
"custom-select"
[(
ngModel
)]="
modelWidget
.
dbSupport
"
>
<option
value=
"SQLServer"
>
SQLServer
</option>
<option
value=
"PostgreSQL"
>
PostgreSQL
</option>
<option
value=
"Oracle"
>
Oracle
</option>
</select>
<!-- <input type="text" class="form-control" id="nameeng" [(ngModel)]="modelWidget.dbSupport"> -->
</div>
</div>
<div
class=
"form-group row"
>
<label
for=
"name"
class=
"col-sm-4 col-form-label"
>
ไฟล์อัพโหลด
</label>
<div
class=
"{{!modelWidget.widgetObj||!checkEdit ? 'col-sm-8' : 'col-sm-6'}}"
>
<input
type=
"file"
class=
"form-control"
(
change
)="
onSelectFile
($
event
)"
>
<div
class=
"msg-detail"
>
ไฟล์ที่อนุญาต:*.xlsx *.xlsm
</div>
</div>
<div
class=
"col-auto"
*
ngIf=
"modelWidget.widgetObj&&checkEdit"
>
<button
class=
"btn btn-primary"
(
click
)="
downloadFile
(
modelWidget
.
widgetId
)"
><i
class=
"fas fa-download"
></i></button>
</div>
</div>
<div
class=
"form-group row"
>
<div
class=
"form-group row"
>
<label
for=
"name"
class=
"col-sm-4 col-form-label"
>
รูปภาพตัวอย่าง
</label>
<label
for=
"name"
class=
"col-sm-4 col-form-label"
>
รูปภาพตัวอย่าง
</label>
...
@@ -129,7 +155,14 @@
...
@@ -129,7 +155,14 @@
<div
class=
"msg-detail"
>
ไฟล์ที่อนุญาต:*.jpeg, *.jpg, *.png
</div>
<div
class=
"msg-detail"
>
ไฟล์ที่อนุญาต:*.jpeg, *.jpg, *.png
</div>
</div>
</div>
</div>
</div>
<div
class=
"form-group row"
>
<label
for=
"name"
class=
"col-sm-4 col-form-label"
>
Link ตัวอย่าง
</label>
<div
class=
"col-sm-8"
>
<input
type=
"text"
class=
"form-control"
id=
"nameeng"
[(
ngModel
)]="
modelWidget
.
link1
"
>
</div>
</div>
<div
class=
"form-group row"
>
<div
class=
"form-group row"
>
<label
for=
"name"
class=
"col-sm-4 col-form-label"
>
แท็ก
</label>
<label
for=
"name"
class=
"col-sm-4 col-form-label"
>
แท็ก
</label>
<div
class=
"col-sm-8"
>
<div
class=
"col-sm-8"
>
...
@@ -140,6 +173,50 @@
...
@@ -140,6 +173,50 @@
</tag-input>
</tag-input>
</div>
</div>
</div>
</div>
<div
class=
"form-group row"
>
<label
for=
"position"
class=
"col-sm-4 col-form-label"
>
กลุ่ม
</label>
<div
class=
"col-sm-8"
>
<select
class=
"custom-select"
[(
ngModel
)]="
modelWidget
.
group
.
groupId
"
(
change
)="
selectGroup
()"
>
<option
*
ngFor=
"let item of listGroup"
[
ngValue
]="
item
.
groupId
"
>
{{item.thName}}
</option>
</select>
</div>
</div>
<div
class=
"form-group row"
>
<label
for=
"position"
class=
"col-sm-4 col-form-label"
>
แสดงรูปแบบ Pivot
</label>
<div
class=
"col-sm-8 d-flex"
>
<div
class=
"form-check form-check-inline"
>
<div
class=
"custom-control custom-radio"
>
<input
type=
"radio"
class=
"custom-control-input"
id=
"pivot0"
name=
"radio-pivot"
[
value
]="
0
"
[(
ngModel
)]="
modelWidget
.
isPivot
"
>
<label
class=
"custom-control-label"
for=
"pivot0"
>
ใช่
</label>
</div>
</div>
<div
class=
"form-check form-check-inline"
>
<div
class=
"custom-control custom-radio"
>
<input
type=
"radio"
class=
"custom-control-input"
id=
"pivot1"
name=
"radio-pivot"
[
value
]="
1
"
[(
ngModel
)]="
modelWidget
.
isPivot
"
>
<label
class=
"custom-control-label"
for=
"pivot1"
>
ไม่ใช่
</label>
</div>
</div>
</div>
</div>
<div
class=
"form-group row"
>
<label
for=
"position"
class=
"col-sm-4 col-form-label"
>
แสดงรูปแบบ DataGrid
</label>
<div
class=
"col-sm-8 d-flex"
>
<div
class=
"form-check form-check-inline"
>
<div
class=
"custom-control custom-radio"
>
<input
type=
"radio"
class=
"custom-control-input"
id=
"datagrid"
name=
"datagridCheck"
[
value
]="
0
"
[(
ngModel
)]="
modelWidget
.
isDataGrid
"
>
<label
class=
"custom-control-label"
for=
"datagrid"
>
ใช่
</label>
</div>
</div>
<div
class=
"form-check form-check-inline"
>
<div
class=
"custom-control custom-radio"
>
<input
type=
"radio"
class=
"custom-control-input"
id=
"datagrid1"
name=
"datagridCheck"
[
value
]="
1
"
[(
ngModel
)]="
modelWidget
.
isDataGrid
"
>
<label
class=
"custom-control-label"
for=
"datagrid1"
>
ไม่ใช่
</label>
</div>
</div>
</div>
</div>
<div
class=
"form-group row"
>
<div
class=
"form-group row"
>
<label
for=
"position"
class=
"col-sm-4 col-form-label"
>
หมายเหตุ
</label>
<label
for=
"position"
class=
"col-sm-4 col-form-label"
>
หมายเหตุ
</label>
...
...
src/app/apps/list-widgets/list-widgets.component.ts
View file @
fddf6930
...
@@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core';
...
@@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core';
import
{
NgbModal
}
from
'@ng-bootstrap/ng-bootstrap'
;
import
{
NgbModal
}
from
'@ng-bootstrap/ng-bootstrap'
;
import
{
ConfirmModalComponent
}
from
'../confirm-modal/confirm-modal.component'
;
import
{
ConfirmModalComponent
}
from
'../confirm-modal/confirm-modal.component'
;
import
{
AlertModalComponent
}
from
'../alert-modal/alert-modal.component'
;
import
{
AlertModalComponent
}
from
'../alert-modal/alert-modal.component'
;
import
{
DocumentModel
}
from
'src/app/model/document.model'
;
import
{
UploadService
}
from
'src/app/service/upload.service'
;
import
{
UploadService
}
from
'src/app/service/upload.service'
;
import
{
TagService
}
from
'src/app/service/tag.service'
;
import
{
TagService
}
from
'src/app/service/tag.service'
;
import
{
TagModel
}
from
'src/app/model/tag.mmodel'
;
import
{
TagModel
}
from
'src/app/model/tag.mmodel'
;
...
@@ -26,11 +25,55 @@ export class ListWidgetsComponent implements OnInit {
...
@@ -26,11 +25,55 @@ export class ListWidgetsComponent implements OnInit {
checkEdit
:
boolean
=
false
checkEdit
:
boolean
=
false
search
:
string
=
''
search
:
string
=
''
listTag
:
TagModel
[]
=
[]
listTag
:
TagModel
[]
=
[]
listGroup
:
GroupModel
[]
=
[]
constructor
(
private
modalService
:
NgbModal
,
private
widgetService
:
WidgetService
,
constructor
(
private
modalService
:
NgbModal
,
private
widgetService
:
WidgetService
,
private
uploadService
:
UploadService
,
private
uploadService
:
UploadService
,
private
tagService
:
TagService
,
private
tagService
:
TagService
,
private
groupService
:
GroupService
)
{
private
groupService
:
GroupService
)
{
}
}
onSelectFile
(
event
:
any
)
{
if
(
event
.
target
.
files
&&
event
.
target
.
files
[
0
])
{
const
reader
=
new
FileReader
();
const
file
:
File
=
event
.
target
.
files
[
0
];
console
.
log
(
"🚀 ~ ListExcelComponent ~ onSelectFile ~ file:"
,
file
)
reader
.
readAsDataURL
(
event
.
target
.
files
[
0
]);
// read file as data url
reader
.
onload
=
(
event
)
=>
{
// called once readAsDataURL is completed
if
(
event
){
const
allowedTypes
=
[
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
,
'application/vnd.ms-excel.sheet.macroEnabled.12'
];
if
(
!
allowedTypes
.
includes
(
file
.
type
))
{
this
.
openAlertModal
(
'อัพโหลดได้เฉพาะไฟล์ *.xlsx *.xlsm เท่านั้น'
)
}
else
{
let
base64
=
event
.
target
!
.
result
as
string
this
.
modelWidget
.
widgetObj
=
base64
.
split
(
','
)[
1
];
this
.
modelWidget
.
fileType
=
file
.
name
.
split
(
'.'
)[
file
.
name
.
split
(
'.'
).
length
-
1
]
}
}
}
}
}
async
downloadFile
(
logId
:
string
){
try
{
const
data
=
await
this
.
widgetService
.
downloadFile
(
logId
).
toPromise
();
if
(
data
){
FileSaver
.
saveAs
(
new
Blob
([
data
]),
"file_download.xlsx"
);
}
}
catch
(
error
)
{
console
.
error
(
'Error loading data:'
,
error
);
}
}
async
getListGroup
(){
try
{
const
data
=
await
this
.
groupService
.
getList
().
toPromise
();
this
.
listGroup
=
data
.
map
(
x
=>
new
GroupModel
(
x
))
}
catch
(
error
){
console
.
error
(
'Error loading data:'
,
error
);
}
}
selectGroup
(){
let
findData
=
this
.
listGroup
.
find
(
x
=>
x
.
groupId
==
this
.
modelWidget
.
group
.
groupId
)
this
.
modelWidget
.
group
=
findData
?
new
GroupModel
(
findData
):
new
GroupModel
({})
}
async
onUploadImage
(
event
:
any
)
{
async
onUploadImage
(
event
:
any
)
{
try
{
try
{
if
(
event
.
target
.
files
.
length
>
0
)
{
if
(
event
.
target
.
files
.
length
>
0
)
{
...
@@ -189,6 +232,7 @@ export class ListWidgetsComponent implements OnInit {
...
@@ -189,6 +232,7 @@ export class ListWidgetsComponent implements OnInit {
ngOnInit
()
{
ngOnInit
()
{
this
.
getListWidgets
();
this
.
getListWidgets
();
this
.
getListTag
();
this
.
getListTag
();
this
.
getListGroup
();
}
}
async
getListTag
()
{
async
getListTag
()
{
...
...
src/app/apps/portal-category-list/portal-category-list.component.ts
View file @
fddf6930
...
@@ -3,6 +3,7 @@ import { Router } from '@angular/router';
...
@@ -3,6 +3,7 @@ import { Router } from '@angular/router';
import
{
CourseService
}
from
'src/app/service/course.service'
;
import
{
CourseService
}
from
'src/app/service/course.service'
;
import
{
DocumentService
}
from
'src/app/service/document.service'
;
import
{
DocumentService
}
from
'src/app/service/document.service'
;
import
{
ExcelService
}
from
'src/app/service/excel.service'
;
import
{
ExcelService
}
from
'src/app/service/excel.service'
;
import
{
WidgetService
}
from
'src/app/service/widgets.service'
;
@
Component
({
@
Component
({
selector
:
'app-portal-category-list'
,
selector
:
'app-portal-category-list'
,
...
@@ -13,7 +14,7 @@ export class PortalCategoryListComponent implements OnInit {
...
@@ -13,7 +14,7 @@ export class PortalCategoryListComponent implements OnInit {
constructor
(
constructor
(
private
routes
:
Router
,
private
routes
:
Router
,
private
excelService
:
ExcelService
,
private
documentService
:
DocumentService
,
private
courseService
:
CourseService
private
excelService
:
ExcelService
,
private
documentService
:
DocumentService
,
private
courseService
:
CourseService
,
private
widgetService
:
WidgetService
)
{}
)
{}
page
=
1
;
page
=
1
;
pageSize
=
10
;
pageSize
=
10
;
...
@@ -51,18 +52,19 @@ export class PortalCategoryListComponent implements OnInit {
...
@@ -51,18 +52,19 @@ export class PortalCategoryListComponent implements OnInit {
},
},
{
{
id
:
'4'
,
id
:
'4'
,
img
:
"assets/images/icon/
course
.png"
,
img
:
"assets/images/icon/
widget
.png"
,
name
:
"
BI
"
,
name
:
"
Widgets
"
,
details
:
"xxxxxxxxxxxxxxxxxxxxxxxxxxx"
,
details
:
"xxxxxxxxxxxxxxxxxxxxxxxxxxx"
,
document
:
"0"
document
:
"0"
},
},
{
{
id
:
'5'
,
id
:
'5'
,
img
:
"assets/images/
icon/course.pn
g"
,
img
:
"assets/images/
users/1.jp
g"
,
name
:
"
Widgets
"
,
name
:
"
BI
"
,
details
:
"xxxxxxxxxxxxxxxxxxxxxxxxxxx"
,
details
:
"xxxxxxxxxxxxxxxxxxxxxxxxxxx"
,
document
:
"0"
document
:
"0"
},
},
];
];
this
.
getListCount
();
this
.
getListCount
();
}
}
...
@@ -71,6 +73,7 @@ export class PortalCategoryListComponent implements OnInit {
...
@@ -71,6 +73,7 @@ export class PortalCategoryListComponent implements OnInit {
const
countExcel
=
await
this
.
excelService
.
getCountContent
().
toPromise
();
const
countExcel
=
await
this
.
excelService
.
getCountContent
().
toPromise
();
const
countDoc
=
await
this
.
documentService
.
getCountContent
().
toPromise
();
const
countDoc
=
await
this
.
documentService
.
getCountContent
().
toPromise
();
const
countCourse
=
await
this
.
courseService
.
getCountContent
().
toPromise
();
const
countCourse
=
await
this
.
courseService
.
getCountContent
().
toPromise
();
const
countWidgets
=
await
this
.
widgetService
.
getCount
().
toPromise
();
this
.
testdata
.
forEach
((
x
,
i
)
=>
{
this
.
testdata
.
forEach
((
x
,
i
)
=>
{
if
(
i
==
0
){
if
(
i
==
0
){
x
.
document
=
countExcel
.
toString
()
x
.
document
=
countExcel
.
toString
()
...
@@ -78,6 +81,8 @@ export class PortalCategoryListComponent implements OnInit {
...
@@ -78,6 +81,8 @@ export class PortalCategoryListComponent implements OnInit {
x
.
document
=
countDoc
.
toString
()
x
.
document
=
countDoc
.
toString
()
}
else
if
(
i
==
2
){
}
else
if
(
i
==
2
){
x
.
document
=
countCourse
.
toString
()
x
.
document
=
countCourse
.
toString
()
}
else
if
(
i
==
3
){
x
.
document
=
countWidgets
.
toString
()
}
}
})
})
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -91,6 +96,8 @@ export class PortalCategoryListComponent implements OnInit {
...
@@ -91,6 +96,8 @@ export class PortalCategoryListComponent implements OnInit {
this
.
routes
.
navigate
([
'apps/view-list-doc'
]);
this
.
routes
.
navigate
([
'apps/view-list-doc'
]);
}
else
if
(
id
==
'3'
){
}
else
if
(
id
==
'3'
){
this
.
routes
.
navigate
([
'apps/view-list-course'
]);
this
.
routes
.
navigate
([
'apps/view-list-course'
]);
}
else
if
(
id
==
'4'
){
this
.
routes
.
navigate
([
'apps/view-list-widgets'
]);
}
}
}
}
...
...
src/app/apps/portal-create-category/portal-create-category.component.ts
View file @
fddf6930
...
@@ -57,14 +57,14 @@ export class PortalCreateCategoryComponent implements OnInit {
...
@@ -57,14 +57,14 @@ export class PortalCreateCategoryComponent implements OnInit {
},
},
{
{
id
:
'4'
,
id
:
'4'
,
img
:
"assets/images/icon/
course
.png"
,
img
:
"assets/images/icon/
widget
.png"
,
name
:
"Widgets"
,
name
:
"Widgets"
,
details
:
"xxxxxxxxxxxxxxxxxxxxxxxxxxx"
,
details
:
"xxxxxxxxxxxxxxxxxxxxxxxxxxx"
,
document
:
"0"
document
:
"0"
},
},
{
{
id
:
'5'
,
id
:
'5'
,
img
:
"assets/images/
icon/course.pn
g"
,
img
:
"assets/images/
users/1.jp
g"
,
name
:
"BI"
,
name
:
"BI"
,
details
:
"xxxxxxxxxxxxxxxxxxxxxxxxxxx"
,
details
:
"xxxxxxxxxxxxxxxxxxxxxxxxxxx"
,
document
:
"0"
document
:
"0"
...
...
src/app/apps/view-list-widgets/view-list-widgets.component.html
0 → 100644
View file @
fddf6930
<div
class=
"row"
>
<div
class=
"col-12"
>
<div
class=
"py-3"
>
<input
type=
"text"
class=
"form-control w-25"
placeholder=
"ค้นหา"
[(
ngModel
)]="
search
"
>
</div>
</div>
<div
class=
"col-sm-6 col-md-4 col-lg-4 mb-3"
*
ngFor=
"let data of filterListWidget()"
>
<div
class=
"card border-5 border border-widget h-100 shadow"
>
<div
class=
" p-2 border-5"
>
<img
width=
"100"
class=
"card-img-top cover"
src=
"{{data.getImage()}}"
(
click
)="
openEmployeeModal
(
data
.
getImage
())"
>
</div>
<div
class=
"card-body"
>
<h4
class=
"card-title"
>
{{ data.widgetTname }}
</h4>
<p
class=
"card-text "
>
{{ data.thDesc }}
</p>
<p
class=
"text-info pointer mb-0"
(
click
)="
downloadFile
(
data
.
widgetId
)"
><i
class=
"fas fa-download mr-1"
></i>
ดาวน์โหลด
<small
class=
"text-muted"
*
ngIf=
"data.dwTime > 0"
>
{{coverDate(data.downloadDate)}} {{data.downloadTime}} ( {{data.dwTime}} ครั้ง)
</small></p>
<p
class=
"text-info pointer mb-0"
(
click
)="
openLink
(
data
.
link1
)"
><i
class=
"fas fa-link mr-1"
></i>
ตัวอย่างวิธีใช้งาน
</p>
</div>
<div
class=
"card-footer border-bottom-5"
>
<small
class=
"text-muted"
>
วันที่อัพโหลด {{coverDate(data.uploadDate)}} {{data.uploadTime}}
</small>
</div>
</div>
</div>
</div>
\ No newline at end of file
src/app/apps/view-list-widgets/view-list-widgets.component.scss
0 → 100644
View file @
fddf6930
src/app/apps/view-list-widgets/view-list-widgets.component.ts
0 → 100644
View file @
fddf6930
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
NgbModal
}
from
'@ng-bootstrap/ng-bootstrap'
;
import
{
AlertModalComponent
}
from
'../alert-modal/alert-modal.component'
;
import
{
OpenImageComponent
}
from
'../open-image/open-image.component'
;
import
{
WidgetService
}
from
'src/app/service/widgets.service'
;
import
{
WidgetModel
}
from
'src/app/model/widgets.model'
;
declare
var
require
:
any
const
FileSaver
=
require
(
'file-saver'
);
@
Component
({
selector
:
'app-view-list-widgets'
,
templateUrl
:
'./view-list-widgets.component.html'
,
styleUrls
:
[
'./view-list-widgets.component.scss'
]
})
export
class
ViewListWidgetsComponent
implements
OnInit
{
page
=
1
;
pageSize
=
10
;
listWidget
:
WidgetModel
[]
=
[]
search
:
string
=
''
constructor
(
private
modalService
:
NgbModal
,
private
widgetService
:
WidgetService
)
{
}
openEmployeeModal
(
image
:
string
)
{
const
modalRef
=
this
.
modalService
.
open
(
OpenImageComponent
,
{
centered
:
true
,
windowClass
:
'my-dialog-img-preview'
})
modalRef
.
componentInstance
.
linkImage
=
image
modalRef
.
result
.
then
(
result
=>
{
},
reason
=>
{
this
.
modalService
.
dismissAll
()
})
}
async
downloadFile
(
logId
:
string
){
try
{
const
data
=
await
this
.
widgetService
.
downloadFile
(
logId
).
toPromise
();
if
(
data
){
FileSaver
.
saveAs
(
new
Blob
([
data
]),
"file_download.xlsx"
);
}
}
catch
(
error
)
{
console
.
error
(
'Error loading data:'
,
error
);
}
}
getStatus
(
status
:
string
)
{
if
(
status
==
'0'
)
{
return
'Private'
}
else
if
(
status
==
'1'
)
{
return
'Public'
}
}
filterListWidget
(){
return
this
.
listWidget
.
filter
(
x
=>
x
.
widgetTname
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
||
x
.
widgetEname
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
()))
}
async
getListExcel
(){
try
{
const
data
=
await
this
.
widgetService
.
getListWidgets
().
toPromise
();
this
.
listWidget
=
data
.
map
(
x
=>
new
WidgetModel
(
x
))
}
catch
(
error
)
{
console
.
error
(
'Error loading data:'
,
error
);
}
}
ngOnInit
()
{
this
.
getListExcel
();
}
openLink
(
url
:
string
){
window
.
open
(
url
,
"_blank"
);
}
openAlertModal
(
message
?:
string
)
{
const
modalRef
=
this
.
modalService
.
open
(
AlertModalComponent
,
{
centered
:
true
,
backdrop
:
'static'
})
modalRef
.
componentInstance
.
message
=
message
?
message
:
""
modalRef
.
result
.
then
(
result
=>
{
this
.
modalService
.
dismissAll
()
},
reason
=>
{
this
.
modalService
.
dismissAll
()
})
}
coverDate
(
date
:
string
){
return
date
.
split
(
'-'
).
reverse
().
join
(
'/'
)
}
}
src/app/model/widgets.model.ts
View file @
fddf6930
...
@@ -15,6 +15,16 @@ export interface WidgetModel {
...
@@ -15,6 +15,16 @@ export interface WidgetModel {
picture
:
string
picture
:
string
remark
:
string
remark
:
string
status
:
number
status
:
number
link1
:
string
dbSupport
:
string
widgetObj
:
string
fileType
:
string
isPivot
:
number
isDataGrid
:
number
uploadBy
:
string
uploadDate
:
string
uploadTime
:
string
group
:
GroupModel
tags
:
TagModel
[]
tags
:
TagModel
[]
}
}
...
@@ -31,6 +41,16 @@ export class WidgetModel implements WidgetModel {
...
@@ -31,6 +41,16 @@ export class WidgetModel implements WidgetModel {
picture
:
string
picture
:
string
remark
:
string
remark
:
string
status
:
number
status
:
number
link1
:
string
dbSupport
:
string
widgetObj
:
string
fileType
:
string
isPivot
:
number
isDataGrid
:
number
uploadBy
:
string
uploadDate
:
string
uploadTime
:
string
group
:
GroupModel
tags
:
TagModel
[]
tags
:
TagModel
[]
constructor
(
data
:
Partial
<
any
>
)
{
constructor
(
data
:
Partial
<
any
>
)
{
this
.
widgetId
=
data
.
widgetId
?
data
.
widgetId
:
''
this
.
widgetId
=
data
.
widgetId
?
data
.
widgetId
:
''
...
@@ -45,7 +65,17 @@ export class WidgetModel implements WidgetModel {
...
@@ -45,7 +65,17 @@ export class WidgetModel implements WidgetModel {
this
.
seriesColumn
=
data
.
seriesColumn
?
data
.
seriesColumn
:
''
this
.
seriesColumn
=
data
.
seriesColumn
?
data
.
seriesColumn
:
''
this
.
picture
=
data
.
picture
?
data
.
picture
:
''
this
.
picture
=
data
.
picture
?
data
.
picture
:
''
this
.
remark
=
data
.
remark
?
data
.
remark
:
''
this
.
remark
=
data
.
remark
?
data
.
remark
:
''
this
.
link1
=
data
.
link1
?
data
.
link1
:
''
this
.
widgetObj
=
data
.
widgetObj
?
data
.
widgetObj
:
''
this
.
dbSupport
=
data
.
dbSupport
?
data
.
dbSupport
:
''
this
.
tags
=
data
.
tags
?
data
.
tags
:[]
this
.
tags
=
data
.
tags
?
data
.
tags
:[]
this
.
fileType
=
data
.
fileType
?
data
.
fileType
:
''
this
.
isPivot
=
data
.
isPivot
?
data
.
isPivot
:
0
this
.
isDataGrid
=
data
.
isDataGrid
?
data
.
isDataGrid
:
0
this
.
uploadBy
=
data
.
uploadBy
?
data
.
uploadBy
:
''
this
.
uploadDate
=
data
.
uploadDate
?
data
.
uploadDate
:
''
this
.
uploadTime
=
data
.
uploadTime
?
data
.
uploadTime
:
''
this
.
group
=
data
.
group
?
new
GroupModel
(
data
.
group
):
new
GroupModel
({})
}
}
getImage
(){
getImage
(){
...
...
src/app/service/widgets.service.ts
View file @
fddf6930
...
@@ -27,7 +27,9 @@ export class WidgetService {
...
@@ -27,7 +27,9 @@ export class WidgetService {
getWidgetById
(
widgetId
:
string
):
Observable
<
WidgetModel
>
{
getWidgetById
(
widgetId
:
string
):
Observable
<
WidgetModel
>
{
return
this
.
http
.
get
<
WidgetModel
>
(
this
.
url
+
"widget/"
+
widgetId
)
return
this
.
http
.
get
<
WidgetModel
>
(
this
.
url
+
"widget/"
+
widgetId
)
}
}
downloadFile
(
logId
:
string
):
Observable
<
any
>
{
return
this
.
http
.
get
(
this
.
url
+
"widget/files/download/"
+
logId
,
{
responseType
:
'blob'
})
}
createWidget
(
model
:
WidgetModel
):
Observable
<
any
>
{
createWidget
(
model
:
WidgetModel
):
Observable
<
any
>
{
let
body
:
any
=
model
let
body
:
any
=
model
return
this
.
http
.
post
(
this
.
url
+
'widget'
,
body
)
return
this
.
http
.
post
(
this
.
url
+
'widget'
,
body
)
...
...
src/assets/images/icon/widget.png
0 → 100644
View file @
fddf6930
7.66 KB
src/styles.scss
View file @
fddf6930
...
@@ -102,6 +102,10 @@ body {
...
@@ -102,6 +102,10 @@ body {
border
:
1px
solid
#7460ee
!
important
;
border
:
1px
solid
#7460ee
!
important
;
border-color
:
#7460ee
!
important
;
border-color
:
#7460ee
!
important
;
}
}
.border-widget
{
border
:
1px
solid
#ccc
!
important
;
border-color
:
#ccc
!
important
;
}
.border-5
{
.border-5
{
border-radius
:
10px
border-radius
:
10px
}
}
...
...
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