ClassificationEmployee add to group or edit membrize completed

This commit is contained in:
SamSys
2025-10-26 19:10:20 +03:30
parent 490393acbc
commit 23c99e60d5
19 changed files with 1935 additions and 36 deletions

View File

@@ -14,17 +14,15 @@ public class ClassificationEmployee : EntityBase
/// <param name="classificationSchemeId"></param>
/// <param name="classificationGroupId"></param>
/// <param name="classificationGroupJobId"></param>
/// <param name="startGroupDate"></param>
/// <param name="endGroupDate"></param>
public ClassificationEmployee(long workshopId, long employeeId, long classificationSchemeId, long classificationGroupId, long classificationGroupJobId, DateTime? startGroupDate, DateTime? endGroupDate)
public ClassificationEmployee(long workshopId, long employeeId, long classificationSchemeId, long classificationGroupId, long classificationGroupJobId)
{
WorkshopId = workshopId;
EmployeeId = employeeId;
ClassificationSchemeId = classificationSchemeId;
ClassificationGroupId = classificationGroupId;
ClassificationGroupJobId = classificationGroupJobId;
StartGroupDate = startGroupDate;
EndGroupDate = endGroupDate;
}
/// <summary>
@@ -73,17 +71,10 @@ public class ClassificationEmployee : EntityBase
/// <param name="classificationSchemeId"></param>
/// <param name="classificationGroupId"></param>
/// <param name="classificationGroupJobId"></param>
/// <param name="startGroupDate"></param>
/// <param name="endGroupDate"></param>
public void Edit(long workshopId, long employeeId, long classificationSchemeId, long classificationGroupId, long classificationGroupJobId, DateTime? startGroupDate, DateTime? endGroupDate)
public void Edit(long classificationGroupId, long classificationGroupJobId)
{
WorkshopId = workshopId;
EmployeeId = employeeId;
ClassificationSchemeId = classificationSchemeId;
ClassificationGroupId = classificationGroupId;
ClassificationGroupJobId = classificationGroupJobId;
StartGroupDate = startGroupDate;
EndGroupDate = endGroupDate;
}
}

View File

@@ -0,0 +1,25 @@
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.ClassificationScheme;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Company.Domain.ClassificationSchemeAgg;
public interface IClassificationEmployeeRepository : IRepository<long, ClassificationEmployee>
{
/// <summary>
/// دریافت لیست پرسنل کارگاه
/// تب افزودن پرسنل
/// </summary>
/// <param name="schemeId"></param>
/// <returns></returns>
Task<List<EmployeeInfoList>> GetEmployeeListData(long schemeId);
/// <summary>
/// دریافت اطلاعات عضویتی پرسنل در گروه
/// </summary>
/// <param name="employeeId"></param>
/// <returns></returns>
Task<ClassificationEmployee> GetEmployeeMemberizeData(long employeeId);
}

View File

@@ -7,6 +7,13 @@ namespace Company.Domain.ClassificationSchemeAgg;
public interface IClassificationGroupRepository : IRepository<long, ClassificationGroup>
{
/// <summary>
/// دریافت گروه های طرح
/// </summary>
/// <param name="schemeId"></param>
/// <returns></returns>
Task<List<ClassificationGroupList>> GetGroups(long schemeId);
/// <summary>
/// دریافت گروه ها و مشاغلشان برای تب تعیین مشاغل
/// </summary>

View File

@@ -0,0 +1,84 @@
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.ClassificationScheme;
/// <summary>
/// مدل برای مدال افزودن پرسنل ب گروه
/// </summary>
public class AddEmployeeToGroup
{
/// <summary>
/// آی دی
/// </summary>
public long Id { get; set; }
/// <summary>
/// نام کامل پرسنل
/// </summary>
public string EmployeeFullName { get; set; }
/// <summary>
/// آی دی پرسنل
/// </summary>
public long EmployeeId { get; set; }
/// <summary>
/// آی دی طرح
/// </summary>
public long SchemeId { get; set; }
/// <summary>
/// آی دی گروه
/// </summary>
public long GroupId { get; set; }
/// <summary>
/// شماره گروه
/// </summary>
public long GoroupNo { get; set; }
/// <summary>
/// آی دی شغل
/// </summary>
public long JobId { get; set; }
/// <summary>
/// نام شغل
/// </summary>
public string JobName { get; set; }
/// <summary>
/// کد شغل
/// </summary>
public string JobCode { get; set; }
/// <summary>
/// لیست گروه ها
/// </summary>
public List<ClassificationGroupList> ClassificationGroupList{ get; set; }
}
/// <summary>
/// لیست گروه ها
/// </summary>
public class ClassificationGroupList
{
/// <summary>
/// آی دی گروه
/// </summary>
public long GroupId { get; set; }
/// <summary>
/// شماره گروه
/// استرینگ
/// </summary>
public string GroupNo { get; set; }
/// <summary>
/// شماره گروه
/// اینتیجر
/// </summary>
public int GroupNoInt { get; set; }
}

View File

@@ -0,0 +1,108 @@
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.ClassificationScheme;
/// <summary>
/// جستجوی پرسنل
/// تب افزودن پرسنل طبقه بندی مشاغل
/// </summary>
public class EmployeeInfoTab
{
/// <summary>
/// آی دی کارگاه
/// </summary>
public long WorkshopId { get; set; }
/// <summary>
/// آی دی پرسنل
/// </summary>
public long EmployeeId { get; set; }
/// <summary>
/// نام کامل پرسنل
/// </summary>
public string FullName { get; set; }
/// <summary>
/// آی دی طرح
/// </summary>
public long SchemeId { get; set; }
/// <summary>
/// لیست پرسنل
/// </summary>
public List<EmployeeInfoList> EmployeeInfoList { get; set; }
}
/// <summary>
/// لیست پرسنل
/// تب افزودن پرسنل طبقه بندی مشاغل
/// </summary>
public class EmployeeInfoList
{
/// <summary>
/// آی دی پرسنل
/// </summary>
public long EmployeeId { get; set; }
/// <summary>
/// نام کامل پرسنل
/// </summary>
public string FullName { get; set; }
/// <summary>
/// شماره گروه یا گره هایی که پرسنل در آن اضافه شده
/// </summary>
public string GroupNo { get; set; }
/// <summary>
/// آیا پرسنل هیچ گروهی دارد؟
/// </summary>
public bool HasGroup { get; set; }
/// <summary>
/// آخرین تاریخ شروع بکار قراداد
/// </summary>
public string LastStartContractWork { get; set; }
/// <summary>
/// آخرین تاریخ ترک کار قراداد
/// </summary>
public string LastLeftContractWork { get; set; }
/// <summary>
/// آخرین تاریخ شروع بکار بیمه
/// </summary>
public string LastStartInsuranceWork { get; set; }
/// <summary>
/// آخرین تاریخ ترک کار بیمه
/// </summary>
public string LastLeftInsuranceWork { get; set; }
/// <summary>
/// آیا پرسنل قرداد است
/// </summary>
public bool ContractPerson { get; set; }
/// <summary>
/// آیا پرسنل بیمه است
/// </summary>
public bool InsurancePerson { get; set; }
/// <summary>
/// آیا ترک کار قرارداد دارد
/// </summary>
public bool ContractLeft { get; set; }
/// <summary>
/// آیا ترک کار بیمه دارد
/// </summary>
public bool InsuranceLeft { get; set; }
/// <summary>
/// آیا کلا ترک کار کرده است
/// </summary>
public bool Black { get; set; }
}

View File

@@ -110,4 +110,41 @@ public interface IClassificationSchemeApplication
/// <returns></returns>
Task<OperationResult> EditGroupSalaryAndCoefficient(SalaryAndRialCoefficientModel command);
/// <summary>
/// دریافت لیست پرسنل برای تب افزودن پرسنل
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
Task<EmployeeInfoTab> GetEmployeeDataTab(EmployeeInfoTab command);
/// <summary>
/// دریافت گروه های طرح
/// </summary>
/// <param name="schemeId"></param>
/// <returns></returns>
Task<List<ClassificationGroupList>> GetGroups(long schemeId);
/// <summary>
/// ذخیره پرسنل افزوده شده در گروه
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
Task<OperationResult> AddEmployeeToGroup(AddEmployeeToGroup command);
/// <summary>
/// ذخیره ویرایش گروه پرسنل
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
Task<OperationResult> EditGroupMember(AddEmployeeToGroup command);
/// <summary>
/// دریافت اطلاعات عضویتی پرسنل در گروه
/// </summary>
/// <param name="employeeId"></param>
/// <returns></returns>
Task<AddEmployeeToGroup> GetEmployeeMemberizeData(long employeeId);
}

