new inurancelist bug fixed - FiexedSalary changes added

This commit is contained in:
SamSys
2025-06-08 16:20:30 +03:30
8 changed files with 170 additions and 65 deletions

View File

@@ -64,9 +64,9 @@ public interface IInsuranceListRepository:IRepository<long, InsuranceList>
#region Mahan
Task<InsuranceListConfirmOperation> GetInsuranceOperationDetails(long id);
Task<InsuranceListTabsCountViewModel> GetTabCounts(long accountId,int month,int year);
Task<InsuranceListTabsCountViewModel> GetTabCounts(InsuranceListSearchModel searchModel);
#endregion
#endregion
}

View File

@@ -44,7 +44,7 @@ public interface IInsuranceListApplication
Task<OperationResult> ConfirmInsuranceOperation(InsuranceListConfirmOperation command);
Task<InsuranceListConfirmOperation> GetInsuranceOperationDetails(long id);
Task<InsuranceListTabsCountViewModel> GetTabCounts(long accountId, int month, int year);
Task<InsuranceListTabsCountViewModel> GetTabCounts(InsuranceListSearchModel searchModel);
#endregion
#endregion
}

View File

@@ -2342,9 +2342,9 @@ public class InsuranceListApplication : IInsuranceListApplication
return _insuranceListRepositpry.GetInsuranceOperationDetails(id);
}
public Task<InsuranceListTabsCountViewModel> GetTabCounts(long accountId, int month, int year)
public Task<InsuranceListTabsCountViewModel> GetTabCounts(InsuranceListSearchModel searchModel)
{
return _insuranceListRepositpry.GetTabCounts(accountId, month, year);
return _insuranceListRepositpry.GetTabCounts(searchModel);
}
#endregion

View File

