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
7c9e1e0e
Commit
7c9e1e0e
authored
Apr 11, 2025
by
Nattana Chaiyamat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ส่วนย่อย1
parent
f048227e
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
69 deletions
+67
-69
section-registration.component.html
.../section-registration/section-registration.component.html
+1
-1
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
+66
-68
No files found.
src/app/components/company-components/company-registration/branch-business-unit/section-registration/section-registration.component.html
View file @
7c9e1e0e
...
@@ -122,7 +122,7 @@
...
@@ -122,7 +122,7 @@
</label>
</label>
<div
class=
"relative flex rounded-md w-1/2"
>
<div
class=
"relative flex rounded-md w-1/2"
>
<input
type=
"text"
class=
"ti-form-input"
[
class
.!
bg-input-readonly
]="
currentModal=
='edit'"
<input
type=
"text"
class=
"ti-form-input"
[
class
.!
bg-input-readonly
]="
currentModal=
='edit'"
[
re
quired
]="
currentModal=
='edit'"
[
class
.!
border-red
]="
currentModal=
='add'&&checkPrimary()"
[
re
adonly
]="
currentModal=
='edit'"
[
class
.!
border-red
]="
currentModal=
='add'&&checkPrimary()"
[(
ngModel
)]="
bu3
.
select
.
bu3id
"
>
[(
ngModel
)]="
bu3
.
select
.
bu3id
"
>
</div>
</div>
<label
for=
"detail_th"
class=
"ti-form-label mt-2rem"
>
รายละเอียดส่วน (ไทย)
<span
<label
for=
"detail_th"
class=
"ti-form-label mt-2rem"
>
รายละเอียดส่วน (ไทย)
<span
...
...
src/app/components/company-components/company-registration/branch-business-unit/sub-department-one/sub-department-one.component.html
View file @
7c9e1e0e
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 @
7c9e1e0e
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
{
Bu3Model
,
MyBu3Model
}
from
'src/app/shared/model/bu3.model'
;
import
{
Bu3Model
,
MyBu3Model
}
from
'src/app/shared/model/bu3.model'
;
import
{
Bu4Model
,
MyBu4Model
}
from
'src/app/shared/model/bu4.model'
;
import
{
Bu4Model
,
MyBu4Model
}
from
'src/app/shared/model/bu4.model'
;
...
@@ -17,15 +18,7 @@ interface table {
...
@@ -17,15 +18,7 @@ interface table {
styleUrls
:
[
'./sub-department-one.component.scss'
]
styleUrls
:
[
'./sub-department-one.component.scss'
]
})
})
export
class
SubDepartmentOneComponent
implements
OnInit
{
export
class
SubDepartmentOneComponent
implements
OnInit
{
bu4List
:
{
check
:
boolean
,
data
:
Bu4Model
}[]
=
[]
bu4
:
{
loading
:
boolean
,
select
:
Bu4Model
,
dataList
:
Bu4Model
[]
}
=
{
loading
:
false
,
select
:
new
MyBu4Model
(),
dataList
:
[]
}
bu4ListLoading
=
false
bu4
:
Bu4Model
=
new
MyBu4Model
()
bu4Table
:
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
=
'กรุณาเลือกไฟล์'
;
...
@@ -46,9 +39,30 @@ export class SubDepartmentOneComponent implements OnInit {
...
@@ -46,9 +39,30 @@ export class SubDepartmentOneComponent implements OnInit {
}
}
currentModal
:
'add'
|
'edit'
|
'delete'
=
"add"
currentModal
:
'add'
|
'edit'
|
'delete'
=
"add"
numDataListChecked
=
0
isDataListChecked
=
false
columns
:
ColumnModel
[]
=
[{
isDataListCheckedAll
=
false
field
:
"bu4id"
,
headerText
:
"รหัสฝ่าย"
,
type
:
"string"
,
isPrimaryKey
:
true
,
},
{
field
:
"tdesc"
,
headerText
:
"รายละเอียดฝ่าย(ไทย)"
,
type
:
"string"
},
{
field
:
"edesc"
,
headerText
:
"รายละเอียดฝ่าย(อังกฤษ)"
,
type
:
"string"
}]
searchSettings
=
{
fields
:
[
'bu4id'
,
'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
bu4Service
:
Bu4Service
,
constructor
(
private
bu4Service
:
Bu4Service
,
private
bu3Service
:
Bu3Service
,
private
bu3Service
:
Bu3Service
,
private
toastr
:
ToastrService
,
private
toastr
:
ToastrService
,
...
@@ -73,7 +87,7 @@ export class SubDepartmentOneComponent implements OnInit {
...
@@ -73,7 +87,7 @@ export class SubDepartmentOneComponent implements OnInit {
}
}
const
formData
=
new
FormData
();
const
formData
=
new
FormData
();
formData
.
append
(
'file'
,
this
.
selectedFile
);
formData
.
append
(
'file'
,
this
.
selectedFile
);
this
.
bu4
ListL
oading
=
true
this
.
bu4
.
l
oading
=
true
this
.
fileService
.
uploadExcel
(
formData
,
'mbu4'
).
subscribe
({
this
.
fileService
.
uploadExcel
(
formData
,
'mbu4'
).
subscribe
({
next
:
response
=>
{
next
:
response
=>
{
if
(
response
.
success
)
{
if
(
response
.
success
)
{
...
@@ -81,11 +95,11 @@ export class SubDepartmentOneComponent implements OnInit {
...
@@ -81,11 +95,11 @@ export class SubDepartmentOneComponent implements OnInit {
this
.
getBu4List
()
this
.
getBu4List
()
}
else
{
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
bu4
ListL
oading
=
false
this
.
bu4
.
l
oading
=
false
}
}
},
error
:
error
=>
{
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
bu4
ListL
oading
=
false
this
.
bu4
.
l
oading
=
false
}
}
})
})
}
}
...
@@ -109,74 +123,62 @@ export class SubDepartmentOneComponent implements OnInit {
...
@@ -109,74 +123,62 @@ export class SubDepartmentOneComponent implements OnInit {
}
}
getBu4List
()
{
getBu4List
()
{
this
.
bu4
ListL
oading
=
true
this
.
bu4
.
l
oading
=
true
this
.
bu4Service
.
getList
().
subscribe
({
this
.
bu4Service
.
getList
().
subscribe
({
next
:
response
=>
{
next
:
response
=>
{
this
.
bu4List
=
response
.
map
(
x
=>
({
check
:
false
,
data
:
new
MyBu4Model
(
x
)
}))
this
.
bu4
.
dataList
=
response
.
map
(
x
=>
{
this
.
bu4ListLoading
=
false
this
.
selectedItems
.
data
.
set
(
x
.
bu4id
,
false
)
this
.
onBu4TableSearchChange
()
return
new
MyBu4Model
(
x
)
})
this
.
selectedItems
.
key
=
'bu4id'
this
.
selectedItems
.
count
=
0
this
.
bu4
.
loading
=
false
this
.
cdr
.
detectChanges
()
this
.
cdr
.
detectChanges
()
},
error
:
error
=>
{
},
error
:
error
=>
{
this
.
bu4
ListL
oading
=
false
this
.
bu4
.
l
oading
=
false
this
.
cdr
.
detectChanges
()
this
.
cdr
.
detectChanges
()
}
}
})
})
}
}
onBu4TableSearchChange
()
{
this
.
bu4Table
.
currentPage
=
1
this
.
bu4Table
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
filterBu4Table
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
this
.
dataListCheck
()
}
filterBu4Table
()
{
return
this
.
bu4List
.
filter
(
x
=>
{
const
data
=
x
.
data
return
data
.
bu4id
.
toLowerCase
().
includes
(
this
.
bu4Table
.
search
.
toLowerCase
())
||
data
.
tdesc
.
toLowerCase
().
includes
(
this
.
bu4Table
.
search
.
toLowerCase
())
||
data
.
edesc
.
toLowerCase
().
includes
(
this
.
bu4Table
.
search
.
toLowerCase
())
})
}
selectBu4
(
bu4
?:
Bu4Model
)
{
selectBu4
(
bu4
?:
Bu4Model
)
{
this
.
bu4
=
new
MyBu4Model
(
bu4
||
{})
if
(
bu4
)
{
this
.
bu4
.
select
=
new
MyBu4Model
(
bu4
)
}
else
if
(
this
.
currentModal
==
'add'
)
{
this
.
bu4
.
select
=
new
MyBu4Model
()
}
else
if
(
this
.
currentModal
==
'edit'
)
{
this
.
bu4
.
select
=
new
MyBu4Model
({
bu4id
:
this
.
bu4
.
select
.
bu4id
})
}
this
.
selectBu3
()
this
.
selectBu3
()
if
(
this
.
bu4
.
parent
)
{
if
(
this
.
bu4
.
select
.
parent
)
{
this
.
bu3Service
.
getById
(
this
.
bu4
.
parent
).
subscribe
(
response
=>
{
this
.
bu3Service
.
getById
(
this
.
bu4
.
select
.
parent
).
subscribe
(
response
=>
{
this
.
bu3
=
new
MyBu3Model
(
response
)
this
.
bu3
=
new
MyBu3Model
(
response
)
this
.
cdr
.
detectChanges
()
this
.
cdr
.
detectChanges
()
})
})
}
}
}
}
onBu4ModalSearchChange
()
{
this
.
bu4Modal
.
currentPage
=
1
this
.
bu4Modal
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
filterBu4Modal
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
}
filterBu4Modal
()
{
return
this
.
bu4List
.
filter
(
x
=>
{
const
data
=
x
.
data
return
data
.
bu4id
.
toLowerCase
().
includes
(
this
.
bu4Table
.
search
.
toLowerCase
())
||
data
.
tdesc
.
toLowerCase
().
includes
(
this
.
bu4Table
.
search
.
toLowerCase
())
||
data
.
edesc
.
toLowerCase
().
includes
(
this
.
bu4Table
.
search
.
toLowerCase
())
})
}
addBu4
()
{
addBu4
()
{
this
.
bu4
ListL
oading
=
true
this
.
bu4
.
l
oading
=
true
this
.
bu4Service
.
post
({
...
this
.
bu4
,
parent
:
this
.
bu3
.
bu3id
}).
subscribe
({
this
.
bu4Service
.
post
({
...
this
.
bu4
.
select
,
parent
:
this
.
bu3
.
bu3id
}).
subscribe
({
next
:
response
=>
{
next
:
response
=>
{
if
(
response
.
success
)
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getBu4List
()
this
.
getBu4List
()
}
else
{
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
bu4
ListL
oading
=
false
this
.
bu4
.
l
oading
=
false
}
}
},
error
:
error
=>
{
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
bu4
ListL
oading
=
false
this
.
bu4
.
l
oading
=
false
}
}
})
})
}
}
deleteBu4
()
{
deleteBu4
()
{
this
.
bu4ListLoading
=
true
this
.
bu4
.
loading
=
true
const
body
=
this
.
bu4List
.
filter
(
x
=>
x
.
check
).
map
(
x
=>
new
MyBu4Model
(
x
.
data
))
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
({
this
.
bu4Service
.
delete
(
body
).
subscribe
({
next
:
response
=>
{
next
:
response
=>
{
if
(
response
.
success
)
{
if
(
response
.
success
)
{
...
@@ -184,11 +186,11 @@ export class SubDepartmentOneComponent implements OnInit {
...
@@ -184,11 +186,11 @@ export class SubDepartmentOneComponent implements OnInit {
this
.
getBu4List
()
this
.
getBu4List
()
}
else
{
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
bu4
ListL
oading
=
false
this
.
bu4
.
l
oading
=
false
}
}
},
error
:
error
=>
{
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
bu4
ListL
oading
=
false
this
.
bu4
.
l
oading
=
false
}
}
})
})
}
}
...
@@ -224,22 +226,18 @@ export class SubDepartmentOneComponent implements OnInit {
...
@@ -224,22 +226,18 @@ export class SubDepartmentOneComponent implements OnInit {
}
}
dataListCheckAll
()
{
checkPrimary
()
{
const
selectAll
=
this
.
isDataListCheckedAll
;
return
this
.
bu4
.
dataList
.
find
(
x
=>
x
.
bu4id
==
this
.
bu4
.
select
.
bu4id
)
this
.
filterBu4Table
().
forEach
(
x
=>
x
.
check
=
selectAll
);
this
.
dataListCheck
();
}
}
dataListCheck
()
{
numSelectItem
()
{
const
dataCheck
=
this
.
filterBu4Table
();
const
selectedKeys
=
Array
.
from
(
this
.
selectedItems
.
data
.
keys
());
this
.
isDataListCheckedAll
=
dataCheck
.
length
?
dataCheck
.
every
(
x
=>
x
.
check
)
:
false
;
const
num
=
this
.
bu4
.
dataList
.
filter
(
x
=>
selectedKeys
.
includes
(
x
.
bu4id
)
&&
this
.
selectedItems
.
data
.
get
(
x
.
bu4id
)).
length
this
.
numDataListChecked
=
this
.
bu4List
.
filter
(
x
=>
x
.
check
).
length
return
num
this
.
isDataListChecked
=
Boolean
(
this
.
numDataListChecked
)
}
}
onSelectItemChange
(
arg
:
any
)
{
checkPrimary
()
{
this
.
selectedItems
=
arg
return
this
.
bu4List
.
find
(
x
=>
x
.
data
.
bu4id
==
this
.
bu4
.
bu4id
)
}
}
}
}
...
...
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