Bonus Process Religion SHow

This commit is contained in:
Mohaimen Hasan 2026-11-29 17:52:14 +06:00
parent 79dd1108ee
commit 46de19578e
7 changed files with 141 additions and 0 deletions

View File

@ -210,6 +210,7 @@ namespace HRM.BO
List<Bonus> GetAllBonus(int payrollTypeID, EnumStatus status, string code, string name);
DataSet GetCCWiseBonusSummary(DateTime bMonthDate, string bonus);
DataSet GetCCWiseBonus(DateTime bMonthDate, string bonus);
List<Religion> GetReligions(int bonusID);
}
#endregion

View File

@ -371,6 +371,37 @@ namespace HRM.DA
return bonus;
}
// The religions set on this bonus (BonusReligion), as ID + Name.
public List<Religion> GetReligions(int bonusID)
{
List<Religion> religions = new List<Religion>();
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();

View File

@ -140,6 +140,11 @@ export class BasicService {
'/' + nname);
}
// the religions set on a bonus (Bonus master screen)
getBonusReligions(bonusID: number): Observable<Religion[]> {
return this.apiService.httpGet<Religion[]>('/HRBasic/getBonusReligions/' + bonusID);
}
getBonusByID(id: number) {
return this.apiService.httpGet(this.apiService.base_url + '/getBonusByID' + '/' + id);
}

View File

@ -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;
}

View File

@ -51,6 +51,21 @@
formControlName="cutOffDate"
style="width:100%"></kendo-datepicker>
</div>
<div class="col-12 md:col-6 lg:col-4 bp-field">
<label class="bp-label">Religion</label>
<!-- display only: the religions set on the selected Bonus Type (Bonus master), in order -->
<div class="bp-religions">
@for (religion of bonusReligions; track religion.id; let i = $index) {
<span class="bp-religion">
<span class="bp-religion__no">{{ i + 1 }}</span>{{ religion.name }}
</span>
} @empty {
<span class="bp-religion-empty">
{{ selectedbonusID > 0 ? 'No Religion set for this Bonus' : 'Select Bonus Type first' }}
</span>
}
</div>
</div>
</div>
</div>

View File

@ -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;

View File

@ -295,6 +295,22 @@ namespace HRM.UI.Controllers.Basic
return Ok(item);
}
[HttpGet("getBonusReligions/{bonusID}")]
public ActionResult GetBonusReligions(int bonusID)
{
List<Religion> items = new List<Religion>();
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)