public_html/layouts/basic/modules/Users/resources/Detail.min.js
'use strict';
/*+***********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
* Contributor(s): YetiForce S.A.
*************************************************************************************/"use strict";Vtiger_Detail_Js("Users_Detail_Js",{/*
* function to trigger delete record action
* @params: delete record url.
*/triggerDeleteUser:function triggerDeleteUser(deleteUserUrl){app.showConfirmModal({title:app.vtranslate("JS_DELETE_USER_CONFIRMATION"),confirmedCallback:function confirmedCallback(){AppConnector.request(deleteUserUrl).done(function(data){if(data){var callback=function(){var params=app.validationEngineOptions;params.onValidationComplete=function(form,valid){return valid&&Users_Detail_Js.deleteUser(form),!1},$("#deleteUser").validationEngine(app.validationEngineOptions);};app.showModalWindow(data,function(data){"function"==typeof callback&&callback(data);});}});}});},deleteUser:function deleteUser(form){var userid=form.find("[name=\"userid\"]").val(),transferUserId=form.find("[name=\"tranfer_owner_id\"]").val(),params={module:app.getModuleName(),action:"DeleteAjax",mode:"deleteUser",transfer_user_id:transferUserId,userid:userid,permanent:form.find("[name=\"deleteUserPermanent\"]:checked").val()};AppConnector.request(params).done(function(data){if(data.success){app.hideModalWindow(),app.showNotify({text:app.vtranslate(data.result.message),type:"success"});var url=data.result.listViewUrl;window.location.href=url;}});},triggerChangeAccessKey:function triggerChangeAccessKey(url){app.showConfirmModal({title:app.vtranslate("JS_NEW_ACCESS_KEY_REQUESTED"),text:app.vtranslate("JS_CHANGE_ACCESS_KEY_CONFIRMATION"),confirmedCallback:function confirmedCallback(){AppConnector.request(url).done(function(data){var message,params={};if(data.success){data=data.result,params.type="success",message=app.vtranslate(data.message);var accessKeyEle=$("#Users_detailView_fieldValue_accesskey");accessKeyEle.length&&accessKeyEle.find(".value").html(data.accessKey);}else message=app.vtranslate(data.error.message);params.text=message,app.showNotify(params);});}});}},{usersEditInstance:!1,updateStartHourElement:function updateStartHourElement(form){this.usersEditInstance.triggerHourFormatChangeEvent(form),this.updateStartHourElementValue();},hourFormatUpdateEvent:function hourFormatUpdateEvent(){var thisInstance=this;this.getForm().on(this.fieldUpdatedEvent,"[name=\"hour_format\"]",function(){thisInstance.updateStartHourElementValue();});},updateStartHourElementValue:function updateStartHourElementValue(){var form=this.getForm(),startHourSelectElement=$("select[name=\"start_hour\"]",form),selectedElementValue=startHourSelectElement.find("option:selected").text();startHourSelectElement.closest(".fieldValue").find("span.value").text(selectedElementValue);var endHourSelectElement=$("select[name=\"end_hour\"]",form);endHourSelectElement.closest(".fieldValue").find("span.value").text(endHourSelectElement.find("option:selected").text());},startHourUpdateEvent:function startHourUpdateEvent(form){var thisInstance=this;form.on(this.fieldUpdatedEvent,"[name=\"start_hour\"]",function(){thisInstance.updateStartHourElement(form);});},saveFieldValues:function saveFieldValues(fieldDetailList){var aDeferred=$.Deferred(),thisInstance=this,lock=!1,recordId=this.getRecordId(),data={};if("undefined"!=typeof fieldDetailList&&(data=fieldDetailList,"email1"==data.field&&thisInstance.usersEditInstance.checkEmail(data.value).done(function(){},function(){lock=!0,aDeferred.reject();})),!0!==lock){data.record=recordId,data.module=app.getModuleName(),data.action="SaveAjax";var params={};params.data=data,params.async=!1,params.dataType="json",AppConnector.request(params).done(function(reponseData){aDeferred.resolve(reponseData);});}return aDeferred.promise()},registerEvents:function registerEvents(){this._super();var form=this.getForm();this.usersEditInstance=Vtiger_Edit_Js.getInstance(),this.updateStartHourElement(form),this.hourFormatUpdateEvent(),this.startHourUpdateEvent(form),Users_Edit_Js.registerChangeEventForCurrencySeparator();}});
//# sourceMappingURL=Detail.min.js.map