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;
}
}
@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)
}
......
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()
// }
// })
}
}
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()
// }
// })
}
}
......
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()
// }
// })
}
}
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