File: /var/www/html/hrms-production/storage/framework/views/728c480205ee1ee6b9c467a532d9da014940df8c.php
<div class="modal fade" id="addEmployeeAddress">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Add Address <span id="AddressEmployeeName" class="text-info"></span></h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<!-- Main content -->
<form id="addEmployeeAddressFrom">
<input type="hidden" name="_token" id="token" value="<?php echo e(csrf_token()); ?>">
<input type="hidden" id="AddressEmployeeId" name="EmployeeId">
<input type="hidden" id="AddressEmployeeCode" name="EmployeeCode">
<div class="row">
<div class="col-md-6">
<div class="card card-light">
<div class="card-header">
<h3 class="card-title">Permanent Address:</h3>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-12">
<div class="form-group mb-2">
<label class="mb-0" for="Home town Decalration">Home town Decalration <span class="text-danger">*</span></label>
<input id="HomeTownDecalration" name="HomeTownDeclaration" class="form-control form-control-sm">
</div>
</div>
</div>
<div class="form-group mb-2">
<label class="mb-0" for="PermanentStreetAddress">Street Address <span class="text-danger">*</span></label>
<input type="text" id="PermanentStreetAddress" name="PermanentStreetAddress"
class="form-control form-control-sm permanent-address">
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group mb-2">
<label class="mb-0" for="PermanentCountry">Country <span class="text-danger">*</span></label>
<select class="form-control form-control-sm select2"
style="width: 100%;" aria-hidden="true"
data-placeholder="Select Country" name="PermanentCountry"
id="PermanentCountry">
<option value="" selected>Select Country</option>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group mb-2">
<label class="mb-0" for="PermanentState">State <span class="text-danger">*</span></label>
<select id="PermanentState" name="PermanentState"
class="form-control form-control-sm select2 permanent-address"
data-placeholder="Select State" aria-hidden="true"
style="width: 100%;">
<option value="" selected disabled>Select State</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group mb-2">
<label class="mb-0" for="PermanentDistrict">District <span class="text-danger">*</span></label>
<select id="PermanentDistrict" name="PermanentDistrict"
class="form-control form-control-sm select2 permanent-address"
data-placeholder="Select District" aria-hidden="true"
style="width: 100%;">
<option value="" selected disabled>Select District</option>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group mb-2">
<label class="mb-0">City <span class="text-danger">*</span></label>
<select id="PermanentCity" name="PermanentCity"
class="form-control form-control-sm select2 permanent-address"
data-placeholder="Select City" aria-hidden="true"
style="width: 100%;">
<option value="" selected disabled>Select City</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group mb-2">
<label class="mb-0" for="PermanentPinCode">Pin Code <span class="text-danger">*</span></label>
<input type="text" id="PermanentPinCode" name="PermanentPinCode"
class="form-control form-control-sm permanent-address">
</div>
</div>
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
</div>
</div>
<div class="col-md-6">
<div class="card card-light">
<div class="card-header">
<h3 class="card-title">Current Address:</h3>
</div>
<div class="card-body">
<div class="clearfix mb-4">
<div class="icheck-primary">
<input type="checkbox" name="SameAsPermanent" id="SameAsPermanent">
<label class="mb-0" for="SameAsPermanent">Same as Permanent</label>
</div>
</div>
<div class="form-group mb-2">
<label class="mb-0" for="CurrentStreetAddress">Street Address <span class="text-danger">*</span></label>
<input type="text" id="CurrentStreetAddress" name="CurrentStreetAddress"
class="form-control form-control-sm current-address">
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group mb-2">
<label class="mb-0">Country <span class="text-danger">*</span></label>
<select class="form-control form-control-sm current-address select2"
style="width: 100%;" aria-hidden="true"
data-placeholder="Select Country" name="CurrentCountry"
id="CurrentCountry">
<option value="" selected>Select Country</option>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group mb-2">
<label class="mb-0">State <span class="text-danger">*</span></label>
<select id="CurrentState" name="CurrentState"
class="form-control form-control-sm select2 current-address"
style="width: 100%;" data-placeholder="Select State">
<option value="" disabled selected>Select State</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group mb-2">
<label class="mb-0">District <span class="text-danger">*</span></label>
<select id="CurrentDistrict" name="CurrentDistrict"
class="form-control form-control-sm select2 current-address"
style="width: 100%;" data-placeholder="Select District">
<option value="" disabled selected>Select District</option>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group mb-2">
<label class="mb-0">City <span class="text-danger">*</span></label>
<select id="CurrentCity" name="CurrentCity"
class="form-control form-control-sm select2 current-address"
style="width: 100%;" data-placeholder="Select City">
<option value="" disabled selected>Select City</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group mb-2">
<label class="mb-0" for="CurrentPinCode">Pin Code <span class="text-danger">*</span></label>
<input type="text" id="CurrentPinCode" name="CurrentPinCode"
class="form-control form-control-sm current-address">
</div>
</div>
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
</div>
</div>
</div>
<hr />
<div class="row">
<div class="col-12">
<div class="d-flex align-items-center justify-content-center">
<button type="button" class="btn btn-sm btn-outline-secondary mx-1" data-dismiss="modal"
aria-label="Close">Cancel</button>
<button type="submit" id="btn-save-address" value="Save"
class="btn btn-sm btn-info mx-1">Save</button>
</div>
</div>
</div>
</form>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<div class="modal fade" id="UpdateEmployeeAddress">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Edit Address <span id="EditAddressEmployeeName" class="text-info"></span></h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<!-- Main content -->
<form id="editEmployeeAddressFrom">
<input type="hidden" name="_token" id="token" value="<?php echo e(csrf_token()); ?>">
<input type="hidden" id="EditAddressEmployeeId" name="EmployeeId">
<input type="hidden" id="EmployeesAddressId" name="EmployeesAddressId">
<div class="row">
<div class="col-md-6">
<div class="card card-light">
<div class="card-header">
<h3 class="card-title">Permanent Address:</h3>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-12">
<div class="form-group mb-2">
<label class="mb-0" for="Home town Decalration">Home town
Decalration</label>
<input id="EditHomeTownDecalration" name="HomeTownDeclaration" rows="1"
class="form-control form-control-sm">
</div>
</div>
</div>
<div class="form-group mb-2">
<label class="mb-0" for="PermanentStreetAddress">Street Address</label>
<input type="text" id="EditPermanentStreetAddress" name="PermanentStreetAddress"
class="form-control form-control-sm permanent-address">
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group mb-2">
<label class="mb-0" for="PermanentCountry">Country</label>
<select class="form-control form-control-sm select2"
style="width: 100%;" aria-hidden="true"
data-placeholder="Select Country" name="PermanentCountry"
id="EditPermanentCountry">
<option value="" selected>Select Country</option>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group mb-2">
<label class="mb-0" for="PermanentState">State</label>
<select id="EditPermanentState" name="PermanentState"
class="form-control form-control-sm select2 permanent-address"
data-placeholder="Select State" aria-hidden="true"
style="width: 100%;">
<option value="" selected disabled>Select State</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group mb-2">
<label class="mb-0" for="PermanentDistrict">District</label>
<select id="EditPermanentDistrict" name="PermanentDistrict"
class="form-control form-control-sm select2 permanent-address"
data-placeholder="Select District" aria-hidden="true"
style="width: 100%;">
<option value="" selected disabled>Select District</option>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group mb-2">
<label class="mb-0">City</label>
<select id="EditPermanentCity" name="PermanentCity"
class="form-control form-control-sm select2 permanent-address"
data-placeholder="Select City" aria-hidden="true"
style="width: 100%;">
<option value="" selected disabled>Select City</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group mb-2">
<label class="mb-0" for="PermanentPinCode">Pin Code</label>
<input type="text" id="EditPermanentPinCode" name="PermanentPinCode"
class="form-control form-control-sm permanent-address">
</div>
</div>
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
</div>
</div>
<div class="col-md-6">
<div class="card card-light">
<div class="card-header">
<h3 class="card-title">Current Address:</h3>
</div>
<div class="card-body">
<div class="clearfix mb-4">
<div class="icheck-primary">
<input type="checkbox" name="SameAsPermanent" id="EditSameAsPermanent">
<label class="mb-0" for="EditSameAsPermanent">Same as Permanent</label>
</div>
</div>
<div class="form-group mb-2">
<label class="mb-0" for="CurrentStreetAddress">Street Address</label>
<input type="text" id="EditCurrentStreetAddress" name="CurrentStreetAddress"
class="form-control form-control-sm current-address">
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group mb-2">
<label class="mb-0">Country</label>
<select class="form-control form-control-sm current-address select2"
style="width: 100%;" aria-hidden="true"
data-placeholder="Select Country" name="CurrentCountry"
id="EditCurrentCountry">
<option value="" selected>Select Country</option>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group mb-2">
<label class="mb-0">State</label>
<select id="EditCurrentState" name="CurrentState"
class="form-control form-control-sm select2 current-address"
style="width: 100%;" data-placeholder="Select State">
<option value="" disabled selected>Select State</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group mb-2">
<label class="mb-0">District</label>
<select id="EditCurrentDistrict" name="CurrentDistrict"
class="form-control form-control-sm select2 current-address"
style="width: 100%;" data-placeholder="Select District">
<option value="" disabled selected>Select District</option>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group mb-2">
<label class="mb-0">City</label>
<select id="EditCurrentCity" name="CurrentCity"
class="form-control form-control-sm select2 current-address"
style="width: 100%;" data-placeholder="Select City">
<option value="" disabled selected>Select City</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group mb-2">
<label class="mb-0" for="CurrentPinCode">Pin Code</label>
<input type="text" id="EditCurrentPinCode" name="CurrentPinCode"
class="form-control form-control-sm current-address">
</div>
</div>
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
</div>
</div>
</div>
<hr />
<div class="row">
<div class="col-12">
<div class="d-flex align-items-center justify-content-center">
<button type="button" class="btn btn-sm btn-outline-secondary mx-1" data-dismiss="modal"
aria-label="Close">Cancel</button>
<button type="submit" value="Update" class="btn btn-sm btn-info mx-1">Udpate</button>
</div>
</div>
</div>
</form>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<script>
function addEmployeeAddress(EmployeeId)
{
var EmployeeId = EmployeeId;
$('#addEmployeeAddress').modal('show');
$.ajax({
type: "POST",
url: "<?php echo e(url('/')); ?>/get-employee-detail",
dataType: 'json',
data: {
EmployeeId: EmployeeId,
_token: "<?php echo e(csrf_token()); ?>",
},
success: function (response) {
$('#AddressEmployeeId').val(response.GetEmployee.EmployeeId);
$('#AddressEmployeeCode').val(response.GetEmployee.EmployeeCode);
$('span#AddressEmployeeName').html('#' +response.GetEmployee.EmployeeName);
}
});
}
</script>
<script>
$(function () {
$.validator.setDefaults({
submitHandler: function () {
event.preventDefault();
// Get Form Data
$.ajax({
type: "post",
url: "<?php echo e(url('store-employee-address')); ?>",
data: $('#addEmployeeAddressFrom').serialize(),
success: function(response) {
const Toast = Swal.mixin({
toast: true,
position: 'top-end',
showConfirmButton: false,
timer: 2000,
timerProgressBar: true,
didOpen: (toast) => {
toast.addEventListener('mouseenter', Swal.stopTimer)
toast.addEventListener('mouseleave', Swal.resumeTimer)
}
})
Toast.fire({
icon: 'success',
title: 'Employee Address added successfully!'
});
setTimeout(function(){
window.location.reload(1);
}, 2000);
},
error: function(data) {
const Toast = Swal.mixin({
toast: true,
position: 'top-end',
showConfirmButton: false,
timer: 2000,
timerProgressBar: true,
didOpen: (toast) => {
toast.addEventListener('mouseenter', Swal.stopTimer)
toast.addEventListener('mouseleave', Swal.resumeTimer)
}
})
Toast.fire({
icon: 'error',
title: 'Something went wrong!'
});
}
});
}
});
$('#addEmployeeAddressFrom').validate({
rules: {
HomeTownDecalration: {
required: true,
},
HomeTownBlockYear: {
// required: true,
},
PermanentStreetAddress: {
required: true,
},
PermanentCountry: {
required: true,
},
PermanentState: {
required: true,
},
PermanentDistrict: {
required: true,
},
PermanentCity: {
required: true,
},
PermanentPinCode: {
required: true,
pattern: '^([0-9]){6}$',
},
CurrentStreetAddress: {
required: true,
},
CurrentCountry: {
required: true,
},
CurrentState: {
required: true,
},
CurrentDistrict: {
required: true,
},
CurrentCity: {
required: true,
},
CurrentPinCode: {
required: true,
pattern: '^([0-9]){6}$',
},
},
messages: {
CurrentPinCode: {
pattern: "Please insert valid pincode.",
},
PermanentPinCode: {
required: "Please insert valid pincode.",
},
},
errorElement: 'span',
errorPlacement: function (error, element) {
error.addClass('invalid-feedback');
element.closest('.form-group').append(error);
},
highlight: function (element, errorClass, validClass) {
$(element).addClass('is-invalid');
},
unhighlight: function (element, errorClass, validClass) {
$(element).removeClass('is-invalid');
}
});
});
</script>
<script>
$(document).ready(function() {
$.ajax({
type: "GET",
url: "<?php echo e(url('/country-list')); ?>",
dataType: "json",
success: function(response) {
var json = response.Country;
$.each(json, function(i, country) {
$("#PermanentCountry, #CurrentCountry, #EditPermanentCountry, #EditCurrentCountry").append("<option value='" + country.id + "'>" + country.country_name + "</option>");
$('#PermanentCountry, #CurrentCountry, #EditPermanentCountry, #EditCurrentCountry').trigger('change');
});
}
});
});
// State List
$(document).ready(function() {
$.ajax({
type: "GET",
url: "<?php echo e(url('/')); ?>/indian-state-list/",
dataType: "json",
success: function(response) {
var json = response.IndianState;
$.each(json, function(i, state) {
$("#PermanentState, #CurrentState, #EditPermanentState, #EditCurrentState").append("<option value='" + state.id + "'>" + state.state_name + "</option>");
$('#PermanentState, #CurrentState, #EditPermanentState, #EditCurrentState').trigger('change');
});
}
});
});
</script>
<script>
// District List
$('#PermanentState').on('select2:select', function (e) {
//alert(e.params.data);
var data = e.params.data;
var state_id = data.id;
getPermanentDistrictList(state_id);
});
$('#CurrentState').on('select2:select', function (e) {
//alert(e.params.data);
var data = e.params.data;
var state_id = data.id;
getCurrentDistrictList(state_id);
});
// City List
$('#PermanentDistrict').on('select2:select', function (e) {
//alert(e.params.data);
var data = e.params.data;
var district_id = data.id;
getPermanentCityList(district_id);
});
$('#CurrentDistrict').on('select2:select', function (e) {
//alert(e.params.data);
var data = e.params.data;
var district_id = data.id;
getCurrentCityList(district_id);
});
// Edit Case Form
// District List
$('#EditPermanentState').on('select2:select', function (e) {
//alert(e.params.data);
var data = e.params.data;
var state_id = data.id;
getPermanentDistrictList(state_id);
});
$('#EditCurrentState').on('select2:select', function (e) {
//alert(e.params.data);
var data = e.params.data;
var state_id = data.id;
getCurrentDistrictList(state_id);
});
// City List
$('#EditPermanentDistrict').on('select2:select', function (e) {
//alert(e.params.data);
var data = e.params.data;
var district_id = data.id;
getPermanentCityList(district_id);
});
$('#EditCurrentDistrict').on('select2:select', function (e) {
//alert(e.params.data);
var data = e.params.data;
var district_id = data.id;
getCurrentCityList(district_id);
});
// End Edit Case
// Permanent District List
function getPermanentDistrictList(state_id = '', district_id_selected = ''){
var state_id = state_id;
$("#PermanentDistrict, #EditPermanentDistrict").empty();
$("#PermanentCity, #EditPermanentCity").empty();
$.ajax({
type: "GET",
url: "<?php echo e(url('/')); ?>/get-district-list/" +state_id,
dataType: "json",
success: function(response) {
var json = response.SelectedDistrict;
$.each(json, function(i, district) {
if (district_id_selected == district.id) {
$("#PermanentDistrict, #EditPermanentDistrict").append("<option selected value='" + district.id + "'>" + district.district_name + "</option>");
$('#EditPermanentDistrict').trigger('change');
} else {
$("#PermanentDistrict, #EditPermanentDistrict").append("<option value='" + district.id + "'>" + district.district_name + "</option>");
$('#PermanentDistrict').val(null).trigger('change');
}
});
}
});
}
// Permanent City List
function getPermanentCityList(district_id = '', city_it_selected = ''){
var district_id = district_id;
$("#PermanentCity, #EditPermanentCity").empty();
$.ajax({
type: "GET",
url: "<?php echo e(url('/')); ?>/get-city-list/" +district_id,
dataType: "json",
success: function(response) {
var json = response.SelectedCity;
$.each(json, function(i, city) {
if (city_it_selected == city.id) {
$("#PermanentCity, #EditPermanentCity").append("<option selected value='" + city.id + "'>" + city.city_name + "</option>");
$('#PermanentCity, #EditPermanentCity').trigger('change');
} else {
$("#PermanentCity, #EditPermanentCity").append("<option value='" + city.id + "'>" + city.city_name + "</option>");
$('#PermanentCity, #EditPermanentCity').trigger('change');
}
});
}
});
}
// Current District List
function getCurrentDistrictList(state_id = '', district_id_selected = ''){
var state_id = state_id;
$("#CurrentDistrict, #EditCurrentDistrict").empty();
$("#CurrentCity, #EditCurrentCity").empty();
$.ajax({
type: "GET",
url: "<?php echo e(url('/')); ?>/get-district-list/" +state_id,
dataType: "json",
success: function(response) {
var json = response.SelectedDistrict;
$.each(json, function(i, district) {
if (district_id_selected == district.id) {
$("#CurrentDistrict, #EditCurrentDistrict").append("<option selected value='" + district.id + "'>" + district.district_name + "</option>");
$('#CurrentDistrict, #EditCurrentDistrict').trigger('change');
} else {
$("#CurrentDistrict, #EditCurrentDistrict").append("<option value='" + district.id + "'>" + district.district_name + "</option>");
$('#CurrentDistrict, #EditCurrentDistrict').trigger('change');
}
});
}
});
}
// Current City List
function getCurrentCityList(district_id = '', city_id_selected = ''){
var district_id = district_id;
$("#CurrentCity, #EditCurrentCity").empty();
$.ajax({
type: "GET",
url: "<?php echo e(url('/')); ?>/get-city-list/" +district_id,
dataType: "json",
success: function(response) {
var json = response.SelectedCity;
$.each(json, function(i, city) {
if (city_id_selected == city.id) {
$("#CurrentCity, #EditCurrentCity").append("<option selected value='" + city.id + "'>" + city.city_name + "</option>");
$('#CurrentCity, #EditCurrentCity').trigger('change');
} else {
$("#CurrentCity, #EditCurrentCity").append("<option value='" + city.id + "'>" + city.city_name + "</option>");
$('#CurrentCity, #EditCurrentCity').trigger('change');
}
});
}
});
}
</script>
<script>
$("#SameAsPermanent").click(function() {
if ($(this).is(":checked")) {
var country_id = $("#PermanentCountry :selected").val();
var state_id = $("#PermanentState :selected").val();
var district_id = $("#PermanentDistrict :selected").val();
var city_id = $("#PermanentCity :selected").val();
getCurrentDistrictList(state_id, district_id);
getCurrentCityList(district_id, city_id);
addressCopy();
} else {
$("#CurrentStreetAddress").val("");
$("#CurrentCountry").val("");
$("#CurrentState").val(null).trigger('change');
$("#CurrentDistrict").empty();
$("#CurrentCity").empty();
$("#CurrentPinCode").val("");
}
});
function addressCopy() {
$("#CurrentStreetAddress").val($("#PermanentStreetAddress").val());
$("#CurrentCountry").val($("#PermanentCountry").val()).trigger("change");
$("#CurrentState").val($("#PermanentState :selected").val()).trigger("change");
$("#CurrentDistrict").val($("#PermanentDistrict :selected").val());
$("#CurrentCity").val($("#PermanentCity :selected").val());
$("#CurrentPinCode").val($("#PermanentPinCode").val());
}
$(document).on("blur keyup", ".permanent-address", function() {
if ($("#SameAsPermanent").is(":checked")) {
var country_id = $("#PermanentCountry :selected").val();
var state_id = $("#PermanentState :selected").val();
var district_id = $("#PermanentDistrict :selected").val();
var city_id = $("#PermanentCity :selected").val();
getCurrentDistrictList(state_id, district_id);
getCurrentCityList(district_id, city_id);
addressCopy();
}
});
// Edit Case Form
$("#EditSameAsPermanent").click(function() {
if ($(this).is(":checked")) {
var country_id = $("#EditPermanentCountry :selected").val();
var state_id = $("#EditPermanentState :selected").val();
var district_id = $("#EditPermanentDistrict :selected").val();
var city_id = $("#EditPermanentCity :selected").val();
getCurrentDistrictList(state_id, district_id);
getCurrentCityList(district_id, city_id);
addressCopyEdit();
} else {
$("#EditCurrentStreetAddress").val("");
$("#EditCurrentCountry").val("");
$("#EditCurrentState").val("");
$("#EditCurrentDistrict").val("");
$("#EditCurrentCity").val("");
$("#EditCurrentPinCode").val("");
}
});
function addressCopyEdit() {
$("#EditCurrentStreetAddress").val($("#EditPermanentStreetAddress").val());
$("#EditCurrentCountry").val($("#EditPermanentCountry").val()).trigger("change");
$("#EditCurrentState").val($("#EditPermanentState :selected").val()).trigger("change");
$("#EditCurrentDistrict").val($("#EditPermanentDistrict :selected").val());
$("#EditCurrentCity").val($("#EditPermanentCity :selected").val());
$("#EditCurrentPinCode").val($("#EditPermanentPinCode").val());
}
$(document).on("blur keyup", ".permanent-address", function() {
if ($("#EditSameAsPermanent").is(":checked")) {
var country_id = $("#EditPermanentCountry :selected").val();
var state_id = $("#EditPermanentState :selected").val();
var district_id = $("#EditPermanentDistrict :selected").val();
var city_id = $("#EditPermanentCity :selected").val();
getCurrentDistrictList(state_id, district_id);
getCurrentCityList(district_id, city_id);
addressCopyEdit();
}
});
</script>
<script>
function editEmployeeAddress(EmployeesAddressId)
{
var EmployeesAddressId = EmployeesAddressId;
$.ajax({
type: "POST",
url: "<?php echo e(url('/')); ?>/edit-employee-address",
dataType: 'json',
data: {
EmployeesAddressId: EmployeesAddressId,
_token: "<?php echo e(csrf_token()); ?>",
},
success: function (response) {
$('#EditAddressEmployeeId').val(response.EmployeeAddress.EmployeeId);
$('#EmployeesAddressId').val(response.EmployeeAddress.EmployeesAddressId);
$('span#EditAddressEmployeeName').html('#' +response.EmployeeAddress.EmployeeName);
$('#EditHomeTownDecalration').val(response.EmployeeAddress.HomeTownDeclaration);
$('#EditHomeTownBlockYear').val(response.EmployeeAddress.HomeTownBlockYear);
$('#EditHomeTownBlockYear').trigger('change');
$('#EditHomeTownBlockYear').val(response.EmployeeAddress.HomeTownBlockYear);
$('#EditPermanentStreetAddress').val(response.EmployeeAddress.PermanentStreetAddress);
$('#EditPermanentCountry').val(response.EmployeeAddress.PermanentCountry);
$('#EditPermanentCountry').trigger('change');
$('#EditPermanentState').val(response.EmployeeAddress.PermanentState);
getPermanentDistrictList(response.EmployeeAddress.PermanentState, response.EmployeeAddress.PermanentDistrict);
$('#EditPermanentState').trigger('change');
$('#EditPermanentDistrict').val(response.EmployeeAddress.PermanentDistrict);
getPermanentCityList(response.EmployeeAddress.PermanentDistrict, response.EmployeeAddress.PermanentCity);
$('#EditPermanentDistrict').trigger('change');
$('#EditPermanentCity').val(response.EmployeeAddress.PermanentCity);
$('#EditPermanentCity').trigger('change');
$('#EditPermanentPinCode').val(response.EmployeeAddress.PermanentPinCode);
// Current Addres
if (response.EmployeeAddress.SameAsPermanent == '1') {
$("input#EditSameAsPermanent").prop('checked', true);
} else {
$("input#EditSameAsPermanent").prop('checked', false);
}
$('#EditCurrentStreetAddress').val(response.EmployeeAddress.CurrentStreetAddress);
$('#EditCurrentCountry').val(response.EmployeeAddress.CurrentCountry);
$('#EditCurrentCountry').trigger('change');
$('#EditCurrentState').val(response.EmployeeAddress.CurrentState);
getCurrentDistrictList(response.EmployeeAddress.CurrentState, response.EmployeeAddress.CurrentDistrict);
$('#EditCurrentState').trigger('change');
$('#EditCurrentDistrict').val(response.EmployeeAddress.CurrentDistrict);
getCurrentCityList(response.EmployeeAddress.CurrentDistrict, response.EmployeeAddress.CurrentCity);
$('#EditCurrentDistrict').trigger('change');
$('#EditCurrentCity').val(response.EmployeeAddress.CurrentCity);
$('#EditCurrentCity').trigger('change');
$('#EditCurrentPinCode').val(response.EmployeeAddress.PermanentPinCode);
}
});
$('#UpdateEmployeeAddress').modal('show');
}
</script>
<script>
$(function () {
$.validator.setDefaults({
submitHandler: function () {
event.preventDefault();
// Get Form Data
$.ajax({
type: "post",
url: "<?php echo e(url('update-employee-address')); ?>",
data: $('#editEmployeeAddressFrom').serialize(),
success: function(response) {
const Toast = Swal.mixin({
toast: true,
position: 'top-end',
showConfirmButton: false,
timer: 2000,
timerProgressBar: true,
didOpen: (toast) => {
toast.addEventListener('mouseenter', Swal.stopTimer)
toast.addEventListener('mouseleave', Swal.resumeTimer)
}
})
Toast.fire({
icon: 'success',
title: 'Employee Address update successfully!'
});
setTimeout(function(){
window.location.reload(1);
}, 2000);
},
error: function(data) {
const Toast = Swal.mixin({
toast: true,
position: 'top-end',
showConfirmButton: false,
timer: 2000,
timerProgressBar: true,
didOpen: (toast) => {
toast.addEventListener('mouseenter', Swal.stopTimer)
toast.addEventListener('mouseleave', Swal.resumeTimer)
}
})
Toast.fire({
icon: 'error',
title: 'Something went wrong!'
});
}
});
}
});
$('#editEmployeeAddressFrom').validate({
rules: {
HomeTownDecalration: {
required: true,
},
HomeTownBlockYear: {
//required: true,
},
PermanentStreetAddress: {
required: true,
},
PermanentCountry: {
required: true,
},
PermanentState: {
required: true,
},
PermanentDistrict: {
required: true,
},
PermanentCity: {
required: true,
},
PermanentPinCode: {
required: true,
pattern: '^([0-9]){6}$',
},
CurrentStreetAddress: {
required: true,
},
CurrentCountry: {
required: true,
},
CurrentState: {
required: true,
},
CurrentDistrict: {
required: true,
},
CurrentCity: {
required: true,
},
CurrentPinCode: {
required: true,
pattern: '^([0-9]){6}$',
},
},
messages: {
CurrentPinCode: {
pattern: "Please insert valid pincode.",
},
PermanentPinCode: {
required: "Please insert valid pincode.",
},
},
errorElement: 'span',
errorPlacement: function (error, element) {
error.addClass('invalid-feedback');
element.closest('.form-group').append(error);
},
highlight: function (element, errorClass, validClass) {
$(element).addClass('is-invalid');
},
unhighlight: function (element, errorClass, validClass) {
$(element).removeClass('is-invalid');
}
});
});
</script>
<script>
function deleteEmployeeAddress(EmployeesAddressId) {
var EmployeesAddressId = EmployeesAddressId;
Swal.fire({
title: "Delete Address?",
text: "Are you sure you want to delete this Address?",
icon: "warning",
icon: "warning",
showCancelButton: true,
confirmButtonColor: "#3085d6",
cancelButtonColor: "#d33",
confirmButtonText: "Yes, delete it!",
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
type: "post",
url: "<?php echo e(url('/')); ?>/delete-employee-address",
dataType: "json",
data: {
_token: "<?php echo e(csrf_token()); ?>",
EmployeesAddressId: EmployeesAddressId,
},
success: function (response) {
Swal.fire({
icon: "success",
title: "Address has been deleted!",
showConfirmButton: false,
timer: 1500,
}).then(function () {
location.reload();
});
},
});
}
});
}
</script>
<script>
function changeStatusEmpAddress(EmployeesAddressId) {
var EmployeesAddressId = EmployeesAddressId;
Swal.fire({
title: "Change Status?",
text: "Are you sure you want to change status to this Address?",
icon: "warning",
icon: "warning",
showCancelButton: true,
confirmButtonColor: "#3085d6",
cancelButtonColor: "#d33",
confirmButtonText: "Yes, change it!",
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
type: "post",
url: "<?php echo e(url('/')); ?>/change-status-emp-address",
dataType: "json",
data: {
_token: "<?php echo e(csrf_token()); ?>",
EmployeesAddressId: EmployeesAddressId,
},
success: function (response) {
Swal.fire({
icon: "success",
title: "Status has been changed!",
showConfirmButton: false,
timer: 1500,
}).then(function () {
location.reload();
});
},
});
}
});
}
</script>
<?php /**PATH /var/www/html/hrms-production/resources/views/components/employee-address-modal.blade.php ENDPATH**/ ?>