rollcall change - workshop vipservice ui added

This commit is contained in:
SamSys
2024-09-16 23:33:13 +03:30
parent d8f14f611a
commit 5d16823a28
11 changed files with 5435 additions and 4485 deletions

View File

@@ -21,4 +21,5 @@ public class CreateRollCallService
public string AmountFa { get; set; }
public string Duration { get; set; }
public string FullName { get; set; }
public int AddPersonValid { get; set; }
}

View File

@@ -2,5 +2,5 @@
public class RollCallServiceViewModel : EditRollCallService
{
public string EndServiceToFarsiDuration { get; set; }
}

View File

@@ -72,5 +72,10 @@ public class CreateWorkshop
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; }
#endregion
}

View File

@@ -152,8 +152,8 @@ public class RollCallEmployeeRepository : RepositoryBase<long, RollCallEmployee>
join = contractLeftWork.Concat(insuranceLeftWork).ToList();
}
if (joinEqualList.Count == 0)
return join;
//if (joinEqualList.Count == 0)
// return join;
join = join.GroupBy(x => x.EmployeeId).Select(d => d.First()).ToList();

View File

@@ -7,195 +7,205 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.SignalR;
using ServiceHost.Hubs;
namespace ServiceHost.Areas.Admin.Pages.Company.Workshops;
[Authorize]
public class CreateWorkshopModel : PageModel
namespace ServiceHost.Areas.Admin.Pages.Company.Workshops
{
private readonly IAccountRepository _accountRepository;
private readonly IAuthHelper _authHelper;
private readonly IEmployerApplication _EmployerApplication;
private readonly IInsuranceJobApplication _insuranceJobApplication;
private readonly IWorkshopApplication _workshopApplication;
public CreateWorkshop Command;
public SelectList Employers;
[Authorize]
public class CreateWorkshopModel : PageModel
{
private readonly IWorkshopApplication _workshopApplication;
private readonly IEmployerApplication _EmployerApplication;
private readonly IAccountRepository _accountRepository;
private readonly IInsuranceJobApplication _insuranceJobApplication;
private readonly IAuthHelper _authHelper;
public CreateWorkshop Command;
public SelectList Employers;
public CreateWorkshopModel(IWorkshopApplication workshopApplication, IEmployerApplication employerApplication,
IAccountRepository accountRepository, IInsuranceJobApplication insuranceJobApplication, IAuthHelper authHelper)
{
_workshopApplication = workshopApplication;
_EmployerApplication = employerApplication;
_accountRepository = accountRepository;
_insuranceJobApplication = insuranceJobApplication;
_authHelper = authHelper;
}
public CreateWorkshopModel(IWorkshopApplication workshopApplication, IEmployerApplication employerApplication, IAccountRepository accountRepository, IInsuranceJobApplication insuranceJobApplication, IAuthHelper authHelper)
{
_workshopApplication = workshopApplication;
_EmployerApplication = employerApplication;
_accountRepository = accountRepository;
_insuranceJobApplication = insuranceJobApplication;
_authHelper = authHelper;
}
public void OnGet()
{
var permissionIds = _authHelper.GetPermissions();
var list = _insuranceJobApplication.GetInsurancJob();
var insuranceJob = list.Select(x => new InsuranceJobViewModel
{
Id = x.Id,
InsuranceJobTitle = x.InsuranceJobTitle + " | " + x.EconomicCode
}).ToList();
public void OnGet()
{
var permissionIds = _authHelper.GetPermissions();
var list = _insuranceJobApplication.GetInsurancJob();
var insuranceJob = list.Select(x => new InsuranceJobViewModel()
{
Id = x.Id,
InsuranceJobTitle = x.InsuranceJobTitle + " | " + x.EconomicCode,
}).ToList();
var command = new CreateWorkshop
{
Employers = _EmployerApplication.GetAllEmployers(),
AccountsList = _accountRepository.GetAccounts()
.Where(x => x.AdminAreaPermission == "true" && x.Id != 2 && x.Id != 3)
.ToList(),
InsuranceJobViewModels = new SelectList(insuranceJob, "Id", "InsuranceJobTitle"),
};
var command = new CreateWorkshop
{
Employers = _EmployerApplication.GetAllEmployers(),
AccountsList = _accountRepository.GetAccounts(),
InsuranceJobViewModels = new SelectList(insuranceJob, "Id", "InsuranceJobTitle")
};
var res = _workshopApplication.GetWorkshop();
var checkOk = res.Any();
int item = 0;
var res = _workshopApplication.GetWorkshop();
var checkOk = res.Any();
var item = 0;
var codes = new List<int>();
foreach (var i in res)
{
var bb = string.Empty;
if (i.ArchiveCode != null)
{
for (var x = 0; x < i.ArchiveCode.Length; x++)
if (char.IsDigit(i.ArchiveCode[x]))
bb += i.ArchiveCode[x];
if (bb.Length > 0)
{
var convert = int.Parse(bb);
codes.Add(convert);
}
}
}
if (checkOk) item = codes.Max();
var sum = item + 1;
var newcode = sum.ToString();
command.ArchiveCode = newcode;
command.PermissionIds = permissionIds;
// command.CurrentAccoutRoleId = currentAccout.RoleId;
var codes = new List<int>();
foreach (var i in res)
{
Command = command;
}
string bb = string.Empty;
public IActionResult OnPostCreate(CreateWorkshop command)
{
#region checkIsLegalAndNotIsLegal
if (i.ArchiveCode != null)
{
for (int x = 0; x < i.ArchiveCode.Length; x++)
{
if (char.IsDigit(i.ArchiveCode[x]))
bb += i.ArchiveCode[x];
}
var resultIsLegal = new OperationResult();
var selectEmployerList = _EmployerApplication.GetEmployers().Where(x => command.EmployerIdList.Contains(x.Id))
.ToList();
var isNotlegal = selectEmployerList.Where(x => x.IsLegal == "حقیقی").FirstOrDefault();
var islegal = selectEmployerList.Where(x => x.IsLegal == "حقوقی").FirstOrDefault();
if (bb.Length > 0)
{
int convert = int.Parse(bb);
codes.Add(convert);
}
}
}
if (checkOk)
{
item = codes.Max();
}
if (isNotlegal != null && islegal != null)
return new JsonResult(resultIsLegal.Failed(
"امکان انتخاب کارفرمای حقیقی و حقوقی به دلیل موانع قانونی در نرم افزار بصورت همزمان امکان پذیر نمی باشد"));
int sum = item + 1;
string newcode = sum.ToString();
command.ArchiveCode = newcode;
command.PermissionIds = permissionIds;
// command.CurrentAccoutRoleId = currentAccout.RoleId;
#endregion
Command = command;
}
public IActionResult OnPostCreate(CreateWorkshop command)
{
#region checkIsLegalAndNotIsLegal
OperationResult resultIsLegal = new OperationResult();
var selectEmployerList = _EmployerApplication.GetEmployers().Where(x => command.EmployerIdList.Contains(x.Id)).ToList();
var isNotlegal = selectEmployerList.Where(x => x.IsLegal == "حقیقی").FirstOrDefault();
var islegal = selectEmployerList.Where(x => x.IsLegal == "حقوقی").FirstOrDefault();
var res = _workshopApplication.GetWorkshop();
var checkNumber = false;
var checkExist = false;
if (isNotlegal != null && islegal != null)
return new JsonResult(resultIsLegal.Failed("امکان انتخاب کارفرمای حقیقی و حقوقی به دلیل موانع قانونی در نرم افزار بصورت همزمان امکان پذیر نمی باشد"));
#endregion
var a = command.ArchiveCode;
var bb = string.Empty;
var convert2 = 0;
if (!string.IsNullOrWhiteSpace(a))
{
for (var x = 0; x < a.Length; x++)
if (char.IsDigit(a[x]))
bb += a[x];
var res = _workshopApplication.GetWorkshop();
bool checkNumber = false;
bool checkExist = false;
if (bb.Length > 0)
{
checkNumber = true;
convert2 = int.Parse(bb);
}
else
{
checkNumber = false;
}
}
else
{
checkNumber = true;
}
string a = command.ArchiveCode;
string bb = string.Empty;
int convert2 = 0;
if (!string.IsNullOrWhiteSpace(a))
{
for (int x = 0; x < a.Length; x++)
{
if (char.IsDigit(a[x]))
bb += a[x];
}
var codes = new List<int>();
foreach (var i in res)
{
var b2 = string.Empty;
if (bb.Length > 0)
{
checkNumber = true;
convert2 = int.Parse(bb);
}
else
{
checkNumber = false;
if (i.ArchiveCode != null)
{
for (var x = 0; x < i.ArchiveCode.Length; x++)
if (char.IsDigit(i.ArchiveCode[x]))
b2 += i.ArchiveCode[x];
}
}
else
{
checkNumber = true;
if (b2.Length > 0)
{
var convert = int.Parse(b2);
codes.Add(convert);
}
}
}
}
foreach (var item in codes)
if (item == convert2)
checkExist = true;
if (checkNumber)
{
//if (checkExist)
//{
// var res3 = _workshopApplication.ExistErr();
// return new JsonResult(res3);
//}
//Thread.Sleep(5000);
command.TypeOfInsuranceSend = command.TypeOfInsuranceSend == "false" ? "" : command.TypeOfInsuranceSend;
var codes = new List<int>();
foreach (var i in res)
{
command.InsuranceCode = !string.IsNullOrWhiteSpace(command.InsuranceCode)
? command.InsuranceCode.ConvertToEnglish()
: "";
command.ArchiveCode = !string.IsNullOrWhiteSpace(command.ArchiveCode)
? command.ArchiveCode.ConvertToEnglish()
: "";
command.AgreementNumber = !string.IsNullOrWhiteSpace(command.AgreementNumber)
? command.AgreementNumber.ConvertToEnglish()
: "";
command.TypeOfInsuranceSend = command.TypeOfInsuranceSend == "false" ? null : command.TypeOfInsuranceSend;
var result = _workshopApplication.Create(command);
return new JsonResult(result);
}
string b2 = string.Empty;
var res2 = _workshopApplication.Err();
return new JsonResult(res2);
}
if (i.ArchiveCode != null)
{
for (int x = 0; x < i.ArchiveCode.Length; x++)
{
if (char.IsDigit(i.ArchiveCode[x]))
b2 += i.ArchiveCode[x];
}
public IActionResult OnGetWorkshopName(string searchText)
{
var result = _workshopApplication.GetWorkshopByTextSearch(searchText);
result = result.OrderBy(x => x.WorkshopFullName.Length).ToList();
return new JsonResult(new
{
IsSuccedded = true,
mylist = result
});
}
if (b2.Length > 0)
{
int convert = int.Parse(b2);
codes.Add(convert);
}
}
}
foreach (var item in codes)
{
if (item == convert2)
checkExist = true;
}
if (checkNumber)
{
//if (checkExist)
//{
// var res3 = _workshopApplication.ExistErr();
// return new JsonResult(res3);
//}
//Thread.Sleep(5000);
command.TypeOfInsuranceSend = command.TypeOfInsuranceSend == "false" ? "" : command.TypeOfInsuranceSend;
public IActionResult OnGetEmployerName(string searchText)
{
var result = _EmployerApplication.GetEmployerWithFNameOrLName(searchText);
result = result.OrderBy(x => x.LName.Length).ToList();
return new JsonResult(new
{
IsSuccedded = true,
mylist = result
});
}
}
command.InsuranceCode = !string.IsNullOrWhiteSpace(command.InsuranceCode) ? command.InsuranceCode.ConvertToEnglish() : "";
command.ArchiveCode = !string.IsNullOrWhiteSpace(command.ArchiveCode) ? command.ArchiveCode.ConvertToEnglish() : "";
command.AgreementNumber = !string.IsNullOrWhiteSpace(command.AgreementNumber) ? command.AgreementNumber.ConvertToEnglish() : "";
command.TypeOfInsuranceSend = command.TypeOfInsuranceSend == "false" ? null : command.TypeOfInsuranceSend;
var result = _workshopApplication.Create(command);
return new JsonResult(result);
}
else
{
var res2 = _workshopApplication.Err();
return new JsonResult(res2);
}
}
public IActionResult OnGetWorkshopName(string searchText)
{
var result = _workshopApplication.GetWorkshopByTextSearch(searchText);
result = result.OrderBy(x => x.WorkshopFullName.Length).ToList();
return new JsonResult(new
{
IsSuccedded = true,
mylist = result,
});
}
public IActionResult OnGetEmployerName(string searchText)
{
var result = _EmployerApplication.GetEmployerWithFNameOrLName(searchText);
result = result.OrderBy(x => x.LName.Length).ToList();
return new JsonResult(new
{
IsSuccedded = true,
mylist = result,
});
}
}
}

