leftwork deactive rollcall
This commit is contained in:
@@ -10,8 +10,8 @@ public static class Version
|
||||
{
|
||||
static Version()
|
||||
{
|
||||
StyleVersion = "2.12.12";
|
||||
AdminVersion = "2.5.32";
|
||||
StyleVersion = "2.12.14";
|
||||
AdminVersion = "2.5.34";
|
||||
CameraVersion = "1.0.7";
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ public interface IRollCallEmployeeRepository : IRepository<long, RollCallEmploye
|
||||
List<RollCallEmployeeViewModel> GetByWorkshopId(long workshopId);
|
||||
EditRollCallEmployee GetDetails(long id);
|
||||
RollCallEmployeeViewModel GetByEmployeeIdAndWorkshopId(long employeeId, long workshopId);
|
||||
List<RollCallEmployeeViewModel> GetPersonnelRollCallListPaginate(long workshopId, int pageIndex);
|
||||
List<RollCallEmployeeViewModel> GetPersonnelRollCallListPaginate(RollCallEmployeeSearchModel command);
|
||||
//rollcallEmployeeIncludeStatus
|
||||
RollCallEmployee GetWithRollCallStatus(long id);
|
||||
int activedPerson(long workshopId);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.RollCallEmployee;
|
||||
using CompanyManagment.App.Contracts.RollCallEmployeeStatus;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -7,5 +8,6 @@ namespace Company.Domain.RollCallEmployeeStatusAgg
|
||||
public interface IRollCallEmployeeStatusRepository : IRepository<long, RollCallEmployeeStatus>
|
||||
{
|
||||
List<RollCallEmployeeStatusViewModel> GetAll();
|
||||
void AdjustRollCallStatusEndDates(List<AdjustRollCallEmployeesWithEmployeeLeftWork> command);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.RollCallEmployee
|
||||
{
|
||||
public class AdjustRollCallEmployeesWithEmployeeLeftWork
|
||||
{
|
||||
public long RollCallEmployeeId { get; set; }
|
||||
public DateTime LeaveDate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ public interface IRollCallEmployeeApplication
|
||||
List<RollCallEmployeeViewModel> GetByWorkshopId(long workshopId);
|
||||
EditRollCallEmployee GetDetails(long id);
|
||||
RollCallEmployeeViewModel GetByEmployeeIdAndWorkshopId(long employeeId, long workshopId);
|
||||
List<RollCallEmployeeViewModel> GetPersonnelRollCallListPaginate(long workshopId, int pageIndex);
|
||||
List<RollCallEmployeeViewModel> GetPersonnelRollCallListPaginate(RollCallEmployeeSearchModel command);
|
||||
List<RollCallEmployeeViewModel> GetActivePersonnelByWorkshopId(long workshopId);
|
||||
bool IsEmployeeRollCallActive(long employeeId, long workshopId);
|
||||
int activedPerson(long workshopId);
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
|
||||
public class RollCallEmployeeSearchModel : EditRollCallEmployee
|
||||
{
|
||||
|
||||
public string FullName { get; set; }
|
||||
public long WorkshopId { get; set; }
|
||||
public long EmployeeId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string NationalCode { get; set; }
|
||||
public string MaritalStatus { get; set; }
|
||||
public int PageIndex { get; set; }
|
||||
}
|
||||
@@ -6,10 +6,13 @@ using _0_Framework.Application;
|
||||
using Company.Domain.ContractAgg;
|
||||
using Company.Domain.EmployeeAgg;
|
||||
using Company.Domain.LeftWorkAgg;
|
||||
using Company.Domain.RollCallEmployeeAgg;
|
||||
using Company.Domain.RollCallEmployeeStatusAgg;
|
||||
using Company.Domain.WorkshopAgg;
|
||||
using CompanyManagment.App.Contracts.Contract;
|
||||
using CompanyManagment.App.Contracts.LeftWork;
|
||||
using CompanyManagment.App.Contracts.PersonnleCode;
|
||||
using CompanyManagment.App.Contracts.RollCallEmployee;
|
||||
using CompanyManagment.App.Contracts.WorkingHours;
|
||||
using CompanyManagment.App.Contracts.WorkingHoursItems;
|
||||
using PersianTools.Core;
|
||||
@@ -25,12 +28,14 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
private readonly IWorkingHoursItemsApplication _workingHoursItemsApplication;
|
||||
private readonly IEmployeeRepository _employeeRepository;
|
||||
private readonly IWorkshopRepository _workshopRepository;
|
||||
private readonly IRollCallEmployeeRepository _rollCallEmployeeRepository;
|
||||
private readonly IRollCallEmployeeStatusRepository _rollCallEmployeeStatusRepository;
|
||||
|
||||
|
||||
public LeftWorkApplication(ILeftWorkRepository leftWorkRepository, IContractRepository contractRepository,
|
||||
public LeftWorkApplication(ILeftWorkRepository leftWorkRepository, IContractRepository contractRepository,
|
||||
IContractApplication contractApplication, IWorkingHoursApplication workingHoursApplication,
|
||||
IWorkingHoursItemsApplication workingHoursItemsApplication, IEmployeeRepository employeeRepository,
|
||||
IWorkshopRepository workshopRepository)
|
||||
IWorkshopRepository workshopRepository, IRollCallEmployeeStatusRepository rollCallEmployeeStatusRepository, IRollCallEmployeeRepository rollCallEmployeeRepository)
|
||||
{
|
||||
_leftWorkRepository = leftWorkRepository;
|
||||
_contractRepository = contractRepository;
|
||||
@@ -39,6 +44,8 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
_workingHoursItemsApplication = workingHoursItemsApplication;
|
||||
_employeeRepository = employeeRepository;
|
||||
_workshopRepository = workshopRepository;
|
||||
_rollCallEmployeeStatusRepository = rollCallEmployeeStatusRepository;
|
||||
_rollCallEmployeeRepository = rollCallEmployeeRepository;
|
||||
}
|
||||
|
||||
public OperationResult Create(CreateLeftWork command)
|
||||
@@ -111,8 +118,9 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
command.AddBonusesPay, command.AddYearsPay, command.AddLeavePay,workshop.ComputeOptions,workshop.BonusesOptions);
|
||||
_leftWorkRepository.Create(leftWork);
|
||||
_leftWorkRepository.SaveChanges();
|
||||
IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(command.EmployeeId);
|
||||
|
||||
return operation.Succcedded();
|
||||
return operation.Succcedded();
|
||||
}
|
||||
|
||||
//public OperationResult Create(CreateLeftWork command)
|
||||
@@ -184,7 +192,8 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
command.EmployeeId, command.JobId, command.IncludeStatus, command.AddBonusesPay, command.AddYearsPay,
|
||||
command.AddLeavePay);
|
||||
_leftWorkRepository.SaveChanges();
|
||||
return operation.Succcedded();
|
||||
IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(command.EmployeeId);
|
||||
return operation.Succcedded();
|
||||
}
|
||||
|
||||
public EditLeftWork GetDetails(long id)
|
||||
@@ -527,8 +536,10 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
}
|
||||
}
|
||||
|
||||
return _leftWorkRepository.CreateLeftWork(informationLeftwork);
|
||||
}
|
||||
operation = _leftWorkRepository.CreateLeftWork(informationLeftwork);
|
||||
if (informationLeftwork != null && operation.IsSuccedded) IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(informationLeftwork.EmployeeId);
|
||||
return operation;
|
||||
}
|
||||
|
||||
public OperationResult CreateLeftWorkByLeftWorkGroups(string employeeFullName, long commandEmployeeId, List<PersonnelCodeViewModel> commandPersonnelCode, List<LeftWorkGroup> leftWorkGroups)
|
||||
{
|
||||
@@ -566,8 +577,10 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
}
|
||||
}
|
||||
|
||||
return _leftWorkRepository.CreateLeftWorkByLeftWorkGroups(employeeFullName, commandEmployeeId, commandPersonnelCode, leftWorkGroups);
|
||||
}
|
||||
operation = _leftWorkRepository.CreateLeftWorkByLeftWorkGroups(employeeFullName, commandEmployeeId, commandPersonnelCode, leftWorkGroups);
|
||||
if (operation.IsSuccedded) IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(commandEmployeeId);
|
||||
return operation;
|
||||
}
|
||||
|
||||
public OperationResult CheckDeleteLeftWork(long workshopId, long employeeId, string date, int type)
|
||||
{
|
||||
@@ -578,4 +591,50 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
{
|
||||
return _leftWorkRepository.CheckEditLeftWork(workshopId, employeeId, date.ToGeorgianDateTime(), type);
|
||||
}
|
||||
|
||||
#region Pooya
|
||||
//این متد ترک کار های کارمند را با فعالیت حضور غیاب یکپارچه می کند
|
||||
private void IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(long employeeId)
|
||||
{
|
||||
|
||||
//get all leftworks for employee
|
||||
var leftWorks = _leftWorkRepository.search(new LeftWorkSearchModel() { EmployeeId = employeeId }).GroupBy(x=>x.WorkshopId).Select(x=>
|
||||
{
|
||||
var leftwork = x.MaxBy(y => y.StartWorkDateGr);
|
||||
return new LeftWorkViewModel()
|
||||
{
|
||||
EmployeeId = employeeId,
|
||||
WorkshopId = x.Key,
|
||||
LeftWorkDateGr = leftwork.LeftWorkDateGr,
|
||||
StartWorkDateGr = leftwork.StartWorkDateGr
|
||||
};
|
||||
});
|
||||
|
||||
//get rollCallEmployee associated with those leftworks which have a higher end date than leftworkDate
|
||||
var rollCallsEmployee = _rollCallEmployeeRepository.GetByEmployeeIdWithStatuses(employeeId).GroupBy(x=>x.WorkshopId).Select(
|
||||
x =>
|
||||
{
|
||||
var maxRollCall = x.MaxBy(y => y.Statuses);
|
||||
return new RollCallEmployeeViewModel()
|
||||
{
|
||||
WorkshopId = x.Key,
|
||||
EmployeeId = employeeId,
|
||||
Id=maxRollCall.Id,
|
||||
Statuses = maxRollCall.Statuses
|
||||
};
|
||||
})
|
||||
.Where(x => leftWorks.Any(y => y.WorkshopId == x.WorkshopId && x.Statuses.Any(z => z.StartDateGr < y.LeftWorkDateGr && z.EndDateGr > y.LeftWorkDateGr)));
|
||||
|
||||
//shaping up the list to send as parameter to repository
|
||||
var newRollCallRecords = rollCallsEmployee.Select(x => new AdjustRollCallEmployeesWithEmployeeLeftWork()
|
||||
{
|
||||
LeaveDate = leftWorks.FirstOrDefault(y => y.WorkshopId == x.WorkshopId && y.EmployeeId == x.EmployeeId)!.LeftWorkDateGr,
|
||||
RollCallEmployeeId = x.Id
|
||||
}).ToList();
|
||||
|
||||
|
||||
_rollCallEmployeeStatusRepository.AdjustRollCallStatusEndDates(newRollCallRecords);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -8,6 +8,7 @@ using CompanyManagment.App.Contracts.RollCallEmployeeStatus;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
|
||||
@@ -113,10 +114,10 @@ public class RollCallEmployeeApplication : IRollCallEmployeeApplication
|
||||
return _rollCallEmployeeRepository.GetByEmployeeIdAndWorkshopId(employeeId, workshopId);
|
||||
}
|
||||
|
||||
public List<RollCallEmployeeViewModel> GetPersonnelRollCallListPaginate(long workshopId, int pageIndex)
|
||||
public List<RollCallEmployeeViewModel> GetPersonnelRollCallListPaginate(RollCallEmployeeSearchModel command)
|
||||
{
|
||||
return _rollCallEmployeeRepository.GetPersonnelRollCallListPaginate(workshopId, pageIndex);
|
||||
}
|
||||
return _rollCallEmployeeRepository.GetPersonnelRollCallListPaginate(command);
|
||||
}
|
||||
|
||||
public int activedPerson(long workshopId)
|
||||
{
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace CompanyManagment.Application
|
||||
return false;
|
||||
|
||||
return _employeeRollCallStatusRepository.Exists(x => x.RollCallEmployeeId == rollCallEmployee.Id &&
|
||||
x.StartDate.Date < contractStart.Date &&
|
||||
x.StartDate.Date <= contractStart.Date &&
|
||||
x.EndDate.Date > contractEnd.Date);
|
||||
}
|
||||
public OperationResult Deactivate(long id)
|
||||
|
||||
@@ -66,36 +66,38 @@ public class RollCallEmployeeRepository : RepositoryBase<long, RollCallEmployee>
|
||||
}).FirstOrDefault();
|
||||
}
|
||||
|
||||
public List<RollCallEmployeeViewModel> GetPersonnelRollCallListPaginate(long workshopId, int pageIndex)
|
||||
public List<RollCallEmployeeViewModel> GetPersonnelRollCallListPaginate(RollCallEmployeeSearchModel command)
|
||||
{
|
||||
var dateNow = DateTime.Now;
|
||||
var f = _context.Employees.Include(x => x.LeftWorks).Include(x => x.LeftWorkInsurances)
|
||||
.Where(x => x.LeftWorks.Any(y => y.WorkshopId == workshopId && y.StartWorkDate <= dateNow && y.LeftWorkDate > dateNow) ||
|
||||
x.LeftWorkInsurances.Any(y => y.WorkshopId == workshopId && y.StartWorkDate <= dateNow &&
|
||||
(y.LeftWorkDate > dateNow || y.LeftWorkDate == null))).ToList();
|
||||
var dateNow = DateTime.Now;
|
||||
var rawQuery = _context.Employees.Include(x => x.LeftWorks).Include(x => x.LeftWorkInsurances)
|
||||
.Where(x => x.LeftWorks.Any(y => y.WorkshopId == command.WorkshopId && y.StartWorkDate <= dateNow && y.LeftWorkDate > dateNow) ||
|
||||
x.LeftWorkInsurances.Any(y => y.WorkshopId == command.WorkshopId && y.StartWorkDate <= dateNow &&
|
||||
(y.LeftWorkDate > dateNow || y.LeftWorkDate == null)));
|
||||
if (!string.IsNullOrWhiteSpace(command.Name))
|
||||
rawQuery = rawQuery.Where(x => (x.FName + " " + x.LName).Contains(command.Name));
|
||||
|
||||
var list = rawQuery.ToList();
|
||||
var res = list.Select(x => new RollCallEmployeeViewModel
|
||||
{
|
||||
WorkshopId = command.WorkshopId,
|
||||
EmployeeId = x.id,
|
||||
Id = _context.RollCallEmployees.Any(r => r.EmployeeId == x.id && r.WorkshopId == command.WorkshopId) ?
|
||||
_context.RollCallEmployees.FirstOrDefault(r => r.EmployeeId == x.id && r.WorkshopId == command.WorkshopId)!.id : 0,
|
||||
EmployeeFullName = $"{x.FName} {x.LName}",
|
||||
EmployeeSlug = _passwordHasher.SlugHasher(x.id),
|
||||
NationalCode = _context.Employees.FirstOrDefault(e => e.id == x.id)?.NationalCode,
|
||||
IsActiveString = _context.RollCallEmployees.Any(r => r.EmployeeId == x.id && r.WorkshopId == command.WorkshopId && r.IsActiveString == "true") ? "true" : "false",
|
||||
HasUploadedImage = _context.RollCallEmployees.Any(r => r.EmployeeId == x.id && r.WorkshopId == command.WorkshopId && r.HasUploadedImage == "true") ? "true" : "false",
|
||||
ImagePath = (System.IO.File.Exists(Path.Combine(_webHostEnvironment.ContentRootPath, "Faces", command.WorkshopId.ToString(), x.id.ToString(), "1.jpg")))
|
||||
? Tools.ResizeImage(Path.Combine(_webHostEnvironment.ContentRootPath, "Faces", command.WorkshopId.ToString(), x.id.ToString(), "1.jpg"), 150, 150)
|
||||
: "",
|
||||
}).OrderBy(x => x.PersonelCode)
|
||||
.Skip(command.PageIndex)
|
||||
.Take(30)
|
||||
.ToList();
|
||||
|
||||
var res = f.Select(x => new RollCallEmployeeViewModel
|
||||
{
|
||||
WorkshopId = workshopId,
|
||||
EmployeeId = x.id,
|
||||
Id = _context.RollCallEmployees.Any(r => r.EmployeeId == x.id && r.WorkshopId == workshopId) ?
|
||||
_context.RollCallEmployees.FirstOrDefault(r => r.EmployeeId == x.id && r.WorkshopId == workshopId)!.id : 0,
|
||||
EmployeeFullName = $"{x.FName} {x.LName}",
|
||||
EmployeeSlug = _passwordHasher.SlugHasher(x.id),
|
||||
NationalCode = _context.Employees.FirstOrDefault(e => e.id == x.id).NationalCode,
|
||||
IsActiveString = _context.RollCallEmployees.Any(r => r.EmployeeId == x.id && r.WorkshopId == workshopId && r.IsActiveString == "true") ? "true" : "false",
|
||||
HasUploadedImage = _context.RollCallEmployees.Any(r => r.EmployeeId == x.id && r.WorkshopId == workshopId && r.HasUploadedImage == "true") ? "true" : "false",
|
||||
ImagePath = (System.IO.File.Exists(Path.Combine(_webHostEnvironment.ContentRootPath, "Faces", workshopId.ToString(), x.id.ToString(), "1.jpg")))
|
||||
? Tools.ResizeImage(Path.Combine(_webHostEnvironment.ContentRootPath, "Faces", workshopId.ToString(), x.id.ToString(), "1.jpg"), 150, 150)
|
||||
: "",
|
||||
}).OrderBy(x => x.PersonelCode)
|
||||
.Skip(pageIndex)
|
||||
.Take(30)
|
||||
.ToList();
|
||||
|
||||
return res;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public RollCallEmployee GetWithRollCallStatus(long id)
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@ using CompanyManagment.App.Contracts.RollCallEmployeeStatus;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CompanyManagment.App.Contracts.RollCallEmployee;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository
|
||||
{
|
||||
@@ -18,7 +19,8 @@ namespace CompanyManagment.EFCore.Repository
|
||||
|
||||
|
||||
|
||||
public List<RollCallEmployeeStatusViewModel> GetAll()
|
||||
#region Pooya
|
||||
public List<RollCallEmployeeStatusViewModel> GetAll()
|
||||
{
|
||||
return _context.RollCallEmployeesStatus.Select(x => new RollCallEmployeeStatusViewModel()
|
||||
{
|
||||
@@ -28,5 +30,25 @@ namespace CompanyManagment.EFCore.Repository
|
||||
}).ToList();
|
||||
|
||||
}
|
||||
public void AdjustRollCallStatusEndDates(List<AdjustRollCallEmployeesWithEmployeeLeftWork> command)
|
||||
{
|
||||
var rollCallEmployeeIds = command.Select(y => y.RollCallEmployeeId);
|
||||
|
||||
var list = _context.RollCallEmployeesStatus.Where(x =>rollCallEmployeeIds.Any(y =>y == x.RollCallEmployeeId))
|
||||
.GroupBy(x => x.RollCallEmployeeId).AsEnumerable().Select(x=> new RollCallEmployeeStatusViewModel()
|
||||
{
|
||||
Id = x.MaxBy(c=>c.StartDate).id,
|
||||
|
||||
|
||||
}).Select(c=>c.Id);
|
||||
|
||||
var finalList = _context.RollCallEmployeesStatus.Where(x => list.Contains(x.id)).AsEnumerable();
|
||||
finalList.Where(x => command.Any(y => !y.LeaveDate.IsDateUndefined() && y.LeaveDate < x.EndDate)).ToList().ForEach(x =>
|
||||
x.Edit(x.StartDate, command.FirstOrDefault(y => y.RollCallEmployeeId == x.RollCallEmployeeId)!.LeaveDate)
|
||||
);
|
||||
|
||||
_context.SaveChanges();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -25,6 +25,13 @@
|
||||
font-weight: 700;
|
||||
margin: 0 0 40px 0;
|
||||
}
|
||||
|
||||
.logoutBtn {
|
||||
background-color: #22a6a6;
|
||||
padding: 7px 70px;
|
||||
border-radius: 5px;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
</style>
|
||||
}
|
||||
|
||||
@@ -59,6 +66,7 @@
|
||||
<h5 class="mt-2 title-logo">سامانه هوشمند گزارشگیر</h5>
|
||||
</div>
|
||||
<div>
|
||||
<p class="text-white">@Model.Message</p>
|
||||
<p class="text-white">@Model.Message</p>
|
||||
<a class="logoutBtn" asp-page="/ErrorMessage" asp-page-handler="Logout">خروج</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,11 +1,19 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using AccountManagement.Application.Contracts.Account;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace ServiceHost.Areas.Camera.Pages
|
||||
{
|
||||
public class ErrorMessageModel : PageModel
|
||||
{
|
||||
public string Message { get; set; }
|
||||
private readonly IAccountApplication _accountApplication;
|
||||
|
||||
public ErrorMessageModel(IAccountApplication accountApplication)
|
||||
{
|
||||
_accountApplication = accountApplication;
|
||||
}
|
||||
|
||||
public string Message { get; set; }
|
||||
public void OnGet(string message)
|
||||
{
|
||||
if (message == "ServiceNotFound")
|
||||
@@ -14,5 +22,11 @@ namespace ServiceHost.Areas.Camera.Pages
|
||||
if (message == "EmployeeNotFound")
|
||||
Message = "شما هیچ پرسنلی را به حضور غیاب اضافه نکردهاید.";
|
||||
}
|
||||
}
|
||||
|
||||
public IActionResult OnGetLogout()
|
||||
{
|
||||
_accountApplication.Logout();
|
||||
return RedirectToPage("/Index");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,12 @@
|
||||
font-weight: 700;
|
||||
/* margin: 0 0 40px 0; */
|
||||
}
|
||||
.logoutBtn {
|
||||
background-color: #22a6a6;
|
||||
padding: 7px 70px;
|
||||
border-radius: 5px;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
</style>
|
||||
}
|
||||
|
||||
@@ -164,7 +170,8 @@
|
||||
<h5 class="mt-2 title-logo">سامانه هوشمند گزارشگیر</h5>
|
||||
</div>
|
||||
<div>
|
||||
<p class="text-white">برای ساعات حضور و غیاب میباست از گوشی استفاده نمایید!</p>
|
||||
<p class="text-white">برای ساعات حضور و غیاب میباست از گوشی استفاده نمایید!</p>
|
||||
<a class="logoutBtn" asp-page="/Index" asp-page-handler="Logout">خروج</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using System.IO;
|
||||
using AccountManagement.Application.Contracts.Account;
|
||||
using AccountManagement.Domain.TaskAgg;
|
||||
using CompanyManagment.App.Contracts.PersonnleCode;
|
||||
using CompanyManagment.App.Contracts.RollCallEmployee;
|
||||
@@ -24,12 +25,14 @@ public class IndexModel : PageModel
|
||||
private readonly IRollCallEmployeeApplication _rollCallEmployeeApplication;
|
||||
private readonly IAuthHelper _authHelper;
|
||||
private readonly IPersonnelCodeApplication _personnelCodeApplication;
|
||||
private readonly IAccountApplication _accountApplication;
|
||||
|
||||
public long WorkshopId;
|
||||
public string UrlPath { get; set; }
|
||||
public List<ImageData> ImageDataList;
|
||||
public List<long> PersonelIds;
|
||||
|
||||
public IndexModel(IWebHostEnvironment webHostEnvironment, IConfiguration configuration, IEmployeeApplication employeeApplication, IRollCallApplication rollCallApplication, IAuthHelper authHelper, IRollCallServiceApplication rollCallServiceApplication, IRollCallEmployeeApplication rollCallEmployeeApplication, IPersonnelCodeApplication personnelCodeApplication)
|
||||
public IndexModel(IWebHostEnvironment webHostEnvironment, IConfiguration configuration, IEmployeeApplication employeeApplication, IRollCallApplication rollCallApplication, IAuthHelper authHelper, IRollCallServiceApplication rollCallServiceApplication, IRollCallEmployeeApplication rollCallEmployeeApplication, IPersonnelCodeApplication personnelCodeApplication, IAccountApplication accountApplication)
|
||||
{
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
_configuration = configuration;
|
||||
@@ -39,6 +42,7 @@ public class IndexModel : PageModel
|
||||
_rollCallServiceApplication = rollCallServiceApplication;
|
||||
_rollCallEmployeeApplication = rollCallEmployeeApplication;
|
||||
_personnelCodeApplication = personnelCodeApplication;
|
||||
_accountApplication = accountApplication;
|
||||
}
|
||||
|
||||
public IActionResult OnGet()
|
||||
@@ -230,6 +234,12 @@ public class IndexModel : PageModel
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public IActionResult OnGetLogout()
|
||||
{
|
||||
_accountApplication.Logout();
|
||||
return RedirectToPage("/Index");
|
||||
}
|
||||
}
|
||||
|
||||
public class ImageData
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
<link href="~/assetsclient/css/table-responsive.css?ver=@Version.StyleVersion" rel="stylesheet" />
|
||||
<link href="~/assetsclient/css/rollcall-list-table.css?ver=@Version.StyleVersion" rel="stylesheet" />
|
||||
<link href="~/assetsclient/css/operation-button.css?ver=@Version.StyleVersion" rel="stylesheet" />
|
||||
<link href="~/AssetsClient/css/dropdown.css?ver=@Version.StyleVersion" rel="stylesheet" />
|
||||
<link href="~/AssetsClient/css/dropdown.css?ver=123" rel="stylesheet" />
|
||||
<link href="~/AssetsClient/css/select2.css?ver=@Version.StyleVersion" rel="stylesheet" />
|
||||
<link href="~/AssetsClient/css/filter-search.css?ver=@Version.StyleVersion" rel="stylesheet" />
|
||||
<link href="~/assetsclient/pages/rollcall/css/casehistory.css?ver=@Version.StyleVersion" rel="stylesheet" />
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
<!-- List Items -->
|
||||
<div class="container-fluid">
|
||||
<div class="row p-lg-2">
|
||||
<div class="row">
|
||||
<div class="col-8 ps-0 d-none d-md-block">
|
||||
<div class="card" style="height: 779px; overflow-y: scroll">
|
||||
<div class="wrapper table-rollcall">
|
||||
@@ -168,7 +168,7 @@
|
||||
<div class="wrapper">
|
||||
<div class="rollcall-list Rtable Rtable--5cols Rtable--collapse px-1">
|
||||
|
||||
<div class="w-100 mb-1">
|
||||
<div class="w-100 my-1">
|
||||
<div class="absenceHeadColorTop" style="border-radius: 10px 10px 0 0;">غیبت</div>
|
||||
<div class="Rtable-row Rtable-row--head align-items-center d-flex absenceHeadColor">
|
||||
<div class="Rtable-cell column-heading width1">ردیف</div>
|
||||
@@ -229,7 +229,7 @@
|
||||
<div class="wrapper">
|
||||
<div class="rollcall-list Rtable Rtable--5cols Rtable--collapse px-1">
|
||||
|
||||
<div class="w-100 mb-1">
|
||||
<div class="w-100 my-1">
|
||||
<div class="leaveHeadColorTop" style="border-radius: 10px 10px 0 0;">مرخصی</div>
|
||||
<div class="Rtable-row Rtable-row--head align-items-center d-flex leaveHeadColor">
|
||||
<div class="Rtable-cell column-heading width1">ردیف</div>
|
||||
|
||||
@@ -14,6 +14,21 @@
|
||||
<link href="~/assetsclient/css/rollcall-list.css?ver=@Version.StyleVersion" rel="stylesheet" />
|
||||
|
||||
<style>
|
||||
|
||||
.errored {
|
||||
animation: shake 300ms;
|
||||
color: #eb3434 !important;
|
||||
background-color: #fef2f2 !important;
|
||||
border: 1px solid #eb3434 !important;
|
||||
border-radius: 7px;
|
||||
}
|
||||
|
||||
.sticky {
|
||||
position: sticky;
|
||||
top: 4px;
|
||||
z-index: 30;
|
||||
}
|
||||
|
||||
.goToTop {
|
||||
position: fixed;
|
||||
bottom: -10px;
|
||||
@@ -21,6 +36,7 @@
|
||||
z-index: 100;
|
||||
color: #fff;
|
||||
background-color: #25acacd6;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.goToTop:hover {
|
||||
@@ -61,7 +77,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* <button class="btn btn-rounded mb-5 goToTop"> <i class="fa fa-chevron-up" style="font-size: 20px"></i> برو بالا</button> *@
|
||||
<button class="btn btn-rounded mb-5 goToTop"> <i class="fa fa-chevron-up" style="font-size: 20px"></i> برو بالا</button>
|
||||
|
||||
<div class="container-fluid">
|
||||
|
||||
@@ -85,13 +101,38 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="search-box card border-0">
|
||||
<div class="row align-items-center px-1">
|
||||
<div class="col-6 col-md-3 pe-1">
|
||||
<input type="text" id="personnelSearch" class="form-control" placeholder="جستجو پرسنل">
|
||||
</div>
|
||||
<div class="col-6 ps-1">
|
||||
<div class="d-flex gap-2">
|
||||
<button class="btn-search btn-w-size btn-search-click text-nowrap d-flex align-items-center justify-content-center" id="searchBtn" type="button" onclick="handlerSearch()">
|
||||
<span>جستجو</span>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" width="20" height="20" class="ms-1">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z" />
|
||||
</svg>
|
||||
</button>
|
||||
<button type="button" class="btn-clear-filter btn-w-size text-nowrap d-flex align-items-center justify-content-center disable" id="filterRemove">
|
||||
<span>حذف جستجو</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row px-lg-2 p-auto">
|
||||
<div class="wrapper bg-white my-1 list-box table-rollcall">
|
||||
@if (@Model.HasEmployees)
|
||||
{
|
||||
<div class="Rtable Rtable--collapse" id="ajaxDataLoad">
|
||||
<div class="Rtable-row Rtable-row--head align-items-center">
|
||||
<div class="Rtable Rtable--collapse">
|
||||
<div class="Rtable-row Rtable-row--head align-items-center sticky">
|
||||
<div class="Rtable-cell column-heading width1">ردیف</div>
|
||||
<div class="Rtable-cell column-heading width2">نام و نام خانوادگی</div>
|
||||
<div class="Rtable-cell column-heading width3">کد ملی</div>
|
||||
@@ -99,134 +140,21 @@
|
||||
<div class="Rtable-cell column-heading width5 text-end">عملیات</div>
|
||||
</div>
|
||||
|
||||
@foreach (var item in @Model.Employees.PersonnelInfoViewModels)
|
||||
{
|
||||
<div id="Section_@item.EmployeeId" class="Rtable-row align-items-center position-relative @((item.IsActiveString == "false" && item.HasUploadedImage == "false") ? "deactive" : "") @(item.Black ? "disable" : "")">
|
||||
<div id="loadingSkeleton" style="display: contents;">
|
||||
@for (int j = 0; j < 30; j++)
|
||||
{
|
||||
<div class="skeleton-loader" style="margin: 2px 0; !important"></div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="Rtable-cell d-md-block d-none width1">
|
||||
<div class="Rtable-cell--heading">
|
||||
ردیف
|
||||
</div>
|
||||
<div class="Rtable-cell--content">
|
||||
<span class="d-flex justify-content-center align-items-center justify-content-center">
|
||||
@index
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="Rtable-cell d-md-block d-none width2">
|
||||
<div class="Rtable-cell--heading">نام و نام خانوادگی</div>
|
||||
<div class="Rtable-cell--content">
|
||||
@if (item.HasUploadedImage == "true")
|
||||
{
|
||||
<img id="ImageEmployee_@item.EmployeeId" src="data:image/jpeg;base64,@item.ImagePath" class="img-avatar" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<img id="ImageEmployee_@item.EmployeeId" src="~/AssetsClient/images/Credits.png" class="img-avatar" alt="">
|
||||
}
|
||||
@item.EmployeeFullName
|
||||
</div>
|
||||
</div>
|
||||
<div class="Rtable-cell d-md-block d-none width3">
|
||||
<div class="Rtable-cell--heading">کد ملی</div>
|
||||
<div class="Rtable-cell--content">@item.NationalCode</div>
|
||||
</div>
|
||||
<div class="Rtable-cell d-md-block d-none width4">
|
||||
<div class="Rtable-cell--heading">وضعیت عکس</div>
|
||||
<div class="Rtable-cell--content">
|
||||
@if (item.HasUploadedImage == "true")
|
||||
{
|
||||
<p id="TextUpload_@item.EmployeeId" class="m-0">عکس پرسنل آپلود شده است</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<p id="TextUpload_@item.EmployeeId" class="m-0 text-danger">عکس پرسنل آپلود نشده است</p>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="Rtable-cell d-md-block d-none width5">
|
||||
<div class="Rtable-cell--content align-items-center d-flex d-md-block text-end">
|
||||
@{
|
||||
var isActive = item.IsActiveString == "true" ? "deactive" : "active";
|
||||
}
|
||||
<button class="desktop-btn @(item.IsActiveString == "true" ? "btn-deactive" : item.HasUploadedImage == "false" ? "btn-active disable" : "btn-active")"
|
||||
type="button"
|
||||
style="width: 95px;"
|
||||
id="togglePersonnelStatus_@(item.Id)_desktop">
|
||||
<div id="IsActiveString_@(item.Id)_desktop">
|
||||
@(item.IsActiveString == "true" ? "غیر فعال کردن" : "فعال کردن")
|
||||
</div>
|
||||
</button>
|
||||
<div class="Rtable Rtable--collapse w-100" id="ajaxDataLoad">
|
||||
|
||||
<button class="btn-upload" type="button" id="uploadMobileBTN_@item.EmployeeId" onclick='ModalUploadPics(@item.EmployeeId)' style="width: 95px;">
|
||||
@(item.HasUploadedImage == "true" ? "ویرایش عکس" : "بارگذاری عکس")
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="table-rollcall-mobile w-100 d-flex d-md-none align-items-center justify-content-between">
|
||||
<div class="d-flex justify-content-center align-items-center justify-content-between">
|
||||
<div class="Rtable-cell--content">
|
||||
<span class="d-flex justify-content-center align-items-center justify-content-center" style="width: 30px;height: 30px;">
|
||||
@index
|
||||
</span>
|
||||
</div>
|
||||
<div class="Rtable-cell--content">
|
||||
<span class="mx-2">
|
||||
@if (item.HasUploadedImage == "true")
|
||||
{
|
||||
<img id="ImageEmployeeMobile_@item.EmployeeId" src="data:image/jpeg;base64,@item.ImagePath" class="img-avatar" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<img id="ImageEmployeeMobile_@item.EmployeeId" src="~/AssetsClient/images/Credits.png" class="img-avatar" alt="">
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
<div class="Rtable-cell--content my-auto">
|
||||
<div class="title-mobile" style="width: 132px;">@item.EmployeeFullName</div>
|
||||
<div class="content-mobile">
|
||||
@if (item.HasUploadedImage == "true")
|
||||
{
|
||||
<p id="TextUploadMobile_@item.EmployeeId" class="m-0">عکس پرسنل آپلود شده است</p>
|
||||
}
|
||||
else {
|
||||
<p id="TextUploadMobile_@item.EmployeeId" class="m-0 text-danger">عکس پرسنل آپلود نشده است</p>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="Rtable-cell--content d-flex justify-content-end align-items-center">
|
||||
<div class="Rtable-cell--heading d-block text-center" style="width: 100px;">
|
||||
<div class="Rtable-cell--content align-items-center d-block text-end">
|
||||
<button class="btn-upload-mobile text-nowrap w-100" type="button" id="uploadMobileBTNMobile_@item.EmployeeId" onclick='ModalUploadPics(@item.EmployeeId)'>
|
||||
@(item.HasUploadedImage == "true" ? "ویرایش عکس" : "بارگذاری عکس")
|
||||
</button>
|
||||
|
||||
<button
|
||||
class="mobile-btn text-nowrap mt-1 w-100 @(item.IsActiveString == "true" ? "btn-deactive" : item.HasUploadedImage == "false" ? "btn-active disable" : "btn-active")"
|
||||
type="button"
|
||||
id="togglePersonnelStatus_@(item.Id)_mobile"
|
||||
style="padding: 9px 8px; font-weight: 600; font-size: 10px;">
|
||||
<div id="IsActiveString_@(item.Id)_mobile">
|
||||
@(item.IsActiveString == "true" ? "غیر فعال کردن" : "فعال کردن")
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@{
|
||||
index++;
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="empty text-center bg-white d-flex align-items-center justify-content-center">
|
||||
<div class="text-center bg-white d-flex align-items-center justify-content-center">
|
||||
<div class="">
|
||||
<img src="~/assetsclient/images/empty.png" alt="" class="img-fluid" />
|
||||
<h5>اطلاعاتی وجود ندارد.</h5>
|
||||
@@ -238,11 +166,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" id="pageIndex" value="@Model.PageIndex" />
|
||||
|
||||
<div id="MainModal" class="modal fade personalListModal" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
|
||||
<div class="modal-dialog modal-md modal-dialog-centered">
|
||||
@* modal-dialog-scrollable *@
|
||||
<div class="modal-content" id="ModalContent">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -56,16 +56,14 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
|
||||
MaxPersonValid = _rollCallServiceApplication.GetActiveServiceByWorkshopId(workshopId).MaxPersonValid;
|
||||
|
||||
var distinctEmployees = _rollCallEmployeeApplication.GetPersonnelRollCallListPaginate(workshopId, 0);
|
||||
|
||||
Employees = new RollCallEmployeeViewModel
|
||||
var distinctEmployees = _rollCallEmployeeApplication.GetPersonnelRollCallListPaginate(new RollCallEmployeeSearchModel()
|
||||
{
|
||||
PersonnelInfoViewModels = distinctEmployees
|
||||
};
|
||||
WorkshopId = workshopId,
|
||||
PageIndex = 0
|
||||
});
|
||||
|
||||
PageIndex = Employees.PersonnelInfoViewModels.Count();
|
||||
HasEmployees = Employees.PersonnelInfoViewModels.Count > 0 ? true : false;
|
||||
return Page();
|
||||
HasEmployees = distinctEmployees.Count > 0 ? true : false;
|
||||
return Page();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -73,7 +71,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
}
|
||||
}
|
||||
|
||||
public IActionResult OnGetEmployeeUploadDataAjax(int pageIndex)
|
||||
public IActionResult OnGetEmployeeUploadDataAjax(int pageIndex, string searchName)
|
||||
{
|
||||
var workshopHash = User.FindFirstValue("WorkshopSlug");
|
||||
var workshopId = _passwordHasher.SlugDecrypt(workshopHash);
|
||||
@@ -81,8 +79,12 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
{
|
||||
MaxPersonValid = _rollCallServiceApplication.GetActiveServiceByWorkshopId(workshopId).MaxPersonValid;
|
||||
|
||||
var distinctEmployees = _rollCallEmployeeApplication.GetPersonnelRollCallListPaginate(workshopId, pageIndex);
|
||||
|
||||
var distinctEmployees = _rollCallEmployeeApplication.GetPersonnelRollCallListPaginate(new RollCallEmployeeSearchModel()
|
||||
{
|
||||
WorkshopId = workshopId,
|
||||
PageIndex = pageIndex,
|
||||
Name = searchName
|
||||
});
|
||||
Employees = new RollCallEmployeeViewModel
|
||||
{
|
||||
PersonnelInfoViewModels = distinctEmployees
|
||||
|
||||
BIN
ServiceHost/Faces/53/222/1.jpg
Normal file
BIN
ServiceHost/Faces/53/222/1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 259 KiB |
BIN
ServiceHost/Faces/53/222/2.jpg
Normal file
BIN
ServiceHost/Faces/53/222/2.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 259 KiB |
@@ -1,4 +1,7 @@
|
||||
$(document).ready(function () {
|
||||
var pageIndexMain = 0
|
||||
var searchName = '';
|
||||
|
||||
$(document).ready(function () {
|
||||
$('.loadingButton').on('click', function () {
|
||||
var button = $(this);
|
||||
var loadingDiv = button.find('.loading');
|
||||
@@ -12,16 +15,49 @@
|
||||
});
|
||||
|
||||
loadInfoCount();
|
||||
loadDataAjax();
|
||||
});
|
||||
|
||||
$('.btn-search-click').on('click', function () {
|
||||
|
||||
|
||||
var isValidSearch = $('#personnelSearch').val().trim();
|
||||
if (isValidSearch == '') {
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('نام پرسنل را وارد نمائید');
|
||||
$('#personnelSearch').addClass('errored');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
$('#personnelSearch').removeClass('errored');
|
||||
}, 3500);
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
pageIndexMain = 0;
|
||||
searchName = $('#personnelSearch').val();
|
||||
$('#filterRemove').removeClass('disable');
|
||||
$('#ajaxDataLoad').html('');
|
||||
$('#loadingSkeleton').css('display', 'contents');
|
||||
loadDataAjax();
|
||||
});
|
||||
|
||||
$('.btn-clear-filter').on('click', function () {
|
||||
pageIndexMain = 0;
|
||||
searchName = '';
|
||||
$('#personnelSearch').val('');
|
||||
$('#ajaxDataLoad').html('');
|
||||
$('#loadingSkeleton').css('display', 'contents');
|
||||
$('#filterRemove').addClass('disable');
|
||||
loadDataAjax();
|
||||
});
|
||||
|
||||
function loadDataAjax() {
|
||||
let pageIndex = Number($('#pageIndex').val());
|
||||
var b = pageIndex % 30;
|
||||
var b = pageIndexMain % 30;
|
||||
var html = '';
|
||||
|
||||
console.log(pageIndex);
|
||||
|
||||
if (b === 0 && pageIndex > 0) {
|
||||
if (b === 0) {
|
||||
$.ajax({
|
||||
async: false,
|
||||
contentType: 'charset=utf-8',
|
||||
@@ -29,19 +65,21 @@ function loadDataAjax() {
|
||||
type: 'GET',
|
||||
url: loadEmployeeUploadDataAjax,
|
||||
data: {
|
||||
pageIndex: pageIndex
|
||||
pageIndex: pageIndexMain,
|
||||
searchName: searchName
|
||||
},
|
||||
headers: { "RequestVerificationToken": `${antiForgeryToken}` },
|
||||
success: function (response) {
|
||||
|
||||
if (response.pageIndex > 0) {
|
||||
var n = pageIndex + 1;
|
||||
var n = pageIndexMain + 1;
|
||||
var dataLoad = response.data.personnelInfoViewModels;
|
||||
|
||||
dataLoad.forEach(function(item) {
|
||||
dataLoad.forEach(function (item) {
|
||||
html += `
|
||||
<div></div>
|
||||
|
||||
<div id="Section_${item.employeeId}" class="Rtable-row align-items-center position-relative ${
|
||||
(item.isActiveString === "false" && item.hasUploadedImage === "false") ? `deactive` : ``} ${item.Black ? `disable` : ``}">
|
||||
<div id="Section_${item.employeeId}" class="Rtable-row align-items-center position-relative ${(item.isActiveString === "false" && item.hasUploadedImage === "false") ? `deactive` : ``} ${item.Black ? `disable` : ``}">
|
||||
|
||||
<div class="Rtable-cell d-md-block d-none width1">
|
||||
<div class="Rtable-cell--heading">
|
||||
@@ -57,14 +95,13 @@ function loadDataAjax() {
|
||||
<div class="Rtable-cell--heading">نام و نام خانوادگی</div>
|
||||
<div class="Rtable-cell--content">`;
|
||||
|
||||
if (item.hasUploadedImage === "true") {
|
||||
html += `<img id="ImageEmployee_${item.employeeId}" src="data:image/jpeg;base64,${item.imagePath}" class="img-avatar" />`;
|
||||
}
|
||||
else
|
||||
{
|
||||
html += `<img id="ImageEmployee_${item.employeeId}" src="/AssetsClient/images/Credits.png" class="img-avatar" alt="">`;
|
||||
}
|
||||
html += `${item.employeeFullName}
|
||||
if (item.hasUploadedImage === "true") {
|
||||
html += `<img id="ImageEmployee_${item.employeeId}" src="data:image/jpeg;base64,${item.imagePath}" class="img-avatar" />`;
|
||||
}
|
||||
else {
|
||||
html += `<img id="ImageEmployee_${item.employeeId}" src="/AssetsClient/images/Credits.png" class="img-avatar" alt="">`;
|
||||
}
|
||||
html += `${item.employeeFullName}
|
||||
</div>
|
||||
</div>
|
||||
<div class="Rtable-cell d-md-block d-none width3">
|
||||
@@ -74,22 +111,22 @@ function loadDataAjax() {
|
||||
<div class="Rtable-cell d-md-block d-none width4">
|
||||
<div class="Rtable-cell--heading">وضعیت عکس</div>
|
||||
<div class="Rtable-cell--content">`;
|
||||
if (item.hasUploadedImage === "true") {
|
||||
html += `<p id="TextUpload_${item.employeeId}" class="m-0">عکس پرسنل آپلود شده است</p>`;
|
||||
}
|
||||
else {
|
||||
html += `<p id="TextUpload_${item.employeeId}" class="m-0 text-danger">عکس پرسنل آپلود نشده است</p>`;
|
||||
}
|
||||
html += `</div>
|
||||
if (item.hasUploadedImage === "true") {
|
||||
html += `<p id="TextUpload_${item.employeeId}" class="m-0">عکس پرسنل آپلود شده است</p>`;
|
||||
}
|
||||
else {
|
||||
html += `<p id="TextUpload_${item.employeeId}" class="m-0 text-danger">عکس پرسنل آپلود نشده است</p>`;
|
||||
}
|
||||
html += `</div>
|
||||
</div>
|
||||
<div class="Rtable-cell d-md-block d-none width5">
|
||||
<div class="Rtable-cell--content align-items-center d-flex d-md-block text-end">`;
|
||||
var isActive = item.isActiveString === "true" ? "deactive" : "active";
|
||||
html += `<button class="desktop-btn ${(item.isActiveString === "true"
|
||||
? `btn-deactive`
|
||||
: item.hasUploadedImage === "false"
|
||||
? `btn-active disable`
|
||||
: `btn-active`)}"
|
||||
var isActive = item.isActiveString === "true" ? "deactive" : "active";
|
||||
html += `<button class="desktop-btn ${(item.isActiveString === "true"
|
||||
? `btn-deactive`
|
||||
: item.hasUploadedImage === "false"
|
||||
? `btn-active disable`
|
||||
: `btn-active`)}"
|
||||
type="button"
|
||||
style="width: 95px;"
|
||||
id="togglePersonnelStatus_${item.id}_desktop">
|
||||
@@ -114,24 +151,24 @@ function loadDataAjax() {
|
||||
</div>
|
||||
<div class="Rtable-cell--content">
|
||||
<span class="mx-2">`;
|
||||
if (item.hasUploadedImage === "true") {
|
||||
html += `<img id="ImageEmployeeMobile_${item.employeeId}" src="data:image/jpeg;base64,${item.imagePath}" class="img-avatar" />`;
|
||||
}
|
||||
else {
|
||||
html += `<img id="ImageEmployeeMobile_${item.employeeId}" src="/AssetsClient/images/Credits.png" class="img-avatar" alt="">`;
|
||||
}
|
||||
html += `</span>
|
||||
if (item.hasUploadedImage === "true") {
|
||||
html += `<img id="ImageEmployeeMobile_${item.employeeId}" src="data:image/jpeg;base64,${item.imagePath}" class="img-avatar" />`;
|
||||
}
|
||||
else {
|
||||
html += `<img id="ImageEmployeeMobile_${item.employeeId}" src="/AssetsClient/images/Credits.png" class="img-avatar" alt="">`;
|
||||
}
|
||||
html += `</span>
|
||||
</div>
|
||||
<div class="Rtable-cell--content my-auto">
|
||||
<div class="title-mobile" style="width: 132px;">${item.employeeFullName}</div>
|
||||
<div class="content-mobile">`;
|
||||
if (item.hasUploadedImage === "true") {
|
||||
html += `<p id="TextUploadMobile_${item.employeeId}" class="m-0">عکس پرسنل آپلود شده است</p>`;
|
||||
}
|
||||
else {
|
||||
html += `<p id="TextUploadMobile_${item.employeeId}" class="m-0 text-danger">عکس پرسنل آپلود نشده است</p>`;
|
||||
}
|
||||
html += `</div>
|
||||
if (item.hasUploadedImage === "true") {
|
||||
html += `<p id="TextUploadMobile_${item.employeeId}" class="m-0">عکس پرسنل آپلود شده است</p>`;
|
||||
}
|
||||
else {
|
||||
html += `<p id="TextUploadMobile_${item.employeeId}" class="m-0 text-danger">عکس پرسنل آپلود نشده است</p>`;
|
||||
}
|
||||
html += `</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="Rtable-cell--content d-flex justify-content-end align-items-center">
|
||||
@@ -159,8 +196,20 @@ function loadDataAjax() {
|
||||
});
|
||||
|
||||
$('#ajaxDataLoad').append(html);
|
||||
var newPageIndex = pageIndex + response.pageIndex;
|
||||
$('#pageIndex').val(newPageIndex);
|
||||
$('#loadingSkeleton').hide();
|
||||
var newPageIndex = pageIndexMain + response.pageIndex;
|
||||
pageIndexMain = newPageIndex;
|
||||
} else {
|
||||
html += `<div></div>
|
||||
<div class="text-center bg-white d-flex align-items-center justify-content-center w-100">
|
||||
<div class="">
|
||||
<img src="/assetsclient/images/empty.png" alt="" class="img-fluid" />
|
||||
<h5>اطلاعاتی وجود ندارد.</h5>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
$('#ajaxDataLoad').append(html);
|
||||
$('#loadingSkeleton').hide();
|
||||
}
|
||||
},
|
||||
failure: function (response) {
|
||||
|
||||
@@ -84,7 +84,7 @@ var runCheckFace1 = async () => {
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
}, 2000);
|
||||
}, 4000);
|
||||
|
||||
hasErrorPic1 = true;
|
||||
|
||||
@@ -97,7 +97,7 @@ var runCheckFace1 = async () => {
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
}, 2000);
|
||||
}, 4000);
|
||||
|
||||
hasErrorPic1 = true;
|
||||
|
||||
@@ -116,7 +116,7 @@ var runCheckFace2 = async () => {
|
||||
const detectionPromise2 = await faceapi.detectAllFaces(img2).withFaceLandmarks().withFaceDescriptors();
|
||||
|
||||
if (detectionPromise2.length === 1) {
|
||||
console.log('یک چهره در تصویر دوم شناسایی شد');
|
||||
console.log('یک چهره در تصویر دوم شناسایی شد');
|
||||
checkFace2 = true;
|
||||
hasErrorPic2 = false;
|
||||
|
||||
@@ -127,7 +127,7 @@ var runCheckFace2 = async () => {
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
}, 2000);
|
||||
}, 4000);
|
||||
|
||||
hasErrorPic2 = true;
|
||||
|
||||
@@ -140,7 +140,7 @@ var runCheckFace2 = async () => {
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
}, 2000);
|
||||
}, 4000);
|
||||
|
||||
hasErrorPic2 = true;
|
||||
|
||||
@@ -255,13 +255,32 @@ function take_snapshot2() {
|
||||
}
|
||||
|
||||
|
||||
function set() {
|
||||
async function set() {
|
||||
let pic1 = $("#pic1").attr('src');
|
||||
let pic2 = $("#pic2").attr('src');
|
||||
const img1 = document.getElementById('pic1');
|
||||
const img2 = document.getElementById('pic2');
|
||||
|
||||
let workshopId = Number($('#workshopId').val());
|
||||
let employeeId = Number($('#employeeId').val());
|
||||
|
||||
if (!hasErrorPic1 && checkFace1 && !hasErrorPic2 && checkFace2) {
|
||||
const detection1 = await faceapi.detectSingleFace(img1).withFaceLandmarks().withFaceDescriptor();
|
||||
const detection2 = await faceapi.detectSingleFace(img2).withFaceLandmarks().withFaceDescriptor();
|
||||
|
||||
console.log(detection1);
|
||||
const distance = faceapi.euclideanDistance(detection1.descriptor, detection2.descriptor);
|
||||
if (distance > 0.45) {
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('چهره اول با چهره دوم مطابقت ندارد');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
}, 4000);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (pic1 != null && pic2 != null) {
|
||||
const loading = $('.spinner-loading-progress').show();
|
||||
const loadingBtn = $('.spinner-loading').show();
|
||||
@@ -308,7 +327,6 @@ function set() {
|
||||
|
||||
$(`#ImageEmployee_${employeeId}`).attr("src", `data:image/jpeg;base64,${response.src}`);
|
||||
$(`#ImageEmployeeMobile_${employeeId}`).attr("src", `data:image/jpeg;base64,${response.src}`);
|
||||
|
||||
$(`#TextUpload_${employeeId}`).text("عکس پرسنل آپلود شده است").removeClass('text-danger');
|
||||
$(`#TextUploadMobile_${employeeId}`).text("عکس پرسنل آپلود شده است").removeClass('text-danger');
|
||||
|
||||
@@ -316,7 +334,6 @@ function set() {
|
||||
$(`#uploadMobileBTNMobile_${employeeId}`).text("ویرایش عکس");
|
||||
|
||||
$(`#Section_${employeeId}`).removeClass("deactive");
|
||||
|
||||
$('#SaveImageEmployee').removeClass('disable');
|
||||
$('#MainModal').modal('hide');
|
||||
}, 1000);
|
||||
|
||||
Reference in New Issue
Block a user