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
2a30be7c
Commit
2a30be7c
authored
Apr 11, 2025
by
Nattana Chaiyamat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
syncfution ทะเบียนส่วน
parent
307b800b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
102 additions
and
124 deletions
+102
-124
department-register.component.ts
...unit/department-register/department-register.component.ts
+32
-34
section-registration.component.html
.../section-registration/section-registration.component.html
+0
-0
section-registration.component.ts
...it/section-registration/section-registration.component.ts
+68
-80
environment.prod.ts
src/environments/environment.prod.ts
+2
-10
No files found.
src/app/components/company-components/company-registration/branch-business-unit/department-register/department-register.component.ts
View file @
2a30be7c
...
@@ -149,22 +149,21 @@ export class DepartmentRegisterComponent implements OnInit {
...
@@ -149,22 +149,21 @@ export class DepartmentRegisterComponent implements OnInit {
reverseButtons
:
true
,
reverseButtons
:
true
,
}).
then
((
result
)
=>
{
}).
then
((
result
)
=>
{
if
(
result
.
isConfirmed
)
{
if
(
result
.
isConfirmed
)
{
console
.
log
(
" 🐒 result:"
,
result
)
this
.
bu1
.
loading
=
true
// this.bu1.loading = true
this
.
bu1Service
.
post
(
this
.
bu1
.
select
).
subscribe
({
// this.bu1Service.post(this.bu1.select).subscribe({
next
:
response
=>
{
// next: response => {
if
(
response
.
success
)
{
// if (response.success) {
this
.
showAlert
(
response
.
message
,
'success'
)
// this.showAlert(response.message, 'success')
this
.
getBu1List
()
// this.getBu1List()
}
else
{
// } else {
this
.
showAlert
(
response
.
message
,
'error'
)
// this.showAlert(response.message, 'error')
this
.
bu1
.
loading
=
false
// this.bu1.loading = false
}
// }
},
error
:
error
=>
{
// }, error: error => {
this
.
showAlert
(
error
.
message
,
'error'
)
// this.showAlert(error.message, 'error')
this
.
bu1
.
loading
=
false
// this.bu1.loading = false
}
// }
})
// })
}
}
})
})
}
}
...
@@ -183,24 +182,23 @@ export class DepartmentRegisterComponent implements OnInit {
...
@@ -183,24 +182,23 @@ export class DepartmentRegisterComponent implements OnInit {
reverseButtons
:
true
,
reverseButtons
:
true
,
}).
then
((
result
)
=>
{
}).
then
((
result
)
=>
{
if
(
result
.
isConfirmed
)
{
if
(
result
.
isConfirmed
)
{
console
.
log
(
" 🐒 result:"
,
result
)
this
.
bu1
.
loading
=
true
// this.bu1.loading = true
const
selectedKeys
=
Array
.
from
(
this
.
selectedItems
.
data
.
keys
());
// const selectedKeys = Array.from(this.selectedItems.data.keys());
const
body
=
this
.
bu1
.
dataList
.
filter
(
x
=>
selectedKeys
.
includes
(
x
.
bu1id
)
&&
this
.
selectedItems
.
data
.
get
(
x
.
bu1id
)).
map
(
x
=>
new
MyBu1Model
(
x
))
// const body = this.bu1.dataList.filter(x => selectedKeys.includes(x.bu1id) && this.selectedItems.data.get(x.bu1id)).map(x => new MyBu1Model(x))
this
.
bu1Service
.
delete
(
body
).
subscribe
({
// this.bu1Service.delete(body).subscribe({
next
:
response
=>
{
// next: response => {
if
(
response
.
success
)
{
// if (response.success) {
this
.
showAlert
(
response
.
message
,
'success'
)
// this.showAlert(response.message, 'success')
this
.
getBu1List
()
// this.getBu1List()
}
else
{
// } else {
this
.
showAlert
(
response
.
message
,
'error'
)
// this.showAlert(response.message, 'error')
this
.
bu1
.
loading
=
false
// this.bu1.loading = false
}
// }
},
error
:
error
=>
{
// }, error: error => {
this
.
showAlert
(
error
.
message
,
'error'
)
// this.showAlert(error.message, 'error')
this
.
bu1
.
loading
=
false
// this.bu1.loading = false
}
// }
})
// })
}
}
});
});
}
}
...
...
src/app/components/company-components/company-registration/branch-business-unit/section-registration/section-registration.component.html
View file @
2a30be7c
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 @
2a30be7c
import
{
ChangeDetectorRef
,
Component
,
EventEmitter
,
Input
,
OnInit
,
}
from
'@angular/core'
;
import
{
ChangeDetectorRef
,
Component
,
EventEmitter
,
Input
,
OnInit
,
}
from
'@angular/core'
;
import
{
ColumnModel
}
from
'@syncfusion/ej2-grids'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
Bu2Model
,
MyBu2Model
}
from
'src/app/shared/model/bu2.model'
;
import
{
Bu2Model
,
MyBu2Model
}
from
'src/app/shared/model/bu2.model'
;
import
{
Bu3Model
,
MyBu3Model
}
from
'src/app/shared/model/bu3.model'
;
import
{
Bu3Model
,
MyBu3Model
}
from
'src/app/shared/model/bu3.model'
;
...
@@ -17,25 +18,10 @@ interface table {
...
@@ -17,25 +18,10 @@ interface table {
styleUrls
:
[
'./section-registration.component.scss'
]
styleUrls
:
[
'./section-registration.component.scss'
]
})
})
export
class
SectionRegistrationComponent
implements
OnInit
{
export
class
SectionRegistrationComponent
implements
OnInit
{
bu3List
:
{
check
:
boolean
,
data
:
Bu3Model
}[]
=
[]
bu3
:
{
loading
:
boolean
,
select
:
Bu3Model
,
dataList
:
Bu3Model
[]
}
=
{
loading
:
false
,
select
:
new
MyBu3Model
(),
dataList
:
[]
}
bu3ListLoading
=
false
bu3
:
Bu3Model
=
new
MyBu3Model
()
bu3Table
:
table
=
{
currentPage
:
1
,
page
:
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
),
search
:
""
,
pageSize
:
10
}
selectedFile
:
File
|
null
=
null
;
selectedFile
:
File
|
null
=
null
;
selectedFileName
:
string
=
'กรุณาเลือกไฟล์'
;
selectedFileName
:
string
=
'กรุณาเลือกไฟล์'
;
bu3Modal
:
table
=
{
currentPage
:
1
,
page
:
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
),
search
:
""
,
pageSize
:
10
}
bu2List
:
Bu2Model
[]
=
[]
bu2List
:
Bu2Model
[]
=
[]
bu2
:
Bu2Model
=
new
MyBu2Model
()
bu2
:
Bu2Model
=
new
MyBu2Model
()
bu2Modal
:
table
=
{
bu2Modal
:
table
=
{
...
@@ -46,9 +32,30 @@ export class SectionRegistrationComponent implements OnInit {
...
@@ -46,9 +32,30 @@ export class SectionRegistrationComponent implements OnInit {
}
}
currentModal
:
'add'
|
'edit'
|
'delete'
=
"add"
currentModal
:
'add'
|
'edit'
|
'delete'
=
"add"
numDataListChecked
=
0
isDataListChecked
=
false
columns
:
ColumnModel
[]
=
[{
isDataListCheckedAll
=
false
field
:
"bu3id"
,
headerText
:
"รหัสฝ่าย"
,
type
:
"string"
,
isPrimaryKey
:
true
,
},
{
field
:
"tdesc"
,
headerText
:
"รายละเอียดฝ่าย(ไทย)"
,
type
:
"string"
},
{
field
:
"edesc"
,
headerText
:
"รายละเอียดฝ่าย(อังกฤษ)"
,
type
:
"string"
}]
searchSettings
=
{
fields
:
[
'bu3id'
,
'tdesc'
,
'edesc'
],
operator
:
'contains'
,
ignoreCase
:
false
};
search
=
''
selectedItems
:
{
key
:
string
,
count
:
number
,
data
:
Map
<
string
,
boolean
>
}
=
{
key
:
''
,
count
:
0
,
data
:
new
Map
<
string
,
boolean
>
()
};
constructor
(
private
bu3Service
:
Bu3Service
,
constructor
(
private
bu3Service
:
Bu3Service
,
private
bu2Service
:
Bu2Service
,
private
bu2Service
:
Bu2Service
,
private
toastr
:
ToastrService
,
private
toastr
:
ToastrService
,
...
@@ -73,7 +80,7 @@ export class SectionRegistrationComponent implements OnInit {
...
@@ -73,7 +80,7 @@ export class SectionRegistrationComponent implements OnInit {
}
}
const
formData
=
new
FormData
();
const
formData
=
new
FormData
();
formData
.
append
(
'file'
,
this
.
selectedFile
);
formData
.
append
(
'file'
,
this
.
selectedFile
);
this
.
bu3
ListL
oading
=
true
this
.
bu3
.
l
oading
=
true
this
.
fileService
.
uploadExcel
(
formData
,
'mbu3'
).
subscribe
({
this
.
fileService
.
uploadExcel
(
formData
,
'mbu3'
).
subscribe
({
next
:
response
=>
{
next
:
response
=>
{
if
(
response
.
success
)
{
if
(
response
.
success
)
{
...
@@ -81,11 +88,11 @@ export class SectionRegistrationComponent implements OnInit {
...
@@ -81,11 +88,11 @@ export class SectionRegistrationComponent implements OnInit {
this
.
getBu3List
()
this
.
getBu3List
()
}
else
{
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
bu3
ListL
oading
=
false
this
.
bu3
.
l
oading
=
false
}
}
},
error
:
error
=>
{
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
bu3
ListL
oading
=
false
this
.
bu3
.
l
oading
=
false
}
}
})
})
}
}
...
@@ -110,80 +117,62 @@ export class SectionRegistrationComponent implements OnInit {
...
@@ -110,80 +117,62 @@ export class SectionRegistrationComponent implements OnInit {
}
}
getBu3List
()
{
getBu3List
()
{
this
.
bu3
ListL
oading
=
true
this
.
bu3
.
l
oading
=
true
this
.
bu3Service
.
getList
().
subscribe
({
this
.
bu3Service
.
getList
().
subscribe
({
next
:
response
=>
{
next
:
response
=>
{
this
.
bu3List
=
response
.
map
(
x
=>
({
check
:
false
,
data
:
new
MyBu3Model
(
x
)
}))
this
.
bu3
.
dataList
=
response
.
map
(
x
=>
{
this
.
bu3ListLoading
=
false
this
.
selectedItems
.
data
.
set
(
x
.
bu3id
,
false
)
this
.
onBu3TableSearchChange
()
return
new
MyBu3Model
(
x
)
this
.
isDataListCheckedAll
=
false
})
this
.
dataListCheckAll
()
this
.
selectedItems
.
key
=
'bu3id'
this
.
selectedItems
.
count
=
0
this
.
bu3
.
loading
=
false
this
.
cdr
.
detectChanges
()
this
.
cdr
.
detectChanges
()
},
error
:
error
=>
{
},
error
:
error
=>
{
this
.
bu3
ListL
oading
=
false
this
.
bu3
.
l
oading
=
false
this
.
cdr
.
detectChanges
()
this
.
cdr
.
detectChanges
()
}
}
})
})
}
}
onBu3TableSearchChange
()
{
this
.
bu3Table
.
currentPage
=
1
this
.
bu3Table
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
filterBu3Table
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
this
.
dataListCheck
()
}
filterBu3Table
()
{
return
this
.
bu3List
.
filter
(
x
=>
{
const
data
=
x
.
data
return
data
.
bu3id
.
toLowerCase
().
includes
(
this
.
bu3Table
.
search
.
toLowerCase
())
||
data
.
tdesc
.
toLowerCase
().
includes
(
this
.
bu3Table
.
search
.
toLowerCase
())
||
data
.
edesc
.
toLowerCase
().
includes
(
this
.
bu3Table
.
search
.
toLowerCase
())
})
}
selectBu3
(
bu3
?:
Bu3Model
)
{
selectBu3
(
bu3
?:
Bu3Model
)
{
this
.
bu3
=
new
MyBu3Model
(
bu3
)
if
(
bu3
)
{
this
.
bu3
.
select
=
new
MyBu3Model
(
bu3
)
}
else
if
(
this
.
currentModal
==
'add'
)
{
this
.
bu3
.
select
=
new
MyBu3Model
()
}
else
if
(
this
.
currentModal
==
'edit'
)
{
this
.
bu3
.
select
=
new
MyBu3Model
({
bu3id
:
this
.
bu3
.
select
.
bu3id
})
}
this
.
selectBu2
()
this
.
selectBu2
()
if
(
this
.
bu3
.
parent
)
{
if
(
this
.
bu3
.
select
.
parent
)
{
this
.
bu2Service
.
getById
(
this
.
bu3
.
parent
).
subscribe
(
response
=>
{
this
.
bu2Service
.
getById
(
this
.
bu3
.
select
.
parent
).
subscribe
(
response
=>
{
this
.
bu2
=
new
MyBu2Model
(
response
)
this
.
bu2
=
new
MyBu2Model
(
response
)
this
.
cdr
.
detectChanges
()
this
.
cdr
.
detectChanges
()
})
})
}
}
}
}
// bu3idChange() {
// const bu3 = this.bu3List.find(x => x.bu3id == this.bu3.bu3id)
// this.selectBu3(bu3 || new MyBu3Model({ bu3id: this.bu3.bu3id }))
// }
onBu3ModalSearchChange
()
{
this
.
bu3Modal
.
currentPage
=
1
this
.
bu3Modal
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
filterBu3Modal
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
}
filterBu3Modal
()
{
return
this
.
bu3List
.
filter
(
x
=>
{
const
data
=
x
.
data
return
data
.
bu3id
.
toLowerCase
().
includes
(
this
.
bu3Table
.
search
.
toLowerCase
())
||
data
.
tdesc
.
toLowerCase
().
includes
(
this
.
bu3Table
.
search
.
toLowerCase
())
||
data
.
edesc
.
toLowerCase
().
includes
(
this
.
bu3Table
.
search
.
toLowerCase
())
})
}
addBu3
()
{
addBu3
()
{
this
.
bu3
ListL
oading
=
true
this
.
bu3
.
l
oading
=
true
this
.
bu3Service
.
post
({
...
this
.
bu3
,
parent
:
this
.
bu2
.
bu2id
}).
subscribe
({
this
.
bu3Service
.
post
({
...
this
.
bu3
.
select
,
parent
:
this
.
bu2
.
bu2id
}).
subscribe
({
next
:
response
=>
{
next
:
response
=>
{
if
(
response
.
success
)
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getBu3List
()
this
.
getBu3List
()
}
else
{
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
bu3
ListL
oading
=
false
this
.
bu3
.
l
oading
=
false
}
}
},
error
:
error
=>
{
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
bu3
ListL
oading
=
false
this
.
bu3
.
l
oading
=
false
}
}
})
})
}
}
deleteBu3
()
{
deleteBu3
()
{
this
.
bu3ListLoading
=
true
this
.
bu3
.
loading
=
true
const
body
=
this
.
bu3List
.
filter
(
x
=>
x
.
check
).
map
(
x
=>
new
MyBu3Model
(
x
.
data
))
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
({
this
.
bu3Service
.
delete
(
body
).
subscribe
({
next
:
response
=>
{
next
:
response
=>
{
if
(
response
.
success
)
{
if
(
response
.
success
)
{
...
@@ -191,11 +180,11 @@ export class SectionRegistrationComponent implements OnInit {
...
@@ -191,11 +180,11 @@ export class SectionRegistrationComponent implements OnInit {
this
.
getBu3List
()
this
.
getBu3List
()
}
else
{
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
bu3
ListL
oading
=
false
this
.
bu3
.
l
oading
=
false
}
}
},
error
:
error
=>
{
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
bu3
ListL
oading
=
false
this
.
bu3
.
l
oading
=
false
}
}
})
})
}
}
...
@@ -230,21 +219,20 @@ export class SectionRegistrationComponent implements OnInit {
...
@@ -230,21 +219,20 @@ export class SectionRegistrationComponent implements OnInit {
})
})
}
}
dataListCheckAll
()
{
checkPrimary
()
{
const
selectAll
=
this
.
isDataListCheckedAll
;
return
this
.
bu3
.
dataList
.
find
(
x
=>
x
.
bu3id
==
this
.
bu3
.
select
.
bu3id
)
this
.
filterBu3Table
().
forEach
(
x
=>
x
.
check
=
selectAll
);
this
.
dataListCheck
();
}
}
dataListCheck
()
{
const
dataCheck
=
this
.
filterBu3Table
();
numSelectItem
()
{
this
.
isDataListCheckedAll
=
dataCheck
.
length
?
dataCheck
.
every
(
x
=>
x
.
check
)
:
false
;
const
selectedKeys
=
Array
.
from
(
this
.
selectedItems
.
data
.
keys
())
;
this
.
numDataListChecked
=
this
.
bu3List
.
filter
(
x
=>
x
.
check
).
length
const
num
=
this
.
bu3
.
dataList
.
filter
(
x
=>
selectedKeys
.
includes
(
x
.
bu3id
)
&&
this
.
selectedItems
.
data
.
get
(
x
.
bu3id
)
).
length
this
.
isDataListChecked
=
Boolean
(
this
.
numDataListChecked
)
return
num
}
}
checkPrimary
(
)
{
onSelectItemChange
(
arg
:
any
)
{
return
this
.
bu3List
.
find
(
x
=>
x
.
data
.
bu3id
==
this
.
bu3
.
bu3id
)
this
.
selectedItems
=
arg
}
}
}
}
src/environments/environment.prod.ts
View file @
2a30be7c
export
const
environment
=
{
export
const
environment
=
{
production
:
true
,
production
:
true
,
firebase
:
{
baseUrl
:
window
.
location
.
origin
+
'/api'
,
apiKey
:
'********************************'
,
}
authDomain
:
'********************************'
,
projectId
:
'********************************'
,
storageBucket
:
'********************************'
,
messagingSenderId
:
'********************************'
,
appId
:
'********************************'
,
measurementId
:
'********************************'
,
},
};
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