fixed bugs

This commit is contained in:
SamSys
2025-02-18 18:21:35 +03:30
parent e6dd81de9b
commit 9ebcb4cde2
50 changed files with 1273 additions and 157 deletions

View File

@@ -0,0 +1,207 @@
@page
@model ServiceHost.Areas.Client.Pages.Company.EmployeesDocuments.IndexModel
@{
string clientVersion = _0_Framework.Application.Version.StyleVersion;
Layout = "Shared/_ClientLayout";
ViewData["title"] = " - لیست کل پرسنل";
int index = 1;
}
@section Styles {
<link href="~/AssetsClient/css/table-style.css?ver=@clientVersion" rel="stylesheet" />
<link href="~/AssetsClient/css/table-responsive.css?ver=@clientVersion" rel="stylesheet" />
<link href="~/assetsclient/css/operation-button.css?ver=@clientVersion" rel="stylesheet" />
<link href="~/AssetsClient/css/filter-search.css?ver=@clientVersion" rel="stylesheet" />
<link href="~/AssetsClient/css/card.css?ver=@clientVersion" rel="stylesheet" />
<link href="~/assetsclient/pages/employeesdocument/css/index.css?ver=@clientVersion" rel="stylesheet" />
}
<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/icons/list-info-personnel.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/Employees/Index" class="back-btn" type="button">
<span>بازگشت</span>
</a>
</div>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row p-2">
<div class="align-items-center d-flex">
<button data-mode="active" class="btnTabPD active">پرسنل های فعال</button>
<button data-mode="deactive" class="btnTabPD">پرسنل های غیر فعال</button>
</div>
</div>
</div>
<button class="btn btn-rounded mb-5 goToTop">
<div class="d-flex align-items-center">
<span>برو بالا</span>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" width="20px" class="ms-1">
<path stroke-linecap="round" stroke-linejoin="round" d="m4.5 18.75 7.5-7.5 7.5 7.5" />
<path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 7.5-7.5 7.5 7.5" />
</svg>
</div>
</button>
<div class="container-fluid d-none d-md-block">
<div class="row px-2">
<div class="search-box card">
<div class="row">
<div class="col-12">
<div class="row search-personal-section gap-2">
<div class="col-3">
<input type="text" name="employeeName" class="form-control employeeName" placeholder="نام و نام خانوادگی پرسنل ...">
</div>
<button class="btn-search btn-w-size btn-search-click text-nowrap d-flex align-items-center justify-content-center" id="searchBtn" type="submit">
<span>جستجو</span>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
<circle cx="11" cy="11" r="6" stroke="white"/>
<path d="M20 20L17 17" stroke="white" stroke-linecap="round"/>
</svg>
</button>
<div class="btn-clear-filter btn-w-size text-nowrap d-flex align-items-center justify-content-center disable">
<span>حذف جستجو</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="container-fluid">
<!-- Advance Search Box -->
<div class="d-block d-md-none mb-1">
<div class="row d-flex align-items-center justify-content-between">
<div class="search-box bg-white p-2">
<div class="d-flex justify-content-between text-center">
<button class="btn-search w-100" type="button" data-bs-toggle="modal" data-bs-target="#searchModal">
<span>جستجو پیشرفته</span>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
<circle cx="11" cy="11" r="6" stroke="white" />
<path d="M20 20L17 17" stroke="white" stroke-linecap="round" />
</svg>
</button>
</div>
</div>
</div>
</div>
<!-- End Advance Search Box -->
<div class="row p-lg-2">
<div class="card p-2">
<div class="wrapper">
<div class="personnelDocuments Rtable Rtable--5cols Rtable--collapse">
<div class="Rtable-row Rtable-row--head align-items-center sticky-div">
<div class="Rtable-cell column-heading width1">ردیف</div>
<div class="Rtable-cell column-heading width2">نام و نام خانوادگی</div>
<div class="Rtable-cell column-heading text-center width3">عکس پرسنلی</div>
<div class="Rtable-cell column-heading text-center width4">کارت ملی</div>
<div class="Rtable-cell column-heading text-center width5">کارت پایان خدمت</div>
<div class="Rtable-cell column-heading text-center width6">شناسنامه</div>
<div class="Rtable-cell column-heading text-end pe-2 width7">عملیات</div>
</div>
<div class="w-100" id="personnelDocumentsAjax">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Modal From Bottom For Advance Search -->
<div class="modal fade" id="searchModal" tabindex="-1" data-bs-backdrop="static" aria-labelledby="searchModalModalLabel" aria-hidden="true">
<div class="modal-dialog modal-fullscreen">
<div class="modal-content">
<div class="modal-header d-block text-center pb-0">
<div class="iphone-line mx-auto mb-3"></div>
<h5 class="modal-title mb-4 text-start" id="searchModalLabel">جستجوی پیشرفته</h5>
</div>
<div class="modal-body pt-0 mb-3">
<div class="container-fluid search-box">
<div id="overlaySearchAdvance" class=""></div>
<div class="row">
<div class="col-12 text-start mb-4">
<div><input type="text" name="employeeName" class="form-control employeeName" placeholder="نام پرسنل"></div>
</div>
<div class="col-12">
<div class="btn-clear-filter py-2 text-center d-block w-100 mt-2">
<span class="w-100">حذف جستجو</span>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer justify-content-center align-items-center">
<div class="container-fluid">
<div class="row">
<div class="col-6 text-end">
<button type="button" class="btn-cancel w-100" data-bs-dismiss="modal">بستن</button>
</div>
<div class="col-6 text-start">
<button type="submit" class="btn-search btn-search-click w-100">جستجو</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- End Modal From Bottom For Advance Search -->
<div id="MainModal" class="modal fade personalListModal" aria-labelledby="myModalLabel" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" 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" name="Model.HasEmployees" value="Model.HasEmployees" id="hasEmployee" />
@section Script {
<script>
var antiForgeryToken = $(`@Html.AntiForgeryToken()`).val();
var employeeDocumentsAjaxLoadData = `@Url.Page("./Index", "EmployeeDocumentsAjax")`;
var showPictureUrl = `@Url.Page("./Index", "ShowPicture")`;
</script>
<script src="~/assetsclient/js/site.js?ver=@clientVersion"></script>
<script src="~/assetsclient/pages/employeesdocument/js/index.js?ver=@clientVersion"></script>
}

View File

@@ -0,0 +1,150 @@
using _0_Framework.Application;
using CompanyManagment.App.Contracts.Employee;
using CompanyManagment.App.Contracts.EmployeeDocuments;
using CompanyManagment.App.Contracts.Error;
using CompanyManagment.App.Contracts.Workshop;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using System.Security.Claims;
namespace ServiceHost.Areas.Client.Pages.Company.EmployeesDocuments
{
[Authorize]
public class IndexModel : PageModel
{
private readonly IPasswordHasher _passwordHasher;
private readonly IAuthHelper _authHelper;
private readonly IWorkshopApplication _workshopApplication;
private readonly IWebHostEnvironment _webHostEnvironment;
private readonly IEmployeeDocumentsApplication _employeeDocumentsApplication;
private readonly IHttpContextAccessor _contextAccessor;
private readonly long _workshopId;
public string WorkshopFullName;
public IndexModel(IPasswordHasher passwordHasher, IWorkshopApplication workshopApplication, IEmployeeDocumentsApplication employeeDocumentsApplication, IAuthHelper authHelper, IWebHostEnvironment webHostEnvironment, IHttpContextAccessor contextAccessor)
{
_passwordHasher = passwordHasher;
_workshopApplication = workshopApplication;
_employeeDocumentsApplication = employeeDocumentsApplication;
_authHelper = authHelper;
_webHostEnvironment = webHostEnvironment;
_contextAccessor = contextAccessor;
var workshopHash = _contextAccessor.HttpContext?.User.FindFirstValue("WorkshopSlug");
_workshopId = _passwordHasher.SlugDecrypt(workshopHash);
if (_workshopId < 1)
throw new InvalidDataException("اختلال در کارگاه");
}
public IActionResult OnGet()
{
WorkshopFullName= _workshopApplication.GetWorkshopFullname(_workshopId);
return Page();
}
public IActionResult OnGetEmployeeDocumentsAjax(string employeeName, int pageIndex, string searchMode = "")
{
EmployeeDocumentSearchMode mode;
switch (searchMode.ToLower())
{
case "all":
mode = EmployeeDocumentSearchMode.All;
break;
case "active":
mode = EmployeeDocumentSearchMode.ActiveEmployees;
break;
case "deactive":
mode = EmployeeDocumentSearchMode.DeactiveEmployees;
break;
default:
mode = EmployeeDocumentSearchMode.All;
break;
}
List<EmployeeDocumentsViewModel> result = _employeeDocumentsApplication.SearchForClient(new SearchEmployeeDocuments()
{
WorkshopId = _workshopId,
PageIndex = pageIndex,
EmployeeName = employeeName
}, mode);
return new JsonResult(new
{
IsSuccedded = true,
data = result,
pageIndex = result.Count()
});
}
public IActionResult OnGetCreateUploadDocument(long employeeId)
{
var employeeDocument = _employeeDocumentsApplication.GetDetailsForClient(employeeId, _workshopId);
return Partial("ModalUploadDocument", employeeDocument);
}
public IActionResult OnPostCreateUploadDocument(AddEmployeeDocumentItem command)
{
command.WorkshopId = _workshopId;
var result = _employeeDocumentsApplication.AddEmployeeDocumentItemForClient(command);
var employeeDocument = _employeeDocumentsApplication.GetDetailsForClient(command.EmployeeId, _workshopId);
return new JsonResult(new
{
isSuccedded = result.IsSuccedded,
message = result.Message,
imageSrc = employeeDocument
});
}
public IActionResult OnPostRemoveEmployeeDocumentByLabel(long employeeId, DocumentItemLabel label)
{
var result = _employeeDocumentsApplication.DeleteEmployeeMultipleUnsubmittedDocumentsByLabel(_workshopId, employeeId,
label);
return new JsonResult(new
{
isSuccedded = result.IsSuccedded,
message = result.Message
});
}
public IActionResult OnPostSaveSubmit(SubmitEmployeeDocuments cmd)
{
var result = _employeeDocumentsApplication.SubmitDocumentItemsByClient(cmd);
return new JsonResult(new
{
isSuccedded = result.IsSuccedded,
message = result.Message,
});
}
public IActionResult OnPostCancelOperation(long workshopId, long employeeId)
{
var result = _employeeDocumentsApplication.DeleteUnsubmittedItems(_workshopId, employeeId);
return new JsonResult(new
{
success = result.IsSuccedded,
message = result.Message,
});
}
public IActionResult OnGetShowPicture(string filePath)
{
if (string.IsNullOrEmpty(filePath))
return NotFound();
if (!System.IO.File.Exists(filePath))
return NotFound();
var contentType = Tools.GetContentTypeImage(Path.GetExtension(filePath));
return PhysicalFile(filePath, contentType);
}
}
}

