Merge branch 'master' into Main

# Conflicts:
#	ServiceHost/Program.cs
#	ServiceHost/Properties/launchSettings.json
This commit is contained in:
2025-12-15 09:48:06 +03:30
18 changed files with 2856 additions and 2522 deletions

View File

@@ -33,4 +33,9 @@ public enum TypeOfSmsSetting
/// </summary>
LegalAction,
/// <summary>
/// پیامک تایید قراداد
/// </summary>
InstitutionContractConfirm,
}

View File

@@ -11,6 +11,7 @@
var j = 1;
var r = 1;
var permissionList = _AuthHelper.GetPermissions();
string adminVersion = _0_Framework.Application.Version.AdminVersion;
//string colaps = "in";
//string act = "active";
}
@@ -552,250 +553,20 @@
<script src="~/AdminTheme/assets/js/site.js"></script>
<script src="~/adminTheme/assets/datatables/jquery.dataTables.min.js"></script>
<script src="~/adminTheme/assets/datatables/dataTables.bootstrap.js"></script>
<script src="~/js/signalr/dist/browser/signalr.js"></script>
@* <script src="~/js/signalr/dist/browser/signalr.js"></script> *@
<script src="~/lib/select2/js/select2.js"></script>
<script src="~/lib/select2/js/i18n/fa.js"></script>
<script>
$(document).ready(function () {
$(".select-city").select2({
language: "fa",
dir: "rtl"
});
})
var antiforgeryToken = $('@Html.AntiForgeryToken()').val();
var directLoginUrl = '@Url.Page("./Index", "LoginToClient")';
var deActiveAjaxUrl = '@Url.Page("./Index", "DeActive")';
var activeAjaxUrl = '@Url.Page("./Index", "Active")';
</script>
<script>
$(document).ready(function() {
$('#datatable').dataTable({
"lengthMenu": [[25, 10, 50, 100, -1], [25, 10, 50, 100, "All"]]
});
<script src="~/assetsadmin/page/account/js/index.js?ver=@adminVersion"></script>
});
function directLogin(id) {
$.ajax({
async: false,
dataType: 'json',
type: 'POST',
url: '@Url.Page("./Index", "LoginToClient")',
headers: { "RequestVerificationToken": $('@Html.AntiForgeryToken()').val() },
data: { "id": id },
success: function (response) {
if (response.isSuccess) {
window.location.href = "/Client";
} else {
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', "خطا در ورود به اکانت");
}
}
});
}
</script>
<script>
$(document).ready(function() {
$('#datatable2').dataTable(
{
"lengthMenu": [[25, 10, 50, 100, -1], [25, 10, 50, 100, "All"]]
});
});
</script>
<script>
$(document).ready(function() {
$('#datatable3').dataTable(
{
"lengthMenu": [[25, 10, 50, 100, -1], [25, 10, 50, 100, "All"]]
});
});
</script>
<script>
$("#myTab a").click(function(e) {
e.preventDefault();
$(this).tab('show');
});
$("#myTab2 a").click(function(e) {
e.preventDefault();
$(this).tab('show');
});
$("#myTab3 a").click(function(e) {
e.preventDefault();
$(this).tab('show');
});
// store the currently selected tab in the hash value
$("ul.nav-tabs > li > a").on("shown.bs.tab",
function(e) {
var id = $(e.target).attr("href").substr(1);
window.location.hash = id;
});
// on load of the page: switch to the currently selected tab
var hash = window.location.hash;
$('#myTab a[href="' + hash + '"]').tab('show', 'active');
var hash2 = window.location.hash;
$('#myTab2 a[href="' + hash2 + '"]').tab('show', 'active');
var hash2 = window.location.hash;
$('#myTab2 a[href="' + hash2 + '"]').tab('show', 'active');
$('.activer').on('change',
function(e) {
e.preventDefault();
$('.search').click();
});
function deActive(id, accountName) {
let alarm = 'آیا از غیرفعال کردن ' + accountName + ' اطمینان دارید؟ ' + ' ';
swal({
title: alarm,
text: "",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "بله",
cancelButtonText: "خیر",
closeOnConfirm: true,
closeOnCancel: true
},
function(isConfirm) {
if (isConfirm) {
deActiveAjax(id);
}
});
}
function deActiveAjax(id) {
$('.sweet-alert').removeClass("successSwall");
$('.sweet-alert').removeClass("errorSwall");
$.ajax({
async: false,
dataType: 'json',
type: 'GET',
url: '@Url.Page("./Index", "DeActive")',
headers: { "RequestVerificationToken": $('@Html.AntiForgeryToken()').val() },
data: { "id": id },
success: function(response) {
if (response.isSuccedded) {
window.location.reload();
}
}
});
}
function Active(id, accountName) {
let alarm = 'آیا از غیرفعال کردن ' + accountName + ' اطمینان دارید؟ ' + ' ';
swal({
title: alarm,
text: "",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "بله",
cancelButtonText: "خیر",
closeOnConfirm: true,
closeOnCancel: true
},
function(isConfirm) {
if (isConfirm) {
ActiveAjax(id);
}
});
}
function ActiveAjax(id) {
$('.sweet-alert').removeClass("successSwall");
$('.sweet-alert').removeClass("errorSwall");
$.ajax({
async: false,
dataType: 'json',
type: 'GET',
url: '@Url.Page("./Index", "Active")',
headers: { "RequestVerificationToken": $('@Html.AntiForgeryToken()').val() },
data: { "id": id },
success: function(response) {
if (response.isSuccedded) {
window.location.reload();
}
}
});
}
</script>
<script>
$(document).ready(function() {
var currentUser = Number($('#userID').val());
console.log(currentUser);
setTimeout(function() {
connectToGroup(currentUser);
},
2000);
});
var connection = new signalR.HubConnectionBuilder().withUrl("/trackingSmsHub").build();
connection.start().then(function() {
console.log("connect.....!");
}).catch(function(err) {
return console.error(err.toString());
});
function connectToGroup(id) {
connection.invoke("send", id)
.catch(function(err) {
console.error(err.toString());
});
console.log("connected to group..." + id);
}
connection.on('showStatus',
function(percent) {
$('#progress-bar-w').css("width", percent + "%");
$('#progress-bar-w').text(percent + '%');
});
$("#sendSms").on("click",
function() {
$('#createProcess').show();
$.ajax({
// async: false,
dataType: 'json',
type: 'GET',
url: '@Url.Page("./Index", "SendAccountSms")',
headers: { "RequestVerificationToken": $('@Html.AntiForgeryToken()').val() },
success: function(response) {
if (response.isSuccess) {
$('#createProcess').hide();
} else {
let mess ="خطا" + " : " + "تعداد" + "("+ response.contractCount + ")" + "مورد انجام نشد";
$("#errSend").append(`<p class="text-danger">${mess}</p>`);
}
}
});
});
</script>
}

File diff suppressed because it is too large Load Diff

View File