View File

@@ -16,13 +16,15 @@ public class ClassificationSchemeApplication : IClassificationSchemeApplication
private readonly IClassificationGroupRepository _classificationGroupRepository;
private readonly IClassificationGroupSalariesRepository _classificationGroupSalariesRepository;
private readonly IClassificationRialCoefficientRepository _classificationRialCoefficientRepository;
private readonly IClassificationEmployeeRepository _classificationEmployeeRepository;
public ClassificationSchemeApplication(IClassificationSchemeRepository classificationSchemeRepository, IClassificationGroupRepository classificationGroupRepository, IClassificationGroupSalariesRepository classificationGroupSalariesRepository, IClassificationRialCoefficientRepository classificationRialCoefficientRepository)
public ClassificationSchemeApplication(IClassificationSchemeRepository classificationSchemeRepository, IClassificationGroupRepository classificationGroupRepository, IClassificationGroupSalariesRepository classificationGroupSalariesRepository, IClassificationRialCoefficientRepository classificationRialCoefficientRepository, IClassificationEmployeeRepository classificationEmployeeRepository)
{
_classificationSchemeRepository = classificationSchemeRepository;
_classificationGroupRepository = classificationGroupRepository;
_classificationGroupSalariesRepository = classificationGroupSalariesRepository;
_classificationRialCoefficientRepository = classificationRialCoefficientRepository;
_classificationEmployeeRepository = classificationEmployeeRepository;
}
public Task<ClassificationSchemePartialModel> ClassificationSchemePartialModel(long workshopId)
@@ -303,4 +305,96 @@ public class ClassificationSchemeApplication : IClassificationSchemeApplication
return op.Succcedded();
}
public async Task<EmployeeInfoTab> GetEmployeeDataTab(EmployeeInfoTab command)
{
var employeeInfoTab = new EmployeeInfoTab();
var employeeInfoList = _classificationEmployeeRepository.GetEmployeeListData(command.SchemeId).GetAwaiter().GetResult();
if (employeeInfoList.Any())
{
if (!string.IsNullOrWhiteSpace(command.FullName))
employeeInfoList = employeeInfoList.Where(x => x.FullName.Contains(command.FullName)).ToList();
employeeInfoTab.EmployeeInfoList = employeeInfoList;
employeeInfoTab.FullName = command.FullName;
}
return employeeInfoTab;
}
public async Task<List<ClassificationGroupList>> GetGroups(long schemeId)
{
return await _classificationGroupRepository.GetGroups(schemeId);
}
public async Task<OperationResult> AddEmployeeToGroup(AddEmployeeToGroup command)
{
var op = new OperationResult();
#region Validation
if (command.GroupId == 0)
return op.Failed("لطفا گروه را انتخاب کنید");
if (command.JobId == 0)
return op.Failed("لطفا سمت را انتخاب کنید");
#endregion
var scheme = _classificationSchemeRepository.GetClassificationScheme(command.SchemeId).GetAwaiter().GetResult();
var create = new ClassificationEmployee(scheme.WorkshopId, command.EmployeeId, command.SchemeId,
command.GroupId, command.JobId);
await _classificationEmployeeRepository.CreateAsync(create);
await _classificationEmployeeRepository.SaveChangesAsync();
return op.Succcedded();
}
public async Task<OperationResult> EditGroupMember(AddEmployeeToGroup command)
{
var op = new OperationResult();
#region Validation
if (command.GroupId == 0)
return op.Failed("لطفا گروه را انتخاب کنید");
if (command.JobId == 0)
return op.Failed("لطفا سمت را انتخاب کنید");
#endregion
var editGroup = _classificationEmployeeRepository.Get(command.Id);
editGroup.Edit(command.GroupId, command.JobId);
await _classificationEmployeeRepository.SaveChangesAsync();
return op.Succcedded();
}
/// <summary>
/// دریافت اطلاعات عضویتی پرسنل در گروه
/// </summary>
/// <param name="employeeId"></param>
/// <returns></returns>
public async Task<AddEmployeeToGroup> GetEmployeeMemberizeData(long employeeId)
{
var result = new AddEmployeeToGroup();
var res = await _classificationEmployeeRepository.GetEmployeeMemberizeData(employeeId);
result.EmployeeId = employeeId;
result.GroupId = res.ClassificationGroupId;
result.JobId = res.ClassificationGroupJobId;
result.Id = res.id;
return result;
}
}

View File