View File

@@ -0,0 +1,348 @@
@using System.Reflection
@using CompanyManagment.App.Contracts.EmployeeDocuments
@using Microsoft.AspNetCore.Mvc.TagHelpers
@model CompanyManagment.App.Contracts.EmployeeDocuments.EmployeeDocumentsViewModel
@{
string clientVersion = _0_Framework.Application.Version.StyleVersion;
<link href="~/assetsclient/pages/employeesdocument/css/ModalUploadDocument.css?ver=@clientVersion" rel="stylesheet" />
}
<form role="form" method="post" name="create-form" id="create-form" autocomplete="off">
<div class="modal-content">
<div class="modal-header pb-0 d-flex align-items-center justify-content-center text-center">
<button type="button" class="btn-close position-absolute text-start exitModal" aria-label="Close"></button>
<div>
<p class="m-0 pdHeaderTitle1">آپلود مدارک @Model.EmployeeFullName</p>
</div>
</div>
<div class="modal-body">
<div class="pdBoxGrid">
<div class="pdBox">
<input type="hidden" id="employeeIdForList" value="@Model.EmployeeId" asp-for="@Model.EmployeeId"/>
<div class="d-flex align-items-center justify-content-start w90">
<div class="pdImageBox">
@if (Model.EmployeePicture.PicturePath != null && !string.IsNullOrWhiteSpace(Model.EmployeePicture.PicturePath))
{
<img id="EmployeePicture" src="@Url.Page("./Index", "ShowPicture", new { filePath = @Model.EmployeePicture.PicturePath })" class="preview-image isTrue"/>
}
else
{
<img id="EmployeePicture" src="~/assetsclient/images/pd-image.png" class="preview-image"/>
}
<input type="hidden" value="@Model.EmployeePicture.Id" asp-for="@Model.EmployeePicture.Id"/>
<div class="sign ">
</div>
</div>
<div class="text-start mx-1 pdTitle">
<div class="d-flex align-items-center justify-content-between">
<div>عکس پرسنل @* <span> *</span> *@</div>
<div class="resultMessage">
<div>@(!string.IsNullOrWhiteSpace(Model.EmployeePicture.RejectionMessage) ? "رد شد" : "")</div>
@* <span class="pdTitle2 d-none d-md-block">در صورت آپلود نکردن عکس پرسنلی، عکس از حضور و غیاب تنظیم می‌شود.</span> *@
</div>
</div>
<div class="pdTitle2 reasonReject">@(!string.IsNullOrWhiteSpace(Model.EmployeePicture.RejectionMessage) ? Model.EmployeePicture.RejectionMessage : "")</div>
</div>
</div>
<input type="hidden" id="label_0" value="EmployeePicture"/>
<div class="pdButtons">
<button type="button" class="btnUploadingPD d-block mb-1" data-index="0">آپلود عکس</button>
<button type="button" class="btnDeletingPD d-block @(!string.IsNullOrWhiteSpace(Model.EmployeePicture.PicturePath) ? Model.EmployeePicture.Status.ToString() : "") @(string.IsNullOrWhiteSpace(Model.EmployeePicture.PicturePath) ? "disable" : "")" data-index="0">حذف</button>
</div>
<input type="file" class="file-input" data-index="0" accept=".jpg,.jpeg,.png,.pdf" style="display: none;">
<div class="spinner-loading-progress loading" style="display: none">
<span class="text-white percentageText"></span>
</div>
</div>
<div class="pdBox">
<div class="d-flex align-items-center justify-content-start w90">
<div class="pdImageBox">
@if (!string.IsNullOrWhiteSpace(Model.NationalCardFront.PicturePath))
{
<img id="NationalCardFront" src="@Url.Page("./Index", "ShowPicture", new { filePath = @Model.NationalCardFront.PicturePath })" class="preview-image isTrue"/>
}
else
{
<img id="NationalCardFront" src="~/assetsclient/images/pd-image.png" class="preview-image"/>
}
<input type="hidden" value="@Model.NationalCardFront?.Id ?? 0" asp-for="@Model.NationalCardFront.Id"/>
<div class="sign ">
</div>
</div>
<div class="text-start mx-1 pdTitle">
<div class="d-flex align-items-center justify-content-between">
<div>کارت ملی رو @* <span> *</span> *@</div>
<div class="resultMessage">
<div>@(!string.IsNullOrWhiteSpace(Model.NationalCardFront.RejectionMessage) ? "رد شد" : "")</div>
</div>
</div>
<div class="pdTitle2 reasonReject ">@(!string.IsNullOrWhiteSpace(Model.NationalCardFront.RejectionMessage) ? Model.NationalCardFront.RejectionMessage : "")</div>
</div>
</div>
<input type="hidden" id="label_1" value="NationalCardFront"/>
<div>
<button type="button" class="btnUploadingPD d-block mb-1" data-index="1">آپلود عکس</button>
<button type="button" class="btnDeletingPD d-block @(!string.IsNullOrWhiteSpace(Model.NationalCardFront.PicturePath) ? Model.NationalCardFront.Status.ToString() : "") @(!string.IsNullOrWhiteSpace(Model.NationalCardFront?.PicturePath) ? "" : "disable")" data-index="1">حذف</button>
</div>
<input type="file" class="file-input" data-index="1" accept=".jpg,.jpeg,.png,.pdf" style="display: none;">
<div class="spinner-loading-progress loading" style="display: none">
<span class="text-white percentageText"></span>
</div>
</div>
<div class="pdBox">
<div class="d-flex align-items-center justify-content-start w90">
<div class="pdImageBox">
@if (!string.IsNullOrWhiteSpace(Model.NationalCardRear.PicturePath))
{
<img id="NationalCardRear" src="@Url.Page("./Index", "ShowPicture", new { filePath = @Model.NationalCardRear.PicturePath })" class="preview-image isTrue"/>
}
else
{
<img id="NationalCardRear" src="~/assetsclient/images/pd-image.png" class="preview-image"/>
}
<input type="hidden" value="@Model.NationalCardRear.Id" asp-for="@Model.NationalCardRear.Id"/>
<div class="sign">
</div>
</div>
<div class="text-start mx-1 pdTitle">
<div class="d-flex align-items-center justify-content-between">
<div>کارت ملی پشت @* <span> *</span> *@</div>
<div class="resultMessage">
<div>@(!string.IsNullOrWhiteSpace(Model.NationalCardRear.RejectionMessage) ? "رد شد" : "")</div>
</div>
</div>
<div class="pdTitle2 reasonReject ">@(!string.IsNullOrWhiteSpace(Model.NationalCardRear.RejectionMessage) ? Model.NationalCardRear.RejectionMessage : "")</div>
</div>
</div>
<input type="hidden" id="label_2" value="NationalCardRear"/>
<div>
<button type="button" class="btnUploadingPD d-block mb-1" data-index="2">آپلود عکس</button>
<button type="button" class="btnDeletingPD d-block @(!string.IsNullOrWhiteSpace(Model.NationalCardRear.PicturePath) ? Model.NationalCardRear.Status.ToString() : "") @(!string.IsNullOrWhiteSpace(Model.NationalCardRear.PicturePath) ? "" : "disable")" data-index="2">حذف</button>
</div>
<input type="file" class="file-input" data-index="2" accept=".jpg,.jpeg,.png,.pdf" style="display: none;">
<div class="spinner-loading-progress loading" style="display: none">
<span class="text-white percentageText"></span>
</div>
</div>
<div class="pdBox @(Model.Gender == "زن" ? "disable" : "") ">
<div class="d-flex align-items-center justify-content-start w90">
<div class="pdImageBox">
@if (!string.IsNullOrWhiteSpace(Model.MilitaryServiceCard.PicturePath))
{
<img id="militaryServiceCardModal" src="@Url.Page("./Index", "ShowPicture", new { filePath = @Model.MilitaryServiceCard.PicturePath })" class="preview-image isTrue"/>
}
else
{
<img id="militaryServiceCardModal" src="~/assetsclient/images/pd-image.png" class="preview-image"/>
}
<input type="hidden" value="@Model.MilitaryServiceCard.Id" asp-for="@Model.MilitaryServiceCard.Id"/>
<div class="sign">
</div>
</div>
<div class="text-start mx-1 pdTitle">
<div class="d-flex align-items-center justify-content-between">
<div>کارت پایان خدمت @* <span> *</span> *@</div>
<div class="resultMessage">
<div>@(!string.IsNullOrWhiteSpace(Model.MilitaryServiceCard.RejectionMessage) ? "رد شد" : "")</div>
</div>
</div>
<div class="pdTitle2 reasonReject ">@(!string.IsNullOrWhiteSpace(Model.MilitaryServiceCard.RejectionMessage) ? Model.MilitaryServiceCard.RejectionMessage : "")</div>
</div>
</div>
<input type="hidden" id="label_3" value="MilitaryServiceCard"/>
<div>
<button type="button" class="btnUploadingPD d-block mb-1" data-index="3">آپلود عکس</button>
<button type="button" class="btnDeletingPD d-block @(Model.Gender == "مرد" && !string.IsNullOrWhiteSpace(Model.MilitaryServiceCard.PicturePath) ? Model.MilitaryServiceCard.Status.ToString() : "") @(!string.IsNullOrWhiteSpace(Model.MilitaryServiceCard.PicturePath) ? "" : "disable")" data-index="3">حذف</button>
</div>
<input type="file" class="file-input" data-index="3" accept=".jpg,.jpeg,.png,.pdf" style="display: none;">
<div class="spinner-loading-progress loading" style="display: none">
<span class="text-white percentageText"></span>
</div>
</div>
<div class="pdBox">
<div class="d-flex align-items-center justify-content-start w90">
<div class="pdImageBox">
@if (!string.IsNullOrWhiteSpace(Model.IdCardPage1.PicturePath))
{
<img id="IdCardPage1" src="@Url.Page("./Index", "ShowPicture", new { filePath = @Model.IdCardPage1.PicturePath })" class="preview-image isTrue"/>
}
else
{
<img id="IdCardPage1" src="~/assetsclient/images/pd-image.png" class="preview-image"/>
}
<input type="hidden" value="@Model.IdCardPage1.Id" asp-for="@Model.IdCardPage1.Id"/>
<div class="sign">
</div>
</div>
<div class="text-start mx-1 pdTitle">
<div class="d-flex align-items-center justify-content-between">
<div>شناسنامه صفحه اول @*<span>*</span> *@</div>
<div class="resultMessage">
<div>@(!string.IsNullOrWhiteSpace(Model.IdCardPage1.RejectionMessage) ? "رد شد" : "")</div>
</div>
</div>
<div class="pdTitle2 reasonReject ">@(!string.IsNullOrWhiteSpace(Model.IdCardPage1.RejectionMessage) ? Model.IdCardPage1.RejectionMessage : "")</div>
</div>
</div>
<input type="hidden" id="label_4" value="IdCardPage1"/>
<div>
<button type="button" class="btnUploadingPD d-block mb-1" data-index="4">آپلود عکس</button>
<button type="button" class="btnDeletingPD d-block @(!string.IsNullOrWhiteSpace(Model.IdCardPage1.PicturePath) ? Model.IdCardPage1.Status.ToString() : "") @(!string.IsNullOrWhiteSpace(Model.IdCardPage1.PicturePath) ? "" : "disable")" data-index="4">حذف</button>
</div>
<input type="file" class="file-input" data-index="4" accept=".jpg,.jpeg,.png,.pdf" style="display: none;">
<div class="spinner-loading-progress loading" style="display: none">
<span class="text-white percentageText"></span>
</div>
</div>
<div class="pdBox">
<div class="d-flex align-items-center justify-content-start w90">
<div class="pdImageBox">
@if (!string.IsNullOrWhiteSpace(Model.IdCardPage2.PicturePath))
{
<img id="IdCardPage2" src="@Url.Page("./Index", "ShowPicture", new { filePath = @Model.IdCardPage2.PicturePath })" class="preview-image isTrue"/>
}
else
{
<img id="IdCardPage2" src="~/assetsclient/images/pd-image.png" class="preview-image"/>
}
<input type="hidden" value="@Model.IdCardPage2.Id" asp-for="@Model.IdCardPage2.Id"/>
<div class="sign ">
</div>
</div>
<div class="text-start mx-1 pdTitle">
<div class="d-flex align-items-center justify-content-between">
<div>شناسنامه صفحه دوم</div>
<div class="resultMessage">
<div>@(!string.IsNullOrWhiteSpace(Model.IdCardPage2.RejectionMessage) ? "رد شد" : "")</div>
</div>
</div>
<div class="pdTitle2 reasonReject ">@(!string.IsNullOrWhiteSpace(Model.IdCardPage2.RejectionMessage) ? Model.IdCardPage2.RejectionMessage : "")</div>
</div>
</div>
<input type="hidden" id="label_5" value="IdCardPage2"/>
<div>
<button type="button" class="btnUploadingPD d-block mb-1" data-index="5">آپلود عکس</button>
@* status change first status *@
<button type="button" class="btnDeletingPD d-block @(!string.IsNullOrWhiteSpace(Model.IdCardPage2.PicturePath) ? Model.IdCardPage2.Status.ToString() : "") @(!string.IsNullOrWhiteSpace(Model.IdCardPage2.PicturePath) ? "" : "disable")" data-index="5">حذف</button>
</div>
<input type="file" class="file-input" data-index="5" accept=".jpg,.jpeg,.png,.pdf" style="display: none;">
<div class="spinner-loading-progress loading" style="display: none">
<span class="text-white percentageText"></span>
</div>
</div>
<div class="pdBox">
<div class="d-flex align-items-center justify-content-start w90">
<div class="pdImageBox">
@if (!string.IsNullOrWhiteSpace(Model.IdCardPage3.PicturePath))
{
<img id="IdCardPage3" src="@Url.Page("./Index", "ShowPicture", new { filePath = @Model.IdCardPage3.PicturePath })" class="preview-image isTrue"/>
}
else
{
<img id="IdCardPage3" src="~/assetsclient/images/pd-image.png" class="preview-image"/>
}
<input type="hidden" value="@Model.IdCardPage3.Id" asp-for="@Model.IdCardPage3.Id"/>
<div class="sign ">
</div>
</div>
<div class="text-start mx-1 pdTitle">
<div class="d-flex align-items-center justify-content-between">
<div>شناسنامه صفحه سوم</div>
<div class="resultMessage">
<div>@(!string.IsNullOrWhiteSpace(Model.IdCardPage3.RejectionMessage) ? "رد شد" : "")</div>
</div>
</div>
<div class="pdTitle2 reasonReject ">@(!string.IsNullOrWhiteSpace(Model.IdCardPage3.RejectionMessage) ? Model.IdCardPage3.RejectionMessage : "")</div>
</div>
</div>
<input type="hidden" id="label_6" value="IdCardPage3"/>
<div>
<button type="button" class="btnUploadingPD d-block mb-1" data-index="6">آپلود عکس</button>
@* status change first status *@
<button type="button" class="btnDeletingPD d-block @(!string.IsNullOrWhiteSpace(Model.IdCardPage3.PicturePath) ? Model.IdCardPage3.Status.ToString() : "") @(!string.IsNullOrWhiteSpace(Model.IdCardPage3.PicturePath) ? "" : "disable")" data-index="6">حذف</button>
</div>
<input type="file" class="file-input" data-index="6" accept=".jpg,.jpeg,.png,.pdf" style="display: none;">
<div class="spinner-loading-progress loading" style="display: none">
<span class="text-white percentageText"></span>
</div>
</div>
<div class="pdBox">
<div class="d-flex align-items-center justify-content-start w90">
<div class="pdImageBox">
@if (!string.IsNullOrWhiteSpace(Model.IdCardPage4.PicturePath))
{
<img id="IdCardPage4" src="@Url.Page("./Index", "ShowPicture", new { filePath = @Model.IdCardPage4.PicturePath })" class="preview-image isTrue"/>
}
else
{
<img id="IdCardPage4" src="~/assetsclient/images/pd-image.png" class="preview-image"/>
}
<input type="hidden" value="@Model.IdCardPage4.Id" asp-for="@Model.IdCardPage4.Id"/>
<div class="sign ">
</div>
</div>
<div class="text-start mx-1 pdTitle">
<div class="d-flex align-items-center justify-content-between">
<div>شناسنامه صفحه چهارم </div>
<div class="resultMessage">
<div>@(!string.IsNullOrWhiteSpace(Model.IdCardPage4.RejectionMessage) ? "رد شد" : "")</div>
</div>
</div>
<div class="pdTitle2 reasonReject ">@(!string.IsNullOrWhiteSpace(Model.IdCardPage4.RejectionMessage) ? Model.IdCardPage4.RejectionMessage : "")</div>
</div>
</div>
<input type="hidden" id="label_7" value="IdCardPage4"/>
<div>
<button type="button" class="btnUploadingPD d-block mb-1" data-index="7">آپلود عکس</button>
<button type="button" class="btnDeletingPD d-block @(!string.IsNullOrWhiteSpace(Model.IdCardPage4.PicturePath) ? Model.IdCardPage4.Status.ToString() : "") @(!string.IsNullOrWhiteSpace(Model.IdCardPage4.PicturePath) ? "" : "disable")" data-index="7">حذف</button>
</div>
<input type="file" class="file-input" data-index="7" accept=".jpg,.jpeg,.png,.pdf" style="display: none;">
<div class="spinner-loading-progress loading" style="display: none">
<span class="text-white percentageText"></span>
</div>
</div>
</div>
</div>
<div class="modal-footer d-block">
<div class="container m-auto">
<div class="row">
<div class="col-6 text-end">
<button type="button" class="exitModal btn-cancel2 justify-content-center">انصراف</button>
</div>
<div class="col-6 text-start">
<button type="button" class="btnCreateNew loadingButton disable position-relative" id="createUploadingFiles" onclick="saveSubmit(Number(@Model.Id))">
ثبت
<div class="spinner-loading loading" style="display: none">
<span class="spinner-border spinner-border-sm loading text-white" role="status" aria-hidden="true"></span>
</div>
</button>
</div>
</div>
</div>
</div>
</div>
</form>
<script src="~/assetsclient/js/site.js?ver=@clientVersion"></script>
<script src="~/assetsadminnew/libs/sweetalert2/sweetalert2.all.min.js"></script>
<script src="~/assetsclient/libs/pdf/pdf.js"></script>
<script>
pdfjsLib.GlobalWorkerOptions.workerSrc = '/assetsclient/libs/pdf/pdf.worker.js';
var saveUploadFileModalAjax = `@Url.Page("./Index", "CreateUploadDocument")`;
var saveSubmitAjax = `@Url.Page("./Index", "SaveSubmit")`;
var deleteFileAjaxUrl = `@Url.Page("./Index", "RemoveEmployeeDocumentByLabel")`;
var cancelOperationUrl = `@Url.Page("./Index", "CancelOperation")`;
var employeeId = Number(@Model.EmployeeId);
var UploadedCount = Number(@Model.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(y => y.PropertyType == typeof(EmployeeDocumentItemViewModel)).Select(y => y.GetValue(@Model) as EmployeeDocumentItemViewModel).Count(x=>x.Status == DocumentStatus.Unsubmitted && !string.IsNullOrWhiteSpace(x.PicturePath)));
</script>
<script src="~/assetsclient/pages/employeesdocument/js/ModalUploadDocument.js?ver=@clientVersion"></script>

