Amo bug fixed

This commit is contained in:
SamSys
2025-05-26 20:53:56 +03:30
parent ad9f747027
commit 1409d30dfd
8 changed files with 69 additions and 27 deletions

View File

@@ -4,4 +4,6 @@ public class AccountSelectListViewModel
{
public long Id { get; set; }
public string Name { get; set; }
public long RoleId { get; set; }
}

View File

@@ -318,7 +318,8 @@ public class AccountRepository : RepositoryBase<long, Account>, IAccountReposito
return await _context.Accounts.Where(x => x.AdminAreaPermission == "true").Select(x => new AccountSelectListViewModel()
{
Id = x.id,
Name = x.Fullname
Name = x.Fullname,
RoleId = x.RoleId
}).ToListAsync();
}

View File

@@ -46,18 +46,30 @@ public class AdminMonthlyOverviewRepository : RepositoryBase<long, AdminMonthlyO
// دریافت طرف حساب های معتبر برای تاریخ مورد نظر
var contractingPartyIds = _companyContext.InstitutionContractSet.AsNoTracking()
.Where(c => c.ContractStartGr <= targetDate && c.ContractEndGr >= targetDate && c.IsActiveString == "true")
.Where(c => c.ContractStartGr <= targetDate && c.ContractEndGr >= targetDate )
.Select(c => c.ContractingPartyId);
// دریافت کارگاه‌های مرتبط با اکانت
var workshopAccounts = _companyContext.WorkshopAccounts
.AsNoTracking()
.Where(w => w.AccountId == accountId)
.Select(w => w.WorkshopId);
List<long> workshopAccounts;
if (accountId is 2 or 3)
{
workshopAccounts = _companyContext.WorkshopAccounts
.AsNoTracking()
.Where(w => w.AccountId == accountId)
.Select(w => w.WorkshopId).ToList();
}
else
{
workshopAccounts = _accountContext.AccountLeftWorks
.AsNoTracking()
.Where(w => w.AccountId == accountId && w.StartWorkGr <= targetDate && w.LeftWorkGr > targetDate)
.Select(w => w.WorkshopId).ToList();
}
var workshopsHasLeftWorkEmployees = _companyContext.LeftWorkList.Where(x =>
(x.StartWorkDate <= targetDate && x.LeftWorkDate.AddDays(-1) >= targetDate)
|| (x.StartWorkDate <= nextMonth && x.LeftWorkDate.AddDays(-1) >= nextMonth)&& workshopAccounts.Contains(x.WorkshopId)).Select(x=>x.WorkshopId);
var workshopsHasLeftWorkEmployees = _companyContext.LeftWorkList.Where(x =>
((x.StartWorkDate <= targetDate && x.LeftWorkDate.AddDays(-1) >= targetDate)
|| (x.StartWorkDate <= nextMonth && x.LeftWorkDate.AddDays(-1) >= nextMonth)) && workshopAccounts.Contains(x.WorkshopId)).Select(x => x.WorkshopId);
@@ -66,7 +78,7 @@ public class AdminMonthlyOverviewRepository : RepositoryBase<long, AdminMonthlyO
// Replace the selected code with the following to return a list of anonymous objects containing both workshop and contractingParty
var workshopsWithContractingParty = await _companyContext.Workshops
.AsNoTracking()
.Where(w => workshopsHasLeftWorkEmployees.Contains(w.id))
.Where(w => workshopsHasLeftWorkEmployees.Contains(w.id) && w.IsActive)
.Include(w => w.WorkshopEmployers)
.ThenInclude(we => we.Employer)
.ThenInclude(e => e.ContractingParty).AsSplitQuery().
@@ -86,7 +98,7 @@ public class AdminMonthlyOverviewRepository : RepositoryBase<long, AdminMonthlyO
var workshopIds = workshopsWithContractingParty.Select(x => x.Workshop.id).ToList();
// پیدا کردن کارگاه‌هایی که قبلاً برای این ماه/سال AdminMonthlyOverview دارند
var adminMonthlyOverviewWorkshopIds = await _companyContext.AdminMonthlyOverviews
.AsNoTracking()
@@ -110,7 +122,7 @@ public class AdminMonthlyOverviewRepository : RepositoryBase<long, AdminMonthlyO
if (searchModel.ActivationStatus != IsActive.None)
{
var isBlock = searchModel.ActivationStatus == IsActive.True ? "true" : "false";
var isBlock = searchModel.ActivationStatus == IsActive.True ? "false" : "true";
workshopsWithContractingParty = workshopsWithContractingParty
.Where(x => x.ContractingParty?.IsBlock == isBlock).ToList();
@@ -161,7 +173,7 @@ public class AdminMonthlyOverviewRepository : RepositoryBase<long, AdminMonthlyO
Id = x.id,
WorkshopName = workshop?.WorkshopFullName ?? "",
WorkshopArchiveCode = workshop?.ArchiveCode ?? "",
WorkshopArchiveCodeInt = Convert.ToInt32(workshop?.ArchiveCode ?? "0"),
WorkshopArchiveCodeInt = workshop?.ArchiveCode.ExtractIntNumbers() ?? 0,
Address = workshop?.Address ?? "",
City = workshop?.City ?? "",
Province = workshop?.State ?? "",
@@ -173,7 +185,7 @@ public class AdminMonthlyOverviewRepository : RepositoryBase<long, AdminMonthlyO
AgentPhoneNumber = "",
IsBlock = contractingParty?.IsBlock == "true"
};
}).OrderBy(x => x.IsBlock).ThenBy(x=>x.WorkshopArchiveCodeInt).ToList();
}).OrderBy(x => x.IsBlock).ThenBy(x => x.WorkshopArchiveCodeInt).ToList();
return adminMonthlyOverviewList;
@@ -235,7 +247,7 @@ public class AdminMonthlyOverviewRepository : RepositoryBase<long, AdminMonthlyO
.ToHashSet();
var workingCheckoutGrouping = workingCheckoutEmployeeIds.GroupBy(x => x.WorkshopId).ToList();
var workingContractGrouping = workingContractEmployeeIds.GroupBy(x => x.WorkshopId).Select(x => new
{
WorkshopId = x.Key,

View File

@@ -341,7 +341,7 @@ public class ReportRepository : IReportRepository
var allCheckoutToBeTople = allCheckoutLeftworks.Select(x => new { x.EmployeeId, x.WorkshopId }).ToList();
//تمام تصفیه حساب های ایجاد شده ماه مورد نظر
var allCheckoutCreated = _context.CheckoutSet
.Where(x => allCheckoutLeftworkEmployeeIds.Contains(x.EmployeeId))
.Where(x => allCheckoutLeftworkEmployeeIds.Contains(x.EmployeeId) && allCheckoutLeftworkWorkshopIds.Contains(x.WorkshopId))
.Where(x =>
x.ContractStart.Date >= currentMonthStart.Date && x.ContractEnd.Date <= currentMonthEnd.Date && x.IsActiveString == "true");
@@ -404,7 +404,7 @@ public class ReportRepository : IReportRepository
var allContracToBeTople = allContractLeftworks.Select(x => new { x.EmployeeId, x.WorkshopId }).ToList();
var allContractLeftworkWorkshopIds = allContractLeftworks.Select(x => x.WorkshopId).ToList();
var allContractCreated = _context.Contracts
.Where(x => allContractLeftworkEmployeeIds.Contains(x.EmployeeId))
.Where(x => allContractLeftworkEmployeeIds.Contains(x.EmployeeId) && allContractLeftworkWorkshopIds.Contains(x.WorkshopIds))
.Where(x =>
x.ContarctStart.Date <= nextMonthEnd.Date && x.ContractEnd.Date > nextMonthStart.Date && x.IsActiveString == "true");
var allContractCreatedlist = allContractCreated.Select(x => x.WorkshopIds).ToList();

View File

@@ -838,6 +838,25 @@
<label class="btn btn-inverse waves-effect waves-light m-b-5 parent"> <input type="checkbox" value="500" class="check-btn"> &nbsp;<span style="bottom: 2px;position: relative"> امور ماهیانه پرسنل </span>&nbsp;</label>
<div class="child-check level2">
<label class="btn btn-icon waves-effect btn-default m-b-5 open-close">
<i class="ion-plus"></i> <i class="ion-minus" style="display: none;"></i><input type="checkbox" style="display: none" class="open-btn" />
</label>
<label class="btn btn-inverse waves-effect waves-light m-b-5 parentLevel2"> <input type="checkbox" disabled="disabled" value="5001" class="check-btn"> &nbsp;<span style="bottom: 2px;position: relative"> دکمه بعد </span> </label>
</div>
<div class="child-check level2">
<label class="btn btn-icon waves-effect btn-default m-b-5 open-close">
<i class="ion-plus"></i> <i class="ion-minus" style="display: none;"></i><input type="checkbox" style="display: none" class="open-btn" />
</label>
<label class="btn btn-inverse waves-effect waves-light m-b-5 parentLevel2"> <input type="checkbox" disabled="disabled" value="5001" class="check-btn"> &nbsp;<span style="bottom: 2px;position: relative"> دکمه بعد </span> </label>
</div>
@* <div class="child-check level2">
<label class="btn btn-icon waves-effect btn-default m-b-5 open-close">

View File

@@ -1,9 +1,13 @@
@page
@using _0_Framework.Application
@model ServiceHost.Areas.AdminNew.Pages.Company.MonthlyOverview.IndexModel
@inject _0_Framework.Application.IAuthHelper AuthHelper;
@{
var adminVersion = _0_Framework.Application.Version.AdminVersion;
string clientVersion = _0_Framework.Application.Version.StyleVersion;
ViewData["Title"] = " - " + "کارگاه";
var currentAccount = AuthHelper.CurrentAccountInfo();
List<int> permission = currentAccount.Permissions();
}
@section Styles {
@@ -398,6 +402,9 @@
var accountSelectListUrl = `@Url.Page("./Index", "AccountSelectList")`;
var currentMonth = `@Model.SearchModel.Month`;
var adminAccountId = Number(@Model.SearchModel.AdminAccountId);
var nextPermission = @permission.Contains(5001);
var prevPermission = @permission.Contains(5002);
</script>
<script src="~/AssetsAdminNew/monthlyoverview/js/Index.js?ver=@adminVersion"></script>
}

View File

@@ -106,6 +106,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.MonthlyOverview
public async Task<IActionResult> OnGetAccountSelectList()
{
var res = await _accountApplication.GetAdminSelectList();
res = res.Where(x => x.RoleId == 5).ToList();
return new JsonResult(new
{
data = res

View File

@@ -358,7 +358,7 @@ async function loadMonthlyOverviewData() {
'WorkshopId': workshopAndArchive,
'EmployerId': employer,
'AdminAccountId': adminPersonnel !== "0" ? adminPersonnel : adminAccountId,
'ActivationStatus': Number(status)
'ActivationStatus': status !== "" ? Number(status) : 2
};
try {
@@ -599,13 +599,13 @@ function monthlyOverviewStatusDocument(data) {
<div class="monthly-table__cell tw-w-[15%] tw-text-center">${item.agentPhoneNumber}</div>
<div class="monthly-table__cell tw-w-[10%] tw-text-center">${item.adminFullName}</div>
<div class="monthly-table__cell tw-flex tw-w-[10%] tw-justify-end tw-gap-2">
<button class="monthly-table__stage-button u-tactile prev-button ${item.status === 1 ? 'disable' : ''}" aria-label="Edit monthly">
<button class="monthly-table__stage-button u-tactile prev-button ${prevPermission ? 'disable' : ''} ${item.status === 1 ? 'disable' : ''}" aria-label="Edit monthly">
<svg width="17" height="18" viewBox="0 0 17 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M6.62724 13.5L10.5344 9L6.62724 4.5" stroke="white" stroke-width="2" stroke-linecap="round"/>
</svg>
<span>مرحله قبل</span>
</button>
<button class="monthly-table__stage-button u-tactile next-button ${item.status === 4 ? 'disable' : ''}" aria-label="Edit monthly" onclick="handlerStep(${item.id},'next')">
<button class="monthly-table__stage-button u-tactile next-button ${nextPermission ? 'disable' : ''} ${item.status === 4 ? 'disable' : ''}" aria-label="Edit monthly" onclick="handlerStep(${item.id},'next')">
<span>مرحله بعد</span>
<svg width="17" height="18" viewBox="0 0 17 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M10.3726 4.5L6.46545 9L10.3726 13.5" stroke="white" stroke-width="2" stroke-linecap="round"/>
@@ -756,13 +756,13 @@ function monthlyOverviewStatusDocument(data) {
<div class="monthly-table__cell tw-w-[15%] tw-text-center">${item.agentPhoneNumber}</div>
<div class="monthly-table__cell tw-w-[10%] tw-text-center">${item.adminFullName}</div>
<div class="monthly-table__cell tw-flex tw-w-[10%] tw-justify-end tw-gap-2">
<button class="monthly-table__stage-button u-tactile prev-button ${item.status === 1 ? 'disable' : ''}" aria-label="Edit monthly" onclick="handlerStep(${item.id},'prev')">
<button class="monthly-table__stage-button u-tactile prev-button ${prevPermission ? 'disable' : ''} ${item.status === 1 ? 'disable' : ''}" aria-label="Edit monthly" onclick="handlerStep(${item.id},'prev')">
<svg width="17" height="18" viewBox="0 0 17 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M6.62724 13.5L10.5344 9L6.62724 4.5" stroke="white" stroke-width="2" stroke-linecap="round"/>
</svg>
<span>مرحله قبل</span>
</button>
<button class="monthly-table__stage-button u-tactile next-button ${item.status === 4 ? 'disable' : ''}" aria-label="Edit monthly" onclick="handlerStep(${item.id},'next')">
<button class="monthly-table__stage-button u-tactile next-button ${nextPermission ? 'disable' : ''} ${item.status === 4 ? 'disable' : ''}" aria-label="Edit monthly" onclick="handlerStep(${item.id},'next')">
<span>مرحله بعد</span>
<svg width="17" height="18" viewBox="0 0 17 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M10.3726 4.5L6.46545 9L10.3726 13.5" stroke="white" stroke-width="2" stroke-linecap="round"/>
@@ -917,13 +917,13 @@ function monthlyOverviewStatusDocument(data) {
<div class="monthly-table__cell tw-w-[15%] tw-text-center">${item.agentPhoneNumber}</div>
<div class="monthly-table__cell tw-w-[10%] tw-text-center">${item.adminFullName}</div>
<div class="monthly-table__cell tw-flex tw-w-[10%] tw-justify-end tw-gap-2">
<button class="monthly-table__stage-button u-tactile prev-button ${item.status === 1 ? 'disable' : ''}" aria-label="Edit monthly" onclick="handlerStep(${item.id},'prev')">
<button class="monthly-table__stage-button u-tactile prev-button ${prevPermission ? 'disable' : ''} ${item.status === 1 ? 'disable' : ''}" aria-label="Edit monthly" onclick="handlerStep(${item.id},'prev')">
<svg width="17" height="18" viewBox="0 0 17 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M6.62724 13.5L10.5344 9L6.62724 4.5" stroke="white" stroke-width="2" stroke-linecap="round"/>
</svg>
<span>مرحله قبل</span>
</button>
<button class="monthly-table__stage-button u-tactile next-button ${item.status === 4 ? 'disable' : ''}" aria-label="Edit monthly" onclick="handlerStep(${item.id},'next')">
<button class="monthly-table__stage-button u-tactile next-button ${nextPermission ? 'disable' : ''} ${item.status === 4 ? 'disable' : ''}" aria-label="Edit monthly" onclick="handlerStep(${item.id},'next')">
<span>مرحله بعد</span>
<svg width="17" height="18" viewBox="0 0 17 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M10.3726 4.5L6.46545 9L10.3726 13.5" stroke="white" stroke-width="2" stroke-linecap="round"/>
@@ -1078,13 +1078,13 @@ function monthlyOverviewStatusDocument(data) {
<div class="monthly-table__cell tw-w-[15%] tw-text-center">${item.agentPhoneNumber}</div>
<div class="monthly-table__cell tw-w-[10%] tw-text-center">${item.adminFullName}</div>
<div class="monthly-table__cell tw-flex tw-w-[10%] tw-justify-end tw-gap-2">
<button class="monthly-table__stage-button u-tactile prev-button ${item.status === 1 ? 'disable' : ''}" aria-label="Edit monthly" onclick="handlerStep(${item.id},'prev')">
<button class="monthly-table__stage-button u-tactile prev-button ${prevPermission ? 'disable' : ''} ${item.status === 1 ? 'disable' : ''}" aria-label="Edit monthly" onclick="handlerStep(${item.id},'prev')">
<svg width="17" height="18" viewBox="0 0 17 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M6.62724 13.5L10.5344 9L6.62724 4.5" stroke="white" stroke-width="2" stroke-linecap="round"/>
</svg>
<span>مرحله قبل</span>
</button>
<button class="monthly-table__stage-button u-tactile next-button ${item.status === 4 ? 'disable' : ''}" aria-label="Edit monthly">
<button class="monthly-table__stage-button u-tactile next-button ${nextPermission ? 'disable' : ''} ${item.status === 4 ? 'disable' : ''}" aria-label="Edit monthly">
<span>مرحله بعد</span>
<svg width="17" height="18" viewBox="0 0 17 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M10.3726 4.5L6.46545 9L10.3726 13.5" stroke="white" stroke-width="2" stroke-linecap="round"/>
@@ -1521,7 +1521,7 @@ function paramsUrl(year, month, employer, employerName, workshopAndArchive, work
hasAnyFilter = true;
}
if (status !== "2") {
if (status !== "") {
params.set("status", status);
hasAnyFilter = true;
}