Commit c8c4c04c by Nattana Chaiyamat

Merge branch 'DEV' of https://mygit.myhr.co.th/angular/myAppraisal into DEV

# Conflicts:
#	src/app/components/company-registration/branch-business-unit/department-list/department-list.component.ts
parents 514fae22 75b18de3
import { Component, Renderer2 } from '@angular/core';
import { Component, ElementRef, Inject, Renderer2 } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { Router } from '@angular/router';
import { AuthService } from 'src/app/shared/services/auth.service';
import { DOCUMENT } from '@angular/common';
@Component({
selector: 'app-login-page',
templateUrl: './login-page.component.html',
styleUrls: ['./login-page.component.scss'],
templateUrl: './login-page2.component.html',
styleUrls: ['./login-page2.component.scss'],
})
export class LoginPageComponent {
public showPassword = false;
disabled = '';
active: any;
constructor(
private authservice: AuthService,
private router: Router,
private formBuilder: FormBuilder,
private renderer: Renderer2
) {
const bodyElement = this.renderer.selectRootElement('body', true);
constructor(@Inject(DOCUMENT)
private document: Document,
private elementRef: ElementRef,
private renderer: Renderer2,
private formBuilder: FormBuilder,
private router: Router,
private authservice: AuthService,) {
const bodyElement = this.renderer.selectRootElement('body', true);
this.renderer.setAttribute(bodyElement, 'class', 'cover1 justify-center');
}
ngOnInit(): void {
......@@ -27,6 +29,23 @@ export class LoginPageComponent {
username: ['spruko@admin.com', [Validators.required, Validators.email]],
password: ['sprukoadmin', Validators.required],
});
const authe: any = document.querySelector('.auth');
authe.setAttribute('class', 'h-full');
this.renderer.addClass(this.document.body, 'h-full');
this.renderer.addClass(this.document.body, '!py-0');
this.renderer.addClass(this.document.body, 'bg-white');
this.renderer.addClass(this.document.body, 'dark:bg-bgdark');
const html : any = this.elementRef.nativeElement.ownerDocument.documentElement;
html.removeAttribute('data-header-styles', 'light');
//html.removeAttribute('data-nav-layout','vertical');
html.classList.add('h-full', 'light');
if (localStorage.getItem('synto-header-mode') == 'dark') {
const html: any = this.elementRef.nativeElement.ownerDocument.documentElement;
html.classList.add('h-full', 'dark');
}
}
// firebase
......@@ -103,5 +122,16 @@ export class LoginPageComponent {
ngOnDestroy(): void {
const bodyElement = this.renderer.selectRootElement('body', true);
this.renderer.removeAttribute(bodyElement, 'class');
this.renderer.removeClass(this.document.body, 'h-full');
this.renderer.removeClass(this.document.body, '!py-0');
this.renderer.removeClass(this.document.body, 'bg-white');
this.renderer.removeClass(this.document.body, 'dark:bg-bgdark');
if (localStorage.getItem('synto-header-mode') == 'dark') {
const html: any = this.elementRef.nativeElement.ownerDocument.documentElement;
html.classList.remove('h-full', 'dark');
}
const authe: any = document.querySelector('.h-full');
authe.removeAttribute('class', 'h-full');
}
}
}
\ No newline at end of file
<div class="auth">
<div class="flex h-full !py-0 bg-white dark:bg-bgdark">
<div class="grid grid-cols-12 gap-6 w-full h-full">
<div class="lg:col-span-6 col-span-12 hidden lg:block relative">
<div class="cover relative w-full h-full z-[1] p-10">
<a routerLink="/dashboard/sales" class="header- logo">
<img style="height: 36px; width: 93px;" src="./assets/img/brand-logos/logo-login-light.png" alt="logo"
class="ltr:ml-auto rtl:mr-auto block" />
</a>
<div class="authentication-page justify-center w-full max-w-7xl mx-auto p-0">
<img src="./assets/img/loginform/Computer login-bro.png" alt="logo" class="mx-auto h-[500px]" />
</div>
</div>
</div>
<div class="lg:col-span-6 col-span-12">
<div class="authentication-page w-full">
<!-- ========== MAIN CONTENT ========== -->
<main id="content" class="w-full max-w-md mx-auto p-6">
<a routerLink="/dashboard/sales" class="header-logo">
<img src="./assets/img/brand-logos/logo.png" alt="logo" class="mx-auto block dark:hidden" />
<img src="./assets/img/brand-logos/desktop-dark.png" alt="logo" class="mx-auto hidden dark:block" />
</a>
<div class="mt-2">
<div class="p-4 sm:p-7">
<div class="text-center">
<h1 class="block text-2xl font-bold text-gray-800 dark:text-white">
Sign in
</h1>
<h1 class="block text-1xl font-bold text-gray-800 dark:text-white">
(ลงชื่อเข้าใช้งานระบบ)
</h1>
</div>
<div class="mt-5">
<!-- Form -->
<div>
<form [formGroup]="loginForm" (ngSubmit)="Submit()">
<div class="grid gap-y-4">
<!-- Form Group -->
<div>
<label for="email" class="block text-sm mb-2 dark:text-white">Email address (อีเมล์)</label>
<div class="relative">
<input type="email" id="email" name="email"
class="py-2 px-3 block w-full border-gray-200 rounded-sm text-sm focus:border-primary focus:ring-primary dark:bg-bgdark dark:border-white/10 dark:text-white/70"
placeholder="Username" autocomplete formControlName="username" />
</div>
</div>
<!-- End Form Group -->
<!-- Form Group -->
<div>
<div class="flex justify-between items-center">
<label for="password" class="block text-sm mb-2 dark:text-white">Password (รหัสผ่าน)</label>
<a class="text-sm text-primary decoration-2 hover:underline font-medium"
routerLink="/forgotpassword/basic">Forgot password?</a>
</div>
<div class="relative">
<input [type]="showPassword ? 'text' : 'password'" id="password" name="password"
class="py-2 px-3 block w-full border-gray-200 rounded-sm text-sm focus:border-primary focus:ring-primary dark:bg-bgdark dark:border-white/10 dark:text-white/70"
placeholder="Password" autocomplete formControlName="password" />
</div>
</div>
<!-- End Form Group -->
<!-- Checkbox -->
<div class="flex items-center">
<div class="flex">
<input id="remember-me" name="remember-me" type="checkbox"
class="shrink-0 mt-0.5 border-gray-200 rounded text-primary focus:ring-primary dark:bg-bgdark dark:border-white/10 dark:checked:bg-primary dark:checked:border-primary dark:focus:ring-offset-white/10" />
</div>
<div class="ltr:ml-3 rtl:mr-3">
<label for="remember-me" class="text-sm dark:text-white">Remember me</label>
</div>
</div>
<!-- End Checkbox -->
<a routerLink="/dashboard/sales"
class="py-2 px-3 inline-flex justify-center items-center gap-2 rounded-sm border border-transparent font-semibold bg-primary text-white hover:bg-primary focus:outline-none focus:ring-0 focus:ring-primary focus:ring-offset-0 transition-all text-sm dark:focus:ring-offset-white/10">Sign
in</a>
<div class="text-center">
<p class="mt-3 text-sm text-gray-600 dark:text-white/70">
Don't have an account yet?
(คุณมีบัญชีเเล้วหรือยัง?)
<a class="text-primary decoration-2 hover:underline font-medium" routerLink="/auth/register">
Sign up here
(กรุณาลงทะเบียนที่นี่ หากคุณยังไม่มีบัญชีเข้าใช้)
</a>
</p>
</div>
</div>
</form>
</div>
<!-- End Form -->
</div>
</div>
</div>
</main>
<!-- ========== END MAIN CONTENT ========== -->
</div>
</div>
</div>
</div>
</div>
.cover::before{
position: absolute;
left: 0px;
right: 0px;
top: 0px;
z-index: -1;
height: 100%;
width: 100%;
content: var(--tw-content);
background-image: url('/assets/img/loginform/bg_signup.jpg');
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
@media (min-width: 480px){
.authentication-page{
padding-top: 1rem;
padding-bottom: 1rem;
}
}
<!-- ========== MAIN CONTENT ========== -->
<main id="content" class="w-full max-w-md mx-auto p-6">
<a routerLink="/dashboard/sales" class="header-logo">
<img
src="./assets/img/brand-logos/desktop-logo.png"
alt="logo"
class="mx-auto block dark:hidden"
/>
<img
src="./assets/img/brand-logos/desktop-dark.png"
alt="logo"
class="mx-auto hidden dark:block"
/>
</a>
<div class="mt-7 bg-white rounded-sm shadow-sm dark:bg-bgdark">
<div class="p-4 sm:p-7">
<div class="text-center">
<h1 class="block text-2xl font-bold text-gray-800 dark:text-white">
Sign up
</h1>
<p class="mt-3 text-sm text-gray-600 dark:text-white/70">
Already have an account?
<a
class="text-primary decoration-2 hover:underline font-medium"
routerLink="/signin/basic"
>
Sign in here
</a>
</p>
<div class="auth">
<div class="grid grid-cols-12 gap-6 w-full h-full">
<div class="lg:col-span-6 col-span-12 hidden lg:block relative">
<div class="cover relative w-full h-full z-[1] p-10">
<a routerLink="/dashboard/sales" class="header-logo">
<img style="width: 93px; height: 36px;" src="./assets/img/register_images/logo-login-light.png" alt="logo"
class="ltr:ml-auto rtl:mr-auto block" />
</a>
<div class="authentication-page justify-center w-full max-w-7xl mx-auto p-0">
<img src="./assets/img/register_images/Sign-up-pana2.png" alt="logo" class="mx-auto h-[500px]" />
</div>
</div>
</div>
<div class="mt-5">
<button
type="button"
class="w-full py-2 px-3 inline-flex justify-center items-center gap-2 rounded-sm border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:outline-none focus:ring-0 focus:ring-offset-0 focus:ring-offset-white focus:ring-primary transition-all text-sm 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"
>
<img
src="./assets/img/authentication/social/1.png"
class="w-4 h-4"
alt="google-img"
/>Sign in with Google
</button>
<div class="lg:col-span-6 col-span-12">
<div class="authentication-page w-full">
<!-- ========== MAIN CONTENT ========== -->
<main id="content" class="w-full max-w-md mx-auto p-6 mt-7">
<a routerLink="/dashboard/sales" class="header-logo">
<img src="./assets/img/brand-logos/logo.png" alt="logo" class="mx-auto block dark:hidden mt-1" />
<img src="./assets/img/brand-logos/logo.png" alt="logo" class="mx-auto hidden dark:block mt-1" />
</a>
<div class="mt-2">
<div class="p-4 sm:p-7">
<div class="text-center">
<h1 class="block text-2xl font-bold text-gray-800 dark:text-white">
Sign up
</h1>
</div>
<div
class="py-3 flex items-center text-xs text-gray-400 uppercase before:flex-[1_1_0%] before:border-t before:border-gray-200 ltr:before:mr-6 rtl:before:ml-6 after:flex-[1_1_0%] after:border-t after:border-gray-200 ltr:after:ml-6 rtl:after:mr-6 dark:text-white/70 dark:before:border-white/10 dark:after:border-white/10"
>
Or
</div>
<div class="mt-5">
<!-- Form -->
<form>
<div class="grid gap-y-4">
<!-- Form Group -->
<div>
<label class="block text-sm mb-2 dark:text-white">Full Name</label>
<div class="relative">
<input type="text" name="text"
class="py-2 px-3 block w-full border-gray-200 rounded-sm text-sm focus:border-primary focus:ring-primary dark:bg-bgdark dark:border-white/10 dark:text-white/70"
required />
</div>
</div>
<!-- End Form Group -->
<!-- Form -->
<form>
<div class="grid gap-y-4">
<!-- Form Group -->
<div>
<label class="block text-sm mb-2 dark:text-white"
>Full Name</label
>
<div class="relative">
<input
type="text"
name="text"
class="py-2 px-3 block w-full border-gray-200 rounded-sm text-sm focus:border-primary focus:ring-primary dark:bg-bgdark dark:border-white/10 dark:text-white/70"
required
/>
</div>
</div>
<!-- End Form Group -->
<!-- Form Group -->
<div>
<label class="block text-sm mb-2 dark:text-white">Email address</label>
<div class="relative">
<input type="email" name="email"
class="py-2 px-3 block w-full border-gray-200 rounded-sm text-sm focus:border-primary focus:ring-primary dark:bg-bgdark dark:border-white/10 dark:text-white/70"
required />
</div>
</div>
<!-- End Form Group -->
<!-- Form Group -->
<div>
<label class="block text-sm mb-2 dark:text-white"
>Email address</label
>
<div class="relative">
<input
type="email"
name="email"
class="py-2 px-3 block w-full border-gray-200 rounded-sm text-sm focus:border-primary focus:ring-primary dark:bg-bgdark dark:border-white/10 dark:text-white/70"
required
/>
</div>
</div>
<!-- End Form Group -->
<!-- Form Group -->
<div>
<label for="password" class="block text-sm mb-2 dark:text-white">Password</label>
<div class="relative">
<input type="password" id="password" name="password"
class="py-2 px-3 block w-full border-gray-200 rounded-sm text-sm focus:border-primary focus:ring-primary dark:bg-bgdark dark:border-white/10 dark:text-white/70"
required />
</div>
</div>
<!-- End Form Group -->
<!-- Form Group -->
<div>
<label for="password" class="block text-sm mb-2 dark:text-white"
>Password</label
>
<div class="relative">
<input
type="password"
id="password"
name="password"
class="py-2 px-3 block w-full border-gray-200 rounded-sm text-sm focus:border-primary focus:ring-primary dark:bg-bgdark dark:border-white/10 dark:text-white/70"
required
/>
</div>
</div>
<!-- End Form Group -->
<!-- Form Group -->
<div>
<label for="confirm-password" class="block text-sm mb-2 dark:text-white">Confirm Password</label>
<div class="relative">
<input type="password" id="confirm-password" name="confirm-password"
class="py-2 px-3 block w-full border-gray-200 rounded-sm text-sm focus:border-primary focus:ring-primary dark:bg-bgdark dark:border-white/10 dark:text-white/70"
required />
</div>
</div>
<!-- End Form Group -->
<!-- Form Group -->
<div>
<label
for="confirm-password"
class="block text-sm mb-2 dark:text-white"
>Confirm Password</label
>
<div class="relative">
<input
type="password"
id="confirm-password"
name="confirm-password"
class="py-2 px-3 block w-full border-gray-200 rounded-sm text-sm focus:border-primary focus:ring-primary dark:bg-bgdark dark:border-white/10 dark:text-white/70"
required
/>
</div>
</div>
<!-- End Form Group -->
<!-- Checkbox -->
<div class="flex items-center">
<div class="flex">
<input id="remember-me" name="remember-me" type="checkbox"
class="shrink-0 mt-0.5 border-gray-200 rounded text-primary focus:ring-primary dark:bg-bgdark dark:border-white/10 dark:checked:bg-primary dark:checked:border-primary dark:focus:ring-offset-white/10" />
</div>
<div class="ltr:ml-3 rtl:mr-3">
<label for="remember-me" class="text-sm dark:text-white">I accept the
<a class="text-primary decoration-2 hover:underline font-medium"
routerLink="/page/terms-conditions">Terms and Conditions</a></label>
</div>
</div>
<!-- <div
class="py-3 flex items-center text-xs text-gray-400 uppercase before:flex-[1_1_0%] before:border-t before:border-gray-200 ltr:before:mr-6 rtl:before:ml-6 after:flex-[1_1_0%] after:border-t after:border-gray-200 ltr:after:ml-6 rtl:after:mr-6 dark:text-white/70 dark:before:border-white/10 dark:after:border-white/10">
Or
</div>
<button type="button"
class="w-full py-2 px-3 inline-flex justify-center items-center gap-2 rounded-sm border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:outline-none focus:ring-0 focus:ring-offset-0 focus:ring-offset-white focus:ring-primary transition-all text-sm 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">
<img src="./assets/img/register_images/google-icon.png" class="w-4 h-4" alt="google-img" />Sign
in with Google
</button> -->
<!-- End Checkbox -->
<!-- Checkbox -->
<div class="flex items-center">
<div class="flex">
<input
id="remember-me"
name="remember-me"
type="checkbox"
class="shrink-0 mt-0.5 border-gray-200 rounded text-primary focus:ring-primary dark:bg-bgdark dark:border-white/10 dark:checked:bg-primary dark:checked:border-primary dark:focus:ring-offset-white/10"
/>
</div>
<div class="ltr:ml-3 rtl:mr-3">
<label for="remember-me" class="text-sm dark:text-white"
>I accept the
<a
class="text-primary decoration-2 hover:underline font-medium"
routerLink="/page/terms-conditions"
>Terms and Conditions</a
></label>
<button type="submit"
class="py-2 px-3 inline-flex justify-center items-center gap-2 rounded-sm border border-transparent font-semibold bg-primary text-white hover:bg-primary focus:outline-none focus:ring-0 focus:ring-primary focus:ring-offset-0 transition-all text-sm dark:focus:ring-offset-white/10">
Sign up
</button>
<div class="text-center">
<p class="mt-1 text-sm text-gray-600 dark:text-white/70">
Already have an account?
<a class="text-primary decoration-2 hover:underline font-medium" routerLink="/auth/login">
Sign in here
</a>
</p>
</div>
</div>
</form>
<!-- End Form -->
</div>
</div>
<!-- End Checkbox -->
<button
type="submit"
class="py-2 px-3 inline-flex justify-center items-center gap-2 rounded-sm border border-transparent font-semibold bg-primary text-white hover:bg-primary focus:outline-none focus:ring-0 focus:ring-primary focus:ring-offset-0 transition-all text-sm dark:focus:ring-offset-white/10"
>
Sign up
</button>
</div>
</form>
<!-- End Form -->
</main>
<!-- ========== END MAIN CONTENT ========== -->
</div>
</div>
</div>
</main>
<!-- ========== END MAIN CONTENT ========== -->
</div>
@media (min-width: 480px){
.authentication-page{
padding-top: 1rem;
padding-bottom: 1rem;
}
}
.cover::before{
position: absolute;
left: 0px;
right: 0px;
top: 0px;
z-index: -1;
height: 100%;
width: 100%;
content: var(--tw-content);
background-image: url('/assets/img/register_images/bg_signup.jpg');
background-size: cover;
background-position: center;
}
\ No newline at end of file
import { Component } from '@angular/core';
import { DOCUMENT } from '@angular/common';
import { Component, ElementRef, Inject, Renderer2 } from '@angular/core';
@Component({
selector: 'app-register-page',
......@@ -6,5 +7,38 @@ import { Component } from '@angular/core';
styleUrls: ['./register-page.component.scss']
})
export class RegisterPageComponent {
constructor(@Inject(DOCUMENT) private document: Document,private elementRef: ElementRef,
private renderer: Renderer2) {}
ngOnInit(): void {
this.renderer.addClass(this.document.body, 'h-full');
this.renderer.addClass(this.document.body, '!py-0');
this.renderer.addClass(this.document.body, 'bg-white');
this.renderer.addClass(this.document.body, 'dark:bg-bgdark');
const authe : any = document.querySelector('.auth');
authe.setAttribute('class','h-full');
const html: any = this.elementRef.nativeElement.ownerDocument.documentElement;
html.classList.add('h-full', 'light');
html.removeAttribute('data-header-styles', 'light');
// html.removeAttribute('data-nav-layout', 'vertical');
if (localStorage.getItem('synto-header-mode') == 'dark') {
const html: any = this.elementRef.nativeElement.ownerDocument.documentElement;
html.classList.add('h-full', 'dark');
}
}
ngOnDestroy(): void {
this.renderer.removeClass(this.document.body, 'h-full');
this.renderer.removeClass(this.document.body, '!py-0');
this.renderer.removeClass(this.document.body, 'bg-white');
this.renderer.removeClass(this.document.body, 'dark:bg-bgdark');
if (localStorage.getItem('synto-header-mode') == 'dark') {
const html: any = this.elementRef.nativeElement.ownerDocument.documentElement;
html.classList.remove('h-full', 'dark');
}
const authe: any = document.querySelector('.h-full');
authe.removeAttribute('class', 'h-full');
}
}
<app-page-header [pathTitle]="pathTitle"></app-page-header>
<!-- <app-page-header [pathTitle]="pathTitle"></app-page-header>
<div class="bg-card-white">
</div>
<div class="block-main-content">
......@@ -28,4 +28,42 @@
</div>
</div>
</div>
</div> -->
<app-page-header [pathTitle]="pathTitle"></app-page-header>
<div class="bg-card-white">
</div>
<div class="block-main-content">
<div class="text-xxl font-bold py-2 px-4 text-primary">
ตั้งค่าผู้ใช้งาน
</div>
<div class="page">
<div class="border-b border-gray-200 dark:border-white/10">
<nav class="-mb-0.5 flex space-x-6 rtl:space-x-reverse">
<a class="pl-8 text-xxl font-bold hs-tab-active:border-secondary hs-tab-active:text-secondary pb-3 px-1 inline-flex items-center gap-2 border-b-[3px] border-transparent whitespace-nowrap text-gray-500 dark:text-white/70 hover:text-secondary active"
href="javascript:void(0);" id="underline-item-1" data-hs-tab="#underline-1"
aria-controls="underline-1" (click)="pathTitle = ['ตั้งค่าผู้ใช้งาน','สร้างชื่อผู้ใช้งาน']">
สร้างชื่อผู้ใช้งาน
</a>
<a class="text-xxl font-bold hs-tab-active:border-secondary hs-tab-active:text-secondary pb-3 px-1 inline-flex items-center gap-2 border-b-[3px] border-transparent whitespace-nowrap text-gray-500 dark:text-white/70 hover:text-secondary"
href="javascript:void(0);" id="underline-item-2" data-hs-tab="#underline-2"
aria-controls="underline-2" (click)="pathTitle = ['ตั้งค่าผู้ใช้งาน','กำหนดรหัสผ่าน']">
กำหนดรหัสผ่าน
</a>
<a class="text-xxl font-bold hs-tab-active:border-secondary hs-tab-active:text-secondary pb-3 px-1 inline-flex items-center gap-2 border-b-[3px] border-transparent whitespace-nowrap text-gray-500 dark:text-white/70 hover:text-secondary"
href="javascript:void(0);" id="underline-item-3" data-hs-tab="#underline-3"
aria-controls="underline-3" (click)="pathTitle = ['ตั้งค่าผู้ใช้งาน','จัดการผู้ใช้งาน']">
จัดการผู้ใช้งาน
</a>
</nav>
</div>
<div class="mt-3 px-3rem">
<div id="underline-1" role="tabpanel" aria-labelledby="underline-item-1">
<app-user-settings [pathTitle]="pathTitle"
(sendPathTitle)="pathTitle=$event"></app-user-settings>
</div>
<div id="underline-2" class="hidden" role="tabpanel" aria-labelledby="underline-item-2">
<app-set-a-password [pathTitle]="pathTitle" (sendPathTitle)="pathTitle=$event"></app-set-a-password>
</div>
</div>
</div>
</div>
\ No newline at end of file
......@@ -6,12 +6,5 @@ import { Component } from '@angular/core';
styleUrls: ['./account-settings.component.scss']
})
export class AccountSettingsComponent {
pathTitle = ['การจัดการข้อมูลองค์กร', 'ตั้งค่าผู้ใช้งาน', 'สร้างรหัสผู้ใช้งาน']
activeTab: string = 'tab1';
// ฟังก์ชันในการเปลี่ยนแท็บ
changeTab(tab: { id: string, text: string }) {
this.pathTitle = ['การจัดการข้อมูลองค์กร', 'ตั้งค่าผู้ใช้งาน', tab.text]
this.activeTab = tab.id
}
pathTitle = ['ตั้งค่าผู้ใช้งาน', 'สร้างชื่อผู้ใช้งาน']
}
......@@ -44,7 +44,7 @@ export class DepartmentListComponent implements OnInit {
this.getBu1List()
}
getBu2List() {
this.bu2Service.getBu2().subscribe(response => {
this.bu2Service.getList().subscribe(response => {
this.bu2List = response
this.onBu2TableSearchChange()
})
......@@ -62,7 +62,7 @@ export class DepartmentListComponent implements OnInit {
this.bu2 = new MyBu2Model(bu2 || {})
this.selectBu1()
if (this.bu2.parent) {
this.bu1Service.getBu1ById(this.bu2.parent).subscribe(response => {
this.bu1Service.getById(this.bu2.parent).subscribe(response => {
this.bu1 = new MyBu1Model(response)
})
}
......@@ -96,7 +96,7 @@ export class DepartmentListComponent implements OnInit {
}
getBu1List() {
this.bu1Service.getBu1().subscribe(response => {
this.bu1Service.getList().subscribe(response => {
this.bu1List = response
this.onBu1ModalSearchChange()
})
......
......@@ -21,7 +21,7 @@ export class DepartmentRegisterComponent implements OnInit {
this.getBu1List()
}
getBu1List() {
this.bu1Service.getBu1().subscribe(response => {
this.bu1Service.getList().subscribe(response => {
this.bu1List = response
this.searchChange()
})
......
......@@ -257,7 +257,7 @@
<div class="relative w-full">
<div>
<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-none ltr:rounded-r-md rtl:rounded-l-md focus:z-10" value="01" style="padding-right: 3.5rem;">
<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-none ltr:rounded-r-md rtl:rounded-l-md focus:z-10" style="padding-right: 3.5rem;" [(ngModel)]="bu2.bu2id">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center pointer-events-none z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<i class="ti ti-circle-x text-red-500 cursor-pointer right-10"></i>
<svg class="h-3.5 w-3.5 text-gray-500 dark:text-white/70" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
......@@ -269,7 +269,7 @@
</div>
<div class="flex flex-col-6">
<input type="text" id="part2" class="ti-form-input w-full" placeholder="" style="background-color: #B3B3B3; margin-left: 10px;" disabled value="แผนก 1">
<input type="text" id="part2" class="ti-form-input w-full" placeholder="" style="background-color: #B3B3B3; margin-left: 10px;" [(ngModel)]="bu2.tdesc" readonly>
</div>
</div>
</div>
......
import { Component, EventEmitter, Input, OnInit, } from '@angular/core';
import { Bu2Model, MyBu2Model } from 'src/app/shared/model/bu2.model';
import { Bu3Model, MyBu3Model } from 'src/app/shared/model/bu3.model';
import { Bu2Service } from 'src/app/shared/services/bu2.service';
import { Bu3Service } from 'src/app/shared/services/bu3.service';
......@@ -13,8 +15,11 @@ export class SectionRegistrationComponent implements OnInit {
page = Array.from({ length: 1 }, (_, i) => i + 1);
bu3List: Bu3Model[] = []
bu3: Bu3Model = new MyBu3Model({})
bu2: Bu2Model = new MyBu2Model({})
search = ""
constructor(private bu3Service: Bu3Service) { }
constructor(private bu3Service: Bu3Service,
private bu2Service: Bu2Service
) { }
ngOnInit(): void {
this.getBu3List()
}
......@@ -34,8 +39,8 @@ export class SectionRegistrationComponent implements OnInit {
x.edesc.toLowerCase().includes(this.search))
}
selectBu3(bu3: Bu3Model) {
this.bu3Service.getById(bu3.parent).subscribe(response =>{
console.log(response)
this.bu2Service.getById(bu3.parent).subscribe(response =>{
this.bu2 = response
})
this.bu3 = new MyBu3Model(bu3)
}
......
......@@ -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="!bu7ListFilter().length">
<tr>
<td class="text-center" colspan="100%">
ไม่พบข้อมูล
</td>
</tr>
</tbody>
<tbody *ngIf="bu7ListFilter().length">
<tr
*ngFor="let item of bu7ListFilter() | slice:((currentPage-1) * 10) : (((currentPage-1) * 10) + 10);let i = index">
<td class="flex justify-center">
{{((currentPage-1) * 10)+(i+1)}}
</td>
<td>{{item.bu7id}}</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" data-hs-overlay="#sub-department-four-modal-edit"></i>
<i class="ti ti-trash cursor-pointer i-gray fs-l px-1"></i>
<i class="ti ti-edit cursor-pointer i-gray fs-l px-1" (click)="selectBu7(item)"
data-hs-overlay="#sub-department-four-modal-edit"></i>
<i class="ti ti-trash cursor-pointer i-gray fs-l px-1" (click)="deleteBu7(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>
......@@ -128,12 +157,16 @@
<div class="relative rounded-xl overflow-auto">
<div class="sm:grid grid-cols-2 gap-1">
<div class="relative w-full">
<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-none ltr:rounded-r-md rtl:rounded-l-md focus:z-10" style="padding-right: 3.5rem;">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center pointer-events-none z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<i class="ti ti-circle-x text-red-500 cursor-pointer"></i>
<svg class="h-3.5 w-3.5 text-gray-300 dark:text-white/70" xmlns="http://www.w3.org/2000/svg" width="10" height="10" fill="currentColor" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
</svg>
<div>
<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-none ltr:rounded-r-md rtl:rounded-l-md focus:z-10" style="padding-right: 3.5rem;">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center pointer-events-none z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<i class="ti ti-circle-x text-red-500 cursor-pointer right-10"></i>
<svg class="h-3.5 w-3.5 text-gray-500 dark:text-white/70" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
</svg>
</div>
</div>
</div>
</div>
......@@ -145,12 +178,16 @@
</div>
<label for="part" class="ti-form-label mt-2rem">ส่วนย่อย4</label>
<div class="relative w-1/2">
<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-none ltr:rounded-r-md rtl:rounded-l-md focus:z-10" style="padding-right: 3.5rem;">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center pointer-events-none z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<i class="ti ti-circle-x text-red-500 cursor-pointer"></i>
<svg class="h-3.5 w-3.5 text-gray-300 dark:text-white/70" xmlns="http://www.w3.org/2000/svg" width="10" height="10" fill="currentColor" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
</svg>
<div>
<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-none ltr:rounded-r-md rtl:rounded-l-md focus:z-10" style="padding-right: 3.5rem;">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center pointer-events-none z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<i class="ti ti-circle-x text-red-500 cursor-pointer right-10"></i>
<svg class="h-3.5 w-3.5 text-gray-500 dark:text-white/70" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
</svg>
</div>
</div>
</div>
</div>
......@@ -165,7 +202,8 @@
data-hs-overlay="#sub-department-four-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="#sub-department-four-alert-modal">
บันทึกข้อมูล
</a>
</div>
......@@ -218,36 +256,78 @@
<div class="relative rounded-xl overflow-auto">
<div class="sm:grid grid-cols-2 gap-1">
<div class="relative w-full">
<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-none ltr:rounded-r-md rtl:rounded-l-md focus:z-10" style="padding-right: 3.5rem;" value="01">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center pointer-events-none z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<i class="ti ti-circle-x text-red-500 cursor-pointer"></i>
<svg class="h-3.5 w-3.5 text-gray-300 dark:text-white/70" xmlns="http://www.w3.org/2000/svg" width="10" height="10" fill="currentColor" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
</svg>
<div>
<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-none ltr:rounded-r-md rtl:rounded-l-md focus:z-10" style="padding-right: 3.5rem;" [(ngModel)]="bu6.bu6id">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center pointer-events-none z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<i class="ti ti-circle-x text-red-500 cursor-pointer right-10"></i>
<svg class="h-3.5 w-3.5 text-gray-500 dark:text-white/70" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
</svg>
</div>
</div>
</div>
</div>
<div class="flex flex-col-6">
<input type="text" id="part2" class="ti-form-input w-full" placeholder="" style="background-color: #B3B3B3; margin-left: 10px;" disabled value="ส่วนย่อย 3">
<input type="text" id="part2" class="ti-form-input w-full" placeholder="" style="background-color: #B3B3B3; margin-left: 10px;" [(ngModel)]="bu6.tdesc" readonly>
</div>
</div>
</div>
</div>
<label for="part" class="ti-form-label mt-2rem">ส่วนย่อย4</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)]="bu7.bu7id" 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="ส่วนย่อย 4">
<input type="text" id="detail_th" class="ti-form-input h-16" [(ngModel)]="bu7.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)]="bu7.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="#sub-department-four-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="#sub-department-four-alert-modal">
บันทึกข้อมูล
</a>
</div>
</div>
</div>
</div>
</div>
<div id="sub-department-four-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="#sub-department-four-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="#sub-department-four-alert-modal">
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#sub-department-four-alert-modal" (click)="addBu7()">
บันทึกข้อมูล
</a>
</div>
......
import { Component } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { Bu6Model, MyBu6Model } from 'src/app/shared/model/bu6.model';
import { Bu7Model, MyBu7Model } from 'src/app/shared/model/bu7.model';
import { Bu6Service } from 'src/app/shared/services/bu6.service';
import { Bu7Service } from 'src/app/shared/services/bu7.service';
@Component({
selector: 'app-sub-department-four',
templateUrl: './sub-department-four.component.html',
styleUrls: ['./sub-department-four.component.scss']
})
export class SubDepartmentFourComponent {
modalOptions: {
[nameModal: string]: { // ชื่อตรวจสอบการเปิดปิด
isModalOpen: boolean; // เปิด/ปิด
modalSize: string; // ขนาดของ Modal (s,m,l,vw10-vw100 )
backdropClose: boolean; // (คลิก Backdrop แล้ว true ปิด false ไม่ปิด )
}
} = {
"add": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
},
"edit": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
}
}
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
export class SubDepartmentFourComponent implements OnInit {
currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1);
bu7List: Bu7Model[] = []
bu7: Bu7Model = new MyBu7Model({})
bu6: Bu6Model = new MyBu6Model({})
search = ""
constructor(private bu7Service: Bu7Service,
private bu6Service: Bu6Service
) { }
ngOnInit(): void {
this.getBu7List()
}
closeModal(name: string) {
this.modalOptions[name].isModalOpen = false;
// ตรวจสอบว่ามี Modal อื่นเปิดอยู่หรือไม่
if (!this.isAnyModalOpen()) {
document.body.style.overflow = ''; // คืนค่าการ Scroll เฉพาะเมื่อ Modal ทั้งหมดปิดแล้ว
}
getBu7List() {
this.bu7Service.getList().subscribe(response => {
this.bu7List = response
this.searchChange()
})
}
isAnyModalOpen(): boolean {
// Logic ตรวจสอบว่า Modal อื่นยังเปิดอยู่หรือไม่
return Object.values(this.modalOptions).some(modal => modal.isModalOpen); // หากไม่มี Modal อื่นเปิด
searchChange() {
this.currentPage = 1
this.page = Array.from({ length: Math.ceil(this.bu7ListFilter().length / 10) }, (_, i) => i + 1);
}
bu7ListFilter() {
return this.bu7List.filter(x => x.bu7id.toLowerCase().includes(this.search) ||
x.tdesc.toLowerCase().includes(this.search) ||
x.edesc.toLowerCase().includes(this.search))
}
selectBu7(bu7: Bu7Model) {
this.bu6Service.getById(bu7.parent).subscribe(response =>{
this.bu6 = new MyBu6Model(response)
})
this.bu7 = new MyBu7Model(bu7)
}
addBu7() {
// this.bu7Service.post(this.bu7).subscribe((response:any) => {
// if (response.success) {
// this.getBu7List()
// }
// })
}
deleteBu7(bu7: Bu7Model) {
// this.bu7Service.delete(new MyBu1Model(bu7)).subscribe((response:any) => {
// if (response.success) {
// this.getBu7List()
// }
// })
}
}
......@@ -2,7 +2,9 @@
<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>
......@@ -11,7 +13,7 @@
</div>
<div class="px-1">
<button type="button" class="ti-btn ti-btn-soft-secondary h-45px m-0 shadow-md"
data-hs-overlay="#sub-department-one-modal-add">
data-hs-overlay="#sub-department-one-component-modal-add">
<i class="ri-add-line"></i>
Add
</button>
......@@ -60,38 +62,67 @@
</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="!bu4ListFilter().length">
<tr>
<td class="text-center" colspan="100%">
ไม่พบข้อมูล
</td>
</tr>
</tbody>
<tbody *ngIf="bu4ListFilter().length">
<tr
*ngFor="let item of bu4ListFilter() | 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="#sub-department-one-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.bu4id}}</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)="selectBu4(item)"
data-hs-overlay="#sub-department-one-component-modal-edit"></i>
<i class="ti ti-trash cursor-pointer i-gray fs-l px-1" (click)="deleteBu4(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>
<div id="sub-department-one-modal-add" class="hs-overlay hidden ti-modal">
<div id="sub-department-one-component-modal-add" 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">
เพิ่มข้อมูลทะเบียนส่วนย่อยที่ 1
เพิ่มข้อมูลทะเบียนส่วนย่อย 1
</h3>
<div class="flex justify-end">
<div class="flex justify-end" >
<div class="button-clear">
<button type="button" class="ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md">
<svg class="svg-indigo" width="16" height="16" viewBox="0 0 64.00 64.00"
......@@ -116,36 +147,36 @@
</button>
</div>
<button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay="#sub-department-one-modal-add">
data-hs-overlay="#sub-department-one-component-modal-add">
<span class="sr-only">Close</span>
<i class="ti ti-circle-x fs-xxl"></i>
</button>
</div>
</div>
<div class="ti-modal-body" style="margin-top: 40px;">
<div class="ti-modal-body " style="margin-top: 40px;">
<label for="input-label" class="ti-form-label mt-2rem">อยู่ภายใต้หน่วยงาน</label>
<div class="relative">
<div class="relative rounded-xl overflow-auto">
<div class="sm:grid grid-cols-2 gap-1">
<div class="relative w-full">
<div>
<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-none ltr:rounded-r-md rtl:rounded-l-md focus:z-10" style="padding-right: 3.5rem;">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center pointer-events-none z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<i class="ti ti-circle-x text-red-500 cursor-pointer right-10"></i>
<svg class="h-3.5 w-3.5 text-gray-500 dark:text-white/70" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
</svg>
</div>
<div class="relative">
<div class="relative rounded-xl overflow-auto">
<div class="sm:grid grid-cols-2 gap-1">
<div class="relative w-full">
<div>
<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-none ltr:rounded-r-md rtl:rounded-l-md focus:z-10" style="padding-right: 3.5rem;">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center pointer-events-none z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<i class="ti ti-circle-x text-red-500 cursor-pointer right-10"></i>
<svg class="h-3.5 w-3.5 text-gray-500 dark:text-white/70" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
</svg>
</div>
</div>
</div>
</div>
</div>
<div class="flex flex-col-6" >
<input type="text" id="input-label" class="ti-form-input w-full" style="background-color: #B3B3B3; margin-left:10px;" disabled>
<div class="flex flex-col-6" >
<input type="text" id="input-label" class="ti-form-input w-full" style="background-color: #B3B3B3; margin-left:10px;" disabled>
</div>
</div>
</div>
</div>
</div>
</div>
<label for="input-label" class="ti-form-label mt-2rem">ส่วนย่อย1</label>
<div class="sm:grid grid-cols-2 gap-1">
<div class="relative w-full">
......@@ -161,18 +192,19 @@
</div>
</div>
</div>
</div>
</div>
<label for="detail_th" class="ti-form-label mt-2rem">รายละเอียด (ไทย)</label>
<input type="text" id="detail_th" class="ti-form-input h-16" placeholder="">
<input type="text" id="detail_th" class="ti-form-input h-16">
<label for="detail_eng" class="ti-form-label mt-2rem">รายละเอียด (อังกฤษ)</label>
<input type="text" id="detail_eng" class="ti-form-input h-16" placeholder="">
<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="#sub-department-one-modal-add">
data-hs-overlay="#sub-department-one-component-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="#sub-department-one-alert-modal">
บันทึกข้อมูล
</a>
</div>
......@@ -181,7 +213,7 @@
</div>
</div>
<div id="sub-department-one-modal-edit" class="hs-overlay hidden ti-modal">
<div id="sub-department-one-component-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">
......@@ -213,21 +245,21 @@
</button>
</div>
<button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay="#sub-department-one-modal-edit">
data-hs-overlay="#sub-department-one-component-modal-edit">
<span class="sr-only">Close</span>
<i class="ti ti-circle-x fs-xxl"></i>
</button>
</div>
</div>
<div class="ti-modal-body " style="margin-top: 40px;">
<label for="input-label" class="ti-form-label mt-2rem">เเก้ไขข้อมูลทะเบียนส่วนย่อย 1</label>
<label for="input-label" class="ti-form-label mt-2rem">อยู่ภายใต้หน่วยงาน</label>
<div class="relative">
<div class="relative rounded-xl overflow-auto">
<div class="sm:grid grid-cols-2 gap-1">
<div class="relative w-full">
<div>
<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-none ltr:rounded-r-md rtl:rounded-l-md focus:z-10" value="01" style="padding-right: 3.5rem;">
<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-none ltr:rounded-r-md rtl:rounded-l-md focus:z-10" style="padding-right: 3.5rem;" [(ngModel)]="bu3.bu3id">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center pointer-events-none z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<i class="ti ti-circle-x text-red-500 cursor-pointer right-10"></i>
<svg class="h-3.5 w-3.5 text-gray-500 dark:text-white/70" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
......@@ -238,28 +270,64 @@
</div>
</div>
<div class="flex flex-col-6" >
<input type="text" id="input-label" class="ti-form-input w-full" style="background-color: #B3B3B3; margin-left:10px;" disabled value="ส่วน 1">
<input type="text" id="input-label" class="ti-form-input w-full" style="background-color: #B3B3B3; margin-left:10px;" [(ngModel)]="bu3.tdesc" readonly>
</div>
</div>
</div>
</div>
<label for="input-label" class="ti-form-label mt-2rem">ส่วนย่อย 1</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 " style="background-color: #B3B3B3;" value="01">
</div>
<label for="input-label" class="ti-form-label mt-2rem">ส่วนย่อย1</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 " style="background-color: #B3B3B3;" [value]="bu4.bu4id">
</div>
<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">
<label for="detail_eng" class="ti-form-label mt-2rem">รายละเอียด (อังกฤษ)</label>
<input type="text" id="detail_eng" class="ti-form-input h-16" placeholder="">
<div class="flex justify-end mt-2rem mb-1rem space-x-4">
</div>
<label for="detail_th" class="ti-form-label mt-2rem">รายละเอียด (ไทย)</label>
<input type="text" id="detail_th" class="ti-form-input h-16" [(ngModel)]="bu4.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)]="bu4.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="#sub-department-one-component-modal-edit">
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#sub-department-one-alert-modal">
บันทึกข้อมูล
</a>
</div>
</div>
</div>
</div>
</div>
<div id="sub-department-one-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="#sub-department-one-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="#sub-department-one-modal-edit">
data-hs-overlay="#sub-department-one-alert-modal">
ย้อนกลับ
</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="#sub-department-one-alert-modal" (click)="addBu4()">
บันทึกข้อมูล
</a>
</div>
......
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { Component, EventEmitter, Input, OnInit } from '@angular/core';
import { Bu3Model, MyBu3Model } from 'src/app/shared/model/bu3.model';
import { Bu4Model, MyBu4Model } from 'src/app/shared/model/bu4.model';
import { Bu3Service } from 'src/app/shared/services/bu3.service';
import { Bu4Service } from 'src/app/shared/services/bu4.service';
@Component({
selector: 'app-sub-department-one',
templateUrl: './sub-department-one.component.html',
styleUrls: ['./sub-department-one.component.scss']
})
export class SubDepartmentOneComponent {
modalOptions: {
[nameModal: string]: { // ชื่อตรวจสอบการเปิดปิด
isModalOpen: boolean; // เปิด/ปิด
modalSize: string; // ขนาดของ Modal (s,m,l,vw10-vw100 )
backdropClose: boolean; // (คลิก Backdrop แล้ว true ปิด false ไม่ปิด )
}
} = {
"add": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
},
"edit": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
}
}
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
export class SubDepartmentOneComponent implements OnInit {
currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1);
bu4List: Bu4Model[] = []
bu4: Bu4Model = new MyBu4Model({})
bu3: Bu3Model = new MyBu3Model({})
search = ""
constructor(private bu4Service: Bu4Service,
private bu3Service: Bu3Service
) { }
ngOnInit(): void {
this.getBu4List()
}
closeModal(name: string) {
this.modalOptions[name].isModalOpen = false;
// ตรวจสอบว่ามี Modal อื่นเปิดอยู่หรือไม่
if (!this.isAnyModalOpen()) {
document.body.style.overflow = ''; // คืนค่าการ Scroll เฉพาะเมื่อ Modal ทั้งหมดปิดแล้ว
}
getBu4List() {
this.bu4Service.getList().subscribe(response => {
this.bu4List = response
this.searchChange()
})
}
isAnyModalOpen(): boolean {
// Logic ตรวจสอบว่า Modal อื่นยังเปิดอยู่หรือไม่
return Object.values(this.modalOptions).some(modal => modal.isModalOpen); // หากไม่มี Modal อื่นเปิด
searchChange() {
this.currentPage = 1
this.page = Array.from({ length: Math.ceil(this.bu4ListFilter().length / 10) }, (_, i) => i + 1);
}
bu4ListFilter() {
return this.bu4List.filter(x => x.bu4id.toLowerCase().includes(this.search) ||
x.tdesc.toLowerCase().includes(this.search) ||
x.edesc.toLowerCase().includes(this.search))
}
selectBu4(bu4: Bu4Model) {
this.bu3Service.getById(bu4.parent).subscribe(response => {
this.bu3 = response
})
this.bu4 = new MyBu4Model(bu4)
}
addBu4() {
// this.bu4Service.post(this.bu4).subscribe((response:any) => {
// if (response.success) {
// this.getBu4List()
// }
// })
}
deleteBu4(bu4: Bu4Model) {
// this.bu4Service.delete(new MyBu4Model(bu4)).subscribe((response:any) => {
// if (response.success) {
// this.getBu4List()
// }
// })
}
}
......
......@@ -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="!bu6ListFilter().length">
<tr>
<td class="text-center" colspan="100%">
ไม่พบข้อมูล
</td>
</tr>
</tbody>
<tbody *ngIf="bu6ListFilter().length">
<tr
*ngFor="let item of bu6ListFilter() | 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="#sub-department-three-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.bu6id}}</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)="selectBu6(item)"
data-hs-overlay="#sub-department-three-modal-edit"></i>
<i class="ti ti-trash cursor-pointer i-gray fs-l px-1" (click)="deleteBu6(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>
......@@ -89,7 +118,7 @@
<div class="max-h-full overflow-hidden ti-modal-content">
<div class="ti-modal-header">
<h3 class="text-xxl font-bold text-primary">
เพิ่มข้อมูลทะเบียนส่วนย่อยที่ 3
เพิ่มข้อมูลทะเบียนส่วนย่อย 3
</h3>
<div class="flex justify-end">
<div class="button-clear">
......@@ -123,39 +152,48 @@
</div>
</div>
<div class="ti-modal-body" style="margin-top: 40px;">
<label for="input-label" class="ti-form-label mt-2rem">อยู่ภายใต้หน่วยงาน</label>
<label for="part" class="ti-form-label mt-2rem">อยู่ภายใต้หน่วยงาน</label>
<div class="relative">
<div class="relative rounded-xl overflow-auto">
<div class="sm:grid grid-cols-2 gap-1">
<div class="relative w-full">
<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-none ltr:rounded-r-md rtl:rounded-l-md focus:z-10" style="padding-right: 3.5rem;">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center pointer-events-none z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<i class="ti ti-circle-x text-red-500 cursor-pointer"></i>
<svg class="h-3.5 w-3.5 text-gray-300 dark:text-white/70" xmlns="http://www.w3.org/2000/svg" width="10" height="10" fill="currentColor" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
</svg>
<div>
<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-none ltr:rounded-r-md rtl:rounded-l-md focus:z-10" style="padding-right: 3.5rem;">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center pointer-events-none z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<i class="ti ti-circle-x text-red-500 cursor-pointer right-10"></i>
<svg class="h-3.5 w-3.5 text-gray-500 dark:text-white/70" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
</svg>
</div>
</div>
</div>
</div>
<div class="flex flex-col-6" >
<input type="text" id="input-label" class="ti-form-input w-full" style="background-color: #B3B3B3; margin-left:10px;" disabled>
<div class="flex flex-col-6">
<input type="text" id="part2" class="ti-form-input w-full" placeholder="" style="background-color: #B3B3B3; margin-left: 10px;" disabled>
</div>
</div>
</div>
</div>
<label for="input-label" class="ti-form-label mt-2rem">ส่วนย่อย3</label>
<div class="sm:grid grid-cols-2 gap-1">
<div class="relative w-full">
<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-none ltr:rounded-r-md rtl:rounded-l-md focus:z-10" style="padding-right: 3.5rem;">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center pointer-events-none z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<i class="ti ti-circle-x text-red-500 cursor-pointer"></i>
<svg class="h-3.5 w-3.5 text-gray-300 dark:text-white/70" xmlns="http://www.w3.org/2000/svg" width="10" height="10" fill="currentColor" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
<label for="part" class="ti-form-label mt-2rem">ส่วนย่อย3</label>
<div class="relative w-1/2">
<div>
<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-none ltr:rounded-r-md rtl:rounded-l-md focus:z-10" style="padding-right: 3.5rem;">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center pointer-events-none z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<i class="ti ti-circle-x text-red-500 cursor-pointer right-10"></i>
<svg class="h-3.5 w-3.5 text-gray-500 dark:text-white/70" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
</svg>
</div>
</div>
</div>
</div>
</div>
<label for="detail_th" class="ti-form-label mt-2rem">รายละเอียด (ไทย)</label>
<input type="text" id="detail_th" class="ti-form-input h-16" placeholder="">
<label for="detail_eng" class="ti-form-label mt-2rem">รายละเอียด (อังกฤษ)</label>
<input type="text" id="detail_eng" class="ti-form-input h-16" placeholder="">
<div class="flex justify-end mt-2rem mb-1rem space-x-4">
......@@ -164,7 +202,8 @@
data-hs-overlay="#sub-department-three-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="#sub-department-three-alert-modal">
บันทึกข้อมูล
</a>
</div>
......@@ -189,7 +228,7 @@
<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>W
<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>
......@@ -211,43 +250,84 @@
</button>
</div>
</div>
<div class="ti-modal-body " style="margin-top: 40px;">
<label for="input-label" class="ti-form-label mt-2rem">เเก้ไขข้อมูลทะเบียนส่วนย่อย 3</label>
<div class="relative">
<div class="relative rounded-xl overflow-auto">
<div class="sm:grid grid-cols-2 gap-1">
<div class="relative w-full">
<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-none ltr:rounded-r-md rtl:rounded-l-md focus:z-10" style="padding-right: 3.5rem;" value="01">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center pointer-events-none z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<i class="ti ti-circle-x text-red-500 cursor-pointer"></i>
<svg class="h-3.5 w-3.5 text-gray-300 dark:text-white/70" xmlns="http://www.w3.org/2000/svg" width="10" height="10" fill="currentColor" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
<div class="ti-modal-body" style="margin-top: 40px;">
<label for="part" class="ti-form-label mt-2rem">อยู่ภายใต้หน่วยงาน</label>
<div class="relative">
<div class="relative rounded-xl overflow-auto">
<div class="sm:grid grid-cols-2 gap-1">
<div class="relative w-full">
<div>
<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-none ltr:rounded-r-md rtl:rounded-l-md focus:z-10" style="padding-right: 3.5rem;" [(ngModel)]="bu5.bu5id">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center pointer-events-none z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<i class="ti ti-circle-x text-red-500 cursor-pointer right-10"></i>
<svg class="h-3.5 w-3.5 text-gray-500 dark:text-white/70" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
</svg>
</div>
</div>
</div>
<div class="flex flex-col-6" >
<input type="text" id="input-label" class="ti-form-input w-full" style="background-color: #B3B3B3; margin-left:10px;" disabled value="ส่วนย่อย 2">
</div>
</div>
</div>
</div>
<label for="input-label" class="ti-form-label mt-2rem">ส่วนย่อย 3</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 " style="background-color: #B3B3B3;" value="01">
<div class="flex flex-col-6">
<input type="text" id="part2" class="ti-form-input w-full" placeholder="" style="background-color: #B3B3B3; margin-left: 10px;" [(ngModel)]="bu5.tdesc" readonly>
</div>
</div>
</div>
<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="ส่วนย่อย 3">
<label for="detail_eng" class="ti-form-label mt-2rem">รายละเอียด (อังกฤษ)</label>
<input type="text" id="detail_eng" class="ti-form-input h-16" placeholder="">
</div>
<label for="part" class="ti-form-label mt-2rem">ส่วนย่อย3</label>
<input type="text" id="part" class="ti-form-input w-1/2 pr-10" style="background-color: #B3B3B3;" [(ngModel)]="bu6.bu6id" readonly>
<label for="detail_th" class="ti-form-label mt-2rem">รายละเอียด (ไทย)</label>
<input type="text" id="detail_th" class="ti-form-input h-16" [(ngModel)]="bu6.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)]="bu6.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="#sub-department-three-modal-edit">
data-hs-overlay="#sub-department-three-modal-add">
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#sub-department-three-alert-modal">
บันทึกข้อมูล
</a>
</div>
</div>
</div>
</div>
</div>
<div id="sub-department-three-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="#sub-department-three-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="#sub-department-three-alert-modal">
ย้อนกลับ
</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="#sub-department-three-alert-modal" (click)="addBu6()">
บันทึกข้อมูล
</a>
</div>
......
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { Component, EventEmitter, Input, OnInit } from '@angular/core';
import { Bu5Model, MyBu5Model } from 'src/app/shared/model/bu5.model';
import { Bu6Model, MyBu6Model } from 'src/app/shared/model/bu6.model';
import { Bu5Service } from 'src/app/shared/services/bu5.service';
import { Bu6Service } from 'src/app/shared/services/bu6.service';
@Component({
selector: 'app-sub-department-three',
templateUrl: './sub-department-three.component.html',
styleUrls: ['./sub-department-three.component.scss']
})
export class SubDepartmentThreeComponent {
modalOptions: {
[nameModal: string]: { // ชื่อตรวจสอบการเปิดปิด
isModalOpen: boolean; // เปิด/ปิด
modalSize: string; // ขนาดของ Modal (s,m,l,vw10-vw100 )
backdropClose: boolean; // (คลิก Backdrop แล้ว true ปิด false ไม่ปิด )
}
} = {
"add": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
},
"edit": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
}
}
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
export class SubDepartmentThreeComponent implements OnInit {
currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1);
bu6List: Bu6Model[] = []
bu6: Bu6Model = new MyBu6Model({})
bu5: Bu5Model = new MyBu5Model({})
search = ""
constructor(private bu6Service: Bu6Service,
private bu5Service: Bu5Service
) { }
ngOnInit(): void {
this.getBu6List()
}
closeModal(name: string) {
this.modalOptions[name].isModalOpen = false;
// ตรวจสอบว่ามี Modal อื่นเปิดอยู่หรือไม่
if (!this.isAnyModalOpen()) {
document.body.style.overflow = ''; // คืนค่าการ Scroll เฉพาะเมื่อ Modal ทั้งหมดปิดแล้ว
}
getBu6List() {
this.bu6Service.getList().subscribe(response => {
this.bu6List = response
this.searchChange()
})
}
isAnyModalOpen(): boolean {
// Logic ตรวจสอบว่า Modal อื่นยังเปิดอยู่หรือไม่
return Object.values(this.modalOptions).some(modal => modal.isModalOpen); // หากไม่มี Modal อื่นเปิด
searchChange() {
this.currentPage = 1
this.page = Array.from({ length: Math.ceil(this.bu6ListFilter().length / 10) }, (_, i) => i + 1);
}
bu6ListFilter() {
return this.bu6List.filter(x => x.bu6id.toLowerCase().includes(this.search) ||
x.tdesc.toLowerCase().includes(this.search) ||
x.edesc.toLowerCase().includes(this.search))
}
selectBu6(bu6: Bu6Model) {
this.bu5Service.getById(bu6.parent).subscribe(response =>{
this.bu5 = new MyBu5Model(response)
})
this.bu6 = new MyBu6Model(bu6)
}
addBu6() {
// this.bu6Service.post(this.bu6).subscribe((response:any) => {
// if (response.success) {
// this.getBu6List()
// }
// })
}
deleteBu6(bu6: Bu6Model) {
// this.bu6Service.delete(new MyBu1Model(bu6)).subscribe((response:any) => {
// if (response.success) {
// this.getBu6List()
// }
// })
}
}
......@@ -2,7 +2,9 @@
<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>
......@@ -11,7 +13,7 @@
</div>
<div class="px-1">
<button type="button" class="ti-btn ti-btn-soft-secondary h-45px m-0 shadow-md"
data-hs-overlay="#sub-department-two-modal-add">
data-hs-overlay="#sub-department-two-component-modal-add">
<i class="ri-add-line"></i>
Add
</button>
......@@ -60,38 +62,67 @@
</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="!bu5ListFilter().length">
<tr>
<td class="text-center" colspan="100%">
ไม่พบข้อมูล
</td>
</tr>
</tbody>
<tbody *ngIf="bu5ListFilter().length">
<tr
*ngFor="let item of bu5ListFilter() | slice:((currentPage-1) * 10) : (((currentPage-1) * 10) + 10);let i = index">
<td class="flex justify-center">
{{((currentPage-1) * 10)+(i+1)}}
</td>
<td>{{item.bu5id}}</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" data-hs-overlay="#sub-department-two-modal-edit"></i>
<i class="ti ti-trash cursor-pointer i-gray fs-l px-1"></i>
<i class="ti ti-edit cursor-pointer i-gray fs-l px-1" (click)="selectBu5(item)"
data-hs-overlay="#sub-department-two-modal-edit"></i>
<i class="ti ti-trash cursor-pointer i-gray fs-l px-1" (click)="deleteBu5(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>
<div id="sub-department-two-modal-add" class="hs-overlay hidden ti-modal">
<div id="sub-department-two-component-modal-add" 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">
เพิ่มข้อมูลทะเบียนส่วนย่อย 2
</h3>
<div class="flex justify-end">
<div class="flex justify-end" >
<div class="button-clear">
<button type="button" class="ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md">
<svg class="svg-indigo" width="16" height="16" viewBox="0 0 64.00 64.00"
......@@ -116,56 +147,64 @@
</button>
</div>
<button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay="#sub-department-two-modal-add">
data-hs-overlay="#sub-department-two-component-modal-add">
<span class="sr-only">Close</span>
<i class="ti ti-circle-x fs-xxl"></i>
</button>
</div>
</div>
<div class="ti-modal-body" style="margin-top: 40px;">
<label for="part" class="ti-form-label mt-2rem">อยู่ภายใต้หน่วยงาน</label>
<div class="relative">
<div class="relative rounded-xl overflow-auto">
<div class="sm:grid grid-cols-2 gap-1">
<div class="relative w-full">
<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-none ltr:rounded-r-md rtl:rounded-l-md focus:z-10" style="padding-right: 3.5rem;">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center pointer-events-none z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<i class="ti ti-circle-x text-red-500 cursor-pointer"></i>
<svg class="h-3.5 w-3.5 text-gray-300 dark:text-white/70" xmlns="http://www.w3.org/2000/svg" width="10" height="10" fill="currentColor" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
</svg>
<div class="ti-modal-body " style="margin-top: 40px;">
<label for="input-label" class="ti-form-label mt-2rem">อยู่ภายใต้หน่วยงาน</label>
<div class="relative">
<div class="relative rounded-xl overflow-auto">
<div class="sm:grid grid-cols-2 gap-1">
<div class="relative w-full">
<div>
<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-none ltr:rounded-r-md rtl:rounded-l-md focus:z-10" style="padding-right: 3.5rem;">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center pointer-events-none z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<i class="ti ti-circle-x text-red-500 cursor-pointer right-10"></i>
<svg class="h-3.5 w-3.5 text-gray-500 dark:text-white/70" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
</svg>
</div>
</div>
</div>
</div>
<div class="flex flex-col-6" >
<input type="text" id="input-label" class="ti-form-input w-full" style="background-color: #B3B3B3; margin-left:10px;" disabled>
</div>
</div>
<div class="flex flex-col-6">
<input type="text" id="part2" class="ti-form-input w-full" placeholder="" style="background-color: #B3B3B3; margin-left: 10px;" disabled>
</div>
</div>
<label for="input-label" class="ti-form-label mt-2rem">ส่วนย่อย2</label>
<div class="sm:grid grid-cols-2 gap-1">
<div class="relative w-full">
<div>
<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-none ltr:rounded-r-md rtl:rounded-l-md focus:z-10" style="padding-right: 3.5rem;">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center pointer-events-none z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<i class="ti ti-circle-x text-red-500 cursor-pointer right-10"></i>
<svg class="h-3.5 w-3.5 text-gray-500 dark:text-white/70" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
</svg>
</div>
</div>
</div>
</div>
</div>
<label for="part" class="ti-form-label mt-2rem">ส่วนย่อย2</label>
<div class="relative w-1/2">
<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-none ltr:rounded-r-md rtl:rounded-l-md focus:z-10" style="padding-right: 3.5rem;">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center pointer-events-none z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<i class="ti ti-circle-x text-red-500 cursor-pointer"></i>
<svg class="h-3.5 w-3.5 text-gray-300 dark:text-white/70" xmlns="http://www.w3.org/2000/svg" width="10" height="10" fill="currentColor" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
</svg>
</div>
</div>
<label for="detail_th" class="ti-form-label mt-2rem">รายละเอียด (ไทย)</label>
<input type="text" id="detail_th" class="ti-form-input h-16" placeholder="">
<input type="text" id="detail_th" class="ti-form-input h-16">
<label for="detail_eng" class="ti-form-label mt-2rem">รายละเอียด (อังกฤษ)</label>
<input type="text" id="detail_eng" class="ti-form-input h-16" placeholder="">
<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="#sub-department-two-modal-add">
data-hs-overlay="#sub-department-two-component-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="#sub-department-two-alert-modal">
บันทึกข้อมูล
</a>
</div>
......@@ -212,42 +251,83 @@
</button>
</div>
</div>
<div class="ti-modal-body" style="margin-top: 40px;">
<label for="part" class="ti-form-label mt-2rem">อยู่ภายใต้หน่วยงาน</label>
<div class="relative">
<div class="relative rounded-xl overflow-auto">
<div class="sm:grid grid-cols-2 gap-1">
<div class="relative w-full">
<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-none ltr:rounded-r-md rtl:rounded-l-md focus:z-10" style="padding-right: 3.5rem;" value="01">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center pointer-events-none z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<i class="ti ti-circle-x text-red-500 cursor-pointer"></i>
<svg class="h-3.5 w-3.5 text-gray-300 dark:text-white/70" xmlns="http://www.w3.org/2000/svg" width="10" height="10" fill="currentColor" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
</svg>
<div class="ti-modal-body " style="margin-top: 40px;">
<label for="input-label" class="ti-form-label mt-2rem">อยู่ภายใต้หน่วยงาน</label>
<div class="relative">
<div class="relative rounded-xl overflow-auto">
<div class="sm:grid grid-cols-2 gap-1">
<div class="relative w-full">
<div>
<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-none ltr:rounded-r-md rtl:rounded-l-md focus:z-10" style="padding-right: 3.5rem;" [(ngModel)]="bu4.bu4id">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center pointer-events-none z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<i class="ti ti-circle-x text-red-500 cursor-pointer right-10"></i>
<svg class="h-3.5 w-3.5 text-gray-500 dark:text-white/70" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
</svg>
</div>
</div>
</div>
</div>
<div class="flex flex-col-6" >
<input type="text" id="input-label" class="ti-form-input w-full" style="background-color: #B3B3B3; margin-left:10px;" [(ngModel)]="bu4.tdesc" readonly>
</div>
</div>
<div class="flex flex-col-6">
<input type="text" id="part2" class="ti-form-input w-full" placeholder="" style="background-color: #B3B3B3; margin-left: 10px;" disabled value="ส่วนย่อย 1">
</div>
</div>
</div>
<label for="input-label" class="ti-form-label mt-2rem">ส่วนย่อย2</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 " style="background-color: #B3B3B3;" [value]="bu5.bu5id">
</div>
</div>
<label for="part" class="ti-form-label mt-2rem">ส่วนย่อย2</label>
<input type="text" id="part" class="ti-form-input w-1/2 pr-10" placeholder="" style="background-color: #B3B3B3;" disabled value="01">
<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="ส่วนย่อย 2">
<input type="text" id="detail_th" class="ti-form-input h-16" [(ngModel)]="bu5.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="">
<div class="flex justify-end mt-2rem mb-1rem space-x-4">
<input type="text" id="detail_eng" class="ti-form-input h-16" [(ngModel)]="bu5.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="#sub-department-two-modal-edit">
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#sub-department-two-alert-modal">
บันทึกข้อมูล
</a>
</div>
</div>
</div>
</div>
</div>
<div id="sub-department-two-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="#sub-department-two-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="#sub-department-two-modal-add">
data-hs-overlay="#sub-department-two-alert-modal">
ย้อนกลับ
</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="#sub-department-two-alert-modal" (click)="addBu5()">
บันทึกข้อมูล
</a>
</div>
......
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { Component, EventEmitter, Input, OnInit } from '@angular/core';
import { Bu4Model, MyBu4Model } from 'src/app/shared/model/bu4.model';
import { Bu5Model, MyBu5Model } from 'src/app/shared/model/bu5.model';
import { Bu4Service } from 'src/app/shared/services/bu4.service';
import { Bu5Service } from 'src/app/shared/services/bu5.service';
@Component({
selector: 'app-sub-department-two',
templateUrl: './sub-department-two.component.html',
styleUrls: ['./sub-department-two.component.scss']
})
export class SubDepartmentTwoComponent {
modalOptions: {
[nameModal: string]: { // ชื่อตรวจสอบการเปิดปิด
isModalOpen: boolean; // เปิด/ปิด
modalSize: string; // ขนาดของ Modal (s,m,l,vw10-vw100 )
backdropClose: boolean; // (คลิก Backdrop แล้ว true ปิด false ไม่ปิด )
}
} = {
"add": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
},
"edit": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
}
}
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
export class SubDepartmentTwoComponent implements OnInit {
currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1);
bu5List: Bu5Model[] = []
bu5: Bu5Model = new MyBu5Model({})
bu4: Bu4Model = new MyBu4Model({})
search = ""
constructor(private bu5Service: Bu5Service,
private bu4Service: Bu4Service
) { }
ngOnInit(): void {
this.getBu5List()
}
closeModal(name: string) {
this.modalOptions[name].isModalOpen = false;
// ตรวจสอบว่ามี Modal อื่นเปิดอยู่หรือไม่
if (!this.isAnyModalOpen()) {
document.body.style.overflow = ''; // คืนค่าการ Scroll เฉพาะเมื่อ Modal ทั้งหมดปิดแล้ว
}
getBu5List() {
this.bu5Service.getList().subscribe(response => {
this.bu5List = response
this.searchChange()
})
}
isAnyModalOpen(): boolean {
// Logic ตรวจสอบว่า Modal อื่นยังเปิดอยู่หรือไม่
return Object.values(this.modalOptions).some(modal => modal.isModalOpen); // หากไม่มี Modal อื่นเปิด
searchChange() {
this.currentPage = 1
this.page = Array.from({ length: Math.ceil(this.bu5ListFilter().length / 10) }, (_, i) => i + 1);
}
bu5ListFilter() {
return this.bu5List.filter(x => x.bu5id.toLowerCase().includes(this.search) ||
x.tdesc.toLowerCase().includes(this.search) ||
x.edesc.toLowerCase().includes(this.search))
}
selectBu5(bu5: Bu5Model) {
this.bu4Service.getById(bu5.parent).subscribe(response => {
this.bu4 = response
})
this.bu5 = new MyBu5Model(bu5)
}
addBu5() {
// this.bu5Service.post(this.bu5).subscribe((response:any) => {
// if (response.success) {
// this.getBu5List()
// }
// })
}
deleteBu5(bu5: Bu5Model) {
// this.bu5Service.delete(new MyBu5Model(bu5)).subscribe((response:any) => {
// if (response.success) {
// this.getBu5List()
// }
// })
}
}
......@@ -44,7 +44,7 @@ import { FormsModule } from '@angular/forms';
import { Bu2Service } from 'src/app/shared/services/bu2.service';
import { Bu3Service } from 'src/app/shared/services/bu3.service';
import { Bu4Service } from 'src/app/shared/services/bu4.service';
import { Bu5Service } from 'src/app/shared/services/bu5service';
import { Bu5Service } from 'src/app/shared/services/bu5.service';
import { Bu6Service } from 'src/app/shared/services/bu6.service';
import { Bu7Service } from 'src/app/shared/services/bu7.service';
......
......@@ -11,10 +11,10 @@ export class Bu1Service {
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getBu1(): Observable<Bu1Model[]> {
getList(): Observable<Bu1Model[]> {
return this.http.get<Bu1Model[]>(this.urlApi + "/lists")
}
getBu1ById(bu1id:string): Observable<Bu1Model> {
getById(bu1id:string): Observable<Bu1Model> {
return this.http.get<Bu1Model>(this.urlApi + "/"+bu1id)
}
// post(body: Bu1Model) {
......
......@@ -11,10 +11,10 @@ export class Bu2Service {
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getBu2(): Observable<Bu2Model[]> {
getList(): Observable<Bu2Model[]> {
return this.http.get<Bu2Model[]>(this.urlApi + "/lists")
}
getBu2ById(bu2id: string): Observable<Bu2Model> {
getById(bu2id: string): Observable<Bu2Model> {
return this.http.get<Bu2Model>(this.urlApi + "/" + bu2id)
}
// post(body: Bu1Model) {
......
......@@ -11,10 +11,10 @@ export class Bu4Service {
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getBu4(): Observable<Bu4Model[]> {
getList(): Observable<Bu4Model[]> {
return this.http.get<Bu4Model[]>(this.urlApi + "/lists")
}
getBu4ById(bu4id: string): Observable<Bu4Model> {
getById(bu4id: string): Observable<Bu4Model> {
return this.http.get<Bu4Model>(this.urlApi + "/" + bu4id)
}
// post(body: Bu1Model) {
......
......@@ -11,10 +11,10 @@ export class Bu5Service {
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getBu5(): Observable<Bu5Model[]> {
getList(): Observable<Bu5Model[]> {
return this.http.get<Bu5Model[]>(this.urlApi + "/lists")
}
getBu5ById(bu5id: string): Observable<Bu5Model> {
getById(bu5id: string): Observable<Bu5Model> {
return this.http.get<Bu5Model>(this.urlApi + "/" + bu5id)
}
// post(body: Bu1Model) {
......
......@@ -11,10 +11,10 @@ export class Bu6Service {
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getBu6(): Observable<Bu6Model[]> {
getList(): Observable<Bu6Model[]> {
return this.http.get<Bu6Model[]>(this.urlApi + "/lists")
}
getBu6ById(bu6id: string): Observable<Bu6Model> {
getById(bu6id: string): Observable<Bu6Model> {
return this.http.get<Bu6Model>(this.urlApi + "/" + bu6id)
}
// post(body: Bu1Model) {
......
......@@ -11,10 +11,10 @@ export class Bu7Service {
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getBu7(): Observable<Bu7Model[]> {
getList(): Observable<Bu7Model[]> {
return this.http.get<Bu7Model[]>(this.urlApi + "/lists")
}
getBu7ById(bu7id: string): Observable<Bu7Model> {
getById(bu7id: string): Observable<Bu7Model> {
return this.http.get<Bu7Model>(this.urlApi + "/" + bu7id)
}
// post(body: Bu1Model) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment