Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
myAppraisal
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
myAppraisal
Commits
cce363b7
Commit
cce363b7
authored
Nov 27, 2024
by
Natthaphat Pankiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
แก้ bu3
parent
de2e521d
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
186 additions
and
53 deletions
+186
-53
section-registration.component.html
.../section-registration/section-registration.component.html
+85
-19
section-registration.component.ts
...it/section-registration/section-registration.component.ts
+42
-33
dashboard.module.ts
src/app/components/dashboard/dashboard.module.ts
+2
-1
bu3.model.ts
src/app/shared/model/bu3.model.ts
+24
-0
bu3.service.ts
src/app/shared/services/bu3.service.ts
+33
-0
No files found.
src/app/components/company-registration/branch-business-unit/section-registration/section-registration.component.html
View file @
cce363b7
...
...
@@ -2,7 +2,8 @@
<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"
>
class=
"ti-form-input ltr:pl-11 rtl:pr-11 focus:z-10 "
placeholder=
"Search by No. or Name"
[(
ngModel
)]="
search
"
(
ngModelChange
)="
searchChange
()"
>
<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"
>
<i
class=
"ri-search-line text-gray"
></i>
...
...
@@ -60,27 +61,55 @@
</ng-container>
</tr>
</thead>
<tbody>
<tr
*
ngFor=
"let item of[
['ACC', 'งานบัญชีเเละการเงิน', 'Accounting and Finance'],
['ACC', 'งานบัญชีเเละการเงิน', 'Accounting and Finance'],
['ACC', 'งานบัญชีเเละการเงิน', 'Accounting and Finance'],
['ACC', 'งานบัญชีเเละการเงิน', 'Accounting and Finance'],
['ACC', 'งานบัญชีเเละการเงิน', 'Accounting and Finance']];let i = index"
>
<td
class=
"flex justify-center"
style=
"font-size: 12px;"
>
{{0+""+(i+1)}}
</td>
<td
style=
"font-size: 12px;"
>
{{item[0]}}
</td>
<td
style=
"font-size: 12px;"
>
{{item[1]}}
</td>
<td
style=
"font-size: 12px;"
>
{{item[2]}}
</td>
<tbody
*
ngIf=
"!bu3ListFilter().length"
>
<tr>
<td
class=
"text-center"
colspan=
"100%"
>
ไม่พบข้อมูล
</td>
</tr>
</tbody>
<tbody
*
ngIf=
"bu3ListFilter().length"
>
<tr
*
ngFor=
"let item of bu3ListFilter() | slice:((currentPage-1) * 10) : (((currentPage-1) * 10) + 10);let i = index"
>
<td
class=
"flex justify-center"
>
<i
class=
"ti ti-edit cursor-pointer i-gray fs-l px-1"
data-hs-overlay=
"#section-registration-modal-edit"
></i>
<i
class=
"ti ti-trash cursor-pointer i-gray fs-l px-1"
></i>
{{((currentPage-1) * 10)+(i+1)}}
</td>
<td>
{{item.bu3id}}
</td>
<td>
{{item.tdesc}}
</td>
<td>
{{item.edesc}}
</td>
<td
class=
"flex justify-center"
>
<i
class=
"ti ti-edit cursor-pointer i-gray fs-l px-1"
(
click
)="
selectBu3
(
item
)"
data-hs-overlay=
"#section-registration-modal-edit"
></i>
<i
class=
"ti ti-trash cursor-pointer i-gray fs-l px-1"
(
click
)="
deleteBu3
(
item
)"
></i>
</td>
</tr>
</tbody>
</table>
</div>
<nav
class=
"pagination-style-3 overflow-auto my-5"
*
ngIf=
"page.length"
>
<ul
class=
"ti-pagination"
>
<li>
<a
aria-label=
"anchor"
class=
"page-link"
href=
"javascript:void(0);"
(
click
)="
currentPage =
(currentPage-1
||
1
)"
>
<i
class=
"ri-arrow-left-s-line align-middle rtl:rotate-180"
></i>
</a>
</li>
<li
*
ngFor=
"let item of page"
>
<a
class=
"page-link"
href=
"javascript:void(0);"
[
class
.
active
]="
item=
=currentPage"
(
click
)="
currentPage=
item"
>
{{item}}
</a>
<!-- <a aria-label="anchor" class="page-link" href="javascript:void(0);"><i class="ri-more-line"></i>
</a> -->
</li>
<li>
<a
aria-label=
"anchor"
class=
"page-link"
href=
"javascript:void(0);"
(
click
)="
currentPage =
(currentPage
>
page.length-1 ? currentPage: currentPage+1 )">
<i
class=
"ri-arrow-right-s-line align-middle rtl:rotate-180"
></i>
</a>
</li>
</ul>
</nav>
</div>
</div>
...
...
@@ -246,20 +275,57 @@
</div>
</div>
<label
for=
"part"
class=
"ti-form-label mt-2rem"
>
ส่วน
</label>
<input
type=
"text"
id=
"part"
class=
"ti-form-input w-1/2 pr-10"
placeholder=
""
style=
"background-color: #B3B3B3;"
disabled
value=
"01"
>
<input
type=
"text"
id=
"part"
class=
"ti-form-input w-1/2 pr-10"
style=
"background-color: #B3B3B3;"
[(
ngModel
)]="
bu3
.
bu3id
"
readonly
>
<label
for=
"detail_th"
class=
"ti-form-label mt-2rem"
>
รายละเอียด (ไทย)
</label>
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input h-16"
placeholder=
""
value=
"ส่วน 1
"
>
<input
type=
"text"
id=
"detail_th"
class=
"ti-form-input h-16"
[(
ngModel
)]="
bu3
.
tdesc
"
>
<label
for=
"detail_eng"
class=
"ti-form-label mt-2rem"
>
รายละเอียด (อังกฤษ)
</label>
<input
type=
"text"
id=
"detail_eng"
class=
"ti-form-input h-16"
placeholder=
"
"
>
<input
type=
"text"
id=
"detail_eng"
class=
"ti-form-input h-16"
[(
ngModel
)]="
bu3
.
edesc
"
>
<div
class=
"flex justify-end mt-2rem mb-1rem space-x-4"
>
<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=
"#section-registration-modal-add"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#section-registration-alert-modal"
>
บันทึกข้อมูล
</a>
</div>
</div>
</div>
</div>
</div>
<div
id=
"section-registration-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=
"max-h-full overflow-hidden ti-modal-content w-full"
>
<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=
"#section-registration-alert-modal"
>
<span
class=
"sr-only"
>
Close
</span>
<i
class=
"ti ti-circle-x fs-xxl"
></i>
</button>
</div>
</div>
<div
class=
"ti-modal-body "
>
<p
class=
"mt-1 text-gray-800 dark:text-white/70"
>
ยืนยันการบันทึกข้อมูลหรือไม่
</p>
<div
class=
"flex justify-end mt-2rem mb-1rem"
>
<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=
"#section-registration-alert-modal"
>
ย้อนกลับ
</button>
<a
class=
"ti-btn ti-btn-success"
href=
"javascript:void(0);"
data-hs-overlay=
"#section-registration-alert-modal"
(
click
)="
addBu3
()"
>
บันทึกข้อมูล
</a>
</div>
...
...
src/app/components/company-registration/branch-business-unit/section-registration/section-registration.component.ts
View file @
cce363b7
import
{
Component
}
from
'@angular/core'
;
import
{
Component
,
EventEmitter
,
Input
,
OnInit
,
}
from
'@angular/core'
;
import
{
Bu3Model
,
MyBu3Model
}
from
'src/app/shared/model/bu3.model'
;
import
{
Bu3Service
}
from
'src/app/shared/services/bu3.service'
;
@
Component
({
selector
:
'app-section-registration'
,
templateUrl
:
'./section-registration.component.html'
,
styleUrls
:
[
'./section-registration.component.scss'
]
})
export
class
SectionRegistrationComponent
{
modalOptions
:
{
[
nameModal
:
string
]:
{
// ชื่อตรวจสอบการเปิดปิด
isModalOpen
:
boolean
;
// เปิด/ปิด
modalSize
:
string
;
// ขนาดของ Modal (s,m,l,vw10-vw100 )
backdropClose
:
boolean
;
// (คลิก Backdrop แล้ว true ปิด false ไม่ปิด )
export
class
SectionRegistrationComponent
implements
OnInit
{
currentPage
=
1
page
=
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
);
bu3List
:
Bu3Model
[]
=
[]
bu3
:
Bu3Model
=
new
MyBu3Model
({})
search
=
""
constructor
(
private
bu3Service
:
Bu3Service
)
{
}
ngOnInit
():
void
{
this
.
getBu3List
()
}
}
=
{
"add"
:
{
isModalOpen
:
false
,
modalSize
:
'm'
,
backdropClose
:
true
,
},
"edit"
:
{
isModalOpen
:
false
,
modalSize
:
'm'
,
backdropClose
:
true
,
getBu3List
()
{
this
.
bu3Service
.
getList
().
subscribe
(
response
=>
{
this
.
bu3List
=
response
this
.
searchChange
()
})
}
searchChange
()
{
this
.
currentPage
=
1
this
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
bu3ListFilter
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
}
openModal
(
name
:
string
,
size
:
string
,
closeOnBackdrop
?:
boolean
)
{
this
.
modalOptions
[
name
].
modalSize
=
size
;
this
.
modalOptions
[
name
].
backdropClose
=
closeOnBackdrop
||
false
;
this
.
modalOptions
[
name
].
isModalOpen
=
true
;
document
.
body
.
style
.
overflow
=
'hidden'
;
// ล็อก Scroll
bu3ListFilter
()
{
return
this
.
bu3List
.
filter
(
x
=>
x
.
bu3id
.
toLowerCase
().
includes
(
this
.
search
)
||
x
.
tdesc
.
toLowerCase
().
includes
(
this
.
search
)
||
x
.
edesc
.
toLowerCase
().
includes
(
this
.
search
))
}
closeModal
(
name
:
string
)
{
this
.
modalOptions
[
name
].
isModalOpen
=
false
;
// ตรวจสอบว่ามี Modal อื่นเปิดอยู่หรือไม่
if
(
!
this
.
isAnyModalOpen
())
{
document
.
body
.
style
.
overflow
=
''
;
// คืนค่าการ Scroll เฉพาะเมื่อ Modal ทั้งหมดปิดแล้ว
selectBu3
(
bu3
:
Bu3Model
)
{
this
.
bu3Service
.
getById
(
bu3
.
parent
).
subscribe
(
response
=>
{
console
.
log
(
response
)
})
this
.
bu3
=
new
MyBu3Model
(
bu3
)
}
addBu3
()
{
// this.bu3Service.post(this.bu3).subscribe((response:any) => {
// if (response.success) {
// this.getBu3List()
// }
// })
}
isAnyModalOpen
():
boolean
{
// Logic ตรวจสอบว่า Modal อื่นยังเปิดอยู่หรือไม่
return
Object
.
values
(
this
.
modalOptions
).
some
(
modal
=>
modal
.
isModalOpen
);
// หากไม่มี Modal อื่นเปิด
deleteBu3
(
bu3
:
Bu3Model
)
{
// this.bu3Service.delete(new MyBu1Model(bu3)).subscribe((response:any) => {
// if (response.success) {
// this.getBu3List()
// }
// })
}
}
src/app/components/dashboard/dashboard.module.ts
View file @
cce363b7
...
...
@@ -42,6 +42,7 @@ import { Bu1Service } from 'src/app/shared/services/bu1.service';
import
{
HttpRequestInterceptor
}
from
'src/app/shared/services/http-request.interceptor'
;
import
{
FormsModule
}
from
'@angular/forms'
;
import
{
Bu2Service
}
from
'src/app/shared/services/bu2.service'
;
import
{
Bu3Service
}
from
'src/app/shared/services/bu3.service'
;
@
NgModule
({
declarations
:
[
...
...
@@ -89,7 +90,7 @@ import { Bu2Service } from 'src/app/shared/services/bu2.service';
HttpClientModule
,
FormsModule
],
providers
:
[
Bu1Service
,
Bu2Service
,
{
providers
:
[
Bu1Service
,
Bu2Service
,
Bu3Service
,
{
provide
:
HTTP_INTERCEPTORS
,
useClass
:
HttpRequestInterceptor
,
multi
:
true
,
...
...
src/app/shared/model/bu3.model.ts
0 → 100644
View file @
cce363b7
export
interface
Bu3Model
{
bu3id
:
string
;
tdesc
:
string
;
edesc
:
string
;
parent
:
string
;
companyId
:
string
;
}
export
class
MyBu3Model
implements
Bu3Model
{
bu3id
:
string
;
tdesc
:
string
;
edesc
:
string
;
parent
:
string
;
companyId
:
string
;
constructor
(
data
:
Partial
<
Bu3Model
>
)
{
this
.
bu3id
=
data
.
bu3id
||
""
this
.
tdesc
=
data
.
tdesc
||
""
this
.
edesc
=
data
.
edesc
||
""
this
.
parent
=
data
.
parent
||
""
this
.
companyId
=
data
.
companyId
||
""
}
}
src/app/shared/services/bu3.service.ts
0 → 100644
View file @
cce363b7
import
{
HttpClient
,
HttpHeaders
}
from
'@angular/common/http'
;
import
{
Injectable
}
from
'@angular/core'
;
import
{
Observable
}
from
'rxjs'
;
import
{
environment
}
from
'src/environments/environment'
;
import
{
Bu3Model
}
from
'../model/bu3.model'
;
@
Injectable
({
providedIn
:
'root'
})
export
class
Bu3Service
{
api
=
"/bu3"
urlApi
=
environment
.
baseUrl
+
this
.
api
constructor
(
private
http
:
HttpClient
)
{
}
getById
(
bu3id
:
string
):
Observable
<
Bu3Model
>
{
return
this
.
http
.
get
<
Bu3Model
>
(
this
.
urlApi
+
"/"
+
bu3id
)
}
getList
():
Observable
<
Bu3Model
[]
>
{
return
this
.
http
.
get
<
Bu3Model
[]
>
(
this
.
urlApi
+
"/lists"
)
}
// post(body: Bu3Model) {
// return this.http.post(this.urlApi, body)
// }
// delete(body: Bu3Model) {
// const options = {
// headers: new HttpHeaders({
// "Content-Type": "application/json",
// }),
// body: body
// };
// return this.http.delete(this.urlApi, options)
// }
}
\ No newline at end of file
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