diff --git a/js/digiriskdolibarr.min.js b/js/digiriskdolibarr.min.js index a44dea06a..fbe184e07 100644 --- a/js/digiriskdolibarr.min.js +++ b/js/digiriskdolibarr.min.js @@ -1 +1 @@ -"use strict";window.digiriskdolibarr||(window.digiriskdolibarr={},window.digiriskdolibarr.scriptsLoaded=!1),window.digiriskdolibarr.scriptsLoaded||(window.digiriskdolibarr.init=function(){window.digiriskdolibarr.load_list_script()},window.digiriskdolibarr.load_list_script=function(){if(!window.digiriskdolibarr.scriptsLoaded){var i=void 0,e=void 0;for(i in window.digiriskdolibarr)for(e in window.digiriskdolibarr[i].init&&window.digiriskdolibarr[i].init(),window.digiriskdolibarr[i])window.digiriskdolibarr[i]&&window.digiriskdolibarr[i][e]&&window.digiriskdolibarr[i][e].init&&window.digiriskdolibarr[i][e].init();window.digiriskdolibarr.scriptsLoaded=!0}},window.digiriskdolibarr.refresh=function(){var i=void 0,e=void 0;for(i in window.digiriskdolibarr)for(e in window.digiriskdolibarr[i].refresh&&window.digiriskdolibarr[i].refresh(),window.digiriskdolibarr[i])window.digiriskdolibarr[i]&&window.digiriskdolibarr[i][e]&&window.digiriskdolibarr[i][e].refresh&&window.digiriskdolibarr[i][e].refresh()},$(document).ready(window.digiriskdolibarr.init)),window.digiriskdolibarr.accident={},window.digiriskdolibarr.accident.init=function(){window.digiriskdolibarr.accident.event()},window.digiriskdolibarr.accident.event=function(){$(document).on("submit",".sendfile",window.digiriskdolibarr.accident.tmpStockFile),$(document).on("click",".linked-file-delete-workstop",window.digiriskdolibarr.accident.removeFile),$(document).on("change","#external_accident",window.digiriskdolibarr.accident.showExternalAccidentLocation)},window.digiriskdolibarr.accident.tmpStockFile=function(e,i=""){var s=$("#sendfile").prop("files"),t=new FormData;for(let i=0;ii.json()).then(i=>{i=i[0].option.matrix[e];t.find(".risk-evaluation-calculated-cotation").find(".risk-evaluation-cotation").attr("data-scale",window.digiriskdolibarr.evaluation.getDynamicScale(i)),t.find(".risk-evaluation-calculated-cotation").find(".risk-evaluation-cotation span").text(i),t.find(".risk-evaluation-content").find(".risk-evaluation-seuil").val(i),window.digiriskdolibarr.risk.haveDataInInput(t)})}},window.digiriskdolibarr.evaluator={},window.digiriskdolibarr.evaluator.init=function(){window.digiriskdolibarr.evaluator.event()},window.digiriskdolibarr.evaluator.event=function(){$(document).on("click",".evaluator-create",window.digiriskdolibarr.evaluator.createEvaluator),$(document).on("change","#fk_user_employer",window.digiriskdolibarr.evaluator.selectUser)},window.digiriskdolibarr.evaluator.selectUser=function(i){var e=window.saturne.toolbox.getToken(),s=$(this).closest(".modal-container"),t=s.find("#fk_user_employer").val();window.saturne.loader.display(s.find('input[name="evaluatorJob"]')),$.ajax({url:document.URL+"&action=getEvaluatorJob&token="+e,type:"POST",processData:!1,data:JSON.stringify({userID:t}),contentType:!1,success:function(i){s.find('input[name="evaluatorJob"]').val($(i).find('input[name="evaluatorJob"]').val()),s.find('input[name="evaluatorJob"]').removeClass("wpeo-loader")},error:function(i){}}),window.digiriskdolibarr.evaluator.haveDataInInput(s)},window.digiriskdolibarr.evaluator.haveDataInInput=function(i){i=i.parent().parent();i.hasClass("evaluator-add-modal")&&(0 div:nth-child(1)").text();var l=[];$(this).closest(".modal-container").find(".risk-categories").find(":selected").each(function(){l.push($(this).val())}),$.ajax({url:document.URL+"&action=saveRisk&token="+e,type:"POST",processData:!1,data:JSON.stringify({riskID:t,category:s,comment:r,newParent:o,categories:l}),contentType:!1,success:function(i){$(".wpeo-loader").removeClass("wpeo-loader");var e=$(".messageSuccessRiskEdit"),s=(o==a||n?($(".modal-active").removeClass("modal-active"),$(".risk-description-"+t).html($(i).find(".risk-description-"+t)),$(".risk-row-content-"+t).find(".risk-category .cell-risk").html($(i).find(".risk-row-content-"+t).find(".risk-category .cell-risk").children()),$(".risk-row-content-"+t).find(".risk-category").fadeOut(800),$(".risk-row-content-"+t).find(".risk-category").fadeIn(800),$(".risk-row-content-"+t).find(".risk-description-"+t).fadeOut(800),$(".risk-row-content-"+t).find(".risk-description-"+t).fadeIn(800)):$(".risk-row-content-"+t).fadeOut(800,function(){$(".fichecenter .opacitymedium.colorblack.paddingleft").html($(i).find("#searchFormListRisks .opacitymedium.colorblack.paddingleft"))}),""),s=(s=(s+=e.find(".valueForEditRisk1").val())+d)+e.find(".valueForEditRisk2").val();e.find("a").attr("href","#risk_row_"+t),e.find(".notice-subtitle .text").text(s),e.removeClass("hidden")},error:function(i){var e=$(".messageErrorRiskEdit"),s="",s=(s=(s+=e.find(".valueForEditRisk1").val())+d)+e.find(".valueForEditRisk2").val();e.find(".notice-subtitle .text").text(s),e.removeClass("hidden")}})},window.digiriskdolibarr.risk.unlinkSharedRisk=function(i){var e=window.saturne.toolbox.getToken();let s=$(this).attr("value"),t=(window.saturne.loader.display($(this)),$(".risk_row_"+s).find(".risk-container > div:nth-child(1)").text());var a=document.URL.split(/#/);$.ajax({url:a[0]+"&action=unlinkSharedRisk&token="+e,type:"POST",processData:!1,data:JSON.stringify({riskID:s}),contentType:!1,success:function(i){$(".confirmquestions").html($(i).find(".confirmquestions").children()),$(".fichecenter.sharedrisklist .opacitymedium.colorblack.paddingleft").html($(i).find("#searchFormSharedListRisks .opacitymedium.colorblack.paddingleft"));var i=$(".messageSuccessRiskUnlinkShared"),e=($("#risk_row_"+s).fadeOut(800),""),e=(e=(e+=i.find(".valueForUnlinkSharedRisk1").val())+t)+i.find(".valueForUnlinkSharedRisk2").val();i.find(".notice-subtitle .text").text(e),i.removeClass("hidden")},error:function(i){var e=$(".messageErrorRiskUnlinkShared"),s="",s=(s=(s+=e.find(".valueForUnlinkSharedRisk1").val())+t)+e.find(".valueForUnlinkSharedRisk2").val();e.find(".notice-subtitle .text").text(s),e.removeClass("hidden")}})},window.digiriskdolibarr.risk.sharedRiskBoxLoader=function(i){"Oui"==$(this).text()&&window.saturne.loader.display($("#searchFormSharedListRisks"))},window.digiriskdolibarr.evaluation={},window.digiriskdolibarr.evaluation.init=function(){window.digiriskdolibarr.evaluation.event()},window.digiriskdolibarr.evaluation.event=function(){$(document).on("click",".select-evaluation-method",window.digiriskdolibarr.evaluation.selectEvaluationMethod),$(document).on("click",".cotation-container .risk-evaluation-cotation.cotation",window.digiriskdolibarr.evaluation.selectSeuil),$(document).on("click",".risk-evaluation-create",window.digiriskdolibarr.evaluation.createEvaluation),$(document).on("click",".risk-evaluation-save",window.digiriskdolibarr.evaluation.saveEvaluation),$(document).on("click",".risk-evaluation-delete",window.digiriskdolibarr.evaluation.deleteEvaluation)},window.digiriskdolibarr.evaluation.selectEvaluationMethod=function(i){var e=$(this).closest(".modal-container");0"+e.split(/\(/)[0]+"("+(+s-1)+")"),s-1<1&&$(".fichecenter.risklist").html($(i).find("#searchFormListRisks")),t.removeClass("wpeo-loader"),""),e=(e=(e+=r.find(".valueForDeleteEvaluation1").val())+n)+r.find(".valueForDeleteEvaluation2").val();r.find(".notice-subtitle .text").text(e),r.removeClass("hidden")},error:function(i){var e="",e=(e=(e+=o.find(".valueForDeleteEvaluation1").val())+n)+o.find(".valueForDeleteEvaluation2").val();o.find(".notice-subtitle .text").text(e),o.removeClass("hidden")}})}},window.digiriskdolibarr.evaluation.saveEvaluation=function(i){var e=window.saturne.toolbox.getToken();let s=$(this).closest(".risk-evaluation-edit-modal"),t=s.attr("value");var a=s.find(".risk-evaluation-comment textarea").val();let n=$(this).closest(".risk-row").find(".risk-evaluations-list-content").attr("value"),r=$(".risk-evaluation-ref-"+t).attr("value"),o=$(".risk-evaluation-list-modal-"+n),d=$("#risk_evaluation_list"+n).hasClass("modal-active");var a=window.digiriskdolibarr.risk.sanitizeBeforeRequest(a),l=s.find(".risk-evaluation-method").val(),c=s.find(".risk-evaluation-seuil").val(),k=s.find("#RiskAssessmentDateEdit"+t).val(),u=s.find(".risk-evaluation-photo .filename").val();let m=[];Object.values($(".table-cell.active.cell-"+t)).forEach(function(i){-1<$(i).data("seuil")&&(m[$(i).data("type")]=$(i).data("seuil"))}),window.saturne.loader.display($(this)),$.ajax({url:document.URL+"&action=saveEvaluation&token="+e,type:"POST",processData:!1,data:JSON.stringify({cotation:c,comment:a,method:l,photo:u,date:k,evaluationID:t,criteres:{gravite:m.gravite||0,occurrence:m.occurrence||0,protection:m.protection||0,formation:m.formation||0,exposition:m.exposition||0}}),contentType:!1,success:function(i){$("#risk_evaluation_edit"+t).removeClass("modal-active"),0<$(i).find(".risk-evaluation-container.risk-evaluation-container-"+t+":not(.last-risk-assessment)").length?((d?($(".risk-evaluation-ref-"+t+":not(.last-risk-assessment)").fadeOut(800),$(".risk-evaluation-ref-"+t+":not(.last-risk-assessment)")):($(".risk-evaluation-container-"+t+":not(.last-risk-assessment)").fadeOut(800),$(".risk-evaluation-container-"+t+":not(.last-risk-assessment)"))).fadeIn(800),o.find(".risk-evaluation-ref-"+t).replaceWith($(i).find(".risk-evaluation-ref-"+t)),$(".risk-evaluation-container.risk-evaluation-container-"+t+":not(.last-risk-assessment)").replaceWith($(i).find(".risk-evaluation-container.risk-evaluation-container-"+t+":not(.last-risk-assessment)")),$("#risk_evaluation_add"+n).html($(i).find("#risk_evaluation_add"+n).children())):($(".div-table-responsive").html($(i).find(".div-table-responsive").children()),(d?($(".risk-evaluation-ref-"+t+":not(.last-risk-assessment)").fadeOut(800),$(".risk-evaluation-ref-"+t+":not(.last-risk-assessment)")):($(".risk-evaluation-container-"+t+":not(.last-risk-assessment)").fadeOut(800),$(".risk-evaluation-container-"+t+":not(.last-risk-assessment)"))).fadeIn(800)),$(".wpeo-loader").removeClass("wpeo-loader");var i=$(".messageSuccessEvaluationEdit"),e=(s.find("#risk_evaluation_edit"+t).removeClass("modal-active"),""),e=(e=(e+=i.find(".valueForEditEvaluation1").val())+r)+i.find(".valueForEditEvaluation2").val();i.find("a").attr("href","#risk_row_"+n),i.find(".notice-subtitle .text").text(e),i.removeClass("hidden")},error:function(){var i=$(".messageErrorEvaluationEdit"),e="",e=(e=(e+=i.find(".valueForEditEvaluation1").val())+r)+i.find(".valueForEditEvaluation2").val();i.find(".notice-subtitle .text").text(e),i.removeClass("hidden")}})},window.digiriskdolibarr.risksign={},window.digiriskdolibarr.risksign.init=function(){window.digiriskdolibarr.risksign.event()},window.digiriskdolibarr.risksign.event=function(){$(document).on("click",".risksign-category-danger .item, .wpeo-table .risksign-category-danger .item",window.digiriskdolibarr.risksign.selectRiskSign),$(document).on("click",".risksign-create:not(.button-disable)",window.digiriskdolibarr.risksign.createRiskSign),$(document).on("click",".risksign-save",window.digiriskdolibarr.risksign.saveRiskSign),$(document).on("click",".risksign-unlink-shared",window.digiriskdolibarr.risksign.unlinkSharedRiskSign)},window.digiriskdolibarr.risksign.selectRiskSign=function(i){var e=$(this),e=(e.closest(".content").removeClass("active"),e.closest(".wpeo-dropdown").find(".dropdown-toggle span").hide(),e.closest(".wpeo-dropdown").find(".dropdown-toggle img").show(),e.closest(".wpeo-dropdown").find(".dropdown-toggle img").attr("src",e.find("img").attr("src")),e.closest(".wpeo-dropdown").find(".dropdown-toggle img").attr("aria-label",e.closest(".wpeo-tooltip-event").attr("aria-label")),e.closest(".fichecenter").find(".input-hidden-danger").val(e.data("id")),$(this).closest(".modal-container"));window.digiriskdolibarr.risksign.haveDataInInput(e)},window.digiriskdolibarr.risksign.haveDataInInput=function(i){i=i.parent().parent();i.hasClass("risksign-add-modal")&&0<=i.find('input[name="risksign_category_id"]').val()&&i.find(".button-disable").removeClass("button-disable")},window.digiriskdolibarr.risksign.createRiskSign=function(i){var e=window.saturne.toolbox.getToken(),s=$(this).closest(".fichecenter").find(".risksign-content"),t=s.find(".risksign-category input").val(),s=s.find(".risksign-description textarea").val();window.saturne.loader.display($(".fichecenter.risksignlist")),$.ajax({url:document.URL+"&action=add&token="+e,type:"POST",data:JSON.stringify({riskSignCategory:t,riskSignDescription:s}),processData:!1,contentType:!1,success:function(i){$(".fichecenter.risksignlist").html($(i).find("#searchFormListRiskSigns"));var e=$(".messageSuccessRiskSignCreate");$(".fichecenter.risksignlist").removeClass("wpeo-loader"),e.html($(i).find(".risksign-create-success-notice")),e.removeClass("hidden")},error:function(i){var e=$(".messageErrorRiskCreate");e.html($(i).find(".risksign-create-error-notice")),e.removeClass("hidden")}})},window.digiriskdolibarr.risksign.saveRiskSign=function(i){var e=window.saturne.toolbox.getToken(),s=$(this).attr("value");let t=$(this).closest(".risksign-container").find(".risksign-content"),a="";var n=t.find(".risksign-category input").val(),r=t.find(".risksign-description textarea").val();let o=$(".risksign_row_"+s).find(".risksign-container > div:nth-child(1)").text();window.saturne.loader.display(t),$.ajax({url:document.URL+"&action=saveRiskSign&token="+e,data:JSON.stringify({riskSignID:s,riskSignCategory:n,riskSignDescription:r}),type:"POST",processData:!1,contentType:!1,success:function(i){$(".fichecenter.risksignlist").html($(i).find("#searchFormListRiskSigns"));i=$(".messageSuccessRiskSignEdit");t.removeClass("wpeo-loader"),a=(a=(a+=i.find(".valueForEditRiskSign1").val())+o)+i.find(".valueForEditRiskSign2").val(),i.find(".notice-subtitle .text").text(a),i.removeClass("hidden")},error:function(){var i=$(".messageErrorRiskSignEdit");t.removeClass("wpeo-loader"),a=(a=(a+=i.find(".valueForEditRiskSign1").val())+o)+i.find(".valueForEditRiskSign2").val(),i.find(".notice-subtitle .text").text(a),i.removeClass("hidden")}})},window.digiriskdolibarr.risksign.unlinkSharedRiskSign=function(i){var e=window.saturne.toolbox.getToken();let s=$(this).attr("value"),t=(window.saturne.loader.display($(this)),$(".risksign_row_"+s).find(".risksign-container > div:nth-child(1)").text());var a=document.URL.split(/#/);$.ajax({url:a[0]+"&action=unlinkSharedRiskSign&token="+e,type:"POST",processData:!1,data:JSON.stringify({risksignID:s}),contentType:!1,success:function(i){$(".fichecenter.sharedrisksignlist .opacitymedium.colorblack.paddingleft").html($(i).find("#searchFormSharedListRiskSigns .opacitymedium.colorblack.paddingleft"));var i=$(".messageSuccessRiskSignUnlinkShared"),e=($("#risksign_row_"+s).fadeOut(800),""),e=(e=(e+=i.find(".valueForUnlinkSharedRiskSign1").val())+t)+i.find(".valueForUnlinkSharedRiskSign2").val();i.find(".notice-subtitle .text").text(e),i.removeClass("hidden")},error:function(i){var e=$(".messageErrorRiskSignUnlinkShared"),s="",s=(s=(s+=e.find(".valueForUnlinkSharedRiskSign1").val())+t)+e.find(".valueForUnlinkSharedRiskSign2").val();e.find(".notice-subtitle .text").text(s),e.removeClass("hidden")}})},window.digiriskdolibarr.riskassessmenttask={},window.digiriskdolibarr.riskassessmenttask.init=function(){window.digiriskdolibarr.riskassessmenttask.event()},window.digiriskdolibarr.riskassessmenttask.event=function(){$(document).on("input",".riskassessment-task-label",window.digiriskdolibarr.riskassessmenttask.fillRiskAssessmentTaskLabel),$(document).on("click",".riskassessment-task-create",window.digiriskdolibarr.riskassessmenttask.createRiskAssessmentTask),$(document).on("click",".riskassessment-task-save",window.digiriskdolibarr.riskassessmenttask.saveRiskAssessmentTask),$(document).on("click",".riskassessment-task-delete",window.digiriskdolibarr.riskassessmenttask.deleteRiskAssessmentTask),$(document).on("click",".riskassessment-task-timespent-create",window.digiriskdolibarr.riskassessmenttask.createRiskAssessmentTaskTimeSpent),$(document).on("click",".riskassessment-task-timespent-save",window.digiriskdolibarr.riskassessmenttask.saveRiskAssessmentTaskTimeSpent),$(document).on("click",".riskassessment-task-timespent-delete",window.digiriskdolibarr.riskassessmenttask.deleteRiskAssessmentTaskTimeSpent),$(document).on("click",".riskassessment-task-progress-checkbox:not(.riskassessment-task-progress-checkbox-readonly)",window.digiriskdolibarr.riskassessmenttask.checkTaskProgress),$(document).on("change","#RiskassessmentTaskTimespentDatehour",window.digiriskdolibarr.riskassessmenttask.selectRiskassessmentTaskTimespentDateHour),$(document).on("change","#RiskassessmentTaskTimespentDatemin",window.digiriskdolibarr.riskassessmenttask.selectRiskassessmentTaskTimespentDateMin),$(document).on("keyup",".riskassessment-task-label",window.digiriskdolibarr.riskassessmenttask.checkRiskassessmentTaskLabelLength),$(document).on("click",".listingHeaderTaskTooltip",window.digiriskdolibarr.riskassessmenttask.redirectOnSharedTaskConfig)},window.digiriskdolibarr.riskassessmenttask.fillRiskAssessmentTaskLabel=function(i){var e=$(this).closest(".modal-container");window.digiriskdolibarr.riskassessmenttask.haveDataInInput(e)},window.digiriskdolibarr.riskassessmenttask.haveDataInInput=function(i){i=i.parent().parent();i.hasClass("riskassessment-task-add-modal")&&i.find('input[name="label"]').val().length&&i.find(".button-disable").removeClass("button-disable")},window.digiriskdolibarr.riskassessmenttask.createRiskAssessmentTask=function(i){var e=window.saturne.toolbox.getToken(),s=$(this).closest(".riskassessment-task-add-modal"),t=s.find(".modal-risk").attr("value"),s=s.find(".riskassessment-task-container"),a=s.find(".riskassessment-task-label").val(),a=window.digiriskdolibarr.risk.sanitizeBeforeRequest(a),n=s.find("#RiskassessmentTaskDateStart"+t).val(),r=s.find("#RiskassessmentTaskDateStart"+t+"hour").val(),o=s.find("#RiskassessmentTaskDateStart"+t+"min").val(),d=s.find("#RiskassessmentTaskDateEnd"+t).val(),l=s.find("#RiskassessmentTaskDateEnd"+t+"hour").val(),c=s.find("#RiskassessmentTaskDateEnd"+t+"min").val(),s=s.find(".riskassessment-task-budget").val();window.saturne.loader.display($(this)),window.saturne.loader.display($(".riskassessment-tasks"+t)),$.ajax({url:document.URL+"&action=addRiskAssessmentTask&token="+e,type:"POST",data:JSON.stringify({tasktitle:a,dateStart:n,hourStart:r,minStart:o,dateEnd:d,hourEnd:l,minEnd:c,budget:s,riskToAssign:t}),processData:!1,contentType:!1,success:function(i){$(".tasks-list-container-"+t).replaceWith($(i).find(".tasks-list-container-"+t));var e=$(".messageSuccessTaskCreate");$(".riskassessment-tasks"+t).fadeOut(800),$(".riskassessment-tasks"+t).fadeIn(800),e.find("a").attr("href","#risk_row_"+t),e.html($(i).find(".task-create-success-notice")),e.removeClass("hidden")},error:function(i){$(".wpeo-loader").removeClass("wpeo-loader"),window.scrollTo(0,0);var i=JSON.parse(i.responseText),e=$(".messageErrorTaskCreate"),s=($("#risk_assessment_task_add"+t).removeClass("modal-active"),""),s=(s=(s+=e.find(".valueForCreateTask1").val())+e.find(".valueForCreateTask2").val())+" : "+i.message;e.find(".notice-subtitle .text").text(s),e.removeClass("hidden")}})},window.digiriskdolibarr.riskassessmenttask.deleteRiskAssessmentTask=function(i){var e=window.saturne.toolbox.getToken(),t=$(this).closest(".wpeo-table.riskassessment-tasks").attr("value"),a=$(this).closest(".riskassessment-task-single-content").attr("value"),s=$(this).closest(".riskassessment-task-container-"+a).find(".labelForDelete").val();let n=$(".messageSuccessTaskDelete"),r=$(".messageErrorTaskDelete");if(1!=confirm(s))return!1;{let s=$(".riskassessment-task-container-"+a).attr("value");window.saturne.loader.display($(".riskassessment-task-container-"+a)),$.ajax({url:document.URL+"&action=deleteRiskAssessmentTask&deletedRiskAssessmentTaskId="+a+"&token="+e,type:"POST",processData:!1,contentType:!1,success:function(i){console.log($(".riskassessment-task-listing-wrapper-"+t)),console.log(t),$(".riskassessment-task-listing-wrapper-"+t).replaceWith($(i).find(".riskassessment-task-listing-wrapper-"+t)),$(".riskassessment-tasks"+t).fadeOut(800),$(".riskassessment-tasks"+t).fadeIn(800);i="",i=(i=(i+=n.find(".valueForDeleteTask1").val())+s)+n.find(".valueForDeleteTask2").val();n.find("a").attr("href","#risk_row_"+t),n.find(".notice-subtitle .text").text(i),n.removeClass("hidden")},error:function(i){$(".wpeo-loader").removeClass("wpeo-loader"),window.scrollTo(0,0);var i=JSON.parse(i.responseText),e="",e=(e=(e=(e+=r.find(".valueForDeleteTask1").val())+s)+r.find(".valueForDeleteTask2").val())+" : "+i.message;r.find(".notice-subtitle .text").text(e),r.removeClass("hidden")}})}},window.digiriskdolibarr.riskassessmenttask.saveRiskAssessmentTask=function(i){var e=window.saturne.toolbox.getToken();let s=$(this).attr("value");var t=$(this).closest(".modal-container"),a=$(this).closest(".modal-risk").attr("value");let n="";var r=t.find(".riskassessment-task-label"+s).val(),r=window.digiriskdolibarr.risk.sanitizeBeforeRequest(r);let o=$(".riskassessment-task-single-"+s+" .riskassessment-task-reference").attr("value"),d=0;t.find(".riskassessment-task-progress-checkbox"+s).is(":checked")&&(d=1);var l=t.find("#RiskassessmentTaskDateStartEdit"+s).val(),c=t.find("#RiskassessmentTaskDateStartEdit"+s+"hour").val(),k=t.find("#RiskassessmentTaskDateStartEdit"+s+"min").val(),u=t.find("#RiskassessmentTaskDateEndEdit"+s).val(),m=t.find("#RiskassessmentTaskDateEndEdit"+s+"hour").val(),v=t.find("#RiskassessmentTaskDateEndEdit"+s+"min").val(),t=t.find(".riskassessment-task-budget"+s).val();window.saturne.loader.display($(this)),window.saturne.loader.display($(".riskassessment-task-single-"+s)),$.ajax({url:document.URL+"&action=saveRiskAssessmentTask&token="+e,data:JSON.stringify({riskAssessmentTaskID:s,tasktitle:r,dateStart:l,hourStart:c,minStart:k,dateEnd:u,hourEnd:m,minEnd:v,budget:t,taskProgress:d}),type:"POST",processData:!1,contentType:!1,success:function(i){$("#risk_assessment_task_edit"+s).removeClass("modal-active"),$(".riskassessment-task-container-"+s).replaceWith($(i).find(".riskassessment-task-container-"+s).first());i=$(".messageSuccessTaskEdit");$(".riskassessment-tasks"+a).fadeOut(800),$(".riskassessment-tasks"+a).fadeIn(800),n=(n=(n+=i.find(".valueForEditTask1").val())+o)+i.find(".valueForEditTask2").val(),$(".wpeo-loader").removeClass("wpeo-loader"),$(".loader-spin").remove(),i.find("a").attr("href","#risk_row_"+a),i.find(".notice-subtitle .text").text(n),i.removeClass("hidden")},error:function(i){$(".wpeo-loader").removeClass("wpeo-loader"),window.scrollTo(0,0);var i=JSON.parse(i.responseText),e=$(".messageErrorTaskEdit");$("#risk_assessment_task_edit"+s).removeClass("modal-active"),$(".wpeo-loader").removeClass("wpeo-loader"),n=(n=(n=(n+=e.find(".valueForEditTask1").val())+o)+e.find(".valueForEditTask2").val()+" : ")+i.message,e.find(".notice-subtitle .text").text(n),e.removeClass("hidden")}})},window.digiriskdolibarr.riskassessmenttask.createRiskAssessmentTaskTimeSpent=function(i){var e=window.saturne.toolbox.getToken();let s=$(this).attr("value");var t=$(this).closest(".riskassessment-task-edit-modal"),a=t.find(".riskassessment-task-timespent-container");let n=t.find("riskassessment-task-single").attr("value"),r="",o=t.find(".riskassessment-task-reference").attr("value"),d=$(".id-container").find(".riskassessment-total-task-timespent-"+s);var t=a.find("#RiskassessmentTaskTimespentDate"+s).val(),l=a.find("#RiskassessmentTaskTimespentDate"+s+"hour").val(),c=a.find("#RiskassessmentTaskTimespentDate"+s+"min").val(),k=a.find(".riskassessment-task-timespent-comment").val(),k=window.digiriskdolibarr.risk.sanitizeBeforeRequest(k),a=a.find(".riskassessment-task-timespent-duration").val();window.saturne.loader.display($(this)),window.saturne.loader.display($(".riskassessment-task-single-"+s)),$.ajax({url:document.URL+"&action=addRiskAssessmentTaskTimeSpent&token="+e,type:"POST",data:JSON.stringify({taskID:s,date:t,hour:l,min:c,comment:k,duration:a}),processData:!1,contentType:!1,success:function(i){var e=$(".messageSuccessTaskTimeSpentCreate"+s);$(".riskassessment-tasks"+n).fadeOut(800),$(".riskassessment-tasks"+n).fadeIn(800),r=(r=(r+=e.find(".valueForCreateTaskTimeSpent1").val())+o)+e.find(".valueForCreateTaskTimeSpent2").val(),$(".riskassessment-task-timespent-container").find(".riskassessment-task-timespent-list-"+s).replaceWith($(i).find(".riskassessment-task-timespent-container").find(".riskassessment-task-timespent-list-"+s)),$(".riskassessment-task-container-"+s).closest(".riskassessment-tasks").replaceWith($(i).find(".riskassessment-task-container-"+s).closest(".riskassessment-tasks")),$(".loader-spin").remove(),$(".wpeo-loader").removeClass("wpeo-loader"),e.find(".notice-subtitle .text").text(r),e.removeClass("hidden"),d.html($(i).find(".modal-content").find(".riskassessment-total-task-timespent-"+s).first())},error:function(i){$(this).closest(".risk-row-content-"+n).removeClass("wpeo-loader");var e=$(".messageErrorTaskTimeSpentCreate"+s);e.html($(i).find(".task-timespent-create-error-notice")),e.removeClass("hidden")},complete:function(){$("#risk_assessment_task_edit"+s+".wpeo-modal").addClass("modal-active")}})},window.digiriskdolibarr.riskassessmenttask.deleteRiskAssessmentTaskTimeSpent=function(i){var e=window.saturne.toolbox.getToken();let a=$(this).closest(".riskassessment-task-timespent-list").attr("value"),n=$(this).attr("value");var s=$(this).attr("value"),t=$(this).closest(".riskassessment-task-timespent-"+n).find(".labelForDelete").val();let r=$(".id-container").first().find(".riskassessment-total-task-timespent-"+a);if(1!=confirm(t))return!1;{let t=$(".riskassessment-task-container-"+a).attr("value");window.saturne.loader.display($(this)),$.ajax({url:document.URL+"&action=deleteRiskAssessmentTaskTimeSpent&deletedRiskAssessmentTaskTimeSpentId="+s+"&token="+e,type:"POST",processData:!1,contentType:!1,success:function(i){var e=$(".messageSuccessTaskTimeSpentDelete"+a),s=($(".riskassessment-task-timespent-"+n).fadeOut(800),""),s=(s=(s+=e.find(".valueForDeleteTaskTimeSpent1").val())+t)+e.find(".valueForDeleteTaskTimeSpent2").val();e.find(".notice-subtitle .text").text(s),e.removeClass("hidden"),r.html($(i).find(".modal-content").find(".riskassessment-total-task-timespent-"+a).first())},error:function(i){var e=$(".messageErrorTaskDeleteTimeSpent"+a),s="",s=(s=(s+=e.find(".valueForDeleteTaskTimeSpent1").val())+t)+e.find(".valueForDeleteTaskTimeSpent2").val();e.find(".notice-subtitle .text").text(s),e.removeClass("hidden")}})}},window.digiriskdolibarr.riskassessmenttask.saveRiskAssessmentTaskTimeSpent=function(i){var e=window.saturne.toolbox.getToken();let s=$(this);var t=$(this).attr("value"),a=$(this).closest(".riskassessment-task-timespent-edit-modal").find(".riskassessment-task-timespent-container");let n=a.attr("value"),r="",o=$(".riskassessment-task-container-"+n).attr("value"),d=$(".id-container").first().find(".riskassessment-total-task-timespent-"+n);var l=a.find("#RiskassessmentTaskTimespentDateEdit"+t).val(),c=a.find("#RiskassessmentTaskTimespentDateEdit"+t+"hour").val(),k=a.find("#RiskassessmentTaskTimespentDateEdit"+t+"min").val(),u=a.find(".riskassessment-task-timespent-comment").val(),u=window.digiriskdolibarr.risk.sanitizeBeforeRequest(u),a=a.find(".riskassessment-task-timespent-duration").val();window.saturne.loader.display($(this)),window.saturne.loader.display($(".riskassessment-task-single-"+n)),$.ajax({url:document.URL+"&action=saveRiskAssessmentTaskTimeSpent&token="+e,data:JSON.stringify({riskAssessmentTaskTimeSpentID:t,taskID:n,date:l,hour:c,min:k,comment:u,duration:a}),type:"POST",processData:!1,contentType:!1,success:function(i){s.closest(".modal-active").removeClass("modal-active");var e=$(".messageSuccessTaskTimeSpentEdit"+n);$(".wpeo-loader").removeClass("wpeo-loader"),r=(r=(r+=e.find(".valueForEditTaskTimeSpent1").val())+o)+e.find(".valueForEditTaskTimeSpent2").val(),d.html($(i).find(".modal-content").find(".riskassessment-total-task-timespent-"+n).first()),$(".riskassessment-task-timespent-list-"+n).html($(i).find(".riskassessment-task-timespent-list-"+n).children()),e.find(".notice-subtitle .text").text(r),e.removeClass("hidden")},error:function(i){var e=$(".messageSuccessTaskTimeSpentEdit"+n);r=(r=(r+=e.find(".valueForEditTaskTimeSpent1").val())+o)+e.find(".valueForEditTaskTimeSpent2").val(),e.find(".notice-subtitle .text").text(r),e.removeClass("hidden")}})},window.digiriskdolibarr.riskassessmenttask.checkTaskProgress=function(i){var e=window.saturne.toolbox.getToken(),s=$(this).closest(".risk-row").find(".riskassessment-task-container"),t=$(this).closest(".riskassessment-task-single-content").attr("value");let a=$(this).closest(".riskassessment-tasks").attr("value"),n="",r=s.attr("value"),o="";s.find(".riskassessment-task-progress-checkbox"+t).hasClass("progress-checkbox-check")?(o=0,s.find(".riskassessment-task-progress-checkbox"+t).toggleClass("progress-checkbox-check").toggleClass("progress-checkbox-uncheck")):s.find(".riskassessment-task-progress-checkbox"+t).hasClass("progress-checkbox-uncheck")&&(o=1,s.find(".riskassessment-task-progress-checkbox"+t).toggleClass("progress-checkbox-uncheck").toggleClass("progress-checkbox-check")),window.saturne.loader.display($(".riskassessment-task-single-"+t));s=window.location.href.replace(/#.*/,"");$.ajax({url:s+"&action=checkTaskProgress&token="+e,data:JSON.stringify({riskAssessmentTaskID:t,taskProgress:o}),type:"POST",processData:!1,contentType:!1,success:function(i){$(".fichecenter.risklist").html($(i).find("#searchFormListRisks"));i=$(".messageSuccessTaskEdit");$(".riskassessment-tasks"+a).fadeOut(800),$(".riskassessment-tasks"+a).fadeIn(800),n=(n=(n+=i.find(".valueForEditTask1").val())+r)+i.find(".valueForEditTask2").val(),i.find(".notice-subtitle .text").text(n),i.removeClass("hidden")},error:function(i){var e=$(".messageErrorTaskEdit");n=(n=(n+=e.find(".valueForEditTask1").val())+r)+e.find(".valueForEditTask2").val(),e.find(".notice-subtitle .text").text(n),e.removeClass("hidden")}})},window.digiriskdolibarr.riskassessmenttask.selectRiskassessmentTaskTimespentDateHour=function(i){$(this).closest(".nowraponall").find(".select-riskassessmenttask-timespent-datehour").remove(),$(this).before('{$("#sendFileForm").load(document.URL+n+"ticket_id="+a+" #fileLinkedTable")})},window.digiriskdolibarr.ticket.removeFile=function(i){let e=$(this).attr("value");e=e.replace("_mini","");var s=$("#ticket_id").val(),t=window.saturne.toolbox.getQuerySeparator(document.URL);fetch(document.URL+t+"action=removefile&filetodelete="+e+"&ticket_id="+s,{method:"POST"}).then(i=>{$(this).parent().parent().hide()})},window.digiriskdolibarr.ticket.addDashBoardTicketInfo=function(){var i=window.saturne.toolbox.getToken(),e=$("#select2-boxcombo-container").attr("title"),s=e.split(" : ")[0],e=e.split(" : ")[2],t=window.saturne.toolbox.getQuerySeparator(document.URL);$.ajax({url:document.URL+t+"action=adddashboardinfo&token="+i,type:"POST",processData:!1,data:JSON.stringify({digiriskelementID:s,catID:e}),contentType:!1,success:function(i){window.location.reload()},error:function(){}})},window.digiriskdolibarr.ticket.closeDashBoardTicketInfo=function(){var i=window.saturne.toolbox.getToken();let e=$(this);var s=e.attr("data-digiriskelementid"),t=e.attr("data-catid"),a=window.saturne.toolbox.getQuerySeparator(document.URL);$.ajax({url:document.URL+a+"action=closedashboardinfo&token="+i,type:"POST",processData:!1,data:JSON.stringify({digiriskelementID:s,catID:t}),contentType:!1,success:function(i){e.closest(".box-flex-item").fadeOut(400),$(".add-widget-box").attr("style",""),$(".add-widget-box").html($(i).find(".add-widget-box").children())},error:function(){}})},window.digiriskdolibarr.ticket.checkValidEmail=function(){0==/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/.test(this.value)?$(this).css("border","3px solid red"):$(this).css("border","3px solid green")},window.digiriskdolibarr.ticket.checkValidPhone=function(){0==/^(?:(?:(?:\+|00)\d{2}[\s]?(?:\(0\)[\s]?)?)|0){1}[1-9]{1}([\s.-]?)(?:\d{2}\1?){3}\d{2}$/.test(this.value)?$(this).css("border","3px solid red"):$(this).css("border","3px solid green")},window.digiriskdolibarr.digiriskusers={},window.digiriskdolibarr.digiriskusers.init=function(){window.digiriskdolibarr.digiriskusers.event()},window.digiriskdolibarr.digiriskusers.event=function(){$(document).on("input",".digirisk-users #firstname",window.digiriskdolibarr.digiriskusers.fillEmail),$(document).on("input",".digirisk-users #lastname",window.digiriskdolibarr.digiriskusers.fillEmail)},window.digiriskdolibarr.digiriskusers.fillEmail=function(i){var e=$(".digirisk-users #firstname").val(),s=$(".digirisk-users #lastname").val(),t=$(".input-domain-mail").val(),e=window.digiriskdolibarr.digiriskusers.removeDiacritics(e+"."+s+"@"+t).toLowerCase();$(".digirisk-users #email").val(e)},window.digiriskdolibarr.digiriskusers.removeDiacritics=function(i){for(var e="",s=i.normalize("NFD"),t=0,a=0;ti.json()).then(i=>{i=i[0].option.matrix[e];t.find(".risk-evaluation-calculated-cotation").find(".risk-evaluation-cotation").attr("data-scale",window.digiriskdolibarr.evaluation.getDynamicScale(i)),t.find(".risk-evaluation-calculated-cotation").find(".risk-evaluation-cotation span").text(i),t.find(".risk-evaluation-content").find(".risk-evaluation-seuil").val(i),window.digiriskdolibarr.risk.haveDataInInput(t)})}},window.digiriskdolibarr.evaluator={},window.digiriskdolibarr.evaluator.init=function(){window.digiriskdolibarr.evaluator.event()},window.digiriskdolibarr.evaluator.event=function(){$(document).on("click",".evaluator-create",window.digiriskdolibarr.evaluator.createEvaluator),$(document).on("change","#fk_user_employer",window.digiriskdolibarr.evaluator.selectUser)},window.digiriskdolibarr.evaluator.selectUser=function(i){var e=window.saturne.toolbox.getToken(),s=$(this).closest(".modal-container"),t=s.find("#fk_user_employer").val();window.saturne.loader.display(s.find('input[name="evaluatorJob"]')),$.ajax({url:document.URL+"&action=getEvaluatorJob&token="+e,type:"POST",processData:!1,data:JSON.stringify({userID:t}),contentType:!1,success:function(i){s.find('input[name="evaluatorJob"]').val($(i).find('input[name="evaluatorJob"]').val()),s.find('input[name="evaluatorJob"]').removeClass("wpeo-loader")},error:function(i){}}),window.digiriskdolibarr.evaluator.haveDataInInput(s)},window.digiriskdolibarr.evaluator.haveDataInInput=function(i){i=i.parent().parent();i.hasClass("evaluator-add-modal")&&(0 div:nth-child(1)").text();var l=[];$(this).closest(".modal-container").find(".risk-categories").find(":selected").each(function(){l.push($(this).val())}),$.ajax({url:document.URL+"&action=saveRisk&token="+e,type:"POST",processData:!1,data:JSON.stringify({riskID:t,category:s,comment:r,newParent:o,categories:l}),contentType:!1,success:function(i){$(".wpeo-loader").removeClass("wpeo-loader");var e=$(".messageSuccessRiskEdit"),s=(o==a||n?($(".modal-active").removeClass("modal-active"),$(".risk-description-"+t).html($(i).find(".risk-description-"+t)),$(".risk-row-content-"+t).find(".risk-category .cell-risk").html($(i).find(".risk-row-content-"+t).find(".risk-category .cell-risk").children()),$(".risk-row-content-"+t).find(".risk-category").fadeOut(800),$(".risk-row-content-"+t).find(".risk-category").fadeIn(800),$(".risk-row-content-"+t).find(".risk-description-"+t).fadeOut(800),$(".risk-row-content-"+t).find(".risk-description-"+t).fadeIn(800)):$(".risk-row-content-"+t).fadeOut(800,function(){$(".fichecenter .opacitymedium.colorblack.paddingleft").html($(i).find("#searchFormListRisks .opacitymedium.colorblack.paddingleft"))}),""),s=(s=(s+=e.find(".valueForEditRisk1").val())+d)+e.find(".valueForEditRisk2").val();e.find("a").attr("href","#risk_row_"+t),e.find(".notice-subtitle .text").text(s),e.removeClass("hidden")},error:function(i){var e=$(".messageErrorRiskEdit"),s="",s=(s=(s+=e.find(".valueForEditRisk1").val())+d)+e.find(".valueForEditRisk2").val();e.find(".notice-subtitle .text").text(s),e.removeClass("hidden")}})},window.digiriskdolibarr.risk.unlinkSharedRisk=function(i){var e=window.saturne.toolbox.getToken();let s=$(this).attr("value"),t=(window.saturne.loader.display($(this)),$(".risk_row_"+s).find(".risk-container > div:nth-child(1)").text());var a=document.URL.split(/#/);$.ajax({url:a[0]+"&action=unlinkSharedRisk&token="+e,type:"POST",processData:!1,data:JSON.stringify({riskID:s}),contentType:!1,success:function(i){$(".confirmquestions").html($(i).find(".confirmquestions").children()),$(".fichecenter.sharedrisklist .opacitymedium.colorblack.paddingleft").html($(i).find("#searchFormSharedListRisks .opacitymedium.colorblack.paddingleft"));var i=$(".messageSuccessRiskUnlinkShared"),e=($("#risk_row_"+s).fadeOut(800),""),e=(e=(e+=i.find(".valueForUnlinkSharedRisk1").val())+t)+i.find(".valueForUnlinkSharedRisk2").val();i.find(".notice-subtitle .text").text(e),i.removeClass("hidden")},error:function(i){var e=$(".messageErrorRiskUnlinkShared"),s="",s=(s=(s+=e.find(".valueForUnlinkSharedRisk1").val())+t)+e.find(".valueForUnlinkSharedRisk2").val();e.find(".notice-subtitle .text").text(s),e.removeClass("hidden")}})},window.digiriskdolibarr.risk.sharedRiskBoxLoader=function(i){"Oui"==$(this).text()&&window.saturne.loader.display($("#searchFormSharedListRisks"))},window.digiriskdolibarr.evaluation={},window.digiriskdolibarr.evaluation.init=function(){window.digiriskdolibarr.evaluation.event()},window.digiriskdolibarr.evaluation.event=function(){$(document).on("click",".select-evaluation-method",window.digiriskdolibarr.evaluation.selectEvaluationMethod),$(document).on("click",".cotation-container .risk-evaluation-cotation.cotation",window.digiriskdolibarr.evaluation.selectSeuil),$(document).on("click",".risk-evaluation-create",window.digiriskdolibarr.evaluation.createEvaluation),$(document).on("click",".risk-evaluation-save",window.digiriskdolibarr.evaluation.saveEvaluation),$(document).on("click",".risk-evaluation-delete",window.digiriskdolibarr.evaluation.deleteEvaluation)},window.digiriskdolibarr.evaluation.selectEvaluationMethod=function(i){var e=$(this).closest(".modal-container");0"+e.split(/\(/)[0]+"("+(+s-1)+")"),s-1<1&&$(".fichecenter.risklist").html($(i).find("#searchFormListRisks")),t.removeClass("wpeo-loader"),""),e=(e=(e+=r.find(".valueForDeleteEvaluation1").val())+n)+r.find(".valueForDeleteEvaluation2").val();r.find(".notice-subtitle .text").text(e),r.removeClass("hidden")},error:function(i){var e="",e=(e=(e+=o.find(".valueForDeleteEvaluation1").val())+n)+o.find(".valueForDeleteEvaluation2").val();o.find(".notice-subtitle .text").text(e),o.removeClass("hidden")}})}},window.digiriskdolibarr.evaluation.saveEvaluation=function(i){var e=window.saturne.toolbox.getToken();let s=$(this).closest(".risk-evaluation-edit-modal"),t=s.attr("value");var a=s.find(".risk-evaluation-comment textarea").val();let n=$(this).closest(".risk-row").find(".risk-evaluations-list-content").attr("value"),r=$(".risk-evaluation-ref-"+t).attr("value"),o=$(".risk-evaluation-list-modal-"+n),d=$("#risk_evaluation_list"+n).hasClass("modal-active");var a=window.digiriskdolibarr.risk.sanitizeBeforeRequest(a),l=s.find(".risk-evaluation-method").val(),c=s.find(".risk-evaluation-seuil").val(),k=s.find("#RiskAssessmentDateEdit"+t).val(),u=s.find(".risk-evaluation-photo .filename").val();let m=[];Object.values($(".table-cell.active.cell-"+t)).forEach(function(i){-1<$(i).data("seuil")&&(m[$(i).data("type")]=$(i).data("seuil"))}),window.saturne.loader.display($(this)),$.ajax({url:document.URL+"&action=saveEvaluation&token="+e,type:"POST",processData:!1,data:JSON.stringify({cotation:c,comment:a,method:l,photo:u,date:k,evaluationID:t,criteres:{gravite:m.gravite||0,occurrence:m.occurrence||m.frequence||0,protection:m.protection||m.historique||0,formation:m.formation||m.maitrise||0,exposition:m.exposition||m.milieu||0}}),contentType:!1,success:function(i){$("#risk_evaluation_edit"+t).removeClass("modal-active"),0<$(i).find(".risk-evaluation-container.risk-evaluation-container-"+t+":not(.last-risk-assessment)").length?((d?($(".risk-evaluation-ref-"+t+":not(.last-risk-assessment)").fadeOut(800),$(".risk-evaluation-ref-"+t+":not(.last-risk-assessment)")):($(".risk-evaluation-container-"+t+":not(.last-risk-assessment)").fadeOut(800),$(".risk-evaluation-container-"+t+":not(.last-risk-assessment)"))).fadeIn(800),o.find(".risk-evaluation-ref-"+t).replaceWith($(i).find(".risk-evaluation-ref-"+t)),$(".risk-evaluation-container.risk-evaluation-container-"+t+":not(.last-risk-assessment)").replaceWith($(i).find(".risk-evaluation-container.risk-evaluation-container-"+t+":not(.last-risk-assessment)")),$("#risk_evaluation_add"+n).html($(i).find("#risk_evaluation_add"+n).children())):($(".div-table-responsive").html($(i).find(".div-table-responsive").children()),(d?($(".risk-evaluation-ref-"+t+":not(.last-risk-assessment)").fadeOut(800),$(".risk-evaluation-ref-"+t+":not(.last-risk-assessment)")):($(".risk-evaluation-container-"+t+":not(.last-risk-assessment)").fadeOut(800),$(".risk-evaluation-container-"+t+":not(.last-risk-assessment)"))).fadeIn(800)),$(".wpeo-loader").removeClass("wpeo-loader");var i=$(".messageSuccessEvaluationEdit"),e=(s.find("#risk_evaluation_edit"+t).removeClass("modal-active"),""),e=(e=(e+=i.find(".valueForEditEvaluation1").val())+r)+i.find(".valueForEditEvaluation2").val();i.find("a").attr("href","#risk_row_"+n),i.find(".notice-subtitle .text").text(e),i.removeClass("hidden")},error:function(){var i=$(".messageErrorEvaluationEdit"),e="",e=(e=(e+=i.find(".valueForEditEvaluation1").val())+r)+i.find(".valueForEditEvaluation2").val();i.find(".notice-subtitle .text").text(e),i.removeClass("hidden")}})},window.digiriskdolibarr.risksign={},window.digiriskdolibarr.risksign.init=function(){window.digiriskdolibarr.risksign.event()},window.digiriskdolibarr.risksign.event=function(){$(document).on("click",".risksign-category-danger .item, .wpeo-table .risksign-category-danger .item",window.digiriskdolibarr.risksign.selectRiskSign),$(document).on("click",".risksign-create:not(.button-disable)",window.digiriskdolibarr.risksign.createRiskSign),$(document).on("click",".risksign-save",window.digiriskdolibarr.risksign.saveRiskSign),$(document).on("click",".risksign-unlink-shared",window.digiriskdolibarr.risksign.unlinkSharedRiskSign)},window.digiriskdolibarr.risksign.selectRiskSign=function(i){var e=$(this),e=(e.closest(".content").removeClass("active"),e.closest(".wpeo-dropdown").find(".dropdown-toggle span").hide(),e.closest(".wpeo-dropdown").find(".dropdown-toggle img").show(),e.closest(".wpeo-dropdown").find(".dropdown-toggle img").attr("src",e.find("img").attr("src")),e.closest(".wpeo-dropdown").find(".dropdown-toggle img").attr("aria-label",e.closest(".wpeo-tooltip-event").attr("aria-label")),e.closest(".fichecenter").find(".input-hidden-danger").val(e.data("id")),$(this).closest(".modal-container"));window.digiriskdolibarr.risksign.haveDataInInput(e)},window.digiriskdolibarr.risksign.haveDataInInput=function(i){i=i.parent().parent();i.hasClass("risksign-add-modal")&&0<=i.find('input[name="risksign_category_id"]').val()&&i.find(".button-disable").removeClass("button-disable")},window.digiriskdolibarr.risksign.createRiskSign=function(i){var e=window.saturne.toolbox.getToken(),s=$(this).closest(".fichecenter").find(".risksign-content"),t=s.find(".risksign-category input").val(),s=s.find(".risksign-description textarea").val();window.saturne.loader.display($(".fichecenter.risksignlist")),$.ajax({url:document.URL+"&action=add&token="+e,type:"POST",data:JSON.stringify({riskSignCategory:t,riskSignDescription:s}),processData:!1,contentType:!1,success:function(i){$(".fichecenter.risksignlist").html($(i).find("#searchFormListRiskSigns"));var e=$(".messageSuccessRiskSignCreate");$(".fichecenter.risksignlist").removeClass("wpeo-loader"),e.html($(i).find(".risksign-create-success-notice")),e.removeClass("hidden")},error:function(i){var e=$(".messageErrorRiskCreate");e.html($(i).find(".risksign-create-error-notice")),e.removeClass("hidden")}})},window.digiriskdolibarr.risksign.saveRiskSign=function(i){var e=window.saturne.toolbox.getToken(),s=$(this).attr("value");let t=$(this).closest(".risksign-container").find(".risksign-content"),a="";var n=t.find(".risksign-category input").val(),r=t.find(".risksign-description textarea").val();let o=$(".risksign_row_"+s).find(".risksign-container > div:nth-child(1)").text();window.saturne.loader.display(t),$.ajax({url:document.URL+"&action=saveRiskSign&token="+e,data:JSON.stringify({riskSignID:s,riskSignCategory:n,riskSignDescription:r}),type:"POST",processData:!1,contentType:!1,success:function(i){$(".fichecenter.risksignlist").html($(i).find("#searchFormListRiskSigns"));i=$(".messageSuccessRiskSignEdit");t.removeClass("wpeo-loader"),a=(a=(a+=i.find(".valueForEditRiskSign1").val())+o)+i.find(".valueForEditRiskSign2").val(),i.find(".notice-subtitle .text").text(a),i.removeClass("hidden")},error:function(){var i=$(".messageErrorRiskSignEdit");t.removeClass("wpeo-loader"),a=(a=(a+=i.find(".valueForEditRiskSign1").val())+o)+i.find(".valueForEditRiskSign2").val(),i.find(".notice-subtitle .text").text(a),i.removeClass("hidden")}})},window.digiriskdolibarr.risksign.unlinkSharedRiskSign=function(i){var e=window.saturne.toolbox.getToken();let s=$(this).attr("value"),t=(window.saturne.loader.display($(this)),$(".risksign_row_"+s).find(".risksign-container > div:nth-child(1)").text());var a=document.URL.split(/#/);$.ajax({url:a[0]+"&action=unlinkSharedRiskSign&token="+e,type:"POST",processData:!1,data:JSON.stringify({risksignID:s}),contentType:!1,success:function(i){$(".fichecenter.sharedrisksignlist .opacitymedium.colorblack.paddingleft").html($(i).find("#searchFormSharedListRiskSigns .opacitymedium.colorblack.paddingleft"));var i=$(".messageSuccessRiskSignUnlinkShared"),e=($("#risksign_row_"+s).fadeOut(800),""),e=(e=(e+=i.find(".valueForUnlinkSharedRiskSign1").val())+t)+i.find(".valueForUnlinkSharedRiskSign2").val();i.find(".notice-subtitle .text").text(e),i.removeClass("hidden")},error:function(i){var e=$(".messageErrorRiskSignUnlinkShared"),s="",s=(s=(s+=e.find(".valueForUnlinkSharedRiskSign1").val())+t)+e.find(".valueForUnlinkSharedRiskSign2").val();e.find(".notice-subtitle .text").text(s),e.removeClass("hidden")}})},window.digiriskdolibarr.riskassessmenttask={},window.digiriskdolibarr.riskassessmenttask.init=function(){window.digiriskdolibarr.riskassessmenttask.event()},window.digiriskdolibarr.riskassessmenttask.event=function(){$(document).on("input",".riskassessment-task-label",window.digiriskdolibarr.riskassessmenttask.fillRiskAssessmentTaskLabel),$(document).on("click",".riskassessment-task-create",window.digiriskdolibarr.riskassessmenttask.createRiskAssessmentTask),$(document).on("click",".riskassessment-task-save",window.digiriskdolibarr.riskassessmenttask.saveRiskAssessmentTask),$(document).on("click",".riskassessment-task-delete",window.digiriskdolibarr.riskassessmenttask.deleteRiskAssessmentTask),$(document).on("click",".riskassessment-task-timespent-create",window.digiriskdolibarr.riskassessmenttask.createRiskAssessmentTaskTimeSpent),$(document).on("click",".riskassessment-task-timespent-save",window.digiriskdolibarr.riskassessmenttask.saveRiskAssessmentTaskTimeSpent),$(document).on("click",".riskassessment-task-timespent-delete",window.digiriskdolibarr.riskassessmenttask.deleteRiskAssessmentTaskTimeSpent),$(document).on("click",".riskassessment-task-progress-checkbox:not(.riskassessment-task-progress-checkbox-readonly)",window.digiriskdolibarr.riskassessmenttask.checkTaskProgress),$(document).on("change","#RiskassessmentTaskTimespentDatehour",window.digiriskdolibarr.riskassessmenttask.selectRiskassessmentTaskTimespentDateHour),$(document).on("change","#RiskassessmentTaskTimespentDatemin",window.digiriskdolibarr.riskassessmenttask.selectRiskassessmentTaskTimespentDateMin),$(document).on("keyup",".riskassessment-task-label",window.digiriskdolibarr.riskassessmenttask.checkRiskassessmentTaskLabelLength),$(document).on("click",".listingHeaderTaskTooltip",window.digiriskdolibarr.riskassessmenttask.redirectOnSharedTaskConfig)},window.digiriskdolibarr.riskassessmenttask.fillRiskAssessmentTaskLabel=function(i){var e=$(this).closest(".modal-container");window.digiriskdolibarr.riskassessmenttask.haveDataInInput(e)},window.digiriskdolibarr.riskassessmenttask.haveDataInInput=function(i){i=i.parent().parent();i.hasClass("riskassessment-task-add-modal")&&i.find('input[name="label"]').val().length&&i.find(".button-disable").removeClass("button-disable")},window.digiriskdolibarr.riskassessmenttask.createRiskAssessmentTask=function(i){var e=window.saturne.toolbox.getToken(),s=$(this).closest(".riskassessment-task-add-modal"),t=s.find(".modal-risk").attr("value"),s=s.find(".riskassessment-task-container"),a=s.find(".riskassessment-task-label").val(),a=window.digiriskdolibarr.risk.sanitizeBeforeRequest(a),n=s.find("#RiskassessmentTaskDateStart"+t).val(),r=s.find("#RiskassessmentTaskDateStart"+t+"hour").val(),o=s.find("#RiskassessmentTaskDateStart"+t+"min").val(),d=s.find("#RiskassessmentTaskDateEnd"+t).val(),l=s.find("#RiskassessmentTaskDateEnd"+t+"hour").val(),c=s.find("#RiskassessmentTaskDateEnd"+t+"min").val(),s=s.find(".riskassessment-task-budget").val();window.saturne.loader.display($(this)),window.saturne.loader.display($(".riskassessment-tasks"+t)),$.ajax({url:document.URL+"&action=addRiskAssessmentTask&token="+e,type:"POST",data:JSON.stringify({tasktitle:a,dateStart:n,hourStart:r,minStart:o,dateEnd:d,hourEnd:l,minEnd:c,budget:s,riskToAssign:t}),processData:!1,contentType:!1,success:function(i){$(".tasks-list-container-"+t).replaceWith($(i).find(".tasks-list-container-"+t));var e=$(".messageSuccessTaskCreate");$(".riskassessment-tasks"+t).fadeOut(800),$(".riskassessment-tasks"+t).fadeIn(800),e.find("a").attr("href","#risk_row_"+t),e.html($(i).find(".task-create-success-notice")),e.removeClass("hidden")},error:function(i){$(".wpeo-loader").removeClass("wpeo-loader"),window.scrollTo(0,0);var i=JSON.parse(i.responseText),e=$(".messageErrorTaskCreate"),s=($("#risk_assessment_task_add"+t).removeClass("modal-active"),""),s=(s=(s+=e.find(".valueForCreateTask1").val())+e.find(".valueForCreateTask2").val())+" : "+i.message;e.find(".notice-subtitle .text").text(s),e.removeClass("hidden")}})},window.digiriskdolibarr.riskassessmenttask.deleteRiskAssessmentTask=function(i){var e=window.saturne.toolbox.getToken(),t=$(this).closest(".wpeo-table.riskassessment-tasks").attr("value"),a=$(this).closest(".riskassessment-task-single-content").attr("value"),s=$(this).closest(".riskassessment-task-container-"+a).find(".labelForDelete").val();let n=$(".messageSuccessTaskDelete"),r=$(".messageErrorTaskDelete");if(1!=confirm(s))return!1;{let s=$(".riskassessment-task-container-"+a).attr("value");window.saturne.loader.display($(".riskassessment-task-container-"+a)),$.ajax({url:document.URL+"&action=deleteRiskAssessmentTask&deletedRiskAssessmentTaskId="+a+"&token="+e,type:"POST",processData:!1,contentType:!1,success:function(i){console.log($(".riskassessment-task-listing-wrapper-"+t)),console.log(t),$(".riskassessment-task-listing-wrapper-"+t).replaceWith($(i).find(".riskassessment-task-listing-wrapper-"+t)),$(".riskassessment-tasks"+t).fadeOut(800),$(".riskassessment-tasks"+t).fadeIn(800);i="",i=(i=(i+=n.find(".valueForDeleteTask1").val())+s)+n.find(".valueForDeleteTask2").val();n.find("a").attr("href","#risk_row_"+t),n.find(".notice-subtitle .text").text(i),n.removeClass("hidden")},error:function(i){$(".wpeo-loader").removeClass("wpeo-loader"),window.scrollTo(0,0);var i=JSON.parse(i.responseText),e="",e=(e=(e=(e+=r.find(".valueForDeleteTask1").val())+s)+r.find(".valueForDeleteTask2").val())+" : "+i.message;r.find(".notice-subtitle .text").text(e),r.removeClass("hidden")}})}},window.digiriskdolibarr.riskassessmenttask.saveRiskAssessmentTask=function(i){var e=window.saturne.toolbox.getToken();let s=$(this).attr("value");var t=$(this).closest(".modal-container"),a=$(this).closest(".modal-risk").attr("value");let n="";var r=t.find(".riskassessment-task-label"+s).val(),r=window.digiriskdolibarr.risk.sanitizeBeforeRequest(r);let o=$(".riskassessment-task-single-"+s+" .riskassessment-task-reference").attr("value"),d=0;t.find(".riskassessment-task-progress-checkbox"+s).is(":checked")&&(d=1);var l=t.find("#RiskassessmentTaskDateStartEdit"+s).val(),c=t.find("#RiskassessmentTaskDateStartEdit"+s+"hour").val(),k=t.find("#RiskassessmentTaskDateStartEdit"+s+"min").val(),u=t.find("#RiskassessmentTaskDateEndEdit"+s).val(),m=t.find("#RiskassessmentTaskDateEndEdit"+s+"hour").val(),v=t.find("#RiskassessmentTaskDateEndEdit"+s+"min").val(),t=t.find(".riskassessment-task-budget"+s).val();window.saturne.loader.display($(this)),window.saturne.loader.display($(".riskassessment-task-single-"+s)),$.ajax({url:document.URL+"&action=saveRiskAssessmentTask&token="+e,data:JSON.stringify({riskAssessmentTaskID:s,tasktitle:r,dateStart:l,hourStart:c,minStart:k,dateEnd:u,hourEnd:m,minEnd:v,budget:t,taskProgress:d}),type:"POST",processData:!1,contentType:!1,success:function(i){$("#risk_assessment_task_edit"+s).removeClass("modal-active"),$(".riskassessment-task-container-"+s).replaceWith($(i).find(".riskassessment-task-container-"+s).first());i=$(".messageSuccessTaskEdit");$(".riskassessment-tasks"+a).fadeOut(800),$(".riskassessment-tasks"+a).fadeIn(800),n=(n=(n+=i.find(".valueForEditTask1").val())+o)+i.find(".valueForEditTask2").val(),$(".wpeo-loader").removeClass("wpeo-loader"),$(".loader-spin").remove(),i.find("a").attr("href","#risk_row_"+a),i.find(".notice-subtitle .text").text(n),i.removeClass("hidden")},error:function(i){$(".wpeo-loader").removeClass("wpeo-loader"),window.scrollTo(0,0);var i=JSON.parse(i.responseText),e=$(".messageErrorTaskEdit");$("#risk_assessment_task_edit"+s).removeClass("modal-active"),$(".wpeo-loader").removeClass("wpeo-loader"),n=(n=(n=(n+=e.find(".valueForEditTask1").val())+o)+e.find(".valueForEditTask2").val()+" : ")+i.message,e.find(".notice-subtitle .text").text(n),e.removeClass("hidden")}})},window.digiriskdolibarr.riskassessmenttask.createRiskAssessmentTaskTimeSpent=function(i){var e=window.saturne.toolbox.getToken();let s=$(this).attr("value");var t=$(this).closest(".riskassessment-task-edit-modal"),a=t.find(".riskassessment-task-timespent-container");let n=t.find("riskassessment-task-single").attr("value"),r="",o=t.find(".riskassessment-task-reference").attr("value"),d=$(".id-container").find(".riskassessment-total-task-timespent-"+s);var t=a.find("#RiskassessmentTaskTimespentDate"+s).val(),l=a.find("#RiskassessmentTaskTimespentDate"+s+"hour").val(),c=a.find("#RiskassessmentTaskTimespentDate"+s+"min").val(),k=a.find(".riskassessment-task-timespent-comment").val(),k=window.digiriskdolibarr.risk.sanitizeBeforeRequest(k),a=a.find(".riskassessment-task-timespent-duration").val();window.saturne.loader.display($(this)),window.saturne.loader.display($(".riskassessment-task-single-"+s)),$.ajax({url:document.URL+"&action=addRiskAssessmentTaskTimeSpent&token="+e,type:"POST",data:JSON.stringify({taskID:s,date:t,hour:l,min:c,comment:k,duration:a}),processData:!1,contentType:!1,success:function(i){var e=$(".messageSuccessTaskTimeSpentCreate"+s);$(".riskassessment-tasks"+n).fadeOut(800),$(".riskassessment-tasks"+n).fadeIn(800),r=(r=(r+=e.find(".valueForCreateTaskTimeSpent1").val())+o)+e.find(".valueForCreateTaskTimeSpent2").val(),$(".riskassessment-task-timespent-container").find(".riskassessment-task-timespent-list-"+s).replaceWith($(i).find(".riskassessment-task-timespent-container").find(".riskassessment-task-timespent-list-"+s)),$(".riskassessment-task-container-"+s).closest(".riskassessment-tasks").replaceWith($(i).find(".riskassessment-task-container-"+s).closest(".riskassessment-tasks")),$(".loader-spin").remove(),$(".wpeo-loader").removeClass("wpeo-loader"),e.find(".notice-subtitle .text").text(r),e.removeClass("hidden"),d.html($(i).find(".modal-content").find(".riskassessment-total-task-timespent-"+s).first())},error:function(i){$(this).closest(".risk-row-content-"+n).removeClass("wpeo-loader");var e=$(".messageErrorTaskTimeSpentCreate"+s);e.html($(i).find(".task-timespent-create-error-notice")),e.removeClass("hidden")},complete:function(){$("#risk_assessment_task_edit"+s+".wpeo-modal").addClass("modal-active")}})},window.digiriskdolibarr.riskassessmenttask.deleteRiskAssessmentTaskTimeSpent=function(i){var e=window.saturne.toolbox.getToken();let a=$(this).closest(".riskassessment-task-timespent-list").attr("value"),n=$(this).attr("value");var s=$(this).attr("value"),t=$(this).closest(".riskassessment-task-timespent-"+n).find(".labelForDelete").val();let r=$(".id-container").first().find(".riskassessment-total-task-timespent-"+a);if(1!=confirm(t))return!1;{let t=$(".riskassessment-task-container-"+a).attr("value");window.saturne.loader.display($(this)),$.ajax({url:document.URL+"&action=deleteRiskAssessmentTaskTimeSpent&deletedRiskAssessmentTaskTimeSpentId="+s+"&token="+e,type:"POST",processData:!1,contentType:!1,success:function(i){var e=$(".messageSuccessTaskTimeSpentDelete"+a),s=($(".riskassessment-task-timespent-"+n).fadeOut(800),""),s=(s=(s+=e.find(".valueForDeleteTaskTimeSpent1").val())+t)+e.find(".valueForDeleteTaskTimeSpent2").val();e.find(".notice-subtitle .text").text(s),e.removeClass("hidden"),r.html($(i).find(".modal-content").find(".riskassessment-total-task-timespent-"+a).first())},error:function(i){var e=$(".messageErrorTaskDeleteTimeSpent"+a),s="",s=(s=(s+=e.find(".valueForDeleteTaskTimeSpent1").val())+t)+e.find(".valueForDeleteTaskTimeSpent2").val();e.find(".notice-subtitle .text").text(s),e.removeClass("hidden")}})}},window.digiriskdolibarr.riskassessmenttask.saveRiskAssessmentTaskTimeSpent=function(i){var e=window.saturne.toolbox.getToken();let s=$(this);var t=$(this).attr("value"),a=$(this).closest(".riskassessment-task-timespent-edit-modal").find(".riskassessment-task-timespent-container");let n=a.attr("value"),r="",o=$(".riskassessment-task-container-"+n).attr("value"),d=$(".id-container").first().find(".riskassessment-total-task-timespent-"+n);var l=a.find("#RiskassessmentTaskTimespentDateEdit"+t).val(),c=a.find("#RiskassessmentTaskTimespentDateEdit"+t+"hour").val(),k=a.find("#RiskassessmentTaskTimespentDateEdit"+t+"min").val(),u=a.find(".riskassessment-task-timespent-comment").val(),u=window.digiriskdolibarr.risk.sanitizeBeforeRequest(u),a=a.find(".riskassessment-task-timespent-duration").val();window.saturne.loader.display($(this)),window.saturne.loader.display($(".riskassessment-task-single-"+n)),$.ajax({url:document.URL+"&action=saveRiskAssessmentTaskTimeSpent&token="+e,data:JSON.stringify({riskAssessmentTaskTimeSpentID:t,taskID:n,date:l,hour:c,min:k,comment:u,duration:a}),type:"POST",processData:!1,contentType:!1,success:function(i){s.closest(".modal-active").removeClass("modal-active");var e=$(".messageSuccessTaskTimeSpentEdit"+n);$(".wpeo-loader").removeClass("wpeo-loader"),r=(r=(r+=e.find(".valueForEditTaskTimeSpent1").val())+o)+e.find(".valueForEditTaskTimeSpent2").val(),d.html($(i).find(".modal-content").find(".riskassessment-total-task-timespent-"+n).first()),$(".riskassessment-task-timespent-list-"+n).html($(i).find(".riskassessment-task-timespent-list-"+n).children()),e.find(".notice-subtitle .text").text(r),e.removeClass("hidden")},error:function(i){var e=$(".messageSuccessTaskTimeSpentEdit"+n);r=(r=(r+=e.find(".valueForEditTaskTimeSpent1").val())+o)+e.find(".valueForEditTaskTimeSpent2").val(),e.find(".notice-subtitle .text").text(r),e.removeClass("hidden")}})},window.digiriskdolibarr.riskassessmenttask.checkTaskProgress=function(i){var e=window.saturne.toolbox.getToken(),s=$(this).closest(".risk-row").find(".riskassessment-task-container"),t=$(this).closest(".riskassessment-task-single-content").attr("value");let a=$(this).closest(".riskassessment-tasks").attr("value"),n="",r=s.attr("value"),o="";s.find(".riskassessment-task-progress-checkbox"+t).hasClass("progress-checkbox-check")?(o=0,s.find(".riskassessment-task-progress-checkbox"+t).toggleClass("progress-checkbox-check").toggleClass("progress-checkbox-uncheck")):s.find(".riskassessment-task-progress-checkbox"+t).hasClass("progress-checkbox-uncheck")&&(o=1,s.find(".riskassessment-task-progress-checkbox"+t).toggleClass("progress-checkbox-uncheck").toggleClass("progress-checkbox-check")),window.saturne.loader.display($(".riskassessment-task-single-"+t));s=window.location.href.replace(/#.*/,"");$.ajax({url:s+"&action=checkTaskProgress&token="+e,data:JSON.stringify({riskAssessmentTaskID:t,taskProgress:o}),type:"POST",processData:!1,contentType:!1,success:function(i){$(".fichecenter.risklist").html($(i).find("#searchFormListRisks"));i=$(".messageSuccessTaskEdit");$(".riskassessment-tasks"+a).fadeOut(800),$(".riskassessment-tasks"+a).fadeIn(800),n=(n=(n+=i.find(".valueForEditTask1").val())+r)+i.find(".valueForEditTask2").val(),i.find(".notice-subtitle .text").text(n),i.removeClass("hidden")},error:function(i){var e=$(".messageErrorTaskEdit");n=(n=(n+=e.find(".valueForEditTask1").val())+r)+e.find(".valueForEditTask2").val(),e.find(".notice-subtitle .text").text(n),e.removeClass("hidden")}})},window.digiriskdolibarr.riskassessmenttask.selectRiskassessmentTaskTimespentDateHour=function(i){$(this).closest(".nowraponall").find(".select-riskassessmenttask-timespent-datehour").remove(),$(this).before('{$("#sendFileForm").load(document.URL+n+"ticket_id="+a+" #fileLinkedTable")})},window.digiriskdolibarr.ticket.removeFile=function(i){let e=$(this).attr("value");e=e.replace("_mini","");var s=$("#ticket_id").val(),t=window.saturne.toolbox.getQuerySeparator(document.URL);fetch(document.URL+t+"action=removefile&filetodelete="+e+"&ticket_id="+s,{method:"POST"}).then(i=>{$(this).parent().parent().hide()})},window.digiriskdolibarr.ticket.addDashBoardTicketInfo=function(){var i=window.saturne.toolbox.getToken(),e=$("#select2-boxcombo-container").attr("title"),s=e.split(" : ")[0],e=e.split(" : ")[2],t=window.saturne.toolbox.getQuerySeparator(document.URL);$.ajax({url:document.URL+t+"action=adddashboardinfo&token="+i,type:"POST",processData:!1,data:JSON.stringify({digiriskelementID:s,catID:e}),contentType:!1,success:function(i){window.location.reload()},error:function(){}})},window.digiriskdolibarr.ticket.closeDashBoardTicketInfo=function(){var i=window.saturne.toolbox.getToken();let e=$(this);var s=e.attr("data-digiriskelementid"),t=e.attr("data-catid"),a=window.saturne.toolbox.getQuerySeparator(document.URL);$.ajax({url:document.URL+a+"action=closedashboardinfo&token="+i,type:"POST",processData:!1,data:JSON.stringify({digiriskelementID:s,catID:t}),contentType:!1,success:function(i){e.closest(".box-flex-item").fadeOut(400),$(".add-widget-box").attr("style",""),$(".add-widget-box").html($(i).find(".add-widget-box").children())},error:function(){}})},window.digiriskdolibarr.ticket.checkValidEmail=function(){0==/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/.test(this.value)?$(this).css("border","3px solid red"):$(this).css("border","3px solid green")},window.digiriskdolibarr.ticket.checkValidPhone=function(){0==/^(?:(?:(?:\+|00)\d{2}[\s]?(?:\(0\)[\s]?)?)|0){1}[1-9]{1}([\s.-]?)(?:\d{2}\1?){3}\d{2}$/.test(this.value)?$(this).css("border","3px solid red"):$(this).css("border","3px solid green")},window.digiriskdolibarr.digiriskusers={},window.digiriskdolibarr.digiriskusers.init=function(){window.digiriskdolibarr.digiriskusers.event()},window.digiriskdolibarr.digiriskusers.event=function(){$(document).on("input",".digirisk-users #firstname",window.digiriskdolibarr.digiriskusers.fillEmail),$(document).on("input",".digirisk-users #lastname",window.digiriskdolibarr.digiriskusers.fillEmail)},window.digiriskdolibarr.digiriskusers.fillEmail=function(i){var e=$(".digirisk-users #firstname").val(),s=$(".digirisk-users #lastname").val(),t=$(".input-domain-mail").val(),e=window.digiriskdolibarr.digiriskusers.removeDiacritics(e+"."+s+"@"+t).toLowerCase();$(".digirisk-users #email").val(e)},window.digiriskdolibarr.digiriskusers.removeDiacritics=function(i){for(var e="",s=i.normalize("NFD"),t=0,a=0;t