@@ -0,0 +1,192 @@
using System.Collections.Generic;
using System.Linq;
using System;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.InfraStructure;
using Company.Domain.ClassificationSchemeAgg;
using CompanyManagment.App.Contracts.ClassificationScheme;
using CompanyManagment.App.Contracts.Workshop;
using Microsoft.EntityFrameworkCore;
namespace CompanyManagment.EFCore.Repository;
public class ClassificationEmployeeRepository : RepositoryBase<long, ClassificationEmployee>, IClassificationEmployeeRepository
{
private readonly CompanyContext _context;
public ClassificationEmployeeRepository(CompanyContext context) : base(context)
{
_context = context;
}
public async Task<List<EmployeeInfoList>> GetEmployeeListData(long schemeId)
{
var leftDate = new DateTime(2121, 3, 21);
var workshopId = _context.ClassificationSchemes.FirstOrDefault(x => x.id == schemeId)!.WorkshopId;
var join = new List<PersonnelInfoViewModel>();
var contractLeftWork =await _context.LeftWorkList.Include(em=>em.Employee).Select(x => new PersonnelInfoViewModel()
{
WorkshopId = x.WorkshopId,
EmployeeId = x.EmployeeId,
FullName = x.Employee.FullName,
PersonnelCode = 0,
ContractPerson = true,
ContractLeft = x.LeftWorkDate != leftDate,
StartWork = x.StartWorkDate,
LeftWork = x.LeftWorkDate,
LastStartInsuranceWork = "-",
LastLeftInsuranceWork = "-",
}).Where(x => x.WorkshopId == workshopId)
.OrderByDescending(x => x.StartWork)
.ToListAsync();
contractLeftWork = contractLeftWork.Select(x => new PersonnelInfoViewModel()
{
WorkshopId = x.WorkshopId,
EmployeeId = x.EmployeeId,
FullName = x.FullName,
ContractPerson = true,
ContractLeft = x.ContractLeft,
LastStartContractWork = x.StartWork.ToFarsi(),
LastLeftContractWork = x.LeftWork != leftDate ? x.LeftWork.ToFarsi() : "-",
StartWork = x.StartWork,
LeftWork = x.LeftWork,
LastStartInsuranceWork = x.LastStartInsuranceWork,
LastLeftInsuranceWork = x.LastLeftInsuranceWork,
}).ToList();
var insuranceLeftWork =await _context.LeftWorkInsuranceList.Include(em=> em.Employee).Select(x => new PersonnelInfoViewModel()
{
WorkshopId = x.WorkshopId,
EmployeeId = x.EmployeeId,
FullName = x.Employee.FullName,
PersonnelCode = 0,
InsurancePerson = true,
InsuranceLeft = x.LeftWorkDate != null,
StartWork = x.StartWorkDate,
LastStartInsuranceWork = x.StartWorkDate.ToFarsi(),
LastLeftInsuranceWork = x.LeftWorkDate != null ? x.LeftWorkDate.ToFarsi() : "-",
}).Where(x => x.WorkshopId == workshopId)
.OrderByDescending(x => x.StartWork).ToListAsync();
insuranceLeftWork = insuranceLeftWork.Select(x => new PersonnelInfoViewModel()
{
WorkshopId = x.WorkshopId,
EmployeeId = x.EmployeeId,
FullName = x.FullName,
PersonnelCode = _context.PersonnelCodeSet.Any(p => p.EmployeeId == x.EmployeeId && p.WorkshopId == x.WorkshopId) ?
_context.PersonnelCodeSet.FirstOrDefault(p => p.EmployeeId == x.EmployeeId && p.WorkshopId == x.WorkshopId)!.PersonnelCode : 0,
InsurancePerson = true,
InsuranceLeft = x.InsuranceLeft,
StartWork = x.StartWork,
LastStartInsuranceWork = x.LastStartInsuranceWork,
LastLeftInsuranceWork = x.LastLeftInsuranceWork,
}).ToList();
var joinEqualList = contractLeftWork.Join(insuranceLeftWork,
x => x.EmployeeId,
c => c.EmployeeId,
(first, second) => new PersonnelInfoViewModel
{
EmployeeId = first.EmployeeId,
ContractPerson = first.ContractPerson,
ContractLeft = first.ContractLeft,
InsurancePerson = second.InsurancePerson,
InsuranceLeft = second.InsuranceLeft,
LastStartContractWork = first.LastStartContractWork,
LastLeftContractWork = first.LastLeftContractWork,
StartWork = first.StartWork,
LeftWork = first.LeftWork,
LastStartInsuranceWork = second.LastStartInsuranceWork,
LastLeftInsuranceWork = second.LastLeftInsuranceWork,
}).ToList();
if (contractLeftWork.Any() && !insuranceLeftWork.Any())
{
join = contractLeftWork.ToList();
}
else if (!contractLeftWork.Any() && insuranceLeftWork.Any())
{
join = insuranceLeftWork.ToList();
}
else if (contractLeftWork.Any() && insuranceLeftWork.Any())
{
join = contractLeftWork.Concat(insuranceLeftWork).ToList();
}
//if (joinEqualList.Count == 0)
// return new List<EmployeeInfoList>();
//join = join.GroupBy(x => x.EmployeeId).Select(d => d.First()).ToList();
var employeeWhitGroup = _context.ClassificationEmployees.Include(g=>g.ClassificationGroup)
.Where(x => x.ClassificationSchemeId == schemeId);
var finalList = join.Select(x =>
{
var hasGroup = employeeWhitGroup.Any(em => em.EmployeeId == x.EmployeeId);
var groupNo = "";
if (hasGroup)
{
var group = employeeWhitGroup.Where(g => g.EmployeeId == x.EmployeeId)
.Select(n => n.ClassificationGroup.GroupNo).ToList();
if (group.Count > 0)
groupNo = string.Join(" - ", group);
}
var contractPerson = joinEqualList.Any(c => c.EmployeeId == x.EmployeeId) ? joinEqualList.FirstOrDefault(c => c.EmployeeId == x.EmployeeId)!.ContractPerson : x.ContractPerson;
var insurancePerson = joinEqualList.Any(c => c.EmployeeId == x.EmployeeId) ? joinEqualList.FirstOrDefault(c => c.EmployeeId == x.EmployeeId)!.InsurancePerson : x.InsurancePerson;
var contractLeft = joinEqualList.Any(c => c.EmployeeId == x.EmployeeId) ? joinEqualList.FirstOrDefault(c => c.EmployeeId == x.EmployeeId)!.ContractLeft : x.ContractLeft;
var insuranceLeft = joinEqualList.Any(c => c.EmployeeId == x.EmployeeId) ? joinEqualList.FirstOrDefault(c => c.EmployeeId == x.EmployeeId)!.InsuranceLeft : x.InsuranceLeft;
var lastStartInsuranceWork = joinEqualList.Any(c => c.EmployeeId == x.EmployeeId) ? joinEqualList.FirstOrDefault(c => c.EmployeeId == x.EmployeeId)!.LastStartInsuranceWork : x.LastStartInsuranceWork;
var lastLeftInsuranceWork = joinEqualList.Any(c => c.EmployeeId == x.EmployeeId) ? joinEqualList.FirstOrDefault(c => c.EmployeeId == x.EmployeeId)!.LastLeftInsuranceWork : x.LastLeftInsuranceWork;
return new EmployeeInfoList
{
HasGroup = hasGroup,
GroupNo = groupNo,
EmployeeId = x.EmployeeId,
FullName = x.FullName,
ContractPerson = contractPerson,
InsurancePerson = insurancePerson,
ContractLeft = contractLeft,
InsuranceLeft = insuranceLeft,
Black = ((contractPerson && insurancePerson && insuranceLeft && contractLeft) || (contractPerson && !insurancePerson && contractLeft) || (insurancePerson && !contractPerson && insuranceLeft)) ? true : false,
LastStartContractWork = x.LastStartContractWork,
LastLeftContractWork = x.LastLeftContractWork,
LastStartInsuranceWork = lastStartInsuranceWork,
LastLeftInsuranceWork = lastLeftInsuranceWork,
};
}).ToList();
var final = finalList.GroupBy(x => x.EmployeeId).Select(x => x.First()).ToList();
return final;
}
/// <summary>
/// دریافت اطلاعات عضویتی پرسنل در گروه
/// </summary>
/// <param name="employeeId"></param>
/// <returns></returns>
public async Task<ClassificationEmployee> GetEmployeeMemberizeData(long employeeId)
{
return await _context.ClassificationEmployees.FirstOrDefaultAsync(x => x.EmployeeId == employeeId);
}
}

View File

@@ -17,6 +17,25 @@ public class ClassificationGroupRepository : RepositoryBase<long, Classification
_context = context;
}
/// <summary>
/// دریافت گروه های طرح
/// </summary>
/// <param name="schemeId"></param>
/// <returns></returns>
public async Task<List<ClassificationGroupList>> GetGroups(long schemeId)
{
return await _context.ClassificationGroups
.Where(x => x.ClassificationSchemeId == schemeId)
.Select(x=> new ClassificationGroupList
{
GroupId = x.id,
GroupNo = x.GroupNo,
GroupNoInt = Convert.ToInt32(x.GroupNo)
}).OrderBy(x=>x.GroupNoInt).ToListAsync();
}
/// <summary>
/// دریافت گروه ها و مشاغلشان برای تب تعیین مشاغل
/// </summary>

View File

