Commit 67e6377e by Nattana Chaiyamat

ทะเบียนบริษัท

parent 9d7c4558
......@@ -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[
['80812', 'ลูกค้าสัมพันธ์', 'Customer Relations'],
['30305', 'การตลาด', 'Marketing'],
['310101', 'งานบัญชี', 'Accounting'],
['70711', 'โลจิสติกส์', 'Logistics'],
['40408', 'เทคโนโลยีสารสนเทศ', 'IT']];let i = index">
<td class="flex justify-center">{{0+""+(i+1)}}</td>
<td>{{item[0]}}</td>
<td>{{item[1]}}</td>
<td>{{item[2]}}</td>
<tbody *ngIf="!bu1ListFilter().length">
<tr>
<td class="text-center" colspan="100%">
ไม่พบข้อมูล
</td>
</tr>
</tbody>
<tbody *ngIf="bu1ListFilter().length">
<tr
*ngFor="let item of bu1ListFilter() | 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="#department-register-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.bu1id}}</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)="selectBu1(item)"
data-hs-overlay="#department-register-modal-edit"></i>
<i class="ti ti-trash cursor-pointer i-gray fs-l px-1" (click)="deleteBu1(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>
......@@ -124,18 +153,19 @@
</div>
<div class="ti-modal-body ">
<label for="input-label" class="ti-form-label mt-2rem">ฝ่าย</label>
<input type="text" id="input-label" class="ti-form-input w-1/2" placeholder="">
<input type="text" id="input-label" class="ti-form-input w-1/2" [(ngModel)]="bu1.bu1id">
<label for="detail_th" class="ti-form-label mt-2rem">รายละเอียดฝ่าย (ไทย)</label>
<input type="text" id="detail_th" class="ti-form-input" placeholder="">
<input type="text" id="detail_th" class="ti-form-input" [(ngModel)]="bu1.tdesc">
<label for="detail_eng" class="ti-form-label mt-2rem">รายละเอียดฝ่าย (อังกฤษ)</label>
<input type="text" id="detail_eng" class="ti-form-input" placeholder="">
<input type="text" id="detail_eng" class="ti-form-input" [(ngModel)]="bu1.edesc">
<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="#department-register-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="#department-register-alert-modal">
บันทึกข้อมูล
</a>
</div>
......@@ -184,18 +214,56 @@
</div>
<div class="ti-modal-body ">
<label for="input-label" class="ti-form-label mt-2rem">ฝ่าย</label>
<input type="text" id="input-label" class="ti-form-input w-1/2 bg-input-readonly" placeholder="" readonly>
<input type="text" id="input-label" class="ti-form-input w-1/2 bg-input-readonly"
[(ngModel)]="bu1.bu1id" readonly>
<label for="detail_th" class="ti-form-label mt-2rem">รายละเอียดฝ่าย (ไทย)</label>
<input type="text" id="detail_th" class="ti-form-input" placeholder="">
<input type="text" id="detail_th" class="ti-form-input" [(ngModel)]="bu1.tdesc">
<label for="detail_eng" class="ti-form-label mt-2rem">รายละเอียดฝ่าย (อังกฤษ)</label>
<input type="text" id="detail_eng" class="ti-form-input" placeholder="">
<input type="text" id="detail_eng" class="ti-form-input" [(ngModel)]="bu1.edesc">
<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="#department-register-modal-edit">
ย้อนกลับ
</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="#department-register-alert-modal">
บันทึกข้อมูล
</a>
</div>
</div>
</div>
</div>
</div>
<div id="department-register-alert-modal" class="hs-overlay hidden ti-modal">
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)] flex items-center">
<div class="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="#department-register-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="#department-register-alert-modal">
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#department-register-alert-modal" (click)="addBu1()">
บันทึกข้อมูล
</a>
</div>
......
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { Component, EventEmitter, Input, OnInit, } from '@angular/core';
import { Bu1Model, MyBu1Model } from 'src/app/shared/model/bu1.model';
import { Bu1Service } from 'src/app/shared/services/bu1.service';
@Component({
selector: 'app-department-register',
templateUrl: './department-register.component.html',
styleUrls: ['./department-register.component.scss']
})
export class DepartmentRegisterComponent {
modalOptions: {
[nameModal: string]: { // ชื่อตรวจสอบการเปิดปิด
isModalOpen: boolean; // เปิด/ปิด
modalSize: string; // ขนาดของ Modal (s,m,l,vw10-vw100 )
backdropClose: boolean; // (คลิก Backdrop แล้ว true ปิด false ไม่ปิด )
export class DepartmentRegisterComponent implements OnInit {
currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1);
bu1List: Bu1Model[] = []
bu1: Bu1Model = new MyBu1Model({})
search = ""
constructor(private bu1Service: Bu1Service) { }
ngOnInit(): void {
this.getBu1List()
}
} = {
"add": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
},
"edit": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
getBu1List() {
this.bu1Service.getList().subscribe(response => {
this.bu1List = response
this.searchChange()
})
}
searchChange() {
this.currentPage = 1
this.page = Array.from({ length: Math.ceil(this.bu1ListFilter().length / 10) }, (_, i) => i + 1);
}
openModal(name: string, size: string, closeOnBackdrop?: boolean) {
this.modalOptions[name].modalSize = size;
this.modalOptions[name].backdropClose = closeOnBackdrop || false;
this.modalOptions[name].isModalOpen = true;
document.body.style.overflow = 'hidden'; // ล็อก Scroll
bu1ListFilter() {
return this.bu1List.filter(x => x.bu1id.toLowerCase().includes(this.search) ||
x.tdesc.toLowerCase().includes(this.search) ||
x.edesc.toLowerCase().includes(this.search))
}
closeModal(name: string) {
this.modalOptions[name].isModalOpen = false;
// ตรวจสอบว่ามี Modal อื่นเปิดอยู่หรือไม่
if (!this.isAnyModalOpen()) {
document.body.style.overflow = ''; // คืนค่าการ Scroll เฉพาะเมื่อ Modal ทั้งหมดปิดแล้ว
selectBu1(bu1: Bu1Model) {
this.bu1 = new MyBu1Model(bu1)
}
addBu1() {
// this.bu1Service.post(this.bu1).subscribe((response:any) => {
// if (response.success) {
// this.getBu1List()
// }
// })
}
isAnyModalOpen(): boolean {
// Logic ตรวจสอบว่า Modal อื่นยังเปิดอยู่หรือไม่
return Object.values(this.modalOptions).some(modal => modal.isModalOpen); // หากไม่มี Modal อื่นเปิด
deleteBu1(bu1: Bu1Model) {
// this.bu1Service.delete(new MyBu1Model(bu1)).subscribe((response:any) => {
// if (response.success) {
// this.getBu1List()
// }
// })
}
}
......@@ -24,8 +24,8 @@ import { CompanyRegistrationComponent } from '../company-registration/company-re
import { DepartmentRegisterComponent } from '../company-registration/branch-business-unit/department-register/department-register.component';
import { BranchBusinessUnitComponent } from '../company-registration/branch-business-unit/branch-business-unit.component';
import { DepartmentListComponent } from '../company-registration/branch-business-unit/department-list/department-list.component';
import { SubDepartmentOneComponent} from '../company-registration/branch-business-unit/sub-department-one/sub-department-one.component';
import { SubDepartmentThreeComponent} from '../company-registration/branch-business-unit/sub-department-three/sub-department-three.component';
import { SubDepartmentOneComponent } from '../company-registration/branch-business-unit/sub-department-one/sub-department-one.component';
import { SubDepartmentThreeComponent } from '../company-registration/branch-business-unit/sub-department-three/sub-department-three.component';
import { SubDepartmentTwoComponent } from '../company-registration/branch-business-unit/sub-department-two/sub-department-two.component';
import { SubDepartmentFourComponent } from '../company-registration/branch-business-unit/sub-department-four/sub-department-four.component';
import { SectionRegistrationComponent } from '../company-registration/branch-business-unit/section-registration/section-registration.component';
......@@ -37,6 +37,10 @@ import { AccountSettingsComponent } from '../account-settings/account-settings.c
import { UserSettingsComponent } from '../account-settings/user-settings/user-settings.component';
import { EmployeeLevel } from '../job-description/employee-level/employee-level.component';
import { SetAPasswordComponent } from '../account-settings/set-a-password/set-a-password.component';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { Bu1Service } from 'src/app/shared/services/bu1.service';
import { HttpRequestInterceptor } from 'src/app/shared/services/http-request.interceptor';
import { FormsModule } from '@angular/forms';
@NgModule({
declarations: [
......@@ -81,6 +85,13 @@ import { SetAPasswordComponent } from '../account-settings/set-a-password/set-a-
SharedModule,
NgxChartsModule,
NgSelectModule,
HttpClientModule,
FormsModule
],
providers: [Bu1Service, {
provide: HTTP_INTERCEPTORS,
useClass: HttpRequestInterceptor,
multi: true,
},]
})
export class DashboardModule { }
export interface Bu1Model {
bu1id: string;
tdesc: string;
edesc: string;
}
export class MyBu1Model implements Bu1Model {
bu1id: string;
tdesc: string;
edesc: string;
constructor(data: Partial<Bu1Model>) {
this.bu1id = data.bu1id || ""
this.tdesc = data.tdesc || ""
this.edesc = data.edesc || ""
}
}
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { Bu1Model } from '../model/bu1.model';
@Injectable({
providedIn: 'root'
})
export class Bu1Service {
api = "/bu1"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getList(): Observable<Bu1Model[]> {
return this.http.get<Bu1Model[]>(this.urlApi + "/lists")
}
// post(body: Bu1Model) {
// return this.http.post(this.urlApi, body)
// }
// delete(body: Bu1Model) {
// const options = {
// headers: new HttpHeaders({
// "Content-Type": "application/json",
// }),
// body: body
// };
// return this.http.delete(this.urlApi, options)
// }
}
import { Injectable } from '@angular/core';
import {
HttpRequest,
HttpHandler,
HttpEvent,
HttpInterceptor,
HttpErrorResponse
} from '@angular/common/http';
import { Observable, of, throwError } from 'rxjs';
import { catchError, tap } from 'rxjs/operators';
@Injectable()
export class HttpRequestInterceptor {
responseCache = new Map()
constructor() { }
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
if (req.url.startsWith("./")) {
return next.handle(req);
} else {
const authHeader = 'Bearer ' + "eyJhbGciOiJIUzI1NiJ9.eyJzY2hlbWEiOiJkYm8iLCJlbmNvZGUiOiIyIiwic3ViIjoiQXV0aCIsImNvbXBhbnlOYW1lIjoi4Lia4Lij4Li04Lip4Lix4LiXIOC4oeC4suC4ouC5gOC4reC4iuC4reC4suC4o-C5jCDguIjguLPguIHguLHguJQiLCJkYk5hbWUiOiJNWUhSUExVUyIsInJvbGVzIjpbIlVTRVIiXSwid29ya2FyZWEiOiJUS1ciLCJpc3MiOiJDb21wdXRlciBTY2llbmNlIENvcnBvcmF0aW9uIExpbWl0ZWQiLCJ6bWxvZ2luIjoiZmFsc2UiLCJyb2xlX2xldmVsIjoiNiIsImVtcGxveWVlaWQiOiIxMDAwMDA4MiIsImJyYW5jaCI6Im15aHIzIiwiZW1wX3Bvc2l0aW9uIjoiMDk3IiwidXNlcl9yb2xlIjoiQWxsIiwidWlkIjoiMTAwMDAwODIiLCJjb21wYW55aWQiOiIxMDAiLCJhY3RvcmlkIjoiMTAwMDAwODIiLCJsYW5nIjoidGgiLCJhZCI6ImZhbHNlIiwiZmlyc3Rsb2dpbiI6ImZhbHNlIiwidXJsX215aHIiOiJodHRwOi8vaHJwbHVzLXN0ZC5teWhyLmNvLnRoL2hyIiwiYXBwX25hbWUiOiJteWhyIiwicmVnaW9uYWxsdHkiOiJFTkciLCJ0b2tlbl96ZWVtZSI6IiIsInVzZXJfbGV2ZWwiOiJNWUhSIiwiZnVsbG5hbWUiOiLguJnguLLguKLguK3guJ7guLTguKPguLHguJXguJnguYwgIOC4l-C4lOC4quC4reC4miIsImNvbWlkIjoiIiwiam9iIjoiMDk3LTI0NjkiLCJ1c2VyIjoibXlociIsInptX3VzZXIiOiIiLCJ1c2VybmFtZSI6Im15aHIiLCJtZW1iZXJpZCI6IiJ9.5VUk7ZilGchdTTm-5YC0xIL53cEYX6AkfEW4d8Xd-1g";
const overideReq = {
headers: req.headers.set('Authorization', authHeader),
url: req.url,
};
const authReq = req.clone(overideReq);
return next.handle(authReq).pipe(tap(response => {
this.responseCache.set(req.urlWithParams, response)
}));
}
}
}
......@@ -3352,7 +3352,8 @@ select option:active,
}
}
.ti-pagination li .page-link.active{
background-color: rgb(var(--color-primary));
/* background-color: rgb(var(--color-primary)); */
background-color: rgb(var(--color-secondary));
--tw-text-opacity: 1;
color: rgb(255 255 255 / var(--tw-text-opacity));
}
......
......@@ -12,6 +12,7 @@ export const environment = {
appId: '********************************',
measurementId: '********************************',
},
baseUrl: 'https://hrplus-std.myhr.co.th/plus',
};
/*
......
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