Add institution contract workflow count functionality to admin workflow
This commit is contained in:
@@ -136,6 +136,9 @@
|
||||
<div class="card-title">قرارداد های مالی</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="countNumber" id="InstitutionContractCount">
|
||||
<span></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="spinner-loading loading" style="display: none;">
|
||||
<span class="spinner-border spinner-border-sm loading text-white" role="status" aria-hidden="true"></span>
|
||||
@@ -192,6 +195,7 @@
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
workFlowStartAndLeftWorkCountMenu();
|
||||
getInstitutionContractCount();
|
||||
|
||||
$('.loadingButton').on('click', function (e) {
|
||||
if (e.ctrlKey || e.metaKey) {
|
||||
@@ -235,5 +239,29 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getInstitutionContractCount() {
|
||||
$.ajax({
|
||||
async: true,
|
||||
dataType: 'json',
|
||||
url: `@Url.Page("./Index", "InstitutionContractCount")`,
|
||||
headers: { "RequestVerificationToken": antiForgeryTokenLayout },
|
||||
type: 'GET',
|
||||
success: function (response) {
|
||||
if (response.success) {
|
||||
if (response.dataInstitutionContractCount === 0) {
|
||||
$('#InstitutionContractCount').hide();
|
||||
} else {
|
||||
$('#InstitutionContractCount').show();
|
||||
var contractCount = response.dataInstitutionContractCount > 99 ? "+99" : response.dataInstitutionContractCount;
|
||||
$('#InstitutionContractCount span').text(contractCount);
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using _0_Framework.Application;
|
||||
using Company.Domain.WorkshopAccountAgg;
|
||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||
using CompanyManagment.App.Contracts.RollCallService;
|
||||
using CompanyManagment.App.Contracts.Workshop;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -18,13 +19,15 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.WorkFlow
|
||||
private readonly IAuthHelper _authHelper;
|
||||
private readonly IWorkshopAccountRepository _workshopAccountRepository;
|
||||
public int EmployeeDocumentsAwaitingSubmitCount;
|
||||
private readonly IInstitutionContractApplication _institutionContractApplication;
|
||||
private readonly long _roleId;
|
||||
|
||||
public IndexModel(IAdminWorkFlowApplication adminWorkFlowApplication, IAuthHelper authHelper, IWorkshopAccountRepository workshopAccountRepository)
|
||||
public IndexModel(IAdminWorkFlowApplication adminWorkFlowApplication, IAuthHelper authHelper, IWorkshopAccountRepository workshopAccountRepository, IInstitutionContractApplication institutionContractApplication)
|
||||
{
|
||||
_adminWorkFlowApplication = adminWorkFlowApplication;
|
||||
_authHelper = authHelper;
|
||||
_workshopAccountRepository = workshopAccountRepository;
|
||||
_institutionContractApplication = institutionContractApplication;
|
||||
_roleId = authHelper.CurrentAccountInfo().RoleId;
|
||||
|
||||
}
|
||||
@@ -49,5 +52,27 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.WorkFlow
|
||||
dataLeftWorkCount = resultLeftWorkCount,
|
||||
});
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnGetInstitutionContractCount()
|
||||
{
|
||||
try
|
||||
{
|
||||
var institutionContractCount = (await _institutionContractApplication.RegistrationWorkflowMainList()).Count;
|
||||
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
dataInstitutionContractCount = institutionContractCount
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = false,
|
||||
message = ex.Message
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +99,9 @@ namespace ServiceHost.Areas.AdminNew.Pages
|
||||
{
|
||||
var currentAccountId = _authHelper.CurrentAccountId();
|
||||
var accountWorkshops = _workshopAccountRepository.GetList(currentAccountId).Select(x => x.WorkshopId).ToList();
|
||||
int workFlowCount = await _adminWorkFlowApplication.GetWorkFlowCountsForAdmin(accountWorkshops,currentAccountId, _roleId);
|
||||
var permissions = _authHelper.GetPermissions();
|
||||
|
||||
int workFlowCount = await _adminWorkFlowApplication.GetWorkFlowCountsForAdmin(accountWorkshops,currentAccountId, _roleId,permissions);
|
||||
|
||||
|
||||
return new JsonResult(new
|
||||
|
||||
@@ -67,7 +67,7 @@ public interface IAdminWorkFlowApplication
|
||||
#endregion
|
||||
|
||||
Task<int> GetEmployeeDocumentWorkFlowCountsForAdmin(List<long> workshopIds, long roleId);
|
||||
Task<int> GetWorkFlowCountsForAdmin(List<long> workshopIds, long accountId, long roleId);
|
||||
Task<int> GetWorkFlowCountsForAdmin(List<long> workshopIds, long accountId, long roleId, List<int> permissions);
|
||||
Task<int> GetWorkFlowCountForChecker();
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ public interface IAdminWorkFlowApplication
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
Task<int> GetInstitutionContractWorkflowCount();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -3,6 +3,7 @@ using CompanyManagment.App.Contracts.Employee;
|
||||
using WorkFlow.Application.Contracts.AdminWorkFlow;
|
||||
using WorkFlow.Infrastructure.ACL.Employee;
|
||||
using WorkFlow.Infrastructure.ACL.EmployeeDocuments;
|
||||
using WorkFlow.Infrastructure.ACL.InstitutionContract;
|
||||
using WorkFlow.Infrastructure.ACL.Workshop;
|
||||
|
||||
namespace WorkFlow.Application
|
||||
@@ -12,65 +13,76 @@ namespace WorkFlow.Application
|
||||
private readonly IWorkFlowEmployeeDocumentsACL _workFlowEmployeeDocumentsACL;
|
||||
private readonly IWorkFlowWorkshopACL _workFlowWorkshopACL;
|
||||
private readonly IWorkFlowEmployeeACL _workFlowEmployeeACL;
|
||||
private readonly IWorkFlowInstitutionContractACL _workFlowInstitutionContractACL;
|
||||
|
||||
|
||||
public AdminWorkFlowApplication(IWorkFlowEmployeeDocumentsACL workFlowEmployeeDocumentsACL, IWorkFlowWorkshopACL workFlowWorkshopACL, IWorkFlowEmployeeACL workFlowEmployeeACL)
|
||||
public AdminWorkFlowApplication(IWorkFlowEmployeeDocumentsACL workFlowEmployeeDocumentsACL,
|
||||
IWorkFlowWorkshopACL workFlowWorkshopACL, IWorkFlowEmployeeACL workFlowEmployeeACL,
|
||||
IWorkFlowInstitutionContractACL workFlowInstitutionContractACL)
|
||||
{
|
||||
_workFlowEmployeeDocumentsACL = workFlowEmployeeDocumentsACL;
|
||||
_workFlowWorkshopACL = workFlowWorkshopACL;
|
||||
_workFlowEmployeeACL = workFlowEmployeeACL;
|
||||
_workFlowInstitutionContractACL = workFlowInstitutionContractACL;
|
||||
}
|
||||
|
||||
#region Pooya
|
||||
|
||||
public List<WorkshopWithDocumentsViewModelForWorkFlow> GetWorkshopDocumentsAwaitingReviewForChecker(List<long> workshops)
|
||||
public List<WorkshopWithDocumentsViewModelForWorkFlow> GetWorkshopDocumentsAwaitingReviewForChecker(
|
||||
List<long> workshops)
|
||||
{
|
||||
return _workFlowEmployeeDocumentsACL.GetWorkshopDocumentsAwaitingReviewForChecker(workshops);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public async Task<int> GetEmployeeDocumentWorkFlowCountsForAdmin(List<long> workshopIds,long roleId)
|
||||
public async Task<int> GetEmployeeDocumentWorkFlowCountsForAdmin(List<long> workshopIds, long roleId)
|
||||
{
|
||||
var count = 0;
|
||||
count += await _workFlowEmployeeDocumentsACL.GetWorkshopDocumentRejectedForAdmin(workshopIds,roleId);
|
||||
count += await _workFlowEmployeeDocumentsACL.GetWorkshopDocumentRejectedForAdmin(workshopIds, roleId);
|
||||
|
||||
count+= await _workFlowEmployeeDocumentsACL.GetCreatedEmployeesWorkshopDocumentForAdmin(workshopIds,roleId);
|
||||
count += await _workFlowEmployeeDocumentsACL.GetCreatedEmployeesWorkshopDocumentForAdmin(workshopIds,
|
||||
roleId);
|
||||
|
||||
//count+= await _workFlowEmployeeDocumentsACL.GetClientRejectedDocumentWorkshopsForAdmin(workshopIds, roleId);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
public async Task<int> GetWorkFlowCountsForAdmin(List<long> workshopIds, long accountId,long roleId)
|
||||
public async Task<int> GetWorkFlowCountsForAdmin(List<long> workshopIds, long accountId, long roleId,
|
||||
List<int> permissions)
|
||||
{
|
||||
var employeeDocumentWorkFlowCounts = await GetEmployeeDocumentWorkFlowCountsForAdmin(workshopIds, roleId);
|
||||
var startWork = await GetWorkshopsForEmployeeStartWorkCount(accountId);
|
||||
var leftWork = await GetWorkshopsForLeftWorkTempCount(accountId);
|
||||
int institutionContract = 0;
|
||||
if (permissions.Any(x => x == 1004))
|
||||
{
|
||||
institutionContract = await GetInstitutionContractWorkflowCount();
|
||||
}
|
||||
|
||||
return employeeDocumentWorkFlowCounts + startWork + leftWork;
|
||||
return employeeDocumentWorkFlowCounts + startWork + leftWork +institutionContract;
|
||||
}
|
||||
|
||||
public async Task<int> GetWorkFlowCountForChecker()
|
||||
{
|
||||
return await _workFlowEmployeeDocumentsACL.GetCheckerWorkFlowCount();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<WorkshopWithDocumentsViewModelForWorkFlow> GetWorkshopsWithDocumentsAwaitingUploadForAdmin(List<long> workshops)
|
||||
public List<WorkshopWithDocumentsViewModelForWorkFlow> GetWorkshopsWithDocumentsAwaitingUploadForAdmin(
|
||||
List<long> workshops)
|
||||
{
|
||||
return _workFlowEmployeeDocumentsACL.GetWorkshopsWithDocumentsAwaitingUploadForAdmin(workshops);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mahan
|
||||
|
||||
#region شروع به کار پرسنل افزوده شده
|
||||
public async Task<ICollection<WorkshopWithStartedWorkWorkFlowViewModel>> GetWorkshopsForEmployeeStartWork(long accountId)
|
||||
|
||||
public async Task<ICollection<WorkshopWithStartedWorkWorkFlowViewModel>> GetWorkshopsForEmployeeStartWork(
|
||||
long accountId)
|
||||
{
|
||||
return await _workFlowWorkshopACL.GetWorkshopsForEmployeeStartWork(accountId);
|
||||
}
|
||||
@@ -81,14 +93,14 @@ namespace WorkFlow.Application
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public async Task<ICollection<ClientStartedWorkEmployeesWorkFlowViewModel>> GetClientEmployeesStartWork(long workshopId)
|
||||
public async Task<ICollection<ClientStartedWorkEmployeesWorkFlowViewModel>> GetClientEmployeesStartWork(
|
||||
long workshopId)
|
||||
{
|
||||
return await _workFlowEmployeeACL.GetClientEmployeesStartWork(workshopId);
|
||||
}
|
||||
|
||||
public async Task<GetEditEmployeeInEmployeeDocumentViewModel> GetEmployeeEditInEmployeeDocumentWorkFlow(long employeeId, long workshopId)
|
||||
public async Task<GetEditEmployeeInEmployeeDocumentViewModel> GetEmployeeEditInEmployeeDocumentWorkFlow(
|
||||
long employeeId, long workshopId)
|
||||
{
|
||||
return await _workFlowEmployeeACL.GetEmployeeEditInEmployeeDocumentWorkFlow(employeeId, workshopId);
|
||||
}
|
||||
@@ -103,16 +115,24 @@ namespace WorkFlow.Application
|
||||
|
||||
#region ترک کار موقت
|
||||
|
||||
public async Task<ICollection<WorkshopWithLeftWorkWorkFlowViewModel>> GetWorkshopsForLeftWorkTemp(long accountId)
|
||||
public async Task<ICollection<WorkshopWithLeftWorkWorkFlowViewModel>> GetWorkshopsForLeftWorkTemp(
|
||||
long accountId)
|
||||
{
|
||||
return await _workFlowWorkshopACL.GetWorkshopsForLeftWorkTemp(accountId);
|
||||
}
|
||||
|
||||
public async Task<int> GetWorkshopsForLeftWorkTempCount(long accountId)
|
||||
{
|
||||
return await _workFlowWorkshopACL.GetWorkshopsForLeftWorkTempCount(accountId);
|
||||
}
|
||||
|
||||
public async Task<ICollection<ClientLeftWorkEmployeesWorkFlowViewModel>> GetEmployeesForLeftWorkTemp(long workshopId)
|
||||
public async Task<int> GetInstitutionContractWorkflowCount()
|
||||
{
|
||||
return await _workFlowInstitutionContractACL.GetInstitutionContractWorkflowCount();
|
||||
}
|
||||
|
||||
public async Task<ICollection<ClientLeftWorkEmployeesWorkFlowViewModel>> GetEmployeesForLeftWorkTemp(
|
||||
long workshopId)
|
||||
{
|
||||
return await _workFlowEmployeeACL.GetEmployeesForLeftWorkTemp(workshopId);
|
||||
}
|
||||
@@ -121,7 +141,8 @@ namespace WorkFlow.Application
|
||||
|
||||
#region آپلود مدارک پرسنل
|
||||
|
||||
public async Task<ICollection<WorkshopWithDocumentsViewModelForWorkFlow>> GetWorkshopDocumentCreatedEmployeeForAdmin(List<long> workshops, long roleId)
|
||||
public async Task<ICollection<WorkshopWithDocumentsViewModelForWorkFlow>>
|
||||
GetWorkshopDocumentCreatedEmployeeForAdmin(List<long> workshops, long roleId)
|
||||
{
|
||||
return await _workFlowEmployeeDocumentsACL.GetWorkshopDocumentCreatedEmployeeForAdmin(workshops, roleId);
|
||||
}
|
||||
@@ -130,6 +151,4 @@ namespace WorkFlow.Application
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -58,4 +58,5 @@ public class WorkFlowEmployeeACL : IWorkFlowEmployeeACL
|
||||
{
|
||||
return await _employeeApplication.EditEmployeeInEmployeeDocumentWorkFlow(command);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
namespace WorkFlow.Infrastructure.ACL.InstitutionContract;
|
||||
|
||||
public interface IWorkFlowInstitutionContractACL
|
||||
{
|
||||
Task<int> GetInstitutionContractWorkflowCount();
|
||||
}
|
||||
|
||||
public class WorkFlowInstitutionContractACL : IWorkFlowInstitutionContractACL
|
||||
{
|
||||
private readonly IInstitutionContractApplication _institutionContractApplication;
|
||||
public WorkFlowInstitutionContractACL(IInstitutionContractApplication institutionContractApplication)
|
||||
{
|
||||
_institutionContractApplication = institutionContractApplication;
|
||||
}
|
||||
|
||||
public async Task<int> GetInstitutionContractWorkflowCount()
|
||||
{
|
||||
var list = await _institutionContractApplication.RegistrationWorkflowMainList();
|
||||
return list.Count;
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ using WorkFlow.Infrastructure.ACL.Checkout;
|
||||
using WorkFlow.Infrastructure.ACL.CustomizedWorkshopSettings;
|
||||
using WorkFlow.Infrastructure.ACL.Employee;
|
||||
using WorkFlow.Infrastructure.ACL.EmployeeDocuments;
|
||||
using WorkFlow.Infrastructure.ACL.InstitutionContract;
|
||||
using WorkFlow.Infrastructure.ACL.RollCall;
|
||||
using WorkFlow.Infrastructure.ACL.Workshop;
|
||||
using WorkFlow.Infrastructure.EfCore;
|
||||
@@ -33,8 +34,7 @@ namespace WorkFlow.Infrastructure.Config
|
||||
services.AddTransient<IWorkFlowRollCallACL, WorkFlowRollCallACL>();
|
||||
services.AddTransient<IWorkFlowCustomizedWorkshopSettingsACL, WorkFlowCustomizedWorkshopSettingsACL>();
|
||||
services.AddTransient<IWorkFlowEmployeeACL, WorkFlowEmployeeACL>();
|
||||
|
||||
|
||||
services.AddTransient<IWorkFlowInstitutionContractACL, WorkFlowInstitutionContractACL>();
|
||||
services.AddTransient<IWorkFlowWorkshopACL, WorkFlowWorkshopACL>();
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user