@@ -506,6 +506,7 @@ public class PersonalBootstrapper
services.AddTransient<IClassificationGroupRepository, ClassificationGroupRepository>();
services.AddTransient<IClassificationGroupSalariesRepository, ClassificationGroupSalariesRepository>();
services.AddTransient<IClassificationRialCoefficientRepository, ClassificationRialCoefficientRepository>();
services.AddTransient<IClassificationEmployeeRepository, ClassificationEmployeeRepository>();
#endregion
//=========End Of Main====================================

View File

@@ -72,7 +72,7 @@
<span>تعیین دستمزد گروه ها</span>
</a>
</li>
<li class="li-wizard step" id="addEmployeesTab" data-url="/Admin/Company/Workshops/ClassificationScheme?handler=AddEmployees">
<li class="li-wizard step" id="addEmployeesTab" data-url="/Admin/Company/Workshops/ClassificationScheme?handler=AddEmployeesTab">
<a class="nav-link">
<div class="success-icon" id="success-icon3" style="display:none;">
<svg width="11" height="8" viewBox="0 0 11 8" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -163,9 +163,17 @@
break;
case "addEmployeesTab" :
if(hasScheme === "true"){
loadPartial(url);
$("#schemeTab, #jobsTab, #salariesTab, #addEmployeesTab").removeClass("active");
$(this).addClass("active");
checkEmptyGroup(function (result) {
if (result) {
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', 'لطفا ابتدا مشاغل تمامی گروه ها را تعیین نمایید');
} else {
url += "&schemeId=" + schemeId;
loadPartial(url);
$("#schemeTab, #jobsTab, #salariesTab").removeClass("active");
$('#addEmployeesTab').addClass("active");
}
});
}else{
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', 'ابتدا باید طرح ایجاد کنید');
@@ -188,6 +196,8 @@
callback(data.hasEmptyGroup);
});
}
});

View File

@@ -1,6 +1,7 @@
using Company.Domain.ClassificationSchemeAgg;
using CompanyManagment.App.Contracts.ClassificationScheme;
using CompanyManagment.App.Contracts.Job;
using CompanyManagment.App.Contracts.Workshop;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
@@ -290,9 +291,162 @@ public class ClassificationSchemeModel : PageModel
#endregion
public IActionResult OnGetAddEmployees()
#region EmployeesTab
/// <summary>
/// تب افزودن پرسنل
/// </summary>
/// <param name="schemeId"></param>
/// <returns></returns>
public IActionResult OnGetAddEmployeesTab(long schemeId)
{
return Partial("_ClassificationPartials/AddClassificationEmployees");
var model = new EmployeeInfoTab
{
SchemeId = schemeId,
};
//var result = _classificationSchemeApplication.GetEmployeeDataTab(command).GetAwaiter().GetResult();
return Partial("_ClassificationPartials/ClassificationEmployeesTab", model);
}
/// <summary>
/// دریافت نتیجه جستجو در تب پرسنل
/// </summary>
/// <param name="schemeId"></param>
/// <param name="fullName"></param>
/// <returns></returns>
public IActionResult OnGetAjaxDataLoading(long schemeId, string fullName)
{
var command = new EmployeeInfoTab
{
SchemeId = schemeId,
FullName = fullName,
};
var result = _classificationSchemeApplication.GetEmployeeDataTab(command).GetAwaiter().GetResult();
if(result.EmployeeInfoList == null || !result.EmployeeInfoList.Any())
return new JsonResult(new
{
hasEmployee = false
});
var personnelList = result.EmployeeInfoList.OrderBy(x => x.Black ? 1 : 0);
return new JsonResult(new
{
hasEmployee = true,
personnelList
});
}
/// <summary>
///لود مودال افزودن پرسنل به گروه
/// </summary>
/// <param name="employeeId"></param>
/// <param name="schemeId"></param>
/// <param name="employeeFullName"></param>
/// <returns></returns>
public IActionResult OnGetAddToGroup(long employeeId, long schemeId, string employeeFullName)
{
var model = new AddEmployeeToGroup();
var groups = _classificationSchemeApplication.GetGroups(schemeId).GetAwaiter().GetResult();
model.SchemeId = schemeId;
model.EmployeeId = employeeId;
model.EmployeeFullName = employeeFullName;
model.ClassificationGroupList = groups;
return Partial("_ClassificationPartials/AddEmployeeToGroup", model);
}
/// <summary>
/// ذخیره انتخاب گروه و شغل برای پرسنل
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
public IActionResult OnPostAddToGroup(AddEmployeeToGroup command)
{
var result = _classificationSchemeApplication.AddEmployeeToGroup(command).GetAwaiter().GetResult();
if (!result.IsSuccedded)
{
return new JsonResult(new
{
isSuccess = false,
message = result.Message,
});
}
return new JsonResult(new
{
isSuccess = true,
message = result.Message,
});
}
/// <summary>
/// دریافت لیست مشاغل با ای دی گروه
/// </summary>
/// <param name="schemeId"></param>
/// <param name="groupId"></param>
/// <returns></returns>
public IActionResult OnGetJobList(long schemeId, long groupId)
{
var jobList = _classificationSchemeApplication.GetGroupJobs(groupId).GetAwaiter().GetResult();
return new JsonResult(new
{
jobs = jobList,
});
}
/// <summary>
///لود مودال ویرایش پرسنل گروه
/// </summary>
/// <param name="employeeId"></param>
/// <param name="schemeId"></param>
/// <param name="employeeFullName"></param>
/// <returns></returns>
public IActionResult OnGetEditGroupMember(long employeeId, long schemeId, string employeeFullName)
{
var model = new AddEmployeeToGroup();
var groups = _classificationSchemeApplication.GetGroups(schemeId).GetAwaiter().GetResult();
var employeeMemberizeData = _classificationSchemeApplication.GetEmployeeMemberizeData(employeeId).GetAwaiter().GetResult();
model.SchemeId = schemeId;
model.EmployeeId = employeeId;
model.EmployeeFullName = employeeFullName;
model.ClassificationGroupList = groups;
model.GroupId = employeeMemberizeData.GroupId;
model.JobId = employeeMemberizeData.JobId;
model.Id = employeeMemberizeData.Id;
return Partial("_ClassificationPartials/EditGroupMember", model);
}
/// <summary>
/// ذخیره ویرایش گروه پرسنل
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
public IActionResult OnPostEditGroupMember(AddEmployeeToGroup command)
{
var result = _classificationSchemeApplication.EditGroupMember(command).GetAwaiter().GetResult();
if (!result.IsSuccedded)
{
return new JsonResult(new
{
isSuccess = false,
message = result.Message,
});
}
return new JsonResult(new
{
isSuccess = true,
message = result.Message,
});
}
#endregion
}

View File

@@ -1,9 +0,0 @@
@*
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
}
<div class="card card-pattern m-t-10">
<button class="btn btn-success"> ایجاد پرسنل طرح</button>
</div>

View File