@@ -1492,33 +1492,108 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
return res.ToList();
}
public async Task<InsuranceListTabsCountViewModel> GetTabCounts(long accountId, int month, int year)
{
var workshopIds = _context.WorkshopAccounts
.Where(a => a.AccountId == accountId)
.Select(a => a.WorkshopId);
var res = await _context.InsuranceListSet
.Where(x =>
x.Year == year.ToString("0000") &&
x.Month == month.ToString("00") &&
workshopIds.Contains(x.WorkshopId)
)
.GroupBy(x => 1)
.Select(g => new InsuranceListTabsCountViewModel
{
NotStarted = g.Count(x =>
!x.Debt.IsDone && !x.EmployerApproval.IsDone && !x.Inspection.IsDone && !x.ConfirmSentlist),
InProgress = g.Count(x =>
(x.Debt.IsDone || x.EmployerApproval.IsDone || x.Inspection.IsDone)&& !(x.Debt.IsDone && x.EmployerApproval.IsDone && x.Inspection.IsDone) && !x.ConfirmSentlist),
ReadyToSendList = g.Count(x =>
x.Debt.IsDone && x.EmployerApproval.IsDone && x.Inspection.IsDone && !x.ConfirmSentlist),
Done = g.Count(x => x.ConfirmSentlist)
})
.FirstOrDefaultAsync() ?? new InsuranceListTabsCountViewModel();
public async Task<InsuranceListTabsCountViewModel> GetTabCounts(InsuranceListSearchModel searchModel)
{
var acountId = _authHelper.CurrentAccountId();
return res;
var workshopIds = _context.WorkshopAccounts
.Where(a => a.AccountId == acountId)
.Select(a => a.WorkshopId);
var query = _context.InsuranceListSet
.Where(x => workshopIds.Contains(x.WorkshopId))
.Join(_context.Workshops.Include(x => x.InsuranceWorkshopInfo),
insurance => insurance.WorkshopId,
workshop => workshop.id,
(insurance, workshop) => new { insurance, workshop })
.GroupJoin(_context.WorkshopEmployers,
result => result.workshop.id,
employer => employer.WorkshopId,
(result, employer) => new { result.insurance, result.workshop, employer })
.Select(result => new InsuranceListViewModel
{
Id = result.insurance.id,
Year = result.insurance.Year,
Month = result.insurance.Month,
WorkShopId = result.insurance.WorkshopId,
WorkShopCode = result.workshop.InsuranceWorkshopInfo != null ? result.workshop.InsuranceWorkshopInfo.InsuranceCode : result.workshop.InsuranceCode,
WorkShopName = result.workshop.InsuranceWorkshopInfo != null ? result.workshop.InsuranceWorkshopInfo.WorkshopName : result.workshop.WorkshopFullName,
TypeOfInsuranceSend = result.workshop.TypeOfInsuranceSend == "NormalList" ? "عادی" :
result.workshop.TypeOfInsuranceSend == "Govermentlist" ? "کمک دولت" :
result.workshop.TypeOfInsuranceSend == "Familylist" ? "خانوادگی" : "",
FixedSalary = result.workshop.FixedSalary,
EmployerName = result.workshop.InsuranceWorkshopInfo != null ? result.workshop.InsuranceWorkshopInfo.EmployerName : result.workshop.WorkshopFullName,
ConfirmSentlist = result.insurance.ConfirmSentlist,
EmployerId = result.employer.First().EmployerId,
DebtDone = result.insurance.Debt.IsDone,
EmployerApproved = result.insurance.EmployerApproval.IsDone,
InspectionDone = result.insurance.Inspection.IsDone
});
}
if (!string.IsNullOrEmpty(searchModel.Year) && searchModel.Year != "0" && !string.IsNullOrEmpty(searchModel.Month) && searchModel.Month != "0")
query = query.Where(x => x.Year == searchModel.Year && x.Month == searchModel.Month);
else
{
if (!string.IsNullOrEmpty(searchModel.Month) && searchModel.Month != "0")
query = query.Where(x => x.Month == searchModel.Month);
if (!string.IsNullOrEmpty(searchModel.Year) && searchModel.Year != "0")
query = query.Where(x => x.Year == searchModel.Year);
}
if (!string.IsNullOrEmpty(searchModel.WorkShopCode))
query = query.Where(x => x.WorkShopCode == searchModel.WorkShopCode);
if (!string.IsNullOrEmpty(searchModel.WorkShopName))
query = query.Where(x => x.WorkShopName.Contains(searchModel.WorkShopName));
if (searchModel.WorkshopId > 0)
{
var workshopName = query.FirstOrDefault(u => u.WorkShopId == searchModel.WorkshopId)?.WorkShopName;
query = query.Where(x => x.WorkShopName.Contains(workshopName));
}
if (searchModel.EmployerId > 0)
{
var employerName = query.FirstOrDefault(u => u.EmployerId == searchModel.EmployerId)?.EmployerName;
query = query.Where(x => x.EmployerName.Contains(employerName));
}
if (!string.IsNullOrEmpty(searchModel.EmployerName))
query = query.Where(x => x.EmployerName.Contains(searchModel.EmployerName));
if (searchModel.FixedSalary != null)
query = query.Where(x => x.FixedSalary == searchModel.FixedSalary);
if (!string.IsNullOrEmpty(searchModel.TypeOfInsuranceSend) && searchModel.TypeOfInsuranceSend != "0")
query = query.Where(x => x.TypeOfInsuranceSend == searchModel.TypeOfInsuranceSend);
if (!string.IsNullOrEmpty(searchModel.City) && searchModel.City != "0")
query = query.Where(x => x.City == searchModel.City);
if (!string.IsNullOrEmpty(searchModel.Branch))
query = query.Where(x => x.Branch.Contains(searchModel.Branch));
var res = await query.GroupBy(x => 1)
.Select(g => new InsuranceListTabsCountViewModel
{
NotStarted = g.Count(x =>
!x.DebtDone && !x.EmployerApproved && !x.InspectionDone && !x.ConfirmSentlist),
InProgress = g.Count(x =>
(x.DebtDone || x.EmployerApproved || x.InspectionDone) && !(x.DebtDone && x.EmployerApproved && x.InspectionDone) && !x.ConfirmSentlist),
ReadyToSendList = g.Count(x =>
x.DebtDone && x.EmployerApproved && x.InspectionDone && !x.ConfirmSentlist),
Done = g.Count(x => x.ConfirmSentlist)
})
.FirstOrDefaultAsync() ?? new InsuranceListTabsCountViewModel();
return res;
}
/// <summary>
///