@@ -3,10 +3,15 @@
@Html.AntiForgeryToken()
@{
string adminVersion = _0_Framework.Application.Version.AdminVersion;
<link href="~/admintheme/css/workshop-create.css?ver=@adminVersion" rel="stylesheet" />
<link href="~/admintheme/page/SmsSettings/css/SmsSettings.css?ver=@adminVersion" rel="stylesheet" />
var adminVersion = _0_Framework.Application.Version.AdminVersion;
@section Styles {
<link href="~/admintheme/css/workshop-create.css?ver=@adminVersion" rel="stylesheet" />
<link href="~/AssetsAdmin/page/SmsSettings/css/SmsSettings.css?ver=@adminVersion" rel="stylesheet" />
}
}
<div class="container">
@@ -46,7 +51,7 @@
<span> پیامک مسدودی </span>
</a>
</li>
<li class="li-wizard step" id="warningTab" data-url="/Admin/Company/SmsResult/SmsSettings?handler=WarningTab">
<a class="nav-link">
@@ -58,7 +63,7 @@
<span> پیامک هشدار برای اقدام قضائی </span>
</a>
</li>
<li class="li-wizard step" id="legalActionTab" data-url="/Admin/Company/SmsResult/SmsSettings?handler=LegalActionTab">
<a class="nav-link">
<div class="success-icon" id="success-icon2" style="display:none;">
@@ -69,12 +74,23 @@
<span> پیامک اقدام قضائی </span>
</a>
</li>
<li class="li-wizard step" id="institutionContractConfirmTab" data-url="/Admin/Company/SmsResult/SmsSettings?handler=InstitutionContractConfirmTab">
<a class="nav-link">
<div class="success-icon" id="success-icon2" style="display:none;">
<svg width="11" height="8" viewBox="0 0 11 8" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M1.25 4L4.14393 6.89393C4.20251 6.95251 4.29749 6.95251 4.35607 6.89393L10.25 1" stroke="#222222" stroke-width="1.2" />
</svg>
</div>
<span> پیامک تایید قرارداد مالی </span>
</a>
</li>
</ul>
</div>
<div class="partial-tabs" id="partialContainer"></div>
@@ -96,7 +112,10 @@
var urlAjaxToRemove = '@Url.Page("/Company/SmsResult/SmsSettings", "RemoveSetting")';
var antiforgeryToken = $('@Html.AntiForgeryToken()').val();
</script>
<script src="~/AssetsAdmin/page/SmsSettings/js/SmsSettings.js?ver=@adminVersion"></script>
}

View File

@@ -236,7 +236,18 @@ namespace ServiceHost.Areas.Admin.Pages.Company.SmsResult
{
var modelData = await _smsSettingApplication.GetSmsSettingsByType(TypeOfSmsSetting.Warning);
return Partial("_SmsSettingPartials/WarningSmsListData", modelData);
}
}
/// <summary>
/// تب پیامک هشدار قضایی
/// </summary>
/// <returns></returns>
public async Task<IActionResult> OnGetInstitutionContractConfirmTab()
{
var modelData = await _smsSettingApplication.GetSmsSettingsByType(TypeOfSmsSetting.InstitutionContractConfirm);
return Partial("_SmsSettingPartials/InstitutionContractConfirmData", modelData);
}
#endregion
}

View File

@@ -0,0 +1,155 @@
@using _0_Framework.Application.Enums
@model CompanyManagment.App.Contracts.SmsResult.SmsSettingViewModel
@{
int index = 1;
<style>
.head-table{
font-size: 14px;
background-color: #2dbcbc;
padding: 4px 1px;
border-radius: 5px;
color: aliceblue;
margin-bottom: 9px;
}
.tr-table{
background-color: #ddf4f4;
border-radius: 5px;
padding: 4px 1px;
margin-bottom: 3px;
font-family: "IranText" !important;
}
div.tr-table:nth-of-type(even) {
background-color: #b0e0e08f !important;
}
.row-number{
background-color: rgb(187, 240, 240);
color: #0B5959;
width: 24px;
height: 24px;
line-height: 24px;
text-align: center;
border-radius: 5px;
}
.icon-span {
display: inline-block;
text-align: center;
vertical-align: middle;
line-height: 14px;
border-radius: 5px;
padding: 2px;
}
.icon-span svg {
vertical-align: middle;
}
</style>
}
<div class="card card-pattern m-t-10">
<a class="btn btn-success"
style="border-radius:5px;" href="#showmodal=@Url.Page("./SmsSettings", "CreateSmsSetting", new { typeOfSmsSetting = TypeOfSmsSetting.InstitutionContractConfirm })">
<span class="icon-span">
<svg width="19" height="19" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="11" cy="11" r="8.25" stroke="white" />
<path d="M11 13.75L11 8.25" stroke="white" stroke-linecap="round" />
<path d="M13.75 11L8.25 11" stroke="white" stroke-linecap="round" />
</svg>
<span style="margin-right:4px"> ایجاد پیامک تایید قرارداد </span>
</span>
</a>
@* <a class="btn btn-success instantSendSms"
style="border-radius:5px;" href="#showmodal=@Url.Page("./SmsSettings", "InstantSendSms", new { typeOfSmsSetting = TypeOfSmsSetting.InstitutionContractDebtReminder })">
<span class="icon-span">
<svg width="20px" height="20px" viewBox="-11.26 -11.26 49.32 49.32" xmlns="http://www.w3.org/2000/svg" fill="#000000" transform="matrix(-1, 0, 0, 1, 0, 0)rotate(0)" stroke="#000000" stroke-width="0.00026804">
<g id="SVGRepo_bgCarrier" stroke-width="0"></g>
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round" stroke="#CCCCCC" stroke-width="0.053608"></g>
<g id="SVGRepo_iconCarrier">
<g id="Group_37" data-name="Group 37" transform="translate(-108.142 -942.014)">
<path id="Path_17" data-name="Path 17" d="M109.642,968.818a1.5,1.5,0,0,1-1.5-1.5v-23.8a1.5,1.5,0,0,1,2.25-1.3l20.616,11.9a1.5,1.5,0,0,1,0,2.6l-20.616,11.9A1.5,1.5,0,0,1,109.642,968.818Zm1.5-22.707V964.72l16.116-9.3Z" fill="#ffffff"></path>
</g>
</g>
</svg>
<span style="margin-right:4px"> ارسال آنی پیامک یاد آور </span>
</span>
</a> *@
</div>
<div class="card card-pattern m-t-10">
@if (Model.EditSmsSettings.Any())
{
<div class="container-fluid">
<!-- هدر -->
<div class="row fw-bold mb-2 head-table">
<div class="col-2 col-md-1">ردیف</div>
<div class="col-10 col-md-3"> روز ارسال </div>
<div class="col-6 col-md-2"> ساعت ارسال </div>
<div class="col-12 col-md-3" style="float:left; direction:ltr">عملیات</div>
</div>
<!-- لیست -->
@foreach (var item in Model.EditSmsSettings)
{
<div class="row align-items-center p-2 tr-table">
<div class="col-2 col-md-1"><div class="row-number">@index</div></div>
<div class="col-10 col-md-3">@item.DayOfMonth</div>
<div class="col-6 col-md-2">@item.TimeOfDayDisplay</div>
@{
index++;
}
<div class="col-12 col-md-3 align-items-center" style="float:left; direction:ltr">
<a href="#" onclick="remove(@item.Id);"
style="border-radius:5px;" return false;>
<span class="icon-span" style="background-color:#ddd3e0">
<svg width="19" height="18" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="18.5047" height="18.5047" transform="translate(0.523438 0.523438)" fill="#DDD3E0"></rect>
<path d="M7.84814 11.7031L7.84814 9.39004" stroke="#BF3737" stroke-linecap="round"></path>
<path d="M11.7031 11.7031L11.7031 9.39004" stroke="#BF3737" stroke-linecap="round"></path>
<path d="M2.83643 5.53125H16.7149V5.53125C16.0652 5.53125 15.7403 5.53125 15.4745 5.60604C14.8039 5.79477 14.2799 6.31884 14.0911 6.98943C14.0163 7.25518 14.0163 7.58007 14.0163 8.22985V11.5546C14.0163 13.4402 14.0163 14.383 13.4305 14.9688C12.8448 15.5546 11.902 15.5546 10.0163 15.5546H9.53502C7.64941 15.5546 6.7066 15.5546 6.12081 14.9688C5.53502 14.383 5.53502 13.4402 5.53502 11.5546V8.22985C5.53502 7.58007 5.53502 7.25518 5.46023 6.98943C5.27151 6.31884 4.74744 5.79477 4.07685 5.60604C3.8111 5.53125 3.48621 5.53125 2.83643 5.53125V5.53125Z" stroke="#BF3737" stroke-linecap="round"></path>
<path d="M7.84799 3.22434C7.84799 3.22434 8.2335 2.45312 9.77556 2.45312C11.3176 2.45312 11.7031 3.22415 11.7031 3.22415" stroke="#BF3737" stroke-linecap="round"></path>
</svg>
</span>
</a>
<a href="#showmodal=@Url.Page("./SmsSettings", "EditSmsSettings", new { id = item.Id, typeOfSmsSetting = item.TypeOfSmsSetting })">
<span class="icon-span" style="background-color:#ade7f2">
<svg width="19" height="18" viewBox="0 0 19 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="18.5047" height="18.5047" transform="translate(0.074707 0.679688)" fill="#ADE7F2"></rect>
<path d="M11.3213 5.25293C11.5664 5.19964 11.8217 5.20913 12.0635 5.28027L12.2178 5.33691C12.3659 5.40344 12.4945 5.49613 12.6152 5.59766C12.7711 5.72874 12.9467 5.90375 13.1504 6.10742L13.4326 6.39258C13.5184 6.48132 13.5946 6.56459 13.6602 6.64258C13.7953 6.80336 13.914 6.97832 13.9775 7.19434L14.0049 7.29883C14.0506 7.50888 14.0506 7.72647 14.0049 7.93652L13.9775 8.04102C13.914 8.25701 13.7953 8.43201 13.6602 8.59277C13.5946 8.67073 13.5184 8.75407 13.4326 8.84277L13.1504 9.12793L7.75879 14.5186C7.62672 14.6506 7.50929 14.7722 7.37793 14.8701L7.24121 14.959C7.14574 15.013 7.04539 15.0527 6.93848 15.0859L6.59766 15.1768L4.85938 15.6113C4.69519 15.6524 4.51668 15.6984 4.36816 15.7129C4.23271 15.7261 4.01567 15.7249 3.82324 15.584L3.74316 15.5146C3.53379 15.3053 3.52979 15.0444 3.54492 14.8896C3.55945 14.7411 3.60544 14.5626 3.64648 14.3984L4.08105 12.6602L4.17188 12.3193C4.20508 12.2124 4.24479 12.1121 4.29883 12.0166L4.3877 11.8799C4.48563 11.7485 4.60719 11.6311 4.73926 11.499L10.1299 6.10742L10.415 5.8252C10.5036 5.7396 10.5862 5.66312 10.6641 5.59766C10.8249 5.46245 11.0007 5.34385 11.2168 5.28027L11.3213 5.25293Z" stroke="#009EE2"></path>
<path d="M9.7124 6.46393L12.0255 4.92188L14.3386 7.23496L12.7965 9.54804L9.7124 6.46393Z" fill="#009EE2"></path>
</svg>
</span>
</a>
</div>
</div>
}
</div>
}
</div>

