Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mySkill-x
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
mySkill-x
Commits
55e84dd8
Commit
55e84dd8
authored
Apr 18, 2025
by
Nakarin Luankla
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
แก้ modal
parent
aff91f9f
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
5 deletions
+57
-5
sub-department-two.component.html
...unit/sub-department-two/sub-department-two.component.html
+0
-0
sub-department-two.component.ts
...s-unit/sub-department-two/sub-department-two.component.ts
+57
-5
No files found.
src/app/components/company-components/company-registration/branch-business-unit/sub-department-two/sub-department-two.component.html
View file @
55e84dd8
This diff is collapsed.
Click to expand it.
src/app/components/company-components/company-registration/branch-business-unit/sub-department-two/sub-department-two.component.ts
View file @
55e84dd8
import
{
ChangeDetectorRef
,
Component
,
EventEmitter
,
Input
,
OnInit
,
}
from
'@angular/core'
;
import
{
ChangeDetectorRef
,
Component
,
EventEmitter
,
Input
,
OnInit
,
ViewChild
,
}
from
'@angular/core'
;
import
{
MatDialog
}
from
'@angular/material/dialog'
;
import
{
ColumnModel
}
from
'@syncfusion/ej2-grids'
;
import
{
ColumnModel
}
from
'@syncfusion/ej2-grids'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
Bu4Model
,
MyBu4Model
}
from
'src/app/shared/model/bu4.model'
;
import
{
Bu4Model
,
MyBu4Model
}
from
'src/app/shared/model/bu4.model'
;
...
@@ -6,6 +7,7 @@ import { Bu5Model, MyBu5Model } from 'src/app/shared/model/bu5.model';
...
@@ -6,6 +7,7 @@ import { Bu5Model, MyBu5Model } from 'src/app/shared/model/bu5.model';
import
{
Bu4Service
}
from
'src/app/shared/services/bu4.service'
;
import
{
Bu4Service
}
from
'src/app/shared/services/bu4.service'
;
import
{
Bu5Service
}
from
'src/app/shared/services/bu5.service'
;
import
{
Bu5Service
}
from
'src/app/shared/services/bu5.service'
;
import
{
FileService
}
from
'src/app/shared/services/file.service'
;
import
{
FileService
}
from
'src/app/shared/services/file.service'
;
import
Swal
from
'sweetalert2'
;
interface
table
{
interface
table
{
currentPage
:
number
,
currentPage
:
number
,
page
:
number
[],
page
:
number
[],
...
@@ -56,17 +58,39 @@ export class SubDepartmentTwoComponent implements OnInit {
...
@@ -56,17 +58,39 @@ export class SubDepartmentTwoComponent implements OnInit {
};
};
search
=
''
search
=
''
selectedItems
:
{
key
:
string
,
count
:
number
,
data
:
Map
<
string
,
boolean
>
}
=
{
key
:
''
,
count
:
0
,
data
:
new
Map
<
string
,
boolean
>
()
};
selectedItems
:
{
key
:
string
,
count
:
number
,
data
:
Map
<
string
,
boolean
>
}
=
{
key
:
''
,
count
:
0
,
data
:
new
Map
<
string
,
boolean
>
()
};
@
ViewChild
(
"subDepartmentTwoModal"
)
subDepartmentTwoModal
:
any
;
@
ViewChild
(
"subDepartmentTwoModalBu4"
)
subDepartmentTwoModalBu4
:
any
;
dialogRef
:
any
dialogRefBu4
:
any
constructor
(
private
bu5Service
:
Bu5Service
,
constructor
(
private
bu5Service
:
Bu5Service
,
private
bu4Service
:
Bu4Service
,
private
bu4Service
:
Bu4Service
,
private
toastr
:
ToastrService
,
private
toastr
:
ToastrService
,
private
cdr
:
ChangeDetectorRef
,
private
cdr
:
ChangeDetectorRef
,
private
fileService
:
FileService
private
fileService
:
FileService
,
private
dialog
:
MatDialog
)
{
}
)
{
}
ngOnInit
():
void
{
ngOnInit
():
void
{
this
.
getBu5List
()
this
.
getBu5List
()
this
.
getBu4List
()
this
.
getBu4List
()
}
}
openDialog
()
{
this
.
dialogRef
=
this
.
dialog
.
open
(
this
.
subDepartmentTwoModal
,
{
width
:
'500px'
,
})
}
openDialogBu4
()
{
this
.
dialogRefBu4
=
this
.
dialog
.
open
(
this
.
subDepartmentTwoModalBu4
,
{
width
:
'800px'
,
})
}
closeDialog
()
{
this
.
dialogRef
.
close
()
}
closeDialogBu4
()
{
this
.
dialogRefBu4
.
close
()
}
onFileSelected
(
event
:
any
)
{
onFileSelected
(
event
:
any
)
{
this
.
selectedFile
=
event
.
target
.
files
.
length
>
0
?
event
.
target
.
files
[
0
]
:
null
;
this
.
selectedFile
=
event
.
target
.
files
.
length
>
0
?
event
.
target
.
files
[
0
]
:
null
;
this
.
selectedFileName
=
this
.
selectedFile
?.
name
||
"กรุณาเลือกไฟล์"
this
.
selectedFileName
=
this
.
selectedFile
?.
name
||
"กรุณาเลือกไฟล์"
...
@@ -153,23 +177,47 @@ export class SubDepartmentTwoComponent implements OnInit {
...
@@ -153,23 +177,47 @@ export class SubDepartmentTwoComponent implements OnInit {
}
}
addBu5
()
{
addBu5
()
{
Swal
.
fire
({
icon
:
'question'
,
title
:
'แจ้งเตือน'
,
text
:
'ยืนยันการบันทึกข้อมูลหรือไม่'
,
showCancelButton
:
true
,
confirmButtonText
:
'ยืนยัน'
,
}).
then
((
result
)
=>
{
if
(
result
.
isConfirmed
)
{
this
.
bu5
.
loading
=
true
this
.
bu5
.
loading
=
true
this
.
bu5Service
.
post
({
...
this
.
bu5
.
select
,
parent
:
this
.
bu4
.
bu4id
}).
subscribe
({
this
.
bu5Service
.
post
({
...
this
.
bu5
.
select
,
parent
:
this
.
bu4
.
bu4id
}).
subscribe
({
next
:
response
=>
{
next
:
response
=>
{
if
(
response
.
success
)
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getBu5List
()
this
.
getBu5List
()
this
.
closeDialog
()
}
else
{
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
bu5
.
loading
=
false
this
.
bu5
.
loading
=
false
this
.
closeDialog
()
}
}
},
error
:
error
=>
{
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
bu5
.
loading
=
false
this
.
bu5
.
loading
=
false
this
.
closeDialog
()
}
})
}
}
})
})
}
}
deleteBu5
()
{
deleteBu5
()
{
if
(
this
.
numSelectItem
()
==
0
)
{
this
.
showAlert
(
'กรุณาเลือกข้อมูลที่จะลบ'
,
'error'
)
return
}
Swal
.
fire
({
icon
:
'question'
,
title
:
'แจ้งเตือน'
,
text
:
'ยืนยันการลบข้อมูลหรือไม่'
,
showCancelButton
:
true
,
confirmButtonText
:
'ลบข้อมูล'
,
}).
then
((
result
)
=>
{
this
.
bu5
.
loading
=
true
this
.
bu5
.
loading
=
true
const
selectedKeys
=
Array
.
from
(
this
.
selectedItems
.
data
.
keys
());
const
selectedKeys
=
Array
.
from
(
this
.
selectedItems
.
data
.
keys
());
const
body
=
this
.
bu5
.
dataList
.
filter
(
x
=>
selectedKeys
.
includes
(
x
.
bu5id
)
&&
this
.
selectedItems
.
data
.
get
(
x
.
bu5id
)).
map
(
x
=>
new
MyBu5Model
(
x
))
const
body
=
this
.
bu5
.
dataList
.
filter
(
x
=>
selectedKeys
.
includes
(
x
.
bu5id
)
&&
this
.
selectedItems
.
data
.
get
(
x
.
bu5id
)).
map
(
x
=>
new
MyBu5Model
(
x
))
...
@@ -187,6 +235,7 @@ export class SubDepartmentTwoComponent implements OnInit {
...
@@ -187,6 +235,7 @@ export class SubDepartmentTwoComponent implements OnInit {
this
.
bu5
.
loading
=
false
this
.
bu5
.
loading
=
false
}
}
})
})
})
}
}
getBu4List
()
{
getBu4List
()
{
...
@@ -213,9 +262,12 @@ export class SubDepartmentTwoComponent implements OnInit {
...
@@ -213,9 +262,12 @@ export class SubDepartmentTwoComponent implements OnInit {
}
}
showAlert
(
text
:
string
,
type
:
'success'
|
'error'
)
{
showAlert
(
text
:
string
,
type
:
'success'
|
'error'
)
{
this
.
toastr
[
type
](
text
,
'แจ้งเตือน'
,
{
Swal
.
fire
({
timeOut
:
3000
,
icon
:
type
,
positionClass
:
'toast-top-right'
,
title
:
'แจ้งเตือน'
,
text
:
text
,
showCancelButton
:
false
,
confirmButtonText
:
'ยืนยัน'
,
})
})
}
}
...
...
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