Server IP : 103.6.199.200 / Your IP : 18.191.165.149 Web Server : Microsoft-IIS/10.0 System : Windows NT EMPUSA 10.0 build 20348 (Windows Server 2016) i586 User : EMPUSA$ ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Domains/jivisol1/build/42400163_Patch_20240823/ |
Upload File : |
@using JiView.Framework; @using JiView.WebClient.Security; @using JiView.Lang.Resource; @{ var globalDateFormat = System.Configuration.ConfigurationManager.AppSettings["AppDateFormatString"].ToString(); var isOnBehalfApplication = (ViewData["IsOnBehalf"] != null ? Convert.ToInt16(ViewData["IsOnBehalf"]) : 0); var viewEmpInfo = (ViewData["IsOnBehalf"] != null ? (ViewData["IsOnBehalf"].ToString() == "0" ? "hidden" : "") : "hidden"); //<JiraItem cref="E10-2809"> After Leave Saved, Leave Modal windows wants close automatically In Employee Roster</JiraItem> var IsCallFromEmployeeRoster = (ViewData["IsCallFromEmployeeRoster"] != null ? Convert.ToInt16(ViewData["IsCallFromEmployeeRoster"]) : 0); } <div class="d-flex justify-content-between align-items-center w-100 font-weight-bold py-1 mb-1"> <h5></h5> <div class="demo-inline-spacing"> <button type="button" class="btn btn-primary btn-round icon-btn ml-auto" id="btnApplyUCL" style="margin-left: 10px" data-toggle="modal" data-placement="bottom" title="@Resource.Save"> <span class="ion ion-md-save"></span> </button> </div> </div> <form name="apply-leave-form"> <div class="card"> <div class="card-body mb-1"> <div class="form-row" @viewEmpInfo> <div class="form-group col-md-6"> <label class="form-label">@Resource.EmployeeNumber - @Resource.EmployeeName</label> <input type="text" class="form-control" id="txtUCLEmployeeName" readonly> </div> <div class="form-group col-md-6"> <label class="form-label">@Resource.OrgName</label> <input type="text" class="form-control" id="txtUCLEmployeeOUName" readonly> </div> </div> @* Exception Type (Leave Type) && Leave Reason *@ <div class="form-row"> @* Exception Type *@ <div class="form-group col-md-6"> <label class="form-label">@Resource.LeaveType <span class="text-danger">*</span></label> <select class="select2-demo form-control" id="cmbUCLExceptionType" name="leavetype" placeholder="@Resource.Select @Resource.LeaveType"></select> </div> @* Leave Date *@ <div class="form-group col-md-6"> <label class="form-label">@Resource.LeaveDate <span class="text-danger">*</span></label> <input type="text" class="form-control clsleavestartdate" id="dtUCLDate" name="leavedate" placeholder="@Resource.Select @Resource.LeaveDate"> </div> </div> @*Shift Start And End Time*@ <div class="form-row"> @* Shift Start Time *@ <div class="form-group col-md-6"> <label class="form-label">@Resource.ShiftStartTime <span class="text-danger">*</span></label> <input type="text" class="form-control" readonly id="txtUCLShiftStartDateTime" name="shiftstarttime" placeholder="@Resource.Select @Resource.ShiftStartTime"> </div> @* Shift End Time *@ <div class="form-group col-md-6"> <label class="form-label">@Resource.ShiftEndTime <span class="text-danger">*</span></label> <input type="text" class="form-control" readonly id="txtUCLShiftEndDateTime" name="shiftendtime" placeholder="@Resource.Select @Resource.ShiftEndTime"> </div> </div> @* Leave Reference Number *@ <div class="form-row"> <div class="form-group col-md-12"> <label class="form-label">@Resource.ReferenceNo</label> <input type="text" class="form-control" id="txtUCLReferenceNo" placeholder="@Resource.ReferenceNo"> </div> </div> @* Leave Remarks *@ <div class="form-row"> <div class="form-group col-md-12"> <label class="form-label">@Resource.Remarks</label> <textarea class="form-control" rows="3" id="txtUCLRemarks" placeholder="@Resource.LeaveRemarks"></textarea> </div> </div> </div> </div> </form> <script src="~/Scripts/global/app-validations/leave-management-validation.js?v=@DateTime.Now" async></script> <script src="~/Scripts/global/initelements.js?v=@DateTime.Now" async></script> <script async> var currentDateShiftRow = undefined; var selectedEmployeeRow = undefined; var uclConfigValue = undefined; $(document).ready(() => { // Load Exception Types LoadingImage.show('#dvContent'); ScreenCaption.show('@Resource.ApplyforUncontrolledLeave'); // Initialize Date Picker Controls RenderDatePickerControl.init('@globalDateFormat', true, ['#dtUCLDate']); LoadUCLExceptionCodes(); $('#dtUCLDate').datepicker().on('changeDate', function (e) { // Check Whether Any Shift Assigned on the seleted date. LoadingImage.show('#dvContent'); GetShiftBySelectedDate((selectedEmployeeRow != undefined ? selectedEmployeeRow.EmployeeId : parseInt('@GlobalAttributes.LoginUserEmployeeID')), moment($("#dtUCLDate").val(), '@globalDateFormat.ToUpper()').format("YYYY-MM-DD")) .then(() => { LoadingImage.hide('#dvContent'); }); }); LoadingImage.show('#dvContent'); GetUnControlledLeaveConfigValue().then((configResult) => { uclConfigValue = configResult; GetShiftBySelectedDate((selectedEmployeeRow != undefined ? selectedEmployeeRow.EmployeeId : parseInt('@GlobalAttributes.LoginUserEmployeeID')), moment($("#dtUCLDate").val(), '@globalDateFormat.ToUpper()').format("YYYY-MM-DD")) .then(() => { LoadingImage.hide('#dvContent'); }); }); }); // Load Exception Codes function LoadUCLExceptionCodes(){ var exceptionCodesUrlString = '@Url.Action("GetAll", "ExceptionCodes", new { area = "Definitions", showEssOnly = "__showEssOnly", showAll = "__showAll", filterExceptionTypes = "__filterExceptionTypes", isClinicalAccess = "__isClinicalAccess", isOnBehalf="__isOnBehalf" })' exceptionCodesUrlString = exceptionCodesUrlString.replace("__showEssOnly", true) .replace("__filterExceptionTypes", '@Convert.ToInt32(AppEnumerations.ExceptionCodeTypes.UncontrolledLeave)') .replace("__showAll", false) .replace("__isClinicalAccess", 0) .replace("__isOnBehalf", 0) .replace(/&/g, '&'); LoadDropDownDataWithAjaxRequest.init('#cmbUCLExceptionType', '@Resource.Select @Resource.LeaveType', exceptionCodesUrlString) .then(function () { $('#cmbUCLExceptionType').val('').trigger('change'); LoadingImage.hide('#dvContent'); }); } $('#btnApplyUCL').click(() => { try { if ($("form[name=apply-leave-form]").valid() && currentDateShiftRow != undefined && currentDateShiftRow.ShiftId != 0) { selectedEmployeeRow = $('#txtUCLEmployeeName').data('selected-employee-row') || undefined; @*Validate whether work assigned if assigned show popup*@ if (currentDateShiftRow != undefined && currentDateShiftRow.ActivityId != 0) { @*Validate Confiramtion*@ ConfirmAndDelete(undefined, 'Are you sure you want to un-allocate assigned work?', '') .then((result) => { if (result == true) { @*Save UnControlled Leave Details*@ SaveUnControlledLeave().then((returnResult) => { if (returnResult.ReturnResultCode == '@AppEnumerations.UnControlledLeaveApplicationStatusCodes.UCLS001.ToString()') { //<JiraItem cref = "E10-3347"> [Employee Roster V2]Summary table - Total count is wrong for Time OFF </JiraItem> if ('@IsCallFromEmployeeRoster' == 1) LoadingImage.show('#divApplyLeaveModal', '@Resource.DeAllocateActivities'); else LoadingImage.show('#dvContent', '@Resource.DeAllocateActivities'); @* Retrieve Shift Details By Date And Employee ID*@ UnAssignSelectedWork(currentDateShiftRow.ShiftId).then(() => { LoadingImage.hide('#dvContent'); LoadingImage.hide('#divApplyLeaveModal'); ClearUCLLeaveApplicationContents(); }); } }); } }); } else { SaveUnControlledLeave().then((returnResult) => { if (returnResult.ReturnResultCode == '@AppEnumerations.UnControlledLeaveApplicationStatusCodes.UCLS001.ToString()') ClearUCLLeaveApplicationContents(); }); } } } catch (err) { LoadingImage.hide('#dvContent'); AppTost.show('error', err.message.toString(), '@Resource.ApplyforUncontrolledLeave'); } }); // Save UnControlled Leave function SaveUnControlledLeave() { var dfSaveLeave = new $.Deferred(); try { //<JiraItem cref = "E10-3347"> [Employee Roster V2]Summary table - Total count is wrong for Time OFF </JiraItem> if ('@IsCallFromEmployeeRoster' == 1) LoadingImage.show('#divApplyLeaveModal'); else LoadingImage.show('#dvContent'); var unControlledLeaveObj = { "UCLID": 0, "EmployeeId": (selectedEmployeeRow == undefined ? '@GlobalAttributes.LoginUserEmployeeID' : selectedEmployeeRow.EmployeeId), "ExceptionCodeId": $('#cmbUCLExceptionType').val(), "ExceptionCode": ($('#cmbUCLExceptionType').select2('data').shift() != null ? $('#cmbUCLExceptionType').select2('data').shift().ExcpetionCodeName : ''), "ExceptionCodeDesc": ($('#cmbUCLExceptionType').select2('data').shift() != null ? $('#cmbUCLExceptionType').select2('data').shift().ExceptionCodeDesc : ''), "UCLDate": moment($("#dtUCLDate").val(), '@globalDateFormat.ToUpper()').format("YYYY-MM-DD"), "ReferenceNo": $('#txtUCLReferenceNo').val(), "Remarks": $('#txtUCLRemarks').val(), "AppliedBy": ( '@GlobalAttributes.LoginUserEmployeeNumber' == '' ? '@GlobalAttributes.LoginUserName' : '@GlobalAttributes.LoginUserEmployeeNumber' ), "AppliedDate": new Date(), "CreatedBy": '@GlobalAttributes.LoginUserName', "MappedExceptions": (uclConfigValue != undefined ? uclConfigValue.ConfigValue : ''), "OUId": parseInt('@GlobalAttributes.CurrentOUID'), "IsOnBehalf": @isOnBehalfApplication == 1 ? true : false }; $.ajax({ url: '@Url.Action("CreateUnControlledLeave", "UncontrolledLeave", new { area = "SelfService" })', type: "POST", data: JSON.stringify({ "unControlledLeave": unControlledLeaveObj }), contentType: "application/json; charset=utf-8", async: true, cache: false, success: (response) => { var responseObject = JSON.parse(response); if (responseObject.IsSuccess == true) AppTost.show((responseObject.IsSuccess == true ? 'success' : 'error'), responseObject.ReturnResult, '@Resource.ApplyforUncontrolledLeave'); else AppTost.show((responseObject.IsSuccess == true ? 'success' : 'error'), responseObject.ReturnResult, '@Resource.ApplyforUncontrolledLeave'); LoadingImage.hide('#dvContent'); //<JiraItem cref="E10-2809"> After Leave Saved, Leave Modal windows wants close automatically in Employee Roster</JiraItem> if ('@IsCallFromEmployeeRoster' == 1) { //<JiraItem cref = "E10-3347"> [Employee Roster V2]Summary table - Total count is wrong for Time OFF </JiraItem> LoadingImage.hide('#divApplyLeaveModal'); funAfterLeaveSuccess(responseObject.IsSuccess, responseObject.ReturnResult); } dfSaveLeave.resolve(responseObject); }, error: (jqXHR, textStatus, errorThrown) => { LoadingImage.hide('#dvContent'); LoadingImage.hide('#divApplyLeaveModal'); AppTost.show("@Resource.error", jqXHR.responseJSON.ReturnResult, jqXHR.responseJSON.ReturnResultTitle); } }); } catch (err) { dfSaveLeave.fail(); LoadingImage.hide('#dvContent'); LoadingImage.hide('#divApplyLeaveModal'); throw err.message.toString(); } return dfSaveLeave.promise(); } // Clear Leave Application Contents function ClearUCLLeaveApplicationContents(){ try{ $('#cmbUCLExceptionType').val(null).trigger('change'); RenderDatePickerControl.init('@globalDateFormat', true, startAndEndDateObjects); $('#txtUCLReferenceNo').val(''); $('#txtUCLRemarks').val(''); $('#txtUCLShiftStartDateTime').val(''); $('#txtUCLShiftEndDateTime').val(''); } catch(err){ throw err.message.toString(); } } // Get Shift Details For Selected Date And Employee Id function GetShiftBySelectedDate(employeeId, selectedDate) { var dfShiftDetails = new $.Deferred(); try { LoadingImage.show('#dvContent'); currentDateShiftRow = undefined; var shiftInfoUrl = '@Url.Action("GetShiftStartAndEndTimeByEmployeeIdAndDate", "EmployeeRoster", new { area = "Scheduler", employeeId = "__employeeId", shiftDate = "__shiftDate" })'.replace("__employeeId", employeeId).replace("__shiftDate", selectedDate).replace(/&/g, '&');; AsyncAjaxCallAwaitReturn(shiftInfoUrl).done((returnResult) => { currentDateShiftRow = $.parseJSON(returnResult); if (currentDateShiftRow.ShiftId == 0) { if (selectedEmployeeRow != undefined) AppTost.show('warning', '@Resource.NoShiftsFound'.replace("{0}", moment($("#dtUCLDate").val(), '@globalDateFormat.ToUpper()').format("YYYY-MM-DD")), '@Resource.ApplyforUncontrolledLeave'); $('#txtUCLShiftStartDateTime').val(''); $('#txtUCLShiftEndDateTime').val(''); $('#btnApplyUCL').prop('hidden', true); $('#dtUCLDate').focus(); } else { $('#txtUCLShiftStartDateTime').val(ConvertDateFormat(currentDateShiftRow.ActualStartTime, '@globalDateFormat.ToUpper()') + ' ' + ConvertTimeFormat(currentDateShiftRow.ActualStartTime, 'HH:mm')); $('#txtUCLShiftEndDateTime').val(ConvertDateFormat(currentDateShiftRow.ActualEndTime, '@globalDateFormat.ToUpper()') + ' ' + ConvertTimeFormat(currentDateShiftRow.ActualEndTime, 'HH:mm')); $('#btnApplyUCL').prop('hidden', false); $('#txtUCLShiftStartDateTime').removeClass('is-invalid'); $('#txtUCLShiftEndDateTime').removeClass('is-invalid'); } dfShiftDetails.resolve(currentDateShiftRow); LoadingImage.hide('#dvContent'); }); } catch (err) { dfShiftDetails.fail(); LoadingImage.hide('#dvContent'); AppTost.show('error', err.message.toString(), '@Resource.ApplyforUncontrolledLeave'); } return dfShiftDetails.promise(); } @*Un Allocate Activities By Selected Shift Id*@ function UnAssignSelectedWork(shiftId) { var dfUnAssignWork = new $.Deferred(); try{ var urlString = '@Url.Action("UnAllocateActivityByShiftId", "DailyOperation", new { area = "Operations", shiftId = "__shiftId" })'.replace("__shiftId", shiftId ?? 0).replace(/&/g, '&'); AsyncAjaxCallAwaitReturn(urlString).done((result) => { var returnResult = JSON.parse(result); if (returnResult.success) AppTost.show('success', 'Shift Un-Allocated Successfully.', '@Resource.DailyOperation'); dfUnAssignWork.resolve(); }); } catch (err) { dfUnAssignWork.fail(); AppTost.show('error',err.message.toString(),'@Resource.ApplyforUncontrolledLeave'); } return dfUnAssignWork.promise(); } @*Load Uncontrolled Leave Configuration Value*@ function GetUnControlledLeaveConfigValue() { var dfConfig = new $.Deferred(); try { LoadingImage.show('#dvContent'); var urlString = '@Url.Action("GetLeaveIdDetail", "ScreenConfiguration", new { area = "Planning", configType = "__configType", configName = "__configName" })' .replace("__configType", @Convert.ToInt64(AppEnumerations.ConfigType.UncontrolledLeave)) .replace("__configName", '@AppEnumerations.ConfigName.LeaveCodeList').replace(/&/g, '&'); AsyncAjaxCallAwaitReturn(urlString).then((result) => { dfConfig.resolve($.parseJSON(result).shift()); }); return dfConfig.promise(); } catch (err) { dfConfig.fail(); LoadingImage.hide('#dvContent'); AppTost.show('error', err.message.toString(), '@Resource.ApplyforUncontrolledLeave'); } } </script>