AccountLeftwork change to access admin
31
0_Framework/Application/StaticWorkshopAccounts.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace _0_Framework.Application;
|
||||
|
||||
public static class StaticWorkshopAccounts
|
||||
{
|
||||
/// <summary>
|
||||
/// لیستی آی دی نقش هایی که در زمان ساخت یا ویرایش کارگاه استفاده می شوند
|
||||
/// 3 : قرارداد ارشد
|
||||
/// 5 : قرارداد ساده
|
||||
/// 7 : بیمه ارشد
|
||||
/// 8 : بیمه ساده
|
||||
/// </summary>
|
||||
public static List<long> SelectedAccountsRoleIds = [3, 5, 7, 8];
|
||||
|
||||
/// <summary>
|
||||
/// لیست اکانتهایی که به همه کارگاه ها باید دسترسی داشته باشند
|
||||
/// 2 - صادق فرخی
|
||||
/// 3 - میلاد مصباح
|
||||
/// 380 - افروز نظری
|
||||
/// 381 - مهدی قربانی
|
||||
/// </summary>
|
||||
public static List<long> StaticAccountIds = [2, 3, 380, 381];
|
||||
|
||||
/// <summary>
|
||||
/// این تاریخ در جدول اکانت لفت ورک به این معنیست
|
||||
/// که کاربر همچنان به کارگاه دسترسی دارد
|
||||
/// </summary>
|
||||
public static DateTime ContinuesWorkingDate = new DateTime(2150, 1, 1);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AccountManagement.Application.Contracts.Account;
|
||||
|
||||
public class WorkshopAdminListsViewModel
|
||||
{
|
||||
public List<AccountViewModel> JuniorContractAdmins { get; set; }
|
||||
public List<AccountViewModel> SeniorContractAdmins { get; set; }
|
||||
public List<AccountViewModel> JuniorInsuranceAdmins { get; set; }
|
||||
public List<AccountViewModel> SeniorInsuranceAdmins { get; set; }
|
||||
|
||||
}
|
||||
@@ -29,6 +29,10 @@ namespace AccountManagement.Domain.AccountAgg
|
||||
List<AccountViewModel> GetAccountsDeactivePositionValue(long Positionid);
|
||||
#endregion
|
||||
|
||||
List<AccountViewModel> GetAdminAccountsNew();
|
||||
|
||||
List<AccountViewModel> GetAccountsToEditWorkshop(long workshopId);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,26 +2,56 @@
|
||||
using _0_Framework.Domain;
|
||||
using AccountManagement.Application.Contracts.Account;
|
||||
using AccountManagement.Domain.AccountAgg;
|
||||
using AccountManagement.Domain.RoleAgg;
|
||||
|
||||
namespace AccountManagement.Domain.AccountLeftWorkAgg;
|
||||
|
||||
public class AccountLeftWork : EntityBase
|
||||
{
|
||||
public AccountLeftWork(DateTime startWorkGr, DateTime leftWorkGr, long accountId)
|
||||
public AccountLeftWork(DateTime startWorkGr, DateTime leftWorkGr, long accountId, long workshopId, long roleId)
|
||||
{
|
||||
StartWorkGr = startWorkGr;
|
||||
LeftWorkGr = leftWorkGr;
|
||||
AccountId = accountId;
|
||||
}
|
||||
WorkshopId = workshopId;
|
||||
RoleId = roleId;
|
||||
IsActive = leftWorkGr > DateTime.Now;
|
||||
}
|
||||
|
||||
public DateTime StartWorkGr { get; private set; }
|
||||
public AccountLeftWork(DateTime startWorkGr, DateTime leftWorkGr, long accountId, long workshopId, long roleId, bool isActive)
|
||||
{
|
||||
StartWorkGr = startWorkGr;
|
||||
LeftWorkGr = leftWorkGr;
|
||||
AccountId = accountId;
|
||||
WorkshopId = workshopId;
|
||||
RoleId = roleId;
|
||||
IsActive = isActive;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public DateTime StartWorkGr { get; private set; }
|
||||
public DateTime LeftWorkGr { get; private set; }
|
||||
public long WorkshopId { get; private set; }
|
||||
public long RoleId { get; private set; }
|
||||
public long AccountId { get; private set; }
|
||||
public bool IsActive { get; private set; }
|
||||
public Account Account { get; set; }
|
||||
|
||||
public void Edit(DateTime startWorkGr, DateTime leftWorkGr)
|
||||
public void Edit(DateTime startWorkGr, DateTime leftWorkGr,long workshopId,long roleId,bool isActive)
|
||||
{
|
||||
StartWorkGr = startWorkGr;
|
||||
LeftWorkGr = leftWorkGr;
|
||||
}
|
||||
WorkshopId = workshopId;
|
||||
RoleId = roleId;
|
||||
IsActive = leftWorkGr > DateTime.Now && isActive;
|
||||
}
|
||||
|
||||
public void DeActive(DateTime startWorkGr, DateTime leftWorkGr)
|
||||
{
|
||||
StartWorkGr = startWorkGr;
|
||||
LeftWorkGr = leftWorkGr;
|
||||
IsActive = false;
|
||||
}
|
||||
}
|
||||
@@ -19,4 +19,6 @@ public interface IAccountLeftworkRepository : IRepository<long, AccountLeftWork>
|
||||
string startDate,
|
||||
string leftDate,
|
||||
long accountId);
|
||||
|
||||
|
||||
}
|
||||
1267
AccountMangement.Infrastructure.EFCore/Migrations/20250302141707_cAccountLeftWorkChangedToNew.Designer.cs
generated
Normal file
@@ -0,0 +1,51 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace AccountMangement.Infrastructure.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class cAccountLeftWorkChangedToNew : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsActive",
|
||||
table: "AccountLeftWork",
|
||||
type: "bit",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<long>(
|
||||
name: "RoleId",
|
||||
table: "AccountLeftWork",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
defaultValue: 0L);
|
||||
|
||||
migrationBuilder.AddColumn<long>(
|
||||
name: "WorkshopId",
|
||||
table: "AccountLeftWork",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
defaultValue: 0L);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsActive",
|
||||
table: "AccountLeftWork");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RoleId",
|
||||
table: "AccountLeftWork");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "WorkshopId",
|
||||
table: "AccountLeftWork");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,12 +119,21 @@ namespace AccountMangement.Infrastructure.EFCore.Migrations
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime>("LeftWorkGr")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<long>("RoleId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTime>("StartWorkGr")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<long>("WorkshopId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.HasIndex("AccountId");
|
||||
|
||||
@@ -114,18 +114,20 @@ public class AccountLeftworkRepository : RepositoryBase<long, AccountLeftWork>,
|
||||
return operationResult.Failed("تاریخ شروع بکار و ترک کار برابرند");
|
||||
var oldLefts = _accountContext.AccountLeftWorks.Where(x => x.AccountId == accountId).ToList();
|
||||
_accountContext.AccountLeftWorks.RemoveRange(oldLefts);
|
||||
Create(new AccountLeftWork(start, leftWorkGr, accountId));
|
||||
SaveChanges();
|
||||
var workshopAccountViewModel = workshopAccountList.Select(x => new WorkshopAccountViewModel()
|
||||
{
|
||||
AccountId = x.AccountId,
|
||||
WorkshopId = x.WorkshopId,
|
||||
Insurance = x.Insurance,
|
||||
ContractAndCheckout = x.ContractAndCheckout,
|
||||
Tax = x.Tax,
|
||||
IsActiveSting = x.IsActiveSting
|
||||
}).ToList();
|
||||
_workshopAccountRepository.SaveWorkshopAccount(workshopAccountViewModel);
|
||||
//Create(new AccountLeftWork(start, leftWorkGr, accountId));
|
||||
//SaveChanges();
|
||||
//var workshopAccountViewModel = workshopAccountList.Select(x => new WorkshopAccountViewModel()
|
||||
//{
|
||||
// AccountId = x.AccountId,
|
||||
// WorkshopId = x.WorkshopId,
|
||||
// Insurance = x.Insurance,
|
||||
// ContractAndCheckout = x.ContractAndCheckout,
|
||||
// Tax = x.Tax,
|
||||
// IsActiveSting = x.IsActiveSting
|
||||
//}).ToList();
|
||||
//_workshopAccountRepository.SaveWorkshopAccount(workshopAccountViewModel);
|
||||
return operationResult.Succcedded();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -279,6 +279,39 @@ public class AccountRepository : RepositoryBase<long, Account>, IAccountReposito
|
||||
Fullname = x.Fullname
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
public List<AccountViewModel> GetAdminAccountsNew()
|
||||
{
|
||||
List<long> roleIds = _0_Framework.Application.StaticWorkshopAccounts.SelectedAccountsRoleIds;
|
||||
|
||||
return _context.Accounts
|
||||
.Where(x => x.IsActiveString == "true" && roleIds.Contains(x.RoleId))
|
||||
.Select(x => new AccountViewModel
|
||||
{
|
||||
Id = x.id,
|
||||
Fullname = x.Fullname,
|
||||
RoleName = x.RoleName,
|
||||
Username = x.Username,
|
||||
RoleId = x.RoleId,
|
||||
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
public List<AccountViewModel> GetAccountsToEditWorkshop(long workshopId)
|
||||
{
|
||||
List<long> roleIds = _0_Framework.Application.StaticWorkshopAccounts.SelectedAccountsRoleIds;
|
||||
return _context.AccountLeftWorks
|
||||
.Where(x => x.WorkshopId == workshopId && roleIds.Contains(x.RoleId))
|
||||
.Include(x => x.Account)
|
||||
.Select(x => new AccountViewModel
|
||||
{
|
||||
Id = x.AccountId,
|
||||
Fullname = x.Account.Fullname,
|
||||
RoleName = x.Account.RoleName,
|
||||
RoleId = x.RoleId,
|
||||
IsActiveString = x.IsActive ? "true" : "false",
|
||||
}).ToList();
|
||||
}
|
||||
//public List<AccountViewModel> GetAdminAccounts()
|
||||
//{
|
||||
// return _context.Accounts.Where(x=>x.AdminAreaPermission == "true" && x.IsActiveString == "true").Select(x => new AccountViewModel()
|
||||
|
||||
@@ -25,7 +25,7 @@ public interface ILeftWorkRepository : IRepository<long, LeftWork>
|
||||
/// <param name="dateTime">تاریخی که بین شروع کار و ترک کار باشد</param>
|
||||
/// <returns>یک کلاس از جنس اطلاعات ترک کار</returns>
|
||||
LeftWorkViewModel GetByDateAndWorkshopIdAndEmployeeId(long workshopId, long employeeId, DateTime dateTime);
|
||||
List<long> GetEmployeeIdsByWorkshopIdActiveInDates(long workshopId, DateTime start, DateTime end);
|
||||
List<long> GetAllEmployeeIdsInWorkshop(long workshopId);
|
||||
|
||||
#endregion
|
||||
List<LeftWorkViewModel> GetLeftPersonelByWorkshopId(List<long> workshopIds);
|
||||
|
||||
@@ -72,6 +72,19 @@ public interface IWorkshopRepository : IRepository<long, Workshop>
|
||||
/// <returns></returns>
|
||||
List<WorkshopViewModel> GetWorkshopSelectListInsuransce();
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// ایجاد دسترسی برای کاربران ادمین در زمان ایجاد کارگاه
|
||||
/// </summary>
|
||||
/// <param name="AccountIds"></param>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <returns></returns>
|
||||
OperationResult CreateAccountLeftWorkAndWorkshopAccounts(List<long> accountIds, long workshopId);
|
||||
/// <summary>
|
||||
/// ویرایش دسترسی کاربران ادمین به کارگاه در زمان ویرایش کارگاه
|
||||
/// </summary>
|
||||
/// <param name="AccountIds"></param>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <returns></returns>
|
||||
OperationResult EditAccountLeftWorkAndWorkshopAccounts(List<long> accountIds, long workshopId);
|
||||
}
|
||||
@@ -68,15 +68,40 @@ public class CreateWorkshop
|
||||
public List<long> EmployerIdList { get; set; }
|
||||
|
||||
public CreateWorkshopPlan CreatePlan {get; set; }
|
||||
|
||||
public List<AccountViewModel> AccountsList { get; set; }
|
||||
public List<AccountViewModel> Type { get; set; }
|
||||
|
||||
#region Pooya
|
||||
/// <summary>
|
||||
/// قرارداد ارشد
|
||||
/// </summary>
|
||||
public List<AccountViewModel> JuniorContractAccountsList { get; set; }
|
||||
/// <summary>
|
||||
/// قرارداد ساده
|
||||
/// </summary>
|
||||
public List<AccountViewModel> SeniorContractAccountsList { get; set; }
|
||||
/// <summary>
|
||||
/// بیمه ساده
|
||||
/// </summary>
|
||||
public List<AccountViewModel> JuniorInsuranceAccountsList { get; set; }
|
||||
/// <summary>
|
||||
/// بیمه ارشد
|
||||
/// </summary>
|
||||
public List<AccountViewModel> SeniorInsuranceAccountList { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
public List<long> AccountIdsList { get; set; }
|
||||
|
||||
public SelectList InsuranceJobViewModels { get; set; }
|
||||
public List<int> PermissionIds { get; set; }
|
||||
public long CurrentAccoutRoleId { get; set; }
|
||||
#region Vafa
|
||||
public List<AccountViewModel> InAccountIdsList { get; set; }
|
||||
public string HasRollCallFreeVip { get; set; }
|
||||
public List<AccountViewModel> DeActiveAccounts { get; set; }
|
||||
public List<AccountViewModel> ActiveAccounts { get; set; }
|
||||
public string HasRollCallFreeVip { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -621,7 +621,7 @@ namespace CompanyManagment.Application
|
||||
#region Create EmployeeDocuments Record For Newly Added Employees
|
||||
|
||||
var existingEmployeesWithDocs = _employeeDocumentsRepository.GetEmployeeIds(cmd.WorkshopId);
|
||||
var existingEmployeeIds = _leftWorkRepository.GetEmployeeIdsByWorkshopIdActiveInDates(cmd.WorkshopId, DateTime.Now, DateTime.Now);
|
||||
var existingEmployeeIds = _leftWorkRepository.GetAllEmployeeIdsInWorkshop(cmd.WorkshopId);
|
||||
var newEmployeeIds = existingEmployeeIds.Except(existingEmployeesWithDocs).ToList();
|
||||
|
||||
if (newEmployeeIds.Any())
|
||||
@@ -1022,7 +1022,7 @@ namespace CompanyManagment.Application
|
||||
|
||||
var existingEmployeesWithDocs = _employeeDocumentsRepository.GetEmployeeIds(cmd.WorkshopId);
|
||||
var existingEmployeeIds =
|
||||
_leftWorkRepository.GetEmployeeIdsByWorkshopIdActiveInDates(cmd.WorkshopId, DateTime.Now, DateTime.Now);
|
||||
_leftWorkRepository.GetAllEmployeeIdsInWorkshop(cmd.WorkshopId);
|
||||
|
||||
var newEmployeeIds = existingEmployeeIds.Except(existingEmployeesWithDocs).ToList();
|
||||
|
||||
@@ -1070,7 +1070,7 @@ namespace CompanyManagment.Application
|
||||
|
||||
var existingEmployeesWithDocs = _employeeDocumentsRepository.GetEmployeeIds(workshopId);
|
||||
var existingEmployeeIds =
|
||||
_leftWorkRepository.GetEmployeeIdsByWorkshopIdActiveInDates(workshopId, DateTime.Now, DateTime.Now);
|
||||
_leftWorkRepository.GetAllEmployeeIdsInWorkshop(workshopId);
|
||||
var newEmployeeIds = existingEmployeeIds.Except(existingEmployeesWithDocs).ToList();
|
||||
|
||||
if (newEmployeeIds.Any())
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Transactions;
|
||||
using _0_Framework.Application;
|
||||
using AccountManagement.Application.Contracts.Account;
|
||||
using AccountManagement.Domain.AccountAgg;
|
||||
@@ -177,8 +178,8 @@ public class WorkshopAppliction : IWorkshopApplication
|
||||
_workshopRepository.EmployerWorkshop(workshop.id, e);
|
||||
}
|
||||
|
||||
|
||||
_workshopRepository.WorkshopAccounts(accountIds, workshop.id);
|
||||
|
||||
var op = _workshopRepository.CreateAccountLeftWorkAndWorkshopAccounts(accountIds, workshop.id);
|
||||
|
||||
|
||||
|
||||
@@ -188,6 +189,7 @@ public class WorkshopAppliction : IWorkshopApplication
|
||||
|
||||
public OperationResult Edit(EditWorkshop command)
|
||||
{
|
||||
using var transaction = new TransactionScope();
|
||||
var leftSearch = new LeftWorkSearchModel()
|
||||
{
|
||||
WorkshopId = command.Id
|
||||
@@ -318,7 +320,7 @@ public class WorkshopAppliction : IWorkshopApplication
|
||||
{
|
||||
_workshopRepository.EmployerWorkshop(workshop.id, e);
|
||||
}
|
||||
_workshopRepository.WorkshopAccounts(accountIds, workshop.id);
|
||||
var op = _workshopRepository.EditAccountLeftWorkAndWorkshopAccounts(accountIds, workshop.id);
|
||||
foreach (var item in leftWork)
|
||||
{
|
||||
var editLeft = _leftWorkRepository.Get(item.Id);
|
||||
@@ -327,6 +329,7 @@ public class WorkshopAppliction : IWorkshopApplication
|
||||
_leftWorkRepository.SaveChanges();
|
||||
|
||||
}
|
||||
transaction.Complete();
|
||||
return operation.Succcedded();
|
||||
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ using _0_Framework.Application;
|
||||
using AccountManagement.Application.Contracts.Media;
|
||||
using Company.Domain.empolyerAgg;
|
||||
using Company.Domain.LeftWorkAgg;
|
||||
using System.Collections;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository
|
||||
{
|
||||
@@ -186,26 +187,52 @@ namespace CompanyManagment.EFCore.Repository
|
||||
}
|
||||
|
||||
|
||||
//get the last leftworks in each workshop for selected employees where the leftwork
|
||||
var passedLeftWorks = _companyContext.LeftWorkList
|
||||
.Where(x => query.Any(y => y.EmployeeId == x.EmployeeId &&
|
||||
y.WorkshopId == cmd.WorkshopId && x.LeftWorkDate <= DateTime.Now.Date))
|
||||
.Select(x => x.EmployeeId).AsEnumerable();
|
||||
var now = DateTime.Now.Date;
|
||||
|
||||
//پرسنل قرارداد این کارگاه
|
||||
var contractEmployees = _companyContext.LeftWorkList
|
||||
.Where(x => x.WorkshopId == cmd.WorkshopId);
|
||||
//پرسنل فعال در قرارداد
|
||||
var contractActiveEmployeeIds = contractEmployees
|
||||
.Where(x => x.LeftWorkDate == new DateTime(2121, 3, 21) && x.StartWorkDate.Date <= now).Select(x => x.EmployeeId).ToList();
|
||||
//پرسنل غیر فعال قرارداد
|
||||
var contractDeActivedEmployeeIds = contractEmployees
|
||||
.Where(x => x.LeftWorkDate.Date <= now && !contractActiveEmployeeIds.Contains(x.EmployeeId))
|
||||
.Select(x => x.EmployeeId).ToList();
|
||||
|
||||
//پرسنل بیمه این کارگاه
|
||||
var insuranceEmployees = _companyContext.LeftWorkInsuranceList
|
||||
.Where(x => x.WorkshopId == cmd.WorkshopId);
|
||||
//پرسنل فعال در بیمه
|
||||
var insuranceActiveEmployeeIds = insuranceEmployees
|
||||
.Where(x => x.LeftWorkDate == null && x.StartWorkDate.Date <= now).Select(x => x.EmployeeId).ToList();
|
||||
//پرسنل غیر فعال بیمه
|
||||
var insuranceDeActivedEmployeeIds = insuranceEmployees
|
||||
.Where(x => x.LeftWorkDate.Value.Date <= now && !contractActiveEmployeeIds.Contains(x.EmployeeId))
|
||||
.Select(x => x.EmployeeId).ToList();
|
||||
|
||||
// پرسنل هر دو لیست که غیر فعال هستند
|
||||
var activeEmployees = contractActiveEmployeeIds.Concat(insuranceActiveEmployeeIds).Distinct().ToList();
|
||||
// پرسنل هر دو لیست که فعال هستند
|
||||
var deActiveEmployees = contractDeActivedEmployeeIds.Concat(insuranceDeActivedEmployeeIds).Distinct().ToList();
|
||||
|
||||
//پرسنل غیر فعالی که یا در هر دو غیرفعال هستند یا فقط در یکی استارت خورده و غیر فعال شده اند
|
||||
var deActivedEmployeesIdlist = deActiveEmployees.Where(x => !activeEmployees.Contains(x)).ToList();
|
||||
|
||||
|
||||
List<EmployeeDocuments> employeeDocuments;
|
||||
switch (cmd.Mode)
|
||||
{
|
||||
case EmployeeDocumentSearchMode.All:
|
||||
employeeDocuments = query.OrderBy(x => passedLeftWorks.Any(y => x.EmployeeId == y))
|
||||
.Skip(cmd.PageIndex).Take(30).ToList();
|
||||
break;
|
||||
// case EmployeeDocumentSearchMode.All:
|
||||
//employeeDocuments = query.OrderBy(x => passedLeftWorks.Any(y => x.EmployeeId == y))
|
||||
// .Skip(cmd.PageIndex).Take(30).ToList();
|
||||
//break;
|
||||
case EmployeeDocumentSearchMode.ActiveEmployees:
|
||||
employeeDocuments = query.Where(x => passedLeftWorks.All(y => x.EmployeeId != y))
|
||||
.OrderByDescending(x => x.id).Skip(cmd.PageIndex).Take(30).ToList();
|
||||
break;
|
||||
employeeDocuments = query.Where(q => deActivedEmployeesIdlist.All(deActived => q.EmployeeId != deActived))
|
||||
.OrderByDescending(x => x.id).Skip(cmd.PageIndex).Take(30).ToList();
|
||||
break;
|
||||
case EmployeeDocumentSearchMode.DeactiveEmployees:
|
||||
employeeDocuments = query.Where(x => passedLeftWorks.Any(y => x.EmployeeId == y))
|
||||
employeeDocuments = query.Where(x => deActivedEmployeesIdlist.Any(deActived => x.EmployeeId == deActived))
|
||||
.OrderByDescending(x => x.id).Skip(cmd.PageIndex).Take(30).ToList();
|
||||
break;
|
||||
default:
|
||||
@@ -250,7 +277,7 @@ namespace CompanyManagment.EFCore.Repository
|
||||
NationalCardRear =GetByLabelAndLoadMedia(employeeLatestConfirmedDocuments, medias, DocumentItemLabel.NationalCardRear),
|
||||
MilitaryServiceCard= GetByLabelAndLoadMedia(employeeLatestConfirmedDocuments, medias, DocumentItemLabel.MilitaryServiceCard),
|
||||
EmployeePicture = GetByLabelAndLoadMedia(employeeLatestConfirmedDocuments, medias, DocumentItemLabel.EmployeePicture),
|
||||
IsBlack = passedLeftWorks.Any(y => y == x.EmployeeId) ? "true" : "false",
|
||||
IsBlack = deActivedEmployeesIdlist.Any(y => y == x.EmployeeId) ? "true" : "false",
|
||||
EmployerFullName = employerFullName,
|
||||
IsSentToChecker = x.IsSentToChecker,
|
||||
PersonnelCode = personnelCodes.FirstOrDefault(y=>y.EmployeeId == x.EmployeeId)?.PersonnelCode??0
|
||||
@@ -270,29 +297,51 @@ namespace CompanyManagment.EFCore.Repository
|
||||
query = query.Where(x => (x.Employee.FName + " " + x.Employee.LName).Contains(cmd.EmployeeName));
|
||||
}
|
||||
|
||||
var now = DateTime.Now.Date;
|
||||
|
||||
//پرسنل قرارداد این کارگاه
|
||||
var contractEmployees = _companyContext.LeftWorkList
|
||||
.Where(x => x.WorkshopId == cmd.WorkshopId);
|
||||
//پرسنل فعال در قرارداد
|
||||
var contractActiveEmployeeIds = contractEmployees
|
||||
.Where(x=> x.LeftWorkDate == new DateTime(2121, 3, 21) && x.StartWorkDate.Date <= now).Select(x => x.EmployeeId).ToList();
|
||||
//پرسنل غیر فعال قرارداد
|
||||
var contractDeActivedEmployeeIds = contractEmployees
|
||||
.Where(x=> x.LeftWorkDate.Date <= now && !contractActiveEmployeeIds.Contains(x.EmployeeId))
|
||||
.Select(x=>x.EmployeeId).ToList();
|
||||
|
||||
//get the last leftworks in each workshop for selected employees where the leftwork
|
||||
var passedLeftWorks = _companyContext.LeftWorkList
|
||||
.Where(x => query.Any(y => y.EmployeeId == x.EmployeeId && y.WorkshopId == cmd.WorkshopId && x.LeftWorkDate <= DateTime.Now.Date))
|
||||
.Select(x => x.EmployeeId).AsEnumerable();
|
||||
//پرسنل بیمه این کارگاه
|
||||
var insuranceEmployees = _companyContext.LeftWorkInsuranceList
|
||||
.Where(x => x.WorkshopId == cmd.WorkshopId);
|
||||
//پرسنل فعال در بیمه
|
||||
var insuranceActiveEmployeeIds = insuranceEmployees
|
||||
.Where(x => x.LeftWorkDate == null && x.StartWorkDate.Date <= now).Select(x => x.EmployeeId).ToList();
|
||||
//پرسنل غیر فعال بیمه
|
||||
var insuranceDeActivedEmployeeIds = insuranceEmployees
|
||||
.Where(x => x.LeftWorkDate.Value.Date <= now && !contractActiveEmployeeIds.Contains(x.EmployeeId))
|
||||
.Select(x => x.EmployeeId).ToList();
|
||||
|
||||
// پرسنل هر دو لیست که غیر فعال هستند
|
||||
var activeEmployees = contractActiveEmployeeIds.Concat(insuranceActiveEmployeeIds).Distinct().ToList();
|
||||
// پرسنل هر دو لیست که فعال هستند
|
||||
var deActiveEmployees = contractDeActivedEmployeeIds.Concat(insuranceDeActivedEmployeeIds).Distinct().ToList();
|
||||
|
||||
//پرسنل غیر فعالی که یا در هر دو غیرفعال هستند یا فقط در یکی استارت خورده و غیر فعال شده اند
|
||||
var deActivedEmployeesIdlist = deActiveEmployees.Where(x => !activeEmployees.Contains(x)).ToList();
|
||||
|
||||
var passedInsuranceLeftWorks = _companyContext.LeftWorkInsuranceList
|
||||
.Where(x => query.Any(y => y.EmployeeId == x.EmployeeId && y.WorkshopId == cmd.WorkshopId && x.LeftWorkDate <= DateTime.Now.Date))
|
||||
.Select(x => x.EmployeeId).AsEnumerable();
|
||||
passedLeftWorks = passedLeftWorks.Concat(passedInsuranceLeftWorks).Distinct();
|
||||
|
||||
List<EmployeeDocuments> employeeDocuments;
|
||||
switch (cmd.Mode)
|
||||
{
|
||||
case EmployeeDocumentSearchMode.All:
|
||||
employeeDocuments = query.OrderBy(x => passedLeftWorks.Any(y => x.EmployeeId == y)).Skip(cmd.PageIndex).Take(30).ToList();
|
||||
break;
|
||||
//case EmployeeDocumentSearchMode.All:
|
||||
// employeeDocuments = query.OrderBy(x => passedLeftWorks.Any(y => x.EmployeeId == y)).Skip(cmd.PageIndex).Take(30).ToList();
|
||||
// break;
|
||||
case EmployeeDocumentSearchMode.ActiveEmployees:
|
||||
employeeDocuments = query.Where(x => passedLeftWorks.All(y => x.EmployeeId != y))
|
||||
employeeDocuments = query.Where(q => deActivedEmployeesIdlist.All(deActived => q.EmployeeId != deActived))
|
||||
.OrderByDescending(x => x.id).Skip(cmd.PageIndex).Take(30).ToList();
|
||||
break;
|
||||
case EmployeeDocumentSearchMode.DeactiveEmployees:
|
||||
employeeDocuments = query.Where(x => passedLeftWorks.Any(y => x.EmployeeId == y))
|
||||
employeeDocuments = query.Where(x => deActivedEmployeesIdlist.Any(deActived => x.EmployeeId == deActived))
|
||||
.OrderByDescending(x => x.id).Skip(cmd.PageIndex).Take(30).ToList();
|
||||
break;
|
||||
default:
|
||||
@@ -334,7 +383,7 @@ namespace CompanyManagment.EFCore.Repository
|
||||
NationalCardRear = GetByLabelAndLoadMedia(employeeLatestConfirmedDocuments, medias, DocumentItemLabel.NationalCardRear),
|
||||
MilitaryServiceCard = GetByLabelAndLoadMedia(employeeLatestConfirmedDocuments, medias, DocumentItemLabel.MilitaryServiceCard),
|
||||
EmployeePicture = GetByLabelAndLoadMedia(employeeLatestConfirmedDocuments, medias, DocumentItemLabel.EmployeePicture),
|
||||
IsBlack = passedLeftWorks.Any(y => y == x.EmployeeId) ? "true" : "false",
|
||||
IsBlack = deActivedEmployeesIdlist.Any(y => y == x.EmployeeId) ? "true" : "false",
|
||||
EmployerFullName = employerFullName,
|
||||
PersonnelCode = personnelCodes.FirstOrDefault(y => y.EmployeeId == x.EmployeeId)?.PersonnelCode ?? 0
|
||||
};
|
||||
|
||||
@@ -196,13 +196,13 @@ public class LeftWorkRepository : RepositoryBase<long, LeftWork>, ILeftWorkRepos
|
||||
};
|
||||
}
|
||||
|
||||
public List<long> GetEmployeeIdsByWorkshopIdActiveInDates(long workshopId, DateTime start, DateTime end)
|
||||
public List<long> GetAllEmployeeIdsInWorkshop(long workshopId)
|
||||
{
|
||||
var leftWorks = _context.LeftWorkList
|
||||
.Where(x => x.WorkshopId == workshopId && x.LeftWorkDate.AddDays(-1) >= start && x.StartWorkDate.Date <= end.Date)
|
||||
.Where(x => x.WorkshopId == workshopId)
|
||||
.GroupBy(x => x.EmployeeId).Select(x => x.Key).ToList();
|
||||
var insuranceLeftWork = _context.LeftWorkInsuranceList
|
||||
.Where(x => x.WorkshopId == workshopId && (x.LeftWorkDate == null && x.StartWorkDate <= start) || (x.LeftWorkDate != null && x.LeftWorkDate.Value.AddDays(-1) >= start && x.StartWorkDate.Date <= end.Date))
|
||||
.Where(x => x.WorkshopId == workshopId)
|
||||
.GroupBy(x => x.EmployeeId).Select(x => x.Key).ToList();
|
||||
return leftWorks.Concat(insuranceLeftWork).Distinct().ToList();
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Linq;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.InfraStructure;
|
||||
using AccountManagement.Application.Contracts.Account;
|
||||
using AccountManagement.Domain.AccountLeftWorkAgg;
|
||||
using AccountMangement.Infrastructure.EFCore;
|
||||
using Company.Domain.EmployeeAgg;
|
||||
using Company.Domain.empolyerAgg;
|
||||
@@ -1541,5 +1542,199 @@ public class WorkshopRepository : RepositoryBase<long, Company.Domain.WorkshopAg
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
public OperationResult CreateAccountLeftWorkAndWorkshopAccounts(List<long> accountIds, long workshopId)
|
||||
{
|
||||
OperationResult op = new();
|
||||
|
||||
var startGr = ($"{(DateTime.Now.ToFarsi().Substring(0, 8))}01").ToGeorgianDateTime();
|
||||
var continueWorking = _0_Framework.Application.StaticWorkshopAccounts.ContinuesWorkingDate;
|
||||
var staticAccountIds = _0_Framework.Application.StaticWorkshopAccounts.StaticAccountIds;
|
||||
|
||||
|
||||
var accountIdList = staticAccountIds.Concat(accountIds).ToList();
|
||||
var selectedAccountsPlusStaticAccounts = _accountContext.Accounts.Where(x => accountIdList.Contains(x.id)).ToList();
|
||||
foreach (var item in selectedAccountsPlusStaticAccounts)
|
||||
{
|
||||
_context.WorkshopAccounts.Add(new WorkshopAccount()
|
||||
{
|
||||
|
||||
WorkshopId = workshopId,
|
||||
AccountId = item.id
|
||||
|
||||
});
|
||||
_context.SaveChanges();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
var toBeCreateAccountLeftWork = _accountContext.Accounts.Where(x => accountIds.Contains(x.id)).ToList();
|
||||
|
||||
foreach (var item in toBeCreateAccountLeftWork)
|
||||
{
|
||||
_accountContext.AccountLeftWorks.Add(new AccountLeftWork(startGr, continueWorking, item.id, workshopId, item.RoleId));
|
||||
_accountContext.SaveChanges();
|
||||
}
|
||||
|
||||
|
||||
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
public OperationResult EditAccountLeftWorkAndWorkshopAccounts(List<long> accountIds, long workshopId)
|
||||
{
|
||||
List<long> roleIds = _0_Framework.Application.StaticWorkshopAccounts.SelectedAccountsRoleIds;
|
||||
var goStartFa = $"{(DateTime.Now.ToFarsi().Substring(0, 8))}01";
|
||||
var goStartGr = goStartFa.ToGeorgianDateTime();
|
||||
var goEndGr = goStartFa.ToGeorgianDateTime().AddDays(-1);
|
||||
var continueWorking = _0_Framework.Application.StaticWorkshopAccounts.ContinuesWorkingDate;
|
||||
var staticAccountIds = _0_Framework.Application.StaticWorkshopAccounts.StaticAccountIds;
|
||||
|
||||
if (accountIds.Count == 0)
|
||||
return new OperationResult();
|
||||
|
||||
//اکانت های انتخاب شده در ویرایش
|
||||
var selectedAccounts = _accountContext.Accounts.Where(x => accountIds.Contains(x.id)).ToList();
|
||||
if (!selectedAccounts.Any())
|
||||
return new OperationResult();
|
||||
|
||||
//اکانتهایی که در جدول اکانت لفت ورک به این کارگاه دسترسی دارند و نقش های مشخص شده را دارند
|
||||
var accountLeftworksAreActiveNow = _accountContext.AccountLeftWorks.Where(x => x.WorkshopId == workshopId && roleIds.Contains(x.RoleId) && x.IsActive).ToList();
|
||||
|
||||
//ورکشاپ اکانتهای این کارگاه رو بیار
|
||||
var workshopAccountsAreAcceseNow = _context.WorkshopAccounts.Where(x => x.WorkshopId == workshopId).ToList();
|
||||
var workshopAccountsAreAcceseNowIdList = workshopAccountsAreAcceseNow.Select(x => x.AccountId).ToList();
|
||||
// اکانتهایی که با نقش های تعریف شده استاتیک دسترسی دارند به کارگاه
|
||||
var accountsHaveStaticRolesNow = _accountContext.Accounts
|
||||
.Where(x => workshopAccountsAreAcceseNowIdList.Contains(x.id))
|
||||
.Where(x => roleIds.Contains(x.RoleId)).ToList();
|
||||
|
||||
// به ازای هر یک از اکانت های انتخاب شده در ویرایش
|
||||
foreach (var account in selectedAccounts)
|
||||
{
|
||||
//اگر اکانت انتخاب شده در جدول اکانت لفت ورک نبود یا فعال نبود
|
||||
if (!accountLeftworksAreActiveNow.Any(x => x.RoleId == account.RoleId && x.AccountId == account.id))
|
||||
{
|
||||
//اکانت لفت ورکی که قبلا این نقش را داشته بیار
|
||||
var accountLeftworkToBeDeActiveAcount = accountLeftworksAreActiveNow.FirstOrDefault(x => x.RoleId == account.RoleId);
|
||||
if (accountLeftworkToBeDeActiveAcount != null)
|
||||
{
|
||||
var start = accountLeftworkToBeDeActiveAcount.StartWorkGr > goEndGr ? goEndGr : accountLeftworkToBeDeActiveAcount.StartWorkGr;
|
||||
//غیر فعالش کن
|
||||
accountLeftworkToBeDeActiveAcount.DeActive(start, goEndGr);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//برای اکانت جدید لفت ورک اکانت بساز
|
||||
var create = new AccountLeftWork(goStartGr, continueWorking, account.id, workshopId, account.RoleId, true);
|
||||
_accountContext.AccountLeftWorks.Add(create);
|
||||
_accountContext.SaveChanges();
|
||||
|
||||
}
|
||||
|
||||
//اگر اکانت انتخاب شده با این نقش به کارگاه وصل نبود
|
||||
if (!accountsHaveStaticRolesNow.Any(x => x.RoleId == account.RoleId && x.id == account.id))
|
||||
{
|
||||
// اکانتی که قبلا این نقش را داشته
|
||||
var accountHasTheRole = accountsHaveStaticRolesNow.FirstOrDefault(x => x.RoleId == account.RoleId);
|
||||
if (accountHasTheRole != null)
|
||||
{
|
||||
//ورکشاپ اکانت دسترسی این کارگاه رو بیار
|
||||
var workshopAccountToBeRemove =
|
||||
workshopAccountsAreAcceseNow.FirstOrDefault(x => x.AccountId == accountHasTheRole.id);
|
||||
if (workshopAccountToBeRemove != null)
|
||||
{
|
||||
//حذفش کن
|
||||
_context.WorkshopAccounts.Remove(workshopAccountToBeRemove);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//برای اکانت جدید ورکشاپ اکانت بساز
|
||||
_context.WorkshopAccounts.Add(new WorkshopAccount()
|
||||
{
|
||||
|
||||
WorkshopId = workshopId,
|
||||
AccountId = account.id
|
||||
|
||||
});
|
||||
_context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
//اگر تعداد اکانتهای انتخاب شده کمتر از 4 نقش استاتیک بود
|
||||
if (accountIds.Count < 4)
|
||||
{
|
||||
//رول های انتخاب شده
|
||||
var roleBeActive = selectedAccounts.Select(x => x.RoleId).ToList();
|
||||
// رول هایی که باید دسترسی اکانتشان حذف شود
|
||||
var roleBeRemove = roleIds.Except(roleBeActive).ToList();
|
||||
|
||||
var accountsBeRemoveList = accountLeftworksAreActiveNow.Where(x => roleBeRemove.Contains(x.RoleId)).ToList();
|
||||
|
||||
foreach (var accountBeRemove in accountsBeRemoveList)
|
||||
{
|
||||
|
||||
//اکانت لفت ورکی که قبلا این نقش را داشته بیار
|
||||
var accountLeftworkToBeDeActiveAcount = accountLeftworksAreActiveNow.FirstOrDefault(x => x.RoleId == accountBeRemove.RoleId);
|
||||
if (accountLeftworkToBeDeActiveAcount != null)
|
||||
{
|
||||
var start = accountLeftworkToBeDeActiveAcount.StartWorkGr > goEndGr ? goEndGr : accountLeftworkToBeDeActiveAcount.StartWorkGr;
|
||||
//غیر فعالش کن
|
||||
accountLeftworkToBeDeActiveAcount.DeActive(start, goEndGr);
|
||||
_accountContext.SaveChanges();
|
||||
}
|
||||
|
||||
//ورکشاپ اکانت دسترسی این نقش رو بیار
|
||||
var workshopAccountToBeRemove =
|
||||
workshopAccountsAreAcceseNow.FirstOrDefault(x => x.AccountId == accountBeRemove.id);
|
||||
if (workshopAccountToBeRemove != null)
|
||||
{
|
||||
//حذفش کن
|
||||
_context.WorkshopAccounts.Remove(workshopAccountToBeRemove);
|
||||
_context.SaveChanges();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//حذف ورکشاپ اکانتهای اضافی
|
||||
var accountIdList = staticAccountIds.Concat(accountIds).ToList();
|
||||
var otherAccessTobeRemove = _context.WorkshopAccounts.Where(x => x.WorkshopId == workshopId)
|
||||
.Where(x => !accountIdList.Contains(x.AccountId)).ToList();
|
||||
_context.WorkshopAccounts.RemoveRange(otherAccessTobeRemove);
|
||||
|
||||
//اگر اکانتی از اکانتهای ثابت دسترسی نداشت اضافه کن
|
||||
foreach (var starticAccount in staticAccountIds)
|
||||
{
|
||||
var checkExist = workshopAccountsAreAcceseNow.Any(x => x.AccountId == starticAccount);
|
||||
|
||||
if (!checkExist)
|
||||
{
|
||||
//var acc = _accountContext.Accounts.FirstOrDefault(x => x.id == starticAccount);
|
||||
//if (acc != null)
|
||||
//{
|
||||
|
||||
//}
|
||||
_context.WorkshopAccounts.Add(new WorkshopAccount()
|
||||
{
|
||||
WorkshopId = workshopId,
|
||||
AccountId = starticAccount
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
_context.SaveChanges();
|
||||
|
||||
|
||||
|
||||
return new OperationResult().Succcedded();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -41,13 +41,15 @@ namespace ServiceHost.Areas.Admin.Pages.Company.Workshops
|
||||
Id = x.Id,
|
||||
InsuranceJobTitle = x.InsuranceJobTitle + " | " + x.EconomicCode,
|
||||
}).ToList();
|
||||
|
||||
var accounts = _accountRepository.GetAdminAccountsNew();
|
||||
var command = new CreateWorkshop
|
||||
{
|
||||
Employers = _EmployerApplication.GetAllEmployers(),
|
||||
AccountsList = _accountRepository.GetAccounts()
|
||||
.Where(x => x.AdminAreaPermission == "true" && x.Id != 2 && x.Id != 3)
|
||||
.ToList(),
|
||||
AccountsList = accounts,
|
||||
SeniorContractAccountsList = accounts.Where(x => x.RoleId == 3).ToList(),
|
||||
JuniorContractAccountsList = accounts.Where(x => x.RoleId == 5).ToList(),
|
||||
SeniorInsuranceAccountList = accounts.Where(x => x.RoleId == 7).ToList(),
|
||||
JuniorInsuranceAccountsList = accounts.Where(x => x.RoleId == 8).ToList(),
|
||||
InsuranceJobViewModels = new SelectList(insuranceJob, "Id", "InsuranceJobTitle"),
|
||||
};
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ using Company.Domain.WorkshopAgg;
|
||||
using CompanyManagment.App.Contracts.RollCall;
|
||||
using CompanyManagment.App.Contracts.RollCallService;
|
||||
using CompanyManagment.EFCore.Repository;
|
||||
using CompanyManagment.EFCore.Migrations;
|
||||
|
||||
namespace ServiceHost.Areas.Admin.Pages.Company.Workshops
|
||||
{
|
||||
@@ -33,6 +32,7 @@ namespace ServiceHost.Areas.Admin.Pages.Company.Workshops
|
||||
public bool HasPermissionWorkshopInfo;
|
||||
public bool HasPermissionContract;
|
||||
public bool HasPermissionInsurance;
|
||||
public List<AccountViewModel> DeactivatedAccounts;
|
||||
|
||||
public EditWorkshopModel(IWorkshopApplication workshopApplication, IWorkshopRepository workshopRepository, IEmployerApplication employerApplication, IAccountRepository accountRepository, IInsuranceJobApplication insuranceJobApplication, IAuthHelper authHelper, IRollCallServiceApplication rollCallServiceApplication)
|
||||
{
|
||||
@@ -65,16 +65,36 @@ namespace ServiceHost.Areas.Admin.Pages.Company.Workshops
|
||||
if (RollCallService != null)
|
||||
RollCallService.EndServiceToFarsiDuration = RollCallService.EndServiceStr.ToFarsiDuration2();
|
||||
|
||||
var workshop = _workshopApplication.GetDetails(id);
|
||||
var allAccounts = _accountRepository.GetAccountsToEditWorkshop(id);
|
||||
|
||||
var activeAccounts = allAccounts.Where(x => x.IsActiveString == "true").ToList();
|
||||
|
||||
DeactivatedAccounts = allAccounts.Except(activeAccounts).ToList();
|
||||
|
||||
var workshop = _workshopApplication.GetDetails(id);
|
||||
|
||||
workshop.Employers = _EmployerApplication.GetAllEmployers();
|
||||
workshop.AccountsList = _accountRepository.GetAccounts()
|
||||
.Where(x => x.AdminAreaPermission == "true" && !_workshopRepository.GetWorkshopAccountRelation(id).Contains(x.Id))
|
||||
.ToList();
|
||||
|
||||
workshop.AccountsList = activeAccounts;
|
||||
|
||||
var adminAccounts = _accountRepository.GetAdminAccountsNew();
|
||||
workshop.SeniorContractAccountsList = adminAccounts.Where(x => x.RoleId == 3).ToList();
|
||||
workshop.JuniorContractAccountsList = adminAccounts.Where(x => x.RoleId == 5).ToList();
|
||||
workshop.SeniorInsuranceAccountList = adminAccounts.Where(x => x.RoleId == 7).ToList();
|
||||
workshop.JuniorInsuranceAccountsList = adminAccounts.Where(x => x.RoleId == 8).ToList();
|
||||
|
||||
|
||||
|
||||
|
||||
workshop.EmployerIdList = _workshopRepository.GetRelation(id);
|
||||
workshop.AccountIdsList = _workshopRepository.GetWorkshopAccountRelation(id);
|
||||
workshop.InAccountIdsList = _accountRepository.GetAccounts()
|
||||
.Where(x => _workshopRepository.GetWorkshopAccountRelation(id).Contains(x.Id))
|
||||
.ToList();
|
||||
|
||||
workshop.DeActiveAccounts = allAccounts.Except(activeAccounts).ToList();
|
||||
workshop.ActiveAccounts = activeAccounts;
|
||||
//workshop.InAccountIdsList = _accountRepository.GetAccounts()
|
||||
// .Where(x => _workshopRepository.GetWorkshopAccountRelation(id).Contains(x.Id))
|
||||
// .ToList();
|
||||
|
||||
workshop.InsuranceJobViewModels = new SelectList(insuranceJob, "Id", "InsuranceJobTitle");
|
||||
Message = workshop.ArchiveCode;
|
||||
workshop.PermissionIds = permissionIds;
|
||||
|
||||
@@ -1,202 +1,165 @@
|
||||
@model CompanyManagment.App.Contracts.Workshop.CreateWorkshop
|
||||
@{
|
||||
<style>
|
||||
.p-2 {
|
||||
padding: 2rem;
|
||||
}
|
||||
|
||||
.form-add {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.add_input {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 4px;
|
||||
transform: translateY(-50%);
|
||||
background: #84cc16;
|
||||
color: #fff;
|
||||
padding: 4px 8px;
|
||||
border-radius: 6px;
|
||||
transition: all .3s ease;
|
||||
}
|
||||
|
||||
.add_input:hover {
|
||||
background: #65a30d;
|
||||
}
|
||||
|
||||
.req_input {
|
||||
height: 340px;
|
||||
background: #e2e8f0;
|
||||
margin: 5px 0;
|
||||
padding: 5px;
|
||||
border-radius: 8px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.head-section {
|
||||
background: #2fc1c1;
|
||||
padding: 6px 5px;
|
||||
margin: 0 0 3px 0;
|
||||
border-radius: 6px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
color: #fff;
|
||||
position: sticky;
|
||||
top: -5px;
|
||||
z-index: 50;
|
||||
}
|
||||
|
||||
.head-section .rowNumber {
|
||||
width: 35px;
|
||||
}
|
||||
|
||||
.head-section .row-fullname {
|
||||
width: 190px;
|
||||
}
|
||||
|
||||
.head-section .row-contract-checkout {
|
||||
width: 145px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.head-section .row-insurance {
|
||||
width: 130px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.head-section .row-tax {
|
||||
width: 130px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.head-section .row-active-deactive {
|
||||
width: 200px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.required_inp {
|
||||
background: #d9f99d;
|
||||
padding: 3px 5px;
|
||||
margin: 0 0 3px 0;
|
||||
border-radius: 6px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.dark {
|
||||
background-color: #475569;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.required_inp .rowNumber {
|
||||
width: 35px;
|
||||
}
|
||||
|
||||
.required_inp .row-number {
|
||||
background: #84cc16;
|
||||
width: 21px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 3px;
|
||||
height: 21px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.dark .row-number {
|
||||
background: #1e293b;
|
||||
}
|
||||
|
||||
.required_inp .row-fullname {
|
||||
width: 190px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.required_inp .row-contract-checkout {
|
||||
width: 145px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.required_inp .row-insurance {
|
||||
width: 130px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.required_inp .row-tax {
|
||||
width: 130px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.required_inp .form-switch {
|
||||
width: 200px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.required_inp .input-label {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.required_inp .form-switch {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.required_inp .form-switch label {
|
||||
margin: 0 10px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.required_inp .form-check-input {
|
||||
position: relative;
|
||||
width: 40px;
|
||||
height: 20px;
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
background-color: #c6c6c6;
|
||||
outline: none;
|
||||
border-radius: 20px;
|
||||
transition: background-color 0.3s;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.required_inp .form-check-input::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border-radius: 50%;
|
||||
top: 1px;
|
||||
left: 1px;
|
||||
background-color: #fff;
|
||||
transition: transform 0.3s;
|
||||
}
|
||||
|
||||
.required_inp .form-check-input:checked {
|
||||
background-color: #4CAF50;
|
||||
}
|
||||
|
||||
.required_inp .form-check-input:checked::before {
|
||||
transform: translateX(20px);
|
||||
}
|
||||
|
||||
.required_inp .inputRemove {
|
||||
background: #ef4444;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
padding: 3px 10px;
|
||||
}
|
||||
</style>
|
||||
string adminVersion = _0_Framework.Application.Version.AdminVersion;
|
||||
<link href="~/AssetsClient/css/select2.css?ver=@adminVersion" rel="stylesheet" />
|
||||
<link href="~/assetsadmin/page/workshop/css/formpermissionaccount.css?ver=@adminVersion" rel="stylesheet" />
|
||||
}
|
||||
|
||||
<div class="p-2">
|
||||
<div class="selection-section">
|
||||
<div class="w-25-persent SeniorContractAccountsSelect">
|
||||
<span>قرارداد ارشد</span>
|
||||
<select class="form-control SelectItemAccount" id="SeniorContractAccountsSelect">
|
||||
<option value="0" disabled="" selected>انتخاب کنید ...</option>
|
||||
@foreach (var itemAccount in Model.SeniorContractAccountsList)
|
||||
{
|
||||
<option value="@itemAccount.Id">@itemAccount.Fullname</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div class="w-25-persent JuniorContractAccountsSelect">
|
||||
<span>قرارداد ساده</span>
|
||||
<select class="form-control SelectItemAccount" id="JuniorContractAccountsSelect">
|
||||
<option value="0" disabled="" selected>انتخاب کنید ...</option>
|
||||
@foreach (var itemAccount in Model.JuniorContractAccountsList)
|
||||
{
|
||||
<option value="@itemAccount.Id">@itemAccount.Fullname</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div class="w-25-persent SeniorInsuranceAccountsSelect">
|
||||
<span>بیمه ارشد</span>
|
||||
<select class="form-control SelectItemAccount" id="SeniorInsuranceAccountsSelect">
|
||||
<option value="0" disabled="" selected>انتخاب کنید ...</option>
|
||||
@foreach (var itemAccount in Model.SeniorInsuranceAccountList)
|
||||
{
|
||||
<option value="@itemAccount.Id">@itemAccount.Fullname</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div class="w-25-persent JuniorInsuranceAccountsSelect">
|
||||
<span>بیمه ساده</span>
|
||||
<select class="form-control SelectItemAccount" id="JuniorInsuranceAccountsSelect">
|
||||
<option value="0" disabled="" selected>انتخاب کنید ...</option>
|
||||
@foreach (var itemAccount in Model.JuniorInsuranceAccountsList)
|
||||
{
|
||||
<option value="@itemAccount.Id">@itemAccount.Fullname</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-permission-section">
|
||||
<div>
|
||||
<button type="button" class="active-account-btn">
|
||||
سطح دسترسی فعال
|
||||
</button>
|
||||
</div>
|
||||
<div class="d-flex" id="activeAccounts">
|
||||
<table>
|
||||
<colgroup>
|
||||
<col style="width: 1%;">
|
||||
<col style="width: 30%;">
|
||||
</colgroup>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="table-number">1</div>
|
||||
</td>
|
||||
<td id="SeniorContractAdded"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="table-number table-number-empty"></div>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="table-number table-number-empty"></div>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="table-number table-number-empty"></div>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="table-number table-number-empty"></div>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table>
|
||||
<colgroup>
|
||||
<col style="width: 30%;">
|
||||
</colgroup>
|
||||
<tr>
|
||||
<td id="JuniorContractAdded"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table>
|
||||
<colgroup>
|
||||
<col style="width: 30%;">
|
||||
</colgroup>
|
||||
<tr>
|
||||
<td id="SeniorInsuranceAdded"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table style="border: none;">
|
||||
<colgroup>
|
||||
<col style="width: 30%;">
|
||||
</colgroup>
|
||||
<tr>
|
||||
<td id="JuniorInsuranceAdded"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
@* <div class="p-2">
|
||||
<div class="form-add">
|
||||
<div class="datainputs">
|
||||
<div class="form-group">
|
||||
@@ -232,147 +195,291 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> *@
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
let counter = 1;
|
||||
//let counter = 1;
|
||||
|
||||
$('.SelectItemAccount').select2({
|
||||
dir: "rtl"
|
||||
});
|
||||
|
||||
$("#addMore").click(function () {
|
||||
var selectedOption = $('.SelectItemAccount option:selected');
|
||||
$('#contractCheckoutCheckAll').prop('disabled', false);
|
||||
$('#insuranceCheckAll').prop('disabled', false);
|
||||
$('#taxCheckAll').prop('disabled', false);
|
||||
// ------------------------------------------------------------ Senior Contract Accounts Action
|
||||
$('#SeniorContractAccountsSelect').on('change', function () {
|
||||
var selectedOption = $('#SeniorContractAccountsSelect option:selected');
|
||||
var selectedText = selectedOption.text();
|
||||
var selectedValue = selectedOption.val();
|
||||
|
||||
if (selectedValue) {
|
||||
selectedOption.remove();
|
||||
//selectedOption.remove();
|
||||
$('#SeniorContractAccountsSelect').val("0");
|
||||
$('.SeniorContractAccountsSelect .select2').addClass("disable");
|
||||
|
||||
var htmlContent = `
|
||||
<div class="required_inp" data-id="${selectedValue}">
|
||||
<input type="hidden" name="Command.AccountIdsList" value="${selectedValue}">
|
||||
<div class="rowNumber"><span class="row-number">${counter}</span></div>
|
||||
<span class="row-fullname">${selectedText}</span>
|
||||
<span class="row-contract-checkout">
|
||||
<input type="checkbox" class="myCheckbox checkboxes contract-checkbox">
|
||||
</span>
|
||||
<span class="row-insurance">
|
||||
<input type="checkbox" class="myCheckbox checkboxes insurance-checkbox">
|
||||
</span>
|
||||
<span class="row-tax">
|
||||
<input type="checkbox" class="myCheckbox checkboxes tax-checkbox">
|
||||
</span>
|
||||
<div class="form-switch">
|
||||
<label for="switch-checkbox_${counter}" class="label-active">فعال</label>
|
||||
<input type="checkbox" id="switch-checkbox_${counter}" class="form-check-input switch-checkbox" checked>
|
||||
<label for="switch-checkbox_${counter}" class="label-inactive">غیر فعال</label>
|
||||
</div>
|
||||
<input type="button" class="inputRemove" value="حذف"/>
|
||||
${selectedText}
|
||||
<button type="button" class="inputRemove SeniorContractBtn">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M8.26758 12.2871L8.26758 9.87557" stroke="#BF3737" stroke-linecap="round"/>
|
||||
<path d="M12.2866 12.2871L12.2866 9.87557" stroke="#BF3737" stroke-linecap="round"/>
|
||||
<path d="M3.04248 5.85547H17.5117V5.85547C16.7546 5.85547 16.3761 5.85547 16.0702 5.95665C15.4694 6.15536 14.9981 6.62664 14.7994 7.22739C14.6982 7.53328 14.6982 7.91183 14.6982 8.66893V12.3055C14.6982 14.1911 14.6982 15.1339 14.1125 15.7197C13.5267 16.3055 12.5839 16.3055 10.6982 16.3055H9.85594C7.97032 16.3055 7.02751 16.3055 6.44173 15.7197C5.85594 15.1339 5.85594 14.1911 5.85594 12.3055V8.66893C5.85594 7.91183 5.85594 7.53328 5.75476 7.22739C5.55605 6.62664 5.08477 6.15536 4.48402 5.95665C4.17813 5.85547 3.79958 5.85547 3.04248 5.85547V5.85547Z" stroke="#BF3737" stroke-linecap="round"/>
|
||||
<path d="M8.26739 3.44467C8.26739 3.44467 8.66931 2.64062 10.277 2.64062C11.8847 2.64062 12.2866 3.44447 12.2866 3.44447" stroke="#BF3737" stroke-linecap="round"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
$("#req_input").append(htmlContent);
|
||||
counter++;
|
||||
updateRowNumbers();
|
||||
|
||||
$('#contractCheckoutCheckAll').prop('checked', false);
|
||||
$('#insuranceCheckAll').prop('checked', false);
|
||||
$('#taxCheckAll').prop('checked', false);
|
||||
$("#SeniorContractAdded").append(htmlContent);
|
||||
}
|
||||
});
|
||||
|
||||
$('body').on('change', '.switch-checkbox', function () {
|
||||
var parentDiv = $(this).closest('.required_inp');
|
||||
if (!this.checked) {
|
||||
parentDiv.addClass('dark').appendTo('#req_input');
|
||||
} else {
|
||||
parentDiv.removeClass('dark');
|
||||
var activeDivs = $('#req_input .required_inp').not('.dark');
|
||||
if (activeDivs.length > 0) {
|
||||
parentDiv.insertBefore(activeDivs.first());
|
||||
} else {
|
||||
parentDiv.appendTo('#req_input');
|
||||
}
|
||||
}
|
||||
updateRowNumbers();
|
||||
});
|
||||
|
||||
$('body').on('change', '#contractCheckoutCheckAll', function () {
|
||||
$('#req_input .row-contract-checkout .contract-checkbox').prop('checked', this.checked);
|
||||
});
|
||||
// ------------------------------------------------------------ Junior Contract Accounts Action
|
||||
$('#JuniorContractAccountsSelect').on('change', function () {
|
||||
var selectedOption = $('#JuniorContractAccountsSelect option:selected');
|
||||
var selectedText = selectedOption.text();
|
||||
var selectedValue = selectedOption.val();
|
||||
|
||||
$('body').on('change', '#insuranceCheckAll', function () {
|
||||
$('#req_input .row-insurance .insurance-checkbox').prop('checked', this.checked);
|
||||
});
|
||||
if (selectedValue) {
|
||||
//selectedOption.remove();
|
||||
$('#JuniorContractAccountsSelect').val("0");
|
||||
$('.JuniorContractAccountsSelect .select2').addClass("disable");
|
||||
|
||||
$('body').on('change', '#taxCheckAll', function () {
|
||||
$('#req_input .row-tax .tax-checkbox').prop('checked', this.checked);
|
||||
});
|
||||
|
||||
$('body').on('change', '.contract-checkbox', function () {
|
||||
if (!this.checked) {
|
||||
$('#contractCheckoutCheckAll').prop('checked', false);
|
||||
} else {
|
||||
var allChecked = true;
|
||||
$('.contract-checkbox').each(function () {
|
||||
if (!this.checked) {
|
||||
allChecked = false;
|
||||
}
|
||||
});
|
||||
$('#contractCheckoutCheckAll').prop('checked', allChecked);
|
||||
var htmlContent = `
|
||||
<div class="required_inp" data-id="${selectedValue}">
|
||||
<input type="hidden" name="Command.AccountIdsList" value="${selectedValue}">
|
||||
${selectedText}
|
||||
<button type="button" class="inputRemove JuniorContractBtn">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M8.26758 12.2871L8.26758 9.87557" stroke="#BF3737" stroke-linecap="round"/>
|
||||
<path d="M12.2866 12.2871L12.2866 9.87557" stroke="#BF3737" stroke-linecap="round"/>
|
||||
<path d="M3.04248 5.85547H17.5117V5.85547C16.7546 5.85547 16.3761 5.85547 16.0702 5.95665C15.4694 6.15536 14.9981 6.62664 14.7994 7.22739C14.6982 7.53328 14.6982 7.91183 14.6982 8.66893V12.3055C14.6982 14.1911 14.6982 15.1339 14.1125 15.7197C13.5267 16.3055 12.5839 16.3055 10.6982 16.3055H9.85594C7.97032 16.3055 7.02751 16.3055 6.44173 15.7197C5.85594 15.1339 5.85594 14.1911 5.85594 12.3055V8.66893C5.85594 7.91183 5.85594 7.53328 5.75476 7.22739C5.55605 6.62664 5.08477 6.15536 4.48402 5.95665C4.17813 5.85547 3.79958 5.85547 3.04248 5.85547V5.85547Z" stroke="#BF3737" stroke-linecap="round"/>
|
||||
<path d="M8.26739 3.44467C8.26739 3.44467 8.66931 2.64062 10.277 2.64062C11.8847 2.64062 12.2866 3.44447 12.2866 3.44447" stroke="#BF3737" stroke-linecap="round"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
$("#JuniorContractAdded").append(htmlContent);
|
||||
}
|
||||
});
|
||||
|
||||
$('body').on('change', '.insurance-checkbox', function () {
|
||||
if (!this.checked) {
|
||||
$('#insuranceCheckAll').prop('checked', false);
|
||||
} else {
|
||||
var allChecked = true;
|
||||
$('.insurance-checkbox').each(function () {
|
||||
if (!this.checked) {
|
||||
allChecked = false;
|
||||
}
|
||||
});
|
||||
$('#insuranceCheckAll').prop('checked', allChecked);
|
||||
|
||||
// ------------------------------------------------------------ Senior Insurance Accounts Action
|
||||
$('#SeniorInsuranceAccountsSelect').on('change', function () {
|
||||
var selectedOption = $('#SeniorInsuranceAccountsSelect option:selected');
|
||||
var selectedText = selectedOption.text();
|
||||
var selectedValue = selectedOption.val();
|
||||
|
||||
if (selectedValue) {
|
||||
//selectedOption.remove();
|
||||
$('#SeniorInsuranceAccountsSelect').val("0");
|
||||
$('.SeniorInsuranceAccountsSelect .select2').addClass("disable");
|
||||
|
||||
var htmlContent = `
|
||||
<div class="required_inp" data-id="${selectedValue}">
|
||||
<input type="hidden" name="Command.AccountIdsList" value="${selectedValue}">
|
||||
${selectedText}
|
||||
<button type="button" class="inputRemove SeniorInsuranceBtn">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M8.26758 12.2871L8.26758 9.87557" stroke="#BF3737" stroke-linecap="round"/>
|
||||
<path d="M12.2866 12.2871L12.2866 9.87557" stroke="#BF3737" stroke-linecap="round"/>
|
||||
<path d="M3.04248 5.85547H17.5117V5.85547C16.7546 5.85547 16.3761 5.85547 16.0702 5.95665C15.4694 6.15536 14.9981 6.62664 14.7994 7.22739C14.6982 7.53328 14.6982 7.91183 14.6982 8.66893V12.3055C14.6982 14.1911 14.6982 15.1339 14.1125 15.7197C13.5267 16.3055 12.5839 16.3055 10.6982 16.3055H9.85594C7.97032 16.3055 7.02751 16.3055 6.44173 15.7197C5.85594 15.1339 5.85594 14.1911 5.85594 12.3055V8.66893C5.85594 7.91183 5.85594 7.53328 5.75476 7.22739C5.55605 6.62664 5.08477 6.15536 4.48402 5.95665C4.17813 5.85547 3.79958 5.85547 3.04248 5.85547V5.85547Z" stroke="#BF3737" stroke-linecap="round"/>
|
||||
<path d="M8.26739 3.44467C8.26739 3.44467 8.66931 2.64062 10.277 2.64062C11.8847 2.64062 12.2866 3.44447 12.2866 3.44447" stroke="#BF3737" stroke-linecap="round"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
$("#SeniorInsuranceAdded").append(htmlContent);
|
||||
}
|
||||
});
|
||||
|
||||
$('body').on('change', '.tax-checkbox', function () {
|
||||
if (!this.checked) {
|
||||
$('#taxCheckAll').prop('checked', false);
|
||||
} else {
|
||||
var allChecked = true;
|
||||
$('.tax-checkbox').each(function () {
|
||||
if (!this.checked) {
|
||||
allChecked = false;
|
||||
}
|
||||
});
|
||||
$('#taxCheckAll').prop('checked', allChecked);
|
||||
|
||||
// ------------------------------------------------------------ Junior Insurance Accounts Action
|
||||
$('#JuniorInsuranceAccountsSelect').on('change', function () {
|
||||
var selectedOption = $('#JuniorInsuranceAccountsSelect option:selected');
|
||||
var selectedText = selectedOption.text();
|
||||
var selectedValue = selectedOption.val();
|
||||
|
||||
if (selectedValue) {
|
||||
//selectedOption.remove();
|
||||
$('#JuniorInsuranceAccountsSelect').val("0");
|
||||
$('.JuniorInsuranceAccountsSelect .select2').addClass("disable");
|
||||
|
||||
var htmlContent = `
|
||||
<div class="required_inp" data-id="${selectedValue}">
|
||||
<input type="hidden" name="Command.AccountIdsList" value="${selectedValue}">
|
||||
${selectedText}
|
||||
<button type="button" class="inputRemove JuniorInsuranceBtn">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M8.26758 12.2871L8.26758 9.87557" stroke="#BF3737" stroke-linecap="round"/>
|
||||
<path d="M12.2866 12.2871L12.2866 9.87557" stroke="#BF3737" stroke-linecap="round"/>
|
||||
<path d="M3.04248 5.85547H17.5117V5.85547C16.7546 5.85547 16.3761 5.85547 16.0702 5.95665C15.4694 6.15536 14.9981 6.62664 14.7994 7.22739C14.6982 7.53328 14.6982 7.91183 14.6982 8.66893V12.3055C14.6982 14.1911 14.6982 15.1339 14.1125 15.7197C13.5267 16.3055 12.5839 16.3055 10.6982 16.3055H9.85594C7.97032 16.3055 7.02751 16.3055 6.44173 15.7197C5.85594 15.1339 5.85594 14.1911 5.85594 12.3055V8.66893C5.85594 7.91183 5.85594 7.53328 5.75476 7.22739C5.55605 6.62664 5.08477 6.15536 4.48402 5.95665C4.17813 5.85547 3.79958 5.85547 3.04248 5.85547V5.85547Z" stroke="#BF3737" stroke-linecap="round"/>
|
||||
<path d="M8.26739 3.44467C8.26739 3.44467 8.66931 2.64062 10.277 2.64062C11.8847 2.64062 12.2866 3.44447 12.2866 3.44447" stroke="#BF3737" stroke-linecap="round"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
$("#JuniorInsuranceAdded").append(htmlContent);
|
||||
}
|
||||
});
|
||||
|
||||
function updateRowNumbers() {
|
||||
$('#req_input .required_inp').each(function (index) {
|
||||
$(this).find('.row-number').text(index + 1);
|
||||
});
|
||||
counter = $('#req_input .required_inp').length + 1;
|
||||
}
|
||||
|
||||
$('body').on('click', '.inputRemove', function () {
|
||||
var parentDiv = $(this).parent('div.required_inp');
|
||||
var accountId = parentDiv.data('id');
|
||||
var accountText = parentDiv.find('.row-fullname').text();
|
||||
var $this = $(this);
|
||||
|
||||
parentDiv.remove();
|
||||
$('.SelectItemAccount').append(`<option value="${accountId}">${accountText}</option>`);
|
||||
updateRowNumbers();
|
||||
if ($(this).hasClass("SeniorContractBtn")) {
|
||||
$('.SeniorContractAccountsSelect .select2').removeClass("disable");
|
||||
} else if ($(this).hasClass("JuniorContractBtn")) {
|
||||
$('.JuniorContractAccountsSelect .select2').removeClass("disable");
|
||||
} else if ($(this).hasClass("SeniorInsuranceBtn")) {
|
||||
$('.SeniorInsuranceAccountsSelect .select2').removeClass("disable");
|
||||
} else {
|
||||
$('.JuniorInsuranceAccountsSelect .select2').removeClass("disable");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// $('#SeniorContractAccountsSelect').on('change', function () {
|
||||
// var selectedOption = $('.SelectItemAccount option:selected');
|
||||
// $('#contractCheckoutCheckAll').prop('disabled', false);
|
||||
// $('#insuranceCheckAll').prop('disabled', false);
|
||||
// $('#taxCheckAll').prop('disabled', false);
|
||||
// var selectedText = selectedOption.text();
|
||||
// var selectedValue = selectedOption.val();
|
||||
|
||||
// if (selectedValue) {
|
||||
// selectedOption.remove();
|
||||
|
||||
// var htmlContent = `
|
||||
// <div class="required_inp" data-id="${selectedValue}">
|
||||
// <input type="hidden" name="Command.AccountIdsList" value="${selectedValue}">
|
||||
// <div class="rowNumber"><span class="row-number">${counter}</span></div>
|
||||
// <span class="row-fullname">${selectedText}</span>
|
||||
// <span class="row-contract-checkout">
|
||||
// <input type="checkbox" class="myCheckbox checkboxes contract-checkbox">
|
||||
// </span>
|
||||
// <span class="row-insurance">
|
||||
// <input type="checkbox" class="myCheckbox checkboxes insurance-checkbox">
|
||||
// </span>
|
||||
// <span class="row-tax">
|
||||
// <input type="checkbox" class="myCheckbox checkboxes tax-checkbox">
|
||||
// </span>
|
||||
// <div class="form-switch">
|
||||
// <label for="switch-checkbox_${counter}" class="label-active">فعال</label>
|
||||
// <input type="checkbox" id="switch-checkbox_${counter}" class="form-check-input switch-checkbox" checked>
|
||||
// <label for="switch-checkbox_${counter}" class="label-inactive">غیر فعال</label>
|
||||
// </div>
|
||||
// <input type="button" class="inputRemove" value="حذف"/>
|
||||
// </div>
|
||||
// `;
|
||||
// $("#req_input").append(htmlContent);
|
||||
// counter++;
|
||||
// updateRowNumbers();
|
||||
|
||||
// $('#contractCheckoutCheckAll').prop('checked', false);
|
||||
// $('#insuranceCheckAll').prop('checked', false);
|
||||
// $('#taxCheckAll').prop('checked', false);
|
||||
// }
|
||||
// });
|
||||
|
||||
// $('body').on('change', '.switch-checkbox', function () {
|
||||
// var parentDiv = $(this).closest('.required_inp');
|
||||
// if (!this.checked) {
|
||||
// parentDiv.addClass('dark').appendTo('#req_input');
|
||||
// } else {
|
||||
// parentDiv.removeClass('dark');
|
||||
// var activeDivs = $('#req_input .required_inp').not('.dark');
|
||||
// if (activeDivs.length > 0) {
|
||||
// parentDiv.insertBefore(activeDivs.first());
|
||||
// } else {
|
||||
// parentDiv.appendTo('#req_input');
|
||||
// }
|
||||
// }
|
||||
// updateRowNumbers();
|
||||
// });
|
||||
|
||||
// $('body').on('change', '#contractCheckoutCheckAll', function () {
|
||||
// $('#req_input .row-contract-checkout .contract-checkbox').prop('checked', this.checked);
|
||||
// });
|
||||
|
||||
// $('body').on('change', '#insuranceCheckAll', function () {
|
||||
// $('#req_input .row-insurance .insurance-checkbox').prop('checked', this.checked);
|
||||
// });
|
||||
|
||||
// $('body').on('change', '#taxCheckAll', function () {
|
||||
// $('#req_input .row-tax .tax-checkbox').prop('checked', this.checked);
|
||||
// });
|
||||
|
||||
// $('body').on('change', '.contract-checkbox', function () {
|
||||
// if (!this.checked) {
|
||||
// $('#contractCheckoutCheckAll').prop('checked', false);
|
||||
// } else {
|
||||
// var allChecked = true;
|
||||
// $('.contract-checkbox').each(function () {
|
||||
// if (!this.checked) {
|
||||
// allChecked = false;
|
||||
// }
|
||||
// });
|
||||
// $('#contractCheckoutCheckAll').prop('checked', allChecked);
|
||||
// }
|
||||
// });
|
||||
|
||||
// $('body').on('change', '.insurance-checkbox', function () {
|
||||
// if (!this.checked) {
|
||||
// $('#insuranceCheckAll').prop('checked', false);
|
||||
// } else {
|
||||
// var allChecked = true;
|
||||
// $('.insurance-checkbox').each(function () {
|
||||
// if (!this.checked) {
|
||||
// allChecked = false;
|
||||
// }
|
||||
// });
|
||||
// $('#insuranceCheckAll').prop('checked', allChecked);
|
||||
// }
|
||||
// });
|
||||
|
||||
// $('body').on('change', '.tax-checkbox', function () {
|
||||
// if (!this.checked) {
|
||||
// $('#taxCheckAll').prop('checked', false);
|
||||
// } else {
|
||||
// var allChecked = true;
|
||||
// $('.tax-checkbox').each(function () {
|
||||
// if (!this.checked) {
|
||||
// allChecked = false;
|
||||
// }
|
||||
// });
|
||||
// $('#taxCheckAll').prop('checked', allChecked);
|
||||
// }
|
||||
// });
|
||||
|
||||
// function updateRowNumbers() {
|
||||
// $('#req_input .required_inp').each(function (index) {
|
||||
// $(this).find('.row-number').text(index + 1);
|
||||
// });
|
||||
// counter = $('#req_input .required_inp').length + 1;
|
||||
// }
|
||||
|
||||
// $('body').on('click', '.inputRemove', function () {
|
||||
// var parentDiv = $(this).parent('div.required_inp');
|
||||
// var accountId = parentDiv.data('id');
|
||||
// var accountText = parentDiv.find('.row-fullname').text();
|
||||
// var $this = $(this);
|
||||
|
||||
// parentDiv.remove();
|
||||
// $('.SelectItemAccount').append(`<option value="${accountId}">${accountText}</option>`);
|
||||
// updateRowNumbers();
|
||||
// });
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1,203 +1,509 @@
|
||||
@model CompanyManagment.App.Contracts.Workshop.EditWorkshop
|
||||
@using AccountManagement.Application.Contracts.Account
|
||||
@using Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@model CompanyManagment.App.Contracts.Workshop.EditWorkshop
|
||||
|
||||
@{
|
||||
int index = 1;
|
||||
<style>
|
||||
.p-2 {
|
||||
padding: 2rem;
|
||||
}
|
||||
string adminVersion = _0_Framework.Application.Version.AdminVersion;
|
||||
<link href="~/AssetsClient/css/select2.css?ver=@adminVersion" rel="stylesheet" />
|
||||
<link href="~/assetsadmin/page/workshop/css/formpermissionaccount.css?ver=@adminVersion" rel="stylesheet" />
|
||||
|
||||
.form-add {
|
||||
position: relative;
|
||||
}
|
||||
var deactivatedEmployees = @Model.DeActiveAccounts;
|
||||
var activeAccount = @Model.ActiveAccounts;
|
||||
var maxEmployeeDeactive = deactivatedEmployees.Any() ? deactivatedEmployees.GroupBy(x => x.RoleName).Max(g => g.Count()) :0;
|
||||
var maxRows = deactivatedEmployees.Any() ? maxEmployeeDeactive <= 4 ? 5 : maxEmployeeDeactive : 5;
|
||||
|
||||
.add_input {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 4px;
|
||||
transform: translateY(-50%);
|
||||
background: #84cc16;
|
||||
color: #fff;
|
||||
padding: 4px 8px;
|
||||
border-radius: 6px;
|
||||
transition: all .3s ease;
|
||||
}
|
||||
|
||||
.add_input:hover {
|
||||
background: #65a30d;
|
||||
}
|
||||
|
||||
.req_input {
|
||||
height: 340px;
|
||||
background: #e2e8f0;
|
||||
margin: 5px 0;
|
||||
padding: 5px;
|
||||
border-radius: 8px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.head-section {
|
||||
background: #2fc1c1;
|
||||
padding: 6px 5px;
|
||||
margin: 0 0 3px 0;
|
||||
border-radius: 6px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
color: #fff;
|
||||
position: sticky;
|
||||
top: -5px;
|
||||
z-index: 50;
|
||||
}
|
||||
|
||||
.head-section .rowNumber {
|
||||
width: 35px;
|
||||
}
|
||||
|
||||
.head-section .row-fullname {
|
||||
width: 190px;
|
||||
}
|
||||
|
||||
.head-section .row-contract-checkout {
|
||||
width: 145px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.head-section .row-insurance {
|
||||
width: 130px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.head-section .row-tax {
|
||||
width: 130px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.head-section .row-active-deactive {
|
||||
width: 200px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.required_inp {
|
||||
background: #d9f99d;
|
||||
padding: 3px 5px;
|
||||
margin: 0 0 3px 0;
|
||||
border-radius: 6px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.dark {
|
||||
background-color: #475569;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.required_inp .rowNumber {
|
||||
width: 35px;
|
||||
}
|
||||
|
||||
.required_inp .row-number {
|
||||
background: #84cc16;
|
||||
width: 21px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 3px;
|
||||
height: 21px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.dark .row-number {
|
||||
background: #1e293b;
|
||||
}
|
||||
|
||||
.required_inp .row-fullname {
|
||||
width: 190px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.required_inp .row-contract-checkout {
|
||||
width: 145px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.required_inp .row-insurance {
|
||||
width: 130px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.required_inp .row-tax {
|
||||
width: 130px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.required_inp .form-switch {
|
||||
width: 200px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.required_inp .input-label {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.required_inp .form-switch {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.required_inp .form-switch label {
|
||||
margin: 0 10px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.required_inp .form-check-input {
|
||||
position: relative;
|
||||
width: 40px;
|
||||
height: 20px;
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
background-color: #c6c6c6;
|
||||
outline: none;
|
||||
border-radius: 20px;
|
||||
transition: background-color 0.3s;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.required_inp .form-check-input::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border-radius: 50%;
|
||||
top: 1px;
|
||||
left: 1px;
|
||||
background-color: #fff;
|
||||
transition: transform 0.3s;
|
||||
}
|
||||
|
||||
.required_inp .form-check-input:checked {
|
||||
background-color: #4CAF50;
|
||||
}
|
||||
|
||||
.required_inp .form-check-input:checked::before {
|
||||
transform: translateX(20px);
|
||||
}
|
||||
|
||||
.required_inp .inputRemove {
|
||||
background: #ef4444;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
padding: 3px 10px;
|
||||
}
|
||||
</style>
|
||||
}
|
||||
|
||||
<div class="p-2">
|
||||
<div class="selection-section">
|
||||
<div class="w-25-persent SeniorContractAccountsSelect">
|
||||
<span>قرارداد ارشد</span>
|
||||
<select class="form-control SelectItemAccount disable" id="SeniorContractAccountsSelect">
|
||||
<option value="0" disabled="" selected>انتخاب کنید ...</option>
|
||||
@foreach (var itemAccount in Model.SeniorContractAccountsList)
|
||||
{
|
||||
<option value="@itemAccount.Id">@itemAccount.Fullname</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div class="w-25-persent JuniorContractAccountsSelect">
|
||||
<span>قرارداد ساده</span>
|
||||
<select class="form-control SelectItemAccount disable" id="JuniorContractAccountsSelect">
|
||||
<option value="0" disabled="" selected>انتخاب کنید ...</option>
|
||||
@foreach (var itemAccount in Model.JuniorContractAccountsList)
|
||||
{
|
||||
<option value="@itemAccount.Id">@itemAccount.Fullname</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div class="w-25-persent SeniorInsuranceAccountsSelect">
|
||||
<span>بیمه ارشد</span>
|
||||
<select class="form-control SelectItemAccount disable" id="SeniorInsuranceAccountsSelect">
|
||||
<option value="0" disabled="" selected>انتخاب کنید ...</option>
|
||||
@foreach (var itemAccount in Model.SeniorInsuranceAccountList)
|
||||
{
|
||||
<option value="@itemAccount.Id">@itemAccount.Fullname</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div class="w-25-persent JuniorInsuranceAccountsSelect">
|
||||
<span>بیمه ساده</span>
|
||||
<select class="form-control SelectItemAccount disable" id="JuniorInsuranceAccountsSelect">
|
||||
<option value="0" disabled="" selected>انتخاب کنید ...</option>
|
||||
@foreach (var itemAccount in Model.JuniorInsuranceAccountsList)
|
||||
{
|
||||
<option value="@itemAccount.Id">@itemAccount.Fullname</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-permission-section">
|
||||
<div class="btns-section">
|
||||
<button type="button" id="activeAccountBtn" class="active-account-btn">
|
||||
سطح دسترسی فعال
|
||||
</button>
|
||||
<button type="button" id="deactivatedAccountBtn" class="active-account-btn" style="background-color: #91A8B2;width: 104%;">
|
||||
سطح دسترسی غیر فعال
|
||||
</button>
|
||||
</div>
|
||||
<div class="d-flex" id="activeAccounts">
|
||||
<table>
|
||||
<colgroup>
|
||||
<col style="width: 1%;">
|
||||
<col style="width: 30%;">
|
||||
</colgroup>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="table-number">1</div>
|
||||
</td>
|
||||
<td id="SeniorContractAdded">
|
||||
@{
|
||||
int hasSeniorContract = 0;
|
||||
|
||||
}
|
||||
@foreach (var item in activeAccount.Where(x=>x.RoleId == 3))
|
||||
{
|
||||
<div class="required_inp" data-id="@item.Id">
|
||||
<input type="hidden" name="Command.AccountIdsList" value="@item.Id">
|
||||
@item.Fullname
|
||||
<button type="button" class="inputRemove SeniorContractBtn">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M8.26758 12.2871L8.26758 9.87557" stroke="#BF3737" stroke-linecap="round"/>
|
||||
<path d="M12.2866 12.2871L12.2866 9.87557" stroke="#BF3737" stroke-linecap="round"/>
|
||||
<path d="M3.04248 5.85547H17.5117V5.85547C16.7546 5.85547 16.3761 5.85547 16.0702 5.95665C15.4694 6.15536 14.9981 6.62664 14.7994 7.22739C14.6982 7.53328 14.6982 7.91183 14.6982 8.66893V12.3055C14.6982 14.1911 14.6982 15.1339 14.1125 15.7197C13.5267 16.3055 12.5839 16.3055 10.6982 16.3055H9.85594C7.97032 16.3055 7.02751 16.3055 6.44173 15.7197C5.85594 15.1339 5.85594 14.1911 5.85594 12.3055V8.66893C5.85594 7.91183 5.85594 7.53328 5.75476 7.22739C5.55605 6.62664 5.08477 6.15536 4.48402 5.95665C4.17813 5.85547 3.79958 5.85547 3.04248 5.85547V5.85547Z" stroke="#BF3737" stroke-linecap="round"/>
|
||||
<path d="M8.26739 3.44467C8.26739 3.44467 8.66931 2.64062 10.277 2.64062C11.8847 2.64062 12.2866 3.44447 12.2866 3.44447" stroke="#BF3737" stroke-linecap="round"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
hasSeniorContract++;
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="table-number table-number-empty"></div>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="table-number table-number-empty"></div>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="table-number table-number-empty"></div>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="table-number table-number-empty"></div>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table>
|
||||
<colgroup>
|
||||
<col style="width: 30%;">
|
||||
</colgroup>
|
||||
<tr>
|
||||
<td id="JuniorContractAdded">
|
||||
@{
|
||||
int hasJuniorContract = 0;
|
||||
|
||||
}
|
||||
@foreach (var item in activeAccount.Where(x => x.RoleId == 5))
|
||||
{
|
||||
<div class="required_inp" data-id="@item.Id">
|
||||
<input type="hidden" name="Command.AccountIdsList" value="@item.Id">
|
||||
@item.Fullname
|
||||
<button type="button" class="inputRemove JuniorContractBtn">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M8.26758 12.2871L8.26758 9.87557" stroke="#BF3737" stroke-linecap="round" />
|
||||
<path d="M12.2866 12.2871L12.2866 9.87557" stroke="#BF3737" stroke-linecap="round" />
|
||||
<path d="M3.04248 5.85547H17.5117V5.85547C16.7546 5.85547 16.3761 5.85547 16.0702 5.95665C15.4694 6.15536 14.9981 6.62664 14.7994 7.22739C14.6982 7.53328 14.6982 7.91183 14.6982 8.66893V12.3055C14.6982 14.1911 14.6982 15.1339 14.1125 15.7197C13.5267 16.3055 12.5839 16.3055 10.6982 16.3055H9.85594C7.97032 16.3055 7.02751 16.3055 6.44173 15.7197C5.85594 15.1339 5.85594 14.1911 5.85594 12.3055V8.66893C5.85594 7.91183 5.85594 7.53328 5.75476 7.22739C5.55605 6.62664 5.08477 6.15536 4.48402 5.95665C4.17813 5.85547 3.79958 5.85547 3.04248 5.85547V5.85547Z" stroke="#BF3737" stroke-linecap="round" />
|
||||
<path d="M8.26739 3.44467C8.26739 3.44467 8.66931 2.64062 10.277 2.64062C11.8847 2.64062 12.2866 3.44447 12.2866 3.44447" stroke="#BF3737" stroke-linecap="round" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
hasJuniorContract++;
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table>
|
||||
<colgroup>
|
||||
<col style="width: 30%;">
|
||||
</colgroup>
|
||||
<tr>
|
||||
<td id="SeniorInsuranceAdded">
|
||||
@{
|
||||
int hasSeniorInsurance = 0;
|
||||
|
||||
}
|
||||
@foreach (var item in activeAccount.Where(x => x.RoleId == 7))
|
||||
{
|
||||
<div class="required_inp" data-id="@item.Id">
|
||||
<input type="hidden" name="Command.AccountIdsList" value="@item.Id">
|
||||
@item.Fullname
|
||||
<button type="button" class="inputRemove SeniorInsuranceBtn">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M8.26758 12.2871L8.26758 9.87557" stroke="#BF3737" stroke-linecap="round" />
|
||||
<path d="M12.2866 12.2871L12.2866 9.87557" stroke="#BF3737" stroke-linecap="round" />
|
||||
<path d="M3.04248 5.85547H17.5117V5.85547C16.7546 5.85547 16.3761 5.85547 16.0702 5.95665C15.4694 6.15536 14.9981 6.62664 14.7994 7.22739C14.6982 7.53328 14.6982 7.91183 14.6982 8.66893V12.3055C14.6982 14.1911 14.6982 15.1339 14.1125 15.7197C13.5267 16.3055 12.5839 16.3055 10.6982 16.3055H9.85594C7.97032 16.3055 7.02751 16.3055 6.44173 15.7197C5.85594 15.1339 5.85594 14.1911 5.85594 12.3055V8.66893C5.85594 7.91183 5.85594 7.53328 5.75476 7.22739C5.55605 6.62664 5.08477 6.15536 4.48402 5.95665C4.17813 5.85547 3.79958 5.85547 3.04248 5.85547V5.85547Z" stroke="#BF3737" stroke-linecap="round" />
|
||||
<path d="M8.26739 3.44467C8.26739 3.44467 8.66931 2.64062 10.277 2.64062C11.8847 2.64062 12.2866 3.44447 12.2866 3.44447" stroke="#BF3737" stroke-linecap="round" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
hasSeniorInsurance++;
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table style="border: none;">
|
||||
<colgroup>
|
||||
<col style="width: 30%;">
|
||||
</colgroup>
|
||||
<tr>
|
||||
<td id="JuniorInsuranceAdded">
|
||||
@{
|
||||
int hasJuniorInsurance = 0;
|
||||
|
||||
}
|
||||
@foreach (var item in activeAccount.Where(x => x.RoleId == 8))
|
||||
{
|
||||
<div class="required_inp" data-id="@item.Id">
|
||||
<input type="hidden" name="Command.AccountIdsList" value="@item.Id">
|
||||
@item.Fullname
|
||||
<button type="button" class="inputRemove JuniorInsuranceBtn">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M8.26758 12.2871L8.26758 9.87557" stroke="#BF3737" stroke-linecap="round" />
|
||||
<path d="M12.2866 12.2871L12.2866 9.87557" stroke="#BF3737" stroke-linecap="round" />
|
||||
<path d="M3.04248 5.85547H17.5117V5.85547C16.7546 5.85547 16.3761 5.85547 16.0702 5.95665C15.4694 6.15536 14.9981 6.62664 14.7994 7.22739C14.6982 7.53328 14.6982 7.91183 14.6982 8.66893V12.3055C14.6982 14.1911 14.6982 15.1339 14.1125 15.7197C13.5267 16.3055 12.5839 16.3055 10.6982 16.3055H9.85594C7.97032 16.3055 7.02751 16.3055 6.44173 15.7197C5.85594 15.1339 5.85594 14.1911 5.85594 12.3055V8.66893C5.85594 7.91183 5.85594 7.53328 5.75476 7.22739C5.55605 6.62664 5.08477 6.15536 4.48402 5.95665C4.17813 5.85547 3.79958 5.85547 3.04248 5.85547V5.85547Z" stroke="#BF3737" stroke-linecap="round" />
|
||||
<path d="M8.26739 3.44467C8.26739 3.44467 8.66931 2.64062 10.277 2.64062C11.8847 2.64062 12.2866 3.44447 12.2866 3.44447" stroke="#BF3737" stroke-linecap="round" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
hasJuniorInsurance++;
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="d-flex" id="DeactivatedAccounts" style="display: none">
|
||||
@functions {
|
||||
void RenderTable(List<AccountViewModel> accounts, string type, int maxRows, int maxEmployeeDeactive)
|
||||
{
|
||||
<table>
|
||||
<colgroup>
|
||||
@if (type == "SeniorContract")
|
||||
{
|
||||
<col style="width: 1%;">
|
||||
}
|
||||
<col style="width: 30%;">
|
||||
</colgroup>
|
||||
@{
|
||||
var itemsList = accounts.ToList();
|
||||
int indexNumber = 1;
|
||||
for (int i = 0; i < maxRows; i++)
|
||||
{
|
||||
<tr>
|
||||
@if (type == "SeniorContract")
|
||||
{
|
||||
@if (indexNumber <= maxEmployeeDeactive)
|
||||
{
|
||||
<td>
|
||||
<div class="table-number">@(indexNumber++)</div>
|
||||
</td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td></td>
|
||||
}
|
||||
}
|
||||
<td>
|
||||
@if (i < itemsList.Count)
|
||||
{
|
||||
<div class="required_inp" data-id="@itemsList[i].Id">
|
||||
@itemsList[i].Fullname
|
||||
</div>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</table>
|
||||
}
|
||||
}
|
||||
|
||||
@{
|
||||
RenderTable(deactivatedEmployees.Where(x => x.RoleId == 3).ToList(), "SeniorContract", maxRows , maxEmployeeDeactive);
|
||||
RenderTable(deactivatedEmployees.Where(x => x.RoleId == 5).ToList(), "JuniorContract", maxRows , maxEmployeeDeactive);
|
||||
RenderTable(deactivatedEmployees.Where(x => x.RoleId == 7).ToList(), "SeniorInsurance", maxRows , maxEmployeeDeactive);
|
||||
RenderTable(deactivatedEmployees.Where(x => x.RoleId == 8).ToList(), "JuniorInsurance", maxRows , maxEmployeeDeactive);
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('.SelectItemAccount').select2({
|
||||
dir: "rtl"
|
||||
});
|
||||
|
||||
var hasSeniorContract = @(hasSeniorContract);
|
||||
var hasJuniorContract = @(hasJuniorContract);
|
||||
var hasSeniorInsurance = @(hasSeniorInsurance);
|
||||
var hasJuniorInsurance = @(hasJuniorInsurance);
|
||||
|
||||
if (hasSeniorContract > 0) {
|
||||
$('.SeniorContractAccountsSelect .select2').addClass("disable");
|
||||
}
|
||||
|
||||
if(hasJuniorContract > 0) {
|
||||
$('.JuniorContractAccountsSelect .select2').addClass("disable");
|
||||
}
|
||||
|
||||
if (hasSeniorInsurance > 0) {
|
||||
$('.SeniorInsuranceAccountsSelect .select2').addClass("disable");
|
||||
}
|
||||
|
||||
if (hasJuniorInsurance > 0) {
|
||||
$('.JuniorInsuranceAccountsSelect .select2').addClass("disable");
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------ Senior Contract Accounts Action
|
||||
$('#SeniorContractAccountsSelect').on('change', function () {
|
||||
var selectedOption = $('#SeniorContractAccountsSelect option:selected');
|
||||
var selectedText = selectedOption.text();
|
||||
var selectedValue = selectedOption.val();
|
||||
|
||||
if (selectedValue) {
|
||||
//selectedOption.remove();
|
||||
$('#SeniorContractAccountsSelect').val("0");
|
||||
$('.SeniorContractAccountsSelect .select2').addClass("disable");
|
||||
|
||||
var htmlContent = `
|
||||
<div class="required_inp" data-id="${selectedValue}">
|
||||
<input type="hidden" name="Command.AccountIdsList" value="${selectedValue}">
|
||||
${selectedText}
|
||||
<button type="button" class="inputRemove SeniorContractBtn">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M8.26758 12.2871L8.26758 9.87557" stroke="#BF3737" stroke-linecap="round"/>
|
||||
<path d="M12.2866 12.2871L12.2866 9.87557" stroke="#BF3737" stroke-linecap="round"/>
|
||||
<path d="M3.04248 5.85547H17.5117V5.85547C16.7546 5.85547 16.3761 5.85547 16.0702 5.95665C15.4694 6.15536 14.9981 6.62664 14.7994 7.22739C14.6982 7.53328 14.6982 7.91183 14.6982 8.66893V12.3055C14.6982 14.1911 14.6982 15.1339 14.1125 15.7197C13.5267 16.3055 12.5839 16.3055 10.6982 16.3055H9.85594C7.97032 16.3055 7.02751 16.3055 6.44173 15.7197C5.85594 15.1339 5.85594 14.1911 5.85594 12.3055V8.66893C5.85594 7.91183 5.85594 7.53328 5.75476 7.22739C5.55605 6.62664 5.08477 6.15536 4.48402 5.95665C4.17813 5.85547 3.79958 5.85547 3.04248 5.85547V5.85547Z" stroke="#BF3737" stroke-linecap="round"/>
|
||||
<path d="M8.26739 3.44467C8.26739 3.44467 8.66931 2.64062 10.277 2.64062C11.8847 2.64062 12.2866 3.44447 12.2866 3.44447" stroke="#BF3737" stroke-linecap="round"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
$("#SeniorContractAdded").append(htmlContent);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// ------------------------------------------------------------ Junior Contract Accounts Action
|
||||
$('#JuniorContractAccountsSelect').on('change', function () {
|
||||
var selectedOption = $('#JuniorContractAccountsSelect option:selected');
|
||||
var selectedText = selectedOption.text();
|
||||
var selectedValue = selectedOption.val();
|
||||
|
||||
if (selectedValue) {
|
||||
//selectedOption.remove();
|
||||
$('#JuniorContractAccountsSelect').val("0");
|
||||
$('.JuniorContractAccountsSelect .select2').addClass("disable");
|
||||
|
||||
var htmlContent = `
|
||||
<div class="required_inp" data-id="${selectedValue}">
|
||||
<input type="hidden" name="Command.AccountIdsList" value="${selectedValue}">
|
||||
${selectedText}
|
||||
<button type="button" class="inputRemove JuniorContractBtn">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M8.26758 12.2871L8.26758 9.87557" stroke="#BF3737" stroke-linecap="round"/>
|
||||
<path d="M12.2866 12.2871L12.2866 9.87557" stroke="#BF3737" stroke-linecap="round"/>
|
||||
<path d="M3.04248 5.85547H17.5117V5.85547C16.7546 5.85547 16.3761 5.85547 16.0702 5.95665C15.4694 6.15536 14.9981 6.62664 14.7994 7.22739C14.6982 7.53328 14.6982 7.91183 14.6982 8.66893V12.3055C14.6982 14.1911 14.6982 15.1339 14.1125 15.7197C13.5267 16.3055 12.5839 16.3055 10.6982 16.3055H9.85594C7.97032 16.3055 7.02751 16.3055 6.44173 15.7197C5.85594 15.1339 5.85594 14.1911 5.85594 12.3055V8.66893C5.85594 7.91183 5.85594 7.53328 5.75476 7.22739C5.55605 6.62664 5.08477 6.15536 4.48402 5.95665C4.17813 5.85547 3.79958 5.85547 3.04248 5.85547V5.85547Z" stroke="#BF3737" stroke-linecap="round"/>
|
||||
<path d="M8.26739 3.44467C8.26739 3.44467 8.66931 2.64062 10.277 2.64062C11.8847 2.64062 12.2866 3.44447 12.2866 3.44447" stroke="#BF3737" stroke-linecap="round"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
$("#JuniorContractAdded").append(htmlContent);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// ------------------------------------------------------------ Senior Insurance Accounts Action
|
||||
$('#SeniorInsuranceAccountsSelect').on('change', function () {
|
||||
var selectedOption = $('#SeniorInsuranceAccountsSelect option:selected');
|
||||
var selectedText = selectedOption.text();
|
||||
var selectedValue = selectedOption.val();
|
||||
|
||||
if (selectedValue) {
|
||||
//selectedOption.remove();
|
||||
$('#SeniorInsuranceAccountsSelect').val("0");
|
||||
$('.SeniorInsuranceAccountsSelect .select2').addClass("disable");
|
||||
|
||||
var htmlContent = `
|
||||
<div class="required_inp" data-id="${selectedValue}">
|
||||
<input type="hidden" name="Command.AccountIdsList" value="${selectedValue}">
|
||||
${selectedText}
|
||||
<button type="button" class="inputRemove SeniorInsuranceBtn">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M8.26758 12.2871L8.26758 9.87557" stroke="#BF3737" stroke-linecap="round"/>
|
||||
<path d="M12.2866 12.2871L12.2866 9.87557" stroke="#BF3737" stroke-linecap="round"/>
|
||||
<path d="M3.04248 5.85547H17.5117V5.85547C16.7546 5.85547 16.3761 5.85547 16.0702 5.95665C15.4694 6.15536 14.9981 6.62664 14.7994 7.22739C14.6982 7.53328 14.6982 7.91183 14.6982 8.66893V12.3055C14.6982 14.1911 14.6982 15.1339 14.1125 15.7197C13.5267 16.3055 12.5839 16.3055 10.6982 16.3055H9.85594C7.97032 16.3055 7.02751 16.3055 6.44173 15.7197C5.85594 15.1339 5.85594 14.1911 5.85594 12.3055V8.66893C5.85594 7.91183 5.85594 7.53328 5.75476 7.22739C5.55605 6.62664 5.08477 6.15536 4.48402 5.95665C4.17813 5.85547 3.79958 5.85547 3.04248 5.85547V5.85547Z" stroke="#BF3737" stroke-linecap="round"/>
|
||||
<path d="M8.26739 3.44467C8.26739 3.44467 8.66931 2.64062 10.277 2.64062C11.8847 2.64062 12.2866 3.44447 12.2866 3.44447" stroke="#BF3737" stroke-linecap="round"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
$("#SeniorInsuranceAdded").append(htmlContent);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// ------------------------------------------------------------ Junior Insurance Accounts Action
|
||||
$('#JuniorInsuranceAccountsSelect').on('change', function () {
|
||||
var selectedOption = $('#JuniorInsuranceAccountsSelect option:selected');
|
||||
var selectedText = selectedOption.text();
|
||||
var selectedValue = selectedOption.val();
|
||||
|
||||
if (selectedValue) {
|
||||
//selectedOption.remove();
|
||||
$('#JuniorInsuranceAccountsSelect').val("0");
|
||||
$('.JuniorInsuranceAccountsSelect .select2').addClass("disable");
|
||||
|
||||
var htmlContent = `
|
||||
<div class="required_inp" data-id="${selectedValue}">
|
||||
<input type="hidden" name="Command.AccountIdsList" value="${selectedValue}">
|
||||
${selectedText}
|
||||
<button type="button" class="inputRemove JuniorInsuranceBtn">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M8.26758 12.2871L8.26758 9.87557" stroke="#BF3737" stroke-linecap="round"/>
|
||||
<path d="M12.2866 12.2871L12.2866 9.87557" stroke="#BF3737" stroke-linecap="round"/>
|
||||
<path d="M3.04248 5.85547H17.5117V5.85547C16.7546 5.85547 16.3761 5.85547 16.0702 5.95665C15.4694 6.15536 14.9981 6.62664 14.7994 7.22739C14.6982 7.53328 14.6982 7.91183 14.6982 8.66893V12.3055C14.6982 14.1911 14.6982 15.1339 14.1125 15.7197C13.5267 16.3055 12.5839 16.3055 10.6982 16.3055H9.85594C7.97032 16.3055 7.02751 16.3055 6.44173 15.7197C5.85594 15.1339 5.85594 14.1911 5.85594 12.3055V8.66893C5.85594 7.91183 5.85594 7.53328 5.75476 7.22739C5.55605 6.62664 5.08477 6.15536 4.48402 5.95665C4.17813 5.85547 3.79958 5.85547 3.04248 5.85547V5.85547Z" stroke="#BF3737" stroke-linecap="round"/>
|
||||
<path d="M8.26739 3.44467C8.26739 3.44467 8.66931 2.64062 10.277 2.64062C11.8847 2.64062 12.2866 3.44447 12.2866 3.44447" stroke="#BF3737" stroke-linecap="round"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
$("#JuniorInsuranceAdded").append(htmlContent);
|
||||
}
|
||||
});
|
||||
|
||||
$('body').on('click', '.inputRemove', function () {
|
||||
var parentDiv = $(this).parent('div.required_inp');
|
||||
var buttonClass = $(this);
|
||||
swal({
|
||||
title: "اخطار",
|
||||
text: "آیا از غیرفعال کردن این شخص اطمینان دارید؟",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "بله",
|
||||
cancelButtonText: "خیر",
|
||||
closeOnConfirm: false
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
parentDiv.remove();
|
||||
|
||||
if (buttonClass.hasClass("SeniorContractBtn")) {
|
||||
$('.SeniorContractAccountsSelect .select2').removeClass("disable");
|
||||
} else if (buttonClass.hasClass("JuniorContractBtn")) {
|
||||
$('.JuniorContractAccountsSelect .select2').removeClass("disable");
|
||||
} else if (buttonClass.hasClass("SeniorInsuranceBtn")) {
|
||||
$('.SeniorInsuranceAccountsSelect .select2').removeClass("disable");
|
||||
} else {
|
||||
$('.JuniorInsuranceAccountsSelect .select2').removeClass("disable");
|
||||
}
|
||||
|
||||
swal.close();
|
||||
$.Notification.autoHideNotify('success', 'bottom right', 'پیام سیستم ', "این کاربر با موفقیت حذف شده است.");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('body').on('click', '#activeAccountBtn', function () {
|
||||
$('#activeAccounts').show();
|
||||
$('#DeactivatedAccounts').hide();
|
||||
});
|
||||
|
||||
$('body').on('click', '#deactivatedAccountBtn', function () {
|
||||
$('#activeAccounts').hide();
|
||||
$('#DeactivatedAccounts').show();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
@* <div class="p-2">
|
||||
<div class="form-add">
|
||||
<div class="datainputs">
|
||||
<div class="form-group">
|
||||
@@ -389,24 +695,7 @@
|
||||
var accountText = parentDiv.find('.row-fullname').text();
|
||||
var $this = $(this);
|
||||
|
||||
swal({
|
||||
title: "اخطار",
|
||||
text: "توجه داشته باشید با حذف این کارگاه سوابق کاربر در قسمت گزارشات حذف میگردد.",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "بله",
|
||||
cancelButtonText: "خیر",
|
||||
closeOnConfirm: false
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
parentDiv.remove();
|
||||
$('.SelectItemAccount').append(`<option value="${accountId}">${accountText}</option>`);
|
||||
updateRowNumbers();
|
||||
swal.close();
|
||||
$.Notification.autoHideNotify('success', 'bottom right', 'پیام سیستم ', "این کاربر با موفقیت حذف شده است.");
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</script> *@
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using AccountManagement.Domain.AccountLeftWorkAgg;
|
||||
using AccountMangement.Infrastructure.EFCore;
|
||||
using Company.Domain.RollCallAgg.DomainService;
|
||||
using CompanyManagment.App.Contracts.AndroidApkVersion;
|
||||
using CompanyManagment.EFCore;
|
||||
@@ -14,15 +16,17 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
private readonly IAndroidApkVersionApplication _application;
|
||||
private readonly IRollCallDomainService _rollCallDomainService;
|
||||
private readonly CompanyContext _context;
|
||||
private readonly AccountContext _accountContext;
|
||||
|
||||
[BindProperty]
|
||||
public IFormFile File { get; set; }
|
||||
|
||||
public IndexModel(IAndroidApkVersionApplication application, IRollCallDomainService rollCallDomainService, CompanyContext context)
|
||||
public IndexModel(IAndroidApkVersionApplication application, IRollCallDomainService rollCallDomainService, CompanyContext context, AccountContext accountContext)
|
||||
{
|
||||
_application = application;
|
||||
_rollCallDomainService = rollCallDomainService;
|
||||
_context = context;
|
||||
_accountContext = accountContext;
|
||||
}
|
||||
|
||||
public void OnGet()
|
||||
@@ -36,26 +40,103 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
return Page();
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnPostShiftDate()
|
||||
{
|
||||
var customizeWorkshopSettings = _context.CustomizeWorkshopSettings.AsSplitQuery();
|
||||
|
||||
public IActionResult OnPostShiftDate()
|
||||
{
|
||||
//RefactorAllTheRollCallsOnEsfand();
|
||||
// AddToAccountLeftWork();
|
||||
ViewData["message"] = "ÊæãÇã";
|
||||
return Page();
|
||||
}
|
||||
#region AccountLeftwork
|
||||
|
||||
private void AddToAccountLeftWork()
|
||||
{
|
||||
List<long> roleIds = [3, 5, 7, 8, 23, 24];
|
||||
var accounts = _accountContext.Accounts
|
||||
.Where(x => roleIds.Contains(x.RoleId)).Where(x => x.AdminAreaPermission == "true");
|
||||
var accountsIds = accounts.Select(x => x.id).ToList();
|
||||
var workshopAccount = _context.WorkshopAccounts
|
||||
.Where(x => accountsIds.Contains(x.AccountId))
|
||||
.GroupBy(x => x.AccountId);
|
||||
|
||||
List<long> oldAccountleftworkActiveNow = [300, 332, 333, 334, 18, 25, 14];
|
||||
List<long> oldAccountleftworkDeActivedNow = [50, 49, 15];
|
||||
var continueWorking = _0_Framework.Application.StaticWorkshopAccounts.ContinuesWorkingDate;
|
||||
|
||||
|
||||
customizeWorkshopSettings = customizeWorkshopSettings.Where(x => x.WorkshopId == 499);
|
||||
|
||||
var rollCalls =
|
||||
_context.RollCalls.Where(x => customizeWorkshopSettings.Any(a => a.WorkshopId == x.WorkshopId))
|
||||
.ToList();
|
||||
|
||||
foreach (var rollCall in rollCalls)
|
||||
foreach (var item in workshopAccount)
|
||||
{
|
||||
rollCall.SetShiftDate(_rollCallDomainService);
|
||||
Console.WriteLine(rollCall.id);
|
||||
|
||||
|
||||
var oldActive = item.FirstOrDefault(x => oldAccountleftworkActiveNow.Contains(x.AccountId));
|
||||
if (oldActive != null)
|
||||
{
|
||||
var roleId = accounts.FirstOrDefault(x => x.id == oldActive.AccountId)!.RoleId;
|
||||
var startGr = item.Key != 25 ? new DateTime(2024, 07, 22) : new DateTime(2024, 08, 22);
|
||||
//if (item.Key is 380 or 381)
|
||||
// startGr = new DateTime(2025, 02, 19);
|
||||
if (item.Key is 14 or 18)
|
||||
startGr = new DateTime(2020, 05, 21);
|
||||
if (item.Key is 300)
|
||||
startGr = new DateTime(2024, 05, 22);
|
||||
|
||||
foreach (var workshop in item)
|
||||
{
|
||||
_accountContext.AccountLeftWorks.Add(new AccountLeftWork(startGr, continueWorking, workshop.AccountId, workshop.WorkshopId, roleId, true));
|
||||
|
||||
}
|
||||
_accountContext.SaveChanges();
|
||||
|
||||
}
|
||||
|
||||
var oldDeActive = item.FirstOrDefault(x => oldAccountleftworkDeActivedNow.Contains(x.AccountId));
|
||||
if (oldDeActive != null)
|
||||
{
|
||||
var roleId = accounts.FirstOrDefault(x => x.id == oldDeActive.AccountId)!.RoleId;
|
||||
var startGr = new DateTime(2022, 03, 21);
|
||||
if (item.Key == 49)
|
||||
startGr = new DateTime(2023, 04, 21);
|
||||
if (item.Key == 50)
|
||||
startGr = new DateTime(2023, 03, 21);
|
||||
foreach (var workshop in item)
|
||||
{
|
||||
_accountContext.Add(new AccountLeftWork(startGr, new DateTime(2024, 07, 21), workshop.AccountId, workshop.WorkshopId, roleId, false));
|
||||
|
||||
}
|
||||
_accountContext.SaveChanges();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
ViewData["message"] = "ÊæãÇã";
|
||||
return Page();
|
||||
}
|
||||
}
|
||||
Console.WriteLine("finished");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
//public async Task<IActionResult> OnPostShiftDate()
|
||||
//{
|
||||
// var customizeWorkshopSettings = _context.CustomizeWorkshopSettings.AsSplitQuery();
|
||||
|
||||
|
||||
// customizeWorkshopSettings = customizeWorkshopSettings.Where(x => x.WorkshopId == 499);
|
||||
|
||||
// var rollCalls =
|
||||
// _context.RollCalls.Where(x => customizeWorkshopSettings.Any(a => a.WorkshopId == x.WorkshopId))
|
||||
// .ToList();
|
||||
|
||||
// foreach (var rollCall in rollCalls)
|
||||
// {
|
||||
// rollCall.SetShiftDate(_rollCallDomainService);
|
||||
// Console.WriteLine(rollCall.id);
|
||||
// }
|
||||
|
||||
// await _context.SaveChangesAsync();
|
||||
// ViewData["message"] = "ÊæãÇã";
|
||||
// return Page();
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 378 KiB After Width: | Height: | Size: 189 KiB |
|
Before Width: | Height: | Size: 366 KiB After Width: | Height: | Size: 191 KiB |
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 268 KiB After Width: | Height: | Size: 180 KiB |
|
Before Width: | Height: | Size: 256 KiB After Width: | Height: | Size: 181 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 3.2 KiB |
@@ -0,0 +1,126 @@
|
||||
.p-2 {
|
||||
padding: 2rem;
|
||||
}
|
||||
|
||||
#activeAccounts, #DeactivatedAccounts {
|
||||
overflow-y: scroll;
|
||||
height: 235px;
|
||||
}
|
||||
|
||||
.required_inp {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.inputRemove {
|
||||
background-color: #EBD3D3;
|
||||
border: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.disable {
|
||||
pointer-events: none;
|
||||
filter: grayscale(1);
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.btns-section {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.selection-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1.2rem;
|
||||
padding: 0 8px 0 24px;
|
||||
}
|
||||
|
||||
.w-25-persent {
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
.table-permission-section {
|
||||
margin: 20px 0;
|
||||
border: 1px solid #2F77CA;
|
||||
border-radius: 20px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.table-permission-section .active-account-btn {
|
||||
width: 100%;
|
||||
border: none;
|
||||
padding: 6px 0;
|
||||
background-color: #61C7F8;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.table-number {
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
background-color: #06B6D4;
|
||||
border-radius: 5px;
|
||||
color: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.table-number-empty {
|
||||
visibility: hidden
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
color: #666;
|
||||
background: #eaebec;
|
||||
border-left: #2F77CA 1px solid;
|
||||
}
|
||||
|
||||
table tr {
|
||||
text-align: right;
|
||||
height: 46px;
|
||||
}
|
||||
|
||||
table td:first-child {
|
||||
text-align: right;
|
||||
border-left: 0;
|
||||
}
|
||||
|
||||
table td {
|
||||
padding: 8px 10px;
|
||||
background: #fafafa;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
table tr:hover td {
|
||||
background: #f2f2f2;
|
||||
}
|
||||
|
||||
|
||||
@media (max-width:768px) {
|
||||
.selection-section {
|
||||
overflow-x: scroll;
|
||||
overflow-y: hidden;
|
||||
}
|
||||
|
||||
.w-25-persent {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.required_inp {
|
||||
font-size: 12px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.table-permission-section .active-account-btn {
|
||||
font-size: 12px;
|
||||
font-weight: 900;
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,10 @@ $(document).ready(function () {
|
||||
//}
|
||||
}
|
||||
|
||||
$("#next-step").on("click", function () {
|
||||
set();
|
||||
});
|
||||
|
||||
$(document).on('click', '.upload-image1', function () {
|
||||
$('.md-modal').addClass('md-show');
|
||||
$('.take_snapshot1').show();
|
||||
|
||||