templates/base.html.twig line 1

Open in your IDE?
  1. {% set emailComptableConfig = render(controller('App\\Controller\\MetaConfigController::getConfigMeta', { 'key': 'cabinet_comptable' })) %}
  2. {% set baseUrl = render(controller('App\\Controller\\HomeController::getBaseUrl', {})) %}
  3. {% set base_api_ocr_url = "https://dockeo.fr" %}
  4. <!DOCTYPE html>
  5. <html>
  6. <head>
  7.     <meta charset="utf-8">
  8.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  9.     <link rel="icon" type="image/ico" href="{{ asset('favicon.ico') }}"/>
  10.     {% block seo %}
  11.         <title>{% block title %} {{ app.session.get('entreprise_session_name') }}  {% endblock %}</title>
  12.         <meta name="description" content=""/>
  13.     {% endblock %}
  14.     <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
  15.     <link href="{{ asset('vendor/@fortawesome/fontawesome-free/css/fontawesome.css') }}" rel="stylesheet">
  16.     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.3/photoswipe.min.css"/>
  17.     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.3/default-skin/default-skin.css"/>
  18.     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/11.1.9/sweetalert2.min.css" referrerpolicy="no-referrer" />
  19.     <link href="{{ asset('vendor/iCheck/custom.css') }}" rel="stylesheet">
  20.     <link href="{{ asset('vendor/animate.css/animate.css') }}" rel="stylesheet">
  21.     <link href="{{ asset('css/style.css') }}" rel="stylesheet">
  22.     <link rel="stylesheet" href="{{ asset('vendor/toastr/toastr.min.css') }}"/>
  23.     <script src="{{ asset('js/jquery-3.1.1.min.js') }}"></script>
  24.     <style type="text/css">
  25.         
  26.         .sf-minitoolbar, .sf-toolbarreset{display:none}
  27.         .inline-text{
  28.           overflow: hidden;
  29.           text-overflow: ellipsis;
  30.           white-space: nowrap;
  31.         }
  32.         body::-webkit-scrollbar {
  33.             width: .75rem;
  34.         }
  35.         *::-webkit-scrollbar-track {
  36.             background-color: #edf2f7;
  37.         }
  38.         *::-webkit-scrollbar-thumb {
  39.             background-color: #718096;
  40.             border-radius: 9999px;
  41.         }
  42.         body {
  43.             scrollbar-width: thin;
  44.             /* The color of thumb and track areas */
  45.             scrollbar-color: #718096 #edf2f7;
  46.         }
  47.         .modal-body {
  48.             padding: 20px 60px 57px 60px;
  49.         }
  50.         .pagination-block{
  51.             text-align: center;
  52.             margin-bottom: 40px;
  53.         }
  54.         .entreprise-list{
  55.             margin-top: 38px;
  56.         }
  57.         .loader-container{display: none;align-items: center;justify-content: center;}
  58.         .switch-entreprise.entreprise-item {
  59.             display: flex;
  60.             align-items: center;
  61.             justify-content: space-between;
  62.             border: 1px solid #dcdcdc;
  63.             padding: 4px 12px;
  64.             font-size: 11px;
  65.             border-radius: 5px;
  66.             margin-top: 7px;
  67.             color: #888;
  68.             font-weight: bold;
  69.         }
  70.         .switch-entreprise.entreprise-item.active, .switch-entreprise.entreprise-item:hover {
  71.             border-color: #14c179;
  72.             background: #14c179;
  73.             color: #fff;
  74.         }
  75.         .entreprise-img{
  76.             width: 35px;
  77.             height: 35px;
  78.             border-radius: 100%;
  79.             margin-right: 8px;
  80.             /*background-color: #18a689;*/
  81.             object-fit: cover;
  82.             border: 2px solid #18a689;
  83.         }
  84.         .navbar-top-links {
  85.             text-align: right;
  86.             margin-right: 8px;
  87.             margin-top: 8px;
  88.         }
  89.         .showDocument{cursor: pointer;}
  90.         .main-logo{
  91.             object-fit: contain;
  92.             width: 174px;
  93.             margin: auto;
  94.             display: block;
  95.         }
  96.         .footer{position: fixed;}
  97.         .nav.navbar-top-links > li > a.admin-btn:hover, .nav.navbar-top-links > li > a.admin-btn:focus{
  98.             background-color: #1ab394;
  99.             border-color: #1ab394;
  100.         }
  101.         .custom-dropdown {
  102.           display: inline-block;
  103.           position: relative;
  104.         }
  105.         .custom-dropdown .dd-button {
  106.           display: inline-block;
  107.           border: 1px solid gray;
  108.           border-radius: 4px;
  109.           padding: 7px 28px 7px 4px;
  110.           background-color: #ffffff;
  111.           cursor: pointer;
  112.           white-space: nowrap;
  113.         }
  114.         .dd-button:after {
  115.           content: '';
  116.           position: absolute;
  117.           top: 50%;
  118.           right: 15px;
  119.           transform: translateY(-50%);
  120.           width: 0; 
  121.           height: 0; 
  122.           border-left: 5px solid transparent;
  123.           border-right: 5px solid transparent;
  124.           border-top: 5px solid black;
  125.         }
  126.         .dd-button:hover {
  127.           background-color: #eeeeee;
  128.         }
  129.         .dd-input {
  130.           display: none;
  131.         }
  132.         .dd-menu {
  133.           position: absolute;
  134.           top: 100%;
  135.           border: 1px solid #ccc;
  136.           border-radius: 4px;
  137.           padding: 0;
  138.           margin: 2px 0 0 0;
  139.           box-shadow: 0 0 6px 0 rgba(0,0,0,0.1);
  140.           background-color: #ffffff;
  141.           list-style-type: none;
  142.         }
  143.         .dd-input + .dd-menu {
  144.           display: none;
  145.         } 
  146.         .dd-input:checked + .dd-menu {
  147.           display: block;
  148.         } 
  149.         .dd-menu li {
  150.           padding: 10px 20px;
  151.           cursor: pointer;
  152.           white-space: nowrap;
  153.           cursor: pointer;
  154.         }
  155.         .dd-menu li:hover {
  156.           background-color: #f6f6f6;
  157.         }
  158.         .btn-config-colonne{
  159.             cursor: pointer;
  160.             font-size: 20px;
  161.         }
  162.         .column-container {
  163.             position: absolute;
  164.             border: 1px solid #ccc;
  165.             padding: 13px;
  166.             border-radius: 5px;
  167.             width: 260px;
  168.             top: 59px;
  169.             box-shadow: 0px 1px 1px 3px rgb(183 183 190 / 20%);
  170.             background: #fff;
  171.             left: 0;
  172.             z-index: 9;
  173.             display: none;
  174.         }
  175.         .column-item label.column-label{
  176.             display: flex;
  177.             margin-bottom: 10px;
  178.         }
  179.         .column-item .column-libelle{
  180.             margin-left: 14px;
  181.         }
  182.     </style>
  183.     {% block css %}
  184.     {% endblock %}
  185. </head>
  186. <body style="-webkit-print-color-adjust: exact;">
  187. <!-- Root element of PhotoSwipe. Must have class pswp. -->
  188. <div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
  189.   <!-- Background of PhotoSwipe. 
  190.            It's a separate element as animating opacity is faster than rgba(). -->
  191.   <div class="pswp__bg"></div>
  192.   <!-- Slides wrapper with overflow:hidden. -->
  193.   <div class="pswp__scroll-wrap">
  194.     <!-- Container that holds slides. 
  195.               PhotoSwipe keeps only 3 of them in the DOM to save memory.
  196.               Don't modify these 3 pswp__item elements, data is added later on. -->
  197.     <div class="pswp__container">
  198.       <div class="pswp__item"></div>
  199.       <div class="pswp__item"></div>
  200.       <div class="pswp__item"></div>
  201.     </div>
  202.     <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
  203.     <div class="pswp__ui pswp__ui--hidden">
  204.       <div class="pswp__top-bar">
  205.         <!--  Controls are self-explanatory. Order can be changed. -->
  206.         <div class="pswp__counter"></div>
  207.         <button class="pswp__button pswp__button--close" title="Fermer (Esc)"></button>
  208.         <button class="pswp__button pswp__button--share" title="Partager"></button>
  209.         <button class="pswp__button pswp__button--fs" title="Plein écran"></button>
  210.         <button class="pswp__button pswp__button--zoom" title="Zoom +/-"></button>
  211.         <!-- Preloader demo https://codepen.io/dimsemenov/pen/yyBWoR -->
  212.         <!-- element will get class pswp__preloader--active when preloader is running -->
  213.         <div class="pswp__preloader">
  214.           <div class="pswp__preloader__icn">
  215.             <div class="pswp__preloader__cut">
  216.               <div class="pswp__preloader__donut"></div>
  217.             </div>
  218.           </div>
  219.         </div>
  220.       </div>
  221.       <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
  222.         <div class="pswp__share-tooltip"></div>
  223.       </div>
  224.       <button class="pswp__button pswp__button--arrow--left" title="Précedent">
  225.       </button>
  226.       <button class="pswp__button pswp__button--arrow--right" title="Suivant">
  227.       </button>
  228.       <div class="pswp__caption">
  229.         <div class="pswp__caption__center"></div>
  230.       </div>
  231.     </div>
  232.   </div>
  233. </div>
  234. <div id="wrapper">
  235.     {% block menu1 %}
  236.         <nav class="navbar-default navbar-static-side" role="navigation" style="margin-bottom: 49px;">
  237.             <div class="sidebar-collapse">
  238.                 <ul class="nav metismenu" id="side-menu">
  239.                     <li class="nav-header">
  240.                         <div class="profile-element">
  241.                             <a href="{{path('home')}}">
  242.                                 {% if app.session.get('entreprise_session_logo') %}
  243.                                     <img alt="FDMA" class="main-logo img-fluid" src="/logo/{{app.session.get('entreprise_session_logo')}}">
  244.                                 {% else %} 
  245.                                     <img src="{{ asset('images/logo-admin.png') }}"  alt="FDMA" class="main-logo img-fluid">
  246.                                 {% endif %}
  247.                             </a>
  248.                         </div>
  249.                         <div class="logo-element">
  250.                             FDMA
  251.                         </div>
  252.                     </li>
  253.                 </ul>
  254.             </div>
  255.         </nav>
  256.     {% endblock %}
  257.         <div id="page-wrapper" class="gray-bg">
  258.             <div class="row border-bottom">
  259.                 <nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0">
  260.                     <div class="navbar-header">
  261.                         <a class="navbar-minimalize minimalize-styl-2 btn btn-primary " href="#"><i class="fa fa-bars"></i> </a>
  262.                     </div>
  263.                     <div class="navbar-header">
  264.                     </div>
  265.                     {% block menu2 %}
  266.                     <ul class="nav navbar-top-links navbar-right">
  267.                         <li>
  268.                             <span class="m-r-sm text-muted welcome-message">Bienvenue sur l'admin FMDA</span>
  269.                         </li>
  270.                         <li style="display: none;">
  271.                             <a href="{{path('admin_control')}}" class="btn btn-primary admin-btn" style="padding: 12px 19px;display: inline;color: #fff; margin-right: 0;">ADMINISTRATION</a>
  272.                         </li>
  273.                         <li class="dropdown">
  274.                             <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
  275.                             {% if app.session.get('entreprise_session_id') %}
  276.                                 <span>
  277.                                     {% if app.session.get('entreprise_session_logo') %}
  278.                                         <img class="entreprise-img" src="/logo/{{app.session.get('entreprise_session_logo')}}">
  279.                                     {% else %} 
  280.                                         <img class="entreprise-img" src="{{asset('images/logotransfmda.png')}}">
  281.                                     {% endif %}
  282.                                 </span>
  283.                                 {{ app.session.get('entreprise_session_name') }}
  284.                             {% endif %}
  285.                             <span class="caret"></span>
  286.                             </button>
  287.                             <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
  288.                                 {% if app.user is not null and app.user.role == "administrateur" %}
  289.                                     <li>
  290.                                         {% if app.session.get('entreprise_session_id') %}
  291.                                             <a href="javascript:void()" class="openEntrepriseModal">
  292.                                             <span>Changer de Société</span> &nbsp <i class="fal fa-chevron-right"></i>
  293.                                             </a>
  294.                                         {% endif %}
  295.                                     </li>
  296.                                     <li role="separator" class="divider"></li>
  297.                                 {% endif %}
  298.                                 <li>
  299.                                     <a href="{{ path('security_logout') }}">
  300.                                         <i class="fa fa-sign-out"></i> Déconnexion
  301.                                     </a>
  302.                                 </li>
  303.                             </ul>
  304.                         </li>
  305.                     </ul>
  306.                     {% endblock %}
  307.                 </nav>
  308.             </div>
  309.             {% block breadcrumb %}
  310.             <div class="row wrapper border-bottom white-bg page-heading">
  311.                 <div class="col-lg-10">
  312.                     <h2>Accueil</h2>
  313.                 </div>
  314.             </div>
  315.             {% endblock %}
  316.             <div class="wrapper wrapper-content animated fadeInRight">
  317.                 {% block content %}
  318.                 {% endblock %}
  319.             </div>
  320.             <div class="footer">
  321.                 <div class="float-right">
  322.                 </div>
  323.                 <div>
  324.                     <strong>Copyright</strong> FMDA &copy; 2020
  325.                 </div>
  326.             </div>
  327.             <div class="modal-entreprise-container">
  328.                 <div id="modalEntreprise" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  329.                     <div class="modal-dialog" role="document">
  330.                         <div class="modal-content">
  331.                             <div class="modal-header" style="border: none;">
  332.                                 {% if app.session.get('entreprise_session_id') %} 
  333.                                     <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true" style="position: absolute;right: 14px;top: 10px;">&times;</span></button>
  334.                                 {% endif %}
  335.                             </div>
  336.                             <div class="modal-body row entreprise-container">
  337.                                 <div class="loader-container">
  338.                                     <img src="{{asset('images/loading.gif')}}" style="width: 54px;">
  339.                                 </div>
  340.                             </div>
  341.                         </div>
  342.                     </div>
  343.                 </div>
  344.             </div>
  345.             <div id="modalDocumentShow" class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
  346.                 <div class="modal-dialog modal-lg" role="document">
  347.                     <div class="modal-content">
  348.                         <div class="modal-header" style="border: none;">
  349.                             <!-- <div class="text-center">
  350.                                 <label class="custom-dropdown" id="btnRotation" style="display: none;z-index: 10">
  351.                                   <div class="dd-button">&nbsp
  352.                                     Orientation <i class="fad fa-redo"></i>&nbsp
  353.                                   </div>
  354.                                   <input type="checkbox" class="dd-input" id="test">
  355.                                   <ul class="dd-menu">
  356.                                     <li class="rotationChoice" data-rotation="90" data-pdf="">rotation 90</li>
  357.                                     <li class="rotationChoice" data-rotation="180" data-pdf="">rotation 180</li>
  358.                                     <li class="rotationChoice" data-rotation="270" data-pdf="">rotation 270</li>
  359.                                   </ul>
  360.                                 </label>
  361.                             </div> -->
  362.                             <button type="button" class="close" data-dismiss="modal" aria-label="Close" style="position: absolute;top: 11px; right: 15px;"><span aria-hidden="true">&times;</span></button>
  363.                         </div>
  364.                         <div class="modal-body text-center">
  365.                             <h3 class="text-center no-document" style="display: none;">Aucun document rattaché.</h3>
  366.                             <div class="documentFile-container" style="display: none;">
  367.                             </div>
  368.                         </div>
  369.                     </div>
  370.                 </div>
  371.             </div>
  372.             <div id="modalScoreIa" class="modal fade bs-example-modal-sm modal-center" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
  373.               <div class="modal-dialog modal-sm" role="document">
  374.                 <div class="modal-content">
  375.                     <div class="modal-header" style="border: none;">
  376.                         <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  377.                         <h4 class="modal-title text-center" id="gridSystemModalLabel" style="padding-top: 27px;">
  378.                           <span style="color: red">ATTENTION RECONNAISSANCE INFERIEUR A 20% !!!</span> <br><br>Ce document est succeptible de n'avoir aucun modèle de reconnaissance IA enregistré. <br>Vous devrez selectionner manuellement les champs sur ce document
  379.                         </h4>
  380.                     </div>
  381.                     <div class="modal-body text-center">
  382.                         <button type="button" class="btn btn-primary" class="close" data-dismiss="modal" aria-label="Close">OK</button>
  383.                     </div>
  384.                 </div>
  385.               </div>
  386.             </div>
  387.         </div>
  388. </div>
  389. <!-- Mainly scripts -->
  390. <script src="{{ asset('vendor/popper.js/dist/umd/popper.js') }}"></script>
  391. <script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
  392. <script src="{{ asset('vendor/metisMenu/jquery.metisMenu.js') }}"></script>
  393. <script src="{{ asset('vendor/slimscroll/jquery.slimscroll.min.js') }}"></script>
  394. <script src="{{ asset('vendor/peity/jquery.peity.min.js') }}"></script>
  395. <script src="{{ asset('vendor/toastr/toastr.min.js') }}"></script>
  396. <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.4.10/dist/sweetalert2.all.min.js"></script>
  397. <!-- Custom and plugin javascript -->
  398. <script src="{{ asset('js/inspinia.js') }}"></script>
  399. <script src="{{ asset('vendor/pace/pace.min.js') }}"></script>
  400. <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.15.6/xlsx.core.min.js"></script>
  401. <script type="text/javascript" src="{{ asset('vendor/excelplus-2.5.min.js') }}"></script>
  402. <!-- iCheck --> 
  403. <script src="{{ asset('vendor/iCheck/icheck.min.js') }}"></script>
  404. <script type="text/javascript">
  405.     var currentRotation = 0;
  406.     $(document).ready(function(){
  407.         $(".btn-config-colonne").click(function(){
  408.             $(".column-container").slideToggle();
  409.         });
  410.     });
  411.     $(document).mouseup(function(e) {
  412.       var containerConfigColumns = $(".column-container");
  413.         if (!containerConfigColumns.is(e.target) && containerConfigColumns.has(e.target).length === 0){ 
  414.           $('.column-container').hide();
  415.         }
  416.     })
  417.     $.fn.isInViewport = function() {
  418.         var elementTop = $(this).offset().top;
  419.         var elementBottom = elementTop + $(this).outerHeight();
  420.         var viewportTop = $(window).scrollTop();
  421.         var viewportBottom = viewportTop + $(window).height();
  422.         return elementBottom > viewportTop && elementTop < viewportBottom;
  423.     };
  424.     function isElementInViewport (el) {
  425.     // Special bonus for those using jQuery
  426.         if (typeof jQuery === "function" && el instanceof jQuery) {
  427.             el = el[0];
  428.         }
  429.         var rect = el.getBoundingClientRect();
  430.         return (
  431.             rect.top >= 0 &&
  432.             rect.left >= 0 &&
  433.             rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && /* or $(window).height() */
  434.             rect.right <= (window.innerWidth || document.documentElement.clientWidth) /* or $(window).width() */
  435.         );
  436.     }
  437.     function isElementPartiallyInViewport(el)
  438.         {
  439.             // Special bonus for those using jQuery
  440.             if (typeof jQuery !== 'undefined' && el instanceof jQuery) 
  441.                 el = el[0];
  442.             var rect = el.getBoundingClientRect();
  443.             // DOMRect { x: 8, y: 8, width: 100, height: 100, top: 8, right: 108, bottom: 108, left: 8 }
  444.             var windowHeight = (window.innerHeight || document.documentElement.clientHeight);
  445.             var windowWidth = (window.innerWidth || document.documentElement.clientWidth);
  446.             // http://stackoverflow.com/questions/325933/determine-whether-two-date-ranges-overlap
  447.             var vertInView = (rect.top <= windowHeight) && ((rect.top + rect.height) >= 0);
  448.             var horInView = (rect.left <= windowWidth) && ((rect.left + rect.width) >= 0);
  449.             return (vertInView && horInView);
  450.         }
  451. </script>
  452. <!-- Peity
  453. <script src="js/demo/peity-demo.js"></script>
  454. -->
  455. {% block js_import %}
  456. {% endblock %}
  457. <script>
  458.     $(document).ready(function(){
  459.         $('.i-checks').iCheck({
  460.             checkboxClass: 'icheckbox_square-green',
  461.             radioClass: 'iradio_square-green',
  462.         });
  463.     });
  464.     jQuery(document).ready(function() { 
  465.         {% for label, message in app.flashes('success') %}
  466.             toastr.success("{{ message }}");
  467.         {% endfor %}
  468.         {% for message in app.flashes('error') %}
  469.             toastr.error("{{ message }}");
  470.         {% endfor %}
  471.         {% for message in app.flashes('infos') %}
  472.             toastr.infos("{{ message }}");
  473.         {% endfor %}
  474.         {% for message in app.flashes('warning') %}
  475.             toastr.warning("{{ message }}");
  476.         {% endfor %}
  477.     });
  478.     isObjectEmpty = function(obj) {
  479.         for(var key in obj) {
  480.             if(obj.hasOwnProperty(key))
  481.                 return false;
  482.         }
  483.         return true;
  484.     };
  485.     {% block javascript %}
  486.     {% endblock %}
  487. </script>
  488. <script type="text/javascript">
  489.     if("{{app.user.role}}" == "administrateur" && !"{{app.session.get('entreprise_session_id')}}"){
  490.         loadEntreprise();
  491.     }
  492.     $('.openEntrepriseModal').click(function(){
  493.         loadEntreprise();        
  494.     })
  495.     function loadEntreprise(){
  496.         $('#modalEntreprise').modal({
  497.           backdrop: 'static'
  498.         });
  499.         $('.loader-container').css('display','flex');
  500.         $.ajax({
  501.             url: "{{path('entreprise_load_xhr')}}",
  502.             type: "GET",
  503.             async: true,
  504.             dataType: "json",
  505.             data: {},
  506.             success:function(response) {
  507.               if(response.status == 200){
  508.                 $('#modalEntreprise .entreprise-container').html(response.datas);
  509.               }
  510.               else if(response.status == 500){
  511.                 toastr.error(response.message);
  512.               }
  513.               $('.loader-container').css('display','none');
  514.             },
  515.             error:function(){
  516.               toastr.error("Ooops... Quelque chose s'est mal passée");
  517.               $('.loader-container').css('display','none');
  518.             }
  519.         });
  520.     }
  521.     function loadMenu(){
  522.         $.ajax({
  523.             url: "{{path('menu_load_xhr')}}",
  524.             type: "GET",
  525.             async: true,
  526.             dataType: "json",
  527.             data: {},
  528.             success:function(response) {
  529.               if(response.status == 200){
  530.                 $('#side-menu').html(response.datas);
  531.               }
  532.               else if(response.status == 500){
  533.                 toastr.error(response.message);
  534.               }
  535.             },
  536.             error:function(){
  537.               toastr.error("Ooops... Quelque chose s'est mal passée");
  538.             }
  539.         });
  540.     }
  541.     if( "{{app.session.get('entreprise_session_id')}}" )
  542.         loadMenu();
  543.     $(document).on('click', '.menu-item', function(){
  544.         if($(this).hasClass('active')){
  545.             $(this).removeClass('active');
  546.             $(this).find('.sub-nav').addClass('collapse');
  547.         }
  548.         else{
  549.             $('.menu-item').removeClass('active');
  550.             $('.menu-item .sub-nav').addClass('collapse');
  551.             $(this).addClass('active');
  552.             $(this).find('.sub-nav').removeClass('collapse');
  553.         }
  554.         
  555.     })
  556.     function switchEntreprise(el){
  557.         var url = el.getAttribute("data-href");
  558.         $('.loader-container').css('display','flex');
  559.         $.ajax({
  560.             url: url,
  561.             type: "GET",
  562.             dataType: "json",
  563.             async: true,
  564.             data: {},
  565.             success: function(response) {
  566.                 if(response.status == 200){
  567.                     location.reload();
  568.                 }
  569.                 else if(response.status == 500){
  570.                     toastr.error(response.message);
  571.                 }
  572.                 $('.loader-container').css('display','none');
  573.             },
  574.             error: function(xhr, textStatus, errorThrown) {
  575.               console.log(errorThrown);
  576.               $('.loader-container').css('display','none');
  577.             }
  578.         });
  579.     }
  580.     $(document).ready( function () {
  581.         $('body').on('click', ' .showDocument', function(){
  582.             $documentFile = $(this).attr('data-file');
  583.             $('#modalDocumentShow').modal('show');
  584.             if($documentFile != ""){
  585.                 $('.no-document').css('display','none');
  586.                 $('.documentFile-container').css('display','block');
  587.                 if($documentFile.substr($documentFile.length - 3).toLowerCase() == "pdf"){
  588.                     // $('#btnRotation').css('display', 'inline-block');
  589.                     // $('#btnRotation .rotationChoice').attr('data-pdf', $documentFile);
  590.                     $('.lien-document').attr('href', $documentFile);
  591.                     $('.documentFile-container').html('<object class="documentPdf" data="" type="application/pdf" width="100%" height="980px"></object>');
  592.                 }
  593.                 else{
  594.                     $('.documentFile-container').html('<object class="documentPdf" data="" ></object>');
  595.                 }
  596.                 $('.documentPdf').attr('data', $documentFile);
  597.             }
  598.             else{
  599.                 $('.documentFile-container').css('display','none');
  600.                 $('.no-document').css('display','block');
  601.             }
  602.         })
  603.         $('body').on('click', ' .rotationChoice', function(){
  604.             var pdf = $(this).attr('data-pdf');
  605.             var rotation = $(this).attr('data-rotation');
  606.             var dossier = $(this).attr('data-dossier');
  607.             // currentRotation = parseInt(currentRotation) + parseInt(rotation);
  608.             // $('.data-ocr-container').css('transform', "rotate("+currentRotation+"deg)");
  609.             // console.log(currentRotation);
  610.             $.ajax({
  611.                 url: "{{path('document_rotation')}}",
  612.                 type: "GET",
  613.                 dataType: "json",
  614.                 async: true,
  615.                 data: {
  616.                     pdf:pdf,
  617.                     rotation:rotation,
  618.                     dossier:dossier
  619.                 },
  620.                 success: function(response, status) {
  621.                   if(response.status == 200){
  622.                     window.open(response.datas.redirect,'_blank');
  623.                     window.close();
  624.                   }
  625.                   else if(response.status == 400){
  626.                         toastr.error(response.message);
  627.                   }
  628.                 },
  629.                 error: function(xhr, textStatus, errorThrown) {
  630.                   toastr.error("Ooops..., Quelque chose s'est mal passée");
  631.                 }
  632.             });
  633.         })
  634.     } );
  635.     // $(document).on('click', '#rotationCss', function(){
  636.     //     let angle = $(this).val();
  637.     //     $('.data-ocr-container').css('transform', "rotate("+angle+"deg)");
  638.     //     console.log(angle);
  639.     //     console.log('deg');
  640.     //     console.log(angle+'deg');
  641.     // })
  642.     $(document).on("blur", ".field-number", function () {
  643.         if($(this).val()){
  644.             var content = $(this).val();
  645.             
  646.             if (content.indexOf(',') > -1 && content.indexOf('.') > -1){
  647.                 content = content.replace(",", '');
  648.             }
  649.             var valeur = content.replace(/[\,]+/g, '.');
  650.             var valString = valeur.toString(); 
  651.             valString = valString.toLowerCase();
  652.             valString = valString.replace("euro", '');
  653.             valString = valString.replace("eur", '');
  654.             valString = valString.replace("€", '');
  655.             valString = valString.replace(" ", '');
  656.             valeur = parseFloat(valString);
  657.             $(this).val(valeur);
  658.         }
  659.     });
  660.     function ajustePrice(content){
  661.         
  662.         if(content != ""){
  663.             if (content.indexOf(',') > -1 && content.indexOf('.') > -1){
  664.                 content = content.replace(",", '');
  665.             }
  666.             var valeur = content.replace(/[\,]+/g, '.');
  667.             var valString = valeur.toString(); 
  668.             valString = valString.toLowerCase();
  669.             valString = valString.replace("euro", '');
  670.             valString = valString.replace("eur", '');
  671.             valString = valString.replace("€", '');
  672.             valString = valString.replace(" ", '');
  673.             valeur = parseFloat(valString);
  674.             return valeur;
  675.         }
  676.         return "";
  677.     }
  678. </script>
  679. <script type="text/javascript">
  680.         jQuery.extend( jQuery.fn.dataTableExt.oSort, {
  681.             "num-html-pre": function ( a ) {
  682.                 var x = String(a).replace( /<[\s\S]*?>/g, "" );
  683.                 return parseFloat( x );
  684.             },
  685.          
  686.             "num-html-asc": function ( a, b ) {
  687.                 return ((a < b) ? -1 : ((a > b) ? 1 : 0));
  688.             },
  689.          
  690.             "num-html-desc": function ( a, b ) {
  691.                 return ((a < b) ? 1 : ((a > b) ? -1 : 0));
  692.             }
  693.         } );
  694. </script>
  695. {% block javascript_script %}
  696.     <script type="text/javascript">
  697.         // our updatable variable objects to use globally
  698.         let img = {};
  699.         let position = {};
  700.         let fieldsOcr = [
  701.             {field:'document_id', type:'text'},
  702.             {field:'facturedAt', type:'date'},
  703.             {field:'dueAt', type:'date'},
  704.             {field:'prixttc', type:'text'},
  705.             {field:'prixht', type:'text'},
  706.             {field:'tva', type:'select'},
  707.             {field:'devise', type:'select'},
  708.             {field:'fournisseur', type:'select'},
  709.             {field:'client', type:'select'},
  710.             {field:'chantier', type:'select'},
  711.             {field:'devis', type:'select'},
  712.             {field:'lot', type:'text'},
  713.             {field:'rossum_document_id', type:'text'},
  714.             {field:'status', type:'select'},
  715.             {field:'code_compta', type:'text'},
  716.             {field:'utilisateur', type:'select'},
  717.             {field:'conges_paye', type:'text'},
  718.             {field:'heure_sup_1', type:'text'},
  719.             {field:'heure_sup_2', type:'text'},
  720.             {field:'heure_normale', type:'text'},
  721.             {field:'trajet', type:'text'},
  722.             {field:'panier', type:'text'},
  723.             {field:'cout_global', type:'text'},
  724.             {field:'salaire_net', type:'text'},
  725.             {field:'date_paie', type:'text'},
  726.         ];
  727.         let moisObject = [
  728.             {mois:'janvier', num:'01'},
  729.             {mois:'fevrier', num:'02'},
  730.             {mois:'mars', num:'03'},
  731.             {mois:'avril', num:'04'},
  732.             {mois:'mai', num:'05'},
  733.             {mois:'juin', num:'06'},
  734.             {mois:'juillet', num:'07'},
  735.             {mois:'août', num:'08'},
  736.             {mois:'septembre', num:'09'},
  737.             {mois:'octobre', num:'10'},
  738.             {mois:'novembre', num:'11'},
  739.             {mois:'decembre', num:'12'},
  740.         ];
  741.         let tabDay = ['lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi', 'dimanche'];
  742.         $fieldPreference = [];
  743.         {% if fieldPreference is defined %}
  744.             $fieldPreference = {{ fieldPreference|json_encode()|raw }};
  745.         {% endif %}
  746.         // image matrix function to update img object variable
  747.         function imgMatrix() {
  748.           // our image object inside area
  749.           let $img = $('.document-container');
  750.           // offset data of image
  751.           let offset = $img.offset();
  752.           // add/update object key data
  753.           img.width = $img.outerWidth();
  754.           img.height = $img.outerHeight();
  755.           img.offsetX = offset.left - $(document).scrollLeft();
  756.           img.offsetY = offset.top - $(document).scrollTop();
  757.         }
  758.         // position matrix function to update position object variable
  759.         function positionMatrix(e, mousedown = false) {
  760.           // if mousedown param is true... for use in 
  761.           if (mousedown) {
  762.             // set the top/left position object data with percentage position
  763.             position.top = (100 / img.height) * ( (e.pageY - $(document).scrollTop()) - img.offsetY);
  764.             position.left = (100 / img.width) * ( (e.pageX - $(document).scrollLeft()) - img.offsetX);
  765.           }
  766.           // set the right/bottom position object data with percentage position
  767.           position.right = 100 - ((100 / img.width) * ((e.pageX - $(document).scrollLeft()) - img.offsetX));
  768.           position.bottom = 100 - ((100 / img.height) * ((e.pageY - $(document).scrollTop()) - img.offsetY));
  769.         }
  770.         // mouse move event function in area div
  771.         $(document).on('mousemove', '.document-container', function(e) {
  772.           // / update img object variable data upon this mousemove event
  773.           imgMatrix();
  774.           // if this area has draw class
  775.           if ($(this).hasClass('draw')) {
  776.             // update position object variable data passing current event data
  777.             positionMatrix(e);
  778.             // if image x cursor drag position percent is negative to mousedown x position
  779.             if ((100 - position.bottom) < position.top) {
  780.               // update rectange x negative positions css
  781.               $('.rect', this).css({
  782.                 top: (100 - position.bottom) + '%',
  783.                 bottom: (100 - position.top) + '%'
  784.               });
  785.               // else if image x cursor drag position percent is positive to mousedown x position
  786.             } else {
  787.               // update rectange x positive positions css
  788.               $('.rect', this).css({
  789.                 bottom: position.bottom + '%',
  790.                 top: position.top + '%',
  791.               });
  792.             }
  793.             // if image y cursor drag position percent is negative to mousedown y position
  794.             if ((100 - position.right) < position.left) {
  795.               // update rectange y negative positions css
  796.               $('.rect', this).css({
  797.                 left: (100 - position.right) + '%',
  798.                 right: (100 - position.left) + '%'
  799.               });
  800.               // else if image y cursor drag position percent is positive to mousedown y position
  801.             } else {
  802.               // update rectange y positive positions css
  803.               $('.rect', this).css({
  804.                 right: position.right + '%',
  805.                 left: position.left + '%'
  806.               });
  807.             }
  808.           }
  809.         });
  810.         function lineDistance(x, y, x0, y0){
  811.             return Math.sqrt((x -= x0) * x + (y -= y0) * y);
  812.         };
  813.         // mouse down event function in area div
  814.         $(document).on('mousedown', '.doc-img', function(e) {
  815.             $('.rect').css('display', 'block');
  816.             var parent = $(this).parent('.document-container').get(0);
  817.           // remove the drawn class
  818.           $(parent).removeClass('drawn');
  819.           // update img object variable data upon this mousedown event
  820.           imgMatrix();
  821.           // update position object variable data passing current event data and mousedown param as true 
  822.           positionMatrix(e, true);
  823.           // update rectange xy positions css
  824.           $('.rect', parent).css({
  825.             left: position.left + '%',
  826.             top: position.top + '%',
  827.             right: position.right + '%',
  828.             bottom: position.bottom + '%'
  829.           });
  830.           // add draw class to area div to reveal rectangle
  831.           $(parent).addClass('draw');
  832.         });
  833.         // mouse up event function in area div
  834.         $(document).on('mouseup', '.document-container', function(e) {
  835.           // update img object variable data upon this mouseup event
  836.           imgMatrix();
  837.           // if this area had draw class
  838.           if ($(this).hasClass('draw')) {
  839.             // update position object variable data passing current event
  840.             positionMatrix(e);
  841.             // math trunc on position values if x and y values are equal, basically no drawn rectangle on mouseup event
  842.             if ((Math.trunc(position.left) === Math.trunc(100 - position.right)) && (Math.trunc(position.top) === Math.trunc(100 - position.bottom))) {
  843.               
  844.               // remove draw and drawn classes
  845.               $(this).removeClass('draw drawn');
  846.             // else if x and y values are not equal, basically a rectange has been drawn
  847.             } else {
  848.               // add drawn class and remove draw class
  849.               $(this).addClass('drawn').removeClass('draw');
  850.             }
  851.           }
  852.             $parentContent = $('.document-container').get(0).getBoundingClientRect();
  853.             $rect = $('.rect').get(0).getBoundingClientRect();
  854.             position.left = convertToPourcentage($parentContent.width, ($rect.left - $parentContent.left));
  855.             position.top = convertToPourcentage($parentContent.height, ($rect.top - $parentContent.top));
  856.             position.width = convertToPourcentage($parentContent.width, $rect.width);
  857.             position.height = convertToPourcentage($parentContent.height, $rect.height);
  858.             /*if( convertToPourcentage($parentContent.width, $rect.width) > convertToPourcentage($parentContent.width, 20)){*/
  859.             if(true){
  860.                 /*$('#popTextExtract').modal('show');*/
  861.                 groupTextByPosition(position);
  862.                 $('.btn-ajuster').css('display', 'inline-block');
  863.             }
  864.         });
  865.         // on window resize function
  866.         $(window).on('resize', function(e) {
  867.           // update img object variable data upon this window resize event
  868.           imgMatrix();
  869.         });
  870.         $('.ocr-field').click(function(e){
  871.             $('.ocr-field').removeClass('active');
  872.             $(this).addClass('active');
  873.         });
  874.         
  875.         function convertToPourcentage(parentContent, toConvert){
  876.             return (toConvert*100) / parentContent ;
  877.         }
  878.         function appendText(data, position = {}, dossier = ""){
  879.             $parentfieldSelect = $('.ocr-field.active');
  880.             index = fieldsOcr.findIndex(x => x.field === $parentfieldSelect.data('field'));
  881.             $fieldSelect = $parentfieldSelect.find('.field');
  882.             var cordonnee =  position.left+'-'+position.top+'-'+position.width+'-'+position.height;
  883.             var type = "";
  884.             if( index > -1 ){
  885.                 type = fieldsOcr[index]['type'];
  886.             }
  887.             if(type == 'text'){
  888.                 $fieldSelect.val(data);
  889.                 $( ".field-number" ).trigger( "blur" );
  890.             }
  891.             else if(type == 'date'){
  892.                 $field = fieldsOcr[index]['field'];
  893.                 console.log([index, $field, $fieldPreference]);
  894.                 dateFormat = $fieldPreference[$field].type;
  895.                 formattedDate = rebuildDate(data, dateFormat);
  896.                 if(formattedDate != "")
  897.                     $fieldSelect.val(formattedDate);
  898.             }
  899.             else if(type == 'select'){
  900.                 $('.row-suggession').css('display', 'none');
  901.                 $field = fieldsOcr[index]['field'];
  902.                 if($field == "fournisseur"){
  903.                     $('#achat_fournisseur').val(data.fournisseur);
  904.                     $('#achat_code_compta').val(data.code_compta);
  905.                     $('#achat_lot').val(data.lot);
  906.                     $('.row-suggession').css('display', 'block');
  907.                     $listSuggestion = "";
  908.                     $.each(data.fournisseurfound, function( index, value ) {
  909.                       $listSuggestion += "<option>"+value.nom+"</option>";
  910.                     });
  911.                     $('.field-suggession').html($listSuggestion);
  912.                 }
  913.                 if($field == "client"){
  914.                     $('#vente_client').val(data.client);
  915.                     $('#vente_lot').val(data.lot);
  916.                     $('.row-suggession').css('display', 'block');
  917.                     $listSuggestion = "";
  918.                     $.each(data.fournisseurfound, function( index, value ) {
  919.                       $listSuggestion += "<option>"+value.nom+"</option>";
  920.                     });
  921.                     $('.field-suggession').html($listSuggestion);
  922.                 }
  923.                 if($field == "utilisateur"){
  924.                     $fieldSelect.val(data.utilisateur);
  925.                 }
  926.                 else if($field == "chantier"){
  927.                     $fieldSelect.val(data.chantier);
  928.                     if(dossier == "achat"){
  929.                         $.ajax({
  930.                             url: "{{path('devis_client_get_by_chantier_import')}}",
  931.                             type: "POST",
  932.                             dataType: "json",
  933.                             async: true,
  934.                             data: {
  935.                                 chantier_id: data.chantier
  936.                             },
  937.                             success: function(response) {
  938.                                 if(response.status == 200){
  939.                                     console.log(response.devis);
  940.                                     var OPTIONS = "<option></option>";
  941.                                     $.each(response.devis, function( index, value ) {
  942.                                         OPTIONS += "<option value="+value.id+">"+value.label+"</option>";
  943.                                     });
  944.                                     $('#achat_devis').html(OPTIONS);
  945.                                 }
  946.                                 else if(response.status == 500){
  947.                                     toastr.error(response.message);
  948.                                 }
  949.                                 $('.loader-container').css('display','none');
  950.                             },
  951.                             error: function(xhr, textStatus, errorThrown) {
  952.                               console.log(errorThrown);
  953.                               $('.loader-container').css('display','none');
  954.                             }
  955.                         });
  956.                     }
  957.                 }
  958.                 else if($field == "devise"){
  959.                     $fieldSelect.val(data.devise);
  960.                 }
  961.                 else if($field == "tva"){
  962.                     $fieldSelect.val(data.tva);
  963.                 }
  964.             }
  965.             $parentfieldSelect.find('input.field_identite').val(cordonnee);
  966.         }
  967.         function rebuildDate(text, dateFormat){
  968.             text = replaceAll(text, ',', '');
  969.             if (text.indexOf('/') <= -1){
  970.                 text = replaceAll(text, '.', '/');
  971.                 text = replaceAll(text, '-', '/');
  972.                 text = replaceAll(text, ' ', '/');
  973.             }
  974.             else{
  975.                 text = replaceAll(text, '.', '');
  976.                 text = replaceAll(text, '-', '');
  977.                 text = replaceAll(text, ' ', '');
  978.             }
  979.             
  980.             var dateTab = text.split('/');
  981.             var formattedDate = "";
  982.             
  983.             if(dateTab.length >= 3){
  984.                 if(tabDay.includes(dateTab[0].toLowerCase())){
  985.                     dateTab.shift(); 
  986.                     var day = pad2(dateTab[0]);
  987.                     indexMois = moisObject.findIndex(x => x.mois === (dateTab[1]).toLowerCase());
  988.                     if( indexMois > -1 ){
  989.                         var month = moisObject[indexMois]['num'];
  990.                     }
  991.                 }
  992.                 else{
  993.                     var day = pad2(dateTab[0]); 
  994.                     indexMois = moisObject.findIndex(x => x.mois === (dateTab[1]).toLowerCase());
  995.                     if( indexMois > -1 ){
  996.                         var month = moisObject[indexMois]['num'];
  997.                     }
  998.                     else{
  999.                         var month = pad2(dateTab[1]);
  1000.                     }
  1001.                 }
  1002.                 var year = dateTab[2];
  1003.                 if(year.length  == 2)
  1004.                     year = "20"+year;
  1005.                 
  1006.                 formattedDate =  year+"-"+month+"-"+day;
  1007.             }
  1008.             return formattedDate;
  1009.         }
  1010.         function replaceAll(str, find, replace) {
  1011.             var escapedFind=find.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
  1012.             return str.replace(new RegExp(escapedFind, 'g'), replace);
  1013.         }
  1014.         function pad2(n) {
  1015.             return (n.length  < 2 ? '0' : '') + n;
  1016.         }
  1017.         $(document).on('input', 'input.float', function() {
  1018.             this.value = this.value.replace(/[^0-9.,]/g, '').replace(/(\..*?)\..*/g, '$1');
  1019.             this.value = this.value.replace(',', '.');
  1020.         });
  1021.     </script>
  1022. {% endblock %}
  1023.   <script type="text/javascript">
  1024.     $(document).ready( function () {
  1025.       $('.removeColumn').remove();
  1026.     })
  1027.   </script>
  1028. </body>
  1029. </html>