This commit is contained in:
parent
f1c8ecf699
commit
5e52206987
2 changed files with 34 additions and 7 deletions
|
|
@ -66,7 +66,7 @@ import {
|
|||
import { orgStructureCache } from "../utils/OrgStructureCache";
|
||||
import { OrgIdMapping, AllOrgMappings, SavePosMasterHistory } from "../interfaces/OrgMapping";
|
||||
import { OrgPermissionData, NodeLevel } from "../interfaces/OrgTypes";
|
||||
import { formatPosMaster, generateLabelName, filterPosMasters } from "../utils/org-formatting";
|
||||
import { formatPosMaster, generateLabelName, filterPosMasters, getPosMasterNo, getOrgFullName } from "../utils/org-formatting";
|
||||
|
||||
@Route("api/v1/org")
|
||||
@Tags("Organization")
|
||||
|
|
@ -8933,13 +8933,25 @@ export class OrganizationController extends Controller {
|
|||
const draftPosMaster = draftPosMasterMap.get(draftPosMasterId) as any;
|
||||
|
||||
// Collect profile update for the selected position
|
||||
// อัพเดท org และ posMasterNo ตลอดไม่ต้องดัก isSit
|
||||
if (nextHolderId != null && draftPos.positionIsSelected) {
|
||||
const _null: any = null;
|
||||
profileUpdates.set(nextHolderId, {
|
||||
posMasterNo: draftPosMaster ? (getPosMasterNo(draftPosMaster as PosMaster) ?? _null) : _null,
|
||||
org: draftPosMaster ? (getOrgFullName(draftPosMaster as PosMaster) ?? _null) : _null,
|
||||
});
|
||||
}
|
||||
// ถ้าไม่ใช่ตำแหน่งนั่งทับ (isSit = false) ถึงจะอัพเดทตำแหน่งในทะเบียนประวัติ
|
||||
if (nextHolderId != null && draftPos.positionIsSelected && !draftPosMaster?.isSit) {
|
||||
profileUpdates.set(nextHolderId, {
|
||||
position: draftPos.positionName,
|
||||
posTypeId: draftPos.posTypeId,
|
||||
posLevelId: draftPos.posLevelId,
|
||||
});
|
||||
const existing = profileUpdates.get(nextHolderId) || {};
|
||||
existing.position = draftPos.positionName;
|
||||
existing.posTypeId = draftPos.posTypeId;
|
||||
existing.posLevelId = draftPos.posLevelId;
|
||||
existing.positionField = draftPos.positionField ?? null;
|
||||
existing.posExecutive = (draftPos as any).posExecutive?.posExecutiveName ?? null;
|
||||
existing.positionArea = draftPos.positionArea ?? null;
|
||||
existing.positionExecutiveField = draftPos.positionExecutiveField ?? null;
|
||||
profileUpdates.set(nextHolderId, existing);
|
||||
if (draftPosMaster && draftPosMaster.ancestorDNA) {
|
||||
// Find the selected position from draft positions
|
||||
const selectedPos =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue