Commit bedbea55 by Natthaphat

แก้ไขสามารถเลือกแล้วเปลี่ยน สถานะได้เลย

parent 3c490f8b
...@@ -14,6 +14,17 @@ ...@@ -14,6 +14,17 @@
translate}} translate}}
</a> </a>
<a href="javascript:void(0);" class="hs-dropdown-toggle ti-btn ti-btn-success-full me-2"
*ngIf="someSelected" (click)="adjustSelect(1)"><i
class="ri-user-follow-line font-semibold align-middle"></i>{{ 'Active' |
translate}}
</a>
<a href="javascript:void(0);" class="hs-dropdown-toggle ti-btn ti-btn-secondary-full me-2"
*ngIf="someSelected" (click)="adjustSelect(0)"><i
class="ri-user-unfollow-line font-semibold align-middle"></i>{{ 'Unactive' |
translate}}
</a>
<a href="javascript:void(0);" class="hs-dropdown-toggle ti-btn ti-btn-danger-full me-2" *ngIf="someSelected" <a href="javascript:void(0);" class="hs-dropdown-toggle ti-btn ti-btn-danger-full me-2" *ngIf="someSelected"
(click)="deleteSelect()"><i class="ri-delete-bin-line font-semibold align-middle"></i>{{ 'Delete' | (click)="deleteSelect()"><i class="ri-delete-bin-line font-semibold align-middle"></i>{{ 'Delete' |
...@@ -170,30 +181,30 @@ ...@@ -170,30 +181,30 @@
<div class="xl:col-span-12 col-span-12"> <div class="xl:col-span-12 col-span-12">
<label for="deal-title" class="form-label">{{'version' | translate}}</label> <label for="deal-title" class="form-label">{{'version' | translate}}</label>
<input type="text" class="form-control" [ngClass]="{ '!bg-input-readonly': modalStatus === 'edit' }" <input type="text" class="form-control" [ngClass]="{ '!bg-input-readonly': modalStatus === 'edit' }"
id="deal-title" placeholder="" [(ngModel)]="consent.version" [readonly]="modalStatus === 'edit'"> id="deal-title" placeholder="" [(ngModel)]="pdpa.version" [readonly]="modalStatus === 'edit'">
<div class="text-danger" *ngIf="!consent.version"> <div class="text-danger" *ngIf="!pdpa.version">
{{'Please fill in information' | translate}} {{'Please fill in information' | translate}}
</div> </div>
</div> </div>
<div class="xl:col-span-6 col-span-12" *ngIf="modalStatus=='add'"> <div class="xl:col-span-6 col-span-12" *ngIf="modalStatus=='add'">
<label for="deal-title" class="form-label">{{'วันที่เริ่ม' | translate}}</label> <label for="deal-title" class="form-label">{{'วันที่เริ่ม' | translate}}</label>
<input type="text" class="form-control" id="deal-title" placeholder="" [(ngModel)]="consent.startDate"> <input type="text" class="form-control" id="deal-title" placeholder="" [(ngModel)]="pdpa.startDate">
<div class="text-danger" *ngIf="!consent.startDate"> <div class="text-danger" *ngIf="!pdpa.startDate">
{{'Please fill in information' | translate}} {{'Please fill in information' | translate}}
</div> </div>
</div> </div>
<div class="xl:col-span-6 col-span-12" *ngIf="modalStatus=='add'"> <div class="xl:col-span-6 col-span-12" *ngIf="modalStatus=='add'">
<label for="deal-title" class="form-label">{{'วันที่สินสุด' | translate}}</label> <label for="deal-title" class="form-label">{{'วันที่สินสุด' | translate}}</label>
<input type="text" class="form-control" id="deal-title" placeholder="" [(ngModel)]="consent.endDate"> <input type="text" class="form-control" id="deal-title" placeholder="" [(ngModel)]="pdpa.endDate">
<div class="text-danger" *ngIf="!consent.endDate"> <div class="text-danger" *ngIf="!pdpa.endDate">
{{'Please fill in information' | translate}} {{'Please fill in information' | translate}}
</div> </div>
</div> </div>
<div class="xl:col-span-12 col-span-12"> <div class="xl:col-span-12 col-span-12">
<label class="form-label">{{'Status' | translate}}</label> <label class="form-label">{{'Status' | translate}}</label>
<ng-select name="choices-multiple-remove-button2" id="choices-multiple-remove-button2" placeholder="" <ng-select name="choices-multiple-remove-button2" id="choices-multiple-remove-button2" placeholder=""
[(ngModel)]="consent.status"> [(ngModel)]="pdpa.status">
<ng-option [value]="0">{{'Unactive' | translate}}</ng-option> <ng-option [value]="0">{{'Unactive' | translate}}</ng-option>
<ng-option [value]="1">{{'Active' | translate}}</ng-option> <ng-option [value]="1">{{'Active' | translate}}</ng-option>
</ng-select> </ng-select>
...@@ -240,9 +251,9 @@ ...@@ -240,9 +251,9 @@
<div class="flex flex-col"> <div class="flex flex-col">
<label class="ti-form-label mb-2 text-primary font-bold">Version *</label> <label class="ti-form-label mb-2 text-primary font-bold">Version *</label>
<input type="text" class="ti-form-input w-full" <input type="text" class="ti-form-input w-full"
[ngClass]="{ '!bg-input-readonly': modalStatus === 'edit' }" [(ngModel)]="consent.version" [ngClass]="{ '!bg-input-readonly': modalStatus === 'edit' }" [(ngModel)]="pdpa.version"
[readonly]="modalStatus === 'edit'" /> [readonly]="modalStatus === 'edit'" />
<div class="text-danger text-sm mt-1" *ngIf="!consent.version"> <div class="text-danger text-sm mt-1" *ngIf="!pdpa.version">
Please fill in information Please fill in information
</div> </div>
</div> </div>
...@@ -252,17 +263,17 @@ ...@@ -252,17 +263,17 @@
<div class="flex items-center space-x-6"> <div class="flex items-center space-x-6">
<label class="inline-flex items-center space-x-2"> <label class="inline-flex items-center space-x-2">
<input type="radio" name="status" [(ngModel)]="consent.status" value="1" /> <input type="radio" name="status" [(ngModel)]="pdpa.status" value="1" />
<span>{{ 'Active' | translate }}</span> <span>{{ 'Active' | translate }}</span>
</label> </label>
<label class="inline-flex items-center space-x-2"> <label class="inline-flex items-center space-x-2">
<input type="radio" name="status" [(ngModel)]="consent.status" value="0" /> <input type="radio" name="status" [(ngModel)]="pdpa.status" value="0" />
<span>{{ 'Unactive' | translate }}</span> <span>{{ 'Unactive' | translate }}</span>
</label> </label>
</div> </div>
<div class="text-danger text-sm mt-1" *ngIf="consent.status === null || consent.status === undefined"> <div class="text-danger text-sm mt-1" *ngIf="pdpa.status === null || pdpa.status === undefined">
Please fill in information Please fill in information
</div> </div>
</div> </div>
...@@ -270,16 +281,16 @@ ...@@ -270,16 +281,16 @@
<div class="flex flex-col"> <div class="flex flex-col">
<label class="ti-form-label mb-2 text-primary font-bold">Start Date </label> <label class="ti-form-label mb-2 text-primary font-bold">Start Date </label>
<input type="datetime-local" class="ti-form-input w-full" [(ngModel)]="consent.startDate" /> <input type="datetime-local" class="ti-form-input w-full" [(ngModel)]="pdpa.startDate" />
<div class="text-danger text-sm mt-1" *ngIf="!consent.startDate"> <div class="text-danger text-sm mt-1" *ngIf="!pdpa.startDate">
Please fill in information Please fill in information
</div> </div>
</div> </div>
<div class="flex flex-col"> <div class="flex flex-col">
<label class="ti-form-label mb-2 text-primary font-bold">End Date</label> <label class="ti-form-label mb-2 text-primary font-bold">End Date</label>
<input type="datetime-local" class="ti-form-input w-full" [(ngModel)]="consent.endDate" /> <input type="datetime-local" class="ti-form-input w-full" [(ngModel)]="pdpa.endDate" />
<div class="text-danger text-sm mt-1" *ngIf="!consent.endDate"> <div class="text-danger text-sm mt-1" *ngIf="!pdpa.endDate">
Please fill in information Please fill in information
</div> </div>
</div> </div>
...@@ -307,17 +318,17 @@ ...@@ -307,17 +318,17 @@
<div> <div>
<div *ngIf="currentTab == 1"> <div *ngIf="currentTab == 1">
<quill-editor [modules]="quillConfig" [styles]="{ 'height': '400px', 'overflow-y': 'auto' }" <quill-editor [modules]="quillConfig" [styles]="{ 'height': '400px', 'overflow-y': 'auto' }"
[(ngModel)]="consent.requestConsentThai" [ngModelOptions]="{ standalone: true }" [(ngModel)]="pdpa.requestConsentThai" [ngModelOptions]="{ standalone: true }"
theme="snow"></quill-editor> theme="snow"></quill-editor>
</div> </div>
<div *ngIf="currentTab == 2"> <div *ngIf="currentTab == 2">
<quill-editor [modules]="quillConfig" [styles]="{ 'height': '400px', 'overflow-y': 'auto' }" <quill-editor [modules]="quillConfig" [styles]="{ 'height': '400px', 'overflow-y': 'auto' }"
[(ngModel)]="consent.requestConsentEng" [ngModelOptions]="{ standalone: true }" [(ngModel)]="pdpa.requestConsentEng" [ngModelOptions]="{ standalone: true }"
theme="snow"></quill-editor> theme="snow"></quill-editor>
</div> </div>
<div *ngIf="currentTab == 3"> <div *ngIf="currentTab == 3">
<quill-editor [modules]="quillConfig" [styles]="{ 'height': '400px', 'overflow-y': 'auto' }" <quill-editor [modules]="quillConfig" [styles]="{ 'height': '400px', 'overflow-y': 'auto' }"
[(ngModel)]="consent.requestConsentChina" [ngModelOptions]="{ standalone: true }" [(ngModel)]="pdpa.requestConsentChina" [ngModelOptions]="{ standalone: true }"
theme="snow"></quill-editor> theme="snow"></quill-editor>
</div> </div>
</div> </div>
......
...@@ -13,12 +13,11 @@ import { UserRoleModel } from "../../models/user-role-model"; ...@@ -13,12 +13,11 @@ import { UserRoleModel } from "../../models/user-role-model";
import { TokenService } from "../../../shared/services/token.service"; import { TokenService } from "../../../shared/services/token.service";
import { environment } from "../../../../environments/environment"; import { environment } from "../../../../environments/environment";
import { PdpaService } from "../../services/pdpa.service"; import { PdpaService } from "../../services/pdpa.service";
import { MyPdpaConsentModel, MyPdpaModel, PdpaConsentModel, PdpaModel } from "../../models/pdpa.model";
import { PdpaConfigModel } from "../../models/pdpaConfig.model";
import { Router } from "@angular/router"; import { Router } from "@angular/router";
import { PdpaConfigComponent } from "./pdpa-config/pdpa-config.component"; import { PdpaConfigComponent } from "./pdpa-config/pdpa-config.component";
import { QuillModule } from "ngx-quill"; import { QuillModule } from "ngx-quill";
import { MatDialog } from "@angular/material/dialog"; import { MatDialog } from "@angular/material/dialog";
import { MyPdpaConfigModel, PdpaConfigModel } from '../../models/pdpaConfig.model';
@Component({ @Component({
selector: 'app-pdpa-manage', selector: 'app-pdpa-manage',
...@@ -60,16 +59,16 @@ export class PdpaManageComponent { ...@@ -60,16 +59,16 @@ export class PdpaManageComponent {
modalRef: any; modalRef: any;
pdpaconfig!: MyPdpaConsentModel; pdpaconfig!: MyPdpaConfigModel;
edit = false edit = false
currentTab = 1 currentTab = 1
allSelected = false; allSelected = false;
someSelected = false; someSelected = false;
itemsList: MyPdpaConsentModel[] = [] itemsList: MyPdpaConfigModel[] = []
filterList: MyPdpaConsentModel[] = [] filterList: MyPdpaConfigModel[] = []
consent: MyPdpaConsentModel = new MyPdpaConsentModel() pdpa: MyPdpaConfigModel = new MyPdpaConfigModel()
selectedItems = new Map<string, boolean>(); selectedItems = new Map<string, boolean>();
pageIndex = 0; pageIndex = 0;
...@@ -97,12 +96,12 @@ export class PdpaManageComponent { ...@@ -97,12 +96,12 @@ export class PdpaManageComponent {
ngOnInit(): void { ngOnInit(): void {
this.pdpaService.getConfigList().subscribe(res => { this.pdpaService.getConfigList().subscribe(res => {
this.itemsList = res.map(item => new MyPdpaConsentModel(item, this.translate)); this.itemsList = res.map(item => new MyPdpaConfigModel(item, this.translate));
this.filterList = [...this.itemsList]; this.filterList = [...this.itemsList];
}); });
} }
filter(v: string): MyPdpaConsentModel[] { filter(v: string): MyPdpaConfigModel[] {
const search = v.toLowerCase(); const search = v.toLowerCase();
return this.itemsList.filter(x => return this.itemsList.filter(x =>
x.version?.toLowerCase().includes(search) || x.version?.toLowerCase().includes(search) ||
...@@ -114,77 +113,63 @@ export class PdpaManageComponent { ...@@ -114,77 +113,63 @@ export class PdpaManageComponent {
new() { new() {
this.modalStatus = 'add' this.modalStatus = 'add'
this.consent = new MyPdpaConsentModel(); // สร้างอ็อบเจกต์ใหม่เสมอเมื่อเปิดหน้าต่างเพิ่ม this.pdpa = new MyPdpaConfigModel();
this.openModal(); this.openModal();
} }
view(item: MyPdpaConsentModel) { view(item: MyPdpaConfigModel) {
this.modalStatus = 'edit'; this.modalStatus = 'edit';
// สร้าง MyPdpaConsentModel ใหม่จาก item เพื่อให้ไม่กระทบข้อมูลเดิม this.pdpa = new MyPdpaConfigModel(item, this.translate);
// และเรียกใช้ formatDatesForDatetimeLocal เพื่อปรับรูปแบบวันที่ this.formatDatesForDatetimeLocal(this.pdpa);
this.consent = new MyPdpaConsentModel(item, this.translate);
this.formatDatesForDatetimeLocal(this.consent); // เพิ่มโค้ดนี้
this.openModal(); this.openModal();
} }
// --- เพิ่มฟังก์ชันนี้เข้าไปในคลาส PdpaManageComponent --- private formatDatesForDatetimeLocal(consentModel: MyPdpaConfigModel): void {
private formatDatesForDatetimeLocal(consentModel: MyPdpaConsentModel): void {
if (consentModel.startDate) { if (consentModel.startDate) {
// ตัดสตริงให้เหลือแค่ YYYY-MM-DDTHH:mm
consentModel.startDate = consentModel.startDate.substring(0, 16); consentModel.startDate = consentModel.startDate.substring(0, 16);
} }
if (consentModel.endDate) { if (consentModel.endDate) {
// ตัดสตริงให้เหลือแค่ YYYY-MM-DDTHH:mm
consentModel.endDate = consentModel.endDate.substring(0, 16); consentModel.endDate = consentModel.endDate.substring(0, 16);
} }
} }
// ---------------------------------------------------- // ----------------------------------------------------
save() { save() {
if (this.isSaving) return;
swal({ swal({
title: "Are you sure?", title: "Are you sure?",
text: "คุณต้องการบันทึกหรือไม่", text: "คุณต้องการบันทึกหรือไม่",
icon: "warning", icon: "warning",
dangerMode: false, dangerMode: false,
buttons: ["Cancel", "Confirm"], buttons: ["Cancel", "Confirm"],
}).then(willSave => { })
if (willSave) { .then((willDelete: any) => {
this.isSaving = true; if (willDelete) {
// 🔧 สร้าง payload เปล่า (ถ้ายังไม่ได้แก้ class)
const payload = {
version: this.consent.version,
startDate: this.consent.startDate,
endDate: this.consent.endDate,
status: this.consent.status,
requestConsentThai: this.consent.requestConsentThai,
requestConsentEng: this.consent.requestConsentEng,
requestConsentChina: this.consent.requestConsentChina
};
this.pdpaService.postConfig(payload).subscribe({ if (this.modalStatus == 'add') {
next: res => { console.log(this.pdpa);
swal("Success", "บันทึกแล้ว", "success"); this.pdpaService.postConfig(this.pdpa).subscribe(result => {
this.isSaving = false; swal("Save Success!!", "บันทึกเวอร์ชั่นสำเร็จ", "success");
this.ngOnInit(); this.ngOnInit()
this.modalRef.close(); this.childModal?.nativeElement.click()
}, })
error: err => { } else if (this.modalStatus == 'edit') {
swal("Error", "เกิดข้อผิดพลาด", "error"); const respone = new MyPdpaConfigModel(this.pdpa);
this.isSaving = false; this.pdpaService.update(respone).subscribe(result => {
console.log(result)
swal("Update Success!!", "บันทึกเวอร์ชั่นสำเร็จ", "success");
this.ngOnInit()
this.childModal?.nativeElement.click()
})
} }
}); }
} });
});
} }
deleteVersion(item: PdpaConfigModel) {
deleteVersion(item: PdpaConsentModel) { const versionText = `${this.translate.instant('Version')}: ${item.version}`;
swal({ swal({
title: "Are you sure?", title: "Are you sure?",
text: "You won't be able to revert this!", text: `Confirm to delete :\n${versionText}\!`,
icon: "warning", icon: "warning",
dangerMode: true, dangerMode: true,
buttons: ["Cancel", "Yes,Delete it!"], buttons: ["Cancel", "Yes,Delete it!"],
...@@ -199,19 +184,19 @@ export class PdpaManageComponent { ...@@ -199,19 +184,19 @@ export class PdpaManageComponent {
} }
deleteSelect() { deleteSelect() {
let employeeInfo = ''; let pdpaConfig = '';
this.selectedItems.forEach((isSelected, version) => { this.selectedItems.forEach((isSelected, version) => {
if (isSelected) { if (isSelected) {
const pdpa = this.itemsList.find(pdpa => pdpa.version === version) as MyPdpaConsentModel; const pdpa = this.itemsList.find(pdpa => pdpa.version === version) as MyPdpaConfigModel;
if (pdpa) { if (pdpa) {
employeeInfo += `${this.translate.instant('version')}: ${pdpa.version}\n`; pdpaConfig += `${this.translate.instant('Version')}: ${pdpa.version}\n`;
} }
} }
}); });
swal({ swal({
title: "Are you sure?", title: "Are you sure?",
text: employeeInfo, text: pdpaConfig,
icon: "warning", icon: "warning",
dangerMode: true, dangerMode: true,
buttons: ["Cancel", "Yes, Delete it!"], buttons: ["Cancel", "Yes, Delete it!"],
...@@ -233,6 +218,53 @@ export class PdpaManageComponent { ...@@ -233,6 +218,53 @@ export class PdpaManageComponent {
}); });
} }
adjustSelect(status: number) {
let title = "Are you sure?";
let pdpaConfig = ''; // เก็บข้อมูลเวอร์ชันที่เลือก
this.selectedItems.forEach((isSelected, version) => {
if (isSelected) {
const pdpa = this.itemsList.find(pdpa => pdpa.version === version);
if (pdpa) {
pdpaConfig += `${this.translate.instant('Version')}: ${pdpa.version}\n`;
}
}
});
swal({
title: title,
text: pdpaConfig,
icon: "warning",
dangerMode: false,
buttons: ["Cancel", "Confirm"],
}).then((willDelete: any) => {
if (willDelete) {
this.selectedItems.forEach((isSelected, version) => {
if (isSelected) {
const pdpa = this.itemsList.find(pdpa => pdpa.version === version);
if (pdpa) {
// แปลง pdpa ให้เป็น Plain Object เพื่อป้องกัน JSON.stringify error
const cleanPdpa = {
version: pdpa.version,
startDate: pdpa.startDate,
endDate: pdpa.endDate,
status: status.toString(),
requestConsentThai: pdpa.requestConsentThai,
requestConsentEng: pdpa.requestConsentEng,
requestConsentChina: pdpa.requestConsentChina
};
this.pdpaService.update(cleanPdpa).subscribe(result => {
swal("Save Success!!", "บันทึกข้อมูลสำเร็จ", "success");
this.ngOnInit();
});
}
}
});
}
});
}
updatePagedItems() { updatePagedItems() {
const startIndex = this.pageIndex * 10; const startIndex = this.pageIndex * 10;
const endIndex = startIndex + 10; const endIndex = startIndex + 10;
...@@ -267,7 +299,7 @@ export class PdpaManageComponent { ...@@ -267,7 +299,7 @@ export class PdpaManageComponent {
} }
filterEmp(empId: string) { filterEmp(empId: string) {
this.consent = this.itemsList.filter(e => e.version == empId)[0] this.pdpa = this.itemsList.filter(e => e.version == empId)[0]
} }
} }
\ No newline at end of file
...@@ -92,7 +92,7 @@ export class MyPdpaConsentModel extends BaseModel implements PdpaConsentModel { ...@@ -92,7 +92,7 @@ export class MyPdpaConsentModel extends BaseModel implements PdpaConsentModel {
this.endDate = data?.endDate || '' this.endDate = data?.endDate || ''
this.status = data?.status || '' this.status = data?.status || ''
this.requestConsentThai = data?.requestConsentThai || '' this.requestConsentThai = data?.requestConsentThai || ''
this.requestConsentThai = data?.requestConsentThai || '' this.requestConsentEng = data?.requestConsentEng || ''
this.requestConsentChina = data?.requestConsentChina || '' this.requestConsentChina = data?.requestConsentChina || ''
} }
......
import { TranslateService } from "@ngx-translate/core"
import { BaseModel } from "./base.model"
export interface PdpaConfigModel { export interface PdpaConfigModel {
version: string version: string
startDate: string startDate: string
...@@ -6,4 +9,31 @@ export interface PdpaConfigModel { ...@@ -6,4 +9,31 @@ export interface PdpaConfigModel {
requestConsentThai: string requestConsentThai: string
requestConsentEng: string requestConsentEng: string
requestConsentChina: string requestConsentChina: string
}
export class MyPdpaConfigModel extends BaseModel implements PdpaConfigModel {
version: string
startDate: string
endDate: string
status: string
requestConsentThai: string
requestConsentEng: string
requestConsentChina: string
constructor(data?: Partial<PdpaConfigModel>, translateService?: TranslateService) {
super(data, translateService)
this.version = data?.version || ''
this.startDate = data?.startDate || ''
this.endDate = data?.endDate || ''
this.status = data?.status || ''
this.requestConsentThai = data?.requestConsentThai || ''
this.requestConsentEng = data?.requestConsentEng || ''
this.requestConsentChina = data?.requestConsentChina || ''
}
getStatus(): string {
if (this.status == "1") {
return this.translateService.instant('Active');
} else {
return this.translateService.instant('Unactive');
}
}
} }
\ No newline at end of file
import { TranslateService } from "@ngx-translate/core"
import { BaseModel } from "./base.model"
export interface PdpaSummaryModel { export interface PdpaSummaryModel {
consentProfile: number consentProfile: number
nonConsentProfile: number nonConsentProfile: number
totalProfile: number totalProfile: number
} }
export class MyPdpaSummaryModel extends BaseModel implements PdpaSummaryModel {
consentProfile: number
nonConsentProfile: number
totalProfile: number
constructor(data?: Partial<PdpaSummaryModel>, translateService?: TranslateService) {
super(data, translateService)
this.consentProfile = data?.consentProfile!;
this.nonConsentProfile = data?.nonConsentProfile!;
this.totalProfile = data?.totalProfile!;
}
}
...@@ -4,7 +4,8 @@ import { Observable } from 'rxjs'; ...@@ -4,7 +4,8 @@ import { Observable } from 'rxjs';
import { PdpaConsentModel, PdpaModel } from '../models/pdpa.model'; import { PdpaConsentModel, PdpaModel } from '../models/pdpa.model';
import { environment } from '../../../environments/environment'; import { environment } from '../../../environments/environment';
import { PdpaSummaryModel } from '../models/pdpaSummary.model'; import { PdpaSummaryModel } from '../models/pdpaSummary.model';
import { PdpaConfigModel } from '../models/pdpaConfig.model'; import { MyPdpaConfigModel, PdpaConfigModel } from '../models/pdpaConfig.model';
import { ResponseModel } from '../models/base.model';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
...@@ -34,16 +35,21 @@ export class PdpaService { ...@@ -34,16 +35,21 @@ export class PdpaService {
} }
// ใช้กับ PdpaConfigModel // ใช้กับ PdpaConfigModel
getConfigList(): Observable<PdpaConsentModel[]> { getConfigList(): Observable<PdpaConfigModel[]> {
return this.http.get<PdpaConsentModel[]>(`${environment.baseUrl}/pdpa/config/lists`); return this.http.get<PdpaConfigModel[]>(`${environment.baseUrl}/pdpa/config/lists`);
} }
getConfigByVersion(version: string): Observable<PdpaConsentModel> {
return this.http.get<PdpaConsentModel>(`${environment.baseUrl}/pdpa/config/${version}`); getConfigByVersion(version: string): Observable<PdpaConfigModel> {
return this.http.get<PdpaConfigModel>(`${environment.baseUrl}/pdpa/config/${version}`);
}
postConfig(data: PdpaConfigModel): Observable<any> {
return this.http.post<ResponseModel>(`${environment.baseUrl}/pdpa/config`, data);
} }
postConfig(data: PdpaConsentModel): Observable<any> { update(body: PdpaConfigModel): Observable<any> {
return this.http.post(`${environment.baseUrl}/pdpa/config`, data); return this.http.post<ResponseModel>(`${environment.baseUrl}/pdpa/config`, body);
} }
deleteConfig(version: string): Observable<any> { deleteConfig(version: string): Observable<any> {
...@@ -59,7 +65,7 @@ export class PdpaService { ...@@ -59,7 +65,7 @@ export class PdpaService {
return this.http.get<PdpaSummaryModel>(`${environment.baseUrl}/pdpa/consent-profile/total/${version}`); return this.http.get<PdpaSummaryModel>(`${environment.baseUrl}/pdpa/consent-profile/total/${version}`);
} }
getLastVersion(): Observable<PdpaConsentModel> { getLastVersion(): Observable<PdpaConfigModel> {
return this.http.get<PdpaConsentModel>(`${environment.baseUrl}/pdpa/consent-profile/last`); return this.http.get<PdpaConfigModel>(`${environment.baseUrl}/pdpa/consent-profile/last`);
} }
} }
...@@ -105,7 +105,7 @@ export class UserService { ...@@ -105,7 +105,7 @@ export class UserService {
} }
update(body: UserProfileModel) { update(body: UserProfileModel) {
return this.http.put<ResponseModel>(this.apiBaseUrl + "/" + body.candidateId, new UserProfileModel(body)); return this.http.post<ResponseModel>(this.apiBaseUrl + "/manage-profile", new UserProfileModel(body));
} }
......
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