templates/base.html.twig line 1

  1. {% trans_default_domain "top_bar" %}
  2. <!DOCTYPE html>
  3. <html lang="{{ app.request.getLocale() }}">
  4. <head>
  5.     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  6.     <meta name="author" content="Fogazzi Mirko" />
  7.     <meta name="copyright" content="Fogazzi Mirko" />
  8.     {{ include('seo_metatag.html.twig') }}
  9.     {{ impostazioni.ritornaImpostazioneDaNome("HeaderGeneraleTuttePagine")|raw }}
  10.     {{ traduzione.CaricaTraduzioniDaFamiglie(["agenti_dialog_principale", "dialog_ricerca_cliente", "agenti_crea_offerta_da_carrello_dialog"], app.request.locale) }}
  11.     {{ include('ZZ_front_end/stili_base.html.twig') }}
  12.     <title>{% block title %}{{ impostazioni.ritornaImpostazioneDaNome("TitleGenerico")|raw }}{% endblock %}</title>
  13.     <link rel="stylesheet" href="{{ asset('css/sm-core-css.css') }}">
  14.     <link rel="stylesheet" href="{{ asset('css/simple-sidebar.css') }}">
  15.     <!-- Bootstrap core CSS -->
  16.     <link href="{{ asset('css/bootstrap.min.css') }}" rel="stylesheet">
  17.     <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css" rel="stylesheet">
  18.     <link href="{{ asset('css/dropdown-css-style.css') }}" rel="stylesheet">
  19.     {#  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css">  #}
  20.     <link href="{{ asset('java_lib/jquery-ui-1.12.0/jquery-ui.min.css') }}" rel="stylesheet">
  21.     {% if is_granted('ROLE_ADMIN') or app.user or is_granted('ROLE_AGENTE') or is_granted('ROLE_COMMERCIALE') or is_granted("ROLE_FORNITORE") %}
  22.         {#<link href="https://unpkg.com/tabulator-tables@4.2.7/dist/css/tabulator.min.css" rel="stylesheet">#}
  23.         <link href="https://unpkg.com/tabulator-tables@5.2.3/dist/css/tabulator.min.css" rel="stylesheet">
  24.         <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.min.css" integrity="sha256-aa0xaJgmK/X74WM224KMQeNQC2xYKwlAt08oZqjeF0E=" crossorigin="anonymous" />
  25.     {% endif %}
  26.     <!-- FONT AWSOME -->
  27.     <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
  28.     <!-- SLICK CAROUSEL -->
  29.     <link rel="stylesheet" type="text/css" href="{{ asset('java_lib/slick-1.8.1/slick/slick.css') }}"/>
  30.     <link rel="stylesheet" type="text/css" href="{{ asset('java_lib/slick-1.8.1/slick/slick-theme.css') }}"/>
  31.     <!-- TINY SLIDER -->
  32.     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tiny-slider/2.9.2/tiny-slider.css">
  33.     <!-- CORE NAV -->
  34.     <link rel="stylesheet" type="text/css" href="{{ asset('java_lib/custom_mf_sidebar/mf_sidebar.css') }}" />
  35.     <style type="text/css">
  36.         #modalZoomImg * {box-sizing: border-box;}
  37.         div#modalDettaglioCliente.modal.fade.in{
  38.             visibility: visible;
  39.         }
  40.         div#modalDettaglioCliente.modal.fade{
  41.             display: block;
  42.             visibility: hidden;
  43.         }
  44.         .tb-numeri-tranne-1 td:not(:first-child), .tb-numeri-tranne-1 th:not(:first-child){
  45.             text-align: right;
  46.         }
  47.         .tb-numeri-tranne-2 td:not(:first-child):not(:nth-child(2)), .tb-numeri-tranne-1 th:not(:first-child):not(:nth-child(2)){
  48.             text-align: right;
  49.         }
  50.         .bottone-risorse-articoli{
  51.             position: absolute;
  52.             border: solid 1px green;
  53.             border-radius: 10px;
  54.             padding: 5px;
  55.             float: right;
  56.             width: 40px;
  57.             z-index: 99;
  58.             cursor: pointer;
  59.             background: white;
  60.             top: 0px;
  61.             right: 0px;
  62.             height: 40px;
  63.         }
  64.         .bottone-risorse-articoli img{
  65.             height: 100%;
  66.             width: 100%;
  67.             /* Permalink - use to edit and share this gradient: https://colorzilla.com/gradient-editor/#ffffff+0,ffffff+100&1+0,0+100;White+to+Transparent */
  68.             background: transparent;
  69.         }
  70.         .img-zoom-container {
  71.             position: relative;
  72.         }
  73.         .centra-flex-tutto{
  74.             display: flex;
  75.             flex-direction: row;
  76.             align-content: center;
  77.             align-items: center;
  78.             justify-content: center;
  79.         }
  80.         .img-zoom-lens {
  81.             position: absolute;
  82.             border: 1px solid #d4d4d4;
  83.             /*set the size of the lens:*/
  84.             width: 250px;
  85.             height: 250px;
  86.         }
  87.         .img-zoom-result {
  88.             border: 1px solid #d4d4d4;
  89.             /*set the size of the result div:*/
  90.             width: 300px;
  91.             height: 300px;
  92.         }
  93.         {% if impostazioni.ritornaImpostazioneDaNome('NascondiFrecceSuGiuInInputNumber') == '1' %}
  94.         /* Chrome, Safari, Edge, Opera */
  95.         input::-webkit-outer-spin-button,
  96.         input::-webkit-inner-spin-button {
  97.             -webkit-appearance: none;
  98.             margin: 0;
  99.         }
  100.         /* Firefox */
  101.         input[type=number] {
  102.             -moz-appearance: textfield;
  103.         }
  104.         {% endif %}
  105.         /* The snackbar - position it at the bottom and in the middle of the screen */
  106.         #snackbar {
  107.             visibility: hidden; /* Hidden by default. Visible on click */
  108.             min-width: 350px; /* Set a default minimum width */
  109.             margin-left: -125px; /* Divide value of min-width by 2 */
  110.             background-color: #333; /* Black background color */
  111.             color: #fff; /* White text color */
  112.             text-align: center; /* Centered text */
  113.             border-radius: 2px; /* Rounded borders */
  114.             padding: 16px; /* Padding */
  115.             position: fixed; /* Sit on top of the screen */
  116.             z-index: 1; /* Add a z-index if needed */
  117.             left: 50%; /* Center the snackbar */
  118.             bottom: 80px; /* 30px from the bottom */
  119.             font-size: 15pt;
  120.         }
  121.         .attiva-tiny-slider{
  122.             display: none;
  123.         }
  124.         .attiva-slick{
  125.             display: none;
  126.         }
  127.         #bodyTabellaRicercaCliente tr:hover{
  128.             background-color: yellow;
  129.             cursor: pointer;
  130.         }
  131.         .cercaCliente:hover{
  132.             cursor: pointer;
  133.         }
  134.         .modal { overflow: auto !important; }
  135.         /* Show the snackbar when clicking on a button (class added with JavaScript) */
  136.         #snackbar.show {
  137.             visibility: visible; /* Show the snackbar */
  138.             /* Add animation: Take 0.5 seconds to fade in and out the snackbar.
  139.             However, delay the fade out process for 2.5 seconds */
  140.             -webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;
  141.             animation: fadein 0.5s, fadeout 0.5s 2.5s;
  142.         }
  143.         /* Animations to fade the snackbar in and out */
  144.         @-webkit-keyframes fadein {
  145.             from {bottom: 0; opacity: 0;}
  146.             to {bottom: 80px; opacity: 1;}
  147.         }
  148.         @keyframes fadein {
  149.             from {bottom: 0; opacity: 0;}
  150.             to {bottom: 80px; opacity: 1;}
  151.         }
  152.         @-webkit-keyframes fadeout {
  153.             from {bottom: 80px; opacity: 1;}
  154.             to {bottom: 0; opacity: 0;}
  155.         }
  156.         @keyframes fadeout {
  157.             from {bottom: 80px; opacity: 1;}
  158.             to {bottom: 0; opacity: 0;}
  159.         }
  160.     </style>
  161.     {% block head %}{% endblock %}
  162.     {% block stylesheet %}{% endblock %}
  163.     {% block altri_nav %}{% endblock %}
  164.     <!-- jQuery Core -->
  165.     <script type="text/javascript" src="{{ asset('java_lib/jquery-2.2.4.min.js') }}"></script>
  166.     <script type="text/javascript" src="{{ asset('java_lib/jquery-ui-1.12.0/jquery-ui.min.js') }}"></script>
  167.     <script type="text/javascript" src="{{ asset('java_lib/bootstrap.min.js') }}"></script>
  168.     {#  <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.bundle.min.js"></script> #}
  169. </head>
  170. <body>
  171. <div id="snackbar"></div>
  172. <div class="loading" id="loadingMaster">Loading&#8230;</div>
  173. {% if app.request.get("_route") == 'admin_pagine_e_componenti_editor' %}
  174.     {% set mostraTopBar = 0 %}
  175. {% endif %}
  176. {% if (mostraTopBar is defined and mostraTopBar == 1) or mostraTopBar is not defined %}
  177.     {{ include('ZZ_front_end/top_bar/top_bar.html.twig') }}
  178. {% endif %}
  179. {% if app.request.get("_route") == 'home_shop' %}
  180.     <div class="modal fade" role="dialog" tabindex="-1" style="z-index: 999999;" id="modal-cerca-filtro-avanzato-dialog">
  181.         <div class="modal-dialog" role="document">
  182.             <div class="modal-content">
  183.                 <div class="modal-header">
  184.                     <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  185.                     <h4 class="modal-title">{{ traduzione.OttieniElementoDizionario("top_bar_filtro_avanzato_title", "top_bar").valoreUscita }}</h4>
  186.                 </div>
  187.                 <div class="modal-body">
  188.                     <form id="form-filtro-avanzato">
  189.                         <div class="form-group">
  190.                             <label for="filtro-avanzato-codice">{{ traduzione.OttieniElementoDizionario("top_bar_filtro_avanzato_codice_label", "top_bar").valoreUscita }}</label>
  191.                             <input type="text" class="form-control" name="articolo.codice" id="filtro-avanzato-codice">
  192.                         </div>
  193.                         <div class="form-group">
  194.                             <label for="filtro-avanzato-nome">{{ traduzione.OttieniElementoDizionario("top_bar_filtro_avanzato_descrizione_label", "top_bar").valoreUscita }}</label>
  195.                             <input type="text" class="form-control" name="articolo.nome" id="filtro-avanzato-nome">
  196.                         </div>
  197.                         <div class="form-group">
  198.                             <label for="filtro-avanzato-marca">{{ traduzione.OttieniElementoDizionario("top_bar_filtro_avanzato_marca_label", "top_bar").valoreUscita }}</label>
  199.                             <input type="text" class="form-control" name="mappa.marca" id="filtro-avanzato-marca">
  200.                         </div>
  201.                         <div class="checkbox">
  202.                             <label>
  203.                                 <input type="checkbox" name="filtro-avanzato-solo-disponibile"> {{ traduzione.OttieniElementoDizionario("top_bar_filtro_avanzato_mostra_solo_disponibili", "top_bar").valoreUscita }}
  204.                             </label>
  205.                         </div>
  206.                         <div class="checkbox">
  207.                             <label>
  208.                                 <input type="checkbox" name="filtro-avanzato-cerca-solo-in-categorie-selezionate"> {{ traduzione.OttieniElementoDizionario("top_bar_filtro_avanzato_cerca_solo_in_albero_categorie_corrente", "top_bar").valoreUscita }}
  209.                             </label>
  210.                         </div>
  211.                     </form>
  212.                 </div>
  213.                 <div class="modal-footer">
  214.                     <button type="button" onclick="ResetRicerca();" class="btn btn-danger" data-dismiss="modal">{{ traduzione.OttieniElementoDizionario("top_bar_filtro_avanzato_reset_btn", "top_bar").valoreUscita }}</button>
  215.                     <button type="button" onclick="$('#form-filtro-avanzato').submit();" class="btn btn-primary" data-dismiss="modal">{{ traduzione.OttieniElementoDizionario("top_bar_filtro_avanzato_applica_btn", "top_bar").valoreUscita }}</button>
  216.                 </div>
  217.             </div><!-- /.modal-content -->
  218.         </div><!-- /.modal-dialog -->
  219.     </div><!-- /.modal -->
  220. {% endif %}
  221. <div class="modal fade" tabindex="-1" role="dialog" id="modalZoomImg" style="z-index: 9999;">
  222.     <div class="modal-dialog panel-warning" role="document"  style="width: 80%;">
  223.         <div class="modal-content panel-warning">
  224.             <div class="modal-body" style="overflow-y: auto;">
  225.                 <div class="col-md-12 nascondiStampa">
  226.                     <div class="img-zoom-container">
  227.                         <div class="col-md-6 col-xs-12">
  228.                             <img id="zoomImgImg" src="" style="max-height: 90vh; width: auto;">
  229.                         </div>
  230.                         <div class="col-md-6 col-xs-12" style="max-height: 90vh;">
  231.                             <div id="zoomImgResult" class="img-zoom-result" style="width: 100%; height: 90vh;"></div>
  232.                         </div>
  233.                     </div>
  234.                 </div>
  235.             </div>
  236.             <div class="modal-footer">
  237.                 <button type="button" class="btn btn-danger" data-dismiss="modal">Chiudi</button>
  238.             </div>
  239.         </div><!-- /.modal-content -->
  240.     </div><!-- /.modal-dialog -->
  241. </div><!-- /.modal -->
  242. <div class="modal fade" tabindex="-1" role="dialog" id="risorseCatArtDialog" style="z-index: 99999;">
  243.     <div class="modal-dialog panel-warning" role="document"  style="width: 80%;">
  244.         <div class="modal-content panel-warning">
  245.             <div class="modal-header">
  246.                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  247.                 <h4 class="modal-title">Risorse</h4>
  248.             </div>
  249.             <div class="modal-body" id="risorseCatArtDialog-body" style="overflow-y: auto;">
  250.             </div>
  251.             <div class="modal-footer">
  252.                 <button type="button" class="btn btn-danger" data-dismiss="modal">Chiudi</button>
  253.             </div>
  254.         </div><!-- /.modal-content -->
  255.     </div><!-- /.modal-dialog -->
  256. </div><!-- /.modal -->
  257. {% if not is_granted('ROLE_ADMIN') or is_granted('ROLE_AGENTE') or is_granted('ROLE_COMMERCIALE') %}
  258. <div class="modal fade" tabindex="-1" role="dialog" id="modalDettaglioClienteLoggato">
  259.     <div class="modal-dialog panel-warning" role="document"  style="width: 80%;">
  260.         <div class="modal-content panel-warning">
  261.             <div class="modal-header">
  262.                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  263.                 <h4 class="modal-title" id="modalTitleDettaglioClienteLoggato">
  264.                     <button class="btn btn-danger" style="margin-right: 10px;" data-dismiss="modal" aria-label="Close">{{ traduzione.OttieniElementoDizionario("agenti_dialog_principale_indietro_btn", "agenti_dialog_principale").valoreUscita }}</button>
  265.                     {{ traduzione.OttieniElementoDizionario("agenti_dialog_principale_dettaglio_cliente", "agenti_dialog_principale").valoreUscita }} <span id="modalDettaglioClienteLoggato-title2" style="color:red;"></span>
  266.                 </h4>
  267.             </div>
  268.             <div class="modal-body" id="modalDettaglioClienteLoggato-body" style="overflow-y: auto;">
  269.             </div>
  270.         </div>
  271.     </div>
  272. </div>
  273. {% endif %}
  274. {% if is_granted('ROLE_ADMIN') or is_granted('ROLE_AGENTE') or is_granted('ROLE_COMMERCIALE') %}
  275. <div class="modal fade" tabindex="-1" role="dialog" id="modalDettaglioCliente">
  276.     <div class="modal-dialog panel-warning" role="document"  style="width: 80%;">
  277.         <div class="modal-content panel-warning">
  278.             <div class="modal-header">
  279.                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  280.                 <h4 class="modal-title" id="modalTitleDettaglioCliente">
  281.                     <button class="btn btn-danger" style="margin-right: 10px;" data-dismiss="modal" aria-label="Close">{{ traduzione.OttieniElementoDizionario("agenti_dialog_principale_indietro_btn", "agenti_dialog_principale").valoreUscita }}</button>
  282.                     {{ traduzione.OttieniElementoDizionario("agenti_dialog_principale_dettaglio_cliente", "agenti_dialog_principale").valoreUscita }} <span id="modalDettaglioCliente-title2" style="color:red;"></span>
  283.                     {% if impostazioni.ritornaImpostazioneDaNome('OfferteMostraPulsanteCreaOffertaDaCarrello') == '1' %}
  284.                         <button href="" style="float:right; margin-right: 20px;" id="modalDettaglioClienteCreaOffertaDaCarrelloBtn" data-toggle="modal" data-target="#modalCreaOffertaDaCarrello" class="btn btn-sm btn-primary">{{ traduzione.OttieniElementoDizionario("agenti_dialog_principale_crea_offerta_da_carrello_btn", "agenti_dialog_principale").valoreUscita }}</button>
  285.                     {% endif %}
  286.                     <button href="" style="float: right; margin-right: 20px;" id="modalDettaglioClienteSpostaCarrelloBtn" class="btn btn-sm btn-warning">{{ traduzione.OttieniElementoDizionario("agenti_dialog_principale_sposta_carrello_btn", "agenti_dialog_principale").valoreUscita }}</button>
  287.                     {% set attivaTipoOrdine = impostazioni.ritornaImpostazioneDaNome("AbilitaTipoOrdine") %}
  288.                     <div class="form-inline" style="float:right; margin-right:20px;{% if attivaTipoOrdine != '1' %}display:none;{% endif %}">
  289.                         <div class="form-group">
  290.                             <label for="tipo-ordine-input">{{ traduzione.OttieniElementoDizionario("agenti_dialog_principale_tipo_ordine", "agenti_dialog_principale").valoreUscita }}</label>
  291.                             <select id="tipo-ordine-input" class="form-control" style="width:auto;">
  292.                                 {% if attivaTipoOrdine == '1' %}
  293.                                     {% for tipoOrdine in servizi.RitornaTipiOrdine() %}
  294.                                         <option {% if loop.first %} selected="selected"{% endif %} value="{{ tipoOrdine.id|default("") }}">{{ tipoOrdine.testoVisualizzato|default("") }}</option>
  295.                                     {% endfor %}
  296.                                 {% endif %}
  297.                                 {% if servizi.RitornaTipiOrdine()|length <= 0 or attivaTipoOrdine == '0' %}
  298.                                     <option value=""></option>
  299.                                 {% endif %}
  300.                             </select>
  301.                         </div>
  302.                     </div>
  303.                 </h4>
  304.             </div>
  305.             <div class="modal-body" style="overflow-y: auto;">
  306.                 <div class="col-md-12 nascondiStampa">
  307.                     <div class="form-inline center">
  308.                         <div class="input-group" style="width: 100%;">
  309.                             <span style="font-weight: bold;width: 10%;min-width: 200px;" class="input-group-addon cercaCliente" id="basic-addon1">{{ traduzione.OttieniElementoDizionario("agenti_dialog_principale_seleziona_cliente", "agenti_dialog_principale").valoreUscita }}</span>
  310.                             <input type="text" style="width: 10%;min-width: 150px;" class="form-control cercaCliente" id="codiceClienteTxt" readonly placeholder="{{ traduzione.OttieniElementoDizionario("agenti_dialog_principale_cliente_codice", "agenti_dialog_principale").valoreUscita }}">
  311.                             <input type="text" style="width: 60%;" class="form-control cercaCliente" id="ragioneSocialeText" readonly placeholder="{{ traduzione.OttieniElementoDizionario("agenti_dialog_principale_cliente_ragione_sociale", "agenti_dialog_principale").valoreUscita }}">
  312.                             <button class="btn btn-small btn-danger pulisci-selezione-cliente" style="margin-left: 10px;" onclick="PulisciSelezioneCliente();"><i class="fa fa-trash" aria-hidden="true"></i></button>
  313.                             <button class="btn btn-default" data-valore="{% if servizi.RitornaAltriDatiUtente() and servizi.RitornaAltriDatiUtente().nascondiPrezzi %}1{% else %}0{% endif %}" id="nascondiPrzBtnDettCliente" onclick="VariaStatoBottoneNascondiPrezzi();" style="margin-left: 10px;{% if impostazioni.ritornaImpostazioneDaNome('MostraPulsanteNascondiPrezzi') != '1' %}display:none;{% endif %}">Nascondi prezzi</button>
  314.                         </div>
  315.                     </div>
  316.                     <hr>
  317.                     <div class="moda-dettaglio-cliente-body">
  318.                     </div>
  319.                 </div>
  320.             </div>
  321.             <div class="modal-footer">
  322.                 <button type="button" class="btn btn-danger" data-dismiss="modal">{{ traduzione.OttieniElementoDizionario("agenti_dialog_principale_chiudi_btn", "agenti_dialog_principale").valoreUscita }}</button>
  323.             </div>
  324.         </div><!-- /.modal-content -->
  325.     </div><!-- /.modal-dialog -->
  326. </div><!-- /.modal -->
  327. <div class="modal fade" tabindex="-1" role="dialog" id="modalCreaOffertaDaCarrello">
  328.     <div class="modal-dialog panel-warning" role="document">
  329.         <div class="modal-content panel-warning">
  330.             <div class="modal-header">
  331.                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  332.                 <h4 class="modal-title">
  333.                     {{ traduzione.OttieniElementoDizionario("agenti_dialog_principale_crea_offerta_da_carrello_btn", "agenti_dialog_principale").valoreUscita }}
  334.                 </h4>
  335.             </div>
  336.             <div class="modal-body" id="modalCreaOffertaDaCarrelloBody" style="overflow-y: auto;">
  337.                 <form id="creaOffertaDaCarrelloForm" action="{{ path('offerte_crea_da_carrello') }}">
  338.                     <div class="form-group">
  339.                         <label for="modal-crea-offerta-carrello-note">{{ traduzione.OttieniElementoDizionario("agenti_crea_offerta_da_carrello_dialog_note", "agenti_crea_offerta_da_carrello_dialog").valoreUscita }}</label>
  340.                         <textarea class="form-control" id="modal-crea-offerta-carrello-note" name="modal-crea-offerta-carrello-note"></textarea>
  341.                     </div>
  342.                     <div class="form-group">
  343.                         <label for="modal-crea-offerta-carrello-note-aziendali">{{ traduzione.OttieniElementoDizionario("agenti_crea_offerta_da_carrello_dialog_note_aziendali", "agenti_crea_offerta_da_carrello_dialog").valoreUscita }}</label>
  344.                         <textarea class="form-control" id="modal-crea-offerta-carrello-note" name="modal-crea-offerta-carrello-note-aziendali"></textarea>
  345.                     </div>
  346.                     <div class="form-group">
  347.                         <label for="modal-crea-offerta-carrello-riferimento-offerta">{{ traduzione.OttieniElementoDizionario("agenti_crea_offerta_da_carrello_dialog_note_riferimento_offerta", "agenti_crea_offerta_da_carrello_dialog").valoreUscita }}</label>
  348.                         <input type="text" class="form-control" id="modal-crea-offerta-carrello-riferimento-offerta" name="modal-crea-offerta-carrello-riferimento-offerta">
  349.                     </div>
  350.                     <div class="checkbox">
  351.                         <label>
  352.                             <input type="checkbox" id="modal-crea-offerta-carrello-invia-mail" name="modal-crea-offerta-carrello-invia-mail" checked="checked">{{ traduzione.OttieniElementoDizionario("agenti_crea_offerta_da_carrello_dialog_invia_offerta_mail_checkbox", "agenti_crea_offerta_da_carrello_dialog").valoreUscita }}
  353.                         </label>
  354.                     </div>
  355.                 </form>
  356.             </div>
  357.             <div class="modal-footer">
  358.                 <button href="" style="float:right; margin-right: 20px;" id="modalCreaOfferteDaCarrello_creaBtn" class="btn btn-sm btn-success">{{ traduzione.OttieniElementoDizionario("agenti_dialog_principale_crea_offerta_da_carrello_btn", "agenti_dialog_principale").valoreUscita }}</button>
  359.             </div>
  360.         </div><!-- /.modal-content -->
  361.     </div><!-- /.modal-dialog -->
  362. </div><!-- /.modal -->
  363. {% endif %}
  364. <div class="modal fade" tabindex="-1" role="dialog" id="modalRichiestaPrezzo">
  365.     <div class="modal-dialog panel-warning" role="document"  style="width: 80%;">
  366.         <div class="modal-content panel-warning">
  367.             <div class="modal-header">
  368.                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  369.                 <h4 class="modal-title">
  370.                     {{ traduzione.CaricaTraduzioniDaFamiglia("richiesta_prezzo", app.request.locale, false) }}
  371.                     {{ traduzione.OttieniElementoDizionario("richiesta_prezzo_title", "richiesta_prezzo").valoreUscita }}
  372.                 </h4>
  373.             </div>
  374.             <div class="modal-body" id="modalRichiestaPrezzoBody" style="overflow-y: auto;">
  375.             </div>
  376.         </div><!-- /.modal-content -->
  377.     </div><!-- /.modal-dialog -->
  378. </div><!-- /.modal -->
  379. <div class="modal fade" tabindex="-1" role="dialog" id="modalMagazziniSecondari">
  380.     <div class="modal-dialog panel-warning" role="document"  style="width: 80%;">
  381.         <div class="modal-content panel-warning">
  382.             <div class="modal-header">
  383.                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  384.                 <h4 class="modal-title">
  385.                     {{ traduzione.CaricaTraduzioniDaFamiglia("modal_magazzini_secondari", app.request.locale, false) }}
  386.                     {{ traduzione.OttieniElementoDizionario("modal_magazzini_secondari_title_main_modal", "modal_magazzini_secondari").valoreUscita }}
  387.                 </h4>
  388.             </div>
  389.             <div class="modal-body" id="modalMagazziniSecondariBody" style="overflow-y: auto;">
  390.             </div>
  391.         </div><!-- /.modal-content -->
  392.     </div><!-- /.modal-dialog -->
  393. </div><!-- /.modal -->
  394. {% if is_granted('ROLE_ADMIN') or is_granted('ROLE_AGENTE') or is_granted('ROLE_COMMERCIALE') %}
  395. <div class="modal fade" tabindex="-1" role="dialog" id="modalCercaCliente">
  396.     <div class="modal-dialog panel-warning" role="document"  style="width: 80%;">
  397.         <div class="modal-content panel-warning">
  398.             <div class="modal-header">
  399.                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  400.                 <h4 class="modal-title" id="modalTitle">{{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_title", "dialog_ricerca_cliente").valoreUscita }}</h4>
  401.             </div>
  402.             <div class="modal-body" style="overflow-y: auto;">
  403.                 <div class="col-md-12">
  404.                     <div class="col-md-4">
  405.                         <div class="form-inline center has-success">
  406.                             <div class="input-group" style="width: 100%;">
  407.                                 <span class="input-group-addon" id="basic-addon1"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></span>
  408.                                 <input type="text" class="form-control" id="ricercaClienteTxt" placeholder="{{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_inizia_a_scrivere", "dialog_ricerca_cliente").valoreUscita }}">
  409.                             </div>
  410.                         </div>
  411.                     </div>
  412.                     <div class="col-md-4">
  413.                         <div class="form-inline center has-success">
  414.                             <div class="input-group" style="width: 100%;">
  415.                                 <span class="input-group-addon" id="basic-addon1"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></span>
  416.                                 <input type="text" class="form-control" id="ricercaCittaTxt" placeholder="{{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_filtro_citta", "dialog_ricerca_cliente").valoreUscita }}">
  417.                             </div>
  418.                         </div>
  419.                     </div>
  420.                     <div class="col-md-4">
  421.                         <div class="form-inline center has-success">
  422.                             <div class="input-group" style="width: 100%;">
  423.                                 <span class="input-group-addon" id="basic-addon1"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></span>
  424.                                 <input type="text" class="form-control" id="ricercaProvinciaTxt" placeholder="{{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_filtro_provincia", "dialog_ricerca_cliente").valoreUscita }}">
  425.                             </div>
  426.                         </div>
  427.                     </div>
  428.                 </div>
  429.                 <table class="table table-striped table-responsive">
  430.                     <thead>
  431.                     <tr>
  432.                         <th>
  433.                             {{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_tab_col1_a", "dialog_ricerca_cliente").valoreUscita }}
  434.                             <br>
  435.                             {{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_tab_col1_b", "dialog_ricerca_cliente").valoreUscita }}
  436.                             <br>
  437.                             {{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_tab_col1_c", "dialog_ricerca_cliente").valoreUscita }}
  438.                         </th>
  439.                         <th>
  440.                             {{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_tab_col2_a", "dialog_ricerca_cliente").valoreUscita }}
  441.                             <br>
  442.                             {{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_tab_col2_b", "dialog_ricerca_cliente").valoreUscita }}
  443.                             <br>
  444.                             {{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_tab_col2_c", "dialog_ricerca_cliente").valoreUscita }}
  445.                         </th><th>
  446.                             {{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_tab_col3_a", "dialog_ricerca_cliente").valoreUscita }}
  447.                             <br>
  448.                             {{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_tab_col3_b", "dialog_ricerca_cliente").valoreUscita }}
  449.                             <br>
  450.                             {{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_tab_col3_c", "dialog_ricerca_cliente").valoreUscita }}
  451.                         </th>
  452.                     </tr>
  453.                     </thead>
  454.                     <tbody id="bodyTabellaRicercaCliente">
  455.                     </tbody>
  456.                 </table>
  457.             </div>
  458.             <div class="modal-footer">
  459.                 <button type="button" id="chiudiModalCercaCliente" class="btn btn-danger" data-dismiss="modal">{{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_chiudi_btn", "dialog_ricerca_cliente").valoreUscita }}</button>
  460.             </div>
  461.         </div><!-- /.modal-content -->
  462.     </div><!-- /.modal-dialog -->
  463. </div><!-- /.modal -->
  464. {% endif %}
  465. <div class="container-fluid contenitore_generale_body" >
  466.     <div class="row master-row-body">
  467.         <div class="col-md-12 master-col-body">
  468.             {% block body %}{% endblock %}
  469.         </div>
  470.     </div>
  471. </div><!-- /.container -->
  472. <script src="https://www.google.com/recaptcha/api.js?render={{ impostazioni.ritornaImpostazioneDaNome('ReCaptchaSiteKey') }}"></script>
  473. <script>
  474.     grecaptcha.ready(function() {
  475.         grecaptcha.execute('{{ impostazioni.ritornaImpostazioneDaNome('ReCaptchaSiteKey') }}', {action: 'homepage'}).then(function(token) {
  476.             $('.re-captcha-v3').val = token;
  477.         });
  478.     });
  479. </script>
  480. <!-- FOSJsRoutingBundle -->
  481. <script src="{{ asset('bundles/fosjsrouting/js/router.js') }}"></script>
  482. <script src="{{ path('fos_js_routing_js', { callback: 'fos.Router.setData' }) }}"></script>
  483. <!-- jQuery smartmenus plugin -->
  484. <script src="{{ asset('java_lib/jquery.smartmenus.min.js') }}"></script>
  485. <script src="{{ asset('java_lib/jquery.smartmenus.bootstrap.min.js') }}"></script>
  486. <script src="{{ asset('java_lib/jquery.stickytableheaders.min.js') }}" type="text/javascript"></script>
  487. <!-- SLICK CAROUSEL -->
  488. <script type="text/javascript" src="{{ asset('java_lib/slick-1.8.1/slick/slick.min.js') }}"></script>
  489. <!-- TINY SLIDER -->
  490. <script src="https://cdnjs.cloudflare.com/ajax/libs/tiny-slider/2.9.2/min/tiny-slider.js"></script>
  491. <!-- CORE NAV -->
  492. <script type="text/javascript" src="{{ asset('java_lib/custom_mf_sidebar/mf_sidebar.js') }}"></script>
  493. {#  <script type="text/javascript" src="https://unpkg.com/tabulator-tables@4.2.7/dist/js/tabulator.min.js"></script>#}
  494. <script type="text/javascript" src="https://unpkg.com/tabulator-tables@5.2.3/dist/js/tabulator.min.js"></script>
  495. <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.bundle.min.js" integrity="sha256-xKeoJ50pzbUGkpQxDYHD7o7hxe0LaOGeguUidbq6vis=" crossorigin="anonymous"></script>
  496. <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.min.js" integrity="sha256-Uv9BNBucvCPipKQ2NS9wYpJmi8DTOEfTA/nH2aoJALw=" crossorigin="anonymous"></script>
  497. <script src="https://cdnjs.cloudflare.com/ajax/libs/luxon/3.0.1/luxon.min.js" integrity="sha512-6ZJuab/UnRq1muTChgrVxJhSgygmL2GMLVmSJN7pcBEqJ1dWPbqN9CiZ6U3HrcApTIJsLnMgXYBYgtVkJ8fWiw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
  498. <script type="text/javascript">
  499.     {# Variabili utile per la sostituzione del carrello #}
  500.     let idCarrelloAttuale = '';
  501.     let stadioSostituzione = 0; {# Quando lo stadio è 1 allora ho già in memoria i due salti #}
  502.     {# FINE #}
  503.     var memorizzazioneAltriDatiUtente = {}
  504.     var lens = null;
  505.     var img = null;
  506.     {# Codice per zoom immagine #}
  507.     function imageZoom(imgID, resultID) {
  508.         if (lens != null){
  509.             lens.removeEventListener("mousemove", moveLens);
  510.             img.removeEventListener("mousemove", moveLens);
  511.             lens.removeEventListener("touchmove", moveLens);
  512.             img.removeEventListener("touchmove", moveLens);
  513.             lens.remove();
  514.             lens = null;
  515.         }
  516.         var result, cx, cy;
  517.         img = document.getElementById(imgID);
  518.         result = document.getElementById(resultID);
  519.         /* Create lens: */
  520.         lens = document.createElement("DIV");
  521.         lens.setAttribute("class", "img-zoom-lens");
  522.         /* Insert lens: */
  523.         img.parentElement.insertBefore(lens, img);
  524.         /* Calculate the ratio between result DIV and lens: */
  525.         cx = result.offsetWidth / lens.offsetWidth;
  526.         cy = result.offsetHeight / lens.offsetHeight;
  527.         /* Set background properties for the result DIV */
  528.         result.style.backgroundImage = "url('" + img.src + "')";
  529.         result.style.backgroundSize = (img.width * cx) + "px " + (img.height * cy) + "px";
  530.         /* Execute a function when someone moves the cursor over the image, or the lens: */
  531.         lens.addEventListener("mousemove", moveLens);
  532.         img.addEventListener("mousemove", moveLens);
  533.         /* And also for touch screens: */
  534.         lens.addEventListener("touchmove", moveLens);
  535.         img.addEventListener("touchmove", moveLens);
  536.         function moveLens(e) {
  537.             var pos, x, y;
  538.             /* Prevent any other actions that may occur when moving over the image */
  539.             e.preventDefault();
  540.             /* Get the cursor's x and y positions: */
  541.             pos = getCursorPos(e);
  542.             /* Calculate the position of the lens: */
  543.             x = pos.x - (lens.offsetWidth / 2);
  544.             y = pos.y - (lens.offsetHeight / 2);
  545.             /* Prevent the lens from being positioned outside the image: */
  546.             if (x > img.width - lens.offsetWidth) {x = img.width - lens.offsetWidth;}
  547.             if (x < 0) {x = 0;}
  548.             if (y > img.height - lens.offsetHeight) {y = img.height - lens.offsetHeight;}
  549.             if (y < 0) {y = 0;}
  550.             /* Set the position of the lens: */
  551.             lens.style.left = x + "px";
  552.             lens.style.top = y + "px";
  553.             /* Display what the lens "sees": */
  554.             result.style.backgroundPosition = "-" + (x * cx) + "px -" + (y * cy) + "px";
  555.         }
  556.         function getCursorPos(e) {
  557.             var a, x = 0, y = 0;
  558.             e = e || window.event;
  559.             /* Get the x and y positions of the image: */
  560.             a = img.getBoundingClientRect();
  561.             /* Calculate the cursor's x and y coordinates, relative to the image: */
  562.             x = e.pageX - a.left;
  563.             y = e.pageY - a.top;
  564.             /* Consider any page scrolling: */
  565.             x = x - window.pageXOffset;
  566.             y = y - window.pageYOffset;
  567.             return {x : x, y : y};
  568.         }
  569.     }
  570.     var randomRgbColor = function() {
  571.         var r = Math.floor(Math.random() * 255);
  572.         var g = Math.floor(Math.random() * 255);
  573.         var b = Math.floor(Math.random() * 255);
  574.         return "rgb(" + r + "," + g + "," + b + ")";
  575.     }
  576.     function toastMessage(messaggio, rosso = false) {
  577.         // Get the snackbar DIV
  578.         var x = document.getElementById("snackbar");
  579.         $(x).text(messaggio);
  580.         if (rosso){
  581.             $(x).css('background-color', 'red');
  582.             $(x).css('color', 'black');
  583.         }else{
  584.             $(x).css('background-color', 'black');
  585.             $(x).css('color', 'white');
  586.         }
  587.         // Add the "show" class to DIV
  588.         x.className = "show";
  589.         // After 3 seconds, remove the show class from DIV
  590.         setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000);
  591.     }
  592.     function ApriModalRichiestaPrezzo(idMappa){
  593.         $('#loadingMaster').show();
  594.         $.ajax({
  595.             dataType: 'html',
  596.             url: Routing.generate('richiesta_prezzo_modal', {'idMappa' : (idMappa) }),
  597.             async: true, //you won't need that if nothing in your following code is dependend of the result
  598.             success: function (response) {
  599.                 $('#modalRichiestaPrezzoBody').html(response);
  600.                 $('#modalRichiestaPrezzo').modal('toggle');
  601.                 $('#loadingMaster').hide();
  602.             },
  603.             error: function(XMLHttpRequest, textStatus, errorThrown) {
  604.                 $('#loadingMaster').hide();
  605.                 alert("Status: " + textStatus); alert("Error: " + errorThrown);
  606.             }
  607.         });
  608.     }
  609.     function ApriModalMagazziniSecondari(idMappa, qta){
  610.         $('#loadingMaster').show();
  611.         $.ajax({
  612.             dataType: 'html',
  613.             url: Routing.generate('magazzini_secondari_modal', {'idMappa' : (idMappa), 'qta' : (qta) }),
  614.             async: true, //you won't need that if nothing in your following code is dependend of the result
  615.             success: function (response) {
  616.                 $('#modalMagazziniSecondariBody').html(response);
  617.                 $('#modalMagazziniSecondari').modal('toggle');
  618.                 $('#loadingMaster').hide();
  619.             },
  620.             error: function(XMLHttpRequest, textStatus, errorThrown) {
  621.                 $('#loadingMaster').hide();
  622.                 alert("Status: " + textStatus); alert("Error: " + errorThrown);
  623.             }
  624.         });
  625.     }
  626.     function CountArticoliCarrello()
  627.     {
  628.         $.ajax({
  629.             type: "POST",
  630.             dataType: 'html',
  631.             url: Routing.generate('carrello_conta_articoli'),
  632.             async: true //you won't need that if nothing in your following code is dependend of the result
  633.         })
  634.         .done(function (response) {
  635.             let js = JSON.parse(response);
  636.             idCarrelloAttuale = js.idCarrello;
  637.             if(idCarrelloAttuale != ''){
  638.                 $('#modalDettaglioClienteSpostaCarrelloBtn').show();
  639.             }else{
  640.                 $('#modalDettaglioClienteSpostaCarrelloBtn').hide();
  641.             }
  642.             if (js.count == '0')
  643.                 $('#badgeArticoliCarello').html(" ");
  644.             else
  645.                 $('#badgeArticoliCarello').html(js.count);
  646.         })
  647.         DettaglioCarrelloJson();
  648.     }
  649.     function DettaglioCarrelloJson()
  650.     {
  651.         $.ajax({
  652.             type: "POST",
  653.             dataType: 'html',
  654.             url: Routing.generate('carrello_dettagli_json'),
  655.             async: true //you won't need that if nothing in your following code is dependend of the result
  656.         })
  657.             .done(function (response) {
  658.                 let js = JSON.parse(response);
  659.                 $("#badgeTotaleImponibileCarrello").html(" - € " + js.imponibile)
  660.             })
  661.     }
  662.     {% if is_granted('ROLE_ADMIN') or is_granted('ROLE_AGENTE') or is_granted('ROLE_COMMERCIALE') %}
  663.     function CambioTabRisorseCategorieSelect(altezza=350) {
  664.         let categoriaSelezionata = $('#tab-risorse-categorie-select').find('option:selected').val();
  665.         $.ajax({
  666.             type: "POST",
  667.             dataType: 'json',
  668.             data: {'tab': 'dati_da_categoria', 'categoria': (categoriaSelezionata)},
  669.             async: true,
  670.             url: Routing.generate('agente_dettaglio_carica_tab_anagrafica', {idAnagrafica: $("#id-anagrafica-da-utilizzare").val()}),
  671.             success: function (response) {
  672.                 var tableRisorseAnag = new Tabulator("#tabella-risorse", {
  673.                     height: (altezza + "px"),
  674.                     data:response.data,           //load row data from array
  675.                     layout:"fitDataFill",      //fit columns to width of table
  676.                     responsiveLayout:"collapse",  //hide columns that dont fit on the table
  677.                     columns: response.colonne,
  678.                 });
  679.                 tableRisorseAnag.on("rowClick", function(e, row){
  680.                     //e - the click event object
  681.                     //row - row component
  682.                     var valore = row.getCell('idRisorsa').getValue();
  683.                     var url = Routing.generate('agente_recupera_risorsa_anagrafica') + '?idRisorsa=' + valore;
  684.                     var win = window.open(url, '_blank');
  685.                     win.focus();
  686.                 });
  687.                 if('sorting' in response){
  688.                     let sort = [];
  689.                     for (const [key, value] of Object.entries(response.sorting)) {
  690.                         //value => {'field' => '', 'direction' => ''}
  691.                         sort.push({'column': value.field, 'dir': value.direction});
  692.                     }
  693.                     if(sort.length > 0){
  694.                         tableRisorseAnag.setSort(sort);
  695.                     }
  696.                 }
  697.             }
  698.         });
  699.     }
  700.     {% else %}
  701.     function CambioTabRisorseCategorieSelect() {
  702.         let categoriaSelezionata = $('#tab-risorse-categorie-select').find('option:selected').val();
  703.         $.ajax({
  704.             type: "POST",
  705.             dataType: 'json',
  706.             data: {'categoria': (categoriaSelezionata)},
  707.             async: true,
  708.             url: Routing.generate('storico_carica_risorse_anagrafiche'),
  709.             success: function (response) {
  710.                 var tableRisorseAnag = new Tabulator("#tabella-risorse", {
  711.                     height: "350px",
  712.                     data:response.data,           //load row data from array
  713.                     layout:"fitDataFill",      //fit columns to width of table
  714.                     responsiveLayout:"collapse",  //hide columns that dont fit on the table
  715.                     columns: response.colonne,
  716.                 });
  717.                 tableRisorseAnag.on("rowClick", function(e, row){
  718.                     //e - the click event object
  719.                     //row - row component
  720.                     var valore = row.getCell('idRisorsa').getValue();
  721.                     var url = Routing.generate('recupera_risorsa_anagrafica') + '?idRisorsa=' + valore;
  722.                     var win = window.open(url, '_blank');
  723.                     win.focus();
  724.                 });
  725.             }
  726.         });
  727.     }
  728.     {% endif %}
  729.     function ResetRicercaFiltroAvanzato(){
  730.         $("#cerca-filtro-btn").removeAttr("style")
  731.         filtroAvanzato = "";
  732.         document.getElementById('form-filtro-avanzato').reset();
  733.     }
  734.     function ResetRicerca(){
  735.         $("#ricercaVeloceTxt").val("");
  736.     }
  737.     {% if not (is_granted("ROLE_ADMIN") or is_granted("ROLE_COMMERCIALE") or is_granted("ROLE_AGENTE")) %}
  738.     function ApriDettaglioClienteLoggato(){
  739.         $('#loadingMaster').show();
  740.         $.ajax({
  741.             type: "POST",
  742.             dataType: 'html',
  743.             url: Routing.generate('utente_dettaglio_anagrafica'),
  744.             async: true,
  745.             success: function (response) {
  746.                 $('#loadingMaster').hide();
  747.                 $('#modalDettaglioClienteLoggato-body').html(response);
  748.                 $("#modalDettaglioClienteLoggato").modal('toggle');
  749.             },
  750.             error: function (xhr, ajaxOptions, thrownError) {
  751.                 $('#loadingMaster').hide();
  752.                 alert(xhr.status);
  753.                 alert(thrownError);
  754.             }
  755.         });
  756.     }
  757.     {% endif %}
  758.     {% if (is_granted("ROLE_ADMIN") or is_granted("ROLE_COMMERCIALE") or is_granted("ROLE_AGENTE")) %}
  759.     function ApriDettaglioClienteDialog(){
  760.         aggiornaVisualizzaAltriDatiUtente('V', '', function (response) {
  761.             let cookie = response;
  762.             $(".pulisci-selezione-cliente").hide();
  763.             if (cookie != "" && cookie && cookie.length > 0){
  764.                 let json = JSON.parse(cookie);
  765.                 $(".pulisci-selezione-cliente").show();
  766.                 $("#codiceClienteTxt").val(json.codice);
  767.                 $("#ragioneSocialeText").val(json.ragioneSociale);
  768.                 let tipoOrdine = json.hasOwnProperty("tipoOrdine") ? json.tipoOrdine : '';
  769.                 $("#tipo-ordine-input > option").each(function() {
  770.                     if($(this).val() ==tipoOrdine){
  771.                         $(this).attr("selected", "selected");
  772.                     } else {
  773.                         $(this).removeAttr("selected");
  774.                     }
  775.                 });
  776.                 $('#navbar-dettaglio-cliente').text(json.codice + ' - ' + json.ragioneSociale);
  777.                 $('#selezionaVariantiModalCliente').text('Cliente: ' + json.codice + ' - ' + json.ragioneSociale);
  778.                 memorizzazioneAltriDatiUtente = json;
  779.                 CaricaDettaglioCliente(json.id);
  780.             }
  781.         });
  782.         AggiornaStatoSelezioneCliente();
  783.         $("#modalDettaglioCliente").modal('show');
  784.     }
  785.     function SpostaCarrello(idAnagraficaDestinazione){
  786.         stadioSostituzione = 0;
  787.         $('#loadingMaster').show();
  788.         $.ajax({
  789.             type: "POST",
  790.             dataType: 'json',
  791.             url: Routing.generate('agente_sposta_carrello', {
  792.                 idCarrelloOrigine: (idCarrelloAttuale),
  793.                 idAnagraficaDestinazione: (idAnagraficaDestinazione)
  794.             }),
  795.             async: true,
  796.             success: function (response) {
  797.                 $('#loadingMaster').hide();
  798.                 let js = JSON.parse(response);
  799.                 if(js.successo == 'SI'){
  800.                     toastMessage(js.messaggio);
  801.                     CountArticoliCarrello();
  802.                 }else{
  803.                     toastMessage(js.messaggio, true);
  804.                 }
  805.             },
  806.             error: function(XMLHttpRequest, textStatus, errorThrown) {
  807.                 $('#loadingMaster').hide();
  808.                 alert("Status: " + textStatus); alert("Error: " + errorThrown);
  809.             }
  810.         });
  811.     }
  812.     function CaricaTabellaGeneraleClienti(rigaInizio) {
  813.         var str_ric = $("#ricercaClienteTxt").val();
  814.         var citta = $("#ricercaCittaTxt").val();
  815.         var provincia = $("#ricercaProvinciaTxt").val();
  816.         $.ajax({
  817.             type: "POST",
  818.             dataType: 'html',
  819.             data: {
  820.                 "data": {
  821.                     'ricerca': str_ric,
  822.                     'citta' : citta,
  823.                     'provincia' : provincia
  824.                 }
  825.             },
  826.             url: Routing.generate('agente_lista_clienti_ricerca', {
  827.                 rigaInzio: rigaInizio
  828.             }),
  829.             async: true,
  830.             success: function (response) {
  831.                 $('#bodyTabellaRicercaCliente').html(response);
  832.             },
  833.             error: function (xhr, ajaxOptions, thrownError) {
  834.                 alert(xhr.status);
  835.                 alert(thrownError);
  836.             }
  837.         });
  838.     }
  839.     function CaricaDettaglioCliente(id) {
  840.         $.ajax({
  841.             type: "POST",
  842.             dataType: 'html',
  843.             url: Routing.generate('agente_dettaglio_anagrafica', {
  844.                 id: (id), soloDati: 1
  845.             }),
  846.             async: true,
  847.             success: function (response) {
  848.                 $('.moda-dettaglio-cliente-body').html(response);
  849.                 $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
  850.                     let tabAperto = e.target; // newly activated tab
  851.                     let identificativo = tabAperto.hash.substring(1);
  852.                     let contenitore = $('#' + identificativo);
  853.                     if(identificativo != 'tab-home') {
  854.                         $(contenitore).html('');
  855.                         $.ajax({
  856.                             type: "POST",
  857.                             dataType: 'html',
  858.                             data: {'tab': (identificativo)},
  859.                             async: true,
  860.                             url: Routing.generate('agente_dettaglio_carica_tab_anagrafica', {idAnagrafica: id}),
  861.                             success: function (response) {
  862.                                 $(contenitore).html(response);
  863.                             },
  864.                             error: function (xhr, ajaxOptions, thrownError) {
  865.                                 alert(xhr.status);
  866.                                 alert(thrownError);
  867.                             }
  868.                         });
  869.                     }
  870.                 });
  871.             }
  872.         });
  873.     }
  874.     function VerificaStileBottoneNascondiPrezzi(){
  875.         if ($("#nascondiPrzBtnDettCliente").data("valore") == '0'){
  876.             $("#nascondiPrzBtnDettCliente").css("background-color", "#fff");
  877.         }else{
  878.             $("#nascondiPrzBtnDettCliente").css("background-color", "yellow");
  879.         }
  880.     }
  881.     
  882.     function VariaStatoBottoneNascondiPrezzi(){
  883.         if ($("#nascondiPrzBtnDettCliente").data("valore") == '0'){
  884.             $("#nascondiPrzBtnDettCliente").data("valore", '1')
  885.             VerificaStileBottoneNascondiPrezzi();
  886.         }else{
  887.             $("#nascondiPrzBtnDettCliente").data("valore", '0')
  888.             VerificaStileBottoneNascondiPrezzi();
  889.         }
  890.         let datiCliente = {
  891.             'codice' : memorizzazioneAltriDatiUtente.codice,
  892.             'ragioneSociale': memorizzazioneAltriDatiUtente.ragioneSociale,
  893.             'id' : memorizzazioneAltriDatiUtente.id,
  894.             'tipoOrdine' : $("#tipo-ordine-input").find(":selected").val(),
  895.             'nascondiPrezzi': $("#nascondiPrzBtnDettCliente").data('valore')
  896.         };
  897.         aggiornaVisualizzaAltriDatiUtente('M', JSON.stringify(datiCliente), function (response) {
  898.             memorizzazioneAltriDatiUtente = datiCliente;
  899.         });
  900.     }
  901.     function PulisciSelezioneCliente(dati){
  902.         aggiornaVisualizzaAltriDatiUtente('E', '', function (response) {
  903.             if(response.esito == 'OK') {
  904.                 AggiornaStatoSelezioneCliente();
  905.                 $("#codiceClienteTxt").val("");
  906.                 $("#ragioneSocialeText").val("");
  907.                 CountArticoliCarrello();
  908.                 memorizzazioneAltriDatiUtente = {}
  909.                 $('.moda-dettaglio-cliente-body').html("");
  910.             }else{
  911.                 alert('{{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_errore_pulisci_cliente", "dialog_ricerca_cliente").valoreUscita }}');
  912.             }
  913.         });
  914.     }
  915.     function AggiornaStatoSelezioneCliente() {
  916.         aggiornaVisualizzaAltriDatiUtente('V', '', function (response) {
  917.             let cck = response;
  918.             if (cck != "" && cck && cck.length > 0) {
  919.                 $(".pulisci-selezione-cliente").show();
  920.                 $(".top-bar-seleziona-cliente").css("background-color", "yellow");
  921.                 memorizzazioneAltriDatiUtente = JSON.parse(cck);
  922.             } else {
  923.                 $(".pulisci-selezione-cliente").hide();
  924.                 $(".top-bar-seleziona-cliente").css("background-color", "transparent");
  925.                 $('#navbar-dettaglio-cliente').text("");
  926.                 $('#selezionaVariantiModalCliente').text('');
  927.             }
  928.         });
  929.     }
  930.     {% endif %}
  931.     function aggiornaVisualizzaAltriDatiUtente(operazione, valore, callback = null){
  932.         $.ajax({
  933.             type: "POST",
  934.             dataType: 'json',
  935.             data: {'valore' : (valore)},
  936.             async: true,
  937.             url: Routing.generate({% if is_granted("ROLE_AGENTE") %}'agente_altro_dato'{% else %}'utente_altro_dato'{% endif %}, {
  938.                 operazione: (operazione)
  939.             }),
  940.             success: function (response){
  941.                 memorizzazioneAltriDatiUtente = valore;
  942.                 callback(response);
  943.             },
  944.             error: function (xhr, ajaxOptions, thrownError) {
  945.                 alert(xhr.status);
  946.                 alert(thrownError);
  947.             }
  948.         });
  949.     }
  950.     function adattaContenutoABarraSuperiore(){
  951.         $(".contenitore_generale_body").css("padding-top", $(".navbar-fixed-top").height() + "px")
  952.         $(".nav-side-menu").css("padding-top", $(".navbar-fixed-top").height() + "px")
  953.     }
  954.     $(document).ready(function () {
  955.         $(window).resize(function() {
  956.             adattaContenutoABarraSuperiore();
  957.         });
  958.         $(document).on("click", ".attiva-img-zoom", function (event){
  959.             event.stopImmediatePropagation();
  960.             event.stopPropagation();
  961.             $("#zoomImgImg").attr("src", $(this).attr("src"));
  962.             $("#modalZoomImg").modal('show');
  963.         });
  964.         $('#modalZoomImg').on("shown.bs.modal", function (){
  965.             imageZoom("zoomImgImg", "zoomImgResult");
  966.         });
  967.         $('.attiva-slick')
  968.             .on('init', function(slick) {
  969.                 $('.attiva-slick').fadeIn(3000);
  970.             })
  971.             .slick();
  972.         $('.attiva-tiny-slider').each(function (index, item) {
  973.             let arrConfig = $(item).data('configurazione');
  974.             tns(arrConfig);
  975.             $(item).css({ display: "block" });
  976.         });
  977.         $('.form-ordinazione-articolo').on("submit", function (e) {
  978.             let disponibilita = $(this).find('input[name="disponibilita"]').val();
  979.             let disponibilitaMagSecondari = $(this).find('input[name="disponibilita-mag-secondari"]').val();
  980.             if(disponibilita && disponibilita <= 0 ) {
  981.                 if(disponibilitaMagSecondari > 0) {
  982.                     e.preventDefault();
  983.                     ApriModalMagazziniSecondari($(this).find('input[name="id-mappa"]').val(), $(this).find('input[name="qta"]').val());
  984.                 }
  985.             }
  986.         });
  987.         $('[data-toggle="popover"]').popover();
  988.         $("#set_min_width").css("min-width", $(window).width() / 2);
  989.         $("#form_news").mouseleave(function () {
  990.             $("#set_min_width").css("display", "none");
  991.         });
  992.         $("#set_min_width").mouseenter(function () {
  993.             $("#set_min_width").css("display", "inline-block");
  994.         });
  995.         $("#set_min_width").mouseleave(function () {
  996.             $("#set_min_width").css("display", "none");
  997.         });
  998.         $('#cerca-btn-top').on('click', function () {
  999.             ResetRicercaFiltroAvanzato();
  1000.             RicercaVeloce($("#ricercaVeloceTxt").val());
  1001.         });
  1002.         $("#ricercaVeloceTxt").on("keypress", function(e) {
  1003.             if(e.which == 13) {
  1004.                 ResetRicercaFiltroAvanzato();
  1005.                 RicercaVeloce($("#ricercaVeloceTxt").val());
  1006.             }
  1007.         });
  1008.         var errori_validazione = [
  1009.             {% if errori_validazione is defined %}
  1010.             {% for err in errori_validazione %}
  1011.             "{{ err }}",
  1012.             {% endfor %}
  1013.             {% endif %}
  1014.         ];
  1015.         $.each(errori_validazione, function (item) {
  1016.             $("#form_" + errori_validazione[item]).addClass("dato-invalido");
  1017.         });
  1018.         CountArticoliCarrello();
  1019.         adattaContenutoABarraSuperiore();
  1020.         {% if (is_granted("ROLE_ADMIN") or is_granted("ROLE_COMMERCIALE") or is_granted("ROLE_AGENTE")) %}
  1021.         $("#ricercaClienteTxt, #ricercaCittaTxt, #ricercaProvinciaTxt").on("change paste keyup", function () {
  1022.             CaricaTabellaGeneraleClienti($("#inizioRiga").data('valore'));
  1023.         });
  1024.         $(".cercaCliente").on("focus, click", function () {
  1025.             stadioSostituzione = 0;
  1026.             $("#modalCercaCliente").modal('show');
  1027.         });
  1028.         $("#tipo-ordine-input").on("change", function (){
  1029.             aggiornaVisualizzaAltriDatiUtente('V', '', function (response) {
  1030.                 let cookie = response;
  1031.                 if (cookie != "" && cookie && cookie.length > 0){
  1032.                     let json = JSON.parse(cookie);
  1033.                     let datiCliente = {
  1034.                         'codice' : json.codice,
  1035.                         'ragioneSociale': json.ragioneSociale,
  1036.                         'id' : json.id,
  1037.                         'tipoOrdine' : $("#tipo-ordine-input").find(":selected").val(),
  1038.                         'nascondiPrezzi': $("#nascondiPrzBtnDettCliente").data('valore')
  1039.                     };
  1040.                     {% if (is_granted("ROLE_ADMIN") or is_granted("ROLE_COMMERCIALE") or is_granted("ROLE_AGENTE")) %}
  1041.                         VerificaStileBottoneNascondiPrezzi();
  1042.                     {% endif %}
  1043.                     aggiornaVisualizzaAltriDatiUtente('M', JSON.stringify(datiCliente), function (response) {
  1044.                         CountArticoliCarrello();
  1045.                         location.reload(); //Ricarico la pagina
  1046.                     });
  1047.                 }
  1048.             });
  1049.         });
  1050.         $("#bodyTabellaRicercaCliente").on("click", "tr", function () {
  1051.             $("#codiceClienteTxt").val($(this).data("codice"));
  1052.             $("#ragioneSocialeText").val($(this).data("ragione-sociale"));
  1053.             let datiCliente = {
  1054.                 'codice' : $(this).data("codice"),
  1055.                 'ragioneSociale': $(this).data("ragione-sociale"),
  1056.                 'id' : $(this).data("identificativo"),
  1057.                 'tipoOrdine' : $("#tipo-ordine-input").find(":selected").val(),
  1058.                 'nascondiPrezzi': $("#nascondiPrzBtnDettCliente").data('valore')
  1059.             };
  1060.             $('#navbar-dettaglio-cliente').text(datiCliente.codice + ' - ' + datiCliente.ragioneSociale);
  1061.             $('#selezionaVariantiModalCliente').text('Cliente: ' + datiCliente.codice + ' - ' + datiCliente.ragioneSociale);
  1062.             $("#modalCercaCliente").modal('toggle');
  1063.             aggiornaVisualizzaAltriDatiUtente('M', JSON.stringify(datiCliente), function (response) {
  1064.                 AggiornaStatoSelezioneCliente();
  1065.                 CountArticoliCarrello();
  1066.                 CaricaDettaglioCliente(datiCliente.id);
  1067.                 {% if (is_granted("ROLE_ADMIN") or is_granted("ROLE_COMMERCIALE") or is_granted("ROLE_AGENTE")) %}
  1068.                     VerificaStileBottoneNascondiPrezzi();
  1069.                 {% endif %}
  1070.             });
  1071.             if(stadioSostituzione == 1){
  1072.                 if(confirm('{{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_conferma_spostamento_carrello", "dialog_ricerca_cliente").valoreUscita }}')) {
  1073.                     SpostaCarrello($(this).data("identificativo"));
  1074.                 }
  1075.             }
  1076.         });
  1077.         $('#modalDettaglioClienteSpostaCarrelloBtn').on('click', function (event) {
  1078.            if(stadioSostituzione == 0){
  1079.                event.preventDefault();
  1080.                event.stopPropagation();
  1081.                stadioSostituzione = 1;
  1082.                $("#modalCercaCliente").modal('show');
  1083.            }
  1084.         });
  1085.         $('#modalCreaOfferteDaCarrello_creaBtn').on("click", function (event) {
  1086.             if(confirm("{{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_conferma_generazione_offerta", "dialog_ricerca_cliente").valoreUscita }}")){
  1087.                 $("#creaOffertaDaCarrelloForm").submit();
  1088.             }
  1089.         });
  1090.         aggiornaVisualizzaAltriDatiUtente('V', '', function (response) {
  1091.             let cookie = response;
  1092.             $(".pulisci-selezione-cliente").hide();
  1093.             if (cookie != "" && cookie && cookie.length > 0){
  1094.                 let json = JSON.parse(cookie);
  1095.                 $(".pulisci-selezione-cliente").show();
  1096.                 $("#codiceClienteTxt").val(json.codice);
  1097.                 $("#ragioneSocialeText").val(json.ragioneSociale);
  1098.                 $("#nascondiPrzBtnDettCliente").data('valore', json.nascondiPrezzi)
  1099.                 let tipoOrdine = json.hasOwnProperty("tipoOrdine") ? json.tipoOrdine : '';
  1100.                 $("#tipo-ordine-input > option").each(function() {
  1101.                     if($(this).val() ==tipoOrdine){
  1102.                         $(this).attr("selected", "selected");
  1103.                     }else{
  1104.                         $(this).removeAttr("selected");
  1105.                     }
  1106.                 });
  1107.                 $('#navbar-dettaglio-cliente').text(json.codice + ' - ' + json.ragioneSociale);
  1108.                 $('#selezionaVariantiModalCliente').text('Cliente: ' + json.codice + ' - ' + json.ragioneSociale);
  1109.                 memorizzazioneAltriDatiUtente = json;
  1110.                 {% if (is_granted("ROLE_ADMIN") or is_granted("ROLE_COMMERCIALE") or is_granted("ROLE_AGENTE")) %}
  1111.                     VerificaStileBottoneNascondiPrezzi();
  1112.                 {% endif %}
  1113.                 CaricaQuadratiAlbero("");
  1114.             }
  1115.         });
  1116.         AggiornaStatoSelezioneCliente();
  1117.         {% if (is_granted("ROLE_ADMIN") or is_granted("ROLE_COMMERCIALE") or is_granted("ROLE_AGENTE")) %}
  1118.             VerificaStileBottoneNascondiPrezzi();
  1119.         {% endif %}
  1120.         CaricaTabellaGeneraleClienti(0);
  1121.         {# Verifico se l'utente ha effettuato il LOGIN #}
  1122.         {% elseif is_granted("IS_AUTHENTICATED_REMEMBERED") %}
  1123.         aggiornaVisualizzaAltriDatiUtente('V', '', function (response) {
  1124.             let cookie = response;
  1125.             $(".pulisci-selezione-cliente").hide();
  1126.             if (cookie != "" && cookie && cookie.length > 0){
  1127.                 let json = JSON.parse(cookie);
  1128.                 $(".pulisci-selezione-cliente").show();
  1129.                 $("#codiceClienteTxt").val(json.codice);
  1130.                 $("#ragioneSocialeText").val(json.ragioneSociale);
  1131.                 let tipoOrdine = json.hasOwnProperty("tipoOrdine") ? json.tipoOrdine : '';
  1132.                 $("#tipo-ordine-input > option").each(function() {
  1133.                     if($(this).val() ==tipoOrdine){
  1134.                         $(this).attr("selected", "selected");
  1135.                     }else{
  1136.                         $(this).removeAttr("selected");
  1137.                     }
  1138.                 });
  1139.                 {% if (is_granted("ROLE_ADMIN") or is_granted("ROLE_COMMERCIALE") or is_granted("ROLE_AGENTE")) %}
  1140.                     $('#navbar-dettaglio-cliente').text(json.codice + ' - ' + json.ragioneSociale);
  1141.                 {% endif %}
  1142.                 $('#selezionaVariantiModalCliente').text('Cliente: ' + json.codice + ' - ' + json.ragioneSociale);
  1143.                 $("#nascondiPrzBtnDettCliente").data('valore', json.nascondiPrezzi)
  1144.                 memorizzazioneAltriDatiUtente = json;
  1145.                 {% if (is_granted("ROLE_ADMIN") or is_granted("ROLE_COMMERCIALE") or is_granted("ROLE_AGENTE")) %}
  1146.                     VerificaStileBottoneNascondiPrezzi();
  1147.                 {% endif %}
  1148.                 CaricaQuadratiAlbero("");
  1149.             }
  1150.         });
  1151.         $("#tipo-ordine-input").on("change", function (){
  1152.             aggiornaVisualizzaAltriDatiUtente('V', '', function (response) {
  1153.                     let datiCliente = {
  1154.                         'codice' : '',
  1155.                         'ragioneSociale': '',
  1156.                         'id' : '',
  1157.                         'tipoOrdine' : $("#tipo-ordine-input").find(":selected").val(),
  1158.                         'nascondiPrezzi': $("#nascondiPrzBtnDettCliente").data('valore')
  1159.                     };
  1160.                 {% if (is_granted("ROLE_ADMIN") or is_granted("ROLE_COMMERCIALE") or is_granted("ROLE_AGENTE")) %}
  1161.                     VerificaStileBottoneNascondiPrezzi();
  1162.                 {% endif %}
  1163.                     aggiornaVisualizzaAltriDatiUtente('M', JSON.stringify(datiCliente), function (response) {
  1164.                         CountArticoliCarrello();
  1165.                         location.reload(); //Ricarico la pagina
  1166.                     });
  1167.             });
  1168.         });
  1169.         {% endif %}
  1170.         {% for flash_message in app.session.flashbag.get('notice')%}
  1171.             toastMessage("{{ flash_message }}");
  1172.         {% endfor %}
  1173.         {% for flash_message in app.session.flashbag.get('error')%}
  1174.             toastMessage("{{ flash_message }}", true);
  1175.         {% endfor %}
  1176.     });
  1177. </script>
  1178. {% block javascript %}{% endblock %}
  1179. <div class="pushContent"></div>
  1180. </body>
  1181. {% if app.request.get("_route") != 'admin_pagine_e_componenti_editor' %}
  1182.     {% if impostazioni.ritornaImpostazioneDaNome('MostraFooterSviluppatoDa') == '1' %}
  1183.         <footer class="navbar navbar-default navbar-fixed-bottom">
  1184.             <div style="margin-top: 15px;" class="container">
  1185.                 <span style="vertical-align: middle;"><a href="http://www.fogazzimirko.it">Sviluppato da Fogazzi Mirko © {{ "now"|date("Y") }}{% block footer %}{% endblock %}</a></span>
  1186.             </div>
  1187.         </footer>
  1188.     {% endif %}
  1189. {% endif %}
  1190. </html>