@@ -0,0 +1,185 @@
@model CompanyManagment.App.Contracts.ClassificationScheme.AddEmployeeToGroup
@Html.AntiForgeryToken()
@{
<style>
.modal .modal-dialog .modal-content {
padding-bottom: 10px !important;
}
.modal-footer {
padding: 0.5rem 1rem !important; /* کوچکتر کردن فاصله */
margin-top: -10px; /* کمی بالا آوردن */
}
.modal .modal-dialog .modal-content {
padding-bottom: 10px;
}
</style>
}
<div class="modal-header">
<h5 class="modal-title">افزودن پرسنل به گروه</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="بستن">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="row m-t-10">
<h5 class="modal-title">@Model.EmployeeFullName</h5>
</div>
<div class="card shadow-sm border-0" style="margin-top: 31px;">
<div class="card-body">
<div class="lineDiv"></div>
<div class="row m-t-10">
<div class="col-md-6 mb-3">
<select id="groupList" asp-for="GroupId" class="form-select form-control" onchange="selectGroup(this)">
<option value="0">انتخاب گروه</option>
@foreach (var item in @Model.ClassificationGroupList)
{
<option value="@item.GroupId" data-groupno="@item.GroupNo"><span>گروه</span><span>&nbsp;</span><span>@item.GroupNo</span></option>
}
</select>
</div>
<div class="col-md-6 mb-3">
<select id="jobList" asp-for="JobId" class="form-select form-control">
<option value="0">انتخاب سمت</option>
</select>
</div>
<div id="groupHiddenInputs">
</div>
<div id="jobHiddenInputs">
</div>
</div>
<div class="lineDiv"></div>
</div>
</div>
</div>
<input type="hidden" asp-for="SchemeId" value="@Model.SchemeId" />
<input type="hidden" asp-for="EmployeeId" value="@Model.EmployeeId" />
<div class="modal-footer border-0">
<button type="button" onclick="saveBtn()" class="btn btn-success px-4 rounded-pill">ذخیره</button>
<button type="button" class="btn btn-outline-secondary px-4 rounded-pill" data-dismiss="modal">بستن</button>
</div>
<script>
function selectGroup(selectElement) {
const selectedOption = selectElement.options[selectElement.selectedIndex];
const groupId = selectedOption.value;
// const groupNo = selectedOption.getAttribute("data-groupno");
// $('#groupHiddenInputs').html('');
// const inputs =`
// <input type="hidden" name="GroupId" value="${groupId}" />
// `;
// $('#groupHiddenInputs').append(inputs);
let schemeId = '@Model.SchemeId';
var url = `/Admin/Company/Workshops/ClassificationScheme?handler=JobList&schemeId=${schemeId}&groupId=${groupId}`;
console.log("Request URL:", url);
$.get(url, function (data) {
// فرض بر این است که data.jobs یک آرایه از آبجکت‌هایی مثل { jobId, jobName, jobCode } باشد
const jobList = $("#jobList");
jobList.empty(); // پاک کردن آیتم‌های قبلی
jobList.append('<option value="0">انتخاب سمت</option>');
data.jobs.forEach(item => {
jobList.append(
`<option value="${item.jobId}" data-jobname="${item.jobName}" data-jobcode="${item.jobCode}">
${item.jobCode} - ${item.jobName}
</option>`
);
});
});
}
// function selectJob(selectElement) {
// const selectedOption = selectElement.options[selectElement.selectedIndex];
// const jobId = selectedOption.value;
// // const jobname = selectedOption.getAttribute("data-jobname");
// // const jobcode = selectedOption.getAttribute("data-jobcode");
// $('#jobHiddenInputs').html('');
// const inputs =`
// <input type="hidden" name="jobId" value="${jobId}" />
// `;
// $('#jobHiddenInputs').append(inputs);
// }
function saveBtn() {
const groupSelect = document.getElementById("groupList");
const jobSelect = document.getElementById("jobList");
const groupId = groupSelect.options[groupSelect.selectedIndex].value;
const jobId = jobSelect.options[jobSelect.selectedIndex].value;
if (groupId == 0) {
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم', "گروه را انتخاب کنید");
return;
}
if (jobId == 0) {
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم', "سمت را انتخاب کنید");
return;
}
const command = {
employeeId: '@Model.EmployeeId',
schemeId: '@Model.SchemeId',
groupId: Number(groupId),
jobId: Number(jobId)
};
var urlAjaxToSave = '@Url.Page("/Company/Workshops/ClassificationScheme", "AddToGroup")';
$.ajax({
dataType: 'json',
type: 'POST',
url: urlAjaxToSave,
headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() },
data: command,
success: function (response) {
if(response.isSuccess){
$.Notification.autoHideNotify('success', 'top center', 'پیام سیستم ', response.message);
$('.close').click();
setTimeout(function () {
$('#addEmployeesTab').click();
}, 1000);
}else{
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', response.message);
}
},
failure: function (response) {
//console.log(5, response);
}
});
}
</script>

View File