View File

@@ -19,6 +19,7 @@
<Compile Remove="Areas\Admin\Pages\Company\Tax\**" />
<Compile Remove="Areas\Client\Client\**" />
<Compile Remove="wwwroot\AssetsAdmin\Workshop\**" />
<Compile Remove="wwwroot\AssetsClient\pages\EmployeesDocument\EmployeesDocument\**" />
<Compile Remove="wwwroot\labels\صادق فرخی\**" />
<Compile Remove="wwwroot\labels\صفا پور توکلی\**" />
<Compile Remove="wwwroot\labels\میلاد مصباح\**" />
@@ -27,6 +28,7 @@
<Content Remove="Areas\Admin\Pages\Company\Tax\**" />
<Content Remove="Areas\Client\Client\**" />
<Content Remove="wwwroot\AssetsAdmin\Workshop\**" />
<Content Remove="wwwroot\AssetsClient\pages\EmployeesDocument\EmployeesDocument\**" />
<Content Remove="wwwroot\labels\صادق فرخی\**" />
<Content Remove="wwwroot\labels\صفا پور توکلی\**" />
<Content Remove="wwwroot\labels\میلاد مصباح\**" />
@@ -35,6 +37,7 @@
<EmbeddedResource Remove="Areas\Admin\Pages\Company\Tax\**" />
<EmbeddedResource Remove="Areas\Client\Client\**" />
<EmbeddedResource Remove="wwwroot\AssetsAdmin\Workshop\**" />
<EmbeddedResource Remove="wwwroot\AssetsClient\pages\EmployeesDocument\EmployeesDocument\**" />
<EmbeddedResource Remove="wwwroot\labels\صادق فرخی\**" />
<EmbeddedResource Remove="wwwroot\labels\صفا پور توکلی\**" />
<EmbeddedResource Remove="wwwroot\labels\میلاد مصباح\**" />
@@ -43,6 +46,7 @@
<None Remove="Areas\Admin\Pages\Company\Tax\**" />
<None Remove="Areas\Client\Client\**" />
<None Remove="wwwroot\AssetsAdmin\Workshop\**" />
<None Remove="wwwroot\AssetsClient\pages\EmployeesDocument\EmployeesDocument\**" />
<None Remove="wwwroot\labels\صادق فرخی\**" />
<None Remove="wwwroot\labels\صفا پور توکلی\**" />
<None Remove="wwwroot\labels\میلاد مصباح\**" />
@@ -230,6 +234,8 @@
<None Include="Areas\Client\Pages\Company\EmployeesBankInfo\DetailsBankInfoModal.cshtml" />
<None Include="Areas\Client\Pages\Company\EmployeesBankInfo\Index.cshtml" />
<None Include="Areas\Client\Pages\Company\EmployeesBankInfo\_Partials\EditBankInfoModal.cshtml" />
<None Include="Areas\Client\Pages\Company\EmployeesDocuments\Index.cshtml" />
<None Include="Areas\Client\Pages\Company\EmployeesDocuments\ModalUploadDocument.cshtml" />
<None Include="Areas\Client\Pages\Company\Employees\alert.cshtml" />
<None Include="Areas\Client\Pages\Company\Employees\ChangeCode.cshtml" />
<None Include="Areas\Client\Pages\Company\Employees\ContractCheckoutStatus.cshtml" />
@@ -822,6 +828,8 @@
<None Include="wwwroot\AssetsClient\pages\EmployeesBankInfo\js\DetailsBankInfoModal.js" />
<None Include="wwwroot\AssetsClient\pages\EmployeesBankInfo\js\EditBankInfoModal.js" />
<None Include="wwwroot\AssetsClient\pages\EmployeesBankInfo\js\Index.js" />
<None Include="wwwroot\AssetsClient\pages\EmployeesDocument\js\Index.js" />
<None Include="wwwroot\AssetsClient\pages\EmployeesDocument\js\ModalUploadDocument.js" />
<None Include="wwwroot\AssetsClient\pages\Employees\js\createleave.js" />
<None Include="wwwroot\AssetsClient\pages\Fine\js\CRUDFineSubjectModal.js" />
<None Include="wwwroot\AssetsClient\pages\Fine\js\Index.js" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 505 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 485 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 485 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 485 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 472 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 472 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 420 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 472 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 512 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 KiB

