芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/kwesioben.com/paymoney/public/admin/customs/js/settings/general/settings.min.js
"use strict";function updateSideBarCompanySmallLogo(file){file.name.match(/.(png|jpg|jpeg|gif|bmp)$/i)?$.ajax({headers:{"X-CSRF-TOKEN":$('meta[name="csrf-token"]').attr("content")},type:"POST",url:ADMIN_URL+"/settings/update-sidebar-company-logo",data:new FormData($("#general_settings_form")[0]),cache:!1,contentType:!1,processData:!1}).done((function(res){$(".company-logo").attr("src",SITE_URL+"/public/uploads/logos/"+res.filename)})).fail((function(error){alert(JSON.parse(error.responseText).message)})):$(".company-logo").attr("src",SITE_URL+"/public/uploads/userPic/default-logo.jpg")}$(window).on("load",(function(){$(".has_captcha, .login_via, .default_currency, .default_language").select2({}),$(".allowed-wallets").select2({});let wallets=selectedAllowedWallets.split(",");$("#allowed-wallets").select2({placeholder:"Selected wallet will be created during registration.",allowClear:!0}).select2().val(wallets).trigger("change")})),$(document).on("change","#logo",(function(){let orginalSource='{{ url("public/uploads/userPic/default-logo.jpg") }}',logo;""!=$("#logo").attr("data-rel")?(readFileOnChange(this,$("#logo-preview"),orginalSource),$(".remove_img_preview_site_logo").remove(),updateSideBarCompanySmallLogo(this.files[0])):(readFileOnChange(this,$("#logo-demo-preview"),orginalSource),updateSideBarCompanySmallLogo(this.files[0]))})),$(document).on("change","#favicon",(function(){let orginalSource=defaultImageUrl,favicon;""!=$("#favicon").attr("data-favicon")?(readFileOnChange(this,$("#favicon-preview"),orginalSource),$(".remove_fav_preview").remove()):readFileOnChange(this,$("#favicon-demo-preview"),orginalSource)})),$(document).on("click",".remove_img_preview_site_logo",(function(){let logo=$("#logo").attr("data-rel");logo&&$.ajax({headers:{"X-CSRF-TOKEN":$('meta[name="csrf-token"]').attr("content")},type:"POST",url:ADMIN_URL+"/settings/delete-logo",data:{logo:logo},dataType:"json",success:function(reply){1==reply.success?swal({title:"",text:reply.message,type:"success"},(function(){window.location.reload()})):(alert(reply.message),location.reload())}})})),$(document).on("click",".remove_fav_preview",(function(){let favicon=$("#favicon").attr("data-favicon");favicon&&$.ajax({headers:{"X-CSRF-TOKEN":$('meta[name="csrf-token"]').attr("content")},type:"POST",url:ADMIN_URL+"/settings/delete-favicon",data:{favicon:favicon},dataType:"json",success:function(reply){1==reply.success?swal({title:"",text:reply.message,type:"success"},(function(){location.reload()})):(alert(reply.message),window.location.reload())}})})),$(document).on("change","#login_via",(function(){"email_or_phone"==$(this).val()||"phone_only"==$(this).val()?$.ajax({headers:{"X-CSRF-TOKEN":$('meta[name="csrf-token"]').attr("content")},method:"POST",url:ADMIN_URL+"/settings/check-sms-settings",dataType:"json",contentType:!1,processData:!1,cache:!1}).done((function(response){0==response.status?($("#sms-error").addClass("error").html(response.message).css("font-weight","bold"),$("form").find("button[type='submit']").prop("disabled",!0)):1==response.status&&($("#sms-error").html(""),$("form").find("button[type='submit']").prop("disabled",!1))})):($("#sms-error").html(""),$("form").find("button[type='submit']").prop("disabled",!1))})),$.validator.setDefaults({highlight:function(element){$(element).parent("div").addClass("has-error")},unhighlight:function(element){$(element).parent("div").removeClass("has-error")},errorPlacement:function(error,element){error.insertAfter(element)}}),$("#general_settings_form").validate({rules:{name:{required:!0},"photos[logo]":{extension:extensionsValidationRule},"photos[favicon]":{extension:extensionsValidationRule}},messages:{"photos[logo]":{extension:extensionsValidationMessage},"photos[favicon]":{extension:extensionsValidationMessage}},submitHandler:function(form){$("#general-settings-submit").attr("disabled",!0).click((function(e){e.preventDefault()})),$(".fa-spin").removeClass("d-none"),$("#general-settings-submit-text").text(submittingText),form.submit()}});