View File

@@ -156,7 +156,7 @@
<div class="">
<select class="form-control" asp-for="searchModel.Year">
<option value="0" disabled="disabled">سال</option>
<option value="0">سال</option>
@foreach (string year in @Model.YearlyList)
{
if (Model.CurrentYear_ == year)
@@ -173,7 +173,7 @@
<div class="">
<select class="form-control form-select" asp-for="searchModel.Month">
<option value="0" disabled="disabled">ماه</option>
<option value="0">ماه</option>
<option value="01">فروردین</option>
<option value="02">اردیبهشت</option>
<option value="03">خرداد</option>
@@ -224,17 +224,17 @@
</select>
</div>
<div class="tw-col-span-2">
@* <div class="tw-col-span-2">
<input class="form-control form-control-custom" asp-for="searchModel.Branch" placeholder="شعبه تامین اجتماعی" style="width: 100%">
</div>
</div> *@
<div class="">
@* <div class="">
<div class="belowRow tw-mt-0">
<select class="form-control form-control-custom" style="width: 100%" asp-for="searchModel.City">
<option value="0" selected>شهرستان</option>
</select>
</div>
</div>
</div> *@
<div class="">
<div class="belowRow tw-mt-0">
@@ -247,7 +247,7 @@
</div>
<div class="tw-col-span-2 tw-flex tw-items-center tw-gap-4">
<button class="btn-search-click tw-flex tw-w-[50%] tw-items-center tw-justify-center tw-gap-2 tw-rounded-[5px] tw-bg-[#84CC16] tw-p-[4px] tw-text-white" id="searchBtn" type="submit">
<button class="btn-search-click tw-flex tw-w-[50%] tw-items-center tw-justify-center tw-gap-2 tw-rounded-[5px] tw-bg-[#84CC16] tw-p-[4px] tw-text-white tw-transition tw-ease-in-out hover:tw-bg-[#7DC215]" id="searchBtn" type="submit">
<span>جستجو</span>
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none">
<circle cx="11" cy="11" r="6" stroke="white" stroke-width="2"/>
@@ -274,7 +274,7 @@
<div class="tw-mb-2 tw-mb-4 tw-flex tw-items-center tw-justify-between tw-gap-2">
<div class="tw-w-full">
<select class="form-control" asp-for="searchModel.Year">
<option value="0" disabled="disabled">سال</option>
<option value="0">سال</option>
@foreach (var year in Model.YearlyList)
{
<option value=@year>@year</option>
@@ -283,7 +283,7 @@
</div>
<div class="tw-w-full">
<select class="form-control" asp-for="searchModel.Month">
<option value="0" disabled="disabled">ماه</option>
<option value="0">ماه</option>
<option value="01">فروردین</option>
<option value="02">اردیبهشت</option>
<option value="03">خرداد</option>
@@ -320,19 +320,19 @@
<div class="mb-2 tw-flex tw-flex-col">
<div class="custom-scrollbar-x tw-w-full tw-overflow-x-auto">
<div class="tab-bar tw-flex tw-w-max tw-gap-3 tw-whitespace-nowrap">
<button permission="80217" type="button" class="tab-bar__tab u-tactile tab-bar__tab--active js-document-click" value="0">
<button permission="80217" data-permission="80217" type="button" class="tab-bar__tab u-tactile tab-bar__tab--active js-document-click" value="0">
<span class="tab-bar__tab-label"> انجام نشده</span>
<span class="tab-bar__tab-badge" id="notStarted"></span>
</button>
<button permission="80218" type="button" class="tab-bar__tab u-tactile js-document-click" value="1">
<button permission="80218" data-permission="80218" type="button" class="tab-bar__tab u-tactile js-document-click" value="1">
<span class="tab-bar__tab-label">در حال انجام امور</span>
<span class="tab-bar__tab-badge" id="inProgress"></span>
</button>
<button permission="80219" type="button" class="tab-bar__tab u-tactile js-document-click" value="2">
<button permission="80219" data-permission="80219" type="button" class="tab-bar__tab u-tactile js-document-click" value="2">
<span class="tab-bar__tab-label">آماده ارسال لیست</span>
<span class="tab-bar__tab-badge" id="readyToSendList"></span>
</button>
<button permission="80220" type="button" class="tab-bar__tab u-tactile js-document-click" value="3">
<button permission="80220" data-permission="80220" type="button" class="tab-bar__tab u-tactile js-document-click" value="3">
<span class="tab-bar__tab-label">انجام بیمه</span>
<span class="tab-bar__tab-badge" id="done"></span>
</button>
@@ -399,6 +399,7 @@
<div class="tw-flex tw-h-[35px] tw-items-center tw-justify-center tw-text-[16px]">
</div>
<div>
</div>
</div>
@@ -478,19 +479,19 @@
</div>
</div>
<div class="tw-col-span-2 md:tw-col-span-2">
@* <div class="tw-col-span-2 md:tw-col-span-2">
<div class="form-group">
<input class="form-control form-control-custom" asp-for="searchModel.Branch" placeholder="شعبه تامین اجتماعی" style="width: 100%">
</div>
</div>
</div> *@
<div class="tw-col-span-2 md:tw-col-span-2">
@* <div class="tw-col-span-2 md:tw-col-span-2">
<div class="form-group">
<select class="form-control form-control-custom" style="width: 100%" asp-for="searchModel.City">
<option value="0" selected>شهرستان</option>
</select>
</div>
</div>
</div> *@
<div class="tw-col-span-2 md:tw-col-span-2">
<div class="form-group">
@@ -555,9 +556,14 @@
var hasPermission_80214 = @(permissionList.Contains(80214) ? "true" : "false");
var hasPermission_80215 = @(permissionList.Contains(80215) ? "true" : "false");
var hasPermission_80216 = @(permissionList.Contains(80216) ? "true" : "false");
//new Permission
// var hasPermission_80217 = true;
var permissions = {
80217: @permissionList.Contains(80217).ToString().ToLower(),
80218: @permissionList.Contains(80218).ToString().ToLower(),
80219: @permissionList.Contains(80219).ToString().ToLower(),
80220: @permissionList.Contains(80220).ToString().ToLower()
};
</script>
<script src="~/assetsadmin/page/insurancelist/js/index.js?ver=@adminVersion"></script>
}

View File

@@ -1109,8 +1109,12 @@ public class IndexModel : PageModel
public async Task<IActionResult> OnGetTabCounts(int month, int year)
{
var accountId = _authHelper.CurrentAccountId();
var resultData = await _insuranceListApplication.GetTabCounts(accountId, month, year);
var searchModel = new InsuranceListSearchModel()
{
Year = year.ToString("0000"),
Month = month.ToString("00")
};
var resultData = await _insuranceListApplication.GetTabCounts(searchModel);
return new JsonResult(new
{

View File

@@ -42,8 +42,8 @@ $(document).ready(function () {
"workshop-id",
"workshop-name",
"type-of-insurance",
"branch",
"city",
//"branch",
//"city",
"fixed-salary"
]);
@@ -55,8 +55,8 @@ $(document).ready(function () {
$("#searchModel_WorkshopId").val(paramsUrl['workshop-id']);
paramsUrl['workshop-id'] !== "" && $("#empSearchWorkshop").val(paramsUrl['workshop-name']).addClass('selectedOption');
paramsUrl['type-of-insurance'] === "" ? $("#searchModel_TypeOfInsuranceSend").val("0").trigger("change") : $("#searchModel_TypeOfInsuranceSend").val(paramsUrl['type-of-insurance']).trigger("change");
$("#searchModel_Branch").val(paramsUrl['branch']);
paramsUrl['city'] === "" ? $("#searchModel_City").val(0).trigger("change") : $("#searchModel_City").val(paramsUrl['city']).trigger("change");
//$("#searchModel_Branch").val(paramsUrl['branch']);
//paramsUrl['city'] === "" ? $("#searchModel_City").val(0).trigger("change") : $("#searchModel_City").val(paramsUrl['city']).trigger("change");
paramsUrl['fixed-salary'] === "" ? $("#searchModel_FixedSalary").val(0).trigger("change") : $("#searchModel_FixedSalary").val(paramsUrl['fixed-salary']).trigger("change");
var isAnyNotEmpty = false;
@@ -131,8 +131,8 @@ $(document).ready(function () {
.addParam("workshop-id", $("#searchModel_WorkshopId").val() === "0" ? "" : $("#searchModel_WorkshopId").val())
.addParam("workshop-name", $("#empSearchWorkshop").val())
.addParam("type-of-insurance", $("#searchModel_TypeOfInsuranceSend").val())
.addParam("branch", $("#searchModel_Branch").val())
.addParam("city", $("#searchModel_City").val())
//.addParam("branch", $("#searchModel_Branch").val())
//.addParam("city", $("#searchModel_City").val())
.addParam("fixed-salary", $("#searchModel_FixedSalary").val())
.pushState();
@@ -149,8 +149,27 @@ $(document).ready(function () {
$('.btn-clear-filter').removeClass('disable');
});
$('#closeModal').click(function () {
$('#MainModal').modal('hide');
});
loadGetTabCounts();
loadSearchNew();
//loadSearchNew();
// Active Tabs by Permission and Load Search New Function
let found = false;
$(".tab-bar__tab").removeClass("tab-bar__tab--active");
$(".tab-bar__tab").each(function () {
var permission = $(this).data("permission");
if (!found && permissions[permission] === true || permissions[permission] === "true") {
$(this).addClass("tab-bar__tab--active");
var status = parseInt($(this).val());
loadSearchNew(status);
found = true;
}
});
});
function removeSearch() {
@@ -216,8 +235,8 @@ function loadSearchNew(status = 0) {
"employee-id",
"workshop-id",
"type-of-insurance",
"branch",
"city",
//"branch",
//"city",
"fixed-salary"
]);
@@ -228,8 +247,8 @@ function loadSearchNew(status = 0) {
EmployerId: paramsUrl['employee-id'],
WorkshopId: paramsUrl['workshop-id'],
TypeOfInsuranceSend: paramsUrl['type-of-insurance'],
Branch: paramsUrl['branch'],
City: paramsUrl['city'],
//Branch: paramsUrl['branch'],
//City: paramsUrl['city'],
FixedSalary: paramsUrl['fixed-salary'],
Status: status,
PageIndex: pageIndex
@@ -505,7 +524,8 @@ function generateButtons(item, pathDSKKAR00, pathDSKWOR00) {
}
}
if (item.inspectionDone && item.debtDone && item.employerApproved && item.confirmSentlist) {
//if (item.inspectionDone && item.debtDone && item.employerApproved && item.confirmSentlist) {
if (item.inspectionDone || item.debtDone || item.employerApproved) {
// Confirm List and Print Button
if (hasPermission_80215) {
html += `

File diff suppressed because one or more lines are too long