Commit 5172e66d by Nattana Chaiyamat

ทะเบียนเครื่องมือ

parent f61fc5dd
......@@ -178,7 +178,7 @@ export class UserSettingsComponent {
const formData = new FormData();
formData.append('file', this.selectedFile);
this.user.loading = true
this.fileService.upload(formData, 'muser').subscribe({
this.fileService.uploadExcel(formData, 'muser').subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
......@@ -195,7 +195,7 @@ export class UserSettingsComponent {
}
downloadFile() {
const fileName = 'IMPORT_USER.xlsx'
this.fileService.download(fileName).subscribe({
this.fileService.downloadTemplate(fileName).subscribe({
next: response => {
const url = window.URL.createObjectURL(response);
const a = document.createElement("a");
......
......@@ -65,7 +65,7 @@ export class DepartmentListComponent implements OnInit {
const formData = new FormData();
formData.append('file', this.selectedFile);
this.bu2ListLoading = true
this.fileService.upload(formData, 'mbu2').subscribe({
this.fileService.uploadExcel(formData, 'mbu2').subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
......@@ -83,7 +83,7 @@ export class DepartmentListComponent implements OnInit {
downloadFile() {
const fileName = 'IMPORT_BU.xlsx'
this.fileService.download(fileName).subscribe({
this.fileService.downloadTemplate(fileName).subscribe({
next: response => {
const url = window.URL.createObjectURL(response);
const a = document.createElement("a");
......
......@@ -42,7 +42,7 @@ export class DepartmentRegisterComponent implements OnInit {
const formData = new FormData();
formData.append('file', this.selectedFile);
this.bu1ListLoading = true
this.fileService.upload(formData, 'mbu1').subscribe({
this.fileService.uploadExcel(formData, 'mbu1').subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
......@@ -60,7 +60,7 @@ export class DepartmentRegisterComponent implements OnInit {
downloadFile() {
const fileName = 'IMPORT_BU.xlsx'
this.fileService.download(fileName).subscribe({
this.fileService.downloadTemplate(fileName).subscribe({
next: response => {
const url = window.URL.createObjectURL(response);
const a = document.createElement("a");
......
......@@ -66,7 +66,7 @@ export class SectionRegistrationComponent implements OnInit {
const formData = new FormData();
formData.append('file', this.selectedFile);
this.bu3ListLoading = true
this.fileService.upload(formData, 'mbu3').subscribe({
this.fileService.uploadExcel(formData, 'mbu3').subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
......@@ -84,7 +84,7 @@ export class SectionRegistrationComponent implements OnInit {
downloadFile() {
const fileName = 'IMPORT_BU.xlsx'
this.fileService.download(fileName).subscribe({
this.fileService.downloadTemplate(fileName).subscribe({
next: response => {
const url = window.URL.createObjectURL(response);
const a = document.createElement("a");
......
......@@ -66,7 +66,7 @@ export class SubDepartmentFourComponent implements OnInit {
const formData = new FormData();
formData.append('file', this.selectedFile);
this.bu7ListLoading = true
this.fileService.upload(formData, 'mbu7').subscribe({
this.fileService.uploadExcel(formData, 'mbu7').subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
......@@ -84,7 +84,7 @@ export class SubDepartmentFourComponent implements OnInit {
downloadFile() {
const fileName = 'IMPORT_BU.xlsx'
this.fileService.download(fileName).subscribe({
this.fileService.downloadTemplate(fileName).subscribe({
next: response => {
const url = window.URL.createObjectURL(response);
const a = document.createElement("a");
......
......@@ -66,7 +66,7 @@ export class SubDepartmentOneComponent implements OnInit {
const formData = new FormData();
formData.append('file', this.selectedFile);
this.bu4ListLoading = true
this.fileService.upload(formData, 'mbu4').subscribe({
this.fileService.uploadExcel(formData, 'mbu4').subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
......@@ -84,7 +84,7 @@ export class SubDepartmentOneComponent implements OnInit {
downloadFile() {
const fileName = 'IMPORT_BU.xlsx'
this.fileService.download(fileName).subscribe({
this.fileService.downloadTemplate(fileName).subscribe({
next: response => {
const url = window.URL.createObjectURL(response);
const a = document.createElement("a");
......
......@@ -66,7 +66,7 @@ export class SubDepartmentThreeComponent implements OnInit {
const formData = new FormData();
formData.append('file', this.selectedFile);
this.bu6ListLoading = true
this.fileService.upload(formData, 'mbu6').subscribe({
this.fileService.uploadExcel(formData, 'mbu6').subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
......@@ -84,7 +84,7 @@ export class SubDepartmentThreeComponent implements OnInit {
downloadFile() {
const fileName = 'IMPORT_BU.xlsx'
this.fileService.download(fileName).subscribe({
this.fileService.downloadTemplate(fileName).subscribe({
next: response => {
const url = window.URL.createObjectURL(response);
const a = document.createElement("a");
......
......@@ -65,7 +65,7 @@ export class SubDepartmentTwoComponent implements OnInit {
const formData = new FormData();
formData.append('file', this.selectedFile);
this.bu5ListLoading = true
this.fileService.upload(formData, 'mbu5').subscribe({
this.fileService.uploadExcel(formData, 'mbu5').subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
......@@ -83,7 +83,7 @@ export class SubDepartmentTwoComponent implements OnInit {
downloadFile() {
const fileName = 'IMPORT_BU.xlsx'
this.fileService.download(fileName).subscribe({
this.fileService.downloadTemplate(fileName).subscribe({
next: response => {
const url = window.URL.createObjectURL(response);
const a = document.createElement("a");
......
......@@ -142,7 +142,7 @@ export class CompanyRegistrationPageComponent {
const formData = new FormData();
formData.append('file', this.selectedFile);
this.dataLoading = true
this.fileService.upload(formData, '').subscribe({
this.fileService.uploadExcel(formData, '').subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
......@@ -161,7 +161,7 @@ export class CompanyRegistrationPageComponent {
}
downloadFile() {
const fileName = '.xlsx'
this.fileService.download(fileName).subscribe({
this.fileService.downloadTemplate(fileName).subscribe({
next: response => {
const url = window.URL.createObjectURL(response);
const a = document.createElement("a");
......
......@@ -98,7 +98,7 @@ export class SubEmployeeRegistrationComponent {
const formData = new FormData();
formData.append('file', this.selectedFile);
this.employee.loading = true
this.fileService.upload(formData, '').subscribe({
this.fileService.uploadExcel(formData, '').subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
......@@ -117,7 +117,7 @@ export class SubEmployeeRegistrationComponent {
}
downloadFile() {
const fileName = 'IMPORT_MPOSITION.xlsx'
this.fileService.download(fileName).subscribe({
this.fileService.downloadTemplate(fileName).subscribe({
next: response => {
const url = window.URL.createObjectURL(response);
const a = document.createElement("a");
......
......@@ -54,7 +54,7 @@ export class EmployeeCategories {
const formData = new FormData();
this.dataLoading = true
formData.append('file', this.selectedFile);
this.fileService.upload(formData, 'employment_type').subscribe({
this.fileService.uploadExcel(formData, 'employment_type').subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
......@@ -74,7 +74,7 @@ export class EmployeeCategories {
downloadFile() {
const fileName = 'IMPORT_MEMPLOYMENTTYPE.xlsx'
this.fileService.download(fileName).subscribe({
this.fileService.downloadTemplate(fileName).subscribe({
next: response => {
const url = window.URL.createObjectURL(response);
const a = document.createElement("a");
......
......@@ -55,7 +55,7 @@ export class EmployeeGroupUnit implements OnInit {
const formData = new FormData();
formData.append('file', this.selectedFile);
this.dataLoading = true
this.fileService.upload(formData, 'mgroup').subscribe({
this.fileService.uploadExcel(formData, 'mgroup').subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
......@@ -73,7 +73,7 @@ export class EmployeeGroupUnit implements OnInit {
downloadFile() {
const fileName = 'IMPORT_MGROUP.xlsx'
this.fileService.download(fileName).subscribe({
this.fileService.downloadTemplate(fileName).subscribe({
next: response => {
const url = window.URL.createObjectURL(response);
const a = document.createElement("a");
......
......@@ -56,7 +56,7 @@ export class EmployeeLevel implements OnInit {
const formData = new FormData();
formData.append('file', this.selectedFile);
this.dataLoading = true
this.fileService.upload(formData, 'pl').subscribe({
this.fileService.uploadExcel(formData, 'pl').subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
......@@ -76,7 +76,7 @@ export class EmployeeLevel implements OnInit {
downloadFile() {
const fileName = 'IMPORT_PL.xlsx'
this.fileService.download(fileName).subscribe({
this.fileService.downloadTemplate(fileName).subscribe({
next: response => {
const url = window.URL.createObjectURL(response);
const a = document.createElement("a");
......
......@@ -55,7 +55,7 @@ export class PositionUnitComponent implements OnInit {
const formData = new FormData();
formData.append('file', this.selectedFile);
this.dataLoading = true
this.fileService.upload(formData, 'mposition').subscribe({
this.fileService.uploadExcel(formData, 'mposition').subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
......@@ -75,7 +75,7 @@ export class PositionUnitComponent implements OnInit {
downloadFile() {
const fileName = 'IMPORT_MPOSITION.xlsx'
this.fileService.download(fileName).subscribe({
this.fileService.downloadTemplate(fileName).subscribe({
next: response => {
const url = window.URL.createObjectURL(response);
const a = document.createElement("a");
......
......@@ -560,7 +560,7 @@
<div class="flex justify-end">
<ng-container *ngIf="modalStatus=='add'||modalStatus=='edit'">
<button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay="#competency-topic-page-alert-modal">
data-hs-overlay="#competency-topic-page-modal">
<span class="sr-only">Close</span>
<i class="ti ti-circle-x fs-xxl"></i>
</button>
......
......@@ -87,7 +87,7 @@ export class CompetencyTopic {
const formData = new FormData();
formData.append('file', this.selectedFile);
this.dataLoading = true
this.fileService.upload(formData, 'competency_topic').subscribe({
this.fileService.uploadExcel(formData, 'competency_topic').subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
......@@ -108,7 +108,7 @@ export class CompetencyTopic {
downloadFile() {
const fileName = 'IMPORT_COMPETENCY_TOPIC.xlsx'
this.fileService.download(fileName).subscribe({
this.fileService.downloadTemplate(fileName).subscribe({
next: response => {
const url = window.URL.createObjectURL(response);
const a = document.createElement("a");
......
......@@ -60,7 +60,7 @@ export class TypeRegistration {
const formData = new FormData();
formData.append('file', this.selectedFile);
this.dataLoading = true
this.fileService.upload(formData, 'competency_type').subscribe({
this.fileService.uploadExcel(formData, 'competency_type').subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
......@@ -80,7 +80,7 @@ export class TypeRegistration {
downloadFile() {
const fileName = 'IMPORT_COMPETENCY_TYPE.xlsx'
this.fileService.download(fileName).subscribe({
this.fileService.downloadTemplate(fileName).subscribe({
next: response => {
const url = window.URL.createObjectURL(response);
const a = document.createElement("a");
......
......@@ -15,10 +15,9 @@
</a>
</nav>
</div>
<div class="mt-3 px-3rem !-mt-3 pt-50px">
<div class="mt-3 px-2rem !-mt-3 pt-50px">
<div id="underline-1" role="tabpanel" aria-labelledby="underline-item-1">
<app-assessment-tool [pathTitle]="pathTitle"
(sendPathTitle)="pathTitle=$event"></app-assessment-tool>
<app-assessment-tool></app-assessment-tool>
</div>
</div>
</div>
......
......@@ -92,7 +92,7 @@ export class SubJobCompetencyComponent {
const formData = new FormData();
formData.append('file', this.selectedFile);
this.loading = true
this.fileService.upload(formData, 'MJOBCODE_COMPETENCY').subscribe({
this.fileService.uploadExcel(formData, 'MJOBCODE_COMPETENCY').subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
......@@ -111,7 +111,7 @@ export class SubJobCompetencyComponent {
downloadFile() {
const fileName = 'IMPORT_MJOBCODEV2.xlsx'
this.fileService.download(fileName).subscribe({
this.fileService.downloadTemplate(fileName).subscribe({
next: response => {
const url = window.URL.createObjectURL(response);
const a = document.createElement("a");
......
......@@ -13,12 +13,12 @@ export class MyAssessmentModel implements AssessmentModel {
edesc: string
tdesc: string
shortName: string
constructor(data: Partial<AssessmentModel>) {
this.assessmentId = data.assessmentId || ""
this.companyId = data.companyId || ""
this.edesc = data.edesc || ""
this.tdesc = data.tdesc || ""
this.shortName = data.shortName || ""
constructor(data?: Partial<AssessmentModel>) {
this.assessmentId = data?.assessmentId || ""
this.companyId = data?.companyId || ""
this.edesc = data?.edesc || ""
this.tdesc = data?.tdesc || ""
this.shortName = data?.shortName || ""
}
}
......@@ -3,6 +3,7 @@ import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { AssessmentModel } from '../model/assessment.model';
import { AlertModel } from '../model/alert.model';
@Injectable({
providedIn: 'root'
})
......@@ -17,16 +18,16 @@ export class AssessmentService {
getList(): Observable<AssessmentModel[]> {
return this.http.get<AssessmentModel[]>(this.urlApi + "/lists")
}
post(body: AssessmentModel) {
return this.http.post(this.urlApi, body)
post(body: AssessmentModel): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi, body)
}
delete(body: AssessmentModel) {
delete(body: AssessmentModel): Observable<AlertModel> {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete(this.urlApi, options)
return this.http.delete<AlertModel>(this.urlApi, options)
}
}
\ No newline at end of file
......@@ -10,10 +10,10 @@ export class FileService {
constructor(private http: HttpClient) {
}
upload(formData: any, table: string): Observable<AlertModel> {
uploadExcel(formData: any, table: string): Observable<AlertModel> {
return this.http.post<AlertModel>(environment.baseUrl + '/import/excel/' + table, formData)
}
download(fileName: string) {
downloadTemplate(fileName: string) {
return this.http.get("/assets/template/" + fileName, { responseType: "blob" })
}
}
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