View File

@@ -1,175 +1,232 @@
using _0_Framework.Application;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using AccountManagement.Domain.AccountAgg;
using Company.Domain.WorkshopAgg;
using CompanyManagment.App.Contracts.Employer;
using CompanyManagment.App.Contracts.InsuranceJob;
using CompanyManagment.App.Contracts.Workshop;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.Rendering;
using _0_Framework.Application;
using AccountManagement.Application.Contracts.Account;
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;
[Authorize]
public class EditWorkshopModel : PageModel
namespace ServiceHost.Areas.Admin.Pages.Company.Workshops
{
private readonly IAccountRepository _accountRepository;
private readonly IAuthHelper _authHelper;
private readonly IEmployerApplication _EmployerApplication;
private readonly IInsuranceJobApplication _insuranceJobApplication;
private readonly IWorkshopApplication _workshopApplication;
private readonly IWorkshopRepository _workshopRepository;
public EditWorkshop Command;
public SelectList Employers;
public bool HasPermissionContract;
public bool HasPermissionInsurance;
public bool HasPermissionWorkshopInfo;
[Authorize]
public class EditWorkshopModel : PageModel
{
public string Message { get; set; }
private readonly IWorkshopApplication _workshopApplication;
private readonly IWorkshopRepository _workshopRepository;
private readonly IEmployerApplication _EmployerApplication;
private readonly IAccountRepository _accountRepository;
private readonly IInsuranceJobApplication _insuranceJobApplication;
private readonly IRollCallServiceApplication _rollCallServiceApplication;
private readonly IAuthHelper _authHelper;
public EditWorkshop Command;
public SelectList Employers;
public RollCallServiceViewModel RollCallService;
public bool HasPermissionWorkshopInfo;
public bool HasPermissionContract;
public bool HasPermissionInsurance;
public EditWorkshopModel(IWorkshopApplication workshopApplication, IWorkshopRepository workshopRepository,
IEmployerApplication employerApplication, IAccountRepository accountRepository,
IInsuranceJobApplication insuranceJobApplication, IAuthHelper authHelper)
{
_workshopApplication = workshopApplication;
_workshopRepository = workshopRepository;
_EmployerApplication = employerApplication;
_accountRepository = accountRepository;
_insuranceJobApplication = insuranceJobApplication;
_authHelper = authHelper;
}
public EditWorkshopModel(IWorkshopApplication workshopApplication, IWorkshopRepository workshopRepository, IEmployerApplication employerApplication, IAccountRepository accountRepository, IInsuranceJobApplication insuranceJobApplication, IAuthHelper authHelper, IRollCallServiceApplication rollCallServiceApplication)
{
_workshopApplication = workshopApplication;
_workshopRepository = workshopRepository;
_EmployerApplication = employerApplication;
_accountRepository = accountRepository;
_insuranceJobApplication = insuranceJobApplication;
_authHelper = authHelper;
_rollCallServiceApplication = rollCallServiceApplication;
}
public string Message { get; set; }
public void OnGet(long id)
{
var permissions = _authHelper.GetPermissions();
HasPermissionWorkshopInfo = permissions.Any(x => x == 10326);
HasPermissionContract = permissions.Any(x => x == 10323);
HasPermissionInsurance = permissions.Any(x => x == 10324);
public void OnGet(long id)
{
var permissions = _authHelper.GetPermissions();
HasPermissionWorkshopInfo = permissions.Any(x => x == 10326);
HasPermissionContract = permissions.Any(x => x == 10323);
HasPermissionInsurance = permissions.Any(x => x == 10324);
var permissionIds = _authHelper.GetPermissions();
// var currentAccout = _authHelper.CurrentAccountInfo();
var list = _insuranceJobApplication.GetInsurancJob();
var insuranceJob = list.Select(x => new InsuranceJobViewModel()
{
Id = x.Id,
InsuranceJobTitle = x.InsuranceJobTitle + " | " + x.EconomicCode,
}).ToList();
var permissionIds = _authHelper.GetPermissions();
// var currentAccout = _authHelper.CurrentAccountInfo();
var list = _insuranceJobApplication.GetInsurancJob();
var insuranceJob = list.Select(x => new InsuranceJobViewModel
{
Id = x.Id,
InsuranceJobTitle = x.InsuranceJobTitle + " | " + x.EconomicCode
}).ToList();
RollCallService = _rollCallServiceApplication.GetActiveServiceByWorkshopId(id);
if (RollCallService != null)
RollCallService.EndServiceToFarsiDuration = RollCallService.EndServiceStr.ToFarsiDuration2();
var workshop = _workshopApplication.GetDetails(id);
workshop.Employers = _EmployerApplication.GetAllEmployers();
workshop.AccountsList = _accountRepository.GetAccounts();
workshop.EmployerIdList = _workshopRepository.GetRelation(id);
workshop.AccountIdsList = _workshopRepository.GetWorkshopAccountRelation(id);
workshop.InsuranceJobViewModels = new SelectList(insuranceJob, "Id", "InsuranceJobTitle");
Message = workshop.ArchiveCode;
workshop.PermissionIds = permissionIds;
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.EmployerIdList = _workshopRepository.GetRelation(id);
workshop.AccountIdsList = _workshopRepository.GetWorkshopAccountRelation(id);
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;
Command = workshop;
}
Command = workshop;
}
public IActionResult OnPostEdit(EditWorkshop command)
{
var aaa = command;
if (ModelState.IsValid)
{
public IActionResult OnPostEdit(EditWorkshop command)
{
var aaa = command;
if (ModelState.IsValid)
{
}
}
#region checkIsLegalAndNotIsLegal
#region checkIsLegalAndNotIsLegal
OperationResult resultIsLegal = new OperationResult();
var selectEmployerList = _EmployerApplication.GetEmployers().Where(x => command.EmployerIdList.Contains(x.Id)).ToList();
var isNotlegal = selectEmployerList.Where(x => x.IsLegal == "حقیقی").FirstOrDefault();
var islegal = selectEmployerList.Where(x => x.IsLegal == "حقوقی").FirstOrDefault();
var resultIsLegal = new OperationResult();
var selectEmployerList = _EmployerApplication.GetEmployers().Where(x => command.EmployerIdList.Contains(x.Id))
.ToList();
var isNotlegal = selectEmployerList.Where(x => x.IsLegal == "حقیقی").FirstOrDefault();
var islegal = selectEmployerList.Where(x => x.IsLegal == "حقوقی").FirstOrDefault();
if (isNotlegal != null && islegal != null)
return new JsonResult(resultIsLegal.Failed("امکان انتخاب کارفرمای حقیقی و حقوقی به دلیل موانع قانونی در نرم افزار بصورت همزمان امکان پذیر نمی باشد"));
#endregion
if (isNotlegal != null && islegal != null)
return new JsonResult(resultIsLegal.Failed(
"امکان انتخاب کارفرمای حقیقی و حقوقی به دلیل موانع قانونی در نرم افزار بصورت همزمان امکان پذیر نمی باشد"));
var workshop = _workshopApplication.GetDetails(command.Id);
var lastNumber = workshop.ArchiveCode;
var res = _workshopApplication.GetWorkshop();
bool checkNumber = false;
bool checkExist = false;
var pration = new OperationResult();
string a = command.ArchiveCode;
string bb = string.Empty;
int convert2 = 0;
if (!string.IsNullOrWhiteSpace(a))
{
for (int x = 0; x < a.Length; x++)
{
if (char.IsDigit(a[x]))
bb += a[x];
}
#endregion
if (bb.Length > 0)
{
checkNumber = true;
convert2 = int.Parse(bb);
}
else
{
checkNumber = false;
var workshop = _workshopApplication.GetDetails(command.Id);
var lastNumber = workshop.ArchiveCode;
var res = _workshopApplication.GetWorkshop();
var checkNumber = false;
var checkExist = false;
var pration = new OperationResult();
var a = command.ArchiveCode;
var bb = string.Empty;
var convert2 = 0;
if (!string.IsNullOrWhiteSpace(a))
{
for (var x = 0; x < a.Length; x++)
if (char.IsDigit(a[x]))
bb += a[x];
}
}
else
{
checkNumber = true;
if (bb.Length > 0)
{
checkNumber = true;
convert2 = int.Parse(bb);
}
else
{
checkNumber = false;
}
}
else
{
checkNumber = true;
}
}
var codes = new List<int>();
foreach (var i in res)
{
var b2 = string.Empty;
var codes = new List<int>();
foreach (var i in res)
{
if (i.ArchiveCode != null && i.ArchiveCode != lastNumber)
{
for (var x = 0; x < i.ArchiveCode.Length; x++)
if (char.IsDigit(i.ArchiveCode[x]))
b2 += i.ArchiveCode[x];
string b2 = string.Empty;
if (b2.Length > 0)
{
var convert = int.Parse(b2);
codes.Add(convert);
if (i.ArchiveCode != null && i.ArchiveCode != lastNumber)
{
for (int x = 0; x < i.ArchiveCode.Length; x++)
{
if (char.IsDigit(i.ArchiveCode[x]))
b2 += i.ArchiveCode[x];
}
if (b2.Length > 0)
{
int convert = int.Parse(b2);
codes.Add(convert);
}
}
}
foreach (var item in codes)
{
if (item == convert2)
checkExist = true;
}
if (checkNumber)
{
//var EmpoyersSelected = _EmployerRepository.Get(command.EmployerId);
//if (EmpoyersSelected.EmployerNo == null)
//{
// EmpoyersSelected.EditEmployerNo(command.ArchiveCode);
//}
command.InsuranceCode = !string.IsNullOrWhiteSpace(command.InsuranceCode) ? command.InsuranceCode.ConvertToEnglish() : "";
command.ArchiveCode = !string.IsNullOrWhiteSpace(command.ArchiveCode) ? command.ArchiveCode.ConvertToEnglish() : "";
command.AgreementNumber = !string.IsNullOrWhiteSpace(command.AgreementNumber) ? command.AgreementNumber.ConvertToEnglish() : "";
command.TypeOfInsuranceSend = command.TypeOfInsuranceSend == "false" ? null : command.TypeOfInsuranceSend;
#region Vafa
if (command.HasRollCallFreeVip == "ture")
{
//var todayPersianDate = DateTime.Now.ToFirstDayOfNextMonth();
// var financialWorkshop
//double amount = Convert.ToDouble(0);
//var commandSaveRollCall = new CreateRollCallService()
//{
// AccountId = _authHelper.CurrentAccountId(),
// WorkshopId = command.Id,
// ServiceType = "VIP",
// EndService = command.EndService,
// Amount = amount,
// MaxPersonValid = -1,
// Duration = command.Duration,
//};
//var resultRollCall = _rollCallServiceApplication.Create(commandSaveRollCall);
}
}
}
foreach (var item in codes)
if (item == convert2)
checkExist = true;
#endregion
if (checkNumber)
{
//var EmpoyersSelected = _EmployerRepository.Get(command.EmployerId);
//if (EmpoyersSelected.EmployerNo == null)
//{
// EmpoyersSelected.EditEmployerNo(command.ArchiveCode);
//}
command.InsuranceCode = !string.IsNullOrWhiteSpace(command.InsuranceCode)
? command.InsuranceCode.ConvertToEnglish()
: "";
command.ArchiveCode = !string.IsNullOrWhiteSpace(command.ArchiveCode)
? command.ArchiveCode.ConvertToEnglish()
: "";
command.AgreementNumber = !string.IsNullOrWhiteSpace(command.AgreementNumber)
? command.AgreementNumber.ConvertToEnglish()
: "";
command.TypeOfInsuranceSend = command.TypeOfInsuranceSend == "false" ? null : command.TypeOfInsuranceSend;
var result = _workshopApplication.Edit(command);
var result = _workshopApplication.Edit(command);
return new JsonResult(result);
}
return new JsonResult(result);
}
else
{
var res2 = _workshopApplication.Err();
return new JsonResult(res2);
}
//else
//{
// var res3 = _workshopApplication.ExistErr();
// return new JsonResult(res3);
//}
}
var res2 = _workshopApplication.Err();
return new JsonResult(res2);
//else
//{
// var res3 = _workshopApplication.ExistErr();
// return new JsonResult(res3);
//}
}
}
}
}

