Files
Backend-Api/ServiceHost/Areas/Client/Pages/Company/Employees/ChangeCode.cshtml
2024-08-24 19:13:34 +03:30

602 lines
22 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@using _0_Framework.Application
@model CompanyManagment.App.Contracts.Checkout.CreateCheckout
@{
<style>
.sendSelectDate {
border-color: #ff4e4e !important;
background-color: #ffe4e4 !important;
}
.modal-dialog {
width: 40% !important;
}
.modal-header{
border-bottom: 0;
}
.panel-default > .panel-heading {
background-color: #ffffff;
}
.modal .modal-dialog .modal-content {
height: auto !important;
min-height: auto !important;
}
@@media (min-width: 1500px) {
.modal-dialog {
width: 35% !important;
}
}
@@media (max-width: 1200px) {
.modal-dialog {
width: 60% !important;
}
}
@@media (max-width: 768px) {
.modal-dialog {
width: 90% !important;
}
}
@@media (max-width: 500px) {
#thh th, td {
font-size: 11px;
}
#datatable.changeCode th{
font-size: 13px !important;
}
}
.select2-container {
width: 100% !important;
}
.modal-footer {
border-top: unset !important;
}
.modal .modal-dialog .modal-content .modal-footer {
padding-top: unset !important;
}
/* p {
direction: ltr !important;
text-align: right !important;
}*/
input[type=radio]:hover {
cursor: pointer;
}
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-track {
background: #dfdfdf;
border-radius: 5px;
}
::-webkit-scrollbar-thumb {
background: brown;
border-radius: 5px;
}
/* .se .select2-container {
width: 75% !important;
}*/
/* .se .select2-container--default .select2-selection--single {
border-radius: 0px 22px 22px 0px !important;
border: 1px solid #a5a3a3 !important;
}*/
hr {
margin-top: 10px;
margin-bottom: 10px;
border-top: 1px solid #d3d3d3;
}
.checkbox + .checkbox, .radio + .radio {
margin-top: 0px !important;
}
.radio {
margin-top: 0px !important;
}
/* .radio {
margin: 5px 20px 5px 20px !important;
}*/
/* .form-control {
width: 75% !important;
display: inline-block;
}
*/
/*----------------------------*/
#EmployerFullName table {
width: 100%;
height: 150px;
text-align: center;
margin: 0 auto;
}
#EmployerFullName th, td {
padding: 10px 20px;
}
#EmployerFullName td:nth-child(odd) {
border-bottom: 1px solid #fff;
background-color: #bed3ca;
text-align: right;
}
#EmployerFullName tr:hover {
background-color: rgb(108, 186, 250);
}
#datatable.changeCode {
width: 100%;
height: 150px;
text-align: center;
margin: 0 auto;
border-collapse: separate;
table-layout: fixed;
overflow-y: scroll;
max-width: 100%;
border-radius: 10px;
}
#datatable.changeCode thead tr th:nth-child(1) {
border-top-right-radius: 10px;
}
#datatable.changeCode thead tr th:last-child {
border-top-left-radius: 10px;
}
#datatable.changeCode tbody td.last-row-last-child {
border-bottom-left-radius: 10px;
}
#datatable.changeCode tbody td.last-row-first-child {
border-bottom-right-radius: 10px;
}
#datatable.changeCode th, td {
padding: 10px 20px;
}
#datatable.changeCode td {
font-weight: normal;
color: black;
border: 1px solid #c7c7c7;
}
#datatable.changeCode th {
background-color: #5a5959;
color: white;
text-align: center;
font-size: 15px !important;
}
#datatable.changeCode td:nth-child(odd) {
border-left: 1px solid #fff;
width: 40%;
text-align: center;
}
#datatable.changeCode td:nth-child(even) {
text-align: center;
}
#datatable.changeCode th {
border-left: 1px solid #fff;
}
#datatable.changeCode tr:nth-child(even) {
background-color: #ffffff;
}
.pCode {
text-align: center;
border-radius: 7px;
background-color: #e9e9e9;
border: 2px solid #bfbfbf;
color: #444444;
height: 24px;
width: 50% !important;
margin: auto;
}
#datatable.changeCode tr {
background-color: rgb(224, 227, 228);
}
#datatable.changeCode tr:hover {
background-color: rgb(152 154 155);
}
.buttonInside {
position: relative;
}
#btnOk {
position: absolute;
left: 12px;
top: 32px;
padding: 6px;
color: #464646 !important;
border-radius: 8px 0px 0px 8px;
border-top: 0px;
border-bottom: 0px;
border-left: 0px;
background-color: #ededed;
border-color: #c9c4c4;
font-size: 11px;
font-family: 'IranSans' !important;
}
.final {
background: #0f9500;
border: #0f9500;
}
</style>
}
@{
<script src="~/lib/jquery-ajax-unobtrusive/jquery.unobtrusive-ajax.min.js"></script>
<script src="~/adminTheme/assets/datatables/jquery.dataTables.min.js"></script>
<script src="~/adminTheme/assets/datatables/dataTables.bootstrap.js"></script>
<script src="~/lib/select2/js/select2.js"></script>
<script src="~/lib/select2/js/i18n/fa.js"></script>
<link href="~/AdminTheme/assets/datatables/jquery.dataTables.min.css" rel="stylesheet" type="text/css" />
<link href="~/lib/select2/css/select2.css" rel="stylesheet" />
}
<div class="modal-header">
<button type="button" class="close pull-right" data-dismiss="modal" aria-hidden="true"><span style="font-size: 24px">×</span></button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<fieldset style="border: 1px solid #999797; border-radius: 10px; padding: revert;">
<legend style="margin-bottom: 5px; font-size: large; border-bottom: 0px; color: #505458; width: 150px; text-align: center;"> ویرایش کد پرسنلی </legend>
<form id="my_form" asp-page="./Index" asp-page-handler="ChangeCode" autocomplete="off"
method="get"
data-ajax="true"
data-ajax-method="get"
data-ajax-update="#panel"
data-ajax-mode="replace"
data-ajax-url="@Url.Page("./Index","LoadContracts")">
<div id="progress-bar" class="progress" style="display: none;">
<div style="background-color: #28a711" class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="row">
<div class="col-md-12 col-sm-12 col-lg-12 col-xs-12 right">
<div class="col-md-6 col-sm-6 col-lg-6 col-xs-12">
<label> نام کارگاه </label>
<div class="form-group se" dir="rtl">
<div class="form-control"> @Model.WorkshopName</div>
<input type="hidden" asp-for="WorkshopId" value="@Model.WorkshopId"/>
@*<a class="btn btn-info btn-rounded waves-effect waves-light" style="border-bottom-right-radius: 0px; border-top-right-radius: 0px; background-color: #257212; border-color: #545353; font-size: 14px; margin-right: -3px; font-family: 'IranSans' !important;" onclick="show()">تایید</a>*@
</div>
</div>
<div class="col-md-6 col-sm-6 col-lg-6 col-xs-12">
<label>نام پرسنل</label>
<div id="person">
<div class="form-group se person" dir="rtl">
<select id="getPersonnel" class="form-control select-city" asp-for="EmployeeId" >
<option value="0"> انتخاب پرسنل </option>
@foreach (var item in Model.EmployeeList)
{
<option value="@item.Id"> @item.EmployeeFullName </option>
}
</select>
</div>
</div>
<span asp-validation-for="EmployeeId" class="error"></span>
</div>
</div>
</div>
<div class="row" dir="rtl">
<div class="col-md-1 pull-left">
@* <a class="btn btn-success btn-rounded waves-effect waves-light" onclick="sendData()" style="float: left;">انتخاب</a>*@
<input type="submit" form="my_form" value="Search" name="Search" id="select" style="display: none" />
</div>
<div class="col-md-11">
<span id="montAndYearError"></span>
</div>
</div>
<hr style=" margin-top: 12px;margin-bottom: 12px;" />
</form>
<form asp-page="./Index" asp-page-handler="ChangeCode" autocomplete="off" id="changeCodeForm"
method="post"
data-ajax="true"
data-ajax-method="post"
data-ajax-url="@Url.Page("./Index","Check")"
data-callback=""
data-action="Refresh">
<div class="row">
<div class="col-sm-12">
<div class="panel panel-default" style="border-radius: 10px;">
<div class="panel-heading" style="border-radius: 10px;">
<h3 class="panel-title"><i class="fa fa-list" style="padding-left: 3px; font-size: 14px"></i> لیست شماره پرسنلی </h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-sm-12 col-sm-12 col-xs-12">
<table id="datatable" class="table table-striped changeCode" style="direction: rtl">
<thead style="background-color: #ecefee">
<tr>
<th style="width: 20px;" class="sizeSet">#</th>
<th class="sizeSet decorCheckbox">
<input class="checkboxtitle" type="checkbox" id="checkSelect1" disabled="disabled" />
</th>
<th class="sizeSet">شماره پرسنلی</th>
<th class="sizeSet"> پرسنل </th>
</tr>
</thead>
<tbody id="panel">
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<input type="hidden" id="sendWId" name="workshopId" />
<div id="listOfContract" style="display: none">
</div>
@*<input type="hidden" asp-for="id" value="id"/>*@
<div class="modal-footer m-b-10">
<a href="#" onclick="final()" class="btn btn-success btn-rounded waves-effect waves-light pull-left final">ثبت نهایی</a>
<button type="button" class="btn btn-default btn-rounded waves-effect waves-light pull-left m-b-5" data-dismiss="modal">بستن</button>
<input type="submit" id="sendFinaly" form="sub" value="fine" name="fine" style="display: none" />
</div>
</form>
</fieldset>
</div>
@Html.AntiForgeryToken()
</div>
</div>
<script>
$(document).ready(function () {
$(".select-city2").select2({
language: "fa",
dir: "rtl"
});
$('.final').attr('disabled', 'disabled');
$('.final').css("background-color", "gray");
$('.byStep').attr('disabled', 'disabled');
$('.byStep').css("background-color", "unset");
$('.byStepButton').attr('disabled', 'disabled');
$('.byStepButton').css("background-color", "gray");
sendData();
});
function sendData() {
$('.formStep').remove();
$('.ConvertErr').remove();
$('#convertError').append(
'<input type="hidden" class="formStep" value="select" name="FormStep"/>'
);
$('#select').click();
$('.byStep').removeAttr('disabled');
$('.byStepButton').removeAttr('disabled');
$('.byStep').css({ 'background-color': '' });
$('.byStepButton').css({ 'background-color': '' });
$('.final').removeAttr('disabled');
$('.final').css({ "background-color": '' });
//} else {
// $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " انتخاب کارگاه اجباری است ");
//}
}
function final() {
//$('.final').attr('disabled', 'disabled');
//$('.final').css("background-color", "gray");
//$('.byStep').attr('disabled', 'disabled');
//$('.byStep').css("background-color", "unset");
//$('.byStepButton').attr('disabled', 'disabled');
//$('.byStepButton').css("background-color", "gray");
//$('#sub').on('submit', function(e) {
// e.preventDefault();
//});
$('.item1').remove();
const wId =@Model.WorkshopId; //document.getElementById("getWorkshopWithName").value;
var checkboxId = document.getElementsByName("cheking");
var personnelCodeChange = document.getElementsByClassName("pCode");
//var listArray = [];
//for (var j = 0, p = personnelCodeChange[j].length; j < p; j++) {
// console.log(personnelCodeChange[j].name);
//}
$('#panel tr td').append(
'<input class="item1" type="hidden" value="' + wId + '" name="WorkshopId"/>'
);
for (var i = 0, n = checkboxId.length; i < n; i++) {
if (checkboxId[i].checked) {
let pname = checkboxId[i].value;
let inputElement = document.querySelector('input[name="' + pname + '"]');
$('#panel tr td').append(
'<input class="item1" type="hidden" value="' + pname + '" name="Contracts[' + i + '].EmployeeId"/>'
+ '<input class="item1" type="hidden" value="' + inputElement.value + '" name="Contracts[' + i + '].PersonnelCode"/>'
);
} else {
$('#panel tr td').append(
'<input class="item1" type="hidden" value="' + 0 + '" name="Contracts[' + i + '].EmployeeId"/>'
+ '<input class="item1" type="hidden" value="' + 0 + '" name="Contracts[' + i + '].PersonnelCode"/>'
);
}
}
if (checkboxId.length > 0) {
$('#changeCodeForm').submit();
} else {
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', "هیچ پرسنلی برای ویرایش انتخاب نشده است");
}
}
$('#changeCodeForm').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);
$('#select').click();
getEmployeeList();
$("#MainModal").modal('hide');
}
else {
$.Notification.autoHideNotify('error', 'top right', response.message);
}
}
});
return false;
});
function loadWorkshopWithName() {
/* loadPersonnel();*/
const nameId = document.getElementById("getWorkshopWithName").value;
const nameIndex = document.getElementById("getWorkshopWithName");
var myArray = document.getElementById('getWorkshopWithName').options.selectedIndex;
//document.getElementById("getWorkshopWithCode").options.selectedIndex = myArray;
//var codeId = document.getElementById("getWorkshopWithCode");
//var archiveCodee = codeId.options[codeId.selectedIndex];
//document.getElementById("select2-getWorkshopWithCode-container").innerHTML = archiveCodee.text;
$('#getPersonnel').empty().append('<option selected="selected" value="0" >انتخاب پرسنل</option>');
// $('#archiveCode').val(archiveCodee.text);
if (nameId != "WorkshopIds") {
$.ajax({
//contentType: 'application/json; charset=utf-8',
dataType: 'json',
type: 'POST',
url: '@Url.Page("/Company/Contracts/Index", "LoadWorkshops")',
headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() },
data: { "id": nameId },
success: function(response) {
var items2 = [];
$.each(response,
function(key, val) {
items2.push({ id: key, vall: val });
});
//document.getElementById("InsurancCode").innerHTML = items2[1].vall;
$.each(response.employeeList, function(i, item)
{
$('#getPersonnel').append($('<option>',
{
value: item.id,
text: item.employeeFullName
}));
});
},
failure: function(response) {
console.log(5, response);
}
});
}
}
function loadWorkshopWithCode() {
var myArray = document.getElementById('getWorkshopWithCode').options.selectedIndex;
document.getElementById("getWorkshopWithName").options.selectedIndex = myArray;
var getNameId = document.getElementById("getWorkshopWithName");
var getWithName = getNameId.options[getNameId.selectedIndex];
document.getElementById("select2-getWorkshopWithName-container").innerHTML = getWithName.text;
loadWorkshopWithName();
}
function loadPersonnel() {
const id = document.getElementById("getPersonnel").value;
const workshopId = document.getElementById("getWorkshopWithName").value;
if (workshopId == "WorkshopIds") {
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ',"ابتدا کارگاه را انتخاب نمایید");
}
if (id > 0 && workshopId != "WorkshopIds") {
$.ajax({
//contentType: 'application/json; charset=utf-8',
dataType: 'json',
type: 'POST',
url: '@Url.Page("/Company/Contracts/Index", "LoadPersonel")',
headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() },
data: { "id": id, "workshopId": workshopId },
success: function (response) {
var items2 = [];
$.each(response, function (key, val) {
items2.push({ id: key, vall: val });
});
//if (items2[8].vall == "")
// $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ',"ابتدا تاریخ شروع به کار را در بخش پرسنل <br/>برای این شخص و کارگاه مورد نظر ایجاد نموده و سپس اقدام به ایجاد قرارداد نمایید");
//document.getElementById("FatherName").innerHTML = items2[1].vall;
//document.getElementById("PersonnelNationalCode").innerHTML = items2[2].vall;
},
failure: function (response) {
console.log(5, response);
}
});
}
}
</script>