View File

@@ -111,6 +111,9 @@
}else if(typeOfSmsSetting == '@TypeOfSmsSetting.Warning'){
$('#warningTab').click();
}else if(typeOfSmsSetting == '@TypeOfSmsSetting.InstitutionContractConfirm'){
$('#institutionContractConfirmTab').click();
}

View File

@@ -114,6 +114,9 @@
}else if(modelTypeOfSmsSetting == '@TypeOfSmsSetting.Warning'){
$('#warningTab').click();
}else if(typeOfSmsSetting == '@TypeOfSmsSetting.InstitutionContractConfirm'){
$('#institutionContractConfirmTab').click();
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,126 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.ModelBinding;
namespace ServiceHost.Conventions;
/// <summary>
/// Convention برای تنظیم خودکار binding source پارامترها
/// GET: FromQuery (اگر attribute نداشته باشد)
/// POST/PUT/PATCH/DELETE: FromBody برای انواع پیچیده (اگر attribute نداشته باشد)
/// </summary>
public class ParameterBindingConvention : IApplicationModelConvention
{
public void Apply(ApplicationModel application)
{
foreach (var controller in application.Controllers)
{
foreach (var action in controller.Actions)
{
foreach (var parameter in action.Parameters)
{
// فقط اگر کاربر خودش attribute مشخص کرده باشد، skip کن
// نه اگر ASP.NET Core خودش binding source پیش‌فرض گذاشته
if (HasExplicitBindingSourceAttribute(parameter))
continue;
// اگر پارامتر از route می‌آید، skip کن
if (IsRouteParameter(action, parameter))
continue;
// برای GET از Query استفاده کن
if (IsGetMethod(action))
{
parameter.BindingInfo = parameter.BindingInfo ?? new BindingInfo();
parameter.BindingInfo.BindingSource = BindingSource.Query;
}
// برای POST, PUT, PATCH, DELETE از Body استفاده کن (فقط برای انواع پیچیده)
else if (IsComplexType(parameter))
{
parameter.BindingInfo = parameter.BindingInfo ?? new BindingInfo();
parameter.BindingInfo.BindingSource = BindingSource.Body;
}
}
}
}
}
/// <summary>
/// چک می‌کند که آیا کاربر خودش attribute binding source گذاشته یا نه
/// (FromBody, FromQuery, FromForm, FromRoute, FromHeader)
/// </summary>
private static bool HasExplicitBindingSourceAttribute(ParameterModel parameter)
{
// فقط attribute های manual کاربر را چک کن، نه binding source پیش‌فرض ASP.NET Core
var parameterInfo = parameter.ParameterInfo;
return parameterInfo.GetCustomAttributes(false)
.Any(a => a is IBindingSourceMetadata);
}
/// <summary>
/// چک می‌کند که آیا پارامتر جزو route template است یا نه
/// مثلا: [HttpGet("{id}")] یا [Route("update/{id}")]
/// </summary>
private static bool IsRouteParameter(ActionModel action, ParameterModel parameter)
{
var parameterName = parameter.ParameterName;
// چک کردن selectors در سطح action
foreach (var selector in action.Selectors)
{
if (selector.AttributeRouteModel?.Template != null)
{
if (selector.AttributeRouteModel.Template.Contains($"{{{parameterName}}}", StringComparison.OrdinalIgnoreCase))
return true;
}
}
// چک کردن selectors در سطح controller
foreach (var selector in action.Controller.Selectors)
{
if (selector.AttributeRouteModel?.Template != null)
{
if (selector.AttributeRouteModel.Template.Contains($"{{{parameterName}}}", StringComparison.OrdinalIgnoreCase))
return true;
}
}
return false;
}
/// <summary>
/// چک می‌کند که آیا action از نوع GET است
/// </summary>
private static bool IsGetMethod(ActionModel action)
{
return action.Attributes.Any(a => a is HttpGetAttribute);
}
/// <summary>
/// چک می‌کند که آیا نوع پارامتر، نوع پیچیده است یا خیر
/// انواع ساده: Primitive types, string, decimal, DateTime, Guid, Enum
/// </summary>
private static bool IsComplexType(ParameterModel parameter)
{
var type = parameter.ParameterInfo.ParameterType;
// Nullable types را handle کن
var underlyingType = Nullable.GetUnderlyingType(type) ?? type;
// انواع ساده را چک کن
if (underlyingType.IsPrimitive ||
underlyingType == typeof(string) ||
underlyingType == typeof(decimal) ||
underlyingType == typeof(DateTime) ||
underlyingType == typeof(DateTimeOffset) ||
underlyingType == typeof(TimeSpan) ||
underlyingType == typeof(Guid) ||
underlyingType.IsEnum)
{
return false;
}
return true;
}
}

View File

@@ -34,6 +34,7 @@ using GozareshgirProgramManager.Infrastructure.Persistence.Seed;
using Microsoft.OpenApi;
using ServiceHost.Hubs.ProgramManager;
using ServiceHost.Notifications.ProgramManager;
using ServiceHost.Conventions;
var builder = WebApplication.CreateBuilder(args);
@@ -174,7 +175,11 @@ builder.Services.AddAuthorization(options =>
// });
builder.Services.AddControllers().AddJsonOptions(options =>
builder.Services.AddControllers(options =>
{
options.Conventions.Add(new ParameterBindingConvention());
})
.AddJsonOptions(options =>
{
options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter());
});

View File

@@ -19,7 +19,7 @@
"sqlDebugging": true,
"dotnetRunMessages": "true",
"nativeDebugging": true,
"applicationUrl": "https://localhost:5004;http://localhost:5003;",
"applicationUrl": "https://localhost:5004;http://localhost:5003;https://192.168.0.117:5006",
"jsWebView2Debugging": false,
"hotReloadEnabled": true
},

View File

@@ -59,10 +59,6 @@
<None Remove="wwwroot\webcamjs\flash\**" />
</ItemGroup>
<ItemGroup>
<Content Remove="wwwroot\AssetsAdmin\page\SmsSettings\js\SmsSettings.js" />
<Content Remove="wwwroot\AssetsAdmin\page\Workshop\js\EditWorkshopAdmin.js" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AccountManagement.Configuration\AccountManagement.Configuration.csproj" />
@@ -109,6 +105,12 @@
<Folder Include="Storage\Ticket\" />
<Folder Include="wwwroot\AdminTheme\js\faceApi\" />
<Folder Include="wwwroot\AdminTheme\static\img\" />
<Folder Include="wwwroot\AssetsAdmin\page\Account\css\" />
<Folder Include="wwwroot\AssetsAdmin\page\Account\js\" />
<Folder Include="wwwroot\AssetsAdmin\page\Report\css\" />
<Folder Include="wwwroot\AssetsAdmin\page\Report\js\" />
<Folder Include="wwwroot\AssetsAdmin\page\SmsSettings\css\" />
<Folder Include="wwwroot\AssetsAdmin\page\SmsSettings\js\" />
<Folder Include="wwwroot\less\" />
<Folder Include="wwwroot\webcamjs\" />
</ItemGroup>

View File

@@ -0,0 +1,169 @@
$(document).ready(function () {
$(".select-city").select2({
language: "fa",
dir: "rtl"
});
})
$(document).ready(function () {
$('#datatable').dataTable({
"lengthMenu": [[25, 10, 50, 100, -1], [25, 10, 50, 100, "All"]]
});
});
$(document).ready(function () {
$('#datatable2').dataTable(
{
"lengthMenu": [[50, 25, 10, 100, -1], [50, 25, 10, 100, "All"]]
});
});
$(document).ready(function () {
$('#datatable3').dataTable(
{
"lengthMenu": [[25, 10, 50, 100, -1], [25, 10, 50, 100, "All"]]
});
});
$("#myTab a").click(function (e) {
e.preventDefault();
$(this).tab('show');
});
$("#myTab2 a").click(function (e) {
e.preventDefault();
$(this).tab('show');
});
$("#myTab3 a").click(function (e) {
e.preventDefault();
$(this).tab('show');
});
// store the currently selected tab in the hash value
$("ul.nav-tabs > li > a").on("shown.bs.tab",
function (e) {
var id = $(e.target).attr("href").substr(1);
window.location.hash = id;
});
// on load of the page: switch to the currently selected tab
var hash = window.location.hash;
$('#myTab a[href="' + hash + '"]').tab('show', 'active');
var hash2 = window.location.hash;
$('#myTab2 a[href="' + hash2 + '"]').tab('show', 'active');
var hash2 = window.location.hash;
$('#myTab2 a[href="' + hash2 + '"]').tab('show', 'active');
$('.activer').on('change',
function (e) {
e.preventDefault();
$('.search').click();
});
function directLogin(id) {
$.ajax({
async: false,
dataType: 'json',
type: 'POST',
url: directLoginUrl,
headers: { "RequestVerificationToken": antiforgeryToken },
data: { "id": id },
success: function (response) {
if (response.isSuccess) {
window.location.href = "/Client";
} else {
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', "خطا در ورود به اکانت");
}
}
});
}
function deActive(id, accountName) {
let alarm = 'آیا از غیرفعال کردن ' + accountName + ' اطمینان دارید؟ ' + ' ';
swal({
title: alarm,
text: "",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "بله",
cancelButtonText: "خیر",
closeOnConfirm: true,
closeOnCancel: true
},
function (isConfirm) {
if (isConfirm) {
deActiveAjax(id);
}
});
}
function deActiveAjax(id) {
$('.sweet-alert').removeClass("successSwall");
$('.sweet-alert').removeClass("errorSwall");
$.ajax({
async: false,
dataType: 'json',
type: 'GET',
url: deActiveAjaxUrl,
headers: { "RequestVerificationToken": antiforgeryToken },
data: { "id": id },
success: function (response) {
if (response.isSuccedded) {
window.location.reload();
}
}
});
}
function Active(id, accountName) {
let alarm = 'آیا از غیرفعال کردن ' + accountName + ' اطمینان دارید؟ ' + ' ';
swal({
title: alarm,
text: "",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "بله",
cancelButtonText: "خیر",
closeOnConfirm: true,
closeOnCancel: true
},
function (isConfirm) {
if (isConfirm) {
ActiveAjax(id);
}
});
}
function ActiveAjax(id) {
$('.sweet-alert').removeClass("successSwall");
$('.sweet-alert').removeClass("errorSwall");
$.ajax({
async: false,
dataType: 'json',
type: 'GET',
url: activeAjaxUrl,
headers: { "RequestVerificationToken": antiforgeryToken },
data: { "id": id },
success: function (response) {
if (response.isSuccedded) {
window.location.reload();
}
}
});
}

File diff suppressed because it is too large Load Diff

View File

@@ -20,7 +20,7 @@
$("#institutionContractDebtReminderTab").addClass("active");
// کلیک روی تب‌ها
$("#institutionContractDebtReminderTab, #blockContractingPartyTab, #legalActionTab, #warningTab").click(function (e) {
$("#institutionContractDebtReminderTab, #blockContractingPartyTab, #legalActionTab, #warningTab, #institutionContractConfirmTab").click(function (e) {
e.preventDefault();
@@ -34,24 +34,29 @@
loadPartial(url);
$("#institutionContractDebtReminderTab, #blockContractingPartyTab, #legalActionTab, #warningTab").removeClass("active");
$("#institutionContractDebtReminderTab, #blockContractingPartyTab, #legalActionTab, #warningTab, #institutionContractConfirmTab").removeClass("active");
$(this).addClass("active");
break;
case "blockContractingPartyTab":
loadPartial(url);
$("#institutionContractDebtReminderTab, #blockContractingPartyTab, #legalActionTab, #warningTab").removeClass("active");
$("#institutionContractDebtReminderTab, #blockContractingPartyTab, #legalActionTab, #warningTab, #institutionContractConfirmTab").removeClass("active");
$(this).addClass("active");
break;
case "legalActionTab":
loadPartial(url);
$("#institutionContractDebtReminderTab, #blockContractingPartyTab, #legalActionTab, #warningTab").removeClass("active");
$("#institutionContractDebtReminderTab, #blockContractingPartyTab, #legalActionTab, #warningTab, #institutionContractConfirmTab").removeClass("active");
$(this).addClass("active");
break;
case "warningTab":
loadPartial(url);
$("#institutionContractDebtReminderTab, #blockContractingPartyTab, #legalActionTab, #warningTab").removeClass("active");
$("#institutionContractDebtReminderTab, #blockContractingPartyTab, #legalActionTab, #warningTab, #institutionContractConfirmTab").removeClass("active");
$(this).addClass("active");
break;
case "institutionContractConfirmTab":
loadPartial(url);
$("#institutionContractDebtReminderTab, #blockContractingPartyTab, #legalActionTab, #warningTab, #institutionContractConfirmTab").removeClass("active");
$(this).addClass("active");
break;

View File

@@ -0,0 +1,471 @@
.operationBtns {
display: flex;
justify-content: end;
}
.hidden {
display: none !important;
}
.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered {
padding-right: 15px;
padding-left: 15px;
}
#datatable .tooltip {
font-size: 10px;
}
#datatable thead .sorting:after, #datatable thead .sorting_asc:after, #datatable thead .sorting_desc:after {
display: none;
}
#datatable thead > tr > th {
padding-left: 0px;
padding-right: 0px;
text-align: center;
font-size: 14px;
}
#datatable > tbody > tr > td {
padding: 5px;
position: relative;
font-size: 12px;
}
#datatable tr:nth-child(odd) td:nth-child(3) {
background-color: #bed3ca87;
}
#datatable tr:nth-child(even) td:nth-child(3) {
background-color: #b0c1ba36;
}
.text-nowrap {
white-space: nowrap !important;
overflow-x: visible;
}
.tooltip-inner {
max-width: 300px;
}
.btn-table {
margin: 0 5px;
border-radius: 8px;
padding: 4px 8px 2px 8px;
box-shadow: 0 0 6px 0px #838383;
font-size: 20px;
}
.btn-table i {
transform: translate(0, 1px);
font-size: 22px !important;
}
.tooltip-container {
cursor: pointer;
position: relative;
}
.tooltip2-container {
cursor: pointer;
position: relative;
display: inline-block;
}
.tooltip {
opacity: 0;
z-index: 99;
color: #fff;
width: 220px;
display: block;
font-size: 14px;
font-family: 'IranSans';
padding: 5px 10px;
border-radius: 3px;
text-align: center;
background: #e67e22;
border: 1px solid #e67e22;
box-shadow: 0 0 3px rgba(0,0,0,0.5);
-webkit-transition: all .2s ease-in-out;
-moz-transition: all .2s ease-in-out;
-o-transition: all .2s ease-in-out;
-ms-transition: all .2s ease-in-out;
transition: all .2s ease-in-out;
-webkit-transform: scale(0);
-moz-transform: scale(0);
-o-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
position: absolute;
right: -50px;
bottom: 40px;
}
.tooltip:before, .tooltip:after {
content: '';
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-top: 10px solid #e67e22;
position: absolute;
bottom: -10px;
left: 70%;
}
.tooltip-container:hover .tooltip, a:hover .tooltip {
opacity: 1;
-webkit-transform: scale(1);
-moz-transform: scale(1);
-o-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
.tooltipfull {
opacity: 0;
z-index: 99;
color: #fff;
display: block;
font-size: 12px;
font-family: 'IranSans';
padding: 5px 10px;
border-radius: 15px;
text-align: center;
background: #4e5a52;
border: 1px solid #4e5a52;
box-shadow: 0 0 3px rgba(0,0,0,0.5);
-webkit-transition: all .2s ease-in-out;
-moz-transition: all .2s ease-in-out;
-o-transition: all .2s ease-in-out;
transition: all .2s ease-in-out;
-webkit-transform: scale(0);
-moz-transform: scale(0);
-o-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
position: absolute;
right: -2px;
bottom: 30px;
white-space: nowrap;
}
.tooltipfull span {
line-height: 1.3;
}
.tooltipfull:before, .tooltipfull:after {
content: '';
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-top: 10px solid #4e5a52;
position: absolute;
bottom: -10px;
left: 50%;
transform: translateX(-9px) translateY(-1.5px) scale(0.5);
}
.tooltipfull-containerText:hover .tooltipfull, a:hover .tooltipfull {
opacity: 1;
-webkit-transform: scale(1);
-moz-transform: scale(1);
-o-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
.loc-full {
white-space: nowrap !important;
max-width: 5rem;
overflow-x: hidden;
text-overflow: ellipsis;
}
.state-full {
max-width: 5rem;
}
.loc-box {
display: flex;
box-shadow: 0px 0px 6px 3px inset #44665e63;
padding: 6px 0px;
border-radius: 10px;
}
.mobile-view {
display: none;
}
.screen-view {
display: flex;
}
.fulltext {
opacity: 0;
white-space: nowrap;
}
.ellipsed {
display: block;
width: 100%;
text-overflow: ellipsis;
overflow-x: clip;
white-space: nowrap;
}
.name-td {
max-width: 155px;
position: relative;
}
.address-td {
max-width: 100px;
position: relative;
}
.city-td {
max-width: 30px;
}
.code-td {
max-width: 50px;
}
.tooltipfull-containerText {
cursor: pointer;
position: absolute;
display: inline-block;
right: 9px;
top: 13px;
}
.oper {
max-width: 200px;
}
@media(max-width: 1550px) {
.fulltext {
max-width: 20rem;
}
.btn-table {
font-size: 18px;
}
.fulltext {
max-width: 22rem;
}
}
@media(max-width: 1440px) {
.fulltext {
max-width: 12rem;
}
.btn-table {
font-size: 14px;
}
.oper {
max-width: 300px;
}
#datatable thead > tr > th {
font-size: 10px;
}
#datatable > tbody > tr > td {
font-size: 11px;
}
.code-td {
max-width: 65px;
}
.fulltext {
max-width: 21rem;
}
}
/*.errorSwall .confirm, .warningSwall .confirm {
display: unset !important;
}*/
.address-flex {
display: flex;
padding: 0;
}
@media(max-width: 768px) {
.mobile-view {
display: block;
padding-top: 10px;
}
.screen-view {
display: none;
}
.panel-body .form-control {
font-size: 12px;
}
.oper {
max-width: 45px;
}
.xs-middle {
display: flex;
column-gap: 4px;
}
.xs-middle .btn-rounded {
padding: 6px 5px;
font-size: 10px;
}
.xs-middle .btn-rounded i {
font-size: 10px !important;
}
.right-one {
padding-left: 0;
}
.middle-one {
padding: 0;
}
.left-one {
padding-right: 0;
}
}
.btn-print {
background: #cbd5e1;
border: none;
border-radius: 4px;
padding: 3px 10px;
color: #1e293b;
transition: all .3s ease
}
.btn-print:hover {
background: #94a3b8;
}
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-track {
background: #dfdfdf;
border-radius: 5px;
}
::-webkit-scrollbar-thumb {
background: #bed3ca;
border-radius: 5px;
}
.opt {
background-color: #cae3d8;
border-radius: 10px;
text-align: right;
padding: 2px 5px;
text-overflow: ellipsis;
overflow-x: hidden;
width: 100%;
}
.noResult {
background-color: #cce5da;
border-radius: 10px;
text-align: right;
padding: 2px 5px;
}
.opt:hover, .noResult:hover {
background-color: #bed3ca !important;
color: #343434 !important;
}
.selectDiv {
position: relative;
z-index: 2;
border-radius: 10px;
min-height: 20px;
max-height: 190px;
overflow: hidden scroll;
width: 100%;
background-color: rgb(255 255 255);
display: block;
box-shadow: 0px -1px 12px 0px rgba(0,0,0,.16), 2px 1px 10px 0 rgba(0,0,0,.12);
}
.selectedOption {
color: #6f7072 !important;
background-color: #d2f5e6 !important;
}
.keyboardSelected {
color: #424242 !important;
background-color: #93c7b0 !important;
}
.bgGray, .bgGray:hover {
background-color: #b5b5b5 !important;
color: #646464;
}
a.disabled {
pointer-events: none;
cursor: default;
background-color: grey !important;
border-color: grey !important;
}
.custom-btn-technical {
background: #5893D4;
box-shadow: 0 0 3px 0 #5893D4;
border: 1px solid #5893D4;
transition: all .2s ease-in;
}
.custom-btn-technical:hover {
background: #366AA4;
box-shadow: 0 0 3px 0 #366AA4;
border: 1px solid #366AA4;
}
.select2-container--default .select2-selection--multiple .select2-selection__clear {
cursor: pointer;
float: left;
font-weight: 700;
margin-top: 5px;
margin-right: 10px;
padding: 1px;
font-size: 14px;
background: #f87171;
color: #fff;
width: 20px;
height: 20px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 60px;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
background-color: #1e9e9e;
border: 1px solid #0b7878;
color: #fff;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
color: #fff;
}