@@ -0,0 +1,697 @@
@model CompanyManagment.App.Contracts.ClassificationScheme.EmployeeInfoTab
@{
<style>
.container .searchPannel {
background: #fbfbff;
border-radius: 20px;
margin-bottom: 20px;
box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
border: 1px solid #e6e6e6;
min-height: 680px;
padding: 8px;
}
.container .filter {
background: #fbfbff;
border-radius: 20px;
margin: 20px 0px;
box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
border: 1px solid #e6e6e6;
}
table {
border-collapse: separate;
border-spacing: 0;
padding: 0 0 0 4px;
}
.table > thead > tr > th {
border-bottom: 2px #fbfbff !important;
background-color: #2dbcbc;
color: #fff;
font-weight: 200;
vertical-align: middle;
}
.table > tbody > tr > td {
color: #131313;
border-top: 2px solid #fbfbff !important;
background-color: #ddf4f4;
text-wrap: nowrap;
}
.table > tbody > tr.withdraw > td {
background-color: #b5b5b5 !important;
}
tr td:first-child {
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
}
tr td:last-child {
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
}
tr:nth-child(even) td {
background-color: #b0e0e08f !important;
}
tr th:first-child {
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
}
tr th:last-child {
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
}
.successSend {
background-color: #b8e3bc;
color: #638f6e;
padding: 2px 7px;
border-radius: 5px;
}
.numbers {
background-color: rgb(187, 240, 240);
color: #0B5959;
display: flex;
width: 30px;
border-radius: 5px;
height: 30px;
align-items: center;
justify-content: center;
}
.errored {
animation: shake 300ms;
box-shadow: inset 0 0 2px #eb3434, 0 0 5px #eb3434 !important;
border: 1px solid #eb3434 !important;
}
@@media screen and (min-width: 1600px) {
.table > thead > tr > th {
font-size: 12px;
}
.table > tbody > tr > td {
font-size: 11px;
}
}
.date-box {
display: flex;
background-color: #e7dbff;
align-items: center;
padding: 7px;
border-radius: 10px;
margin: 3px;
width: 24.6%;
color: #131313;
}
.selectTo {
background-color: #ceebeb;
align-items: center;
padding: 7px;
border-radius: 10px;
}
.bottomRow {
background-color: #e7dbff;
align-items: center;
padding: 7px;
border-radius: 10px;
margin: 3px;
width: 24.6%
}
.searchAll {
background-color: #8892b3;
border-color: #8892b3;
font-family: 'Web_Yekan' !important;
}
.searchOne {
border-bottom-left-radius: 0px;
border-top-left-radius: 0px;
background-color: #3da9c6;
border-color: #3da9c6;
font-family: 'Web_Yekan' !important;
margin-left: -3px;
}
.searchOne:hover, .searchOne:focus, .searchOne:active {
background-color: #8fe1e9;
border-color: #8fe1e9;
}
.searchAll:hover, .searchAll:focus, .searchAll:active {
background-color: #40424b;
border-color: #40424b;
}
.searchOne i {
padding-left: 3px;
font-size: 14px;
}
@@media only screen and (max-width : 1820px) {
.date-box {
width: 24.2%
}
.selectTo {
width: 24.2%
}
.bottomRow {
width: 24.2%
}
}
@@media only screen and (max-width : 992px) {
.date-box {
width: 100%;
margin: 0px 0px 2px 0px;
}
.selectTo {
width: 49%;
margin: 0px 0px 2px 0px;
}
.contractingParty {
width: 100%;
margin: 0px 0px 2px 0px;
}
.startDate {
margin: 0px 0px 2px 0px;
width: 50%;
}
.endDate {
margin: 0px 0px 2px 0px;
width: 50%
}
.bottomRow {
margin: 0px 0px 2px 0px;
width: 50%
}
.searchAll {
width: 49.5%;
}
.searchOne {
width: 49.8%;
}
}
@@media only screen and (max-width : 375px) {
.date-box {
width: 100%;
margin: 0px 0px 2px 0px;
}
.selectTo {
width: 49%;
margin: 0px 0px 2px 0px;
}
.contractingParty {
width: 100%;
margin: 0px 0px 2px 0px;
}
.startDate {
margin: 0px 0px 2px 0px;
width: 50%;
}
.endDate {
margin: 0px 0px 2px 0px;
width: 50%
}
.bottomRow {
margin: 0px 0px 2px 0px;
width: 50%
}
}
.panel-title {
padding: 2px 10px;
}
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-track {
background: #dfdfdf;
border-radius: 5px;
}
::-webkit-scrollbar-thumb {
background: #3c8397;
border-radius: 5px;
}
.goToTop {
position: fixed;
bottom: 40px;
}
.titlePanel {
display: flex;
align-items: center;
justify-content: space-between;
margin: 2px 0;
}
.btn-print-all {
background: #06b6d4;
border: 0;
padding: 4px 8px;
border-radius: 5px;
color: #fff;
transition: all .1s ease-in;
}
.btn-print-all:hover {
background: #0891b2;
}
.btn-print {
background: #8892b3;
padding: 4px 6px;
border-radius: 5px;
transition: all .1s ease-in;
border: 0;
color: #fff;
height: 32px;
width: 32px;
display: flex;
float: left;
}
.btn-print:hover {
background: #0284c7;
color: #ffffff;
}
.table-wrapper {
height: 630px;
overflow-y: scroll;
scrollbar-width: thin;
}
tr.sticky {
position: sticky;
top: 0;
z-index: 1;
}
.tooltiptext {
cursor: text;
font-size: 1rem;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.new-tooltip {
cursor: pointer;
position: relative;
display: inline-block;
}
.new-tooltip .tooltiptext {
width: 100px;
background-color: rgba(0, 0, 0, 0.8);
color: #fff;
-webkit-backdrop-filter: blur(1px);
backdrop-filter: blur(1px);
text-align: center;
border-radius: 6px;
font-weight: semi-bold;
padding: 5px 5px 5px 8px;
transition: opacity 0.5s, visibility 0.5s;
opacity: 0;
visibility: hidden;
pointer-events: none;
position: absolute;
z-index: 1;
bottom: 25px;
left: -45px;
}
.new-tooltip:hover .tooltiptext {
pointer-events: auto;
opacity: 1;
visibility: visible;
}
.skeleton-loader {
width: 100%;
height: 35px;
background: linear-gradient(90deg, #EEEEEE 25%, #DEDEDE 50%, #EEEEEE 75%);
background-size: 200% 100%;
animation: loading 2s infinite ease-in-out;
border-radius: 8px;
margin-bottom: 3px
}
@@keyframes loading {
0% {
background-position: 200% 0;
}
100% {
background-position: -200% 0;
}
}
@@media (max-width: 991px) {
.responsive {
border-collapse: separate;
border-spacing: 0 10px;
}
.responsive > thead th {
display: none;
}
.responsive > tbody td,
.responsive > tbody th {
display: block;
}
.responsive > tbody > tr:nth-child(even) td,
.responsive > tbody > tr:nth-child(even) th {
background-color: #eee;
}
.responsive > tbody > tr > td {
font-size: 11px;
display: flex;
align-items: center;
border-top: 1px solid #fbfbff !important;
}
.responsive > tbody > tr td:first-child {
border-radius: 10px 10px 0 0;
}
.responsive > tbody > tr td:last-child {
border-radius: 0 0 10px 10px;
}
[row-header] {
position: relative;
/* width: 50%;*/
vertical-align: middle;
}
[row-header]:before {
content: attr(row-header);
display: flex;
text-align: right;
width: 125px;
padding-left: 30px;
white-space: break-spaces;
overflow: hidden;
align-items: center;
}
}
.icon-span {
display: inline-block;
text-align: center;
vertical-align: middle;
line-height: 14px;
border-radius: 5px;
padding: 2px;
}
.icon-span{
cursor: pointer;
}
.icon-span svg {
vertical-align: middle;
}
.add-to-group {
background-color: #84cc16;
color: white !important;
}
.edit-group-member {
background-color: #009ee2;
color: white !important;
}
.transfer-group-member{
background-color: #75aea7;
color: white !important;
}
.job-btn-text{
color: white !important;
}
</style>
var i = 1;
var successSend = "successSend";
}
<div class="container filter">
<h3 class="panel-title" style="display: inline-block;color: #7a96a6"><i class="fa fa-search" style="padding-left: 3px; font-size: 14px"></i> جستجو</h3>
<div class="row" style="padding: 15px 10px">
<div class="col-md-3 col-sm-6 col-xs-12 pull-right contractingParty">
<div class="form-group selectTo" style="width: 100% !important; margin: 0 auto;">
<input style="width: 100%" id="FullName" placeholder="نام پرسنل" class="form-control"/>
</div>
</div>
</div>
</div>
<div class="container searchPannel">
<div class="titlePanel">
<h3 class="panel-title" style="display: inline-block;color: #131313;font-size: 15px;">
<i class="fa fa-list" style="padding-left: 3px; font-size: 14px"></i>
لیست پرسنل
</h3>
</div>
<div class="table-wrapper">
<div id="loading" style="padding: 0 0 0 5px;">
@for (var j = 0; j < 16; j++)
{
<div class="skeleton-loader"></div>
}
</div>
<div id="RealodData"></div>
</div>
</div>
<script>
$(document).ready(function() {
let schemeId = '@Model.SchemeId';
$("#FullName").keyup(function() {
const fullname = $(this).val();
LoadData(schemeId, fullname);
});
LoadData(schemeId, fullname = "");
function LoadData(schemeId, fullName) {
$.ajax({
dataType: 'json',
url: '@Url.Page("/Company/Workshops/ClassificationScheme", "AjaxDataLoading")',
type: 'GET',
data: {schemeId: schemeId, fullName: fullName},
success: function(response) {
$('#loading').hide();
$('#RealodData').html('');
var DataTableHtml = '';
if (!response.hasEmployee) {
DataTableHtml += '<h1 style="height: 600px;display: flex;align-items: center;justify-content: center;">این کارگاه پرسنلی ندارد!</h1>';
} else {
const data = response.personnelList;
var i = 0;
DataTableHtml += `<table class="table responsive">
<thead>
<tr class="sticky">
<th>ردیف</th>
<th>نام و نام خانوادگی</th>
<th style="text-align: center;">آخرین تاریخ شروع بکار قرارداد</th>
<th style="text-align: center;">تاریخ ترک کار قرارداد</th>
<th style="text-align: center;">آخرین تاریخ شروع بکار بیمه</th>
<th style="text-align: center;">تاریخ ترک کار بیمه</th>
<th style="text-align: center;">وضعیت گروه</th>
<th style="text-align: center;">عضویت گروه</th>`;
DataTableHtml += `<th style="text-align: left;">عملیات</th>`;
DataTableHtml += `</tr>
</thead>
<tbody class="tb">`;
data.forEach(function(item) {
DataTableHtml += `
<tr class="${item.black ? "withdraw" : ""}">
<td row-header="ردیف" style="text-align: center">
<span class="numbers">
${i += 1}
<span class="idPersonnel" style="display: none;">${item.employeeId}</span>
</span>
</td>
<td row-header="نام و نام خانوادگی">${item.fullName}</td>`;
DataTableHtml += `</td>
<td row-header="آخرین تاریخ شروع بکار قرارداد" class="text-center">`;
if (item.lastStartContractWork == null || item.lastStartContractWork == "") {
DataTableHtml += `<span>-</span>`;
} else {
DataTableHtml += `${item.lastStartContractWork}`;
}
DataTableHtml += `</td>
<td row-header="تاریخ ترک کار قرارداد" class="text-center">`;
if (item.lastLeftContractWork == null || item.lastLeftContractWork == "") {
DataTableHtml += `<span>-</span>`;
} else {
DataTableHtml += `${item.lastLeftContractWork}`;
}
DataTableHtml += `</td>
<td row-header="آخرین تاریخ شروع بکار بیمه" class="text-center">`;
if (item.lastStartInsuranceWork == null || item.lastStartInsuranceWork == "") {
DataTableHtml += `<span>-</span>`;
} else {
DataTableHtml += `${item.lastStartInsuranceWork}`;
}
DataTableHtml += `</td>
<td row-header="تاریخ ترک کار بیمه" class="text-center">`;
if (item.lastLeftInsuranceWork == null || item.lastLeftInsuranceWork == "") {
DataTableHtml += `<span>-</span>`;
} else {
DataTableHtml += `${item.lastLeftInsuranceWork}`;
}
DataTableHtml += `</td>
<td row-header="وضعیت گروه" class="text-center">`;
if (item.hasGroup) {
DataTableHtml += `<span style="background-color: #99d0b0;padding: 5px;border-radius: 5px;">دارای گروه</span>`;
} else {
DataTableHtml += `<span style="background-color: #ffbfbf;padding: 5px;border-radius: 5px;">فاقد گروه</span>`;
}
DataTableHtml += `</td>
<td row-header="عضویت گروه" class="text-center">`;
if (item.hasGroup) {
DataTableHtml += `${item.groupNo}`;;
} else {
DataTableHtml += `<span>-</span>`;
}
DataTableHtml += `<td row-header="عملیات" style="direction: ltr;">`;
if (item.hasGroup)
{
DataTableHtml += `
<span class="icon-span edit-group-member" style="padding: 4px;font-size: 11px;">
<a onclick="editGroupMember(${item.employeeId}, '${item.fullName}')" >
<span class="job-btn-text">ویرایش</span>
<svg width="19" height="18" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="11" cy="11" r="8.25" stroke="white" />
<path d="M11 13.75L11 8.25" stroke="white" stroke-linecap="round" />
<path d="M13.75 11L8.25 11" stroke="white" stroke-linecap="round" />
</svg>
</a>
</span>`;
DataTableHtml += `
<span class="icon-span transfer-group-member" style="padding: 4px;font-size: 11px;">
<a href="#" onclick="editGroupMember(${item.employeeId}, '${item.fullName}')" >
<span class="job-btn-text">انتقال</span>
<svg width="19" height="18" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="11" cy="11" r="8.25" stroke="white" />
<path d="M11 13.75L11 8.25" stroke="white" stroke-linecap="round" />
<path d="M13.75 11L8.25 11" stroke="white" stroke-linecap="round" />
</svg>
</a>
</span>`;
}
else
{
DataTableHtml += `
<span class="icon-span add-to-group" style="padding: 4px 18px;font-size: 11px;">
<a onclick="addToGroup(${item.employeeId}, '${item.fullName}')">
<span class="job-btn-text">افزودن به گروه</span>
<svg width="19" height="18" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="11" cy="11" r="8.25" stroke="white" />
<path d="M11 13.75L11 8.25" stroke="white" stroke-linecap="round" />
<path d="M13.75 11L8.25 11" stroke="white" stroke-linecap="round" />
</svg>
</a>
</span>`;
}
DataTableHtml += `</td></tr>`;
});
DataTableHtml += `</tbody></table>`;
}
$('#RealodData').append(DataTableHtml);
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
}
});
}
});
function addToGroup(employeeId, fullName){
let schemeId = '@Model.SchemeId';
const parametr = `&employeeId=${employeeId}&schemeId=${schemeId}&employeeFullName=${fullName}`;
const url = '#showmodal=@Url.Page("/Company/Workshops/ClassificationScheme", "AddToGroup")';
window.location.href = url + parametr;
}
function editGroupMember(employeeId, fullName){
let schemeId = '@Model.SchemeId';
const parametr = `&employeeId=${employeeId}&schemeId=${schemeId}&employeeFullName=${fullName}`;
const url = '#showmodal=@Url.Page("/Company/Workshops/ClassificationScheme", "EditGroupMember")';
window.location.href = url + parametr;
}
</script>

View File

@@ -32,6 +32,8 @@
border-radius: 5px;
padding: 4px 1px;
margin-bottom: 5px;
font-family: "IranText" !important;
}
.row-number {
@@ -87,7 +89,7 @@
<div class="col-10 col-md-2">سال</div>
<div class="col-6 col-md-2">تاریخ شروع</div>
<div class="col-6 col-md-2">تاریخ پایان</div>
<div class="col-6 col-md-2"> ضریب ریالی </div>
<div class="col-6 col-md-2" style="direction:ltr"> ضریب ریالی </div>
<div class="col-12 col-md-3" style="float:left; direction:ltr">عملیات</div>
</div>
@@ -106,9 +108,11 @@
<div class="col-2 col-md-1"><div class="row-number">@rowIndex</div></div>
<div class="col-10 col-md-2">@item.Year</div>
<div class="col-6 col-md-2">@item.StartDateFa</div>
<div class="col-6 col-md-2">@item.EndDateFa</div>
<div class="col-6 col-md-2">@item.RialCoefficientStr</div>
<div class="col-6 col-md-2">
@item.StartDateFa
</div>
<div class="col-6 col-md-2">@item.EndDateFa</div>
<div class="col-6 col-md-2" style="direction:ltr">@item.RialCoefficientStr</div>
@{
rowIndex++;
}

View File

@@ -22,7 +22,7 @@
box-shadow: 0 1px 2px 0 rgba(0,0,0,.1);
border-top: none;
border-radius: 7px;
background-color: #e8e8e8 !important;
background-color: #e8e8e8;
cursor: pointer;
color: #504f4f;
}
@@ -56,9 +56,13 @@
box-sizing: border-box;
}
.arrowselected{
background-color: #69a3a3 !important;
color: #ffffff !important;
}
</style>
</style>
}
<div class="modal-header">
<h5 class="modal-title"> تعیین مشاغل گروه @Model.GroupNo </h5>
@@ -501,5 +505,72 @@
// console.log(1);
}
}
document.onkeydown = function (e) {
var ul = $('.dadmehr-select-search').find('.result');
if (ul.is(":visible")) {
switch (e.which) {
case 38: // Up arrow
e.preventDefault();
ul.find("li").removeClass('arrowselected');
if ((index - 1) >= 0) {
index--;
ul.find("li.select-item:eq(" + index + ")").addClass('arrowselected');
ul.scrollTop(index * (ul.find("li.select-item:eq(" + index + ")").outerHeight()+5));
ul.find("li.arrowselected").focus();
} else {
index = -1;
}
break;
case 40: // Down arrow
e.preventDefault();
if ((index + 1) < ul.find("li").length) {
ul.find("li.select-item").removeClass('arrowselected');
index++;
//console.log(index);
console.log(index);
ul.find("li.select-item:eq(" + index + ")").addClass('arrowselected');
ul.scrollTop(index * (ul.find("li.select-item:eq(" + index + ")").outerHeight()+5));
ul.find("li.arrowselected").focus();
console.log(index * ul.find("li.select-item:eq(" + index + ")").outerHeight());
console.log(ul.find("li.select-item:eq(" + index + ")").outerHeight());
}
break;
case 13: // Enter
if (index > -1) {
var selectItem = ul.find('li.arrowselected');
selectItemSearch(selectItem);
}
index = -1;
//proposalList.empty();
//params.onSubmit(input.val());
break;
case 9: // Tab
if (index > -1) {
var selectItem = ul.find('li.arrowselected');
selectItemSearch(selectItem);
}
index = -1;
//proposalList.empty();
//params.onSubmit(input.val());
break;
case 27: // Esc button
index = -1;
//proposalList.empty();
//input.val('');
break;
}
}
};
</script>

