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
6198a78e
Commit
6198a78e
authored
Apr 09, 2025
by
Nattana Chaiyamat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
กำหนดกลุ่มการอนุมัติ
parent
9e34f55b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
305 additions
and
387 deletions
+305
-387
department-list.component.html
...iness-unit/department-list/department-list.component.html
+67
-229
department-list.component.ts
...usiness-unit/department-list/department-list.component.ts
+57
-66
department-register.component.html
...it/department-register/department-register.component.html
+63
-26
department-register.component.ts
...unit/department-register/department-register.component.ts
+93
-40
company-registration-page.component.html
...egistration-page/company-registration-page.component.html
+22
-22
company-registration-page.component.ts
...-registration-page/company-registration-page.component.ts
+3
-4
No files found.
src/app/components/company-components/company-registration/branch-business-unit/department-list/department-list.component.html
View file @
6198a78e
<div
class=
"w-full min-height-50px mb-10px justify-between items-center"
>
<div
class=
"w-full min-height-50px mb-10px justify-between items-center"
>
<div
class=
"flex justify-between"
>
<div
class=
"flex justify-end"
>
<div
class=
"flex"
>
<div
class=
"px-1"
>
<div
class=
"flex items-center"
>
<div
class=
"relative shadow-md"
>
<input
type=
"checkbox"
class=
"ti-form-checkbox pointer-events-none"
id=
"hs-default-checkbox"
<input
type=
"text"
id=
"hs-leading-icon"
name=
"hs-leading-icon"
[(
ngModel
)]="
isDataListChecked
"
>
class=
"ti-form-input ltr:pl-11 rtl:pr-11 focus:z-10 "
placeholder=
"Search by No. or Name"
<label
for=
"hs-default-checkbox"
class=
"text-sm text-gray-500 mx-2 pointer-events-none"
>
[(
ngModel
)]="
search
"
>
{{numDataListChecked}} Selected
</label>
</div>
<div
class=
"mx-1 flex items-center"
>
<button
(
click
)="
isDataListCheckedAll =
!isDataListCheckedAll;dataListCheckAll()"
id=
'check-boxall'
class=
"focus:ring-2 focus:ring-primary rounded-sm flex item-center"
>
<i
class=
"fs-l transition-all duration-200"
[
ngClass
]="{'
ri-checkbox-multiple-line
text-gray-500
'
:
!
isDataListCheckedAll
,
'
ri-checkbox-multiple-fill
text-primary
'
:
isDataListCheckedAll
}"
></i>
</button>
<label
class=
"text-sm text-gray-500 ml-2"
for=
"check-boxall"
>
Select All
</label>
</div>
</div>
<div
class=
"flex justify-end"
>
<div
class=
"px-1"
>
<div
class=
"relative shadow-md"
>
<input
type=
"text"
id=
"hs-leading-icon"
name=
"hs-leading-icon"
class=
"ti-form-input ltr:pl-11 rtl:pr-11 focus:z-10 "
placeholder=
"Search by No. or Name"
[(
ngModel
)]="
bu2Table
.
search
"
(
ngModelChange
)="
onBu2TableSearchChange
()"
>
<div
<div
class=
"absolute inset-y-0 ltr:left-0 rtl:right-0 flex items-center pointer-events-none z-20 ltr:pl-4 rtl:pr-4"
>
class=
"absolute inset-y-0 ltr:left-0 rtl:right-0 flex items-center pointer-events-none z-20 ltr:pl-4 rtl:pr-4"
>
<i
class=
"ri-search-line text-gray"
></i>
<i
class=
"ri-search-line text-gray"
></i>
</div>
</div>
</div>
</div>
</div>
<div
class=
"px-1"
>
<button
type=
"button"
class=
" h-45px ti-btn ti-btn bg-pink-500/10 text-pink-500 hover:text-white hover:bg-pink-500 ring-offset-white focus:ring-pink-500 dark:focus:ring-offset-white/10 h-10 m-0 shadow-md"
data-hs-overlay=
"#department-list-upload-modal"
(
click
)="
fileInput
.
value =
''
;
selectedFile=
null;selectedFileName
=
'กรุณาเลือกไฟล์'"
>
<i
class=
"ti ti-file-plus"
></i>
import
</button>
</div>
<div
class=
"px-1"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-secondary h-45px m-0 shadow-md"
(
click
)="
currentModal=
'add'
;
selectBu1
();
selectBu2
()"
data-hs-overlay=
"#department-list-modal-add"
>
<i
class=
"ri-add-line"
></i>
Add
</button>
</div>
<!-- <div class="px-1">
<button href="javascript:void(0);" class="ti-btn ti-btn-soft-info h-45px m-0 shadow-md">
<i class="ri-printer-line"></i>
Print
</button>
</div> -->
<div
class=
"px-1"
>
<button
href=
"javascript:void(0);"
class=
"ti-btn ti-btn-soft-danger h-45px m-0 shadow-md"
(
click
)="
currentModal=
'delete'
;
selectBu1
()"
data-hs-overlay=
"#department-list-alert-delete-modal"
>
<i
class=
"ri-delete-bin-6-line"
></i>
Delete
</button>
</div>
<!-- <div class="px-1">
<button href="javascript:void(0);" class="ti-btn ti-btn-soft-warning h-45px m-0 shadow-md">
<i class="ti ti-book fs-l"></i>
Help
</button>
</div> -->
</div>
</div>
<div
class=
"px-1"
>
<button
type=
"button"
class=
" h-45px ti-btn ti-btn bg-pink-500/10 text-pink-500 hover:text-white hover:bg-pink-500 ring-offset-white focus:ring-pink-500 dark:focus:ring-offset-white/10 h-10 m-0 shadow-md"
data-hs-overlay=
"#department-list-upload-modal"
(
click
)="
fileInput
.
value =
''
;
selectedFile=
null;selectedFileName
=
'กรุณาเลือกไฟล์'"
>
<i
class=
"ti ti-file-plus"
></i>
import
</button>
</div>
<div
class=
"px-1"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-secondary h-45px m-0 shadow-md"
(
click
)="
currentModal=
'add'
;
selectBu1
();
selectBu2
()"
data-hs-overlay=
"#department-list-modal"
>
<i
class=
"ri-add-line"
></i>
Add
</button>
</div>
<!-- <div class="px-1">
<button href="javascript:void(0);" class="ti-btn ti-btn-soft-info h-45px m-0 shadow-md">
<i class="ri-printer-line"></i>
Print
</button>
</div> -->
<div
class=
"px-1"
>
<button
href=
"javascript:void(0);"
class=
"ti-btn ti-btn-soft-danger h-45px m-0 shadow-md"
(
click
)="
currentModal=
'delete'
;
selectBu1
()"
data-hs-overlay=
"#department-list-alert-delete-modal"
>
<i
class=
"ri-delete-bin-6-line"
></i>
Delete
</button>
</div>
<!-- <div class="px-1">
<button href="javascript:void(0);" class="ti-btn ti-btn-soft-warning h-45px m-0 shadow-md">
<i class="ti ti-book fs-l"></i>
Help
</button>
</div> -->
</div>
</div>
</div>
</div>
<div
class=
"page px-rem"
>
<div
class=
"page px-rem"
>
<div
class=
"overflow-auto shadow-md rounded-t-md"
>
<app-datagrid-syncfution
[
searchSettings
]="
searchSettings
"
[
searchText
]="
search
"
[
dataSource
]="
bu2List
"
<table
class=
"ti-custom-table ti-custom-table-head ti-custom-table-hover table-bordered"
>
[
columns
]="
columns
"
[
modalName
]="'#
department-list-modal
'"
[
selectedItems
]="
selectedItems
"
<thead>
(
sendSelectData
)="
currentModal=
'edit'
;
selectBu2
($
event
)"
(
sendSelectedItems
)="
onSelectItemChange
($
event
)"
>
<tr>
</app-datagrid-syncfution>
<ng-container
*
ngFor=
"let item of ['','รหัสแผนก','รายละเอียดแผนก (ไทย)','รายละเอียดแผนก (อังกฤษ)','การจัดการ']; let f = first; let l = last"
>
<th
scope=
"col"
class=
"relative px-10px py-10px bg-soft-secondary text-primary !text-center"
>
<span
class=
"font-size-12px font-weight-700"
>
{{ item }}
</span>
<div
class=
"absolute top-1/2 transform -translate-y-1/2 right-0"
*
ngIf=
"!f&&!l"
>
<i
class=
"ti ti-dots-vertical fs-l"
></i>
</div>
</th>
</ng-container>
</tr>
</thead>
<tbody
*
ngIf=
"bu2ListLoading"
>
<tr>
<td
class=
"text-center"
colspan=
"100%"
>
<div
*
ngFor=
"let item of [1,2,3]"
class=
"ti-spinner w-8 h-8 text-secondary mx-1"
role=
"status"
aria-label=
"loading"
>
<span
class=
"sr-only"
>
Loading...
</span>
</div>
</td>
</tr>
</tbody>
<tbody
*
ngIf=
"!bu2ListLoading&&!filterBu2Table().length"
>
<tr>
<td
class=
"text-center"
colspan=
"100%"
>
ไม่พบข้อมูล
</td>
</tr>
</tbody>
<tbody
*
ngIf=
"!bu2ListLoading&&filterBu2Table().length"
>
<tr
*
ngFor=
"let item of filterBu2Table() | slice:((bu2Table.currentPage-1) * bu2Table.pageSize) : (((bu2Table.currentPage-1) * bu2Table.pageSize) + bu2Table.pageSize);let i = index"
>
<td
class=
"text-center"
>
<input
type=
"checkbox"
class=
"ti-form-checkbox cursor-pointer"
id=
"checkbox-{{item.data.bu2id}}"
[(
ngModel
)]="
item
.
check
"
(
ngModelChange
)="
dataListCheck
()"
>
</td>
<td
class=
"text-center"
>
{{item.data.bu2id}}
</td>
<td>
{{item.data.tdesc}}
</td>
<td>
{{item.data.edesc}}
</td>
<td
class=
"flex justify-center"
>
<i
class=
"ti ti-edit cursor-pointer i-gray fs-l px-1"
(
click
)="
currentModal=
'edit'
;
selectBu2
(
item
.
data
)"
data-hs-overlay=
"#department-list-modal-edit"
></i>
<!-- <i class="ti ti-trash cursor-pointer i-gray fs-l px-1"
(click)="currentModal='delete';selectBu2(item)"
data-hs-overlay="#department-list-alert-delete-modal"></i> -->
</td>
</tr>
</tbody>
</table>
</div>
<app-pagination
[
totalItems
]="
filterBu2Table
().
length
"
[
pageSize
]="
bu2Table
.
pageSize
"
(
pageChange
)="
bu2Table
.
currentPage =
$event"
(
pageSizeChange
)="
bu2Table
.
pageSize =
$event;bu2Table.currentPage
=
1
"
></app-pagination>
</div>
</div>
<div
id=
"department-list-modal
-add
"
class=
"hs-overlay hidden ti-modal"
>
<div
id=
"department-list-modal"
class=
"hs-overlay hidden ti-modal"
>
<div
class=
"hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)]"
>
<div
class=
"hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)]"
>
<div
class=
"max-h-full overflow-hidden ti-modal-content"
>
<div
class=
"max-h-full overflow-hidden ti-modal-content"
>
<div
class=
"ti-modal-header"
>
<div
class=
"ti-modal-header"
>
<h3
class=
"text-xxl font-bold text-primary"
>
<h3
class=
"text-xxl font-bold text-primary"
>
เพิ่มข้อมูลทะเบียนเเผนก
เพิ่มข้อมูลทะเบียนเเผนก
</h3>
</h3>
<h3
class=
"text-xxl font-bold text-primary"
*
ngIf=
"currentModal=='add'"
>
เพิ่มข้อมูลทะเบียนเเผนก
</h3>
<h3
class=
"text-xxl font-bold text-primary"
*
ngIf=
"currentModal=='edit'"
>
แก้ไขข้อมูลทะเบียนเเผนก
</h3>
<div
class=
"flex justify-end"
>
<div
class=
"flex justify-end"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#department-list-modal
-add
"
>
data-hs-overlay=
"#department-list-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
</button>
...
@@ -203,7 +138,8 @@
...
@@ -203,7 +138,8 @@
</span></label>
</span></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 h-16"
<input
type=
"text"
class=
"ti-form-input h-16"
[
class
.!
border-red
]="
currentModal=
='add'&&checkPrimary()"
[(
ngModel
)]="
bu2
.
bu2id
"
>
[
class
.!
border-red
]="
currentModal=
='add'&&checkPrimary()"
[(
ngModel
)]="
bu2
.
bu2id
"
[
readonly
]="
currentModal=
='edit'"
[
class
.!
bg-input-readonly
]="
currentModal=
='edit'"
>
</div>
</div>
<label
for=
"detail_th"
class=
"ti-form-label mt-2rem"
>
รายละเอียดแผนก (ไทย)
<span
<label
for=
"detail_th"
class=
"ti-form-label mt-2rem"
>
รายละเอียดแผนก (ไทย)
<span
class=
"text-danger"
>
*
</span></label>
class=
"text-danger"
>
*
</span></label>
...
@@ -213,7 +149,7 @@
...
@@ -213,7 +149,7 @@
<div
class=
"flex justify-end mt-2rem mb-1rem space-x-4"
>
<div
class=
"flex justify-end mt-2rem mb-1rem space-x-4"
>
<button
type=
"button"
<button
type=
"button"
class=
"hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
class=
"hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay=
"#department-list-modal
-add
"
>
data-hs-overlay=
"#department-list-modal"
>
ย้อนกลับ
ย้อนกลับ
</button>
</button>
<button
class=
"ti-btn ti-btn-success"
type=
"button"
data-hs-overlay=
"#department-list-alert-modal"
<button
class=
"ti-btn ti-btn-success"
type=
"button"
data-hs-overlay=
"#department-list-alert-modal"
...
@@ -227,104 +163,6 @@
...
@@ -227,104 +163,6 @@
</div>
</div>
</div>
</div>
<div
id=
"department-list-modal-edit"
class=
"hs-overlay hidden ti-modal"
>
<div
class=
"hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)]"
>
<div
class=
"max-h-full overflow-hidden ti-modal-content"
>
<div
class=
"ti-modal-header"
>
<h3
class=
"text-xxl font-bold text-primary"
>
แก้ไขข้อมูลทะเบียนเเผนก
</h3>
<div
class=
"flex justify-end"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#department-list-modal-edit"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
</div>
</div>
<div
class=
"ti-modal-center"
>
<div
class=
"flex justify-end"
style=
"padding-right: 1rem;"
>
<div
class=
"px-1"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md"
(
click
)="
selectBu1
();
bu2
.
tdesc=
''
;
bu2
.
edesc=
''
"
>
<svg
class=
"svg-indigo"
width=
"16"
height=
"16"
viewBox=
"0 0 64.00 64.00"
xmlns=
"http://www.w3.org/2000/svg"
fill=
"none"
stroke=
"#595BEA"
stroke-width=
"3.84"
transform=
"rotate(45)matrix(-1, 0, 0, 1, 0, 0)"
>
<g
id=
"SVGRepo_bgCarrier"
stroke-width=
"0"
></g>
<g
id=
"SVGRepo_tracerCarrier"
stroke-linecap=
"round"
stroke-linejoin=
"round"
></g>
<g
id=
"SVGRepo_iconCarrier"
>
<path
d=
"M15 49A24 24 0 0 1 32 8"
></path>
<path
d=
"M49 15a24 24 0 0 1-17 41"
></path>
<polyline
points=
"15.03 40 15.03 48.97 8 48.97"
></polyline>
<polyline
points=
"48.97 24 48.97 15.03 56 15.03"
></polyline>
</g>
</svg>
Clear
</button>
</div>
<!-- <div class="px-1">
<button href="javascript:void(0);" class="ti-btn ti-btn-soft-warning h-45px m-0 shadow-md">
<i class="ti ti-book fs-l"></i>
Help
</button>
</div> -->
</div>
</div>
<div
class=
"ti-modal-body"
>
<label
for=
"hs-trailing-button-add-on-with-icon"
class=
"ti-form-label"
>
อยู่ภายใต้หน่วยงาน
<span
class=
"text-danger"
>
*
</span></label>
<div
class=
"flex"
>
<div
class=
"relative flex rounded-md"
>
<input
type=
"text"
id=
"hs-leading-button-add-on-with-icon-and-button"
name=
"hs-leading-button-add-on-with-icon-and-button"
class=
"ti-form-input rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10"
readonly
style=
"padding-right: 3.5rem;"
[(
ngModel
)]="
bu1
.
bu1id
"
(
ngModelChange
)="
bu1idChange
()"
>
<div
class=
"absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2"
>
<button
type=
"button"
class=
"flex items-center text-red-500"
(
click
)="
selectBu1
()"
>
<i
class=
"ti ti-circle-x cursor-pointer"
></i>
</button>
<button
type=
"button"
class=
"flex items-center text-gray-500 dark:text-white/70"
data-hs-overlay=
"#department-list-bu1-table-modal"
>
<i
class=
"ri-search-line cursor-pointer text-gray"
></i>
</button>
</div>
</div>
<div
class=
"flex rounded-md w-1/2 pl-1rem"
>
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input w-full pr-10 bg-input-readonly"
readonly
[
value
]="
bu1
.
tdesc
"
>
</div>
</div>
<label
for=
"input-label"
class=
"ti-form-label mt-2rem"
>
เเผนก
<span
class=
"text-danger"
>
*
</span></label>
<div
class=
"sm:grid grid-cols-2 gap-1"
>
<div
class=
"relative w-full"
>
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input w-full pr-10 bg-input-readonly"
readonly
[
value
]="
bu2
.
bu2id
"
>
</div>
</div>
<label
for=
"detail_th"
class=
"ti-form-label mt-2rem"
>
รายละเอียดแผนก (ไทย)
<span
class=
"text-danger"
>
*
</span></label>
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input h-16"
[(
ngModel
)]="
bu2
.
tdesc
"
>
<label
for=
"detail_eng"
class=
"ti-form-label mt-2rem"
>
รายละเอียดแผนก (อังกฤษ)
</label>
<input
type=
"text"
id=
"detail_eng"
class=
"ti-form-input h-16"
[(
ngModel
)]="
bu2
.
edesc
"
>
<div
class=
"flex justify-end mt-2rem mb-1rem space-x-4 "
>
<button
type=
"button"
type=
"button"
class=
"hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay=
"#department-list-modal-edit"
>
ย้อนกลับ
</button>
<button
class=
"ti-btn ti-btn-success"
type=
"button"
data-hs-overlay=
"#department-list-alert-edit-modal"
[
class
.
ti-btn-disabled
]="!
bu1
.
bu1id
||!
bu2
.
bu2id
||!
bu2
.
tdesc
"
[
disabled
]="!
bu1
.
bu1id
||!
bu2
.
bu2id
||!
bu2
.
tdesc
"
>
บันทึกข้อมูล
</button>
</div>
</div>
</div>
</div>
</div>
<div
id=
"department-list-bu1-table-modal"
class=
"hs-overlay hidden ti-modal"
>
<div
id=
"department-list-bu1-table-modal"
class=
"hs-overlay hidden ti-modal"
>
<div
class=
"hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out lg:!max-w-4xl lg:w-full m-3 lg:!mx-auto"
>
<div
class=
"hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out lg:!max-w-4xl lg:w-full m-3 lg:!mx-auto"
>
<div
class=
"max-h-full overflow-hidden ti-modal-content"
>
<div
class=
"max-h-full overflow-hidden ti-modal-content"
>
...
@@ -335,7 +173,7 @@
...
@@ -335,7 +173,7 @@
<div
class=
"flex justify-end"
>
<div
class=
"flex justify-end"
>
<button
*
ngIf=
"currentModal=='add'"
type=
"button"
<button
*
ngIf=
"currentModal=='add'"
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#department-list-modal
-add
"
>
data-hs-overlay=
"#department-list-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
</button>
...
@@ -389,7 +227,7 @@
...
@@ -389,7 +227,7 @@
<ng-container
*
ngIf=
"currentModal=='add'"
>
<ng-container
*
ngIf=
"currentModal=='add'"
>
<tr
*
ngFor=
"let item of filterBu1Modal() | slice:((bu1Modal.currentPage-1) * bu1Modal.pageSize) : (((bu1Modal.currentPage-1) * bu1Modal.pageSize) + bu1Modal.pageSize);let i = index"
<tr
*
ngFor=
"let item of filterBu1Modal() | slice:((bu1Modal.currentPage-1) * bu1Modal.pageSize) : (((bu1Modal.currentPage-1) * bu1Modal.pageSize) + bu1Modal.pageSize);let i = index"
class=
"cursor-pointer"
(
click
)="
selectBu1
(
item
)"
class=
"cursor-pointer"
(
click
)="
selectBu1
(
item
)"
data-hs-overlay=
"#department-list-modal
-add
"
>
data-hs-overlay=
"#department-list-modal"
>
<td
class=
"flex justify-center"
>
<td
class=
"flex justify-center"
>
{{((bu1Modal.currentPage-1) * bu1Modal.pageSize)+(i+1)}}
{{((bu1Modal.currentPage-1) * bu1Modal.pageSize)+(i+1)}}
</td>
</td>
...
@@ -419,7 +257,7 @@
...
@@ -419,7 +257,7 @@
<div
class=
"flex justify-end mt-2rem mb-1rem space-x-4"
>
<div
class=
"flex justify-end mt-2rem mb-1rem space-x-4"
>
<button
type=
"button"
*
ngIf=
"currentModal=='add'"
<button
type=
"button"
*
ngIf=
"currentModal=='add'"
class=
"hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
class=
"hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay=
"#department-list-modal
-add
"
>
data-hs-overlay=
"#department-list-modal"
>
ย้อนกลับ
ย้อนกลับ
</button>
</button>
<button
type=
"button"
*
ngIf=
"currentModal=='edit'"
<button
type=
"button"
*
ngIf=
"currentModal=='edit'"
...
@@ -442,7 +280,7 @@
...
@@ -442,7 +280,7 @@
</h3>
</h3>
<div
class=
"flex justify-end"
>
<div
class=
"flex justify-end"
>
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
<button
type=
"button"
class=
"hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay=
"#department-list-modal
-add
"
>
data-hs-overlay=
"#department-list-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
</button>
...
@@ -456,7 +294,7 @@
...
@@ -456,7 +294,7 @@
<div
class=
"flex justify-end mt-2rem mb-1rem"
>
<div
class=
"flex justify-end mt-2rem mb-1rem"
>
<button
type=
"button"
<button
type=
"button"
class=
"hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
class=
"hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay=
"#department-list-modal
-add
"
>
data-hs-overlay=
"#department-list-modal"
>
ย้อนกลับ
ย้อนกลับ
</button>
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
...
@@ -521,10 +359,10 @@
...
@@ -521,10 +359,10 @@
</div>
</div>
<div
class=
"ti-modal-body "
>
<div
class=
"ti-modal-body "
>
<p
class=
"mt-1 text-gray-800 dark:text-white/70"
>
<p
class=
"mt-1 text-gray-800 dark:text-white/70"
>
<ng-container
*
ngIf=
"num
DataListChecked
"
>
<ng-container
*
ngIf=
"num
SelectItem()
"
>
ยืนยันการลบข้อมูลหรือไม่
ยืนยันการลบข้อมูลหรือไม่
</ng-container>
</ng-container>
<ng-container
*
ngIf=
"!num
DataListChecked
"
>
<ng-container
*
ngIf=
"!num
SelectItem()
"
>
เลือกข้อมูลที่ต้องการลบ
เลือกข้อมูลที่ต้องการลบ
</ng-container>
!
</ng-container>
!
</p>
</p>
...
@@ -537,7 +375,7 @@
...
@@ -537,7 +375,7 @@
</button>
</button>
<a
class=
"ti-btn ti-btn-danger"
href=
"javascript:void(0);"
<a
class=
"ti-btn ti-btn-danger"
href=
"javascript:void(0);"
data-hs-overlay=
"#department-list-alert-delete-modal"
(
click
)="
deleteBu2
()"
data-hs-overlay=
"#department-list-alert-delete-modal"
(
click
)="
deleteBu2
()"
*
ngIf=
"num
DataListChecked
"
>
*
ngIf=
"num
SelectItem()
"
>
ลบข้อมูล
ลบข้อมูล
</a>
</a>
</div>
</div>
...
...
src/app/components/company-components/company-registration/branch-business-unit/department-list/department-list.component.ts
View file @
6198a78e
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
{
Bu1Model
,
MyBu1Model
}
from
'src/app/shared/model/bu1.model'
;
import
{
Bu1Model
,
MyBu1Model
}
from
'src/app/shared/model/bu1.model'
;
import
{
Bu2Model
,
MyBu2Model
}
from
'src/app/shared/model/bu2.model'
;
import
{
Bu2Model
,
MyBu2Model
}
from
'src/app/shared/model/bu2.model'
;
...
@@ -17,8 +18,31 @@ interface table {
...
@@ -17,8 +18,31 @@ interface table {
styleUrls
:
[
'./department-list.component.scss'
]
styleUrls
:
[
'./department-list.component.scss'
]
})
})
export
class
DepartmentListComponent
implements
OnInit
{
export
class
DepartmentListComponent
implements
OnInit
{
columns
:
ColumnModel
[]
=
[{
bu2List
:
{
check
:
boolean
,
data
:
Bu2Model
}[]
=
[]
field
:
"bu2id"
,
headerText
:
"ทะเบียนแผนก"
,
type
:
"string"
,
isPrimaryKey
:
true
,
},
{
field
:
"tdesc"
,
headerText
:
"ทะเบียนแผนก(ไทย)"
,
type
:
"string"
},
{
field
:
"edesc"
,
headerText
:
"ทะเบียนแผนก(อังกฤษ)"
,
type
:
"string"
}]
searchSettings
=
{
fields
:
[
'bu2id'
,
'tdesc'
,
'edesc'
],
operator
:
'contains'
,
ignoreCase
:
false
};
search
=
""
selectedItems
:
{
key
:
string
,
count
:
number
,
data
:
Map
<
string
,
boolean
>
}
=
{
key
:
''
,
count
:
0
,
data
:
new
Map
<
string
,
boolean
>
()
};
bu2List
:
Bu2Model
[]
=
[]
bu2ListLoading
=
false
bu2ListLoading
=
false
bu2
:
Bu2Model
=
new
MyBu2Model
()
bu2
:
Bu2Model
=
new
MyBu2Model
()
bu2Table
:
table
=
{
bu2Table
:
table
=
{
...
@@ -47,10 +71,6 @@ export class DepartmentListComponent implements OnInit {
...
@@ -47,10 +71,6 @@ export class DepartmentListComponent implements OnInit {
}
}
currentModal
:
'add'
|
'edit'
|
'delete'
=
"add"
currentModal
:
'add'
|
'edit'
|
'delete'
=
"add"
numDataListChecked
=
0
isDataListChecked
=
false
isDataListCheckedAll
=
false
constructor
(
private
bu2Service
:
Bu2Service
,
constructor
(
private
bu2Service
:
Bu2Service
,
private
bu1Service
:
Bu1Service
,
private
bu1Service
:
Bu1Service
,
private
toastr
:
ToastrService
,
private
toastr
:
ToastrService
,
...
@@ -114,11 +134,13 @@ export class DepartmentListComponent implements OnInit {
...
@@ -114,11 +134,13 @@ export class DepartmentListComponent implements OnInit {
this
.
bu2ListLoading
=
true
this
.
bu2ListLoading
=
true
this
.
bu2Service
.
getList
().
subscribe
({
this
.
bu2Service
.
getList
().
subscribe
({
next
:
response
=>
{
next
:
response
=>
{
this
.
bu2List
=
response
.
map
(
x
=>
({
check
:
false
,
data
:
new
MyBu2Model
(
x
)
}))
this
.
bu2List
=
response
.
map
(
x
=>
{
this
.
selectedItems
.
data
.
set
(
x
.
bu2id
,
false
)
return
new
MyBu2Model
(
x
)
})
this
.
selectedItems
.
key
=
'bu2id'
this
.
selectedItems
.
count
=
0
this
.
bu2ListLoading
=
false
this
.
bu2ListLoading
=
false
this
.
onBu2TableSearchChange
()
this
.
isDataListCheckedAll
=
false
this
.
dataListCheckAll
()
this
.
cdr
.
detectChanges
()
this
.
cdr
.
detectChanges
()
},
error
:
error
=>
{
},
error
:
error
=>
{
this
.
bu2ListLoading
=
false
this
.
bu2ListLoading
=
false
...
@@ -126,18 +148,7 @@ export class DepartmentListComponent implements OnInit {
...
@@ -126,18 +148,7 @@ export class DepartmentListComponent implements OnInit {
}
}
})
})
}
}
onBu2TableSearchChange
()
{
this
.
bu2Table
.
currentPage
=
1
this
.
bu2Table
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
filterBu2Table
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
}
filterBu2Table
()
{
return
this
.
bu2List
.
filter
(
x
=>
{
const
data
=
x
.
data
return
data
.
bu2id
.
toLowerCase
().
includes
(
this
.
bu2Table
.
search
.
toLowerCase
())
||
data
.
tdesc
.
toLowerCase
().
includes
(
this
.
bu2Table
.
search
.
toLowerCase
())
||
data
.
edesc
.
toLowerCase
().
includes
(
this
.
bu2Table
.
search
.
toLowerCase
())
})
}
selectBu2
(
bu2
?:
Bu2Model
)
{
selectBu2
(
bu2
?:
Bu2Model
)
{
this
.
bu2
=
new
MyBu2Model
(
bu2
)
this
.
bu2
=
new
MyBu2Model
(
bu2
)
this
.
selectBu1
()
this
.
selectBu1
()
...
@@ -148,24 +159,6 @@ export class DepartmentListComponent implements OnInit {
...
@@ -148,24 +159,6 @@ export class DepartmentListComponent implements OnInit {
})
})
}
}
}
}
// bu2idChange() {
// const bu2 = this.bu2List.find(x => x.bu2id == this.bu2.bu2id)
// this.selectBu2(bu2 || new MyBu2Model({ bu2id: this.bu2.bu2id }))
// }
onBu2ModalSearchChange
()
{
this
.
bu2Modal
.
currentPage
=
1
this
.
bu2Modal
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
filterBu2Modal
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
this
.
dataListCheck
()
}
filterBu2Modal
()
{
return
this
.
bu2List
.
filter
(
x
=>
{
const
data
=
x
.
data
return
data
.
bu2id
.
toLowerCase
().
includes
(
this
.
bu2Table
.
search
.
toLowerCase
())
||
data
.
tdesc
.
toLowerCase
().
includes
(
this
.
bu2Table
.
search
.
toLowerCase
())
||
data
.
edesc
.
toLowerCase
().
includes
(
this
.
bu2Table
.
search
.
toLowerCase
())
})
}
getBu1List
()
{
getBu1List
()
{
this
.
bu1Service
.
getList
().
subscribe
(
response
=>
{
this
.
bu1Service
.
getList
().
subscribe
(
response
=>
{
...
@@ -215,38 +208,36 @@ export class DepartmentListComponent implements OnInit {
...
@@ -215,38 +208,36 @@ export class DepartmentListComponent implements OnInit {
}
}
deleteBu2
()
{
deleteBu2
()
{
this
.
bu2ListLoading
=
true
this
.
bu2ListLoading
=
true
const
body
=
this
.
bu2List
.
filter
(
x
=>
x
.
check
).
map
(
x
=>
new
MyBu2Model
(
x
.
data
))
//
const body = this.bu2List.filter(x => x.check).map(x => new MyBu2Model(x.data))
this
.
bu2Service
.
delete
(
body
).
subscribe
({
//
this.bu2Service.delete(body).subscribe({
next
:
response
=>
{
//
next: response => {
if
(
response
.
success
)
{
//
if (response.success) {
this
.
showAlert
(
response
.
message
,
'success'
)
//
this.showAlert(response.message, 'success')
this
.
getBu2List
()
//
this.getBu2List()
}
else
{
//
} else {
this
.
showAlert
(
response
.
message
,
'error'
)
//
this.showAlert(response.message, 'error')
this
.
bu2ListLoading
=
false
//
this.bu2ListLoading = false
}
//
}
},
error
:
error
=>
{
//
}, error: error => {
this
.
showAlert
(
error
.
message
,
'error'
)
//
this.showAlert(error.message, 'error')
this
.
bu2ListLoading
=
false
//
this.bu2ListLoading = false
}
//
}
})
//
})
}
}
dataListCheckAll
()
{
const
selectAll
=
this
.
isDataListCheckedAll
;
checkPrimary
()
{
this
.
filterBu2Table
().
forEach
(
x
=>
x
.
check
=
selectAll
);
return
this
.
bu2List
.
find
(
x
=>
x
.
bu2id
==
this
.
bu2
.
bu2id
)
this
.
dataListCheck
();
}
}
dataListCheck
()
{
onSelectItemChange
(
arg
:
any
)
{
const
dataCheck
=
this
.
filterBu2Table
();
this
.
selectedItems
=
arg
this
.
isDataListCheckedAll
=
dataCheck
.
length
?
dataCheck
.
every
(
x
=>
x
.
check
)
:
false
;
this
.
numDataListChecked
=
this
.
bu2List
.
filter
(
x
=>
x
.
check
).
length
this
.
isDataListChecked
=
Boolean
(
this
.
numDataListChecked
)
}
}
checkPrimary
()
{
numSelectItem
()
{
return
this
.
bu2List
.
find
(
x
=>
x
.
data
.
bu2id
==
this
.
bu2
.
bu2id
)
const
selectedKeys
=
Array
.
from
(
this
.
selectedItems
.
data
.
keys
());
const
num
=
this
.
bu2List
.
filter
(
x
=>
selectedKeys
.
includes
(
x
.
bu2id
)
&&
this
.
selectedItems
.
data
.
get
(
x
.
bu2id
)).
length
return
num
}
}
}
}
src/app/components/company-components/company-registration/branch-business-unit/department-register/department-register.component.html
View file @
6198a78e
...
@@ -39,14 +39,14 @@
...
@@ -39,14 +39,14 @@
</div>
</div>
<div
class=
"px-1"
>
<div
class=
"px-1"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-secondary h-45px m-0 shadow-md"
<button
type=
"button"
class=
"ti-btn ti-btn-soft-secondary h-45px m-0 shadow-md"
data-hs-overlay=
"#department-register-modal"
(
click
)="
currentModel=
'add'
;
selectBu1
()"
>
(
click
)="
currentModal=
'add'
;
selectBu1
()"
(
click
)="
openDialog
()"
>
<i
class=
"ri-add-line"
></i>
<i
class=
"ri-add-line"
></i>
Add
Add
</button>
</button>
</div>
</div>
<div
class=
"px-1"
>
<div
class=
"px-1"
>
<button
href=
"javascript:void(0);"
class=
"ti-btn ti-btn-soft-danger h-45px m-0 shadow-md"
<button
href=
"javascript:void(0);"
class=
"ti-btn ti-btn-soft-danger h-45px m-0 shadow-md"
(
click
)="
currentMod
el=
'delete'
;
selectBu1
()"
data-hs-overlay=
"#department-register-alert-modal
"
>
(
click
)="
currentMod
al=
'delete'
;
deleteBu1
()
"
>
<i
class=
"ri-delete-bin-6-line"
></i>
<i
class=
"ri-delete-bin-6-line"
></i>
Delete
Delete
</button>
</button>
...
@@ -56,20 +56,64 @@
...
@@ -56,20 +56,64 @@
<div
class=
"page px-rem"
>
<div
class=
"page px-rem"
>
<app-datagrid-syncfution
[
searchSettings
]="
searchSettings
"
[
searchText
]="
search
"
[
dataSource
]="
bu1
.
dataList
"
<app-datagrid-syncfution
[
searchSettings
]="
searchSettings
"
[
searchText
]="
search
"
[
dataSource
]="
bu1
.
dataList
"
[
columns
]="
columns
"
[
modalName
]="'#
department-register-modal
'"
[
selectedItems
]="
selectedItems
"
[
columns
]="
columns
"
[
selectedItems
]="
selectedItems
"
(
sendSelectData
)="
currentModel=
'edit'
;
selectBu1
($
event
)"
(
sendSelectedItems
)="
onSelectItemChange
($
event
)"
>
(
sendSelectData
)="
currentModal=
'edit'
;
selectBu1
($
event
);
openDialog
()"
(
sendSelectedItems
)="
onSelectItemChange
($
event
)"
>
</app-datagrid-syncfution>
</app-datagrid-syncfution>
</div>
</div>
<ng-template
#
departmentRegisterModal
let-modal
>
<h3
mat-dialog-title
>
{{currentModal=='add'?'เพิ่มข้อมูลทะเบียนฝ่าย':'แก้ไขข้อมูลทะเบียนฝ่าย'}}
</h3>
<div
class=
"w-full flex justify-end"
>
<div
class=
"absolute flex"
>
<div
class=
"px-1"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md"
(
click
)="
selectBu1
()"
>
<i
class=
"ti ti-eraser text-base"
></i>
Clear
</button>
</div>
</div>
</div>
<mat-dialog-content>
<label
for=
"input-label"
class=
"ti-form-label mt-2rem"
>
ฝ่าย
<span
class=
"text-danger"
>
*
<ng-container
*
ngIf=
"checkPrimary()&¤tModal=='add'"
>
ฝ่ายซ้ำ
</ng-container>
</span>
</label>
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input w-1/2"
[
class
.!
border-red
]="
checkPrimary
()&&
currentModal=
='add'"
[(
ngModel
)]="
bu1
.
select
.
bu1id
"
[
readonly
]="
currentModal=
='edit'"
[
class
.!
bg-input-readonly
]="
currentModal=
='edit'"
>
<label
for=
"detail_th"
class=
"ti-form-label mt-2rem"
>
รายละเอียดฝ่าย (ไทย)
<span
class=
"text-danger"
>
*
</span></label>
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input h-16"
[(
ngModel
)]="
bu1
.
select
.
tdesc
"
>
<label
for=
"detail_eng"
class=
"ti-form-label mt-2rem"
>
รายละเอียดฝ่าย (อังกฤษ)
</label>
<input
type=
"text"
id=
"detail_eng"
class=
"ti-form-input h-16"
[(
ngModel
)]="
bu1
.
select
.
edesc
"
>
</mat-dialog-content>
<mat-dialog-actions
align=
"end"
>
<button
type=
"button"
mat-button
[
mat-dialog-close
]
class=
"hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
>
ย้อนกลับ
</button>
<button
type=
"button"
class=
"ti-btn ti-btn-success"
mat-button
(
click
)="
addBu1
()"
[
class
.
ti-btn-disabled
]="!
bu1
.
select
.
bu1id
||!
bu1
.
select
.
tdesc
||(
checkPrimary
()&&
currentModal=
='add')"
[
disabled
]="!
bu1
.
select
.
bu1id
||!
bu1
.
select
.
tdesc
||(
checkPrimary
()&&
currentModal=
='add')"
>
บันทึกข้อมูล
</button>
</mat-dialog-actions>
</ng-template>
<div
id=
"department-register-modal"
class=
"hs-overlay hidden ti-modal"
>
<
!-- <
div id="department-register-modal" class="hs-overlay hidden ti-modal">
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)]">
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)]">
<div class="max-h-full overflow-hidden ti-modal-content">
<div class="max-h-full overflow-hidden ti-modal-content">
<div class="ti-modal-header">
<div class="ti-modal-header">
<h3
class=
"text-xxl font-bold text-primary"
*
ngIf=
"currentMod
e
l=='add'"
>
<h3 class="text-xxl font-bold text-primary" *ngIf="currentMod
a
l=='add'">
เพิ่มข้อมูลทะเบียนฝ่าย
เพิ่มข้อมูลทะเบียนฝ่าย
</h3>
</h3>
<h3
class=
"text-xxl font-bold text-primary"
*
ngIf=
"currentMod
e
l=='edit'"
>
<h3 class="text-xxl font-bold text-primary" *ngIf="currentMod
a
l=='edit'">
แก้ไขข้อมูลทะเบียนฝ่าย
แก้ไขข้อมูลทะเบียนฝ่าย
</h3>
</h3>
<div class="flex justify-end">
<div class="flex justify-end">
...
@@ -100,25 +144,19 @@
...
@@ -100,25 +144,19 @@
Clear
Clear
</button>
</button>
</div>
</div>
<!-- <div class="px-1">
<button href="javascript:void(0);" class="ti-btn ti-btn-soft-warning h-45px m-0 shadow-md">
<i class="ti ti-book fs-l"></i>
Help
</button>
</div> -->
</div>
</div>
</div>
</div>
<div class="ti-modal-body padding-16px pt-0 overflow-y-0">
<div class="ti-modal-body padding-16px pt-0 overflow-y-0">
<label for="input-label" class="ti-form-label mt-2rem">ฝ่าย
<label for="input-label" class="ti-form-label mt-2rem">ฝ่าย
<span class="text-danger">*
<span class="text-danger">*
<ng-container
*
ngIf=
"checkPrimary()&¤tMod
e
l=='add'"
>
<ng-container *ngIf="checkPrimary()&¤tMod
a
l=='add'">
ฝ่ายซ้ำ
ฝ่ายซ้ำ
</ng-container>
</ng-container>
</span>
</span>
</label>
</label>
<input type="text" id="input-label" class="ti-form-input w-1/2"
<input type="text" id="input-label" class="ti-form-input w-1/2"
[
class
.!
border-red
]="
checkPrimary
()&&
currentMod
e
l=
='add'"
[(
ngModel
)]="
bu1
.
select
.
bu1id
"
[class.!border-red]="checkPrimary()&¤tMod
a
l=='add'" [(ngModel)]="bu1.select.bu1id"
[
readonly
]="
currentMod
el=
='edit'"
[
class
.!
bg-input-readonly
]="
currentMode
l=
='edit'"
>
[readonly]="currentMod
al=='edit'" [class.!bg-input-readonly]="currentModa
l=='edit'">
<label for="detail_th" class="ti-form-label mt-2rem">รายละเอียดฝ่าย (ไทย)<span
<label for="detail_th" class="ti-form-label mt-2rem">รายละเอียดฝ่าย (ไทย)<span
class="text-danger">*</span></label>
class="text-danger">*</span></label>
<input type="text" id="detail_th" class="ti-form-input h-16" [(ngModel)]="bu1.select.tdesc">
<input type="text" id="detail_th" class="ti-form-input h-16" [(ngModel)]="bu1.select.tdesc">
...
@@ -132,8 +170,8 @@
...
@@ -132,8 +170,8 @@
</button>
</button>
<button type="button" class="ti-btn ti-btn-success"
<button type="button" class="ti-btn ti-btn-success"
data-hs-overlay="#department-register-alert-modal"
data-hs-overlay="#department-register-alert-modal"
[
class
.
ti-btn-disabled
]="!
bu1
.
select
.
bu1id
||!
bu1
.
select
.
tdesc
||(
checkPrimary
()&&
currentMod
e
l=
='add')"
[class.ti-btn-disabled]="!bu1.select.bu1id||!bu1.select.tdesc||(checkPrimary()&¤tMod
a
l=='add')"
[
disabled
]="!
bu1
.
select
.
bu1id
||!
bu1
.
select
.
tdesc
||(
checkPrimary
()&&
currentMod
e
l=
='add')"
>
[disabled]="!bu1.select.bu1id||!bu1.select.tdesc||(checkPrimary()&¤tMod
a
l=='add')">
บันทึกข้อมูล
บันทึกข้อมูล
</button>
</button>
</div>
</div>
...
@@ -142,7 +180,6 @@
...
@@ -142,7 +180,6 @@
</div>
</div>
</div>
</div>
<div id="department-register-alert-modal" class="hs-overlay hidden ti-modal">
<div id="department-register-alert-modal" class="hs-overlay hidden ti-modal">
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)] flex items-center">
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)] flex items-center">
<div class="max-h-full overflow-hidden ti-modal-content w-full">
<div class="max-h-full overflow-hidden ti-modal-content w-full">
...
@@ -151,13 +188,13 @@
...
@@ -151,13 +188,13 @@
แจ้งเตือน
แจ้งเตือน
</h3>
</h3>
<div class="flex justify-end">
<div class="flex justify-end">
<button
*
ngIf=
"currentMod
el=='add'||currentMode
l=='edit'"
type=
"button"
<button *ngIf="currentMod
al=='add'||currentModa
l=='edit'" type="button"
class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay="#department-register-modal">
data-hs-overlay="#department-register-modal">
<span class="sr-only">Close</span>
<span class="sr-only">Close</span>
<i class="ti ti-circle-x fs-xxl"></i>
<i class="ti ti-circle-x fs-xxl"></i>
</button>
</button>
<button
*
ngIf=
"currentMod
e
l=='delete'"
type=
"button"
<button *ngIf="currentMod
a
l=='delete'" type="button"
class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay="#department-register-alert-modal">
data-hs-overlay="#department-register-alert-modal">
<span class="sr-only">Close</span>
<span class="sr-only">Close</span>
...
@@ -166,10 +203,10 @@
...
@@ -166,10 +203,10 @@
</div>
</div>
</div>
</div>
<div class="ti-modal-body ">
<div class="ti-modal-body ">
<p
*
ngIf=
"currentMod
el=='add'||currentMode
l=='edit'"
class=
"mt-1 text-gray-800 dark:text-white/70"
>
<p *ngIf="currentMod
al=='add'||currentModa
l=='edit'" class="mt-1 text-gray-800 dark:text-white/70">
ยืนยันการบันทึกข้อมูลหรือไม่
ยืนยันการบันทึกข้อมูลหรือไม่
</p>
</p>
<p
*
ngIf=
"currentMod
e
l=='delete'"
class=
"mt-1 text-gray-800 dark:text-white/70"
>
<p *ngIf="currentMod
a
l=='delete'" class="mt-1 text-gray-800 dark:text-white/70">
<ng-container *ngIf="selectedItems.count">
<ng-container *ngIf="selectedItems.count">
ยืนยันการลบข้อมูลหรือไม่
ยืนยันการลบข้อมูลหรือไม่
</ng-container>
</ng-container>
...
@@ -177,7 +214,7 @@
...
@@ -177,7 +214,7 @@
เลือกข้อมูลที่ต้องการลบ
เลือกข้อมูลที่ต้องการลบ
</ng-container>
</ng-container>
</p>
</p>
<div
*
ngIf=
"currentMod
el=='add'||currentMode
l=='edit'"
class=
"flex justify-end mt-2rem mb-1rem"
>
<div *ngIf="currentMod
al=='add'||currentModa
l=='edit'" class="flex justify-end mt-2rem mb-1rem">
<button type="button"
<button type="button"
class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay="#department-register-modal'">
data-hs-overlay="#department-register-modal'">
...
@@ -188,7 +225,7 @@
...
@@ -188,7 +225,7 @@
บันทึกข้อมูล
บันทึกข้อมูล
</button>
</button>
</div>
</div>
<div
*
ngIf=
"currentMod
e
l=='delete'"
class=
"flex justify-end mt-2rem mb-1rem"
>
<div *ngIf="currentMod
a
l=='delete'" class="flex justify-end mt-2rem mb-1rem">
<button type="button"
<button type="button"
class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay="#department-register-alert-modal">
data-hs-overlay="#department-register-alert-modal">
...
@@ -202,7 +239,7 @@
...
@@ -202,7 +239,7 @@
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
-->
<div
id=
"department-register-upload-modal"
class=
"hs-overlay hidden ti-modal"
>
<div
id=
"department-register-upload-modal"
class=
"hs-overlay hidden ti-modal"
>
<div
class=
"hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out rounded-md"
>
<div
class=
"hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out rounded-md"
>
...
...
src/app/components/company-components/company-registration/branch-business-unit/department-register/department-register.component.ts
View file @
6198a78e
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
{
ar
}
from
'date-fns/locale'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
Bu1Model
,
MyBu1Model
}
from
'src/app/shared/model/bu1.model'
;
import
{
Bu1Model
,
MyBu1Model
}
from
'src/app/shared/model/bu1.model'
;
import
{
Bu1Service
}
from
'src/app/shared/services/bu1.service'
;
import
{
Bu1Service
}
from
'src/app/shared/services/bu1.service'
;
import
{
FileService
}
from
'src/app/shared/services/file.service'
;
import
{
FileService
}
from
'src/app/shared/services/file.service'
;
import
Swal
from
'sweetalert2'
;
@
Component
({
@
Component
({
selector
:
'app-department-register'
,
selector
:
'app-department-register'
,
...
@@ -19,11 +20,11 @@ export class DepartmentRegisterComponent implements OnInit {
...
@@ -19,11 +20,11 @@ export class DepartmentRegisterComponent implements OnInit {
selectedFile
:
File
|
null
=
null
;
selectedFile
:
File
|
null
=
null
;
selectedFileName
:
string
=
'กรุณาเลือกไฟล์'
;
selectedFileName
:
string
=
'กรุณาเลือกไฟล์'
;
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
>
()
};
currentMod
e
l
:
'add'
|
'edit'
|
'delete'
=
"add"
currentMod
a
l
:
'add'
|
'edit'
|
'delete'
=
"add"
bu1
:
{
loading
:
boolean
,
select
:
Bu1Model
,
dataList
:
Bu1Model
[]
}
=
{
loading
:
false
,
select
:
new
MyBu1Model
(),
dataList
:
[]
}
bu1
:
{
loading
:
boolean
,
select
:
Bu1Model
,
dataList
:
Bu1Model
[]
}
=
{
loading
:
false
,
select
:
new
MyBu1Model
(),
dataList
:
[]
}
columns
:
ColumnModel
[]
=
[{
columns
:
ColumnModel
[]
=
[{
field
:
"bu1id"
,
field
:
"bu1id"
,
headerText
:
"รหัส
กลุ่มการอนุมัติ
"
,
headerText
:
"รหัส
ฝ่าย
"
,
type
:
"string"
,
type
:
"string"
,
isPrimaryKey
:
true
,
isPrimaryKey
:
true
,
},
},
...
@@ -42,8 +43,10 @@ export class DepartmentRegisterComponent implements OnInit {
...
@@ -42,8 +43,10 @@ export class DepartmentRegisterComponent implements OnInit {
operator
:
'contains'
,
operator
:
'contains'
,
ignoreCase
:
false
ignoreCase
:
false
};
};
@
ViewChild
(
"departmentRegisterModal"
)
departmentRegisterModal
:
any
;
dialogRef
:
any
constructor
(
private
bu1Service
:
Bu1Service
,
constructor
(
private
bu1Service
:
Bu1Service
,
private
toastr
:
ToastrService
,
private
dialog
:
MatDialog
,
private
cdr
:
ChangeDetectorRef
,
private
cdr
:
ChangeDetectorRef
,
private
fileService
:
FileService
private
fileService
:
FileService
)
{
}
)
{
}
...
@@ -119,54 +122,87 @@ export class DepartmentRegisterComponent implements OnInit {
...
@@ -119,54 +122,87 @@ export class DepartmentRegisterComponent implements OnInit {
selectBu1
(
bu1
?:
Bu1Model
)
{
selectBu1
(
bu1
?:
Bu1Model
)
{
if
(
bu1
)
{
if
(
bu1
)
{
this
.
bu1
.
select
=
new
MyBu1Model
(
bu1
)
this
.
bu1
.
select
=
new
MyBu1Model
(
bu1
)
}
else
if
(
this
.
currentMod
e
l
==
'add'
)
{
}
else
if
(
this
.
currentMod
a
l
==
'add'
)
{
this
.
bu1
.
select
=
new
MyBu1Model
()
this
.
bu1
.
select
=
new
MyBu1Model
()
}
else
if
(
this
.
currentMod
e
l
==
'edit'
)
{
}
else
if
(
this
.
currentMod
a
l
==
'edit'
)
{
this
.
bu1
.
select
=
new
MyBu1Model
({
bu1id
:
this
.
bu1
.
select
.
bu1id
})
this
.
bu1
.
select
=
new
MyBu1Model
({
bu1id
:
this
.
bu1
.
select
.
bu1id
})
}
}
}
}
showAlert
(
text
:
string
,
type
:
'success'
|
'error'
)
{
showAlert
(
text
:
string
,
type
:
'success'
|
'error'
)
{
this
.
toastr
[
type
](
text
,
'แจ้งเตือน'
,
{
Swal
.
fire
({
timeOut
:
3000
,
title
:
'แจ้งเตือน'
,
positionClass
:
'toast-top-right'
,
text
:
text
,
})
icon
:
type
,
confirmButtonText
:
'ตกลง'
,
});
}
}
addBu1
()
{
addBu1
()
{
this
.
bu1
.
loading
=
true
Swal
.
fire
({
this
.
bu1Service
.
post
(
this
.
bu1
.
select
).
subscribe
({
icon
:
'question'
,
next
:
response
=>
{
title
:
'แจ้งเตือน'
,
if
(
response
.
success
)
{
text
:
'ยืนยันการบันทึกข้อมูลหรือไม่'
,
this
.
showAlert
(
response
.
message
,
'success'
)
showCancelButton
:
true
,
this
.
getBu1List
()
confirmButtonText
:
'บันทึกข้อมูล'
,
}
else
{
cancelButtonText
:
'ย้อนกลับ'
,
this
.
showAlert
(
response
.
message
,
'error'
)
reverseButtons
:
true
,
this
.
bu1
.
loading
=
false
}).
then
((
result
)
=>
{
}
if
(
result
.
isConfirmed
)
{
},
error
:
error
=>
{
console
.
log
(
" 🐒 result:"
,
result
)
this
.
showAlert
(
error
.
message
,
'error'
)
// this.bu1.loading = true
this
.
bu1
.
loading
=
false
// this.bu1Service.post(this.bu1.select).subscribe({
// next: response => {
// if (response.success) {
// this.showAlert(response.message, 'success')
// this.getBu1List()
// } else {
// this.showAlert(response.message, 'error')
// this.bu1.loading = false
// }
// }, error: error => {
// this.showAlert(error.message, 'error')
// this.bu1.loading = false
// }
// })
}
}
})
})
}
}
deleteBu1
()
{
deleteBu1
()
{
this
.
bu1
.
loading
=
true
if
(
!
this
.
numSelectItem
())
{
const
selectedKeys
=
Array
.
from
(
this
.
selectedItems
.
data
.
keys
());
this
.
showAlert
(
'กรุณาเลือกข้อมูลที่ต้องการลบ'
,
'error'
)
const
body
=
this
.
bu1
.
dataList
.
filter
(
x
=>
selectedKeys
.
includes
(
x
.
bu1id
)
&&
this
.
selectedItems
.
data
.
get
(
x
.
bu1id
)).
map
(
x
=>
new
MyBu1Model
(
x
))
return
this
.
bu1Service
.
delete
(
body
).
subscribe
({
}
next
:
response
=>
{
Swal
.
fire
({
if
(
response
.
success
)
{
icon
:
'question'
,
this
.
showAlert
(
response
.
message
,
'success'
)
title
:
'แจ้งเตือน'
,
this
.
getBu1List
()
text
:
'ยืนยันการลบข้อมูลหรือไม่'
,
}
else
{
showCancelButton
:
true
,
this
.
showAlert
(
response
.
message
,
'error'
)
confirmButtonText
:
'ลบข้อมูล'
,
this
.
bu1
.
loading
=
false
cancelButtonText
:
'ย้อนกลับ'
,
}
reverseButtons
:
true
,
},
error
:
error
=>
{
}).
then
((
result
)
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
if
(
result
.
isConfirmed
)
{
this
.
bu1
.
loading
=
false
console
.
log
(
" 🐒 result:"
,
result
)
// this.bu1.loading = true
// 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))
// this.bu1Service.delete(body).subscribe({
// next: response => {
// if (response.success) {
// this.showAlert(response.message, 'success')
// this.getBu1List()
// } else {
// this.showAlert(response.message, 'error')
// this.bu1.loading = false
// }
// }, error: error => {
// this.showAlert(error.message, 'error')
// this.bu1.loading = false
// }
// })
}
}
})
})
;
}
}
checkPrimary
()
{
checkPrimary
()
{
...
@@ -176,4 +212,20 @@ export class DepartmentRegisterComponent implements OnInit {
...
@@ -176,4 +212,20 @@ export class DepartmentRegisterComponent implements OnInit {
onSelectItemChange
(
arg
:
any
)
{
onSelectItemChange
(
arg
:
any
)
{
this
.
selectedItems
=
arg
this
.
selectedItems
=
arg
}
}
openDialog
()
{
this
.
dialogRef
=
this
.
dialog
.
open
(
this
.
departmentRegisterModal
,
{
width
:
'500px'
,
disableClose
:
false
,
});
}
closeDialog
()
{
this
.
dialogRef
.
close
()
}
numSelectItem
()
{
const
selectedKeys
=
Array
.
from
(
this
.
selectedItems
.
data
.
keys
());
const
num
=
this
.
bu1
.
dataList
.
filter
(
x
=>
selectedKeys
.
includes
(
x
.
bu1id
)
&&
this
.
selectedItems
.
data
.
get
(
x
.
bu1id
)).
length
return
num
}
}
}
\ No newline at end of file
src/app/components/company-components/company-registration/company-registration-page/company-registration-page.component.html
View file @
6198a78e
...
@@ -21,14 +21,14 @@
...
@@ -21,14 +21,14 @@
</div>
</div>
<div
class=
"px-1"
>
<div
class=
"px-1"
>
<button
type=
"button"
class=
"ti-btn ti-btn-soft-secondary h-45px m-0 shadow-md"
<button
type=
"button"
class=
"ti-btn ti-btn-soft-secondary h-45px m-0 shadow-md"
(
click
)="
modalStatus
=
'add'
;
setData
()"
(
click
)="
openDialog
()"
>
(
click
)="
currentModal
=
'add'
;
setData
()"
(
click
)="
openDialog
()"
>
<i
class=
"ri-add-line"
></i>
<i
class=
"ri-add-line"
></i>
Add
Add
</button>
</button>
</div>
</div>
<div
class=
"px-1"
>
<div
class=
"px-1"
>
<button
href=
"javascript:void(0);"
class=
"ti-btn ti-btn-soft-danger h-45px m-0 shadow-md"
<button
href=
"javascript:void(0);"
class=
"ti-btn ti-btn-soft-danger h-45px m-0 shadow-md"
(
click
)="
modalStatus=
'deleteGroup
'
;
setData
();
deleteCompany
()"
>
(
click
)="
currentModal=
'delete
'
;
setData
();
deleteCompany
()"
>
<i
class=
"ri-delete-bin-6-line"
></i>
<i
class=
"ri-delete-bin-6-line"
></i>
Delete
Delete
</button>
</button>
...
@@ -39,14 +39,14 @@
...
@@ -39,14 +39,14 @@
<div
class=
"page px-rem"
>
<div
class=
"page px-rem"
>
<app-datagrid-syncfution
[
searchSettings
]="
searchSettings
"
[
searchText
]="
search
"
[
dataSource
]="
dataList
"
<app-datagrid-syncfution
[
searchSettings
]="
searchSettings
"
[
searchText
]="
search
"
[
dataSource
]="
dataList
"
[
columns
]="
columns
"
[
selectedItems
]="
selectedItems
"
[
columns
]="
columns
"
[
selectedItems
]="
selectedItems
"
(
sendSelectData
)="
modalStatus
=
'edit'
;
setData
($
event
);
openDialog
()"
(
sendSelectData
)="
currentModal
=
'edit'
;
setData
($
event
);
openDialog
()"
(
sendSelectedItems
)="
onSelectItemChange
($
event
)"
(
sendOpenDialog
)="
openDialog
()"
>
(
sendSelectedItems
)="
onSelectItemChange
($
event
)"
>
</app-datagrid-syncfution>
</app-datagrid-syncfution>
</div>
</div>
<ng-template
#
registrationModal
let-modal
>
<ng-template
#
registrationModal
let-modal
>
<h3
mat-dialog-title
>
<h3
mat-dialog-title
>
{{
modalStatus
=='add'?'เพิ่มข้อมูลบริษัท':'แก้ไขข้อมูลบริษัท'}}
{{
currentModal
=='add'?'เพิ่มข้อมูลบริษัท':'แก้ไขข้อมูลบริษัท'}}
</h3>
</h3>
<div
class=
"w-full flex justify-end"
>
<div
class=
"w-full flex justify-end"
>
<div
class=
"absolute flex"
>
<div
class=
"absolute flex"
>
...
@@ -61,13 +61,13 @@
...
@@ -61,13 +61,13 @@
<mat-dialog-content>
<mat-dialog-content>
<label
for=
"input-label"
class=
"ti-form-label mt-2rem"
>
รหัสบริษัท
<span
class=
"text-danger"
>
<label
for=
"input-label"
class=
"ti-form-label mt-2rem"
>
รหัสบริษัท
<span
class=
"text-danger"
>
*
*
<ng-container
*
ngIf=
"
modalStatus
=='add'&&checkPrimary()"
>
<ng-container
*
ngIf=
"
currentModal
=='add'&&checkPrimary()"
>
รหัสบริษัทซ้ำ
รหัสบริษัทซ้ำ
</ng-container>
</ng-container>
</span></label>
</span></label>
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input w-1/2"
<input
type=
"text"
id=
"input-label"
class=
"ti-form-input w-1/2"
[
class
.!
border-red
]="
modalStatus
=
='add'&&checkPrimary()"
[
class
.!
border-red
]="
currentModal
=
='add'&&checkPrimary()"
[
ngClass
]="{'!
bg-input-readonly
'
:
modalStatus=
='edit'}"
[
readonly
]="
modalStatus
=
='edit'"
[
ngClass
]="{'!
bg-input-readonly
'
:
currentModal=
='edit'}"
[
readonly
]="
currentModal
=
='edit'"
[(
ngModel
)]="
dataSelect
.
code
"
[
maxLength
]="
5
"
>
[(
ngModel
)]="
dataSelect
.
code
"
[
maxLength
]="
5
"
>
<label
for=
"detail_th"
class=
"ti-form-label mt-2rem"
>
รายละเอียด (ไทย)
<span
class=
"text-danger"
>
*
</span></label>
<label
for=
"detail_th"
class=
"ti-form-label mt-2rem"
>
รายละเอียด (ไทย)
<span
class=
"text-danger"
>
*
</span></label>
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input h-16"
[(
ngModel
)]="
dataSelect
.
tdesc
"
>
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input h-16"
[(
ngModel
)]="
dataSelect
.
tdesc
"
>
...
@@ -84,8 +84,8 @@
...
@@ -84,8 +84,8 @@
ย้อนกลับ
ย้อนกลับ
</button>
</button>
<button
type=
"button"
class=
"ti-btn ti-btn-success"
mat-button
(
click
)="
addCompany
()"
<button
type=
"button"
class=
"ti-btn ti-btn-success"
mat-button
(
click
)="
addCompany
()"
[
class
.
ti-btn-disabled
]="!
dataSelect
.
code
||!
dataSelect
.
tdesc
||(
modalStatus
=
='add'&&checkPrimary())"
[
class
.
ti-btn-disabled
]="!
dataSelect
.
code
||!
dataSelect
.
tdesc
||(
currentModal
=
='add'&&checkPrimary())"
[
disabled
]="!
dataSelect
.
code
||!
dataSelect
.
tdesc
||(
modalStatus
=
='add'&&checkPrimary())"
>
[
disabled
]="!
dataSelect
.
code
||!
dataSelect
.
tdesc
||(
currentModal
=
='add'&&checkPrimary())"
>
บันทึกข้อมูล
บันทึกข้อมูล
</button>
</button>
...
@@ -97,7 +97,7 @@
...
@@ -97,7 +97,7 @@
<div class="max-h-full overflow-hidden ti-modal-content">
<div class="max-h-full overflow-hidden ti-modal-content">
<div class="ti-modal-header">
<div class="ti-modal-header">
<h3 class="text-xxl font-bold text-primary">
<h3 class="text-xxl font-bold text-primary">
{{
modalStatus
=='add'?'เพิ่มข้อมูลบริษัท':'แก้ไขข้อมูลบริษัท'}}
{{
currentModal
=='add'?'เพิ่มข้อมูลบริษัท':'แก้ไขข้อมูลบริษัท'}}
</h3>
</h3>
<div class="flex justify-end">
<div class="flex justify-end">
<button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
<button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
...
@@ -132,13 +132,13 @@
...
@@ -132,13 +132,13 @@
<div class="ti-modal-body padding-16px pt-0 overflow-y-0">
<div class="ti-modal-body padding-16px pt-0 overflow-y-0">
<label for="input-label" class="ti-form-label mt-2rem">รหัสบริษัท<span class="text-danger">
<label for="input-label" class="ti-form-label mt-2rem">รหัสบริษัท<span class="text-danger">
*
*
<ng-container *ngIf="
modalStatus
=='add'&&checkPrimary()">
<ng-container *ngIf="
currentModal
=='add'&&checkPrimary()">
รหัสบริษัทซ้ำ
รหัสบริษัทซ้ำ
</ng-container>
</ng-container>
</span></label>
</span></label>
<input type="text" id="input-label" class="ti-form-input w-1/2"
<input type="text" id="input-label" class="ti-form-input w-1/2"
[class.!border-red]="
modalStatus
=='add'&&checkPrimary()"
[class.!border-red]="
currentModal
=='add'&&checkPrimary()"
[ngClass]="{'bg-input-readonly':
modalStatus=='edit'}" [readonly]="modalStatus
=='edit'"
[ngClass]="{'bg-input-readonly':
currentModal=='edit'}" [readonly]="currentModal
=='edit'"
[(ngModel)]="dataSelect.code" [maxLength]="5">
[(ngModel)]="dataSelect.code" [maxLength]="5">
<label for="detail_th" class="ti-form-label mt-2rem">รายละเอียด (ไทย)<span
<label for="detail_th" class="ti-form-label mt-2rem">รายละเอียด (ไทย)<span
class="text-danger">*</span></label>
class="text-danger">*</span></label>
...
@@ -157,8 +157,8 @@
...
@@ -157,8 +157,8 @@
</button>
</button>
<button type="button" class="ti-btn ti-btn-success"
<button type="button" class="ti-btn ti-btn-success"
data-hs-overlay="#company-registration-page-alert-modal"
data-hs-overlay="#company-registration-page-alert-modal"
[class.ti-btn-disabled]="!dataSelect.code||!dataSelect.tdesc||(
modalStatus
=='add'&&checkPrimary())"
[class.ti-btn-disabled]="!dataSelect.code||!dataSelect.tdesc||(
currentModal
=='add'&&checkPrimary())"
[disabled]="!dataSelect.code||!dataSelect.tdesc||(
modalStatus
=='add'&&checkPrimary())">
[disabled]="!dataSelect.code||!dataSelect.tdesc||(
currentModal
=='add'&&checkPrimary())">
บันทึกข้อมูล
บันทึกข้อมูล
</button>
</button>
</div>
</div>
...
@@ -175,14 +175,14 @@
...
@@ -175,14 +175,14 @@
แจ้งเตือน
แจ้งเตือน
</h3>
</h3>
<div class="flex justify-end">
<div class="flex justify-end">
<ng-container *ngIf="
modalStatus=='add'||modalStatus
=='edit'">
<ng-container *ngIf="
currentModal=='add'||currentModal
=='edit'">
<button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
<button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay="#company-registration-page-modal">
data-hs-overlay="#company-registration-page-modal">
<span class="sr-only">Close</span>
<span class="sr-only">Close</span>
<i class="ti ti-circle-x fs-xxl"></i>
<i class="ti ti-circle-x fs-xxl"></i>
</button>
</button>
</ng-container>
</ng-container>
<ng-container *ngIf="
modalStatus=='delete'||modalStatus
=='deleteGroup'">
<ng-container *ngIf="
currentModal=='delete'||currentModal
=='deleteGroup'">
<button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
<button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay="#company-registration-page-alert-modal">
data-hs-overlay="#company-registration-page-alert-modal">
<span class="sr-only">Close</span>
<span class="sr-only">Close</span>
...
@@ -193,10 +193,10 @@
...
@@ -193,10 +193,10 @@
</div>
</div>
<div class="ti-modal-body ">
<div class="ti-modal-body ">
<p class="mt-1 text-gray-800 dark:text-white/70">
<p class="mt-1 text-gray-800 dark:text-white/70">
<ng-container *ngIf="
modalStatus=='add'||modalStatus
=='edit'">
<ng-container *ngIf="
currentModal=='add'||currentModal
=='edit'">
ยืนยันการบันทึกข้อมูลหรือไม่
ยืนยันการบันทึกข้อมูลหรือไม่
</ng-container>
</ng-container>
<ng-container *ngIf="
modalStatus=='delete'||modalStatus
=='deleteGroup'">
<ng-container *ngIf="
currentModal=='delete'||currentModal
=='deleteGroup'">
<ng-container *ngIf="numSelectItem()">
<ng-container *ngIf="numSelectItem()">
ยืนยันการลบข้อมูลหรือไม่
ยืนยันการลบข้อมูลหรือไม่
</ng-container>
</ng-container>
...
@@ -207,7 +207,7 @@
...
@@ -207,7 +207,7 @@
</p>
</p>
<div class="flex justify-end mt-2rem mb-1rem">
<div class="flex justify-end mt-2rem mb-1rem">
<ng-container *ngIf="
modalStatus=='add'||modalStatus
=='edit'">
<ng-container *ngIf="
currentModal=='add'||currentModal
=='edit'">
<button type="button"
<button type="button"
class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay="#company-registration-page-modal">
data-hs-overlay="#company-registration-page-modal">
...
@@ -218,7 +218,7 @@
...
@@ -218,7 +218,7 @@
บันทึกข้อมูล
บันทึกข้อมูล
</a>
</a>
</ng-container>
</ng-container>
<ng-container *ngIf="
modalStatus=='delete'||modalStatus
=='deleteGroup'">
<ng-container *ngIf="
currentModal=='delete'||currentModal
=='deleteGroup'">
<button type="button"
<button type="button"
class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay="#company-registration-page-alert-modal">
data-hs-overlay="#company-registration-page-alert-modal">
...
...
src/app/components/company-components/company-registration/company-registration-page/company-registration-page.component.ts
View file @
6198a78e
...
@@ -24,7 +24,7 @@ export class CompanyRegistrationPageComponent {
...
@@ -24,7 +24,7 @@ export class CompanyRegistrationPageComponent {
currentPage
=
1
currentPage
=
1
page
=
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
);
page
=
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
);
search
=
""
search
=
""
modalStatus
=
'add'
currentModal
:
'add'
|
'edit'
|
'delete'
=
'add'
dataList
:
DataModel
[]
=
[]
dataList
:
DataModel
[]
=
[]
dataLoading
=
false
dataLoading
=
false
dataSelect
:
DataModel
=
{
code
:
""
,
tdesc
:
""
,
edesc
:
""
,
address
:
""
,
contact
:
""
}
dataSelect
:
DataModel
=
{
code
:
""
,
tdesc
:
""
,
edesc
:
""
,
address
:
""
,
contact
:
""
}
...
@@ -54,8 +54,7 @@ export class CompanyRegistrationPageComponent {
...
@@ -54,8 +54,7 @@ export class CompanyRegistrationPageComponent {
selectedFile
:
File
|
null
=
null
;
selectedFile
:
File
|
null
=
null
;
selectedFileName
:
string
=
'กรุณาเลือกไฟล์'
;
selectedFileName
:
string
=
'กรุณาเลือกไฟล์'
;
dialogRef
:
any
dialogRef
:
any
constructor
(
private
toastr
:
ToastrService
,
constructor
(
private
companyService
:
CompanyService
,
private
companyService
:
CompanyService
,
private
cdr
:
ChangeDetectorRef
,
private
cdr
:
ChangeDetectorRef
,
private
dialog
:
MatDialog
,
private
dialog
:
MatDialog
,
private
fileService
:
FileService
)
{
}
private
fileService
:
FileService
)
{
}
...
@@ -217,7 +216,7 @@ export class CompanyRegistrationPageComponent {
...
@@ -217,7 +216,7 @@ export class CompanyRegistrationPageComponent {
})
})
}
}
clearData
()
{
clearData
()
{
if
(
this
.
modalStatus
==
'add'
)
{
if
(
this
.
currentModal
==
'add'
)
{
this
.
setData
()
this
.
setData
()
}
else
{
}
else
{
this
.
setData
({
code
:
this
.
dataSelect
.
code
,
tdesc
:
""
,
edesc
:
""
,
address
:
""
,
contact
:
""
})
this
.
setData
({
code
:
this
.
dataSelect
.
code
,
tdesc
:
""
,
edesc
:
""
,
address
:
""
,
contact
:
""
})
...
...
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