View File

@@ -0,0 +1,733 @@
$(document).ready(function () {
$('#datatable').dataTable({
"lengthMenu": [[25, 10, 50, 100, -1], [25, 10, 50, 100, "All"]]
//"autoWidth" :false
});
let state = $('#SearchModel_State').val();
let city = $('#SearchModel_City').val();
console.log(state);
console.log(city);
$('#ddlState').val(state);
iranwebsv2(state);
if (state != "") {
$("#city2 option").each(function () {
if ($(this).text() == city) {
$(this).attr('selected', 'selected');
}
});
} else {
var option = new Option("شهرستان", 0);
$("#city2").append(option);
$("#city2").trigger("change");
}
});
$(document).ready(function () {
//$('#datatable2').dataTable({
// "lengthMenu": [[25, 10, 50, 100, -1], [25, 10, 50, 100, "All"]]
//});
$("#closeModal").click(function () { $('#MainModal').modal('hide'); })
const $modal = $('#MainModal');
const $fixedDiv = $('.printBtns');
$modal.on('show.bs.modal',
function () {
if ($('#printThis').length) {
$fixedDiv.addClass('visible');
$fixedDiv.removeClass('hidden');
}
});
$modal.on('hidden.bs.modal',
function () {
$fixedDiv.removeClass('visible');
$fixedDiv.addClass('hidden');
});
});
function deActiveWorkshop(Id) {
let u2 = '&id=' + Id;
let url = showPersonnelList;
var showList = url + u2;
$('.sweet-alert').removeClass("successSwall");
$('.sweet-alert').removeClass("errorSwall");
swal({
title: "آیا حذف کارگاه انتخاب شده اطمینان دارید؟",
text: "",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "بله",
cancelButtonText: "خیر",
closeOnConfirm: false,
closeOnCancel: true
},
function (isConfirm) {
if (isConfirm) {
$.ajax({
async: false,
url: deActive,
type: "Get",
dataType: 'json',
data: { "id": Id },
success: function (response) {
if (response.sucsses) {
$('#datatable tbody tr').each(function (i) {
if ($(this).attr("data-workshopId") == Id) {
$(this).remove();
}
});
swal({
title: response.message,
text: "",
type: "success",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "بستن",
//cancelButtonText: "خیر",
closeOnConfirm: true,
customClass: "successSwall"
});
} else {
swal({
title: response.message,
text: "",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "لیست پرسنل",
cancelButtonText: "انصراف",
closeOnConfirm: true,
closeOnCancel: true,
customClass: "errorSwall"
},
function (isConfirm) {
if (isConfirm) {
window.location.href = showList;
}
});
}
},
failure: function (response) {
console.log(5, response);
}
}); //endOf Ajax
}
});
// $(".deactivation-"+id).click();
}
if ($('#datatable tbody tr .employee-operations').length > 0) {
$(window).on('resize',
function () {
if ($(window).width() < 768) {
locateButtonContainerMobile();
}
if ($(window).width() > 768) {
locateButtonContainer();
}
});
$(document).on("click",
function (event) {
var target = $(event.target);
if (!target.closest(".buttons-container").length && !target.is(".employee-operations") && !target.is("#personelList") && !target.is("#personelList *") && !target.is("#createWorkshop") && !target.is("#createWorkshop *") && !target.is("#details") && !target.is("#details *") && !target.is("#editWorkshop") && !target.is("#editWorkshop *")
) {
$(".buttons-container").removeClass("active").addClass("reverse");
$(".more-buttons").removeClass("active");
setTimeout(function () {
$(".buttons-container").removeClass("reverse").css("display", "none");
},
200);
}
});
$(".employee-operations").on("click",
function () {
if ($(window).width() < 768) {
locateButtonContainerMobile();
}
if ($(window).width() > 768) {
locateButtonContainer();
}
var buttonsContainer = $(this).next(".buttons-container");
if (buttonsContainer.hasClass("active")) {
buttonsContainer.removeClass("active").addClass("reverse");
$(this).closest(".more-buttons").removeClass("active");
setTimeout(function () {
buttonsContainer.removeClass("reverse").css("display", "none");
},
200);
} else {
buttonsContainer.removeClass("reverse").addClass("active").css("display", "flex");
$(this).closest(".more-buttons").addClass("active");
}
$(".buttons-container").not(buttonsContainer).removeClass("active reverse").css("display", "none");
$(".more-buttons").not($(this).closest(".more-buttons")).removeClass("active");
});
}
function locateButtonContainer() {
var beforePosition = $(".screen-view .employee-operations").position();
var containerWidth = $('.screen-view .buttons-container').outerWidth();
var containerHeight = $('.screen-view .buttons-container').outerHeight();
var containerLeft = beforePosition.left + $(".screen-view .employee-operations").outerWidth() + 20;
var containerTop = beforePosition.top + ($(".screen-view .employee-operations").outerHeight() / 2) - (containerHeight / 2);
$('.screen-view .buttons-container').css({
left: containerLeft,
top: containerTop
});
}
function locateButtonContainerMobile() {
var beforePosition = $(".mobile-view .employee-operations").position();
var containerWidth = $('.mobile-view .buttons-container').outerWidth();
var containerHeight = $('.mobile-view .buttons-container').outerHeight();
var containerLeft = beforePosition.left + $(".mobile-view .employee-operations").outerWidth() + 25;
var containerTop = beforePosition.top + ($(".mobile-view .employee-operations").outerHeight() / 2) - (containerHeight / 2);
$('.mobile-view .buttons-container').css({
left: containerLeft,
top: containerTop
});
}
//------workshop-----
var containerWorkshop = $('#empWorkshop');
var searchBoxWorkshop = $('#empSearchWorkshop');
var hiddenInputValWorkshop = $('.sendWorkshopId');
var searchResulWorkshop = $('.searchResultWorkshop');
var mixContainerAndSerchResultWorkshop = $('#empWorkshop , .searchResultWorkshop');
containerWorkshop.hide();
var liListWorkshop;
var liPointerWorkshop;
let countWorkshop = 0;
//close search Employee when click on body
$(document).on('click',
function (event) {
if (!$(event.target).closest(containerWorkshop).length) {
containerWorkshop.hide();
}
});
//select option by mouse
function selectItemWorkshop(id, employeeFullName) {
searchBoxWorkshop.val(employeeFullName);
hiddenInputValWorkshop.val(id);
containerWorkshop.hide();
searchBoxWorkshop.addClass("selectedOption");
};
//search by Ajax
searchBoxWorkshop.on('keyup keypress',
function (e) {
$(".form-control").removeClass("selectedOption");
// $("#empSearchContractingPartyID").val('');
// $("#SearchModel_ContactingPartyName").val('');
if ($(this).val() == '') {
$("#SearchModel_Id").val("0");
$("#SearchModel_WorkshopFullName").val('');
}
//stop submit form with enter
var keyCode = e.keyCode || e.which;
if (keyCode === 13) {
e.preventDefault();
if (countWorkshop > 0 && countWorkshop <= liListWorkshop.length) {
liPointerWorkshop.click();
}
return false;
}
searchBoxWorkshop.removeClass("selectedOption");
let searchText = $(this).val();
hiddenInputValWorkshop.val(0);
if (searchText.length > 1) {
$.ajax({
async: false,
contentType: 'charset=utf-8',
dataType: 'json',
type: 'GET',
url: workshopNameAjax,
data: { "searchText": searchText },
headers: { "RequestVerificationToken": antiforgeryToken },
success: function (response) {
$(".opt").remove();
if (response.mylist.length > 0) { //result Founded
console.log(response.mylist);
$(".noResult").remove();
containerWorkshop.show();
$.each(response.mylist,
function (i, item) {
let li = `<li data-workshopId="${item.id}" class="btn btn-block opt" onclick="selectItemWorkshop(${item.id}, '${item.workshopFullName}');" >`;
li = li + '<span class="name-right" > ' + item.workshopFullName + ' </span><span class="line">|</span> <span class="code-left" > ' + item.archiveCode + ' </span></li> ';
searchResulWorkshop.append(li);
});
} else { //result NotFounded
$(".noResult").remove();
containerWorkshop.show();
let noResult = `<li class="btn btn-block noResult">نتیجه ای یافت نشد</li>`;
searchResulWorkshop.append(noResult);
}
} // endOfSuccess
}); //endOfAjax
} else {
containerWorkshop.hide();
countWorkshop = 0;
}
//keyboard Arrow Key Select And Enter
liListWorkshop = $('#empWorkshop ul li');
mixContainerAndSerchResultWorkshop.animate({
scrollTop: $(liListWorkshop.eq(0)).offset().top - containerWorkshop.offset().top + containerWorkshop.scrollTop()
},
50);
if (e.which === 40) { // if ArrowUp
if (countWorkshop > 0 && countWorkshop <= liListWorkshop.length) {
liPointerWorkshop.removeClass('keyboardSelected');
console.log(countWorkshop + "plusOne");
liListWorkshop.eq(countWorkshop).addClass('keyboardSelected');
liPointerWorkshop = liListWorkshop.eq(countWorkshop);
if (countWorkshop > 4) {
//ScrollDown
mixContainerAndSerchResultWorkshop.animate({
scrollTop: $(liPointerWorkshop).offset().top - containerWorkshop.offset().top + containerWorkshop.scrollTop()
},
50);
}
countWorkshop += 1;
} else {
liListWorkshop.eq(0).addClass("keyboardSelected");
liPointerWorkshop = liListWorkshop.eq(0);
countWorkshop = 1;
}
} else if (e.which === 38) { //if ArrowDown
if (countWorkshop > 0 && countWorkshop <= liListWorkshop.length) {
liPointerWorkshop.removeClass('keyboardSelected');
countWorkshop -= 1;
liListWorkshop.eq(countWorkshop).addClass('keyboardSelected');
liPointerWorkshop = liListWorkshop.eq(countWorkshop);
//ScrollUp
mixContainerAndSerchResultWorkshop.animate({
scrollTop: $(liPointerWorkshop).offset().top - containerWorkshop.offset().top + containerWorkshop.scrollTop()
},
50);
}
}
});
$("#empSearchWorkshop").keypress(function (event) {
$(".form-control").removeClass("selectedOption");
$("#empSearch").val('');
$("#SearchModel_EmployerLName").val('');
$("#SearchModel_EmployerId").val('');
if (event.keyCode === 13) {
if ($("#SearchModel_Id").val() == "0")
$("#SearchModel_WorkshopFullName").val($("#empSearchWorkshop").val())
$("#btnSearch").click();
}
});
//------Employer-----
var container = $('#emp');
var searchBox = $('#empSearch');
var hiddenInputVal = $('.sendEmployeeId');
var searchResul = $('.searchResult');
var mixContainerAndSerchResult = $('#emp , .searchResult');
container.hide();
var liList;
var liPointer;
let count = 0;
//close search Employee when click on body
$(document).on('click',
function (event) {
if (!$(event.target).closest(container).length) {
container.hide();
}
});
//select option by mouse
function selectItem(id, employeeFullName) {
searchBox.val(employeeFullName);
hiddenInputVal.val(id);
container.hide();
searchBox.addClass("selectedOption");
};
//search by Ajax
searchBox.on('keyup keypress',
function (e) {
$(".form-control").removeClass("selectedOption");
// $("#empSearchContractingPartyID").val('');
// $("#SearchModel_ContactingPartyName").val('');
if ($(this).val() == '') {
$("#SearchModel_EmployerId").val("0");
$("#SearchModel_EmployerLName").val('');
}
//stop submit form with enter
var keyCode = e.keyCode || e.which;
if (keyCode === 13) {
e.preventDefault();
if (count > 0 && count <= liList.length) {
liPointer.click();
}
return false;
}
searchBox.removeClass("selectedOption");
let searchText = $(this).val();
hiddenInputVal.val(0);
if (searchText.length > 1) {
$.ajax({
async: false,
contentType: 'charset=utf-8',
dataType: 'json',
type: 'GET',
url: employerNameAjax,
data: { "searchText": searchText },
headers: { "RequestVerificationToken": antiforgeryToken },
success: function (response) {
$(".opt").remove();
if (response.mylist.length > 0) { //result Founded
$(".noResult").remove();
container.show();
$.each(response.mylist,
function (i, item) {
let li = `<li data-employeeId="${item.id}" class="btn btn-block opt" onclick="selectItem(${item.id}, '${item.lName}');" >${item.lName}</li>`;
searchResul.append(li);
});
} else { //result NotFounded
$(".noResult").remove();
container.show();
let noResult = `<li class="btn btn-block noResult">نتیجه ای یافت نشد</li>`;
searchResul.append(noResult);
}
} // endOfSuccess
}); //endOfAjax
} else {
container.hide();
count = 0;
}
//keyboard Arrow Key Select And Enter
liList = $('#emp ul li');
mixContainerAndSerchResult.animate({
scrollTop: $(liList.eq(0)).offset().top - container.offset().top + container.scrollTop()
},
50);
if (e.which === 40) { // if ArrowUp
if (count > 0 && count <= liList.length) {
liPointer.removeClass('keyboardSelected');
console.log(count + "plusOne");
liList.eq(count).addClass('keyboardSelected');
liPointer = liList.eq(count);
if (count > 4) {
//ScrollDown
mixContainerAndSerchResult.animate({
scrollTop: $(liPointer).offset().top - container.offset().top + container.scrollTop()
},
50);
}
count += 1;
} else {
liList.eq(0).addClass("keyboardSelected");
liPointer = liList.eq(0);
count = 1;
}
} else if (e.which === 38) { //if ArrowDown
if (count > 0 && count <= liList.length) {
liPointer.removeClass('keyboardSelected');
count -= 1;
liList.eq(count).addClass('keyboardSelected');
liPointer = liList.eq(count);
//ScrollUp
mixContainerAndSerchResult.animate({
scrollTop: $(liPointer).offset().top - container.offset().top + container.scrollTop()
},
50);
}
}
});
$("#empSearch").keypress(function (event) {
$(".form-control").removeClass("selectedOption");
$("#empSearchWorkshop").val('');
$("#SearchModel_Id").val('');
$("#SearchModel_WorkshopFullName").val('');
if (event.keyCode === 13) {
if ($("#SearchModel_EmployerId").val() == "0")
$("#SearchModel_EmployerLName").val($("#empSearch").val())
$("#btnSearch").click();
}
});
$(".btn-searchWorkshop").click(function () {
if ($("#SearchModel_Id").val() == "0" || $("#SearchModel_Id").val() == "")
$("#SearchModel_WorkshopFullName").val($("#empSearchWorkshop").val());
if ($("#SearchModel_EmployerId").val() == "0" || $("#SearchModel_EmployerId").val() == "")
$("#SearchModel_EmployerLName").val($("#empSearch").val());
if ($("#empSearch").val() == "0")
$("#empSearch").val('');
$("#btnSearch").click();
});
function remove(id, hasLeftwork) {
$('.sweet-alert').removeClass("successSwall");
$('.sweet-alert').removeClass("errorSwall");
swal({
title: hasLeftwork == "True" ? "توجه داشته باشید حذف کامل از دیتابیس میسر نمی باشد،اما با تایید این پیام این کارگاه و کلیه عملیات مربوط به آن غیرفعال می گردد." : "توجه داشته باشید با تایید این پیام، اطلاعات لیست مورد نظر بطور کامل از بانک اطلاعاتی حذف خواهد شد.",
text: "",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "بله",
cancelButtonText: "خیر",
closeOnConfirm: false,
closeOnCancel: true,
customClass: (hasLeftwork == "True" ? "questionSwall" : "")
},
function (isConfirm) {
if (isConfirm) {
$.ajax({
async: false,
dataType: 'json',
type: 'POST',
url: deleteWorkshopAjaxUrl,
headers: { "RequestVerificationToken": antiforgeryToken },
data: { "id": id },
success: function (response) {
if (response.isSuccedded) {
swal({
title: "حذف با موفقیت انجام شد.",
text: "",
type: "success",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "بستن",
//cancelButtonText: "خیر",
closeOnConfirm: true,
customClass: "successSwall"
},
function (isConfirm) {
if (isConfirm) {
//$("#btnSearch").click();
var url = indexAjax;
window.location.href = url;
}
});
} else {
if (response.message == "DeActive") {
swal({
title: "غیرفعال شدن این کارگاه با موفقیت انجام شد.",
text: "به منظور حذف از دیتابیس باید کلیه عملیات مربوط به این کارگاه را حذف نمایید.",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "بستن",
cancelButtonText: "بستن",
closeOnConfirm: true,
closeOnCancel: true,
customClass: "warningSwall2"
},
function (isConfirm) {
if (isConfirm) {
//$("#btnSearch").click();
var url = indexAjax;
window.location.href = url;
}
});
} else {
swal({
title: response.message,
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
//confirmButtonText: "بستن",
cancelButtonText: "بستن",
closeOnConfirm: false,
closeOnCancel: true,
customClass: "errorSwall"
});
}
}
},
failure: function (response) {
console.log(5, response)
}
});
}
});
}
function active(id) {
$('.sweet-alert').removeClass("successSwall");
$('.sweet-alert').removeClass("errorSwall");
swal({
title: "آیا از فعال کردن این کارگاه مطمئن هستید؟",
text: "",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "بله",
cancelButtonText: "خیر",
closeOnConfirm: false,
closeOnCancel: true
},
function (isConfirm) {
if (isConfirm) {
$.ajax({
async: false,
dataType: 'json',
type: 'POST',
url: activeWorkshopAjaxUrl,
headers: { "RequestVerificationToken": antiforgeryToken },
data: { "id": id },
success: function (response) {
// console.log(response);
if (response.isSuccedded) {
swal({
title: response.message,
text: "",
type: "success",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "بستن",
//cancelButtonText: "خیر",
closeOnConfirm: true,
customClass: "successSwall"
},
function (isConfirm) {
if (isConfirm) {
var url = indexAjax;
window.location.href = url;
// $("#btnSearch").click();
}
});
} else {
swal({
title: response.message,
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
//confirmButtonText: "بستن",
cancelButtonText: "بستن",
closeOnConfirm: false,
closeOnCancel: true,
customClass: "errorSwall"
});
}
},
failure: function (response) {
console.log(5, response)
}
});
}
});
}
function selectState(value) {
if (value != "")
$("#SearchModel_State").val(value);
}
function selectCity(element) {
var value = $(element).val();
if (value != "0" && value != "") {
$("#SearchModel_City").val($(element).find('option:selected').text());
}
}
$(document).ready(function () {
$(".accountList").select2({
placeholder: "نام و نام خانوادگی اعضاء",
allowClear: true,
dir: "rtl"
});
});
function printListWorkshopModal() {
var insuranceCode = $('#SearchModel_InsuranceCode').val();
var state = $('#SearchModel_State').val();
var city = $('#SearchModel_City').val();
var isActiveString = $('#SearchModel_IsActiveString').val();
var accountId = $('#SearchModel_AccountId').val();
var accountIds = $('#SearchModel_AccountIds').val();
// if (accountIds == null) {
// $.Notification.autoHideNotify('error', 'bottom right', 'پیام سیستم ', "لطفا نام و نام خانوادگی اعضاء را انتخاب نمایید.");
// return false;
// }
// var accountIdsNumbers = accountIds.map(function(value) {
// return Number(value);
// });
// var accountIdsQuery = accountIdsNumbers.map(function(id) {
// return `SearchModel.AccountIds=${id}`;
// }).join('&');
// var parameter = `&SearchModel.InsuranceCode=${insuranceCode}&SearchModel.State=${state}&SearchModel.City=${city}&SearchModel.IsActiveString=${isActiveString}&${accountIdsQuery}`;
var parameter = `&SearchModel.InsuranceCode=${insuranceCode}&SearchModel.State=${state}&SearchModel.City=${city}&SearchModel.IsActiveString=${isActiveString}&SearchModel.AccountId=${accountId}`;
window.location.href = printListWorkshopUrl + parameter;
}