You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
easyappointments-archive/assets/js/backend_users.min.js

1 line
2.7 KiB

window.BackendUsers=window.BackendUsers||{},function(a){"use strict";a.MIN_PASSWORD_LENGTH=7;var r={};a.wp={},a.initialize=function(e){e=e||!0,a.wp=new WorkingPlan,a.wp.bindEventHandlers(),(r=new ProvidersHelper).resetForm(),r.filter(""),r.bindEventHandlers(),GlobalVariables.services.forEach(function(e){$("<div/>",{class:"checkbox",html:[$("<div/>",{class:"checkbox form-check",html:[$("<input/>",{class:"form-check-input",type:"checkbox","data-id":e.id,prop:{disabled:!0}}),$("<label/>",{class:"form-check-label",text:e.name,for:e.id})]})]}).appendTo("#provider-services")}),GlobalVariables.providers.forEach(function(e){$("<div/>",{class:"checkbox",html:[$("<div/>",{class:"checkbox form-check",html:[$("<input/>",{class:"form-check-input",type:"checkbox","data-id":e.id}),$("<label/>",{class:"form-check-label",text:e.first_name+" "+e.last_name,for:e.id})]})]}).appendTo("#secretary-providers")}),e&&($('#users-page > .nav-pills a[data-toggle="tab"]').on("shown.bs.tab",function(){var e,a;$(this).parents(".switch-view").length||(r&&r.unbindEventHandlers(),"#admins"===$(this).attr("href")?r=new AdminsHelper:"#providers"===$(this).attr("href")?r=new ProvidersHelper:"#secretaries"===$(this).attr("href")&&(r=new SecretariesHelper,e=GlobalVariables.baseUrl+"/index.php/backend_api/ajax_filter_providers",a={csrfToken:GlobalVariables.csrfToken,key:""},$.post(e,a).done(function(e){GlobalVariables.providers=e,$("#secretary-providers").empty(),GlobalVariables.providers.forEach(function(e){$("<div/>",{class:"checkbox",html:[$("<div/>",{class:"checkbox form-check",html:[$("<input/>",{class:"form-check-input",type:"checkbox","data-id":e.id,prop:{disabled:!0}}),$("<label/>",{class:"form-check-label",text:e.first_name+" "+e.last_name,for:e.id})]})]}).appendTo("#secretary-providers")})})),r.resetForm(),r.filter(""),r.bindEventHandlers(),$(".filter-key").val(""),Backend.placeFooterToBottom())}),$("#admin-username, #provider-username, #secretary-username").focusout(function(){var e,a,r=$(this);!0===r.prop("readonly")||""===r.val()||(a=r.parents().eq(2).find(".record-id").val())&&(e=GlobalVariables.baseUrl+"/index.php/backend_api/ajax_validate_username",a={csrfToken:GlobalVariables.csrfToken,username:r.val(),user_id:a},$.post(e,a).done(function(e){"false"===e?(r.closest(".form-group").addClass("has-error"),r.attr("already-exists","true"),r.parents().eq(3).find(".form-message").text(EALang.username_already_exists),r.parents().eq(3).find(".form-message").show()):(r.closest(".form-group").removeClass("has-error"),r.attr("already-exists","false"),r.parents().eq(3).find(".form-message").text()===EALang.username_already_exists&&r.parents().eq(3).find(".form-message").hide())}))}))}}(window.BackendUsers);