panel.js 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. require('../app');
  2. // require('select2/dist/js/select2.min.js')
  3. // Sidebar Tree View Menu
  4. (function () {
  5. "use strict";
  6. var treeviewMenu = $('.app-menu');
  7. // Toggle Sidebar
  8. $('[data-toggle="sidebar"]').click(function(event) {
  9. event.preventDefault();
  10. $('.app').toggleClass('sidenav-toggled');
  11. });
  12. // Activate sidebar treeview toggle
  13. $("[data-toggle='treeview']").click(function(event) {
  14. event.preventDefault();
  15. if(!$(this).parent().hasClass('is-expanded')) {
  16. treeviewMenu.find("[data-toggle='treeview']").parent().removeClass('is-expanded');
  17. }
  18. $(this).parent().toggleClass('is-expanded');
  19. });
  20. // Set initial active toggle
  21. $("[data-toggle='treeview.'].is-expanded").parent().toggleClass('is-expanded');
  22. //Activate bootstrip tooltips
  23. $("[data-toggle='tooltip']").tooltip();
  24. })();
  25. // price ،
  26. $('input.price').keyup(function () {
  27. const price = $(this).val().replace(/[^0-9]+/g, '');
  28. $(this).val(new Intl.NumberFormat().format(price));
  29. });
  30. // use the select2
  31. $(document).ready(function () {
  32. $('.select2').select2();
  33. });
  34. $('.select2-simple').select2();
  35. //***************************************************************
  36. // setting tinymce(editor)
  37. var editor_config = {
  38. path_absolute : "/",
  39. selector: ".editor",
  40. directionality:"rtl",
  41. plugins: [
  42. "advlist directionality autolink lists link image charmap print preview hr anchor pagebreak",
  43. "searchreplace wordcount visualblocks visualchars code fullscreen",
  44. "insertdatetime media nonbreaking save table contextmenu directionality",
  45. "emoticons template paste textcolor colorpicker textpattern"
  46. ],
  47. toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media | ltr rtl",
  48. relative_urls: false,
  49. file_browser_callback : function(field_name, url, type, win) {
  50. var x = window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth;
  51. var y = window.innerHeight|| document.documentElement.clientHeight|| document.getElementsByTagName('body')[0].clientHeight;
  52. var cmsURL = editor_config.path_absolute + 'laravel-filemanager?field_name=' + field_name;
  53. if (type == 'image') {
  54. cmsURL = cmsURL + "&type=Images";
  55. } else {
  56. cmsURL = cmsURL + "&type=Files";
  57. }
  58. tinyMCE.activeEditor.windowManager.open({
  59. file : cmsURL,
  60. title : 'Filemanager',
  61. width : x * 0.8,
  62. height : y * 0.8,
  63. resizable : "yes",
  64. close_previous : "no"
  65. });
  66. }
  67. };
  68. tinymce.init(editor_config);
  69. //******************************************************