View File

@@ -0,0 +1,378 @@
@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>
}
<div class="p-2">
<div class="form-add">
<div class="datainputs">
<div class="form-group">
<select class="form-control SelectItemAccount">
@foreach (var itemAccount in Model.AccountsList)
{
<option value="@itemAccount.Id">@itemAccount.Fullname</option>
}
</select>
</div>
</div>
<a href="#" id="addMore" class="add_input">افزودن</a>
</div>
<div id="req_input" class="req_input">
<div class="head-section">
<span class="rowNumber">ردیف</span>
<span class="row-fullname">نام و نام خانوادگی</span>
<span class="row-contract-checkout">
<input type="checkbox" class="myCheckbox checkboxes" id="contractCheckoutCheckAll" disabled="disabled">
<label for="contractCheckoutCheckAll" style="margin: 0;">قرارداد و تصفیه</label>
</span>
<span class="row-insurance">
<input type="checkbox" class="myCheckbox checkboxes" id="insuranceCheckAll" disabled="disabled">
<label for="insuranceCheckAll" style="margin: 0;">بیمه</label>
</span>
<span class="row-tax">
<input type="checkbox" class="myCheckbox checkboxes" id="taxCheckAll" disabled="disabled">
<label for="taxCheckAll" style="margin: 0;">مالیات</label>
</span>
<span class="row-active-deactive">فعال یا غیر فعال</span>
</div>
</div>
</div>
<script>
$(document).ready(function () {
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);
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>

View File

@@ -0,0 +1,412 @@
@model CompanyManagment.App.Contracts.Workshop.EditWorkshop
@{
int index = 1;
<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>
}
<div class="p-2">
<div class="form-add">
<div class="datainputs">
<div class="form-group">
<select class="form-control SelectItemAccount">
@foreach (var itemAccount in Model.AccountsList)
{
<option value="@itemAccount.Id">@itemAccount.Fullname</option>
}
</select>
</div>
</div>
<a href="#" id="addMore" class="add_input">افزودن</a>
</div>
<div id="req_input" class="req_input">
<div class="head-section">
<span class="rowNumber">ردیف</span>
<span class="row-fullname">نام و نام خانوادگی</span>
<span class="row-contract-checkout">
<input type="checkbox" class="myCheckbox checkboxes" id="contractCheckoutCheckAll">
<label for="contractCheckoutCheckAll" style="margin: 0;">قرارداد و تصفیه</label>
</span>
<span class="row-insurance">
<input type="checkbox" class="myCheckbox checkboxes" id="insuranceCheckAll">
<label for="insuranceCheckAll" style="margin: 0;">بیمه</label>
</span>
<span class="row-tax">
<input type="checkbox" class="myCheckbox checkboxes" id="taxCheckAll">
<label for="taxCheckAll" style="margin: 0;">مالیات</label>
</span>
<span class="row-active-deactive">فعال یا غیر فعال</span>
</div>
@foreach (var itemAccount in Model.InAccountIdsList)
{
<div class="required_inp" data-id="@itemAccount.Id">
<input type="hidden" name="Command.AccountIdsList" value="@itemAccount.Id">
<div class="rowNumber"><span class="row-number">@(index++)</span></div>
<span class="row-fullname">@itemAccount.Fullname</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>
}
</div>
</div>
<script>
$(document).ready(function () {
let counter = 1;
$('.SelectItemAccount').select2({
dir: "rtl"
});
$("#addMore").click(function () {
var selectedOption = $('.SelectItemAccount option:selected');
var selectedText = selectedOption.text();
var selectedValue = selectedOption.val();
if (selectedValue) {
selectedOption.remove();
InAccountIdsList = null;
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);
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>

View File

@@ -108,6 +108,8 @@
<None Include="Areas\Admin\Pages\Company\PersonnelInfo\Index.cshtml" />
<None Include="Areas\Admin\Pages\Company\PersonnelInfo\PrintAll.cshtml" />
<None Include="Areas\Admin\Pages\Company\Reports\Index.cshtml" />
<None Include="Areas\Admin\Pages\Company\Workshops\_CreateForms\FormPermissionAccount.cshtml" />
<None Include="Areas\Admin\Pages\Company\Workshops\_EditForms\FormPermissionAccount.cshtml" />
<None Include="Areas\Camera\Pages\Index.cshtml" />
<None Include="Areas\Camera\Pages\Shared\_ValidationScriptsPartial.cshtml" />
<None Include="Areas\Camera\Pages\_ViewImports.cshtml" />