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
9b7d69c1
Commit
9b7d69c1
authored
Apr 16, 2025
by
Nakarin Luankla
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
แก้ model bu1-4
parent
b4ff8dbf
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
235 additions
and
72 deletions
+235
-72
department-list.component.html
...iness-unit/department-list/department-list.component.html
+0
-0
department-list.component.ts
...usiness-unit/department-list/department-list.component.ts
+94
-37
section-registration.component.html
.../section-registration/section-registration.component.html
+0
-0
section-registration.component.ts
...it/section-registration/section-registration.component.ts
+66
-14
sub-department-one.component.html
...unit/sub-department-one/sub-department-one.component.html
+0
-0
sub-department-one.component.ts
...s-unit/sub-department-one/sub-department-one.component.ts
+75
-21
No files found.
src/app/components/company-components/company-registration/branch-business-unit/department-list/department-list.component.html
View file @
9b7d69c1
This diff is collapsed.
Click to expand it.
src/app/components/company-components/company-registration/branch-business-unit/department-list/department-list.component.ts
View file @
9b7d69c1
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
{
ToastrService
}
from
'ngx-toastr'
;
import
{
Bu1Model
,
MyBu1Model
}
from
'src/app/shared/model/bu1.model'
;
...
...
@@ -6,6 +7,7 @@ import { Bu2Model, MyBu2Model } from 'src/app/shared/model/bu2.model';
import
{
Bu1Service
}
from
'src/app/shared/services/bu1.service'
;
import
{
Bu2Service
}
from
'src/app/shared/services/bu2.service'
;
import
{
FileService
}
from
'src/app/shared/services/file.service'
;
import
Swal
from
'sweetalert2'
;
interface
table
{
currentPage
:
number
,
page
:
number
[],
...
...
@@ -70,18 +72,38 @@ export class DepartmentListComponent implements OnInit {
pageSize
:
10
}
currentModal
:
'add'
|
'edit'
|
'delete'
=
"add"
@
ViewChild
(
"departmentListModal"
)
departmentListModal
:
any
;
@
ViewChild
(
"departmentListBu1Modal"
)
departmentListBu1Modal
:
any
;
dialogRef
:
any
dialogRefBu1
:
any
constructor
(
private
bu2Service
:
Bu2Service
,
private
bu1Service
:
Bu1Service
,
private
toastr
:
ToastrService
,
private
cdr
:
ChangeDetectorRef
,
private
fileService
:
FileService
private
fileService
:
FileService
,
private
dialog
:
MatDialog
)
{
}
ngOnInit
():
void
{
this
.
getBu2List
()
this
.
getBu1List
()
}
openDialog
()
{
this
.
dialogRef
=
this
.
dialog
.
open
(
this
.
departmentListModal
,
{
width
:
'500px'
,
})
}
openBu1Dialog
()
{
this
.
dialogRefBu1
=
this
.
dialog
.
open
(
this
.
departmentListBu1Modal
,
{
width
:
'800px'
,
})
}
closeDialog
()
{
this
.
dialogRef
.
close
()
}
closeBu1Dialog
()
{
this
.
dialogRefBu1
.
close
()
}
onFileSelected
(
event
:
any
)
{
this
.
selectedFile
=
event
.
target
.
files
.
length
>
0
?
event
.
target
.
files
[
0
]
:
null
;
this
.
selectedFileName
=
this
.
selectedFile
?.
name
||
"กรุณาเลือกไฟล์"
...
...
@@ -185,45 +207,80 @@ export class DepartmentListComponent implements OnInit {
}
showAlert
(
text
:
string
,
type
:
'success'
|
'error'
)
{
this
.
toastr
[
type
](
text
,
'แจ้งเตือน'
,
{
timeOut
:
3000
,
positionClass
:
'toast-top-right'
,
})
Swal
.
fire
({
title
:
'แจ้งเตือน'
,
text
:
text
,
icon
:
type
,
confirmButtonText
:
'ตกลง'
,
});
}
addBu2
()
{
this
.
bu2ListLoading
=
true
this
.
bu2Service
.
post
({
...
this
.
bu2
,
parent
:
this
.
bu1
.
bu1id
}).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getBu2List
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
bu2ListLoading
=
false
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
bu2ListLoading
=
false
Swal
.
fire
({
icon
:
'question'
,
title
:
'แจ้งเตือน'
,
text
:
'ยืนยันการบันทึกข้อมูลหรือไม่'
,
showCancelButton
:
true
,
confirmButtonText
:
'บันทึกข้อมูล'
,
cancelButtonText
:
'ย้อนกลับ'
,
reverseButtons
:
true
,
}).
then
((
result
)
=>
{
if
(
result
.
isConfirmed
)
{
this
.
bu2ListLoading
=
true
this
.
bu2Service
.
post
({
...
this
.
bu2
,
parent
:
this
.
bu1
.
bu1id
}).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getBu2List
()
this
.
closeDialog
();
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
bu2ListLoading
=
false
this
.
closeDialog
();
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
bu2ListLoading
=
false
this
.
closeDialog
();
}
})
}
})
})
;
}
deleteBu2
()
{
this
.
bu2ListLoading
=
true
// const body = this.bu2List.filter(x => x.check).map(x => new MyBu2Model(x.data))
// this.bu2Service.delete(body).subscribe({
// next: response => {
// if (response.success) {
// this.showAlert(response.message, 'success')
// this.getBu2List()
// } else {
// this.showAlert(response.message, 'error')
// this.bu2ListLoading = false
// }
// }, error: error => {
// this.showAlert(error.message, 'error')
// this.bu2ListLoading = false
// }
// })
if
(
!
this
.
numSelectItem
())
{
this
.
showAlert
(
'กรุณาเลือกข้อมูลที่ต้องการลบ'
,
'error'
)
return
}
Swal
.
fire
({
icon
:
'question'
,
title
:
'แจ้งเตือน'
,
text
:
'ยืนยันการลบข้อมูลหรือไม่'
,
showCancelButton
:
true
,
confirmButtonText
:
'ลบข้อมูล'
,
cancelButtonText
:
'ย้อนกลับ'
,
reverseButtons
:
true
,
}).
then
((
result
)
=>
{
if
(
result
.
isConfirmed
)
{
this
.
bu2ListLoading
=
true
const
selectedKeys
=
Array
.
from
(
this
.
selectedItems
.
data
.
keys
());
const
body
=
this
.
bu2List
.
filter
(
x
=>
selectedKeys
.
includes
(
x
.
bu2id
)
&&
this
.
selectedItems
.
data
.
get
(
x
.
bu2id
)).
map
(
x
=>
new
MyBu2Model
(
x
))
this
.
bu2Service
.
delete
(
body
).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getBu2List
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
bu2ListLoading
=
false
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
bu2ListLoading
=
false
}
})
}
});
}
...
...
src/app/components/company-components/company-registration/branch-business-unit/section-registration/section-registration.component.html
View file @
9b7d69c1
This diff is collapsed.
Click to expand it.
src/app/components/company-components/company-registration/branch-business-unit/section-registration/section-registration.component.ts
View file @
9b7d69c1
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
{
ToastrService
}
from
'ngx-toastr'
;
import
{
Bu2Model
,
MyBu2Model
}
from
'src/app/shared/model/bu2.model'
;
...
...
@@ -6,6 +7,7 @@ import { Bu3Model, MyBu3Model } from 'src/app/shared/model/bu3.model';
import
{
Bu2Service
}
from
'src/app/shared/services/bu2.service'
;
import
{
Bu3Service
}
from
'src/app/shared/services/bu3.service'
;
import
{
FileService
}
from
'src/app/shared/services/file.service'
;
import
Swal
from
'sweetalert2'
;
interface
table
{
currentPage
:
number
,
page
:
number
[],
...
...
@@ -56,17 +58,38 @@ export class SectionRegistrationComponent implements OnInit {
};
search
=
''
selectedItems
:
{
key
:
string
,
count
:
number
,
data
:
Map
<
string
,
boolean
>
}
=
{
key
:
''
,
count
:
0
,
data
:
new
Map
<
string
,
boolean
>
()
};
@
ViewChild
(
"sectionRegistrationModal"
)
sectionRegistrationModal
:
any
;
@
ViewChild
(
"sectionRegistrationModalBu2"
)
sectionRegistrationModalBu2
:
any
;
dialogRef
:
any
dialogRefBu2
:
any
constructor
(
private
bu3Service
:
Bu3Service
,
private
bu2Service
:
Bu2Service
,
private
toastr
:
ToastrService
,
private
cdr
:
ChangeDetectorRef
,
private
fileService
:
FileService
private
fileService
:
FileService
,
private
dialog
:
MatDialog
)
{
}
ngOnInit
():
void
{
this
.
getBu3List
()
this
.
getBu2List
()
}
openDialog
()
{
this
.
dialogRef
=
this
.
dialog
.
open
(
this
.
sectionRegistrationModal
,
{
width
:
'500px'
,
})
}
openDialogBu2
()
{
this
.
dialogRefBu2
=
this
.
dialog
.
open
(
this
.
sectionRegistrationModalBu2
,
{
width
:
'800px'
,
})
}
closeDialog
()
{
this
.
dialogRef
.
close
()
}
closeDialogBu2
()
{
this
.
dialogRefBu2
.
close
()
}
onFileSelected
(
event
:
any
)
{
this
.
selectedFile
=
event
.
target
.
files
.
length
>
0
?
event
.
target
.
files
[
0
]
:
null
;
...
...
@@ -154,27 +177,52 @@ export class SectionRegistrationComponent implements OnInit {
}
addBu3
()
{
this
.
bu3
.
loading
=
true
this
.
bu3Service
.
post
({
...
this
.
bu3
.
select
,
parent
:
this
.
bu2
.
bu2id
}).
subscribe
({
next
:
response
=>
{
Swal
.
fire
({
icon
:
'question'
,
title
:
'แจ้งเตือน'
,
text
:
'ยืนยันการบันทึกข้อมูลหรือไม่'
,
showCancelButton
:
true
,
confirmButtonText
:
'บันทึกข้อมูล'
,
}).
then
((
result
)
=>
{
if
(
result
.
isConfirmed
)
{
this
.
bu3
.
loading
=
true
this
.
bu3Service
.
post
({
...
this
.
bu3
.
select
,
parent
:
this
.
bu2
.
bu2id
}).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getBu3List
()
this
.
closeDialog
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
bu3
.
loading
=
false
this
.
closeDialog
()
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
bu3
.
loading
=
false
this
.
closeDialog
()
}
})
}
})
}
deleteBu3
()
{
this
.
bu3
.
loading
=
true
const
selectedKeys
=
Array
.
from
(
this
.
selectedItems
.
data
.
keys
());
const
body
=
this
.
bu3
.
dataList
.
filter
(
x
=>
selectedKeys
.
includes
(
x
.
bu3id
)
&&
this
.
selectedItems
.
data
.
get
(
x
.
bu3id
)).
map
(
x
=>
new
MyBu3Model
(
x
))
this
.
bu3Service
.
delete
(
body
).
subscribe
({
if
(
this
.
numSelectItem
()
==
0
)
{
this
.
showAlert
(
'กรุณาเลือกข้อมูลที่จะลบ'
,
'error'
)
return
}
Swal
.
fire
({
icon
:
'question'
,
title
:
'แจ้งเตือน'
,
text
:
'ยืนยันการลบข้อมูลหรือไม่'
,
showCancelButton
:
true
,
confirmButtonText
:
'ลบข้อมูล'
,
}).
then
((
result
)
=>
{
if
(
result
.
isConfirmed
)
{
this
.
bu3
.
loading
=
true
const
selectedKeys
=
Array
.
from
(
this
.
selectedItems
.
data
.
keys
());
const
body
=
this
.
bu3
.
dataList
.
filter
(
x
=>
selectedKeys
.
includes
(
x
.
bu3id
)
&&
this
.
selectedItems
.
data
.
get
(
x
.
bu3id
)).
map
(
x
=>
new
MyBu3Model
(
x
))
this
.
bu3Service
.
delete
(
body
).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
...
...
@@ -185,7 +233,9 @@ export class SectionRegistrationComponent implements OnInit {
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
bu3
.
loading
=
false
this
.
bu3
.
loading
=
false
}
})
}
})
}
...
...
@@ -214,10 +264,12 @@ export class SectionRegistrationComponent implements OnInit {
}
showAlert
(
text
:
string
,
type
:
'success'
|
'error'
)
{
this
.
toastr
[
type
](
text
,
'แจ้งเตือน'
,
{
timeOut
:
3000
,
positionClass
:
'toast-top-right'
,
})
Swal
.
fire
({
title
:
'แจ้งเตือน'
,
text
:
text
,
icon
:
type
,
confirmButtonText
:
'ตกลง'
,
});
}
checkPrimary
()
{
...
...
src/app/components/company-components/company-registration/branch-business-unit/sub-department-one/sub-department-one.component.html
View file @
9b7d69c1
This diff is collapsed.
Click to expand it.
src/app/components/company-components/company-registration/branch-business-unit/sub-department-one/sub-department-one.component.ts
View file @
9b7d69c1
import
{
ChangeDetectorRef
,
Component
,
EventEmitter
,
Input
,
OnInit
}
from
'@angular/core'
;
import
{
ChangeDetectorRef
,
Component
,
EventEmitter
,
Input
,
OnInit
,
ViewChild
}
from
'@angular/core'
;
import
{
ColumnModel
}
from
'@syncfusion/ej2-grids'
;
import
{
MatDialog
}
from
'@angular/material/dialog'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
Bu3Model
,
MyBu3Model
}
from
'src/app/shared/model/bu3.model'
;
import
{
Bu4Model
,
MyBu4Model
}
from
'src/app/shared/model/bu4.model'
;
import
{
Bu3Service
}
from
'src/app/shared/services/bu3.service'
;
import
{
Bu4Service
}
from
'src/app/shared/services/bu4.service'
;
import
{
FileService
}
from
'src/app/shared/services/file.service'
;
import
Swal
from
'sweetalert2'
;
interface
table
{
currentPage
:
number
,
page
:
number
[],
...
...
@@ -63,16 +65,39 @@ export class SubDepartmentOneComponent implements OnInit {
};
search
=
''
selectedItems
:
{
key
:
string
,
count
:
number
,
data
:
Map
<
string
,
boolean
>
}
=
{
key
:
''
,
count
:
0
,
data
:
new
Map
<
string
,
boolean
>
()
};
@
ViewChild
(
"subDepartmentOneModal"
)
subDepartmentOneModal
:
any
;
@
ViewChild
(
"subDepartmentOneBu3TableModal"
)
subDepartmentOneBu3TableModal
:
any
;
dialogRef
:
any
dialogRefBu3
:
any
constructor
(
private
bu4Service
:
Bu4Service
,
private
bu3Service
:
Bu3Service
,
private
toastr
:
ToastrService
,
private
cdr
:
ChangeDetectorRef
,
private
fileService
:
FileService
private
fileService
:
FileService
,
private
dialog
:
MatDialog
)
{
}
ngOnInit
():
void
{
this
.
getBu4List
()
this
.
getBu3List
()
}
openDialog
()
{
this
.
dialogRef
=
this
.
dialog
.
open
(
this
.
subDepartmentOneModal
,
{
width
:
'500px'
,
})
}
openDialogBu3
()
{
this
.
dialogRefBu3
=
this
.
dialog
.
open
(
this
.
subDepartmentOneBu3TableModal
,
{
width
:
'800px'
,
})
}
closeDialog
()
{
this
.
dialogRef
.
close
()
}
closeDialogBu3
()
{
this
.
dialogRefBu3
.
close
()
}
onFileSelected
(
event
:
any
)
{
...
...
@@ -160,38 +185,65 @@ export class SubDepartmentOneComponent implements OnInit {
}
addBu4
()
{
Swal
.
fire
({
icon
:
'question'
,
title
:
'แจ้งเตือน'
,
text
:
'ยืนยันการบันทึกข้อมูลหรือไม่'
,
showCancelButton
:
true
,
confirmButtonText
:
'บันทึกข้อมูล'
,
}).
then
((
result
)
=>
{
if
(
result
.
isConfirmed
)
{
this
.
bu4
.
loading
=
true
this
.
bu4Service
.
post
({
...
this
.
bu4
.
select
,
parent
:
this
.
bu3
.
bu3id
}).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getBu4List
()
this
.
closeDialog
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
bu4
.
loading
=
false
this
.
closeDialog
()
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
bu4
.
loading
=
false
this
.
closeDialog
()
}
})
}
})
}
deleteBu4
()
{
this
.
bu4
.
loading
=
true
const
selectedKeys
=
Array
.
from
(
this
.
selectedItems
.
data
.
keys
());
const
body
=
this
.
bu4
.
dataList
.
filter
(
x
=>
selectedKeys
.
includes
(
x
.
bu4id
)
&&
this
.
selectedItems
.
data
.
get
(
x
.
bu4id
)).
map
(
x
=>
new
MyBu4Model
(
x
))
this
.
bu4Service
.
delete
(
body
).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getBu4List
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
bu4
.
loading
=
false
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
bu4
.
loading
=
false
if
(
this
.
numSelectItem
()
==
0
)
{
this
.
showAlert
(
'กรุณาเลือกข้อมูลที่จะลบ'
,
'error'
)
return
}
Swal
.
fire
({
icon
:
'question'
,
title
:
'แจ้งเตือน'
,
text
:
'ยืนยันการลบข้อมูลหรือไม่'
,
showCancelButton
:
true
,
confirmButtonText
:
'ลบข้อมูล'
,
}).
then
((
result
)
=>
{
if
(
result
.
isConfirmed
)
{
this
.
bu4
.
loading
=
true
const
selectedKeys
=
Array
.
from
(
this
.
selectedItems
.
data
.
keys
());
const
body
=
this
.
bu4
.
dataList
.
filter
(
x
=>
selectedKeys
.
includes
(
x
.
bu4id
)
&&
this
.
selectedItems
.
data
.
get
(
x
.
bu4id
)).
map
(
x
=>
new
MyBu4Model
(
x
))
this
.
bu4Service
.
delete
(
body
).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getBu4List
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
bu4
.
loading
=
false
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
bu4
.
loading
=
false
}
})
}
})
}
...
...
@@ -220,10 +272,12 @@ export class SubDepartmentOneComponent implements OnInit {
}
showAlert
(
text
:
string
,
type
:
'success'
|
'error'
)
{
this
.
toastr
[
type
](
text
,
'แจ้งเตือน'
,
{
timeOut
:
3000
,
positionClass
:
'toast-top-right'
,
})
Swal
.
fire
({
title
:
'แจ้งเตือน'
,
text
:
text
,
icon
:
type
,
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