This commit is contained in:
Zeeshaun
2026-03-17 09:53:09 -05:00
parent cdcba54aa4
commit 1a0702a79a
590 changed files with 62058 additions and 0 deletions
@@ -0,0 +1,73 @@
using LCU.Library.Internal.IncentiveApiModels.Entities;
using LCU.Library.Internal.IncentiveApiModels.Common;
namespace LCU.API.Internal.Operations.IncentiveApi.Models.Payout;
public class DepartmentPayout: IViewTransformable<DepartmentPayout>
{
public DepartmentPayout(AppUser employee, UserDepartment assignment, MonthRange monthRange, IReadOnlyCollection<IPayoutRule> departmentRules, IReadOnlyCollection<IPayoutRule> personalRules)
{
Employee = employee;
MonthRange = monthRange;
DepartmentRules = departmentRules;
PersonalRules = personalRules;
Department = assignment;
EligibleCommissions = new List<Commission>();
EligiblePayouts = PayoutProfile.FindForRole(assignment.Role);
PersonalActivity = new List<Activity>();
PersonalGoals = new List<Goal>();
DepartmentActivity = new List<Activity>();
DepartmentGoals = new List<Goal>();
CommissionPayouts = new List<PayoutLineItem>();
GoalPayouts = new List<PayoutLineItem>();
}
public AppUser Employee { get; }
public MonthRange MonthRange { get; }
public UserDepartment Department { get; }
public IEnumerable<Commission> EligibleCommissions { get; set; }
public IEnumerable<PayoutProfile> EligiblePayouts { get; }
public IEnumerable<Activity> PersonalActivity { get; set; }
public IEnumerable<Goal> PersonalGoals { get; set; }
public IEnumerable<Activity> DepartmentActivity { get; set; }
public IEnumerable<Goal> DepartmentGoals { get; set; }
public IEnumerable<PayoutLineItem> CommissionPayouts { get; set; }
public IEnumerable<PayoutLineItem> GoalPayouts { get; set; }
public IReadOnlyCollection<IPayoutRule> DepartmentRules { get; }
public IReadOnlyCollection<IPayoutRule> PersonalRules { get; }
public bool HasEligibleIncentives()
{
return HasEligibleCommissions() || HasEligibleGoalPayouts();
}
public DepartmentPayout TransformForView()
{
foreach(var activity in DepartmentActivity)
{
activity?.TransformForView();
}
foreach(var activity in PersonalActivity)
{
activity?.TransformForView();
}
return this;
}
public bool HasEligibleActivity()
{
return PersonalActivity != null && PersonalActivity.Any() ||
DepartmentActivity != null && DepartmentActivity.Any();
}
public bool HasEligibleCommissions()
{
return EligibleCommissions != null && EligibleCommissions.Any();
}
public bool HasEligibleGoalPayouts()
{
return EligiblePayouts != null && EligiblePayouts.Any();
}
}
@@ -0,0 +1,7 @@
namespace LCU.API.Internal.Operations.IncentiveApi.Models.Payout;
public enum PayoutStyle
{
Commission,
Goal
}