From 9ea012f4d25b7185e4c0eb25083e3ebb8b49437b Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Thu, 17 Jul 2025 14:39:02 +0700 Subject: [PATCH] update check citizen2 --- src/controllers/ProfileController.ts | 24 +++++++------------- src/controllers/ProfileEmployeeController.ts | 12 ++++------ src/interfaces/extension.ts | 6 ++--- 3 files changed, 14 insertions(+), 28 deletions(-) diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index cf8a4404..9bdb33ff 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -3125,10 +3125,8 @@ export class ProfileController extends Controller { citizenIdDigits[11] * 2; const calStp2 = cal % 11; let chkDigit = 11 - calStp2; - if (chkDigit === 10) { - chkDigit = 1; - } else if (chkDigit === 11) { - chkDigit = chkDigit % 10; + if (chkDigit >= 10) { + chkDigit = 0; } if (citizenIdDigits[12] !== chkDigit) { @@ -3163,10 +3161,8 @@ export class ProfileController extends Controller { citizenIdDigits[11] * 2; const calStp2 = cal % 11; let chkDigit = 11 - calStp2; - if (chkDigit === 10) { - chkDigit = 1; - } else if (chkDigit === 11) { - chkDigit = chkDigit % 10; + if (chkDigit >= 10) { + chkDigit = 0; } // else if(chkDigit === 11){ // chkDigit = cal % 10; @@ -3243,10 +3239,8 @@ export class ProfileController extends Controller { citizenIdDigits[11] * 2; const calStp2 = cal % 11; let chkDigit = 11 - calStp2; - if (chkDigit === 10) { - chkDigit = 1; - } else if (chkDigit === 11) { - chkDigit = chkDigit % 10; + if (chkDigit >= 10) { + chkDigit = 0; } if (citizenIdDigits[12] !== chkDigit) { @@ -3313,10 +3307,8 @@ export class ProfileController extends Controller { citizenIdDigits[11] * 2; const calStp2 = cal % 11; let chkDigit = 11 - calStp2; - if (chkDigit === 10) { - chkDigit = 1; - } else if (chkDigit === 11) { - chkDigit = chkDigit % 10; + if (chkDigit >= 10) { + chkDigit = 0; } if (citizenIdDigits[12] !== chkDigit) { diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index 0eff8b1b..9331c1a2 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -1859,10 +1859,8 @@ export class ProfileEmployeeController extends Controller { citizenIdDigits[11] * 2; const calStp2 = cal % 11; let chkDigit = 11 - calStp2; - if (chkDigit === 10) { - chkDigit = 1; - } else if (chkDigit === 11) { - chkDigit = chkDigit % 10; + if (chkDigit >= 10) { + chkDigit = 0; } if (citizenIdDigits[12] !== chkDigit) { @@ -1953,10 +1951,8 @@ export class ProfileEmployeeController extends Controller { citizenIdDigits[11] * 2; const calStp2 = cal % 11; let chkDigit = 11 - calStp2; - if (chkDigit === 10) { - chkDigit = 1; - } else if (chkDigit === 11) { - chkDigit = chkDigit % 10; + if (chkDigit >= 10) { + chkDigit = 0; } if (citizenIdDigits[12] !== chkDigit) { diff --git a/src/interfaces/extension.ts b/src/interfaces/extension.ts index 522e58ba..38985d89 100644 --- a/src/interfaces/extension.ts +++ b/src/interfaces/extension.ts @@ -276,10 +276,8 @@ class Extension { citizenIdDigits[11] * 2; const calStp2 = cal % 11; let chkDigit = 11 - calStp2; - if (chkDigit === 10) { - chkDigit = 1; - } else if (chkDigit === 11) { - chkDigit = chkDigit % 10; + if (chkDigit >= 10) { + chkDigit = 0; } // if (citizenIdDigits[12] !== chkDigit) {