channg of rollcall
@@ -10,9 +10,9 @@ public static class Version
|
||||
{
|
||||
static Version()
|
||||
{
|
||||
StyleVersion = "2.12.10";
|
||||
AdminVersion = "2.5.30";
|
||||
CameraVersion = "1.0.6";
|
||||
StyleVersion = "2.12.12";
|
||||
AdminVersion = "2.5.32";
|
||||
CameraVersion = "1.0.7";
|
||||
}
|
||||
|
||||
public static string StyleVersion { get; set; }
|
||||
|
||||
@@ -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> GetPersonnelRollCallList(long workshopId);
|
||||
List<RollCallEmployeeViewModel> GetPersonnelRollCallListPaginate(long workshopId, int pageIndex);
|
||||
//rollcallEmployeeIncludeStatus
|
||||
RollCallEmployee GetWithRollCallStatus(long id);
|
||||
int activedPerson(long workshopId);
|
||||
@@ -18,5 +18,8 @@ public interface IRollCallEmployeeRepository : IRepository<long, RollCallEmploye
|
||||
|
||||
List<RollCallEmployeeViewModel> GetByEmployeeIdWithStatuses(long employeeId);
|
||||
List<RollCallEmployeeViewModel> GetActivePersonnelByWorkshopId(long workshopId);
|
||||
List<RollCallEmployeeViewModel> GetEmployeeRollCalls(long workshopId);
|
||||
|
||||
List<RollCallEmployeeViewModel> GetPersonnelRollCallListAll(long workshopId);
|
||||
#endregion
|
||||
}
|
||||
@@ -12,8 +12,16 @@ public interface IRollCallEmployeeApplication
|
||||
List<RollCallEmployeeViewModel> GetByWorkshopId(long workshopId);
|
||||
EditRollCallEmployee GetDetails(long id);
|
||||
RollCallEmployeeViewModel GetByEmployeeIdAndWorkshopId(long employeeId, long workshopId);
|
||||
List<RollCallEmployeeViewModel> GetPersonnelRollCallList(long workshopId);
|
||||
List<RollCallEmployeeViewModel> GetPersonnelRollCallListPaginate(long workshopId, int pageIndex);
|
||||
List<RollCallEmployeeViewModel> GetActivePersonnelByWorkshopId(long workshopId);
|
||||
bool IsEmployeeRollCallActive(long employeeId, long workshopId);
|
||||
int activedPerson(long workshopId);
|
||||
#region pooya
|
||||
|
||||
List<RollCallEmployeeViewModel> GetEmployeeRollCalls(long workshopId);
|
||||
|
||||
List<RollCallEmployeeViewModel> GetPersonnelRollCallListAll(long workshopId);
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -34,4 +34,5 @@ public class RollCallEmployeeViewModel : EditRollCallEmployee
|
||||
|
||||
public string EmployeeLName { get; set; }
|
||||
public string EmployeeFName { get; set; }
|
||||
public long RollCallEmployeeId { get; set; }
|
||||
}
|
||||
@@ -113,9 +113,9 @@ public class RollCallEmployeeApplication : IRollCallEmployeeApplication
|
||||
return _rollCallEmployeeRepository.GetByEmployeeIdAndWorkshopId(employeeId, workshopId);
|
||||
}
|
||||
|
||||
public List<RollCallEmployeeViewModel> GetPersonnelRollCallList(long workshopId)
|
||||
public List<RollCallEmployeeViewModel> GetPersonnelRollCallListPaginate(long workshopId, int pageIndex)
|
||||
{
|
||||
return _rollCallEmployeeRepository.GetPersonnelRollCallList(workshopId);
|
||||
return _rollCallEmployeeRepository.GetPersonnelRollCallListPaginate(workshopId, pageIndex);
|
||||
}
|
||||
|
||||
public int activedPerson(long workshopId)
|
||||
@@ -143,5 +143,15 @@ public class RollCallEmployeeApplication : IRollCallEmployeeApplication
|
||||
|
||||
}
|
||||
|
||||
public List<RollCallEmployeeViewModel> GetEmployeeRollCalls(long workshopId)
|
||||
{
|
||||
return _rollCallEmployeeRepository.GetEmployeeRollCalls(workshopId);
|
||||
}
|
||||
|
||||
public List<RollCallEmployeeViewModel> GetPersonnelRollCallListAll(long workshopId)
|
||||
{
|
||||
return _rollCallEmployeeRepository.GetPersonnelRollCallListAll(workshopId);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -66,136 +66,35 @@ public class RollCallEmployeeRepository : RepositoryBase<long, RollCallEmployee>
|
||||
}).FirstOrDefault();
|
||||
}
|
||||
|
||||
public List<RollCallEmployeeViewModel> GetPersonnelRollCallList(long workshopId)
|
||||
public List<RollCallEmployeeViewModel> GetPersonnelRollCallListPaginate(long workshopId, int pageIndex)
|
||||
{
|
||||
//var nowFa = DateTime.Now;
|
||||
//var employee = _context.Employees.Include(x => x.LeftWorks).Where(l => l.LeftWorks.Any(c => c.StartWorkDate <= nowFa && c.LeftWorkDate > nowFa && c.WorkshopId == workshopId));
|
||||
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();
|
||||
|
||||
//return employee.Select(x => new RollCallEmployeeViewModel
|
||||
//{
|
||||
// WorkshopId = workshopId,
|
||||
// EmployeeId = x.id,
|
||||
// EmployeeFullName= x.FName + ' ' + x.LName,
|
||||
// NationalCode = x.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",
|
||||
//}).ToList();
|
||||
|
||||
var leftDate = new DateTime(2121, 3, 21);
|
||||
var join = new List<RollCallEmployeeViewModel>();
|
||||
var contractLeftWork = _context.LeftWorkList.Select(x => new RollCallEmployeeViewModel()
|
||||
{
|
||||
WorkshopId = x.WorkshopId,
|
||||
EmployeeId = x.EmployeeId,
|
||||
PersonName = x.EmployeeFullName,
|
||||
PersonelCode = 0,
|
||||
ContractPerson = true,
|
||||
ContractLeft = x.LeftWorkDate != leftDate,
|
||||
StartWork = x.StartWorkDate
|
||||
}).Where(x => x.WorkshopId == workshopId).OrderByDescending(x => x.StartWork).ToList();
|
||||
|
||||
contractLeftWork = contractLeftWork.Select(x => new RollCallEmployeeViewModel()
|
||||
{
|
||||
WorkshopId = x.WorkshopId,
|
||||
EmployeeId = x.EmployeeId,
|
||||
PersonName = x.PersonName,
|
||||
PersonelCode = _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,
|
||||
ContractPerson = true,
|
||||
ContractLeft = x.ContractLeft,
|
||||
StartWork = x.StartWork
|
||||
}).ToList();
|
||||
|
||||
var insuranceLeftWork = _context.LeftWorkInsuranceList.Select(x => new RollCallEmployeeViewModel()
|
||||
{
|
||||
WorkshopId = x.WorkshopId,
|
||||
EmployeeId = x.EmployeeId,
|
||||
PersonName = x.EmployeeFullName,
|
||||
PersonelCode = 0,
|
||||
InsurancePerson = true,
|
||||
InsurancetLeft = x.LeftWorkDate != null,
|
||||
StartWork = x.StartWorkDate
|
||||
}).Where(x => x.WorkshopId == workshopId).OrderByDescending(x => x.StartWork).ToList();
|
||||
insuranceLeftWork = insuranceLeftWork.Select(x => new RollCallEmployeeViewModel()
|
||||
{
|
||||
WorkshopId = x.WorkshopId,
|
||||
EmployeeId = x.EmployeeId,
|
||||
PersonName = x.PersonName,
|
||||
PersonelCode = _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,
|
||||
InsurancetLeft = x.InsurancetLeft,
|
||||
StartWork = x.StartWork
|
||||
}).ToList();
|
||||
|
||||
|
||||
var joinEqualList = contractLeftWork.Join(insuranceLeftWork, x => x.EmployeeId, c => c.EmployeeId,
|
||||
(first, second) => new RollCallEmployeeViewModel
|
||||
{
|
||||
EmployeeId = first.EmployeeId,
|
||||
ContractPerson = first.ContractPerson,
|
||||
ContractLeft = first.ContractLeft,
|
||||
InsurancePerson = second.InsurancePerson,
|
||||
InsurancetLeft = second.InsurancetLeft
|
||||
}).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 join;
|
||||
|
||||
join = join.GroupBy(x => x.EmployeeId).Select(d => d.First()).ToList();
|
||||
|
||||
var finalList = join.Select(x => new RollCallEmployeeViewModel()
|
||||
{
|
||||
WorkshopId = x.WorkshopId,
|
||||
EmployeeId = x.EmployeeId,
|
||||
PersonName = x.PersonName,
|
||||
PersonelCode = x.PersonelCode,
|
||||
ContractPerson = joinEqualList.Any(c => c.EmployeeId == x.EmployeeId) ? joinEqualList.FirstOrDefault(c => c.EmployeeId == x.EmployeeId)!.ContractPerson : x.ContractPerson,
|
||||
InsurancePerson = joinEqualList.Any(c => c.EmployeeId == x.EmployeeId) ? joinEqualList.FirstOrDefault(c => c.EmployeeId == x.EmployeeId)!.InsurancePerson : x.InsurancePerson,
|
||||
ContractLeft = joinEqualList.Any(c => c.EmployeeId == x.EmployeeId) ? joinEqualList.FirstOrDefault(c => c.EmployeeId == x.EmployeeId)!.ContractLeft : x.ContractLeft,
|
||||
InsurancetLeft = joinEqualList.Any(c => c.EmployeeId == x.EmployeeId) ? joinEqualList.FirstOrDefault(c => c.EmployeeId == x.EmployeeId)!.InsurancetLeft : x.InsurancetLeft,
|
||||
Black = false,
|
||||
}).ToList();
|
||||
|
||||
var f = finalList.GroupBy(x => x.EmployeeId).Select(x => x.First()).ToList();
|
||||
|
||||
var res = f.Select(x => new RollCallEmployeeViewModel
|
||||
{
|
||||
WorkshopId = x.WorkshopId,
|
||||
EmployeeId = x.EmployeeId,
|
||||
Id = _context.RollCallEmployees.FirstOrDefault(r => r.EmployeeId == x.EmployeeId && r.WorkshopId == workshopId) == null ? 0 :
|
||||
_context.RollCallEmployees.FirstOrDefault(r => r.EmployeeId == x.EmployeeId && r.WorkshopId == workshopId).id,
|
||||
EmployeeFullName = x.PersonName,
|
||||
EmployeeSlug = _passwordHasher.SlugHasher(x.EmployeeId),
|
||||
NationalCode = _context.Employees.FirstOrDefault(e => e.id == x.EmployeeId)?.NationalCode,
|
||||
PersonName = x.PersonName,
|
||||
IsActiveString = _context.RollCallEmployees.Any(r => r.EmployeeId == x.EmployeeId && r.WorkshopId == workshopId && r.IsActiveString == "true") ? "true" : "false",
|
||||
HasUploadedImage = _context.RollCallEmployees.Any(r => r.EmployeeId == x.EmployeeId && r.WorkshopId == workshopId && r.HasUploadedImage == "true") ? "true" : "false",
|
||||
ImagePath = (System.IO.File.Exists(Path.Combine(_webHostEnvironment.ContentRootPath, "Faces", x.WorkshopId.ToString(), x.EmployeeId.ToString(), "1.jpg")))
|
||||
? Tools.ResizeImage(Path.Combine(_webHostEnvironment.ContentRootPath, "Faces", x.WorkshopId.ToString(), x.EmployeeId.ToString(), "1.jpg"), 150, 150)
|
||||
: "",
|
||||
// ImagePath = x.HasUploadedImage == "true" ? Convert.ToBase64String(System.IO.File.ReadAllBytes($"{_webHostEnvironment.ContentRootPath}\\Faces\\{x.WorkshopId}\\{x.EmployeeId}\\1.jpg")) : "",
|
||||
ContractPerson = x.ContractPerson,
|
||||
InsurancePerson = x.InsurancePerson,
|
||||
ContractLeft = x.ContractLeft,
|
||||
InsurancetLeft = x.InsurancetLeft,
|
||||
Black = ((x.ContractPerson && x.InsurancePerson && x.InsurancetLeft && x.ContractLeft) || (x.ContractPerson && !x.InsurancePerson && x.ContractLeft) || (x.InsurancePerson && !x.ContractPerson && x.InsurancetLeft)) ? true : false
|
||||
}).ToList();
|
||||
{
|
||||
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.Where(x => !x.Black).ToList();
|
||||
return res;
|
||||
}
|
||||
|
||||
public RollCallEmployee GetWithRollCallStatus(long id)
|
||||
@@ -250,5 +149,50 @@ public class RollCallEmployeeRepository : RepositoryBase<long, RollCallEmployee>
|
||||
|
||||
}
|
||||
|
||||
public List<RollCallEmployeeViewModel> GetEmployeeRollCalls(long workshopId)
|
||||
{
|
||||
var dateNow = DateTime.Now;
|
||||
var f = _context.RollCallEmployees.Where(x => x.WorkshopId == workshopId);
|
||||
|
||||
var res = f.Select(x => new RollCallEmployeeViewModel
|
||||
{
|
||||
RollCallEmployeeId = x.id,
|
||||
EmployeeId = x.EmployeeId,
|
||||
EmployeeFullName = x.EmployeeFullName
|
||||
})
|
||||
.ToList();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public List<RollCallEmployeeViewModel> GetPersonnelRollCallListAll(long workshopId)
|
||||
{
|
||||
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 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)
|
||||
.ToList();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -147,7 +147,7 @@
|
||||
<option value="0">انتخاب پرسنل ...</option>
|
||||
@foreach (var itemEmployee in Model.RollCallEmployeeList)
|
||||
{
|
||||
<option value="@itemEmployee.EmployeeId">@itemEmployee.PersonName</option>
|
||||
<option value="@itemEmployee.EmployeeId">@itemEmployee.EmployeeFullName</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
@@ -267,11 +267,11 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<select class="form-select select2Option" aria-label="انتخاب پرسنل ..." id="employeeSelectMobile">
|
||||
<select class="form-select select2OptionMobile" aria-label="انتخاب پرسنل ..." id="employeeSelectMobile">
|
||||
<option value="0">انتخاب پرسنل ...</option>
|
||||
@foreach (var itemEmployee in Model.RollCallEmployeeList)
|
||||
{
|
||||
<option value="@itemEmployee.EmployeeId">@itemEmployee.PersonName</option>
|
||||
<option value="@itemEmployee.EmployeeId">@itemEmployee.EmployeeFullName</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
@@ -318,5 +318,5 @@
|
||||
var itemsYearList = @Html.Raw(Json.Serialize(Model.YearlyList.OrderBy(x => x)));
|
||||
// var dateIndex = 0;
|
||||
</script>
|
||||
<script src="~/assetsclient/pages/rollcall/js/casehistory.js?ver=@Version.StyleVersion"></script>
|
||||
<script src="~/assetsclient/pages/rollcall/js/casehistory.js?ver=45454"></script>
|
||||
}
|
||||
@@ -47,7 +47,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
{
|
||||
if (_rollCallEmployeeApplication.GetByWorkshopId(workshopId).Any())
|
||||
{
|
||||
RollCallEmployeeList = _rollCallEmployeeApplication.GetPersonnelRollCallList(workshopId);
|
||||
RollCallEmployeeList = _rollCallEmployeeApplication.GetEmployeeRollCalls(workshopId);
|
||||
WorkshopFullName = _workshopApplication.GetDetails(workshopId).WorkshopFullName;
|
||||
|
||||
var searchModel = new RollCallSearchModel()
|
||||
|
||||
@@ -1,272 +0,0 @@
|
||||
@page "{slug}"
|
||||
@using Version = _0_Framework.Application.Version
|
||||
@model EmployeeUploadPicModel
|
||||
|
||||
@{
|
||||
Layout = "Shared/_ClientLayout";
|
||||
ViewData["title"] = " - آپلود عکس پرسنل";
|
||||
var index = 1;
|
||||
}
|
||||
|
||||
@section Styles {
|
||||
<link href="~/AssetsClient/css/table-style.css?ver=?ver=@Version.StyleVersion" rel="stylesheet"/>
|
||||
<link href="~/AssetsClient/css/table-responsive.css?ver=@Version.StyleVersion" rel="stylesheet"/>
|
||||
<link href="~/assetsclient/css/operation-button.css?ver=@Version.StyleVersion" rel="stylesheet"/>
|
||||
<link href="~/assetsclient/css/rollcall-list.css?ver=@Version.StyleVersion" rel="stylesheet"/>
|
||||
|
||||
<style>
|
||||
.goToTop {
|
||||
position: fixed;
|
||||
bottom: -10px;
|
||||
margin-right: 100px;
|
||||
z-index: 100;
|
||||
color: #fff;
|
||||
background-color: #25acacd6;
|
||||
}
|
||||
|
||||
.goToTop:hover {
|
||||
color: #fff;
|
||||
background-color: #2ca4a4;
|
||||
}
|
||||
|
||||
@@media screen and (max-width: 767px) {
|
||||
.goToTop {
|
||||
position: fixed;
|
||||
bottom: 54px;
|
||||
margin-right: 39%;
|
||||
z-index: 100;
|
||||
color: #fff;
|
||||
background-color: #25acac70;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}
|
||||
|
||||
<div class="content-container">
|
||||
<div class="container-fluid">
|
||||
<div class="row p-2">
|
||||
<div class="col p-0 m-0 d-flex align-items-center justify-content-between">
|
||||
<div class="col d-flex align-items-center justify-content-start">
|
||||
<img src="~/AssetsClient/images/personalList.png" alt="" class="img-fluid me-2" style="width: 45px;"/>
|
||||
<div>
|
||||
<h4 class="title d-flex align-items-center">آپلود عکس پرسنل</h4>
|
||||
<div>@Model.WorkshopFullName</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<a asp-page="/Company/RollCall/Index" class="back-btn" type="button">
|
||||
<span>بازگشت</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* <button class="btn btn-rounded mb-5 goToTop"> <i class="fa fa-chevron-up" style="font-size: 20px"></i> برو بالا</button> *@
|
||||
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="msg-note my-1">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-4 text-start">
|
||||
<div class="d-flex align-items-center">
|
||||
<svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="18" cy="18" r="13.5" fill="#2FC1C1"></circle>
|
||||
<path d="M19.5 10.5C19.5 11.3284 18.8284 12 18 12C17.1716 12 16.5 11.3284 16.5 10.5C16.5 9.67157 17.1716 9 18 9C18.8284 9 19.5 9.67157 19.5 10.5Z" fill="white"></path>
|
||||
<path stroke-width="1.5" d="M18 24.75V17.25C18 15.8358 18 15.1287 17.5607 14.6893C17.1213 14.25 16.4142 14.25 15 14.25V14.25M18 24.75H20.25M18 24.75H15.75" stroke="white"></path>
|
||||
</svg>
|
||||
<p class="m-0 ms-2">تعداد پرسنل سرویس خریداری شده: @Model.MaxPersonValid</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 text-center">
|
||||
<p class="m-0">تعداد افراد فعال: @Model.MaxPersonValid</p>
|
||||
</div>
|
||||
<div class="col-4 text-end">
|
||||
<p class="m-0 me-2">تعداد افراد غیرفعال: @Model.Employees.Count()</p>
|
||||
</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">
|
||||
<div class="Rtable-row Rtable-row--head align-items-center">
|
||||
<div class="Rtable-cell column-heading width1">ردیف</div>
|
||||
<div class="Rtable-cell column-heading width2">نام و نام خانوادگی</div>
|
||||
<div class="Rtable-cell column-heading width3">کد ملی</div>
|
||||
<div class="Rtable-cell column-heading width4">وضعیت عکس</div>
|
||||
<div class="Rtable-cell column-heading width5 text-end">عملیات</div>
|
||||
</div>
|
||||
|
||||
@foreach (var item in Model.Employees)
|
||||
{
|
||||
<div class="Rtable-row align-items-center position-relative @(item.IsActiveString == "false" && item.HasUploadedImage == "false" ? "deactive" : "")">
|
||||
|
||||
<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">
|
||||
<img 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 class="m-0">عکس پرسنل آپلود شده است</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<p 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">
|
||||
@if (item.IsActiveString == "true")
|
||||
{
|
||||
<button class="btn-deactive" type="button">
|
||||
غیرفعال کردن
|
||||
</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn-active" type="button">
|
||||
فعال کردن
|
||||
</button>
|
||||
}
|
||||
<button class="btn-upload" type="button" onclick="ModalUploadPics(@item.WorkshopId, @item.EmployeeId)">
|
||||
بارگذاری عکس
|
||||
</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">
|
||||
@index
|
||||
</span>
|
||||
</div>
|
||||
<div class="Rtable-cell--content">
|
||||
<span class="mx-2">
|
||||
<img src="/images/mobile-rollcall.png" class="img-avatar" alt="">
|
||||
</span>
|
||||
</div>
|
||||
<div class="Rtable-cell--content my-auto">
|
||||
<div class="title-mobile">@item.EmployeeFullName</div>
|
||||
<div class="content-mobile">عکس پرسنل آپلود شده است.</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">
|
||||
<div class="Rtable-cell--content align-items-center d-flex d-md-block text-end">
|
||||
<button class="btn-upload-mobile" type="button">
|
||||
ویرایش عکس پرسنل
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@{
|
||||
index++;
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="empty 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>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="MainModal" class="modal fade personalListModal" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
|
||||
<div class="modal-dialog modal-xxl modal-dialog-centered modal-dialog-scrollable">
|
||||
<div class="modal-content" id="ModalContent">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<input type="hidden" asp-for="@Model.HasEmployees" value="@Model.HasEmployees" id="hasEmployee"/>
|
||||
|
||||
@section Script {
|
||||
<script src="~/assetsclient/js/site.js?ver=@Version.StyleVersion"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('.loadingButton').on('click',
|
||||
function() {
|
||||
const button = $(this);
|
||||
const loadingDiv = button.find('.loading');
|
||||
loadingDiv.show();
|
||||
});
|
||||
});
|
||||
|
||||
function ModalUploadPics(workshopID, employeeID) {
|
||||
const workshop_ID = Number(workshopID);
|
||||
const employee_ID = Number(employeeID);
|
||||
|
||||
$.ajax({
|
||||
async: false,
|
||||
dataType: 'json',
|
||||
url: '@Url.Page("EmployeeUploadPic", "CheckModalTakeImage")',
|
||||
type: 'GET',
|
||||
data: { "workshopId": workshop_ID, "employeeId": employee_ID },
|
||||
success: function(response) {
|
||||
if (response.isSuccedded) {
|
||||
console.log(response.url);
|
||||
//var url = '#showmodal=@Url.Page("/Company/RollCall/EmployeeUploadPic", "ModalTakeImages")';
|
||||
//var url = '#showmodal="/Client/Company/RollCall/EmployeeUploadPic?handler=ModalTakeImages"';
|
||||
|
||||
const url = `#showmodal=${response.url}`;
|
||||
window.location.href = url;
|
||||
console.log(goTo);
|
||||
// `#showmodal=` + response.action.viewName;
|
||||
// $('#myModal .modal-content').load(response.url, function () {
|
||||
// $('#myModal').modal('show');
|
||||
// });
|
||||
} else {
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text(response.message);
|
||||
setTimeout(function() {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
},
|
||||
3500);
|
||||
}
|
||||
},
|
||||
error: function(err) {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.RollCallEmployee;
|
||||
using CompanyManagment.App.Contracts.RollCallService;
|
||||
using CompanyManagment.App.Contracts.Workshop;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace ServiceHost.Areas.Client.Pages.Company.RollCall;
|
||||
|
||||
public class EmployeeUploadPicModel : PageModel
|
||||
{
|
||||
private readonly IPasswordHasher _passwordHasher;
|
||||
private readonly IRollCallEmployeeApplication _rollCallEmployeeApplication;
|
||||
private readonly IRollCallServiceApplication _rollCallServiceApplication;
|
||||
|
||||
private readonly IWorkshopApplication _workshopApplication;
|
||||
public List<RollCallEmployeeViewModel> Employees;
|
||||
public bool HasEmployees;
|
||||
public int MaxPersonValid;
|
||||
public string WorkshopFullName;
|
||||
public long WorkshopId;
|
||||
|
||||
|
||||
public EmployeeUploadPicModel(IWorkshopApplication workshopApplication, IPasswordHasher passwordHasher,
|
||||
IRollCallEmployeeApplication rollCallEmployeeApplication,
|
||||
IRollCallServiceApplication rollCallServiceApplication)
|
||||
{
|
||||
_workshopApplication = workshopApplication;
|
||||
_passwordHasher = passwordHasher;
|
||||
_rollCallEmployeeApplication = rollCallEmployeeApplication;
|
||||
_rollCallServiceApplication = rollCallServiceApplication;
|
||||
}
|
||||
|
||||
public void OnGet(string slug)
|
||||
{
|
||||
if (slug != "")
|
||||
{
|
||||
var workshopId = _passwordHasher.SlugDecrypt(slug);
|
||||
if (workshopId != 0)
|
||||
{
|
||||
var workshop = _workshopApplication.GetWorkshopInfo(workshopId);
|
||||
WorkshopFullName = workshop.WorkshopFullName;
|
||||
|
||||
MaxPersonValid = _rollCallServiceApplication.GetActiveServiceByWorkshopId(workshopId).MaxPersonValid;
|
||||
|
||||
WorkshopId = workshop.Id;
|
||||
Employees = _rollCallEmployeeApplication.GetPersonnelRollCallList(workshopId);
|
||||
HasEmployees = Employees.Count > 0 ? true : false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Response.Redirect("/error/404");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Response.Redirect("/error/404");
|
||||
}
|
||||
}
|
||||
|
||||
public IActionResult OnGetCheckModalTakeImage(long workshopId, long employeeId)
|
||||
{
|
||||
var plan = _rollCallServiceApplication.GetActiveServiceByWorkshopId(workshopId);
|
||||
var mess = "";
|
||||
if (plan != null)
|
||||
{
|
||||
if (plan.IsActiveString == "true")
|
||||
{
|
||||
var maxValid = plan.MaxPersonValid;
|
||||
var activedPerson = _rollCallEmployeeApplication.activedPerson(workshopId);
|
||||
if (activedPerson < maxValid)
|
||||
return new JsonResult(new
|
||||
{
|
||||
isSuccedded = true,
|
||||
url = Url.Page("/Company/RollCall/EmployeeUploadPic", "ModalTakeImages")
|
||||
});
|
||||
mess = "محدودیت افزودن پرسنل";
|
||||
}
|
||||
else
|
||||
{
|
||||
mess = "سرویس شما فعال نیست";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mess = "شما سرویس خریداری شده ندارید";
|
||||
}
|
||||
|
||||
return new JsonResult(new
|
||||
{
|
||||
isSuccedded = false,
|
||||
message = mess
|
||||
});
|
||||
}
|
||||
|
||||
public IActionResult OnGetModalTakeImages()
|
||||
{
|
||||
return Partial("ModalTakeImages");
|
||||
}
|
||||
}
|
||||
@@ -101,7 +101,7 @@
|
||||
|
||||
@foreach (var item in @Model.Employees.PersonnelInfoViewModels)
|
||||
{
|
||||
<div 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">
|
||||
@@ -118,11 +118,11 @@
|
||||
<div class="Rtable-cell--content">
|
||||
@if (item.HasUploadedImage == "true")
|
||||
{
|
||||
<img src="data:image/jpeg;base64,@item.ImagePath" class="img-avatar" />
|
||||
<img id="ImageEmployee_@item.EmployeeId" src="data:image/jpeg;base64,@item.ImagePath" class="img-avatar" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<img src="~/AssetsClient/images/Credits.png" class="img-avatar" alt="">
|
||||
<img id="ImageEmployee_@item.EmployeeId" src="~/AssetsClient/images/Credits.png" class="img-avatar" alt="">
|
||||
}
|
||||
@item.EmployeeFullName
|
||||
</div>
|
||||
@@ -136,10 +136,11 @@
|
||||
<div class="Rtable-cell--content">
|
||||
@if (item.HasUploadedImage == "true")
|
||||
{
|
||||
<p class="m-0">عکس پرسنل آپلود شده است</p>
|
||||
<p id="TextUpload_@item.EmployeeId" class="m-0">عکس پرسنل آپلود شده است</p>
|
||||
}
|
||||
else {
|
||||
<p class="m-0 text-danger">عکس پرسنل آپلود نشده است</p>
|
||||
else
|
||||
{
|
||||
<p id="TextUpload_@item.EmployeeId" class="m-0 text-danger">عکس پرسنل آپلود نشده است</p>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -157,7 +158,7 @@
|
||||
</div>
|
||||
</button>
|
||||
|
||||
<button class="btn-upload" type="button" onclick='ModalUploadPics(@item.EmployeeId)' style="width: 95px;">
|
||||
<button class="btn-upload" type="button" id="uploadMobileBTN_@item.EmployeeId" onclick='ModalUploadPics(@item.EmployeeId)' style="width: 95px;">
|
||||
@(item.HasUploadedImage == "true" ? "ویرایش عکس" : "بارگذاری عکس")
|
||||
</button>
|
||||
</div>
|
||||
@@ -175,11 +176,11 @@
|
||||
<span class="mx-2">
|
||||
@if (item.HasUploadedImage == "true")
|
||||
{
|
||||
<img src="data:image/jpeg;base64,@item.ImagePath" class="img-avatar" />
|
||||
<img id="ImageEmployeeMobile_@item.EmployeeId" src="data:image/jpeg;base64,@item.ImagePath" class="img-avatar" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<img src="~/AssetsClient/images/Credits.png" class="img-avatar" alt="">
|
||||
<img id="ImageEmployeeMobile_@item.EmployeeId" src="~/AssetsClient/images/Credits.png" class="img-avatar" alt="">
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
@@ -188,10 +189,10 @@
|
||||
<div class="content-mobile">
|
||||
@if (item.HasUploadedImage == "true")
|
||||
{
|
||||
<p class="m-0">عکس پرسنل آپلود شده است</p>
|
||||
<p id="TextUploadMobile_@item.EmployeeId" class="m-0">عکس پرسنل آپلود شده است</p>
|
||||
}
|
||||
else {
|
||||
<p class="m-0 text-danger">عکس پرسنل آپلود نشده است</p>
|
||||
<p id="TextUploadMobile_@item.EmployeeId" class="m-0 text-danger">عکس پرسنل آپلود نشده است</p>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -199,7 +200,7 @@
|
||||
<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" onclick='ModalUploadPics(@item.EmployeeId)'>
|
||||
<button class="btn-upload-mobile text-nowrap w-100" type="button" id="uploadMobileBTNMobile_@item.EmployeeId" onclick='ModalUploadPics(@item.EmployeeId)'>
|
||||
@(item.HasUploadedImage == "true" ? "ویرایش عکس" : "بارگذاری عکس")
|
||||
</button>
|
||||
|
||||
@@ -259,5 +260,5 @@
|
||||
var deActivePersonnelAjax = `@Url.Page("./EmployeeUploadPicture", "DeActivePersonnel")`;
|
||||
var activePersonnelAjax = `@Url.Page("./EmployeeUploadPicture", "ActivePersonnel")`;
|
||||
</script>
|
||||
<script src="~/assetsclient/pages/rollcall/js/employeeuploadpicture.js?ver=215"></script>
|
||||
<script src="~/assetsclient/pages/rollcall/js/employeeuploadpicture.js?ver=@Version.StyleVersion"></script>
|
||||
}
|
||||
@@ -56,15 +56,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
|
||||
MaxPersonValid = _rollCallServiceApplication.GetActiveServiceByWorkshopId(workshopId).MaxPersonValid;
|
||||
|
||||
var distinctEmployees = _rollCallEmployeeApplication
|
||||
.GetPersonnelRollCallList(workshopId)
|
||||
.GroupBy(x => x.EmployeeId)
|
||||
.Select(g => g.First())
|
||||
.OrderBy(x => x.Black ? 1 : 0)
|
||||
.ThenBy(x => x.PersonelCode)
|
||||
.Skip(0)
|
||||
.Take(30)
|
||||
.ToList();
|
||||
var distinctEmployees = _rollCallEmployeeApplication.GetPersonnelRollCallListPaginate(workshopId, 0);
|
||||
|
||||
Employees = new RollCallEmployeeViewModel
|
||||
{
|
||||
@@ -88,15 +80,8 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
if (workshopId > 0)
|
||||
{
|
||||
MaxPersonValid = _rollCallServiceApplication.GetActiveServiceByWorkshopId(workshopId).MaxPersonValid;
|
||||
var distinctEmployees = _rollCallEmployeeApplication
|
||||
.GetPersonnelRollCallList(workshopId)
|
||||
.GroupBy(x => x.EmployeeId)
|
||||
.Select(g => g.First())
|
||||
.OrderBy(x => x.Black ? 1 : 0)
|
||||
.ThenBy(x => x.PersonelCode)
|
||||
.Skip(pageIndex)
|
||||
.Take(30)
|
||||
.ToList();
|
||||
|
||||
var distinctEmployees = _rollCallEmployeeApplication.GetPersonnelRollCallListPaginate(workshopId, pageIndex);
|
||||
|
||||
Employees = new RollCallEmployeeViewModel
|
||||
{
|
||||
@@ -136,13 +121,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
var activeService = _rollCallServiceApplication.GetActiveServiceByWorkshopId(workshopId);
|
||||
var maxPersonValid = activeService.MaxPersonValid;
|
||||
|
||||
var employees = _rollCallEmployeeApplication
|
||||
.GetPersonnelRollCallList(workshopId)
|
||||
.GroupBy(e => e.EmployeeId)
|
||||
.Select(g => g.First())
|
||||
.OrderBy(e => e.Black ? 1 : 0)
|
||||
.ThenBy(e => e.PersonelCode)
|
||||
.ToList();
|
||||
var employees = _rollCallEmployeeApplication.GetPersonnelRollCallListAll(workshopId);
|
||||
|
||||
var activeCount = employees.Count(e => e.IsActiveString == "true");
|
||||
var inactiveCount = employees.Count(e => e.IsActiveString == "false");
|
||||
@@ -307,6 +286,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
{
|
||||
IsSuccedded = result.IsSuccedded,
|
||||
Message = result.Message,
|
||||
src = Tools.ResizeImage(Path.Combine(_webHostEnvironment.ContentRootPath, "Faces", workshopId.ToString(), employeeId.ToString(), "1.jpg"), 150, 150)
|
||||
});
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
@page "{slug}"
|
||||
@model HistoryModel
|
||||
@{
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.RollCallEmployee;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace ServiceHost.Areas.Client.Pages.Company.RollCall;
|
||||
|
||||
public class HistoryModel : PageModel
|
||||
{
|
||||
private readonly IAuthHelper _authHelper;
|
||||
private readonly IPasswordHasher _passwordHasher;
|
||||
private readonly IRollCallEmployeeApplication _rollCallEmployeeApplication;
|
||||
|
||||
public HistoryModel(IAuthHelper authHelper, IPasswordHasher passwordHasher,
|
||||
IRollCallEmployeeApplication rollCallEmployeeApplication)
|
||||
{
|
||||
_authHelper = authHelper;
|
||||
_passwordHasher = passwordHasher;
|
||||
_rollCallEmployeeApplication = rollCallEmployeeApplication;
|
||||
}
|
||||
|
||||
public void OnGet(string slug)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
@page "{slug}"
|
||||
@model ListModel
|
||||
@{
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.RollCallEmployee;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace ServiceHost.Areas.Client.Pages.Company.RollCall;
|
||||
|
||||
public class ListModel : PageModel
|
||||
{
|
||||
private readonly IAuthHelper _authHelper;
|
||||
private readonly IPasswordHasher _passwordHasher;
|
||||
private readonly IRollCallEmployeeApplication _rollCallEmployeeApplication;
|
||||
|
||||
public ListModel(IAuthHelper authHelper, IPasswordHasher passwordHasher,
|
||||
IRollCallEmployeeApplication rollCallEmployeeApplication)
|
||||
{
|
||||
_authHelper = authHelper;
|
||||
_passwordHasher = passwordHasher;
|
||||
_rollCallEmployeeApplication = rollCallEmployeeApplication;
|
||||
}
|
||||
|
||||
public void OnGet(string slug)
|
||||
{
|
||||
if (slug != "")
|
||||
{
|
||||
var workshopId = _passwordHasher.SlugDecrypt(slug);
|
||||
if (workshopId != 0)
|
||||
{
|
||||
if (_rollCallEmployeeApplication.GetByWorkshopId(workshopId).Count() > 0)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
Response.Redirect("/error/403");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Response.Redirect("/error/403");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Response.Redirect("/error/403");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -215,7 +215,10 @@
|
||||
<script>
|
||||
var antiForgeryToken = $('@Html.AntiForgeryToken()').val();
|
||||
var takePictureAjax = `@Url.Page("./EmployeeUploadPicture", "TakePicture")`;
|
||||
var checkFace = @(Model.HasPicture ? 2 : 0);
|
||||
var checkFace1 = `@(Model.HasPicture)` === "True" ? true : false;
|
||||
var checkFace2 = `@(Model.HasPicture)` === "True" ? true : false;
|
||||
var hasErrorPic1 = false;
|
||||
var hasErrorPic2 = false;
|
||||
</script>
|
||||
<script src="~/weights/face-api.js"></script>
|
||||
<script src="~/assetsclient/pages/rollcall/js/modaltakeimages.js"></script>
|
||||
BIN
ServiceHost/Faces/367/3825/1.jpg
Normal file
|
After Width: | Height: | Size: 285 KiB |
BIN
ServiceHost/Faces/367/3825/2.jpg
Normal file
|
After Width: | Height: | Size: 299 KiB |
BIN
ServiceHost/Faces/367/3826/1.jpg
Normal file
|
After Width: | Height: | Size: 298 KiB |
BIN
ServiceHost/Faces/367/3826/2.jpg
Normal file
|
After Width: | Height: | Size: 285 KiB |
BIN
ServiceHost/Faces/367/3828/1.jpg
Normal file
|
After Width: | Height: | Size: 347 KiB |
BIN
ServiceHost/Faces/367/3828/2.jpg
Normal file
|
After Width: | Height: | Size: 355 KiB |
BIN
ServiceHost/Faces/367/3831/1.jpg
Normal file
|
After Width: | Height: | Size: 224 KiB |
BIN
ServiceHost/Faces/367/3831/2.jpg
Normal file
|
After Width: | Height: | Size: 212 KiB |
BIN
ServiceHost/Faces/367/3832/1.jpg
Normal file
|
After Width: | Height: | Size: 197 KiB |
BIN
ServiceHost/Faces/367/3832/2.jpg
Normal file
|
After Width: | Height: | Size: 212 KiB |
BIN
ServiceHost/Faces/367/3833/1.jpg
Normal file
|
After Width: | Height: | Size: 272 KiB |
BIN
ServiceHost/Faces/367/3833/2.jpg
Normal file
|
After Width: | Height: | Size: 267 KiB |
BIN
ServiceHost/Faces/50/230/1.jpg
Normal file
|
After Width: | Height: | Size: 252 KiB |
BIN
ServiceHost/Faces/50/230/2.jpg
Normal file
|
After Width: | Height: | Size: 241 KiB |
@@ -198,11 +198,8 @@
|
||||
<None Include="Areas\Client\Pages\Company\Reports\PrintAllCheckoutReport.cshtml" />
|
||||
<None Include="Areas\Client\Pages\Company\RollCall\CaseHistory.cshtml" />
|
||||
<None Include="Areas\Client\Pages\Company\RollCall\CurrentDay.cshtml" />
|
||||
<None Include="Areas\Client\Pages\Company\RollCall\EmployeeUploadPic.cshtml" />
|
||||
<None Include="Areas\Client\Pages\Company\RollCall\EmployeeUploadPicture.cshtml" />
|
||||
<None Include="Areas\Client\Pages\Company\RollCall\History.cshtml" />
|
||||
<None Include="Areas\Client\Pages\Company\RollCall\Index.cshtml" />
|
||||
<None Include="Areas\Client\Pages\Company\RollCall\List.cshtml" />
|
||||
<None Include="Areas\Client\Pages\Company\RollCall\ModalCameraAccount.cshtml" />
|
||||
<None Include="Areas\Client\Pages\Company\RollCall\ModalOTPAction.cshtml" />
|
||||
<None Include="Areas\Client\Pages\Company\RollCall\ModalOTPActionFree.cshtml" />
|
||||
|
||||
@@ -10,6 +10,12 @@ $(document).ready(function () {
|
||||
dir: "rtl"
|
||||
});
|
||||
|
||||
$(".select2OptionMobile").select2({
|
||||
language: "fa",
|
||||
dir: "rtl",
|
||||
dropdownParent: $('#searchModal'),
|
||||
});
|
||||
|
||||
$('.loadingButton').on('click', function () {
|
||||
var button = $(this);
|
||||
var loadingDiv = button.find('.loading');
|
||||
@@ -125,6 +131,7 @@ $(document).ready(function () {
|
||||
} else {
|
||||
$('.btn-clear-filter').addClass('disable');
|
||||
}
|
||||
console.log(filterEmployeeId);
|
||||
|
||||
hasData = true;
|
||||
dateIndex = 0;
|
||||
@@ -246,12 +253,22 @@ function caseHistoryLoadAjax() {
|
||||
|
||||
$('#dateFaEmployee').show();
|
||||
|
||||
html += `<div class="Rtable-row Rtable-row--head align-items-center d-flex sticky" style="background: #58B3B3;border: none !important;">
|
||||
html += `<div class="Rtable-row Rtable-row--head align-items-center d-none d-md-flex sticky" style="background: #58B3B3;border: none !important;">
|
||||
<div class="col-4"></div>
|
||||
<div class="col-4 text-center">
|
||||
<div class="Rtable-cell column-heading text-center">${caseHistoryEmployeeData.persianMonthName + ` ` + caseHistoryEmployeeData.persianYear}</div>
|
||||
<div class="Rtable-cell column-heading text-center justify-content-center">${caseHistoryEmployeeData.persianMonthName + ` ` + caseHistoryEmployeeData.persianYear}</div>
|
||||
</div>
|
||||
<div class="col-4"></div>
|
||||
</div>
|
||||
|
||||
<div class="Rtable-row Rtable-row--head align-items-center d-flex d-md-none sticky" style="background: #58B3B3;border: none !important;">
|
||||
<div class="col-6">
|
||||
<div class="Rtable-cell column-heading text-center justify-content-start">${caseHistoryEmployeeData.rollCalls[0].employeeFullName}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 text-center">
|
||||
<div class="Rtable-cell column-heading text-center">${caseHistoryEmployeeData.persianMonthName + ` ` + caseHistoryEmployeeData.persianYear}</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
$.each(caseHistoryEmployeeData.rollCalls, function (i, item) {
|
||||
@@ -269,13 +286,20 @@ function caseHistoryLoadAjax() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="Rtable-cell width2">
|
||||
<div class="Rtable-cell width2 d-none d-md-block">
|
||||
<div class="Rtable-cell--heading d-none">نام پرسنل</div>
|
||||
<div class="Rtable-cell--content">
|
||||
${item.employeeFullName}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="Rtable-cell width2 d-block d-md-none">
|
||||
<div class="Rtable-cell--heading d-none">تاریخ</div>
|
||||
<div class="Rtable-cell--content">
|
||||
${item.dateFa}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="Rtable-cell width3 d-none d-md-block">
|
||||
<div class="Rtable-cell--content text-center">
|
||||
<div class="d-md-none d-none">شماره پرسنلی: </div>
|
||||
@@ -440,13 +464,13 @@ function caseHistoryLoadAjax() {
|
||||
html += `
|
||||
<div class="Rtable-row Rtable-row--head align-items-center d-flex sticky" style="background: #58B3B3;border: none !important;">
|
||||
<div class="col-4 text-start">
|
||||
<div class="Rtable-cell column-heading">
|
||||
<div class="Rtable-cell column-heading justify-content-center">
|
||||
${caseHistoryData.dayOfWeekFa}
|
||||
${caseHistoryData.isHoliday ? `<span class="mx-1" style="">(تعطیل)</span>` : ``}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 text-center">
|
||||
<div class="Rtable-cell column-heading text-center">${caseHistoryData.dateFa}</div>
|
||||
<div class="Rtable-cell column-heading text-center justify-content-center">${caseHistoryData.dateFa}</div>
|
||||
</div>
|
||||
<div class="col-4"></div>
|
||||
</div>
|
||||
|
||||
@@ -40,9 +40,8 @@ function loadDataAjax() {
|
||||
dataLoad.forEach(function(item) {
|
||||
html += `
|
||||
|
||||
<div 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">
|
||||
@@ -59,11 +58,11 @@ function loadDataAjax() {
|
||||
<div class="Rtable-cell--content">`;
|
||||
|
||||
if (item.hasUploadedImage === "true") {
|
||||
html += `<img src="data:image/jpeg;base64,${item.imagePath}" class="img-avatar" />`;
|
||||
html += `<img id="ImageEmployee_${item.employeeId}" src="data:image/jpeg;base64,${item.imagePath}" class="img-avatar" />`;
|
||||
}
|
||||
else
|
||||
{
|
||||
html += `<img src="/AssetsClient/images/Credits.png" class="img-avatar" alt="">`;
|
||||
html += `<img id="ImageEmployee_${item.employeeId}" src="/AssetsClient/images/Credits.png" class="img-avatar" alt="">`;
|
||||
}
|
||||
html += `${item.employeeFullName}
|
||||
</div>
|
||||
@@ -76,10 +75,10 @@ function loadDataAjax() {
|
||||
<div class="Rtable-cell--heading">وضعیت عکس</div>
|
||||
<div class="Rtable-cell--content">`;
|
||||
if (item.hasUploadedImage === "true") {
|
||||
html += `<p class="m-0">عکس پرسنل آپلود شده است</p>`;
|
||||
html += `<p id="TextUpload_${item.employeeId}" class="m-0">عکس پرسنل آپلود شده است</p>`;
|
||||
}
|
||||
else {
|
||||
html += `<p class="m-0 text-danger">عکس پرسنل آپلود نشده است</p>`;
|
||||
html += `<p id="TextUpload_${item.employeeId}" class="m-0 text-danger">عکس پرسنل آپلود نشده است</p>`;
|
||||
}
|
||||
html += `</div>
|
||||
</div>
|
||||
@@ -99,7 +98,7 @@ function loadDataAjax() {
|
||||
</div>
|
||||
</button>
|
||||
|
||||
<button class="btn-upload" type="button" onclick='ModalUploadPics(${item.employeeId})' style="width: 95px;">
|
||||
<button class="btn-upload" type="button" onclick='ModalUploadPics(${item.employeeId})' id="uploadMobileBTN_${item.employeeId}" style="width: 95px;">
|
||||
${item.hasUploadedImage === "true" ? `ویرایش عکس` : `بارگذاری عکس`}
|
||||
</button>
|
||||
</div>
|
||||
@@ -116,21 +115,21 @@ function loadDataAjax() {
|
||||
<div class="Rtable-cell--content">
|
||||
<span class="mx-2">`;
|
||||
if (item.hasUploadedImage === "true") {
|
||||
html += `<img src="data:image/jpeg;base64,${item.imagePath}" class="img-avatar" />`;
|
||||
html += `<img id="ImageEmployeeMobile_${item.employeeId}" src="data:image/jpeg;base64,${item.imagePath}" class="img-avatar" />`;
|
||||
}
|
||||
else {
|
||||
html += `<img src="/AssetsClient/images/Credits.png" class="img-avatar" alt="">`;
|
||||
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="title-mobile" style="width: 132px;">${item.employeeFullName}</div>
|
||||
<div class="content-mobile">`;
|
||||
if (item.hasUploadedImage === "true") {
|
||||
html += `<p class="m-0">عکس پرسنل آپلود شده است</p>`;
|
||||
html += `<p id="TextUploadMobile_${item.employeeId}" class="m-0">عکس پرسنل آپلود شده است</p>`;
|
||||
}
|
||||
else {
|
||||
html += `<p class="m-0 text-danger">عکس پرسنل آپلود نشده است</p>`;
|
||||
html += `<p id="TextUploadMobile_${item.employeeId}" class="m-0 text-danger">عکس پرسنل آپلود نشده است</p>`;
|
||||
}
|
||||
html += `</div>
|
||||
</div>
|
||||
@@ -138,7 +137,7 @@ function loadDataAjax() {
|
||||
<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" onclick='ModalUploadPics(${item.employeeId})'>
|
||||
<button class="btn-upload-mobile text-nowrap w-100" type="button" id="uploadMobileBTNMobile_${item.employeeId}" onclick='ModalUploadPics(${item.employeeId})'>
|
||||
${item.hasUploadedImage === "true" ? `ویرایش عکس` : `بارگذاری عکس`}
|
||||
</button>
|
||||
|
||||
|
||||
@@ -1,126 +1,14 @@
|
||||
// if ($(window).width() < 992) {
|
||||
// Webcam.set({
|
||||
|
||||
// width: 1800,
|
||||
// height: 1800,
|
||||
|
||||
// // final cropped size
|
||||
// // crop_width: 296,
|
||||
// // crop_height: 396,
|
||||
// dest_width: 1800,
|
||||
// dest_height: 1800,
|
||||
|
||||
// crop_width: 1800,
|
||||
// crop_height: 1800,
|
||||
// image_format: 'jpeg',
|
||||
// jpeg_quality: 90,
|
||||
// // facingMode: "environment",
|
||||
// constraints: {
|
||||
// facingMode: "user" // This sets the camera to front-facing
|
||||
// }
|
||||
// });
|
||||
// Webcam.attach('#my_camera');
|
||||
// Webcam.attach('#video');
|
||||
// var demo = $('#video');
|
||||
// let demoVideo = $('#video').find('video[playsinline="playsinline"]');
|
||||
// demo.css({
|
||||
// width: "100%",
|
||||
// height: "100%",
|
||||
// });
|
||||
// demoVideo.css({
|
||||
// width: "100%",
|
||||
// height: "100%",
|
||||
// });
|
||||
// } else {
|
||||
|
||||
// Webcam.set({
|
||||
// width: 600,
|
||||
// height: 600,
|
||||
// image_format: 'jpeg',
|
||||
// jpeg_quality: 100
|
||||
// });
|
||||
// Webcam.attach('#my_camera');
|
||||
// Webcam.attach('#video');
|
||||
// var demo = $('#video');
|
||||
// let demoVideo = $('#video').find('video[playsinline="playsinline"]');
|
||||
// demo.css({
|
||||
// width: "100%",
|
||||
// height: "100%",
|
||||
// });
|
||||
// demoVideo.css({
|
||||
// width: "100%",
|
||||
// height: "100%",
|
||||
// });
|
||||
// }
|
||||
|
||||
// function take_snapshot1() {
|
||||
// Webcam.snap(function (data_uri) {
|
||||
// // ایجاد یک عنصر تصویر از دادههای تصویر
|
||||
// var img = new Image();
|
||||
// img.src = data_uri;
|
||||
// img.onload = function() {
|
||||
// let canvas = document.createElement('canvas');
|
||||
// let ctx = canvas.getContext('2d');
|
||||
|
||||
// // پیدا کردن اندازه مربع برای کراپ
|
||||
// let sideLength = Math.min(img.width, img.height);
|
||||
// let startX = (img.width - sideLength) / 2;
|
||||
// let startY = (img.height - sideLength) / 2;
|
||||
|
||||
// let newWidth = 1800;
|
||||
// let newHeight = 1800;
|
||||
|
||||
// // تنظیم اندازه کانواس به اندازه جدید
|
||||
// canvas.width = newWidth;
|
||||
// canvas.height = newHeight;
|
||||
|
||||
// // رسم تصویر کراپ شده و تغییر اندازه داده شده
|
||||
// ctx.drawImage(img, startX, startY, sideLength, sideLength, 0, 0, newWidth, newHeight);
|
||||
// // resolve(canvas.toDataURL('image/jpeg'));
|
||||
|
||||
|
||||
// // // ایجاد یک بوم برای برش دادن تصویر
|
||||
// // var canvas = document.createElement('canvas');
|
||||
// // var context = canvas.getContext('2d');
|
||||
// // var size = Math.min(img.width, img.height);
|
||||
|
||||
// // canvas.width = size;
|
||||
// // canvas.height = size;
|
||||
|
||||
// // // محاسبه محل برش تصویر
|
||||
// // var sx = (img.width - size) / 2;
|
||||
// // var sy = (img.height - size) / 2;
|
||||
|
||||
// // context.drawImage(img, sx, sy, size, size, 0, 0, size, size);
|
||||
|
||||
// // تبدیل بوم به دادههای URI
|
||||
// var croppedDataUri = canvas.toDataURL('image/jpeg');
|
||||
|
||||
// // نمایش تصویر برش داده شده
|
||||
// document.getElementById('result1').innerHTML = '<img style="display:none; object-fit: cover;" id="pic1" data-uri="' + croppedDataUri + '" src="' + croppedDataUri + '"/>';
|
||||
// document.getElementById('demoResult1').innerHTML = '<button type="button" class="upload-image1">آپلود عکس اول</button><img style="width: 100%; height: 100%; border-radius:10px; object-fit: cover;" data-uri="' + croppedDataUri + '" src="' + croppedDataUri + '"/>';
|
||||
// };
|
||||
// });
|
||||
// $('.md-modal').removeClass('md-show');
|
||||
// }
|
||||
|
||||
// function take_snapshot1() {
|
||||
// Webcam.snap(function(data_uri) {
|
||||
// document.getElementById('result1').innerHTML = '<img style="display:none; object-fit: cover;" id="pic1" data-uri="' + data_uri + '" src="' + data_uri + '"/>';
|
||||
// document.getElementById('demoResult1').innerHTML = '<button type="button" class="upload-image1">آپلود عکس اول</button><img style="width: 100%; height: 100%; border-radius:10px; object-fit: cover;" data-uri="' + data_uri + '" src="' + data_uri + '"/>';
|
||||
// });
|
||||
// $('.md-modal').removeClass('md-show');
|
||||
// }
|
||||
// function take_snapshot2() {
|
||||
// Webcam.snap(function (data_uri) {
|
||||
// document.getElementById('result2').innerHTML = '<img style="display:none; object-fit: cover;" id="pic2" data-uri="' + data_uri + '" src="' + data_uri + '"/>';
|
||||
// document.getElementById('demoResult2').innerHTML = '<button type="button" class="upload-image2">آپلود عکس دوم</button><img style="width: 100%; height: 100%; border-radius:10px; object-fit: cover;" data-uri="' + data_uri + '" src="' + data_uri + '"/>';
|
||||
// });
|
||||
// $('.md-modal').removeClass('md-show');
|
||||
// }
|
||||
|
||||
var loadModels = async () => {
|
||||
await Promise.all([
|
||||
faceapi.nets.ssdMobilenetv1.loadFromUri("\\weights\\"),
|
||||
faceapi.nets.faceRecognitionNet.loadFromUri("\\weights\\"),
|
||||
faceapi.nets.faceLandmark68Net.loadFromUri("\\weights\\")
|
||||
]);
|
||||
};
|
||||
loadModels();
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
if ($(window).width() > 992) {
|
||||
$('#desktopDisplay').show();
|
||||
$('#mobileDisplay').hide();
|
||||
@@ -155,29 +43,23 @@ $(document).ready(function () {
|
||||
updateSaveButton();
|
||||
});
|
||||
|
||||
window.onload = async () => {
|
||||
await loadModels();
|
||||
modelsLoaded = true;
|
||||
};
|
||||
//window.onload = async () => {
|
||||
// await loadModels();
|
||||
// modelsLoaded = true;
|
||||
//};
|
||||
|
||||
|
||||
var loadModels = async () => {
|
||||
await Promise.all([
|
||||
faceapi.nets.ssdMobilenetv1.loadFromUri("\\weights\\"),
|
||||
faceapi.nets.faceRecognitionNet.loadFromUri("\\weights\\"),
|
||||
faceapi.nets.faceLandmark68Net.loadFromUri("\\weights\\")
|
||||
]);
|
||||
};
|
||||
var modelsLoaded = false;
|
||||
|
||||
var ensureModelsLoaded = async () => {
|
||||
if (!modelsLoaded) {
|
||||
await loadModels();
|
||||
modelsLoaded = true;
|
||||
}
|
||||
};
|
||||
//var ensureModelsLoaded = async () => {
|
||||
// if (!modelsLoaded) {
|
||||
// await loadModels();
|
||||
// modelsLoaded = true;
|
||||
// }
|
||||
//};
|
||||
|
||||
var updateSaveButton = () => {
|
||||
if (checkFace === 2) {
|
||||
if (!hasErrorPic1 && checkFace1 && !hasErrorPic2 && checkFace2) {
|
||||
$('#SaveImageEmployee').removeClass('disable');
|
||||
} else {
|
||||
$('#SaveImageEmployee').addClass('disable');
|
||||
@@ -185,78 +67,89 @@ var updateSaveButton = () => {
|
||||
};
|
||||
|
||||
var runCheckFace1 = async () => {
|
||||
await ensureModelsLoaded();
|
||||
|
||||
const img1 = document.getElementById('pic1');
|
||||
|
||||
const detectionPromise1 = faceapi.detectSingleFace(img1).withFaceLandmarks().withFaceDescriptor();
|
||||
const delayPromise1 = new Promise(resolve => setTimeout(resolve, 2000));
|
||||
const detectionPromise1 = await faceapi.detectAllFaces(img1).withFaceLandmarks().withFaceDescriptors();
|
||||
|
||||
if (detectionPromise1.length === 1) {
|
||||
console.log('یک چهره در تصویر اول شناسایی شد');
|
||||
|
||||
const [detection1] = await Promise.all([detectionPromise1, delayPromise1]);
|
||||
|
||||
//const detection1 = await faceapi.detectSingleFace(img1).withFaceLandmarks().withFaceDescriptor();
|
||||
if (detection1) {
|
||||
console.log('چهره در تصویر اول شناسایی شد');
|
||||
|
||||
if (checkFace < 2) {
|
||||
checkFace = checkFace + 1;
|
||||
}
|
||||
checkFace1 = true;
|
||||
hasErrorPic1 = false;
|
||||
$('#demoResult1').css('border', '2px dashed #148b8b');
|
||||
} else {
|
||||
} else if (detectionPromise1.length > 1) {
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('چهرهای در تصویر اول شناسایی نشد');
|
||||
$('.alert-msg p').text('بیش از یک چهره در تصویر اول شناسایی شد');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
}, 2000);
|
||||
|
||||
if (checkFace > 0) {
|
||||
checkFace = checkFace - 1;
|
||||
}
|
||||
|
||||
hasErrorPic1 = true;
|
||||
|
||||
$('#SaveImageEmployee').addClass('disable');
|
||||
$('.upload-image1').css('background', '#ff090940');
|
||||
$('#demoResult1').css('border', '2px dashed #ff5c5c');
|
||||
}
|
||||
updateSaveButton();
|
||||
$('#loadingImage1').hide();
|
||||
} else {
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('چهرهای در تصویر اول شناسایی نشد');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
}, 2000);
|
||||
|
||||
hasErrorPic1 = true;
|
||||
|
||||
$('#SaveImageEmployee').addClass('disable');
|
||||
$('.upload-image1').css('background', '#ff090940');
|
||||
$('#demoResult1').css('border', '2px dashed #ff5c5c');
|
||||
}
|
||||
updateSaveButton();
|
||||
$('#loadingImage1').hide();
|
||||
};
|
||||
|
||||
var runCheckFace2 = async () => {
|
||||
await ensureModelsLoaded();
|
||||
|
||||
const img2 = document.getElementById('pic2');
|
||||
|
||||
const detectionPromise2 = faceapi.detectSingleFace(img2).withFaceLandmarks().withFaceDescriptor();
|
||||
const delayPromise2 = new Promise(resolve => setTimeout(resolve, 2000));
|
||||
const detectionPromise2 = await faceapi.detectAllFaces(img2).withFaceLandmarks().withFaceDescriptors();
|
||||
|
||||
const [detection2] = await Promise.all([detectionPromise2, delayPromise2]);
|
||||
|
||||
//const detection2 = await faceapi.detectSingleFace(img2).withFaceLandmarks().withFaceDescriptor();
|
||||
if (detection2) {
|
||||
console.log('چهره در تصویر دوم شناسایی شد');
|
||||
|
||||
if (checkFace < 2) {
|
||||
checkFace = checkFace + 1;
|
||||
}
|
||||
if (detectionPromise2.length === 1) {
|
||||
console.log('یک چهره در تصویر دوم شناسایی شد');
|
||||
checkFace2 = true;
|
||||
hasErrorPic2 = false;
|
||||
|
||||
$('#demoResult2').css('border', '2px dashed #148b8b');
|
||||
} else {
|
||||
} else if (detectionPromise2.length > 1) {
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('چهرهای در تصویر دوم شناسایی نشد');
|
||||
$('.alert-msg p').text('بیش از یک چهره در تصویر دوم شناسایی شد');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
}, 2000);
|
||||
|
||||
if (checkFace > 0) {
|
||||
checkFace = checkFace - 1;
|
||||
}
|
||||
hasErrorPic2 = true;
|
||||
|
||||
$('#SaveImageEmployee').addClass('disable');
|
||||
$('.upload-image2').css('background', '#ff090940');
|
||||
$('#demoResult2').css('border', '2px dashed #ff5c5c');
|
||||
}
|
||||
} else {
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('چهرهای در تصویر دوم شناسایی نشد');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
}, 2000);
|
||||
|
||||
hasErrorPic2 = true;
|
||||
|
||||
$('#SaveImageEmployee').addClass('disable');
|
||||
$('.upload-image2').css('background', '#ff090940');
|
||||
$('#demoResult2').css('border', '2px dashed #ff5c5c');
|
||||
}
|
||||
updateSaveButton();
|
||||
$('#loadingImage2').hide();
|
||||
$('#loadingImage2').hide();
|
||||
};
|
||||
|
||||
|
||||
@@ -359,8 +252,6 @@ function take_snapshot2() {
|
||||
|
||||
$('.md-modal').removeClass('md-show');
|
||||
stopCamera();
|
||||
loadModels();
|
||||
runCheckFace2();
|
||||
}
|
||||
|
||||
|
||||
@@ -370,7 +261,7 @@ function set() {
|
||||
let workshopId = Number($('#workshopId').val());
|
||||
let employeeId = Number($('#employeeId').val());
|
||||
|
||||
if (checkFace) {
|
||||
if (!hasErrorPic1 && checkFace1 && !hasErrorPic2 && checkFace2) {
|
||||
if (pic1 != null && pic2 != null) {
|
||||
const loading = $('.spinner-loading-progress').show();
|
||||
const loadingBtn = $('.spinner-loading').show();
|
||||
@@ -378,7 +269,6 @@ function set() {
|
||||
|
||||
$('#SaveImageEmployee').addClass('disable');
|
||||
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: takePictureAjax,
|
||||
@@ -406,9 +296,9 @@ function set() {
|
||||
success: function (response) {
|
||||
let elapsedTime = Date.now() - startTime;
|
||||
let delay = Math.max(1000 - elapsedTime, 0);
|
||||
console.log(response);
|
||||
|
||||
setTimeout(function () {
|
||||
|
||||
if (response.isSuccedded) {
|
||||
$('.alert-success-msg').show();
|
||||
$('.alert-success-msg p').text(response.message);
|
||||
@@ -416,10 +306,19 @@ function set() {
|
||||
$('.alert-success-msg').hide();
|
||||
$('.alert-success-msg p').text('');
|
||||
|
||||
$(`#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');
|
||||
|
||||
$(`#uploadMobileBTN_${employeeId}`).text("ویرایش عکس");
|
||||
$(`#uploadMobileBTNMobile_${employeeId}`).text("ویرایش عکس");
|
||||
|
||||
$(`#Section_${employeeId}`).removeClass("deactive");
|
||||
|
||||
$('#SaveImageEmployee').removeClass('disable');
|
||||
//loading.hide();
|
||||
$('#MainModal').modal('hide');
|
||||
//window.location.reload();
|
||||
}, 1000);
|
||||
} else {
|
||||
$('#SaveImageEmployee').removeClass('disable');
|
||||
@@ -452,62 +351,4 @@ function set() {
|
||||
$('.alert-msg p').text('');
|
||||
}, 3500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//function set() {
|
||||
// let pic1 = $("#pic1").attr('src');
|
||||
// let pic2 = $("#pic2").attr('src');
|
||||
// let workshopId = Number($('#workshopId').val());
|
||||
// let employeeId = Number($('#employeeId').val());
|
||||
|
||||
// if (checkFace) {
|
||||
// if (pic1 != null && pic2 != null) {
|
||||
// $.ajax({
|
||||
// type: 'POST',
|
||||
// url: takePictureAjax,
|
||||
// data: { "base64pic1": pic1, "base64pic2": pic2, "workshopId": workshopId, "employeeId": employeeId },
|
||||
// headers: { "RequestVerificationToken": antiForgeryToken },
|
||||
// success: function(response) {
|
||||
// if (response.isSuccedded) {
|
||||
// $('.alert-success-msg').show();
|
||||
// $('.alert-success-msg p').text(response.message);
|
||||
// setTimeout(function() {
|
||||
// $('.alert-success-msg').hide();
|
||||
// $('.alert-success-msg p').text('');
|
||||
// window.location.reload();
|
||||
// },
|
||||
// 2000);
|
||||
// } else {
|
||||
// $('.alert-msg').show();
|
||||
// $('.alert-msg p').text(response.message);
|
||||
// setTimeout(function() {
|
||||
// $('.alert-msg').hide();
|
||||
// $('.alert-msg p').text('');
|
||||
// },
|
||||
// 3500);
|
||||
// }
|
||||
// },
|
||||
// failure: function(response) {
|
||||
// console.log(5, response);
|
||||
// }
|
||||
// });
|
||||
// } else {
|
||||
// $('.alert-msg').show();
|
||||
// $('.alert-msg p').text('گرفتن دو عکس الزامیست');
|
||||
// setTimeout(function() {
|
||||
// $('.alert-msg').hide();
|
||||
// $('.alert-msg p').text('');
|
||||
// },
|
||||
// 3500);
|
||||
// }
|
||||
// } else {
|
||||
// $('.alert-msg').show();
|
||||
// $('.alert-msg p').text('گرفتن دو عکس الزامیست');
|
||||
// setTimeout(function () {
|
||||
// $('.alert-msg').hide();
|
||||
// $('.alert-msg p').text('');
|
||||
// }, 3500);
|
||||
// }
|
||||
//}
|
||||
}
|
||||