View File

@@ -0,0 +1,228 @@
@model CompanyManagment.App.Contracts.ClassificationScheme.AddEmployeeToGroup
@Html.AntiForgeryToken()
@{
<style>
.modal .modal-dialog .modal-content {
padding-bottom: 10px !important;
}
.modal-footer {
padding: 0.5rem 1rem !important; /* کوچکتر کردن فاصله */
margin-top: -10px; /* کمی بالا آوردن */
}
.modal .modal-dialog .modal-content {
padding-bottom: 10px;
}
</style>
}
<div class="modal-header">
<h5 class="modal-title">افزودن پرسنل به گروه</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="بستن">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="row m-t-10">
<h5 class="modal-title">@Model.EmployeeFullName</h5>
</div>
<div class="card shadow-sm border-0" style="margin-top: 31px;">
<div class="card-body">
<div class="lineDiv"></div>
<div class="row m-t-10">
<div class="col-md-6 mb-3">
<select id="groupList" asp-for="GroupId" class="form-select form-control" onchange="selectGroup(this)">
<option value="0">انتخاب گروه</option>
@foreach (var item in @Model.ClassificationGroupList)
{
<option value="@item.GroupId" data-groupno="@item.GroupNo"><span>گروه</span><span>&nbsp;</span><span>@item.GroupNo</span></option>
}
</select>
</div>
<div class="col-md-6 mb-3">
<select id="jobList" asp-for="JobId" class="form-select form-control">
<option value="0">انتخاب سمت</option>
</select>
</div>
<div id="groupHiddenInputs">
</div>
<div id="jobHiddenInputs">
</div>
</div>
<div class="lineDiv"></div>
</div>
</div>
</div>
<input type="hidden" name="firstCheckjobId" value="@Model.JobId"/>
<input type="hidden" asp-for="SchemeId" value="@Model.SchemeId" />
<input type="hidden" asp-for="EmployeeId" value="@Model.EmployeeId" />
<div class="modal-footer border-0">
<button type="button" onclick="saveBtn()" class="btn btn-success px-4 rounded-pill">ذخیره</button>
<button type="button" class="btn btn-outline-secondary px-4 rounded-pill" data-dismiss="modal">بستن</button>
</div>
<script>
$(document).ready(function() {
let schemeId = '@Model.SchemeId';
const groupSelect = document.getElementById("groupList");
let jobId = '@Model.JobId';
const groupId = groupSelect.options[groupSelect.selectedIndex].value;
var url = `/Admin/Company/Workshops/ClassificationScheme?handler=JobList&schemeId=${schemeId}&groupId=${groupId}`;
$.get(url, function (data) {
// فرض بر این است که data.jobs یک آرایه از آبجکت‌هایی مثل { jobId, jobName, jobCode } باشد
const jobList = $("#jobList");
jobList.empty(); // پاک کردن آیتم‌های قبلی
jobList.append('<option value="0">انتخاب سمت</option>');
data.jobs.forEach(item => {
if(item.jobId == jobId){
jobList.append(`<option selected="selected" value="${item.jobId}" data-jobname="${item.jobName}" data-jobcode="${item.jobCode}">
${item.jobCode} - ${item.jobName}
</option>`);
}else{
jobList.append(`<option value="${item.jobId}" data-jobname="${item.jobName}" data-jobcode="${item.jobCode}">
${item.jobCode} - ${item.jobName}
</option>`);
}
});
});
});
function selectGroup(selectElement) {
const selectedOption = selectElement.options[selectElement.selectedIndex];
const groupId = selectedOption.value;
// const groupNo = selectedOption.getAttribute("data-groupno");
// $('#groupHiddenInputs').html('');
// const inputs =`
// <input type="hidden" name="GroupId" value="${groupId}" />
// `;
// $('#groupHiddenInputs').append(inputs);
let schemeId = '@Model.SchemeId';
var url = `/Admin/Company/Workshops/ClassificationScheme?handler=JobList&schemeId=${schemeId}&groupId=${groupId}`;
console.log("Request URL:", url);
$.get(url, function (data) {
// فرض بر این است که data.jobs یک آرایه از آبجکت‌هایی مثل { jobId, jobName, jobCode } باشد
const jobList = $("#jobList");
jobList.empty(); // پاک کردن آیتم‌های قبلی
jobList.append('<option value="0">انتخاب سمت</option>');
data.jobs.forEach(item => {
jobList.append(
`<option value="${item.jobId}" data-jobname="${item.jobName}" data-jobcode="${item.jobCode}">
${item.jobCode} - ${item.jobName}
</option>`
);
});
});
}
// function selectJob(selectElement) {
// const selectedOption = selectElement.options[selectElement.selectedIndex];
// const jobId = selectedOption.value;
// // const jobname = selectedOption.getAttribute("data-jobname");
// // const jobcode = selectedOption.getAttribute("data-jobcode");
// $('#jobHiddenInputs').html('');
// const inputs =`
// <input type="hidden" name="jobId" value="${jobId}" />
// `;
// $('#jobHiddenInputs').append(inputs);
// }
function saveBtn() {
const groupSelect = document.getElementById("groupList");
const jobSelect = document.getElementById("jobList");
const groupId = groupSelect.options[groupSelect.selectedIndex].value;
const jobId = jobSelect.options[jobSelect.selectedIndex].value;
if (groupId == 0) {
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم', "گروه را انتخاب کنید");
return;
}
if (jobId == 0) {
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم', "سمت را انتخاب کنید");
return;
}
const command = {
employeeId: '@Model.EmployeeId',
schemeId: '@Model.SchemeId',
id : '@Model.Id',
groupId: Number(groupId),
jobId: Number(jobId),
};
var urlAjaxToSave = '@Url.Page("/Company/Workshops/ClassificationScheme", "EditGroupMember")';
$.ajax({
dataType: 'json',
type: 'POST',
url: urlAjaxToSave,
headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() },
data: command,
success: function (response) {
if(response.isSuccess){
$.Notification.autoHideNotify('success', 'top center', 'پیام سیستم ', response.message);
$('.close').click();
setTimeout(function () {
$('#addEmployeesTab').click();
}, 1000);
}else{
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', response.message);
}
},
failure: function (response) {
//console.log(5, response);
}
});
}
</script>

View File

@@ -327,6 +327,7 @@ function CallBackHandler(data, action, form) {
}
break;
case "RefereshList":
{
if(data.IsSucceedded==true)