View File

@@ -472,7 +472,7 @@ function saveSubmit(id) {
updatePreviewImage(indexId, id2, imgSrc);
});
_RefreshWorkFlowCountMenu();
_RefreshCheckerCountMenu();
$('#MainModal').modal('hide');
showAlertMessage('.alert-success-msg', 'تصویر موجود با موفقیت ارسال شد.', 3500);

View File

@@ -589,7 +589,7 @@
color: white;
border-radius: 6px;
}
}
.slective-slide {

View File

@@ -60,6 +60,11 @@
overflow: hidden;
}
.highlighted-border {
border: 1px solid #6CD7CE;
}
.documentFileBoxImg {
width: 30px;
height: 30px;

View File

@@ -5,8 +5,17 @@
border: 1px solid #eb3434 !important;
}
.modal-dialog, .modal-content {
/*height: 420px;*/
.reasonReject {
color: #2d2d2d;
}
.w90 {
width: 90%;
}
.pdTitle {
width: 100%;
}
.pdHeaderTitle1 {
@@ -19,6 +28,10 @@
font-weight: 500;
}
/*.pdBox.justUploaded {
border: 1px solid #84cc16;
}*/
.pdBoxGrid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
@@ -27,13 +40,26 @@
gap: 9px;
}
.btn-cancel2 {
font-size: 14px;
font-weight: 500;
background-color: #454D5C;
color: #FFFFFF;
border-radius: 8px;
padding: 10px 70px;
}
.btn-cancel2:hover {
opacity: .7;
}
.pdBox {
background-color: #F8F8F8;
border-radius: 15px;
border: 1px solid #E7E7E7;
width: 100%;
position: relative;
display: inline-flex;
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px;
@@ -41,8 +67,10 @@
}
.pdBox.complete {
background-color: #D0FFF7;
border: 1px solid #2BBABA;
/* background-color: #D0FFF7;
border: 1px solid #2BBABA;*/
background-color: #ECFCCB;
border: 1px solid #84CC16;
}
.pdBox.discomplete {
@@ -50,6 +78,16 @@
border: 1px solid #FF5D5D;
}
.pdBox.pending {
/* background-color: #FCE7C9;
border: 1px solid #FDBA74;*/
background-color: #F8F8F8;
border: 1px solid #E7E7E7;
}
.pdImageBox {
background-color: #E6E6E6;
border-radius: 6px;
@@ -58,36 +96,38 @@
height: 60px;
text-align: center;
position: relative;
display: inline-flex;
display: flex;
justify-content: center;
align-items: center;
}
.pdImageBox .completeSign {
position: absolute;
top: -10px;
right: -10px;
}
.pdImageBox .completeSign {
position: absolute;
top: -10px;
right: -10px;
}
.pdImageBox .discompleteSign {
position: absolute;
top: -10px;
right: -10px;
}
.pdImageBox .discompleteSign {
position: absolute;
top: -10px;
right: -10px;
}
.pdImageBox .pendingSign {
position: absolute;
top: -10px;
right: -10px;
}
.pdImageBox img {
object-fit: cover;
object-position: center;
border-radius: 6px;
width: 100px;
height: 60px;
}
.pdImageBox img{
object-fit: cover;
object-position: center;
border-radius: 6px;
width: 100px;
height: 60px;
}
.pdTitle {
color: #000000;
font-weight: 500;
font-size: 16px;
}
.pdTitle span {
color: #FF5E5E;
@@ -95,11 +135,52 @@
font-size: 16px;
}
.resultMessage {
text-align: center;
width: 70px;
font-size: 12px;
font-weight: 800;
display: flex;
align-items: center;
justify-content: center;
}
.resultMessage div{
border-radius: 50px;
padding: 3px 0;
color: #fff;
width: 60px;
}
.resultMessage div.pendingMessage {
background-color: #FDBA74;
position: relative;
top: 20px;
}
.resultMessage div.confirmedMessage {
background-color: #84CC16;
position: relative;
top: 20px;
}
.resultMessage div.rejectMessage {
background-color: #FF7272;
position: relative;
top: 20px;
}
.pdTitle2 {
color: #000000;
font-weight: 400;
font-size: 13px;
width: 90%;
max-width: 80%;
word-wrap: break-word;
height: 40px;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}
.btnUploadingPD {
@@ -113,9 +194,9 @@
width: 80px;
}
.btnUploadingPD:hover {
background-color: #248E8E;
}
.btnUploadingPD:hover {
background-color: #248E8E;
}
.btnDeletingPD {
background-color: #c76161;
@@ -128,9 +209,9 @@
width: 80px;
}
.btnDeletingPD:hover {
background-color: #a54e4e;
}
.btnDeletingPD:hover {
background-color: #a54e4e;
}
.btnCreateNew {
font-size: 14px;
@@ -141,25 +222,15 @@
padding: 10px 70px;
}
.btnCreateNew:hover {
background-color: #5f9213;
}
.btnCreateNew:hover {
background-color: #5f9213;
}
.btnCreateNew,
.btn-cancel2 {
width: auto !important;
}
@media (max-width: 1366px) {
.pdTitle {
font-size: 15px;
}
.pdTitle2 {
font-size: 12px;
/*width: 290px;*/
}
}
@media (max-width: 992px) {
.pdBoxGrid {
@@ -174,16 +245,9 @@
height: 75vh;
}
.pdTitle {
font-size: 14px;
}
.pdTitle2 {
width: auto;
}
.pdBox
{
.pdBox {
padding: 9px;
}
@@ -192,10 +256,10 @@
height: 40px;
}
.pdImageBox img {
width: 70px;
height: 40px;
}
.pdImageBox img {
width: 70px;
height: 40px;
}
.btnUploadingPD,
.btnDeletingPD {
@@ -213,8 +277,25 @@
}
@media (max-width: 548px) {
@media (max-width: 576px) {
.pdTitle {
font-size: 12px;
}
}
.pdTitle2 {
font-weight: 300;
word-wrap: break-word;
font-size: 10px;
height: 32px;
}
.resultMessage div.rejectMessage {
top: 15px;
}
.resultMessage {
width: 50px;
font-size: 9px;
font-weight: 900;
}
}

View File

@@ -1,5 +1,6 @@
var pageIndexJs = 0;
var mode = 'all';
var pageIndex = 0;
var mode = 'active';
var searchName = '';
$(document).ready(function () {
@@ -11,10 +12,20 @@ $(document).ready(function () {
$(this).addClass('active');
$('.btn-clear-filter').addClass('disable');
pageIndexJs = 0;
pageIndex = 0;
$('#personnelDocumentsAjax').html('');
$('.employeeName').val('');
loadPersonnelDocuments(mode, searchName = '');
});
$('.documentFileBox').each(function () {
if ($(this).find('img.uploaded').length > 0) {
// Add the highlighted-border class to the documentFileBox
$(this).addClass('highlighted-border');
}
});
checkImage();
});
$(document).on('click', ".openAction", function () {
@@ -80,10 +91,9 @@ $(window).scroll(function () {
});
function loadPersonnelDocuments(mode, searchName) {
var b = pageIndexJs % 30;
var html = '';
var index = 1;
if (b === 0) {
$.ajax({
@@ -92,20 +102,19 @@ function loadPersonnelDocuments(mode, searchName) {
dataType: 'json',
type: 'GET',
url: employeeDocumentsAjaxLoadData,
data: { searchMode: mode, employeeName: searchName, 'pageIndex': pageIndexJs },
data: { searchMode: mode, employeeName: searchName, 'pageIndex': pageIndex },
headers: { "RequestVerificationToken": antiForgeryToken },
success: function (response) {
var personnelDocumentsData = response.data;
console.log(personnelDocumentsData);
if (response.isSuccedded) {
personnelDocumentsData.forEach(function (item) {
//foreach (var item in @Model.Employees.PersonnelInfoViewModels)
var n = pageIndexJs + 1;
html += `<div></div>
<div class="Rtable-row align-items-center openAction ${item.isBlack === "true"
? `withdraw`
: ``}" id="Employees">
<div class="Rtable-cell width1">
<div class="Rtable-cell width1" style="margin-left:3px; ">
<div class="Rtable-cell--content">
<span class="d-flex justify-content-center">
${n}
@@ -115,12 +124,11 @@ function loadPersonnelDocuments(mode, searchName) {
</div>
<div class="Rtable-cell width2">
<div class="Rtable-cell--content d-flex align-items-center justify-content-start">
<div class="documentFileBoxImg d-md-none d-block">`;
var employeePicturePath = `/Client/Company/EmployeesDocuments/Index?handler=ShowPicture&filePath=${item.employeePicturePath}`;
if (item.employeePicturePath) {
html += `<img src="${employeePicturePath}" class="preview-image">`;
<div class="documentFileBox d-md-none d-block" data-indexList="0">`;
if (item.employeePicture.picturePath && (item.employeePicture.statusString !== "unsubmitted" && item.employeePicture.statusString !== "rejected")) {
html += `<img id="employeePicture_${item.employeeId}" src="${showPictureUrl + `&filePath=` + (item.employeePicture.picturePath ? item.employeePicture.picturePath : "")}" class="preview-image uploaded">`;
} else {
html += `<img src="/assetsclient/images/pd-image.png" class="preview-image"/>`;
html += `<img id="employeePicture_${item.employeeId}" src="/assetsclient/images/pd-image.png" class="preview-image"/>`;
}
html += `</div>
<div class="text-start">${item.employeeFullName}</div>
@@ -128,69 +136,63 @@ function loadPersonnelDocuments(mode, searchName) {
</div>
<div class="Rtable-cell d-md-block d-none width3">
<div class="Rtable-cell--content d-flex align-items-center justify-content-center">
<div class="documentFileBox">`;
if (item.employeePicturePath) {
html += `<img src="${employeePicturePath}" class="preview-image">`;
<div class="documentFileBox" data-indexList="0">`;
if (item.employeePicture.picturePath && (item.employeePicture.statusString !== "unsubmitted" && item.employeePicture.statusString !== "rejected")) {
html += `<img id="employeePicture_${item.employeeId}" src="${showPictureUrl + `&filePath=` + (item.employeePicture.picturePath ? item.employeePicture.picturePath : "")}" class="preview-image uploaded">`;
} else {
html += `<img src="/assetsclient/images/pd-image.png" class="preview-image"/>`;
html += `<img id="employeePicture_${item.employeeId}" src="/assetsclient/images/pd-image.png" class="preview-image"/>`;
}
html += `</div>
</div>
</div>
<div class="Rtable-cell d-md-block d-none width4">
<div class="Rtable-cell--content d-flex align-items-center justify-content-center">`;
var nationalCardFrontPicturePath = `/Client/Company/EmployeesDocuments/Index?handler=ShowPicture&filePath=${item.nationalCardFrontPicturePath}`;
var nationalCardRearPicturePath = `/Client/Company/EmployeesDocuments/Index?handler=ShowPicture&filePath=${item.nationalCardRearPicturePath}`;
if (item.nationalCardFrontPicturePath) {
html += `<div class="documentFileBox"><img src="${nationalCardFrontPicturePath}" class="preview-image"></div>`;
if (item.nationalCardFront.picturePath && (item.nationalCardFront.statusString !== "unsubmitted" && item.nationalCardFront.statusString !== "rejected")) {
html += `<div class="documentFileBox" data-indexList="1"><img id="nationalCardFront_${item.employeeId}" src="${showPictureUrl + `&filePath=` + (item.nationalCardFront.picturePath ? item.nationalCardFront.picturePath : "")}" class="preview-image uploaded"></div>`;
} else {
html += `<div class="documentFileBox"><img src="/assetsclient/images/pd-image.png" class="preview-image"/></div>`;
html += `<div class="documentFileBox" data-indexList="1"><img id="nationalCardFront_${item.employeeId}" src="/assetsclient/images/pd-image.png" class="preview-image"/></div>`;
}
if (item.nationalCardRearPicturePath) {
html += `<div class="documentFileBox"><img src="${nationalCardRearPicturePath}" class="preview-image"></div>`;
if (item.nationalCardRear.picturePath && (item.nationalCardRear.statusString !== "unsubmitted" && item.nationalCardRear.statusString !== "rejected")) {
html += `<div class="documentFileBox" data-indexList="2"><img id="nationalCardRear_${item.employeeId}" src="${showPictureUrl + `&filePath=` + (item.nationalCardRear.picturePath ? item.nationalCardRear.picturePath : "")}" class="preview-image uploaded"></div>`;
} else {
html += `<div class="documentFileBox"><img src="/assetsclient/images/pd-image.png" class="preview-image"/></div>`;
html += `<div class="documentFileBox" data-indexList="2"><img id="nationalCardRear_${item.employeeId}" src="/assetsclient/images/pd-image.png" class="preview-image"/></div>`;
}
html += `</div>
</div>
<div class="Rtable-cell d-md-block d-none width5">
<div class="Rtable-cell--content d-flex align-items-center justify-content-center">
<div class="documentFileBox">`;
var militaryServiceCardPicturePath = `/Client/Company/EmployeesDocuments/Index?handler=ShowPicture&filePath=${item.militaryServiceCardPicturePath}`;
if (item.militaryServiceCardPicturePath) {
html += `<img src="${militaryServiceCardPicturePath}" class="preview-image">`;
<div class="documentFileBox" data-indexList="3">`;
if (item.militaryServiceCard.picturePath && (item.militaryServiceCard.statusString !== "unsubmitted" && item.militaryServiceCard.statusString !== "rejected")) {
html += `<img id="militaryServiceCard_${item.employeeId}" src="${showPictureUrl + `&filePath=` + (item.militaryServiceCard.picturePath ? item.militaryServiceCard.picturePath : "")}" class="preview-image uploaded">`;
} else {
html += `<img src="/assetsclient/images/pd-image.png" class="preview-image"/>`;
html += `<img id="militaryServiceCard_${item.employeeId}" src="/assetsclient/images/pd-image.png" class="preview-image"/>`;
}
html += `</div>
</div>
</div>
<div class="Rtable-cell d-md-block d-none width6">
<div class="Rtable-cell--content d-flex align-items-center justify-content-center">`;
var idCardPage1PicturePath = `/Client/Company/EmployeesDocuments/Index?handler=ShowPicture&filePath=${item.idCardPage1PicturePath}`;
var idCardPage2PicturePath = `/Client/Company/EmployeesDocuments/Index?handler=ShowPicture&filePath=${item.idCardPage2PicturePath}`;
var idCardPage3PicturePath = `/Client/Company/EmployeesDocuments/Index?handler=ShowPicture&filePath=${item.idCardPage3PicturePath}`;
var idCardPage4PicturePath = `/Client/Company/EmployeesDocuments/Index?handler=ShowPicture&filePath=${item.idCardPage4PicturePath}`;
if (item.idCardPage1PicturePath) {
html += `<div class="documentFileBox"><img src="${idCardPage1PicturePath}" class="preview-image"></div>`;
if (item.idCardPage1.picturePath && (item.idCardPage1.statusString !== "unsubmitted" && item.idCardPage1.statusString !== "rejected")) {
html += `<div class="documentFileBox" data-indexList="4"><img id="idCardPage1_${item.employeeId}" src="${showPictureUrl + `&filePath=` + (item.idCardPage1.picturePath ? item.idCardPage1.picturePath : "")}" class="preview-image uploaded"></div>`;
} else {
html += `<div class="documentFileBox"><img src="/assetsclient/images/pd-image.png" class="preview-image"/></div>`;
html += `<div class="documentFileBox" data-indexList="4"><img id="idCardPage1_${item.employeeId}" src="/assetsclient/images/pd-image.png" class="preview-image"/></div>`;
}
if (item.idCardPage2PicturePath) {
html += `<div class="documentFileBox"><img src="${idCardPage2PicturePath}" class="preview-image"></div>`;
if (item.idCardPage2.picturePath && (item.idCardPage2.statusString !== "unsubmitted" && item.idCardPage2.statusString !== "rejected")) {
html += `<div class="documentFileBox" data-indexList="5"><img id="idCardPage2_${item.employeeId}" src="${showPictureUrl + `&filePath=` + (item.idCardPage2.picturePath ? item.idCardPage2.picturePath : "")}" class="preview-image uploaded"></div>`;
} else {
html += `<div class="documentFileBox"><img src="/assetsclient/images/pd-image.png" class="preview-image"/></div>`;
html += `<div class="documentFileBox" data-indexList="5"><img id="idCardPage2_${item.employeeId}" src="/assetsclient/images/pd-image.png" class="preview-image"/></div>`;
}
if (item.idCardPage3PicturePath) {
html += `<div class="documentFileBox"><img src="${idCardPage3PicturePath}" class="preview-image"></div>`;
if (item.idCardPage3.picturePath && (item.idCardPage3.statusString !== "unsubmitted" && item.idCardPage3.statusString !== "rejected")) {
html += `<div class="documentFileBox" data-indexList="6"><img id="idCardPage3_${item.employeeId}" src="${showPictureUrl + `&filePath=` + (item.idCardPage3.picturePath ? item.idCardPage3.picturePath : "")}" class="preview-image uploaded"></div>`;
} else {
html += `<div class="documentFileBox"><img src="/assetsclient/images/pd-image.png" class="preview-image"/></div>`;
html += `<div class="documentFileBox" data-indexList="6"><img id="idCardPage3_${item.employeeId}" src="/assetsclient/images/pd-image.png" class="preview-image"/></div>`;
}
if (item.idCardPage4PicturePath) {
html += `<div class="documentFileBox"><img src="${idCardPage4PicturePath}" class="preview-image"></div>`;
if (item.idCardPage4.picturePath && (item.idCardPage4.statusString !== "unsubmitted" && item.idCardPage4.statusString !== "rejected")) {
html += `<div class="documentFileBox" data-indexList="7"><img id="idCardPage4_${item.employeeId}" src="${showPictureUrl + `&filePath=` + (item.idCardPage4.picturePath ? item.idCardPage4.picturePath : "")}" class="preview-image uploaded"></div>`;
} else {
html += `<div class="documentFileBox"><img src="/assetsclient/images/pd-image.png" class="preview-image"/></div>`;
html += `<div class="documentFileBox" data-indexList="7"><img id="idCardPage4_${item.employeeId}" src="/assetsclient/images/pd-image.png" class="preview-image"/></div>`;
}
html += `</div>
@@ -231,11 +233,11 @@ function loadPersonnelDocuments(mode, searchName) {
<div class="row g-2">
<div class="col-6 text-center">
<div class="d-flex align-items-center justify-content-start">
<div class="documentFileBoxImg">`;
if (item.employeePicturePath) {
html += `<img src="${employeePicturePath}" class="preview-image">`;
<div class="documentFileBox">`;
if (item.employeePicture.picturePath && (item.employeePicture.statusString !== "unsubmitted" && item.employeePicture.statusString !== "rejected")) {
html += `<img id="employeePicture_${item.employeeId}" src="${showPictureUrl + `&filePath=` + (item.employeePicture.picturePath ? item.employeePicture.picturePath : "")}" class="preview-image uploaded">`;
} else {
html += `<img src="/assetsclient/images/pd-image.png" class="preview-image"/>`;
html += `<img id="employeePicture_${item.employeeId}" src="/assetsclient/images/pd-image.png" class="preview-image"/>`;
}
html += `</div>
<div class="txtMonilePD">عکس پرسنلی</div>
@@ -243,11 +245,11 @@ function loadPersonnelDocuments(mode, searchName) {
</div>
<div class="col-6 text-center">
<div class="d-flex align-items-center justify-content-start">
<div class="documentFileBoxImg">`;
if (item.nationalCardFrontPicturePath) {
html += `<img src="${nationalCardFrontPicturePath}" class="preview-image">`;
<div class="documentFileBox">`;
if (item.nationalCardFront.picturePath && (item.nationalCardFront.statusString !== "unsubmitted" && item.nationalCardFront.statusString !== "rejected")) {
html += `<img id="nationalCardFront_${item.employeeId}" src="${showPictureUrl + `&filePath=` + (item.nationalCardFront.picturePath ? item.nationalCardFront.picturePath : "")}" class="preview-image uploaded">`;
} else {
html += `<img src="/assetsclient/images/pd-image.png" class="preview-image"/>`;
html += `<img id="nationalCardFront_${item.employeeId}" src="/assetsclient/images/pd-image.png" class="preview-image"/>`;
}
html += `</div>
<div class="txtMonilePD">کارت ملی رو</div>
@@ -255,11 +257,11 @@ function loadPersonnelDocuments(mode, searchName) {
</div>
<div class="col-6 text-center">
<div class="d-flex align-items-center justify-content-start">
<div class="documentFileBoxImg">`;
if (item.nationalCardRearPicturePath) {
html += `<div class="documentFileBox"><img src="${nationalCardRearPicturePath}" class="preview-image"></div>`;
<div class="documentFileBox">`;
if (item.nationalCardRear.picturePath && (item.nationalCardRear.statusString !== "unsubmitted" && item.nationalCardRear.statusString !== "rejected")) {
html += `<img id="nationalCardRear_${item.employeeId}" src="${showPictureUrl + `&filePath=` + (item.nationalCardRear.picturePath ? item.nationalCardRear.picturePath : "")}" class="preview-image uploaded">`;
} else {
html += `<div class="documentFileBox"><img src="/assetsclient/images/pd-image.png" class="preview-image"/></div>`;
html += `<img id="nationalCardRear_${item.employeeId}" src="/assetsclient/images/pd-image.png" class="preview-image"/>`;
}
html += `</div>
<div class="txtMonilePD">کارت ملی پشت</div>
@@ -267,11 +269,11 @@ function loadPersonnelDocuments(mode, searchName) {
</div>
<div class="col-6 text-center">
<div class="d-flex align-items-center justify-content-start">
<div class="documentFileBoxImg">`;
if (item.militaryServiceCardPicturePath) {
html += `<img src="${militaryServiceCardPicturePath}" class="preview-image">`;
<div class="documentFileBox">`;
if (item.militaryServiceCard.picturePath && (item.militaryServiceCard.statusString !== "unsubmitted" && item.militaryServiceCard.statusString !== "rejected")) {
html += `<img id="militaryServiceCard_${item.employeeId}" src="${showPictureUrl + `&filePath=` + (item.militaryServiceCard.picturePath ? item.militaryServiceCard.picturePath : "")}" class="preview-image uploaded">`;
} else {
html += `<img src="/assetsclient/images/pd-image.png" class="preview-image"/>`;
html += `<img id="militaryServiceCard_${item.employeeId}" src="/assetsclient/images/pd-image.png" class="preview-image"/>`;
}
html += `</div>
<div class="txtMonilePD">کارت پایان خدمت</div>
@@ -279,11 +281,11 @@ function loadPersonnelDocuments(mode, searchName) {
</div>
<div class="col-6 text-center">
<div class="d-flex align-items-center justify-content-start">
<div class="documentFileBoxImg">`;
if (item.idCardPage1PicturePath) {
html += `<div class="documentFileBox"><img src="${idCardPage1PicturePath}" class="preview-image"></div>`;
<div class="documentFileBox">`;
if (item.idCardPage1.picturePath && (item.idCardPage1.statusString !== "unsubmitted" && item.idCardPage1.statusString !== "rejected")) {
html += `<img id="idCardPage1_${item.employeeId}" src="${showPictureUrl + `&filePath=` + (item.idCardPage1.picturePath ? item.idCardPage1.picturePath : "")}" class="preview-image uploaded">`;
} else {
html += `<div class="documentFileBox"><img src="/assetsclient/images/pd-image.png" class="preview-image"/></div>`;
html += `<img id="idCardPage1_${item.employeeId}" src="/assetsclient/images/pd-image.png" class="preview-image"/>`;
}
html += `</div>
<div class="txtMonilePD">شناسنامه صفحه اول</div>
@@ -291,11 +293,11 @@ function loadPersonnelDocuments(mode, searchName) {
</div>
<div class="col-6 text-center">
<div class="d-flex align-items-center justify-content-start">
<div class="documentFileBoxImg">`;
if (item.idCardPage2PicturePath) {
html += `<div class="documentFileBox"><img src="${idCardPage2PicturePath}" class="preview-image"></div>`;
<div class="documentFileBox">`;
if (item.idCardPage2.picturePath && (item.idCardPage2.statusString !== "unsubmitted" && item.idCardPage2.statusString !== "rejected")) {
html += `<img id="idCardPage2_${item.employeeId}" src="${showPictureUrl + `&filePath=` + (item.idCardPage2.picturePath ? item.idCardPage2.picturePath : "")}" class="preview-image uploaded">`;
} else {
html += `<div class="documentFileBox"><img src="/assetsclient/images/pd-image.png" class="preview-image"/></div>`;
html += `<img id="idCardPage2_${item.employeeId}" src="/assetsclient/images/pd-image.png" class="preview-image"/>`;
}
html += `</div>
<div class="txtMonilePD">شناسنامه صفحه دوم</div>
@@ -303,11 +305,11 @@ function loadPersonnelDocuments(mode, searchName) {
</div>
<div class="col-6 text-center">
<div class="d-flex align-items-center justify-content-start">
<div class="documentFileBoxImg">`;
if (item.idCardPage3PicturePath) {
html += `<div class="documentFileBox"><img src="${idCardPage3PicturePath}" class="preview-image"></div>`;
<div class="documentFileBox">`;
if (item.idCardPage3.picturePath && (item.idCardPage3.statusString !== "unsubmitted" && item.idCardPage3.statusString !== "rejected")) {
html += `<img id="idCardPage3_${item.employeeId}" src="${showPictureUrl + `&filePath=` + (item.idCardPage3.picturePath ? item.idCardPage3.picturePath : "")}" class="preview-image uploaded">`;
} else {
html += `<div class="documentFileBox"><img src="/assetsclient/images/pd-image.png" class="preview-image"/></div>`;
html += `<img id="idCardPage3_${item.employeeId}" src="/assetsclient/images/pd-image.png" class="preview-image"/>`;
}
html += `</div>
<div class="txtMonilePD">شناسنامه صفحه سوم</div>
@@ -315,11 +317,11 @@ function loadPersonnelDocuments(mode, searchName) {
</div>
<div class="col-6 text-center">
<div class="d-flex align-items-center justify-content-start">
<div class="documentFileBoxImg">`;
if (item.idCardPage4PicturePath) {
html += `<div class="documentFileBox"><img src="${idCardPage4PicturePath}" class="preview-image"></div>`;
<div class="documentFileBox">`;
if (item.idCardPage4.picturePath && (item.idCardPage4.statusString !== "unsubmitted" && item.idCardPage4.statusString !== "rejected")) {
html += `<img id="idCardPage4_${item.employeeId}" src="${showPictureUrl + `&filePath=` + (item.idCardPage4.picturePath ? item.idCardPage4.picturePath : "")}" class="preview-image uploaded">`;
} else {
html += `<div class="documentFileBox"><img src="/assetsclient/images/pd-image.png" class="preview-image"/></div>`;
html += `<img id="idCardPage4_${item.employeeId}" src="/assetsclient/images/pd-image.png" class="preview-image"/>`;
}
html += `</div>
<div class="txtMonilePD">شناسنامه صفحه چهارم</div>
@@ -342,12 +344,11 @@ function loadPersonnelDocuments(mode, searchName) {
</div>
</div>
</div>`;
pageIndexJs++;
});
pageIndexJs = response.pageIndex;
pageIndexJs = pageIndex + response.pageIndex;
pageIndex = pageIndexJs;
$('#personnelDocumentsAjax').append(html);
} else {
html += `<div class="text-center bg-white d-flex align-items-center justify-content-center">
@@ -359,6 +360,7 @@ function loadPersonnelDocuments(mode, searchName) {
$('#personnelDocumentsAjax').append(html);
}
checkImage();
},
failure: function (response) {
@@ -371,4 +373,13 @@ function loadPersonnelDocuments(mode, searchName) {
function openPersonnelDocsUploadModal(id) {
var goTo = `#showmodal=/Client/Company/EmployeesDocuments/Index?employeeId=${id}&handler=CreateUploadDocument`;
window.location.href = goTo;
}
function checkImage() {
$('.documentFileBox').each(function () {
if ($(this).find('img.uploaded').length > 0) {
// Add the highlighted-border class to the documentFileBox
$(this).addClass('highlighted-border');
}
});
}

View File

@@ -1,17 +1,93 @@
$(document).ready(function () {
var employeePicture;
var nationalCardFront;
var nationalCardRear;
var militaryServiceCard;
var idCardPage1;
var idCardPage2;
var idCardPage3;
var idCardPage4;
var uploadFileCount = UploadedCount;
var pendingMessage = `<div class="pendingMessage">بررسی</div>`;
var pendingIcon = `<svg width="24" height="24" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M11 19.25C15.5563 19.25 19.25 15.5563 19.25 11C19.25 6.44365 15.5563 2.75 11 2.75C6.44365 2.75 2.75 6.44365 2.75 11C2.75 15.5563 6.44365 19.25 11 19.25Z" fill="#FDBA74"/>
<path d="M11.4168 14.6667C11.4168 14.8968 11.2303 15.0833 11.0002 15.0833C10.77 15.0833 10.5835 14.8968 10.5835 14.6667C10.5835 14.4365 10.77 14.25 11.0002 14.25C11.2303 14.25 11.4168 14.4365 11.4168 14.6667Z" fill="white" stroke="white"/>
<path d="M11 11.916V6.41602V11.916Z" fill="white"/>
<path d="M11 11.916V6.41602" stroke="white" stroke-width="1.5" stroke-linecap="round"/>
</svg>`;
var confirmMessage = `<div class="confirmedMessage">تایید</div>`;
var confirmIcon = `<svg width="24" height="24" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="7" cy="7" r="5.25" fill="#00C04D"/>
<path d="M4.66659 7L6.41659 8.75L9.33325 5.25" stroke="white" stroke-linecap="round"/>
</svg>`;
var rejectMessage = `<div class="rejectMessage">رد شده</div>`;
var rejectIcon = `<svg width="24" height="24" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="7" cy="7" r="5.25" fill="#FF5D5D"/>
<path d="M9.33341 4.66602L4.66675 9.33268" stroke="white" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M4.66659 4.66602L9.33325 9.33268" stroke="white" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>`;
$(document).ready(function () {
var employeeId = $("#employeeIdForList").val();
//$('.btnDeletingPD').each(function () {
// if ($(this).hasClass('Unsubmitted')) { // Remove the extra class selector '.btnDeletingPD'
// $(this).closest('.pdBox').addClass('justUploaded'); // Add 'justUploaded' to the closest parent .pdBox
// }
//});
$(document).off('click', '.btnUploadingPD').on('click', '.btnUploadingPD', function (event) {
event.preventDefault();
const index = $(this).data('index');
console.log("Button clicked for index:", index);
$('input[type="file"][data-index="' + index + '"]').click();
});
$(".btnDeletingPD ").each(function () {
if ($(this).hasClass("SubmittedByAdmin") || $(this).hasClass("SubmittedByClient") || $(this).hasClass("Rejected") || $(this).hasClass("Confirmed")) {
$(this).addClass("disable");
} else {
return;
}
});
$('.pdBox').each(function () {
if ($(".isTrue").hasClass("isTrue") && $(".Unsubmitted").hasClass("Unsubmitted")) {
$(".btnCreateNew").prop("disabled", false);
$(".btnCreateNew ").removeClass("disable");
} else {
$(".btnCreateNew ").addClass("disable");
}
});
$('.pdBox').each(function () {
// Check if there's a button with the 'submitted' class inside the pdBox
if ($(this).find('button.SubmittedByAdmin').length > 0 || $(this).find('button.SubmittedByClient').length > 0 ) {
$(this).addClass('pending');
$(this).find(".pdImageBox .sign").addClass("pendingSign").html(pendingIcon);
$(this).find(".btnUploadingPD").addClass("disable");
$(this).find(".resultMessage").html(pendingMessage);
}
if ($(this).find('button.Confirmed').length > 0) {
$(this).addClass('complete');
$(this).find(".pdImageBox .sign").addClass("completeSign").html(confirmIcon);
$(this).find(".resultMessage").html(confirmMessage);
}
if ($(this).find('button.Rejected').length > 0) {
$(this).addClass('discomplete');
$(this).find(".pdImageBox .sign").addClass("discompleteSign").html(rejectIcon);
$(this).find(".resultMessage").html(rejectMessage);
}
});
$(document).off('change', '.file-input').on('change', '.file-input', function (e) {
e.preventDefault();
const fileInputFile = this.files[0];
const indexFileValue = $(this).data('index');
const validExtensions = ['jpg', 'jpeg', 'png'];
const validPdfExtensions = ['pdf'];
const label = $(`#label_${indexFileValue}`).val();
@@ -26,6 +102,53 @@
return;
}
uploadFile(fileInputFile, indexFileValue, label);
} else if (validPdfExtensions.includes(extension)) {
var fileReader = new FileReader();
fileReader.onload = function () {
var typedarray = new Uint8Array(this.result);
pdfjsLib.getDocument(typedarray).promise.then(function (pdf) {
totalPageCount = pdf.numPages;
if (totalPageCount > 1) {
showAlertMessage('.alert-msg', 'آپلود مجاز نیست! تعداد صفحات نباید بیشتر از ۱ باشد.', 3500);
return;
}
pdf.getPage(1).then(function (page) { // فقط صفحه اول پردازش می‌شود
var scale = 2.0;
var viewport = page.getViewport({ scale: scale });
var canvas = document.createElement("canvas");
canvas.className = "page";
canvas.title = "Page 1";
canvas.height = viewport.height;
canvas.width = viewport.width;
var context = canvas.getContext("2d");
page.render({
canvasContext: context,
viewport: viewport
})
.promise.then(function () {
uploadCanvasAsFile(canvas, `${label}_${indexFileValue}.jpg`, indexFileValue, label);
})
.catch(function (error) {
showAlertMessage('.alert-msg', 'مشکلی در پردازش PDF رخ داده است!', 3500);
});
}).catch(function (error) {
showAlertMessage('.alert-msg', 'خطا در دریافت صفحه PDF!', 3500);
});
}).catch(function (error) {
showAlertMessage('.alert-msg', 'خطا در بارگذاری فایل PDF!', 3500);
});
};
fileReader.readAsArrayBuffer(fileInputFile);
} else {
showAlertMessage('.alert-msg', 'فرمت فایل باید یکی از موارد jpeg, jpg یا png باشد.', 3500);
}
@@ -47,7 +170,7 @@
reverseButtons: true
}).then((result) => {
if (result.isConfirmed) {
deleteFile(indexId);
removeEmployeeDocumentByLabel(indexId, employeeId);
const pdBox = $('input[data-index="' + indexId + '"]').closest('.pdBox');
const img = pdBox.find('.preview-image');
img.attr('src', '/assetsclient/images/pd-image.png');
@@ -59,8 +182,60 @@
});
$(".exitModal").click(function () {
if (uploadFileCount > 0) {
swal.fire({
title: "اخطار",
text: "در صورت انصراف عملیات ثبت نخواهد شد!",
icon: "warning",
showCancelButton: true,
confirmButtonText: "بله",
cancelButtonText: "خیر",
confirmButtonColor: '#84cc16',
reverseButtons: true
}).then((result) => {
if (result.isConfirmed) {
cancelOperation();
}
});
} else {
$('#MainModal').modal('hide');
}
});
});
function cancelOperation() {
$.ajax({
url: cancelOperationUrl,
method: 'POST',
data: { employeeId: employeeId },
headers: { 'RequestVerificationToken': antiForgeryToken },
success: function (response) {
if (response.success) {
$('#MainModal').modal('hide');
} else {
showAlertMessage('.alert-success-msg', response.message, 3500);
}
},
error: function (response) {
showAlertMessage('.alert-msg', response.message, 3500);
}
});
}
function uploadCanvasAsFile(canvas, fileName, indexFileValue, label) {
canvas.toBlob(function (blob) {
if (!blob) {
showAlertMessage('.alert-msg', 'مشکلی در تبدیل تصویر رخ داده است!', 3500);
return;
}
let file = new File([blob], fileName, { type: 'image/png' });
uploadFile(file, indexFileValue, label);
}, "image/png");
}
var indexCount = 0;
var activeUploads = 0;
@@ -72,6 +247,7 @@ function uploadFile(file, indexId, label) {
const pdBox = $('input[data-index="' + indexId + '"]').closest('.pdBox');
const spinner = pdBox.find('.spinner-loading-progress');
const percentageText = pdBox.find('.percentageText');
spinner.show();
@@ -133,16 +309,35 @@ function uploadFile(file, indexId, label) {
spinner.css('width', '100%');
percentageText.text('100%');
var id2 = $("#employeeIdForList").val();
if (xhr.status === 200 && response.isSuccedded) {
indexCount++;
const reader = new FileReader();
reader.onload = function (e) {
uploadFileCount = uploadFileCount + 1;
const pdBox = $('input[data-index="' + indexId + '"]').closest('.pdBox');
const img = pdBox.find('.preview-image');
img.attr('src', e.target.result);
};
pdBox.find('.btnDeletingPD').removeClass('disable');
//updatePreviewImage(indexId, id2, e.target.result);
};
if (pdBox.hasClass("complete") || pdBox.hasClass("discomplete")) {
pdBox.removeClass("discomplete complete");
pdBox.find(".sign").removeClass("discompleteSign completeSign");
pdBox.find(".sign").empty();
pdBox.find(".btnDeletingPD").removeClass("Rejected Confirmed");
pdBox.find("confirmedMessage ").remove();
pdBox.find(".resultMessage").empty();
}
pdBox.find('.btnDeletingPD').removeClass('disable').addClass("Unsubmitted");
reader.readAsDataURL(file);
} else {
showAlertMessage('.alert-msg', response.message || 'Error uploading file', 3500);
@@ -184,24 +379,135 @@ function showAlertMessage(selector, message, timeout) {
}, timeout);
}
function deleteFile(indexId) {
function removeEmployeeDocumentByLabel(indexId, employeeId) {
const label = $(`#label_${indexId}`).val();
const pdBox = $('input[data-index="' + indexId + '"]').closest('.pdBox');
$.ajax({
url: deleteFileAjaxUrl,
method: 'POST',
data: { label: label, employeeId: employeeId },
data: { label: label, employeeId: employeeId},
headers: { 'RequestVerificationToken': antiForgeryToken },
success: function (response) {
if (response.isSuccedded) {
showAlertMessage('.alert-msg', 'تصویر موجود با موفقیت حذف شد.', 3500);
label.val('');
uploadFileCount = uploadFileCount - 1;
showAlertMessage('.alert-success-msg', 'تصویر موجود با موفقیت حذف شد.', 3500);
$(`#label_${indexId}`).val('');
pdBox.find('.btnDeletingPD').removeClass("Unsubmitted");
updatePreviewImage(Number(indexId), Number(employeeId), "/assetsclient/images/pd-image.png");
} else {
showAlertMessage('.alert-msg', 'مشکلی در حذف تصویر به وجود آمد.', 3500);
showAlertMessage('.alert-success-msg', response.message, 3500);
}
},
error: function (response) {
showAlertMessage('.alert-msg', response.message, 3500);
}
});
}
function updatePreviewImage(indexId, id2, result) {
switch (indexId) {
case 0:
$(`#employeePicture_${id2}.preview-image`).attr('src', result);
break;
case 1:
$(`#nationalCardFront_${id2}.preview-image`).attr('src', result);
break;
case 2:
$(`#nationalCardRear_${id2}.preview-image`).attr('src', result);
break;
case 3:
$(`#militaryServiceCard_${id2}.preview-image`).attr('src', result);
break;
case 4:
$(`#idCardPage1_${id2}.preview-image`).attr('src', result);
break;
case 5:
$(`#idCardPage2_${id2}.preview-image`).attr('src', result);
break;
case 6:
$(`#idCardPage3_${id2}.preview-image`).attr('src', result);
break;
case 7:
$(`#idCardPage4_${id2}.preview-image`).attr('src', result);
break;
default:
console.warn('Unexpected indexId:', indexId);
}
}
function saveSubmit(id) {
var loading = $(".spinner-loading");
loading.show();
var data = {
'cmd.EmployeeDocumentsId': id
}
$.ajax({
url: saveSubmitAjax,
method: 'POST',
data: data,
headers: { 'RequestVerificationToken': antiForgeryToken },
success: function (response) {
loading.hide();
if (response.isSuccedded) {
var id2 = $("#employeeIdForList").val();
$(".pdBox").each(function () {
var indexId = $(this).find('.btnUploadingPD').data('index');
var imgSrc = $(this).find('.preview-image').attr("src");
updatePreviewImage(indexId, id2, imgSrc);
});
showAlertMessage('.alert-success-msg', 'تصویر موجود با موفقیت ارسال شد.', 3500);
$('#MainModal').modal('hide');
} else {
showAlertMessage('.alert-msg', response.message, 3500);
}
},
error: function () {
showAlertMessage('.alert-msg', 'مشکلی در حذف تصویر به وجود آمد.', 3500);
loading.hide();
showAlertMessage('.alert-msg', 'مشکلی در ارسال تصویر به وجود آمد.', 3500);
}
});
}
}
function cancelOP() {
var data = {
'cmd.EmployeeDocumentsId': id
}
$.ajax({
url: saveSubmitAjax,
method: 'POST',
data: {employeeId:employeeId,},
headers: { 'RequestVerificationToken': antiForgeryToken },
success: function (response) {
loading.hide();
$('#MainModal').modal('hide');
if (response.isSuccedded) {
showAlertMessage('.alert-success-msg', 'تصویر موجود با موفقیت ارسال شد.', 3500);
} else {
showAlertMessage('.alert-msg', response.message, 3500);
}
},
error: function () {
loading.hide();
showAlertMessage('.alert-msg', 'مشکلی در ارسال تصویر به وجود آمد.', 3500);
}
});
}