PHP Classes

File: public/build/js/bundle.js

Recommend this page to a friend!
  Classes of Fabrice Fesch  >  Melis PHP Dashboard Plugin Creator  >  public/build/js/bundle.js  >  Download  
File: public/build/js/bundle.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Melis PHP Dashboard Plugin Creator
Plugin to create dashboards for the Melis platform
Author: By
Last change:
Date: 8 months ago
Size: 7,230 bytes
 

Contents

Class file image Download
$(function(){var e=$("body");function a(e,a,t){$.each(a,function(e,a){e.indexOf("dpc_plugin_tab_icon")>=0&&$("form"+t+" label#dashboard_tab_icon_field_title").css("color","red"),$("form"+t+" .form-control[name='"+e+"']").parents(".form-group").find("label").css("color","red")})}e.on("click",".melis-dashboard-plugin-creator-steps-content .btn-steps",function(){var e=$(this).data("curstep"),t=$(this).data("nextstep"),o=(new Array,new FormData),s=$(".melis-dashboard-plugin-creator-steps-content form.dashboard-plugin-creator-step-"+e);$("form.dashboard-plugin-creator-step-"+e+" .form-control").parents(".form-group").find("label").css("color","#686868"),s.each(function(e,a){var t=$(this).closest("form").attr("name"),s=$("form[name="+t+"]").length,i=new FormData($(this)[0]).entries();for(var n of i)s>1?o.append("step-form["+e+"]["+n[0]+"]",n[1]):o.append("step-form["+n[0]+"]",n[1]);$(this).find('input[type="radio"]:not(:checked),input[type="checkbox"]:not(:checked),input[type="text"][value=""],select[value=""]').each(function(){if(s>1)var a="step-form["+e+"]["+this.name+"]";else a="step-form["+this.name+"]";o.has(a)||o.append(a,"")})}),o.append("curStep",e),o.append("nextStep",t),$(this).hasClass("dpc-validate")&&o.append("validate",!0),$("#id_melisdashboardplugincreator_steps").append('<div id="loader" class="overlay-loader"><img class="loader-icon spinning-cog" src="/MelisCore/assets/images/cog12.svg" data-cog="cog12"></div>'),$.ajax({type:"POST",url:"/melis/MelisDashboardPluginCreator/DashboardPluginCreator/renderDashboardPluginCreatorSteps",data:o,dataType:"json",encode:!0,cache:!1,contentType:!1,processData:!1}).done(function(t){$("#id_melisdashboardplugincreator_steps #loader img").removeClass("spinning-cog").addClass("shrinking-cog"),setTimeout(function(){if(t.errors)t.errors.dpc_plugin_upload_thumbnail&&$(".plugin_thumbnail_div").length&&$(".plugin_thumbnail_div").remove(),melisHelper.melisKoNotification(t.textTitle,t.textMessage,t.errors),a(0,t.errors,".dashboard-plugin-creator-step-"+e),$("#id_melisdashboardplugincreator_steps #loader").remove();else if(t.textMessage)melisHelper.melisKoNotification(t.textTitle,t.textMessage,t.errors),$("#id_melisdashboardplugincreator_steps #loader").remove();else{$("#id_melisdashboardplugincreator_steps").html(t.html),$(".melis-dashboard-plugin-creator-steps li").removeClass("active");var o=$("#id_melisdashboardplugincreator_steps .steps-content").attr("id");$("#dpc_"+o).addClass("active")}},500)}).fail(function(e,a,t){console.log(translations.tr_meliscore_error_message)})}),e.on("change","#dashboard-plugin-creator-step-1 input[name='dpc_plugin_type']",function(){"multi"==$("input:radio[name=dpc_plugin_type]:checked").val()?$("#tab_count_div").show():($("#tab_count_div").hide(),$("#dpc_tab_count").val(""))}),e.on("change","#dashboard-plugin-creator-step-1 input[name='dpc_plugin_destination']",function(){"new_module"==$("input:radio[name=dpc_plugin_destination]:checked").val()?($("#dpc_new_module_name").parents(".form-group").show(),$("#dpc_existing_module_name").parents(".form-group").hide(),$("#dpc_existing_module_name option").prop("selected",!1)):($("#dpc_new_module_name").parents(".form-group").hide(),$("#dpc_new_module_name").val(""),$("#dpc_existing_module_name").parents(".form-group").show())}),e.on("click",".melis-dpc-final-content .fa",function(){$(this).hasClass("fa-check-square-o")?($(this).addClass("fa-square-o"),$(this).removeClass("text-success"),$(this).removeClass("fa-check-square-o"),$(this).next("input").attr("checked",!1)):($(this).removeClass("fa-square-o"),$(this).addClass("fa-check-square-o"),$(this).addClass("text-success"),$(this).next("input").attr("checked",!0))}),e.on("click","a[data-id=id_melisdashboardplugincreator_tool]",function(e){$.ajax({type:"POST",url:"/melis/MelisDashboardPluginCreator/DashboardPluginCreator/removeTempThumbnailDir",data:{},dataType:"text"}).done(function(e){}).fail(function(e,a,t){console.log(translations.tr_meliscore_error_message)})}),e.on("change","#dpc_plugin_upload_thumbnail",function(e){var t=$("#id-dashboard-plugin-creator-thumbnail-upload-form")[0],o=new FormData(t);o.append("file",$("input[type=file]")[0].files[0]),melisCoreTool.pending(".btn-steps"),$.ajax({type:"POST",url:"/melis/MelisDashboardPluginCreator/DashboardPluginCreator/processUpload",data:o,dataType:"json",encode:!0,cache:!1,contentType:!1,processData:!1,async:!0,xhr:function(){var e=$.ajaxSettings.xhr();return e.upload&&e.upload.addEventListener("progress",pluginCreatorTool.progress,!1),e}}).done(function(e){if(e.success){$("div.progressContent").addClass("hidden"),$("form#id-dashboard-plugin-creator-thumbnail-upload-form .form-control").parents(".form-group").find("label").css("color","#686868");var t=$("#pluginThumbnailUploadArea"),o=$(".plugin_thumbnail_div");o.length?o.empty():$('<div class="col-xs-12 col-lg-6"><div class="plugin_thumbnail_div"></div></div>').appendTo(t),$("<img />",{src:e.pluginThumbnail,class:"plugin_thumbnail"}).appendTo(".plugin_thumbnail_div"),$('<div class="hover-details"><div class="me-p-btn-cont"><a id="plugin-thumbnail-eye" class="viewImageDocument" href="" target="_blank"><i class="fa fa-eye"></i></a><a id="removePluginThumbnail" data-type="image"><i class="fa fa-times"></i></a></div></div>').appendTo(".plugin_thumbnail_div"),$("#plugin-thumbnail-eye").attr("href",e.pluginThumbnail),o.show()}else $("div.progressContent").addClass("hidden"),$(".plugin_thumbnail_div").length&&$(".plugin_thumbnail_div").remove(),melisHelper.melisKoNotification(e.textTitle,e.textMessage,e.errors),a(0,e.errors,".dashboard-plugin-creator-step-2");melisCoreTool.done(".btn-steps")}).fail(function(e,a,t){console.log(translations.tr_meliscore_error_message)})}),e.on("click",".melis-dashboard-plugin-creator-steps-content #removePluginThumbnail",function(){melisCoreTool.pending("#removePluginThumbnail"),melisCoreTool.confirm(translations.tr_melisdashboardplugincreator_common_label_yes,translations.tr_melisdashboardplugincreator_common_label_no,translations.tr_melisdashboardplugincreator_delete_plugin_thumbnail_title,translations.tr_melisdashboardplugincreator_delete_plugin_thumbnail_confirm,function(){$.ajax({type:"POST",url:"/melis/MelisDashboardPluginCreator/DashboardPluginCreator/removePluginThumbnail",data:null,dataType:"json",encode:!0}).done(function(e){e.success?($("#dpc_plugin_upload_thumbnail").val(""),$(".plugin_thumbnail_div").remove()):melisHelper.melisKoNotification(translations.tr_melisdashboardplugincreator_delete_plugin_thumbnail_title,translations.tr_melisdashboardplugincreator_delete_plugin_thumbnail_error,null),melisCore.flashMessenger()}).fail(function(){alert(translations.tr_meliscore_error_message)})}),melisCoreTool.done("#removePluginThumbnail")})});var pluginCreatorTool={progress:function(e){var a=$("div.progressContent");a.removeClass("hidden");var t=$("div.progressContent > div.progress > div.progress-bar");t.attr("aria-valuenow",0).css("width","0%");var o=$("div.progressContent > div.progress > span.status");if(o.html(""),e.lengthComputable){var s=e.total,i=100*e.loaded/s;t.attr("aria-valuenow",i),t.css("width",i+"%"),i>100?a.addClass("hidden"):o.html(Math.round(i)+"%")}else alert("not computable")}};
For more information send a message to info at phpclasses dot org.