1728 lines
82 KiB
Plaintext
1728 lines
82 KiB
Plaintext
@model CompanyManagment.App.Contracts.LeftWork.LeftWorkDividedList
|
||
|
||
@*adding bime*@
|
||
|
||
<link href="@Href("~/DadmehrSelect/dad-mehr-select.css")" rel="stylesheet" />
|
||
<link href="@Href("~/ClientTheme/css/left-work-insurance.css")" rel="stylesheet" />
|
||
<link href="@Href("~/ClientTheme/css/left-work.css")" rel="stylesheet" />
|
||
@Html.AntiForgeryToken()
|
||
<div class="container" id="LeftWorkForm">
|
||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||
<div class="main-title"> شروع بکار و ترک کار پرسنل در بخش قرارداد </div>
|
||
|
||
|
||
<fieldset class="box">
|
||
<legend>کارگاه @Model.WorkshopName (@Model.EmployeeName)</legend>
|
||
<div class="tabbed-navigation col-md-12 col-12 col-sm-12">
|
||
<div class="nav-tabs hide-scrollbar">
|
||
@if (Model.LeftWorkGroups != null && Model.LeftWorkGroups.Count > 0)
|
||
{
|
||
int index = 1;
|
||
@foreach (var item in @Model.LeftWorkGroups)
|
||
{
|
||
<a href="#tab-@index" class="@(index == 1 ? "active" : "") nav-link"> <span class="nav-title11" id="nav-title1"> @item.WorkshopName</span></a>
|
||
index = index + 1;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
<a href="#tab-1" class="active nav-link"> <span class="nav-title11" id="nav-title1"> @Model.WorkshopName</span></a>
|
||
}
|
||
|
||
<div class="additionalInfo">
|
||
<div class="info-box row">
|
||
<p>
|
||
<span>شماره ثبت :</span> شماره ثبت نیز همانند شناسه ملی ، در آگهی تاسیس قابل مشاهده میباشد و ضروریست شماره ثبت صحیح را در فیلد مربوطه درج نمائید.
|
||
</p>
|
||
</div>
|
||
<div class="info-box row">
|
||
<p>
|
||
<span>شماره ثبت :</span> شماره ثبت نیز همانند شناسه ملی ، در آگهی تاسیس قابل مشاهده میباشد و ضروریست شماره ثبت صحیح را در فیلد مربوطه درج نمائید.
|
||
</p>
|
||
</div>
|
||
<div class="info-box row">
|
||
<p>
|
||
<span>شماره ثبت :</span> شماره ثبت نیز همانند شناسه ملی ، در آگهی تاسیس قابل مشاهده میباشد و ضروریست شماره ثبت صحیح را در فیلد مربوطه درج نمائید.
|
||
</p>
|
||
</div>
|
||
<div class="info-box row">
|
||
<p>
|
||
<span>شماره ثبت :</span> شماره ثبت نیز همانند شناسه ملی ، در آگهی تاسیس قابل مشاهده میباشد و ضروریست شماره ثبت صحیح را در فیلد مربوطه درج نمائید.
|
||
</p>
|
||
</div>
|
||
<div class="info-box row">
|
||
<p>
|
||
<span>شماره ثبت :</span> شماره ثبت نیز همانند شناسه ملی ، در آگهی تاسیس قابل مشاهده میباشد و ضروریست شماره ثبت صحیح را در فیلد مربوطه درج نمائید.
|
||
</p>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
<div class="tab-content">
|
||
@if (Model.LeftWorkGroups != null && Model.LeftWorkGroups.Count > 0)
|
||
{
|
||
int index = 1;
|
||
@foreach (var item in @Model.LeftWorkGroups)
|
||
{
|
||
<div class="tab-pane @(index == 1 ? "active" : "")" data-workshopId="@item.WorkshopId" data-workshopName="@item.WorkshopName" id="tab-@index" data-pane="index">
|
||
<div class="pane-content">
|
||
<div class="container">
|
||
<div class="top-content first-row">
|
||
<div class="first-col-content">
|
||
<div class="select-container">
|
||
<label> سمت </label>
|
||
<div class=" dadmehr-select-search" onclick="inputFocus(this)">
|
||
<div class="custom-select text-right">
|
||
|
||
<ul class="ul-search single text-right" data-url="@Url.Page("/Company/Employees/Index", "JobByTextSearch")">
|
||
|
||
<li onclick="openSearchResultByCode(this)" class="singleItem"><span class="value" data-value="@item.LeftWorkViewModels[0].JobId">@item.LeftWorkViewModels[0].JobName</span>|<span class="code">@item.LeftWorkViewModels[0].JobCode</span></li>
|
||
</ul>
|
||
|
||
<ul class="result options text-right">
|
||
</ul>
|
||
</div>
|
||
<span class="span-input"></span>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="second-col-content">
|
||
<label> شماره پرسنلی </label>
|
||
<input type="text" class="position-code" placeholder="شماره پرسنلی" data-haspersonelcode="@(item.HasPersonelCode == true ? true : false)" value="@item.PersonnelCode" disabled="disabled">
|
||
</div>
|
||
<div class="third-col-content">
|
||
</div>
|
||
</div>
|
||
<div class="top-content">
|
||
@if (index == 1)
|
||
{
|
||
<div class="first-col-content">
|
||
<input type="text" class="persianDateInput date-input date input2" maxlength="10" id="startDate1" placeholder="تاریخ شروع بکار" tabindex="1">
|
||
</div>
|
||
<div class="second-col-content">
|
||
<input type="text" class="persianDateInput date-input date input3" maxlength="10" id="lastDay1" placeholder="تاریخ آخرین روز کاری" tabindex="2">
|
||
</div>
|
||
<div class="third-col-content">
|
||
<input type="text" class="persianDateInput date-input date input4" maxlength="10" id="endDate1" placeholder="تاریخ ترک کار" tabindex="3">
|
||
<button class="btn save2 " id="save">ثبت</button>
|
||
</div>
|
||
}
|
||
else
|
||
{
|
||
<div class="first-col-content">
|
||
<input type="text" class="persianDateInput date-input date input2" maxlength="10" id="start-date-@(index-1)" placeholder="تاریخ شروع بکار" tabindex="1">
|
||
</div>
|
||
<div class="second-col-content">
|
||
<input type="text" class="persianDateInput date-input date input3" maxlength="10" id="last-day-@(index-1)" placeholder="تاریخ آخرین روز کاری" tabindex="2">
|
||
</div>
|
||
<div class="third-col-content">
|
||
<input type="text" class="persianDateInput date-input date input4" maxlength="10" id="end-date-@(index-1)" placeholder="تاریخ ترک کار" tabindex="3">
|
||
<button class="btn save">ثبت</button>
|
||
</div>
|
||
}
|
||
</div>
|
||
<div class="table-content row">
|
||
<table class="table table-bordered table-striped workDate-table" @((index == 1) ? "id='modal-table'" : "")>
|
||
<colgroup>
|
||
<col style="width: 20px;">
|
||
<col style="width: 140px;">
|
||
<col style="width: 140px;">
|
||
<col style="width: 140px;">
|
||
<col class="col-remove" style="width: 5px;">
|
||
<col style="width: 30px;">
|
||
</colgroup>
|
||
<thead>
|
||
<tr>
|
||
<th>#</th>
|
||
<th>تاریخ شروع بکار</th>
|
||
<th>تاریخ آخرین روز کاری</th>
|
||
<th>تاریخ ترک کار</th>
|
||
<th></th>
|
||
<th class="text-small">روزهای کارکرد</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
@if (item.LeftWorkViewModels != null)
|
||
{
|
||
var leftworkViewModelList = item.LeftWorkViewModels;
|
||
for (int i = 0; i < leftworkViewModelList.Count; i++)
|
||
{
|
||
<tr>
|
||
<td>@(i + 1)</td>
|
||
<td>@leftworkViewModelList[i].StartWorkDate</td>
|
||
<td>@leftworkViewModelList[i].EndWorkDate</td>
|
||
<td>@leftworkViewModelList[i].LeftWorkDate</td>
|
||
<td><i class="fa fa-trash trash trash-icon" aria-hidden="true"></i></td>
|
||
<td>_</td>
|
||
</tr>
|
||
}
|
||
}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<div class="options-box">
|
||
<div class="options-info"> در صورت تمایل به محاسبه ی عناوین ذیل در فیش حقوقی، گزینه های موردنظر را فعال نمایید </div>
|
||
<div class="optional-wages d-flex">
|
||
<div class="d-flex options-check col-lg-4 col-md-4 col-sm-3 col-xs-4">
|
||
|
||
<div class="checkbox-wrapper-2">
|
||
<label class="toggleButton">
|
||
<input type="checkbox" checked="@(item.LeftWorkViewModels != null ?item.LeftWorkViewModels[0].AddYearsPay:"" )" class="activated addyearspay">
|
||
<div>
|
||
<svg viewBox="0 0 44 44">
|
||
<path d="M14,24 L21,31 L39.7428882,11.5937758 C35.2809627,6.53125861 30.0333333,4 24,4 C12.95,4 4,12.95 4,24 C4,35.05 12.95,44 24,44 C35.05,44 44,35.05 44,24 C44,19.3 42.5809627,15.1645919 39.7428882,11.5937758" transform="translate(-2.000000, -2.000000)"></path>
|
||
</svg>
|
||
</div>
|
||
</label>
|
||
</div>
|
||
<span class="options-type">سنوات </span>
|
||
</div>
|
||
<div class="d-flex options-check col-lg-4 col-md-4 col-sm-3 col-xs-4">
|
||
|
||
<div class="checkbox-wrapper-2">
|
||
<label class="toggleButton">
|
||
<input type="checkbox" checked="@(item.LeftWorkViewModels != null ?item.LeftWorkViewModels[0].AddBonusesPay:"" )" class="activated addbonusespay">
|
||
<div>
|
||
<svg viewBox="0 0 44 44">
|
||
<path d="M14,24 L21,31 L39.7428882,11.5937758 C35.2809627,6.53125861 30.0333333,4 24,4 C12.95,4 4,12.95 4,24 C4,35.05 12.95,44 24,44 C35.05,44 44,35.05 44,24 C44,19.3 42.5809627,15.1645919 39.7428882,11.5937758" transform="translate(-2.000000, -2.000000)"></path>
|
||
</svg>
|
||
</div>
|
||
</label>
|
||
</div>
|
||
<span class="options-type"> عیدی و پاداش </span>
|
||
</div>
|
||
<div class="d-flex options-check col-lg-4 col-md-4 col-sm-3 col-xs-4">
|
||
|
||
<div class="checkbox-wrapper-2">
|
||
<label class="toggleButton">
|
||
<input type="checkbox" checked="@(item.LeftWorkViewModels != null ?item.LeftWorkViewModels[0].AddLeavePay:"" )" class="activated addleavepay">
|
||
<div>
|
||
<svg viewBox="0 0 44 44">
|
||
<path d="M14,24 L21,31 L39.7428882,11.5937758 C35.2809627,6.53125861 30.0333333,4 24,4 C12.95,4 4,12.95 4,24 C4,35.05 12.95,44 24,44 C35.05,44 44,35.05 44,24 C44,19.3 42.5809627,15.1645919 39.7428882,11.5937758" transform="translate(-2.000000, -2.000000)"></path>
|
||
</svg>
|
||
</div>
|
||
</label>
|
||
</div>
|
||
<span class="options-type">مزد و مرخصی </span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
index = index + 1;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
<div class="tab-pane active" data-workshopid="" data-workshopName="" id="tab-1" data-pane="1">
|
||
<div class="pane-content">
|
||
<div class="container">
|
||
<div class="top-content first-row">
|
||
<div class="first-col-content">
|
||
<div class="select-container">
|
||
<label> سمت </label>
|
||
<div class="dadmehr-select-search" onclick="inputFocus(this)">
|
||
<div class="custom-select text-right">
|
||
<ul class="ul-search single text-right" data-url="@Url.Page("/Company/Employees/Index", "JobByTextSearch")">
|
||
<li> <input onkeyup="searchText(event,this,'@Url.Page("/Company/Employees/Index", "JobByTextSearch")',true)" class="text-right input-text " /></li>
|
||
</ul>
|
||
<ul class="result options text-right">
|
||
</ul>
|
||
</div>
|
||
<span class="span-input"></span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="second-col-content">
|
||
<label> شماره پرسنلی </label>
|
||
<input type="text" class="position-code" data-haspersonelcode="" disabled="disabled" placeholder="شماره پرسنلی">
|
||
</div>
|
||
<div class="third-col-content">
|
||
</div>
|
||
</div>
|
||
<div class="top-content">
|
||
<div class="first-col-content">
|
||
<input type="text" class="persianDateInput date-input date input2" maxlength="10" id="startDate1" placeholder="تاریخ شروع بکار" tabindex="1">
|
||
</div>
|
||
<div class="second-col-content">
|
||
<input type="text" class="persianDateInput date-input date input3" maxlength="10" id="lastDay1" placeholder="تاریخ آخرین روز کاری" tabindex="2">
|
||
</div>
|
||
<div class="third-col-content">
|
||
<input type="text" class="persianDateInput date-input date input4" maxlength="10" id="endDate1" placeholder="تاریخ ترک کار" tabindex="3">
|
||
<button class=" btn save2" id="save">ثبت</button>
|
||
</div>
|
||
</div>
|
||
<div class="table-content row">
|
||
<table class="table table-bordered table-striped workDate-table" id="modal-table">
|
||
<colgroup>
|
||
<col style="width: 20px;">
|
||
<col style="width: 140px;">
|
||
<col style="width: 140px;">
|
||
<col style="width: 140px;">
|
||
<col class="col-remove" style="width: 5px;">
|
||
<col style="width: 30px;">
|
||
</colgroup>
|
||
<thead>
|
||
<tr>
|
||
<th>#</th>
|
||
<th>تاریخ شروع بکار</th>
|
||
<th>تاریخ آخرین روز کاری</th>
|
||
<th>تاریخ ترک کار</th>
|
||
<th></th>
|
||
<th class="text-small">روزهای کارکرد</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
|
||
<tr>
|
||
<td>1</td>
|
||
<td></td>
|
||
<td></td>
|
||
<td></td>
|
||
<td><i class="fa fa-trash trash trash-icon" aria-hidden="true"></i></td>
|
||
<td></td>
|
||
</tr>
|
||
<tr>
|
||
<td>2</td>
|
||
<td></td>
|
||
<td></td>
|
||
<td></td>
|
||
<td><i class="fa fa-trash trash trash-icon" aria-hidden="true"></i></td>
|
||
<td></td>
|
||
</tr>
|
||
<tr>
|
||
<td>3</td>
|
||
<td></td>
|
||
<td></td>
|
||
<td></td>
|
||
<td><i class="fa fa-trash trash trash-icon" aria-hidden="true"></i></td>
|
||
<td></td>
|
||
</tr>
|
||
<tr>
|
||
<td>4</td>
|
||
<td></td>
|
||
<td></td>
|
||
<td></td>
|
||
<td><i class="fa fa-trash trash trash-icon" aria-hidden="true"></i></td>
|
||
<td></td>
|
||
</tr>
|
||
<tr>
|
||
<td>5</td>
|
||
<td></td>
|
||
<td></td>
|
||
<td></td>
|
||
<td><i class="fa fa-trash trash trash-icon" aria-hidden="true"></i></td>
|
||
<td></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<div class="options-box">
|
||
<div class="options-info"> در صورت تمایل به محاسبه ی عناوین ذیل در فیش حقوقی، گزینه های موردنظر را فعال نمایید </div>
|
||
<div class="optional-wages d-flex">
|
||
<div class="d-flex options-check col-lg-4 col-md-4 col-sm-3 col-xs-4">
|
||
<div class="checkbox-wrapper-2">
|
||
<label class="toggleButton">
|
||
<input type="checkbox" checked="checked" class="activated addyearspay">
|
||
<div>
|
||
<svg viewBox="0 0 44 44">
|
||
<path d="M14,24 L21,31 L39.7428882,11.5937758 C35.2809627,6.53125861 30.0333333,4 24,4 C12.95,4 4,12.95 4,24 C4,35.05 12.95,44 24,44 C35.05,44 44,35.05 44,24 C44,19.3 42.5809627,15.1645919 39.7428882,11.5937758" transform="translate(-2.000000, -2.000000)"></path>
|
||
</svg>
|
||
</div>
|
||
</label>
|
||
</div>
|
||
<span class="options-type">سنوات </span>
|
||
</div>
|
||
<div class="d-flex options-check col-lg-4 col-md-4 col-sm-3 col-xs-4">
|
||
|
||
<div class="checkbox-wrapper-2">
|
||
<label class="toggleButton">
|
||
<input type="checkbox" checked="checked" class="activated addbonusespay">
|
||
<div>
|
||
<svg viewBox="0 0 44 44">
|
||
<path d="M14,24 L21,31 L39.7428882,11.5937758 C35.2809627,6.53125861 30.0333333,4 24,4 C12.95,4 4,12.95 4,24 C4,35.05 12.95,44 24,44 C35.05,44 44,35.05 44,24 C44,19.3 42.5809627,15.1645919 39.7428882,11.5937758" transform="translate(-2.000000, -2.000000)"></path>
|
||
</svg>
|
||
</div>
|
||
</label>
|
||
</div>
|
||
<span class="options-type"> عیدی و پاداش </span>
|
||
</div>
|
||
<div class="d-flex options-check col-lg-4 col-md-4 col-sm-3 col-xs-4">
|
||
<div class="checkbox-wrapper-2">
|
||
<label class="toggleButton">
|
||
<input type="checkbox" checked="checked" class="activated addleavepay">
|
||
<div>
|
||
<svg viewBox="0 0 44 44">
|
||
<path d="M14,24 L21,31 L39.7428882,11.5937758 C35.2809627,6.53125861 30.0333333,4 24,4 C12.95,4 4,12.95 4,24 C4,35.05 12.95,44 24,44 C35.05,44 44,35.05 44,24 C44,19.3 42.5809627,15.1645919 39.7428882,11.5937758" transform="translate(-2.000000, -2.000000)"></path>
|
||
</svg>
|
||
</div>
|
||
</label>
|
||
</div>
|
||
<span class="options-type">مزد و مرخصی </span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
}
|
||
|
||
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-footer">
|
||
<a class="btn btn-rounded waves-effect waves-light bg-white" id="close" data-dismiss="modal">بستن</a>
|
||
<a href="#" id="btnSaveData" class="btn btn-rounded">ذخیره</a>
|
||
</div>
|
||
</fieldset>
|
||
|
||
</div>
|
||
<form asp-page="./Index" asp-page-handler="CreateLeftWork" id="createLeftWork" autocomplete="off"
|
||
method="post"
|
||
data-ajax="true"
|
||
data-callback=""
|
||
data-action="leftworkinsurance">
|
||
<div id="divAppendDataLeftWork">
|
||
<input type="hidden" asp-for="EmployeeId" value="@Model.EmployeeId" />
|
||
<input type="hidden" asp-for="IsDelete" />
|
||
|
||
</div>
|
||
|
||
@* <button type="submit" id="sendData" style="display: none"></button>*@
|
||
</form>
|
||
<script src="~/DadmehrSelect/dadmehr-select.js?v=1.2"></script>
|
||
<script>
|
||
|
||
$(document).ready(function () {
|
||
handleScroll();
|
||
isActived();
|
||
//handleCompanyScroll();
|
||
saveWorkshop();
|
||
});
|
||
$("#close , .close").on('click', function () {
|
||
$(".datepicker-container").hide();
|
||
});
|
||
|
||
|
||
$(".persianDateInput").on('keyup', function () {
|
||
if (event.which !== 8 && event.which !== 46) {
|
||
let value = $(this).val();
|
||
let lengthValue = value.length;
|
||
if (lengthValue === 4) {
|
||
value += '/'
|
||
}
|
||
if (lengthValue === 7) {
|
||
value += '/'
|
||
}
|
||
$(this).val(value);
|
||
}
|
||
});
|
||
|
||
$(".persianDateInput").on('blur', function () {
|
||
let value = $(this).val();
|
||
let lengthValue = value.length;
|
||
if (!dateValidCheck(this)) {
|
||
$(this).addClass("errored");
|
||
}
|
||
else {
|
||
$(this).removeClass("errored");
|
||
}
|
||
});
|
||
//$('.activated').prop('checked', true);
|
||
$('.activated').click(function () {
|
||
if (!$(this).prop('checked')) {
|
||
$(this).siblings("div").addClass("actived");
|
||
|
||
} else {
|
||
$(this).siblings("div").removeClass("actived");
|
||
}
|
||
})
|
||
|
||
|
||
|
||
let navTitle = $('.nav-title');
|
||
if (navTitle.text().trim() === 'نام شرکت') {
|
||
navTitle.addClass("disactive");
|
||
$('.position-code').prop('disabled', true);
|
||
}
|
||
$(".select-city").select2({
|
||
allowClear: true
|
||
});
|
||
|
||
//adding / between dates
|
||
//$(".date").mask("0000/00/00");
|
||
|
||
//this function is for disabling the first tab and adding a new row to the table of the first tab
|
||
checkcountRow();
|
||
|
||
//this code adds a new tab(with the content in it)...
|
||
function addTab(counter) {
|
||
var workshopId = @Model.WorkshopId;
|
||
var workshopName = '@Model.WorkshopName';
|
||
|
||
|
||
//the data in each tab...
|
||
let newTab = $('<div class="tab-pane" data-workshopId="' + workshopId + '" data-workshopName="' + workshopName + '"id="tab' + counter + '" data-pane="' + counter + '">' +
|
||
'<div class="pane-content">' +
|
||
'<div class="container">' +
|
||
'<div class="d-flex position-box row" >' +
|
||
'<div class="col-lg-2 col-md-2 col-sm-0 col-xs-0 hidden-sm"></div>' +
|
||
'<input type = "text" class="position-code col-lg-3 col-md-3 col-sm-3 col-xs-3" data-haspersonelcode="" placeholder = "شماره پرسنلی" >' +
|
||
'<div class="col-lg-7 col-md-7 col-sm-9 col-xs-9 select-container">' +
|
||
'<select class="form-control select-city input position-name" >' +
|
||
'<option value="0" > سمت </option>' +
|
||
'</select>' +
|
||
'</div>' +
|
||
'</div>' +
|
||
'<div class="d-flex date-box row">' +
|
||
'<input type="text" tabindex="1" class="persianDateInput date-input col-lg-3 col-md-12 col-sm-12 col-xs-12 date input2 start-date" id="start-date-' + counter + '" placeholder="تاریخ شروع بکار">' +
|
||
'<input type="text" tabindex="2" class="persianDateInput date-input col-lg-3 col-md-12 col-sm-12 col-xs-12 date input3 last-day" id="last-day-' + counter + '" placeholder="تاریخ آخرین روز کاری">' +
|
||
'<input type="text" tabindex="3" class="persianDateInput date-input col-lg-3 col-md-12 col-sm-12 col-xs-12 date input4 end-date" id="end-date-' + counter + '" placeholder="تاریخ ترک کار">' +
|
||
'<div class="empty-div-hidden col-sm-10 col-xs-10"></div>' +
|
||
'<button class="btn save">ثبت</button>' +
|
||
'</div>' +
|
||
'<div class="table-content row">' +
|
||
'<table class="table table-bordered table-striped workDate-table">' +
|
||
'<colgroup>' +
|
||
'<col style="width: 20px;">' +
|
||
'<col style="width: 140px;">' +
|
||
'<col style="width: 140px;">' +
|
||
'<col style="width: 140px;">' +
|
||
'<col class="col-remove" style="width: 5px;">' +
|
||
'<col style="width: 30px;">' +
|
||
'</colgroup>' +
|
||
'<thead>' +
|
||
'<tr>' +
|
||
'<th>#</th>' +
|
||
'<th>تاریخ شروع بکار</th>' +
|
||
'<th>تاریخ آخرین روز کاری</th>' +
|
||
'<th>تاریخ ترک کار</th>' +
|
||
'<th></th>' +
|
||
'<th class="text-small">روزهای کارکرد</th>' +
|
||
'</tr>' +
|
||
'</thead>' +
|
||
'<tbody>' +
|
||
'<tr>' +
|
||
'<td>1</td>' +
|
||
'<td></td>' +
|
||
'<td></td>' +
|
||
'<td></td>' +
|
||
'<td><i class="fa fa-trash trash trash-icon" aria-hidden="true"></i></td>' +
|
||
'<td></td>' +
|
||
'</tr>' +
|
||
'<tr>' +
|
||
'<td>2</td>' +
|
||
'<td></td>' +
|
||
'<td></td>' +
|
||
'<td></td>' +
|
||
'<td><i class="fa fa-trash trash trash-icon" aria-hidden="true"></i></td>' +
|
||
'<td></td>' +
|
||
'</tr>' +
|
||
'<tr>' +
|
||
'<td>3</td>' +
|
||
'<td></td>' +
|
||
'<td></td>' +
|
||
'<td></td>' +
|
||
'<td><i class="fa fa-trash trash trash-icon" aria-hidden="true"></i></td>' +
|
||
'<td></td>' +
|
||
'</tr>' +
|
||
'<tr>' +
|
||
'<td>4</td>' +
|
||
'<td></td>' +
|
||
'<td></td>' +
|
||
'<td></td>' +
|
||
'<td><i class="fa fa-trash trash trash-icon" aria-hidden="true"></i></td>' +
|
||
'<td></td>' +
|
||
'</tr>' +
|
||
'<tr>' +
|
||
'<td>5</td>' +
|
||
'<td></td>' +
|
||
'<td></td>' +
|
||
'<td></td>' +
|
||
'<td><i class="fa fa-trash trash trash-icon" aria-hidden="true"></i></td>' +
|
||
'<td></td>' +
|
||
'</tr>' +
|
||
'</tbody>' +
|
||
'</table>' +
|
||
'</div>' +
|
||
'<div class="options-box">' +
|
||
'<div class="options-info">در صورت تمایل به محاسبه ی عناوین ذیل در فیش حقوقی، گزینه های موردنظر را فعال نمایید</div>' +
|
||
'<div class="optional-wages d-flex">' +
|
||
'<div class="d-flex options-check col-lg-4 col-md-4 col-sm-3 col-xs-4">' +
|
||
'<div class="checkbox-wrapper-2">' +
|
||
'<label class="toggleButton">' +
|
||
'<input type="checkbox" class="activated addyearspay">' +
|
||
'<div>' +
|
||
'<svg viewBox="0 0 44 44">' +
|
||
'<path d="M14,24 L21,31 L39.7428882,11.5937758 C35.2809627,6.53125861 30.0333333,4 24,4 C12.95,4 4,12.95 4,24 C4,35.05 12.95,44 24,44 C35.05,44 44,35.05 44,24 C44,19.3 42.5809627,15.1645919 39.7428882,11.5937758" transform="translate(-2.000000, -2.000000)"></path>' +
|
||
'</svg>' +
|
||
'</div>' +
|
||
'</label>' +
|
||
'</div>' +
|
||
'<span class="options-type">سنوات </span>' +
|
||
'</div>' +
|
||
'<div class="d-flex options-check col-lg-4 col-md-4 col-sm-3 col-xs-4">' +
|
||
'<div class="checkbox-wrapper-2">' +
|
||
'<label class="toggleButton">' +
|
||
'<input type="checkbox" class="activated addbonusespay">' +
|
||
'<div>' +
|
||
'<svg viewBox="0 0 44 44">' +
|
||
'<path d="M14,24 L21,31 L39.7428882,11.5937758 C35.2809627,6.53125861 30.0333333,4 24,4 C12.95,4 4,12.95 4,24 C4,35.05 12.95,44 24,44 C35.05,44 44,35.05 44,24 C44,19.3 42.5809627,15.1645919 39.7428882,11.5937758" transform="translate(-2.000000, -2.000000)"></path>' +
|
||
'</svg>' +
|
||
'</div>' +
|
||
'</label>' +
|
||
'</div>' +
|
||
'<span class="options-type"> عیدی و پاداش </span>' +
|
||
'</div>' +
|
||
'<div class="d-flex options-check col-lg-4 col-md-4 col-sm-3 col-xs-4">' +
|
||
'<div class="checkbox-wrapper-2">' +
|
||
'<label class="toggleButton">' +
|
||
'<input type="checkbox" class="activated addleavepay">' +
|
||
'<div>' +
|
||
'<svg viewBox="0 0 44 44">' +
|
||
'<path d="M14,24 L21,31 L39.7428882,11.5937758 C35.2809627,6.53125861 30.0333333,4 24,4 C12.95,4 4,12.95 4,24 C4,35.05 12.95,44 24,44 C35.05,44 44,35.05 44,24 C44,19.3 42.5809627,15.1645919 39.7428882,11.5937758" transform="translate(-2.000000, -2.000000)"></path>' +
|
||
'</svg>' +
|
||
'</div>' +
|
||
'</label>' +
|
||
'</div>' +
|
||
'<span class="options-type">مزد و مرخصی </span>' +
|
||
'</div>' +
|
||
'</div>' +
|
||
'</div>' +
|
||
'</div>' +
|
||
'</div>' +
|
||
'</div>');
|
||
$(".tab-content").prepend(newTab);
|
||
isActived();
|
||
$('.activated').click(function () {
|
||
if (!$(this).prop('checked')) {
|
||
$(this).siblings("div").addClass("actived");
|
||
|
||
} else {
|
||
$(this).siblings("div").removeClass("actived");
|
||
}
|
||
|
||
})
|
||
|
||
// $('.activated').prop('checked', true);
|
||
let endDateInput = newTab.find('.end-date');
|
||
let startDateInput = newTab.find('.start-date');
|
||
|
||
var selectItem = $('.tab-pane.active').find('.select-city');
|
||
selectItem.select2();
|
||
getPersonelCode(workshopId);
|
||
|
||
@if (Model.LeftWorkGroups == null)
|
||
{
|
||
<text>getWorkshopInformation(workshopId);</text>
|
||
}
|
||
//this code checks the date in keyup function...
|
||
$(".date").keyup(function () {
|
||
let value = $(this).val();
|
||
let lengthValue = value.length;
|
||
let id = $(this).attr('id');
|
||
if (lengthValue == 10) {
|
||
if (!dateValidCheck(this)) {
|
||
$(this).addClass("errored");
|
||
}
|
||
else {
|
||
$(this).removeClass("errored");
|
||
|
||
if (id == 'last-day-' + counter) {
|
||
setDate(value, 'last-day-' + counter, 'end-date-' + counter, true);
|
||
}
|
||
else if (id == 'end-date-' + counter) {
|
||
setDate(value, 'end-date-' + counter, 'end-date-' + counter, false);
|
||
}
|
||
}
|
||
}
|
||
});
|
||
|
||
//the save button in the new tab...
|
||
newTab.find('.save').click(function (e) {
|
||
|
||
e.preventDefault();
|
||
let paneNumber = newTab.data('pane');
|
||
let startDate = $('#start-date-' + paneNumber).val();
|
||
let lastDay = $('#last-day-' + paneNumber).val();
|
||
let endDate = $('#end-date-' + paneNumber).val();
|
||
|
||
if (startDate != '' && !checkLength($('#start-date-' + counter).val(), 10)) {
|
||
if (!dateValidCheckByValue($('#start-date-' + counter))) {
|
||
$('#start-date-' + counter).addClass("errored");
|
||
} else {
|
||
$('#start-date-' + counter).removeClass("errored");
|
||
}
|
||
|
||
}
|
||
if (lastDay != '' && !checkLength($('#last-day-' + counter).val(), 10)) {
|
||
if (!dateValidCheckByValue($('#start-date-' + counter))) {
|
||
$('#last-day-' + counter).addClass("errored");
|
||
} else {
|
||
$('#last-day-' + counter).removeClass("errored");
|
||
}
|
||
|
||
}
|
||
if (endDate != '' && !checkLength($('#end-date-' + counter).val(), 10)) {
|
||
if (!dateValidCheckByValue($('#end-date-' + counter))) {
|
||
$('#end-date-' + counter).addClass("errored");
|
||
} else {
|
||
$('#end-date-' + counter).removeClass("errored");
|
||
}
|
||
}
|
||
if (!$('.date').hasClass('errored')) {
|
||
addRow2(counter, startDate, lastDay, endDate);
|
||
disableInput();
|
||
handleScroll();
|
||
$('#start-date-' + paneNumber).val("");
|
||
$('#last-day-' + paneNumber).val("");
|
||
$('#end-date-' + paneNumber).val("");
|
||
|
||
}
|
||
});
|
||
}
|
||
|
||
|
||
|
||
//this code handles the first button(for adding new tabs)
|
||
function saveWorkshop() {
|
||
var counter = 1; // start counter from 2 since we already have one tab
|
||
// $('#save1').on('click', function (e) {
|
||
// e.preventDefault();
|
||
var workshopId = @Model.WorkshopId;
|
||
if (workshopId != '0') {
|
||
|
||
$("#IsDelete").val('false');
|
||
// var workshopId=$('#input1').val();
|
||
var workshopname = '@Model.WorkshopName'//$('#input1 option:selected').text();
|
||
|
||
|
||
let navLink = $('.nav-link');
|
||
let navTitle = navLink.find('.nav-title');
|
||
|
||
//if there was only one tab...
|
||
|
||
$('#tab-1').attr("data-workshopId", workshopId);
|
||
$('#tab-1').attr("data-workshopname", workshopname);
|
||
navTitle.text(workshopname);
|
||
navTitle.removeClass("disactive");
|
||
navTitle.addClass("active");
|
||
// $('#input1').val('0').trigger('change');
|
||
getPersonelCode(workshopId);
|
||
@if (Model.LeftWorkGroups == null)
|
||
{
|
||
<text>getWorkshopInformation(workshopId);</text>
|
||
}
|
||
|
||
|
||
}
|
||
|
||
handleScroll();
|
||
|
||
$(".workDate-table .trash-icon").on("mouseenter", function () {
|
||
$(this).animate({ left: "-2px" }, 50)
|
||
.animate({ left: "2px" }, 50)
|
||
.animate({ left: "0px" }, 50);
|
||
});
|
||
//});
|
||
|
||
}
|
||
|
||
//this code handles the second button(for adding data in the first tabs table)
|
||
$(function () {
|
||
$('#save').on('click', function (e) {
|
||
e.preventDefault();
|
||
let activeTabPane = $('.tab-pane.active');
|
||
let date1 = $('#startDate1').val();
|
||
let date2 = $('#lastDay1').val();
|
||
let date3 = $('#endDate1').val();
|
||
let positionCode = $('.position-code').val();
|
||
let positionName = $(".position-name").val();
|
||
if (positionCode == "") {
|
||
$('.position-code').addClass("errored");
|
||
} else {
|
||
$('.position-code').removeClass("errored");
|
||
}
|
||
if (positionName == 0) {
|
||
$('.position-name').addClass("errored");
|
||
} else {
|
||
$('.position-name').addClass("errored");
|
||
}
|
||
if (date1 != '' && !checkLength($('#startDate1').val(), 10)) {
|
||
if (!dateValidCheckByValue($('#startDate1'))) {
|
||
$('#startDate1').addClass("errored");
|
||
} else {
|
||
$('#startDate1').removeClass("errored");
|
||
}
|
||
|
||
}
|
||
if (date2 != '' && !checkLength($('#lastDay1').val(), 10)) {
|
||
if (!dateValidCheckByValue($('#lastDay1'))) {
|
||
$('#lastDay1').addClass("errored");
|
||
} else {
|
||
$('#lastDay1').removeClass("errored");
|
||
}
|
||
|
||
}
|
||
if (date3 != '' && !checkLength($('#endDate1').val(), 10)) {
|
||
if (!dateValidCheckByValue($('#endDate1'))) {
|
||
$('#endDate1').addClass("errored");
|
||
} else {
|
||
$('#endDate1').removeClass("errored");
|
||
}
|
||
|
||
}
|
||
|
||
|
||
if (!$('.date').hasClass('errored')) {
|
||
addRow(date1, date2, date3);
|
||
handleScroll();
|
||
disableInput();
|
||
}
|
||
|
||
|
||
});
|
||
});
|
||
|
||
|
||
// Add the click event listener to the new tab link
|
||
$('.nav-tabs .nav-link').on('click', function (e) {
|
||
e.preventDefault();
|
||
updateRowNumbers();
|
||
const $tab = $(this);
|
||
const target = $tab.attr('href');
|
||
$('.nav-tabs .nav-link, .tab-pane').removeClass('active');
|
||
$tab.addClass('active');
|
||
$(target).addClass('active');
|
||
|
||
var selectItem = $('.tab-pane.active').find('.select-city');
|
||
selectItem.select2();
|
||
handleScroll();
|
||
disableInput();
|
||
});
|
||
//checkPremision();
|
||
|
||
|
||
|
||
|
||
//handleCompanyScroll();
|
||
//this code checks the rows, if there are empty rows,they will be filled, and if there is none, a new row will be added
|
||
let addRow = (date1, date2, date3) => {
|
||
let activeTabPane = $('.tab-pane.active');
|
||
let table = activeTabPane.find('.workDate-table');
|
||
let conflictFound = false;
|
||
|
||
table.find("tbody tr").each(function () {
|
||
let row = $(this);
|
||
let rowStartDate = row.find('td:eq(1)').text(); // Get the start date of the row
|
||
let rowEndDate = row.find('td:eq(3)').text(); // Get the end date of the row
|
||
|
||
|
||
|
||
const $existingDate1 = row.find('td:eq(1):contains("' + date1 + '")');
|
||
|
||
if (date1 != '' && $existingDate1.length > 0) {
|
||
$.Notification.autoHideNotify('error', 'top right', 'پیام سیستم ', 'تاریخ شروع در ردیف ' + row.find('td:eq(0)').text() + ' وارد شده است.');
|
||
$('#startDate1').addClass("errored");
|
||
conflictFound = true;
|
||
return;
|
||
}
|
||
|
||
const $existingDate2 = row.find('td:eq(3):contains("' + date1 + '")');
|
||
if (date1 != '' && $existingDate2.length > 0) {
|
||
$.Notification.autoHideNotify('error', 'top right', 'پیام سیستم ', 'تاریخ شروع با تاریخ پایان در ردیف ' + row.find('td:eq(0)').text() + ' برابر است.');
|
||
$('#startDate1').addClass("errored");
|
||
conflictFound = true;
|
||
return;
|
||
}
|
||
|
||
|
||
const $existingDate3 = row.find('td:eq(3):contains("' + date3 + '")');
|
||
if (date3 != '' && $existingDate3.length > 0) {
|
||
$.Notification.autoHideNotify('error', 'top right', 'پیام سیستم ', 'تاریخ پایان در ردیف ' + row.find('td:eq(0)').text() + ' وارد شده است.');
|
||
$('#lastDay1').addClass("errored");
|
||
conflictFound = true;
|
||
return;
|
||
}
|
||
|
||
const $existingDate4 = row.find('td:eq(1):contains("' + date3 + '")');
|
||
if (date3 != '' && $existingDate4.length > 0) {
|
||
$.Notification.autoHideNotify('error', 'top right', 'پیام سیستم ', 'تاریخ پایان با تاریخ شروع در ردیف ' + row.find('td:eq(0)').text() + ' برابر است.');
|
||
$('#endDate1').addClass("errored");
|
||
conflictFound = true;
|
||
return;
|
||
}
|
||
const $existingDate5 = row.find('td:eq(1):contains("' + date2 + '")');
|
||
if (date2 != '' && $existingDate5.length > 0) {
|
||
$.Notification.autoHideNotify('error', 'top right', 'پیام سیستم ', 'تاریخ آخرین روز کاری با تاریخ شروع در ردیف ' + row.find('td:eq(0)').text() + ' برابر است.');
|
||
$('#lastDay1').addClass("errored");
|
||
conflictFound = true;
|
||
return;
|
||
}
|
||
|
||
if (rowStartDate != '' && date3 != '' && date3 > rowStartDate && date3 < rowEndDate) {
|
||
$.Notification.autoHideNotify('error', 'top right', 'پیام سیستم ', 'تاریخ پایان با توجه به بازه وارد شده در ردیف ' + row.find('td:eq(0)').text() + ' نادرست می باشد.');
|
||
$('#lastDay1').addClass("errored");
|
||
conflictFound = true;
|
||
return false;
|
||
}
|
||
|
||
if (rowStartDate != '' && date3 != '' && rowEndDate == '' && date3 < rowStartDate) {
|
||
$.Notification.autoHideNotify('error', 'top right', 'پیام سیستم ', 'تاریخ پایان با توجه به بازه وارد شده در ردیف ' + row.find('td:eq(0)').text() + ' نادرست می باشد.');
|
||
$('#lastDay1').addClass("errored");
|
||
conflictFound = true;
|
||
return false;
|
||
}
|
||
|
||
if (rowStartDate != '' && date1 != '' && date1 > rowStartDate && date1 < rowEndDate) {
|
||
$.Notification.autoHideNotify('error', 'top right', 'پیام سیستم ', 'تاریخ شروع با توجه به بازه وارد شده در ردیف ' + row.find('td:eq(0)').text() + ' نادرست می باشد.');
|
||
$('#startDate1').addClass("errored");
|
||
conflictFound = true;
|
||
return false;
|
||
}
|
||
|
||
|
||
});
|
||
if (!conflictFound) {
|
||
let emptyRow = table.find("tbody tr td:empty:first").closest('tr');
|
||
if (emptyRow.length > 0) {
|
||
|
||
if (date1 != '')
|
||
emptyRow.children('td:eq(1)').text(date1);
|
||
if (date2 != '')
|
||
emptyRow.children('td:eq(2)').text(date2);
|
||
if (date3 != '')
|
||
emptyRow.children('td:eq(3)').text(date3);
|
||
emptyRow.children('td:eq(5)').text("_");
|
||
|
||
|
||
}
|
||
if (emptyRow.length === 0 && !conflictFound) {
|
||
let rowCount = table.find("tbody tr").length;
|
||
let newRow = '<tr>' +
|
||
'<td>' + (rowCount + 1) + '</td>' +
|
||
'<td>' + date1 + '</td>' +
|
||
'<td>' + date2 + '</td>' +
|
||
'<td>' + date3 + '</td>' +
|
||
'<td>' + '<i class="fa fa-trash trash trash-icon" aria-hidden="true"></i>' + '</td>' +
|
||
'<td>' + "_" + '</td>' +
|
||
'</tr>';
|
||
table.find("tbody").append(newRow);
|
||
disableInput();
|
||
|
||
|
||
}
|
||
sortDates();
|
||
updateRowNumbers();
|
||
|
||
$('#startDate1').val("");
|
||
$('#lastDay1').val("");
|
||
$('#endDate1').val("");
|
||
}
|
||
|
||
}
|
||
|
||
//this code is like addRow for the tabs except the first tab
|
||
let addRow2 = (counter, date1, date2, date3) => {
|
||
let activeTabPane = $('.tab-pane.active');
|
||
let table = activeTabPane.find('.workDate-table');
|
||
let tableRow = table.find('tbody tr');
|
||
let emptyRow = table.find("tbody tr td:empty:first").closest('tr');
|
||
|
||
let startDate = activeTabPane.find('.input2');
|
||
let lastDay = activeTabPane.find('.input3');
|
||
let endDate = activeTabPane.find('.input4');
|
||
|
||
|
||
let conflictFound = false;
|
||
tableRow.each(function () {
|
||
let row = $(this);
|
||
let rowStartDate = row.find('td:eq(1)').text();
|
||
let rowEndDate = row.find('td:eq(3)').text();
|
||
const $existingDate1 = row.find('td:eq(1):contains("' + date1 + '")');
|
||
if (date1 != '' && $existingDate1.length > 0) {
|
||
$.Notification.autoHideNotify('error', 'top right', 'پیام سیستم ', 'تاریخ شروع در ردیف ' + row.find('td:eq(0)').text() + ' وارد شده است.');
|
||
startDate.addClass("errored");
|
||
conflictFound = true;
|
||
return;
|
||
}
|
||
|
||
const $existingDate2 = row.find('td:eq(3):contains("' + date1 + '")');
|
||
if (date1 != '' && $existingDate2.length > 0) {
|
||
$.Notification.autoHideNotify('error', 'top right', 'پیام سیستم ', 'تاریخ شروع با تاریخ پایان در ردیف ' + row.find('td:eq(0)').text() + ' برابر است.');
|
||
startDate.addClass("errored");
|
||
conflictFound = true;
|
||
return;
|
||
}
|
||
|
||
|
||
const $existingDate3 = row.find('td:eq(3):contains("' + date2 + '")');
|
||
if (date2 != '' && $existingDate3.length > 0) {
|
||
$.Notification.autoHideNotify('error', 'top right', 'پیام سیستم ', 'تاریخ پایان در ردیف ' + row.find('td:eq(0)').text() + ' وارد شده است.');
|
||
lastDay.addClass("errored");
|
||
|
||
conflictFound = true;
|
||
return;
|
||
}
|
||
|
||
const $existingDate4 = row.find('td:eq(1):contains("' + date2 + '")');
|
||
if (date2 != '' && $existingDate4.length > 0) {
|
||
$.Notification.autoHideNotify('error', 'top right', 'پیام سیستم ', 'تاریخ آخرین روز کاری با تاریخ شروع در ردیف ' + row.find('td:eq(0)').text() + ' برابر است.');
|
||
lastDay.addClass("errored");
|
||
|
||
conflictFound = true;
|
||
return;
|
||
}
|
||
const $existingDate5 = row.find('td:eq(1):contains("' + date3 + '")');
|
||
if (date3 != '' && $existingDate5.length > 0) {
|
||
$.Notification.autoHideNotify('error', 'top right', 'پیام سیستم ', 'تاریخ پایان با تاریخ شروع در ردیف ' + row.find('td:eq(0)').text() + ' برابر است.');
|
||
endDate.addClass("errored");
|
||
|
||
conflictFound = true;
|
||
return;
|
||
}
|
||
|
||
if (rowStartDate != '' && date2 != '' && date2 > rowStartDate && date2 < rowEndDate) {
|
||
$.Notification.autoHideNotify('error', 'top right', 'پیام سیستم ', 'تاریخ پایان با توجه به بازه وارد شده در ردیف ' + row.find('td:eq(0)').text() + ' نادرست می باشد.');
|
||
lastDay.addClass("errored");
|
||
|
||
conflictFound = true;
|
||
return false;
|
||
}
|
||
|
||
if (rowStartDate != '' && date1 != '' && date1 > rowStartDate && date1 < rowEndDate) {
|
||
$.Notification.autoHideNotify('error', 'top right', 'پیام سیستم ', 'تاریخ شروع با توجه به بازه وارد شده در ردیف ' + row.find('td:eq(0)').text() + ' نادرست می باشد.');
|
||
startDate.addClass("errored");
|
||
conflictFound = true;
|
||
return false;
|
||
}
|
||
|
||
if (rowStartDate != '' && date2 != '' && rowEndDate == '' && date2 < rowStartDate) {
|
||
$.Notification.autoHideNotify('error', 'top right', 'پیام سیستم ', 'تاریخ پایان با توجه به بازه وارد شده در ردیف ' + row.find('td:eq(0)').text() + ' نادرست می باشد.');
|
||
lastDay.addClass("errored");
|
||
|
||
conflictFound = true;
|
||
return false;
|
||
}
|
||
|
||
});
|
||
if (!conflictFound) {
|
||
let emptyRow = table.find("tbody tr td:empty:first").closest('tr');
|
||
|
||
if (emptyRow.length > 0) {
|
||
if (date1 != '')
|
||
emptyRow.children('td:eq(1)').text(date1);
|
||
if (date2 != '')
|
||
emptyRow.children('td:eq(2)').text(date2);
|
||
if (date3 != '')
|
||
emptyRow.children('td:eq(3)').text(date3);
|
||
emptyRow.children('td:eq(5)').text("_");
|
||
|
||
}
|
||
if (emptyRow.length === 0) {
|
||
let rowCount = table.find("tbody tr").length;
|
||
let newRow = '<tr>' +
|
||
'<td>' + (rowCount + 1) + '</td>' +
|
||
'<td>' + date1 + '</td>' +
|
||
'<td>' + date2 + '</td>' +
|
||
'<td>' + date3 + '</td>' +
|
||
'<td>' + '<i class="fa fa-trash trash trash-icon" aria-hidden="true"></i>' + '</td>' +
|
||
'<td>' + "_" + '</td>' +
|
||
'</tr>';
|
||
table.find("tbody").append(newRow);
|
||
disableInput();
|
||
|
||
}
|
||
|
||
sortDates();
|
||
updateRowNumbers();
|
||
}
|
||
$('.trash').click(function () {
|
||
let activeTabPane = $('.tab-pane.active');
|
||
let rows = activeTabPane.find(".workDate-table tbody").find("tr");
|
||
let rowCount = rows.length;
|
||
if (rowCount === 6) {
|
||
$('.table-content').addClass('hide-scrollbar');
|
||
}
|
||
if (rowCount <= 5) {
|
||
let deletedRow = $(this).closest('tr');
|
||
deletedRow.find('td:eq(5)').text("");
|
||
deletedRow.find('td:eq(3)').text("");
|
||
deletedRow.find('td:eq(2)').text("");
|
||
deletedRow.find('td:eq(1)').text("");
|
||
}
|
||
if (rowCount > 5) {
|
||
$(this).closest('tr').fadeOut(200, function () {
|
||
$(this).remove();
|
||
updateRowNumbers();
|
||
});
|
||
}
|
||
|
||
});
|
||
|
||
|
||
|
||
}
|
||
|
||
//this code checks the row number
|
||
let updateRowNumbers = () => {
|
||
|
||
let activeTabPane = $('.tab-pane.active');
|
||
let rows = activeTabPane.find(".workDate-table tbody").find("tr");
|
||
rows.each(function (index) {
|
||
$(this).find("td:first-child").text(index + 1);
|
||
});
|
||
}
|
||
|
||
//this code sorts the table based on the second date column in descending order
|
||
function sortDates() {
|
||
let activeTabPane = $('.tab-pane.active');
|
||
let table = activeTabPane.find('.workDate-table');
|
||
var rows = table.find('tr:gt(0)').toArray();
|
||
rows.sort(function (a, b) {
|
||
var date1a = new Date($(a).find('td:eq(1)').text().replace(/\//g, '-'));
|
||
var date1b = new Date($(b).find('td:eq(1)').text().replace(/\//g, '-'));
|
||
return date1b - date1a;
|
||
});
|
||
for (var i = 0; i < rows.length; i++) {
|
||
table.append(rows[i]);
|
||
}
|
||
}
|
||
|
||
//date keyup for tab-1
|
||
$(".date").keyup(function () {
|
||
let value = $(this).val();
|
||
let lengthValue = value.length;
|
||
let id = $(this).attr('id');
|
||
|
||
|
||
if (lengthValue == 10) {
|
||
if (!dateValidCheck(this)) {
|
||
$(this).addClass("errored");
|
||
}
|
||
else {
|
||
$(this).removeClass("errored");
|
||
|
||
if (id == 'lastDay1') {
|
||
setDate(value, 'lastDay1', 'endDate1', true);
|
||
}
|
||
else if (id == 'endDate1') {
|
||
setDate(value, 'endDate1', 'lastDay1', false);
|
||
}
|
||
}
|
||
}
|
||
});
|
||
//date keyup for tab-except1
|
||
$(".date").keyup(function () {
|
||
let value = $(this).val();
|
||
let lengthValue = value.length;
|
||
let activeTabPane = $('.tab-pane.active');
|
||
let startDate = activeTabPane.find('.input2');
|
||
let lastDay = activeTabPane.find('.input3');
|
||
let endDate = activeTabPane.find('.input4');
|
||
|
||
let endDateId = endDate.attr('id');
|
||
let lastDateId = lastDay.attr('id');
|
||
let id = $(this).attr('id');
|
||
|
||
|
||
if (lengthValue == 10) {
|
||
if (!dateValidCheck(this)) {
|
||
$(this).addClass("errored");
|
||
}
|
||
else {
|
||
$(this).removeClass("errored");
|
||
|
||
if (id == lastDateId) {
|
||
setDate(value, lastDateId, endDateId, true);
|
||
}
|
||
else if (id == endDateId) {
|
||
setDate(value, endDateId, lastDateId, false);
|
||
}
|
||
}
|
||
}
|
||
});
|
||
|
||
function setDate(value, fieldIdInput, fieldIdResult, islastDay) {
|
||
|
||
let urlPost = '';
|
||
|
||
if (islastDay == true) {
|
||
urlPost = '@Url.Page("/Company/Employees/Index", "AfterDate")';
|
||
}
|
||
else {
|
||
urlPost = '@Url.Page("/Company/Employees/Index", "BeforeDate")';
|
||
}
|
||
$.ajax({
|
||
/* contentType: 'charset=utf-8',*/
|
||
dataType: 'json',
|
||
type: 'POST',
|
||
url: urlPost,
|
||
headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() },
|
||
data: { "date": value },
|
||
success: function (response) {
|
||
|
||
|
||
$('#' + fieldIdResult).val(response.resultDate);
|
||
},
|
||
failure: function (response) {
|
||
//console.log(5, response);
|
||
}
|
||
|
||
});
|
||
}
|
||
|
||
|
||
$("#btnSaveData").click(function () {
|
||
$(".input-send-data").remove();
|
||
|
||
$(".tab-pane").each(function (i) {
|
||
var workshopid = $(this).attr("data-workshopid");
|
||
var workshopName = $(this).attr("data-workshopName");
|
||
var employeeId = @Model.EmployeeId;
|
||
var personnelCode = $(this).find('input.position-code');
|
||
var jobId = $(this).find('.ul-search').find('span.value').attr('data-value');
|
||
var includeStatus = $(this).find('input[type=checkbox]').is(":checked");
|
||
var addBonusesPay = $(this).find('input.addbonusespay').is(":checked");
|
||
var addYearsPay = $(this).find('input.addyearspay').is(":checked");
|
||
var addLeavePay = $(this).find('input.addleavepay').is(":checked");
|
||
|
||
|
||
|
||
|
||
// console.log(jobId);
|
||
|
||
var haspersonelcode = personnelCode.attr("data-haspersonelcode");
|
||
|
||
if (haspersonelcode.toLowerCase() != "true") {
|
||
$("#divAppendDataLeftWork").append('<input class="input-send-data" type="hidden" name="PersonnelCode[' + i + '].HasPersonelCode" id="PersonnelCode_' + i + '__HasPersonelCode" value="true" />');
|
||
$("#divAppendDataLeftWork").append('<input class="input-send-data" type="hidden" name="PersonnelCode[' + i + '].WorkshopId" id="PersonnelCode_' + i + '__WorkshopId" value="' + workshopid + '" />');
|
||
$("#divAppendDataLeftWork").append('<input class="input-send-data" type="hidden" name="PersonnelCode[' + i + '].EmployeeId" id="PersonnelCode_' + i + '__EmployeeId" value="' + employeeId + '" />');
|
||
$("#divAppendDataLeftWork").append('<input class="input-send-data" type="hidden" name="PersonnelCode[' + i + '].PersonnelCode" id="PersonnelCode_' + i + '__PersonnelCode" value="' + personnelCode.val() + '" />');
|
||
$("#divAppendDataLeftWork").append('<input class="input-send-data" type="hidden" name="PersonnelCode[' + i + '].WorkShopName" id="PersonnelCode_' + i + '__WorkShopName" value="' + workshopName + '" />');
|
||
}
|
||
|
||
var index2 = 0;
|
||
$(this).find('table tr').each(function (x) {
|
||
var leftWorkDate = $(this).find('td:eq(3)').text().trim();
|
||
var startWorkDate = $(this).find('td:eq(1)').text().trim();
|
||
var employeeId = @Model.EmployeeId;
|
||
|
||
// console.log(leftWorkDate);
|
||
|
||
if (startWorkDate != '') {
|
||
$("#divAppendDataLeftWork").append('<input class="input-send-data" type="hidden" name="LeftWorkGroups[' + i + '].WorkshopId" id="LeftWorkGroups_' + i + '__WorkshopId" value="' + workshopid + '" />');
|
||
$("#divAppendDataLeftWork").append('<input class="input-send-data" type="hidden" name="LeftWorkGroups[' + i + '].LeftworkViewModels[' + index2 + '].WorkshopId" id="LeftWorkGroups_' + i + '__LeftworkViewModels_' + index2 + '__WorkshopId" value="' + workshopid + '" />');
|
||
$("#divAppendDataLeftWork").append('<input class="input-send-data" type="hidden" name="LeftWorkGroups[' + i + '].LeftworkViewModels[' + index2 + '].EmployeeId" id="LeftWorkGroups_' + i + '__LeftworkViewModels_' + index2 + '__EmployeeId" value="' + employeeId + '" />');
|
||
$("#divAppendDataLeftWork").append('<input class="input-send-data" type="hidden" name="LeftWorkGroups[' + i + '].LeftworkViewModels[' + index2 + '].WorkshopName" id="LeftWorkGroups_' + i + '__LeftworkViewModels_' + index2 + '__WorkshopName" value="' + workshopName + '" />');
|
||
$("#divAppendDataLeftWork").append('<input class="input-send-data" type="hidden" name="LeftWorkGroups[' + i + '].LeftworkViewModels[' + index2 + '].StartWorkDate" id="LeftWorkGroups_' + i + '__LeftworkViewModels_' + index2 + '__StartWorkDate" value="' + startWorkDate + '" />');
|
||
$("#divAppendDataLeftWork").append('<input class="input-send-data" type="hidden" name="LeftWorkGroups[' + i + '].LeftworkViewModels[' + index2 + '].LeftWorkDate" id="LeftWorkGroups_' + i + '__LeftworkViewModels_' + index2 + '__LeftWorkDate" value="' + leftWorkDate + '" />');
|
||
$("#divAppendDataLeftWork").append('<input class="input-send-data" type="hidden" name="LeftWorkGroups[' + i + '].LeftworkViewModels[' + index2 + '].JobId" id="LeftWorkGroups_' + i + '__LeftworkViewModels_' + index2 + '__JobId" value="' + jobId + '" />');
|
||
$("#divAppendDataLeftWork").append('<input class="input-send-data" type="hidden" name="LeftWorkGroups[' + i + '].LeftworkViewModels[' + index2 + '].IncludeStatus" id="LeftWorkGroups_' + i + '__LeftworkViewModels_' + index2 + '__IncludeStatus" value="' + includeStatus + '" />');
|
||
$("#divAppendDataLeftWork").append('<input class="input-send-data" type="hidden" name="LeftWorkGroups[' + i + '].LeftworkViewModels[' + index2 + '].AddBonusesPay" id="LeftWorkGroups_' + i + '__LeftworkViewModels_' + index2 + '__AddBonusesPay" value="' + addBonusesPay + '" />');
|
||
$("#divAppendDataLeftWork").append('<input class="input-send-data" type="hidden" name="LeftWorkGroups[' + i + '].LeftworkViewModels[' + index2 + '].AddYearsPay" id="LeftWorkGroups_' + i + '__LeftworkViewModels_' + index2 + '__AddYearsPay" value="' + addYearsPay + '" />');
|
||
$("#divAppendDataLeftWork").append('<input class="input-send-data" type="hidden" name="LeftWorkGroups[' + i + '].LeftworkViewModels[' + index2 + '].AddLeavePay" id="LeftWorkGroups_' + i + '__LeftworkViewModels_' + index2 + '__AddLeavePay" value="' + addLeavePay + '" />');
|
||
|
||
//$("#divAppendData").append('<input type="hidden" name="LeftWorkGroups['+i+'].LeftworkViewModels['+x+'].EmployeeFullName" id="LeftWorkGroups_'+i+'__LeftworkViewModels_'+x+'__EmployeeFullName" value="'+leftWorkDate+'" />');
|
||
index2 = index2 + 1;
|
||
}
|
||
});
|
||
});
|
||
|
||
// $('#sendData').click();
|
||
$("#createLeftWork").submit();
|
||
});
|
||
|
||
|
||
|
||
$('#createLeftWork').submit(function (e) {
|
||
e.preventDefault();
|
||
e.stopImmediatePropagation();
|
||
$.ajax({
|
||
type: "POST",
|
||
url: $(this).attr('action'),
|
||
data: $(this).serialize(),
|
||
success: function (response) {
|
||
if (response.isSuccedded == true) {
|
||
$.Notification.autoHideNotify('success', 'top right', response.message);
|
||
$("#MainModal").modal('hide');
|
||
$(".datepicker-container").hide();
|
||
getEmployeeList();
|
||
}
|
||
else {
|
||
$.Notification.autoHideNotify('error', 'top right', response.message);
|
||
}
|
||
}
|
||
});
|
||
return false;
|
||
});
|
||
|
||
|
||
|
||
|
||
|
||
function checkcountRow() {
|
||
|
||
$(".tab-pane").each(function () {
|
||
var tab = $(this);
|
||
var table = $(this).find('table');
|
||
table.find('tr').each(function (x) {
|
||
var leftWorkDate = $(this).find('td:eq(3)').text().trim();
|
||
var startWorkDate = $(this).find('td:eq(1)').text().trim();
|
||
disableInput();
|
||
});
|
||
|
||
var trCount = $(this).find('table tr').length - 1;
|
||
var newRowNumber = 5 - trCount;
|
||
if (trCount < 5) {
|
||
for (var index = 0; index < newRowNumber; index++) {
|
||
let newRow = '<tr>' +
|
||
'<td>' + (trCount + index + 1) + '</td>' +
|
||
'<td></td>' +
|
||
'<td></td>' +
|
||
'<td></td>' +
|
||
'<td>' + '<i class="fa fa-trash trash trash-icon" aria-hidden="true"></i>' + '</td>' +
|
||
'<td></td>' +
|
||
'</tr>';
|
||
table.find("tbody").append(newRow);
|
||
}
|
||
|
||
}
|
||
|
||
});
|
||
sortDates();
|
||
handleScroll();
|
||
|
||
}
|
||
//this function handles the show or hide of the scrollbar
|
||
function handleScroll() {
|
||
let activeTabPane = $('.tab-pane.active');
|
||
let rows = activeTabPane.find(".workDate-table tbody").find("tr");
|
||
let rowCount = rows.length;
|
||
let content = activeTabPane.find('.table-content');
|
||
if (rowCount > 5) {
|
||
content.removeClass('hide-scrollbar');
|
||
} else {
|
||
content.addClass('hide-scrollbar');
|
||
}
|
||
}
|
||
function isActived() {
|
||
let activeTabPane = $('.tab-pane.active');
|
||
let checked = activeTabPane.find('.activated');
|
||
checked.each(function () {
|
||
if (!checked.prop('checked')) {
|
||
console.log(3);
|
||
$(this).siblings("div").addClass("actived");
|
||
|
||
} else {
|
||
console.log(4);
|
||
$(this).siblings("div").removeClass("actived");
|
||
}
|
||
});
|
||
}
|
||
|
||
|
||
|
||
//this function handles the show or hide of the scrollbar of the company titles
|
||
//function handleCompanyScroll() {
|
||
// if ($('.nav-tabs a').length <= 4) {
|
||
// $('.nav-tabs').addClass('hide-scrollbar');
|
||
// } else {
|
||
// $('.nav-tabs').removeClass('hide-scrollbar');
|
||
// }
|
||
//}
|
||
|
||
// this function disable/enable the input fields based on the data in the table
|
||
function disableInput() {
|
||
let activeTabPane = $('.tab-pane.active');
|
||
let table = activeTabPane.find(".workDate-table tbody").get(0);
|
||
let navLink = $('.nav-link');
|
||
let navTitle = navLink.find('.nav-title');
|
||
|
||
|
||
let firstColumnData = Array.from(table.rows)
|
||
.map(row => row.cells[1].textContent.trim())
|
||
.filter(cellValue => cellValue !== "");
|
||
|
||
|
||
let secondColumnData = Array.from(table.rows)
|
||
.map(row => row.cells[2].textContent.trim())
|
||
.filter(cellValue => cellValue !== "");
|
||
|
||
|
||
let thirdColumnData = Array.from(table.rows)
|
||
.map(row => row.cells[2].textContent.trim())
|
||
.filter(cellValue => cellValue !== "");
|
||
|
||
if (navTitle.text().trim() === 'نام شرکت') {
|
||
$('.input2').prop('disabled', true);
|
||
$('.input3').prop('disabled', true);
|
||
$('.input4').prop('disabled', true);
|
||
$('.position-name').prop('disabled', true);
|
||
// $('.position-code').prop('disabled', true);
|
||
$('.setContract').prop('disabled', true);
|
||
$('.options-check').addClass('disactived');
|
||
}
|
||
|
||
else if (firstColumnData.length > secondColumnData.length) {
|
||
$('.input2').prop('disabled', true);
|
||
$('.input3').prop('disabled', false);
|
||
$('.input4').prop('disabled', false);
|
||
} else {
|
||
$('.input2').prop('disabled', false);
|
||
$('.input3').prop('disabled', true);
|
||
$('.input4').prop('disabled', true);
|
||
$('.position-name').prop('disabled', false);
|
||
// $('.position-code').prop('disabled', false);
|
||
$('.setContract').prop('disabled', false);
|
||
$('.options-check').removeClass('disactived');
|
||
}
|
||
|
||
var haspersonelcode = activeTabPane.find('input.position-code').attr("data-haspersonelcode");
|
||
console.log(haspersonelcode);
|
||
if (haspersonelcode.toLowerCase() == "true" || haspersonelcode == '') {
|
||
activeTabPane.find('input.position-code').prop('disabled', true);
|
||
}
|
||
else {
|
||
activeTabPane.find('input.position-code').prop('disabled', false);
|
||
}
|
||
}
|
||
|
||
// tooltip for when the title of the tabs are long
|
||
$(function () {
|
||
$('.nav-title').tooltip({
|
||
container: 'body',
|
||
fontFamily: 'YekanBold',
|
||
background: 'grey',
|
||
placement: 'top',
|
||
offset: { x: 150, y: 20 },
|
||
trigger: 'hover',
|
||
html: true,
|
||
title: function () {
|
||
return '<span style="font-family: YekanBold;">' + $(this).text() + '</span>';
|
||
}
|
||
});
|
||
});
|
||
|
||
|
||
$('.trash').click(function () {
|
||
let activeTabPane = $('.tab-pane.active');
|
||
let rows = activeTabPane.find(".workDate-table tbody").find("tr");
|
||
let rowCount = rows.length;
|
||
if (rowCount === 6) {
|
||
$('.table-content').addClass('hide-scrollbar');
|
||
}
|
||
if (rowCount <= 5) {
|
||
let deletedRow = $(this).closest('tr');
|
||
deletedRow.find('td:eq(5)').text("");
|
||
deletedRow.find('td:eq(3)').text("");
|
||
deletedRow.find('td:eq(2)').text("");
|
||
deletedRow.find('td:eq(1)').text("");
|
||
}
|
||
if (rowCount > 5) {
|
||
$(this).closest('tr').fadeOut(200, function () {
|
||
$(this).remove();
|
||
updateRowNumbers();
|
||
});
|
||
}
|
||
disableInput();
|
||
|
||
});
|
||
|
||
//this code controls the trash icon
|
||
$(".workDate-table .trash-icon").on("mouseenter", function () {
|
||
$(this).animate({ left: "-2px" }, 50)
|
||
.animate({ left: "2px" }, 50)
|
||
.animate({ left: "0px" }, 50);
|
||
});
|
||
|
||
$('.del-com .trash-icon').click(function () {
|
||
let navLink = $(this).closest('.nav-link');
|
||
let navTitle = navLink.find('.nav-title');
|
||
|
||
if ($(this).closest('.nav-link').index() === 0 && $('.nav-tabs a').length === 1) {
|
||
|
||
@if (Model.LeftWorkGroups != null && Model.LeftWorkGroups.Count > 0)
|
||
{
|
||
<text>$("#IsDelete").val('true'); </text>
|
||
}
|
||
navTitle.text('نام شرکت');
|
||
navTitle.addClass("disactive");
|
||
let activeTabPane = $('.tab-pane.active');
|
||
activeTabPane.find("input.position-code").val("");
|
||
activeTabPane.find(".position-name").val(0);
|
||
|
||
let rows = activeTabPane.find(".workDate-table tbody").find("tr");
|
||
let rowCount = rows.length;
|
||
if (rowCount === 6) {
|
||
$('.table-content').addClass('hide-scrollbar');
|
||
}
|
||
rows.each(function () {
|
||
if (rowCount <= 5) {
|
||
$(this).find('td:eq(5)').text("");
|
||
$(this).find('td:eq(3)').text("");
|
||
$(this).find('td:eq(2)').text("");
|
||
$(this).find('td:eq(1)').text("");
|
||
}
|
||
if (rowCount > 5) {
|
||
$(this).remove();
|
||
updateRowNumbers();
|
||
}
|
||
});
|
||
} else {
|
||
var href_ = $(this).closest('.nav-link').attr("href");
|
||
|
||
var tabId = href_.replace('#', '');
|
||
|
||
$(this).closest('.nav-link').remove();
|
||
//handleCompanyScroll();
|
||
$("#" + tabId).remove();
|
||
|
||
if ($(this).closest('.nav-link').hasClass('active')) {
|
||
$('.nav-tabs a:first-child').trigger('click');
|
||
}
|
||
}
|
||
disableInput();
|
||
});
|
||
|
||
//the save button in the new tab...
|
||
$('.save').click(function (e) {
|
||
e.preventDefault();
|
||
saveData()
|
||
});
|
||
|
||
function saveData() {
|
||
let activeTabPane = $('.tab-pane.active');
|
||
let startDate = activeTabPane.find('.input2');
|
||
let lastDay = activeTabPane.find('.input3');
|
||
let endDate = activeTabPane.find('.input4');
|
||
|
||
|
||
let startValue = startDate.val();
|
||
let lastValue = lastDay.val();
|
||
let endValue = endDate.val();
|
||
|
||
let dateId = startDate.attr('id');
|
||
let number = dateId.match(/\d+/)[0];
|
||
|
||
|
||
if (startValue != '' && !checkLength(startDate.val(), 10)) {
|
||
if (!dateValidCheckByValue(startDate)) {
|
||
startDate.addClass("errored");
|
||
} else {
|
||
startDate.removeClass("errored");
|
||
}
|
||
|
||
}
|
||
if (lastValue != '' && !checkLength(lastDay.val(), 10)) {
|
||
if (!dateValidCheckByValue(startDate)) {
|
||
lastDay.addClass("errored");
|
||
} else {
|
||
lastDay.removeClass("errored");
|
||
}
|
||
|
||
}
|
||
if (endValue != '' && !checkLength(endDate.val(), 10)) {
|
||
if (!dateValidCheckByValue(endDate)) {
|
||
endDate.addClass("errored");
|
||
} else {
|
||
endDate.removeClass("errored");
|
||
}
|
||
|
||
}
|
||
|
||
if (!$('.date').hasClass('errored')) {
|
||
addRow2(number, startValue, lastValue, endValue);
|
||
disableInput();
|
||
handleScroll();
|
||
|
||
startDate.val("");
|
||
lastDay.val("");
|
||
endDate.val("");
|
||
|
||
}
|
||
}
|
||
|
||
//var timer = null;
|
||
//$('body').on('keyup', '.select2-search__field',function(){
|
||
// clearTimeout(timer);
|
||
// timer = setTimeout(jobListByText, 1000);
|
||
//});
|
||
|
||
|
||
function getPersonelCode(workshopId) {
|
||
|
||
var employeeId = @Model.EmployeeId;
|
||
// var workshopId=$("#input1").val();
|
||
|
||
$.ajax({
|
||
/* contentType: 'charset=utf-8',*/
|
||
dataType: 'json',
|
||
type: 'POST',
|
||
url: '@Url.Page("/Company/Employees/Index", "GetPersonelCode")',
|
||
headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() },
|
||
data: { "workshopId": Number(workshopId), "employeeId": Number(employeeId) },
|
||
success: function (response) {
|
||
console.log(response);
|
||
|
||
//console.log(response);
|
||
var inputCode = $('.tab-pane.active').find("input.position-code");
|
||
//var inputClass=inputCode.attr("class");
|
||
inputCode.val(response.personnelCode);
|
||
if (response.hasPersonelCode) {
|
||
// console.log(09);
|
||
inputCode.attr("disabled", "disabled");
|
||
inputCode.attr("data-haspersonelcode", "true");
|
||
}
|
||
else {//console.log(10);
|
||
inputCode.attr("data-haspersonelcode", "false");
|
||
}
|
||
disableInput();
|
||
},
|
||
failure: function (response) {
|
||
// console.log(5, response);
|
||
}
|
||
|
||
});
|
||
|
||
}
|
||
|
||
function getWorkshopInformation(workshopId) {
|
||
console.log('sss');
|
||
var addBonusesPay = $('.tab-pane.active').find("input.addbonusespay");
|
||
var addYearsPay = $('.tab-pane.active').find("input.addyearspay");
|
||
var addLeavePay = $('.tab-pane.active').find("input.addleavepay");
|
||
|
||
|
||
if ('@Model.AddBonusesPay' == 'True') {
|
||
addBonusesPay.prop("checked", true);
|
||
// addBonusesPay.trigger("click");
|
||
}
|
||
else {
|
||
addBonusesPay.prop("checked", false);
|
||
}
|
||
|
||
if ('@Model.AddYearsPay' == 'True') {
|
||
addYearsPay.prop("checked", true);
|
||
// addYearsPay.trigger("click");
|
||
}
|
||
else { addYearsPay.prop("checked", false); }
|
||
if ('@Model.AddLeavePay' == 'True') {
|
||
addLeavePay.prop("checked", true);
|
||
}
|
||
else { addLeavePay.prop("checked", false); }
|
||
|
||
|
||
|
||
//-----------Old----------
|
||
//$.ajax({
|
||
// /* contentType: 'charset=utf-8',*/
|
||
// dataType: 'json',
|
||
// type: 'POST',
|
||
// url: '@Url.Page("/Company/Employees/Index", "GetWorkshopInformation")',
|
||
// headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() },
|
||
// data: { "workshopId": Number(workshopId)},
|
||
// success: function (response) {
|
||
// console.log(response);
|
||
|
||
// var addBonusesPay=$('.tab-pane.active').find("input.addbonusespay");
|
||
// var addYearsPay=$('.tab-pane.active').find("input.addyearspay");
|
||
// var addLeavePay=$('.tab-pane.active').find("input.addleavepay");
|
||
|
||
// if(response.addBonusesPay){
|
||
// addBonusesPay.prop("checked",true);
|
||
// // addBonusesPay.trigger("click");
|
||
// }
|
||
// else{
|
||
// addBonusesPay.prop("checked",false); }
|
||
|
||
// if(response.addYearsPay)
|
||
// {
|
||
// addYearsPay.prop("checked",true);
|
||
// // addYearsPay.trigger("click");
|
||
// }
|
||
// else
|
||
// { addYearsPay.prop("checked",false); }
|
||
|
||
// if(response.addLeavePay)
|
||
// {
|
||
// addLeavePay.prop("checked",true);
|
||
// //addLeavePay.trigger("click");
|
||
// }
|
||
// else
|
||
// { addLeavePay.prop("checked",false); }
|
||
|
||
// },
|
||
// failure: function (response) {
|
||
// // console.log(5, response);
|
||
// }
|
||
|
||
// });
|
||
|
||
}
|
||
|
||
|
||
|
||
// lock=false;
|
||
// lastValue='';
|
||
// function jobListByText() {
|
||
|
||
//var this_=$(".select2-search__field");
|
||
|
||
//var text=$(this_).val();
|
||
//var selectItem=$('.tab-pane.active').find('.select-city');
|
||
//var selectControls=$(this_).attr("aria-controls");
|
||
// if(text!="" && selectControls!="select2-input1-results")
|
||
// {
|
||
// if(!lock){
|
||
// lock=true;
|
||
// lastValue=text;
|
||
// }
|
||
// else{
|
||
// return;
|
||
// }
|
||
// $.ajax({
|
||
// /* contentType: 'charset=utf-8',*/
|
||
// dataType: 'json',
|
||
// type: 'POST',
|
||
// url: '@Url.Page("/Company/InsuranceJob/Index", "JobListByText")',
|
||
// headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() },
|
||
// data: { "textSearch": text },
|
||
// success: function (response) {
|
||
// lock=false;
|
||
// $.each(response.jobList, function (i, item) {
|
||
|
||
// if (selectItem.find("option[value='" + item.id + "']").length==0) {
|
||
// var newOption = new Option((item.jobName+' | '+item.jobCode), item.id, true, true);
|
||
// selectItem.append(newOption).trigger('change');
|
||
// }
|
||
// });
|
||
// if (text != lastValue)
|
||
// {
|
||
// console.log(100);
|
||
// jobListByText($(".select2-search__field"));
|
||
|
||
// }
|
||
// },
|
||
// failure: function (response) {
|
||
// lock=false;
|
||
// console.log(5, response);
|
||
// }
|
||
// });
|
||
// }
|
||
// else
|
||
// {
|
||
// }
|
||
|
||
|
||
// }
|
||
|
||
|
||
|
||
</script>
|
||
|