diff --git a/HRM.BO/Bonus/Bonus.cs b/HRM.BO/Bonus/Bonus.cs index bfe9b38..a89938b 100644 --- a/HRM.BO/Bonus/Bonus.cs +++ b/HRM.BO/Bonus/Bonus.cs @@ -210,6 +210,7 @@ namespace HRM.BO List GetAllBonus(int payrollTypeID, EnumStatus status, string code, string name); DataSet GetCCWiseBonusSummary(DateTime bMonthDate, string bonus); DataSet GetCCWiseBonus(DateTime bMonthDate, string bonus); + List GetReligions(int bonusID); } #endregion diff --git a/HRM.DA/Service/Bonus/BonusService.cs b/HRM.DA/Service/Bonus/BonusService.cs index 632bac2..860d1eb 100644 --- a/HRM.DA/Service/Bonus/BonusService.cs +++ b/HRM.DA/Service/Bonus/BonusService.cs @@ -371,6 +371,37 @@ namespace HRM.DA return bonus; } + // The religions set on this bonus (BonusReligion), as ID + Name. + public List GetReligions(int bonusID) + { + List religions = new List(); + TransactionContext tc = null; + try + { + tc = TransactionContext.Begin(); + DataReader dr = new DataReader(BonusDA.GetReligions(tc, bonusID)); + while (dr.Read()) + { + Religion oReligion = new Religion(); + base.SetObjectID(oReligion, dr.GetInt32("ReligionID").Value); + oReligion.Name = dr.GetString("Name"); + religions.Add(oReligion); + } + dr.Close(); + tc.End(); + } + catch (Exception e) + { + #region Handle Exception + if (tc != null) + tc.HandleError(); + ExceptionLog.Write(e); + throw new ServiceException(e.Message, e); + #endregion + } + return religions; + } + public DataSet GetCCWiseBonusSummary(DateTime bMonthDate, string bonus) { DataSet obonus = new DataSet(); diff --git a/HRM.UI/ClientApp/src/app/_services/Basic/basic.service.ts b/HRM.UI/ClientApp/src/app/_services/Basic/basic.service.ts index 5646279..afdf94f 100644 --- a/HRM.UI/ClientApp/src/app/_services/Basic/basic.service.ts +++ b/HRM.UI/ClientApp/src/app/_services/Basic/basic.service.ts @@ -140,6 +140,11 @@ export class BasicService { '/' + nname); } + // the religions set on a bonus (Bonus master screen) + getBonusReligions(bonusID: number): Observable { + return this.apiService.httpGet('/HRBasic/getBonusReligions/' + bonusID); + } + getBonusByID(id: number) { return this.apiService.httpGet(this.apiService.base_url + '/getBonusByID' + '/' + id); } diff --git a/HRM.UI/ClientApp/src/app/payroll-ot/bonus-process/bonus-process.component.css b/HRM.UI/ClientApp/src/app/payroll-ot/bonus-process/bonus-process.component.css index 673e935..0c1c5df 100644 --- a/HRM.UI/ClientApp/src/app/payroll-ot/bonus-process/bonus-process.component.css +++ b/HRM.UI/ClientApp/src/app/payroll-ot/bonus-process/bonus-process.component.css @@ -68,3 +68,48 @@ span.bp-message { padding: 0 4px; } + +/* Religion of the selected bonus: display only, one numbered badge per religion (palette colours only) */ +.bp-religions { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 6px; + min-height: 34px; + padding: 4px 0; +} + +.bp-religion { + display: inline-flex; + align-items: center; + gap: 6px; + padding: 2px 10px 2px 3px; + border-radius: 999px; + border: 1px solid color-mix(in srgb, var(--gh-btn) 25%, var(--gh-tb)); + background: color-mix(in srgb, var(--gh-btn) 10%, var(--gh-tb)); + color: var(--gh-lk); + font-size: 12px; + font-weight: 600; + line-height: 20px; + white-space: nowrap; +} + +.bp-religion__no { + display: inline-flex; + align-items: center; + justify-content: center; + min-width: 20px; + height: 20px; + padding: 0 5px; + border-radius: 999px; + background: var(--gh-btn); + color: var(--gh-tb); + font-size: 11px; + font-weight: 700; +} + +.bp-religion-empty { + color: var(--gh-muted); + font-size: 13px; + font-style: italic; +} diff --git a/HRM.UI/ClientApp/src/app/payroll-ot/bonus-process/bonus-process.component.html b/HRM.UI/ClientApp/src/app/payroll-ot/bonus-process/bonus-process.component.html index 26a19c2..88508ce 100644 --- a/HRM.UI/ClientApp/src/app/payroll-ot/bonus-process/bonus-process.component.html +++ b/HRM.UI/ClientApp/src/app/payroll-ot/bonus-process/bonus-process.component.html @@ -51,6 +51,21 @@ formControlName="cutOffDate" style="width:100%"> +
+ + +
+ @for (religion of bonusReligions; track religion.id; let i = $index) { + + {{ i + 1 }}{{ religion.name }} + + } @empty { + + {{ selectedbonusID > 0 ? 'No Religion set for this Bonus' : 'Select Bonus Type first' }} + + } +
+
diff --git a/HRM.UI/ClientApp/src/app/payroll-ot/bonus-process/bonus-process.component.ts b/HRM.UI/ClientApp/src/app/payroll-ot/bonus-process/bonus-process.component.ts index 0e66f1c..2d9af1f 100644 --- a/HRM.UI/ClientApp/src/app/payroll-ot/bonus-process/bonus-process.component.ts +++ b/HRM.UI/ClientApp/src/app/payroll-ot/bonus-process/bonus-process.component.ts @@ -7,6 +7,7 @@ import {DataTransferService} from '../../data.transfer.service'; import {loadingPanelService} from '../../hrm-loding panel/loding.panel.service'; import {PayrollType} from '../../_models/Authentication/payrollType'; import {Bonus} from '../../_models/Basic/bonus'; +import {Religion} from '../../_models/HRBasic/religion'; import {Employee} from '../../_models/Employee/employee'; import {EmployeeLite} from '../../_models/Employee/employeeLite'; import {SearchEmployee} from '../../_models/Employee/searchEmployee'; @@ -48,6 +49,8 @@ export class BonusProcessComponent implements OnInit { selectedEmps: SearchEmployee[]; bonuses: Bonus[]; selectedbonusID: number; + // religions set on the selected bonus (Bonus master), shown read-only in order + bonusReligions: Religion[] = []; basicDate: Date; payDate: Date = new Date(); cuttofDate: Date; @@ -550,6 +553,31 @@ export class BonusProcessComponent implements OnInit { this.selectedEmps = []; this.processCompleted = false; this.pbuttonEnalble = false; + this.LoadBonusReligions(value); + } + + // Religion list = only the religions set on the selected bonus + // (bonusID comes from the dropdown's valueChange, which can fire before ngModel updates selectedbonusID) + LoadBonusReligions(bonusID: number) { + this.bonusReligions = []; + if (bonusID == undefined || bonusID == null || bonusID <= 0) { + return; + } + this.loadingPanelService.ShowLoadingPanel = true; + this.basicService.getBonusReligions(bonusID).subscribe( + (x) => { + // ignore a late answer for a bonus that is no longer selected + if (bonusID == this.bonusProcessForm.get('bonusType').value) { + this.bonusReligions = x || []; + } + }, + (x) => { + this.loadingPanelService.ShowLoadingPanel = false; + this.notificationService.showError(x.error); + }, + () => { + this.loadingPanelService.ShowLoadingPanel = false; + }); } TaxRecalculate() { this.loadingPanelService.ShowLoadingPanel = true; diff --git a/HRM.UI/Controllers/Basic/BasicController.cs b/HRM.UI/Controllers/Basic/BasicController.cs index d4f6899..a4c11c6 100644 --- a/HRM.UI/Controllers/Basic/BasicController.cs +++ b/HRM.UI/Controllers/Basic/BasicController.cs @@ -295,6 +295,22 @@ namespace HRM.UI.Controllers.Basic return Ok(item); } + [HttpGet("getBonusReligions/{bonusID}")] + public ActionResult GetBonusReligions(int bonusID) + { + List items = new List(); + try + { + items = _bonusService.GetReligions(bonusID); + } + catch (Exception ex) + { + return StatusCode(StatusCodes.Status500InternalServerError, ex.Message); + } + + return Ok(items); + } + // Category [HttpGet("getAllCategory/{status}/{code}/{name}")] public ActionResult GetAllCategory(EnumStatus status, string code, string name)