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.                     <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>
  284.                     <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>
  285.                     {% set attivaTipoOrdine = impostazioni.ritornaImpostazioneDaNome("AbilitaTipoOrdine") %}
  286.                     <div class="form-inline" style="float:right; margin-right:20px;{% if attivaTipoOrdine != '1' %}display:none;{% endif %}">
  287.                         <div class="form-group">
  288.                             <label for="tipo-ordine-input">{{ traduzione.OttieniElementoDizionario("agenti_dialog_principale_tipo_ordine", "agenti_dialog_principale").valoreUscita }}</label>
  289.                             <select id="tipo-ordine-input" class="form-control" style="width:auto;">
  290.                                 {% if attivaTipoOrdine == '1' %}
  291.                                     {% for tipoOrdine in servizi.RitornaTipiOrdine() %}
  292.                                         <option {% if loop.first %} selected="selected"{% endif %} value="{{ tipoOrdine.id|default("") }}">{{ tipoOrdine.testoVisualizzato|default("") }}</option>
  293.                                     {% endfor %}
  294.                                 {% endif %}
  295.                                 {% if servizi.RitornaTipiOrdine()|length <= 0 or attivaTipoOrdine == '0' %}
  296.                                     <option value=""></option>
  297.                                 {% endif %}
  298.                             </select>
  299.                         </div>
  300.                     </div>
  301.                 </h4>
  302.             </div>
  303.             <div class="modal-body" style="overflow-y: auto;">
  304.                 <div class="col-md-12 nascondiStampa">
  305.                     <div class="form-inline center">
  306.                         <div class="input-group" style="width: 100%;">
  307.                             <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>
  308.                             <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 }}">
  309.                             <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 }}">
  310.                             <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>
  311.                             <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>
  312.                         </div>
  313.                     </div>
  314.                     <hr>
  315.                     <div class="moda-dettaglio-cliente-body">
  316.                     </div>
  317.                 </div>
  318.             </div>
  319.             <div class="modal-footer">
  320.                 <button type="button" class="btn btn-danger" data-dismiss="modal">{{ traduzione.OttieniElementoDizionario("agenti_dialog_principale_chiudi_btn", "agenti_dialog_principale").valoreUscita }}</button>
  321.             </div>
  322.         </div><!-- /.modal-content -->
  323.     </div><!-- /.modal-dialog -->
  324. </div><!-- /.modal -->
  325. <div class="modal fade" tabindex="-1" role="dialog" id="modalCreaOffertaDaCarrello">
  326.     <div class="modal-dialog panel-warning" role="document">
  327.         <div class="modal-content panel-warning">
  328.             <div class="modal-header">
  329.                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  330.                 <h4 class="modal-title">
  331.                     {{ traduzione.OttieniElementoDizionario("agenti_dialog_principale_crea_offerta_da_carrello_btn", "agenti_dialog_principale").valoreUscita }}
  332.                 </h4>
  333.             </div>
  334.             <div class="modal-body" id="modalCreaOffertaDaCarrelloBody" style="overflow-y: auto;">
  335.                 <form id="creaOffertaDaCarrelloForm" action="{{ path('offerte_crea_da_carrello') }}">
  336.                     <div class="form-group">
  337.                         <label for="modal-crea-offerta-carrello-note">{{ traduzione.OttieniElementoDizionario("agenti_crea_offerta_da_carrello_dialog_note", "agenti_crea_offerta_da_carrello_dialog").valoreUscita }}</label>
  338.                         <textarea class="form-control" id="modal-crea-offerta-carrello-note" name="modal-crea-offerta-carrello-note"></textarea>
  339.                     </div>
  340.                     <div class="form-group">
  341.                         <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>
  342.                         <textarea class="form-control" id="modal-crea-offerta-carrello-note" name="modal-crea-offerta-carrello-note-aziendali"></textarea>
  343.                     </div>
  344.                     <div class="form-group">
  345.                         <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>
  346.                         <input type="text" class="form-control" id="modal-crea-offerta-carrello-riferimento-offerta" name="modal-crea-offerta-carrello-riferimento-offerta">
  347.                     </div>
  348.                     <div class="checkbox">
  349.                         <label>
  350.                             <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 }}
  351.                         </label>
  352.                     </div>
  353.                 </form>
  354.             </div>
  355.             <div class="modal-footer">
  356.                 <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>
  357.             </div>
  358.         </div><!-- /.modal-content -->
  359.     </div><!-- /.modal-dialog -->
  360. </div><!-- /.modal -->
  361. {% endif %}
  362. <div class="modal fade" tabindex="-1" role="dialog" id="modalRichiestaPrezzo">
  363.     <div class="modal-dialog panel-warning" role="document"  style="width: 80%;">
  364.         <div class="modal-content panel-warning">
  365.             <div class="modal-header">
  366.                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  367.                 <h4 class="modal-title">
  368.                     {{ traduzione.CaricaTraduzioniDaFamiglia("richiesta_prezzo", app.request.locale, false) }}
  369.                     {{ traduzione.OttieniElementoDizionario("richiesta_prezzo_title", "richiesta_prezzo").valoreUscita }}
  370.                 </h4>
  371.             </div>
  372.             <div class="modal-body" id="modalRichiestaPrezzoBody" style="overflow-y: auto;">
  373.             </div>
  374.         </div><!-- /.modal-content -->
  375.     </div><!-- /.modal-dialog -->
  376. </div><!-- /.modal -->
  377. <div class="modal fade" tabindex="-1" role="dialog" id="modalMagazziniSecondari">
  378.     <div class="modal-dialog panel-warning" role="document"  style="width: 80%;">
  379.         <div class="modal-content panel-warning">
  380.             <div class="modal-header">
  381.                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  382.                 <h4 class="modal-title">
  383.                     {{ traduzione.CaricaTraduzioniDaFamiglia("modal_magazzini_secondari", app.request.locale, false) }}
  384.                     {{ traduzione.OttieniElementoDizionario("modal_magazzini_secondari_title_main_modal", "modal_magazzini_secondari").valoreUscita }}
  385.                 </h4>
  386.             </div>
  387.             <div class="modal-body" id="modalMagazziniSecondariBody" style="overflow-y: auto;">
  388.             </div>
  389.         </div><!-- /.modal-content -->
  390.     </div><!-- /.modal-dialog -->
  391. </div><!-- /.modal -->
  392. {% if is_granted('ROLE_ADMIN') or is_granted('ROLE_AGENTE') or is_granted('ROLE_COMMERCIALE') %}
  393. <div class="modal fade" tabindex="-1" role="dialog" id="modalCercaCliente">
  394.     <div class="modal-dialog panel-warning" role="document"  style="width: 80%;">
  395.         <div class="modal-content panel-warning">
  396.             <div class="modal-header">
  397.                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  398.                 <h4 class="modal-title" id="modalTitle">{{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_title", "dialog_ricerca_cliente").valoreUscita }}</h4>
  399.             </div>
  400.             <div class="modal-body" style="overflow-y: auto;">
  401.                 <div class="col-md-12">
  402.                     <div class="col-md-4">
  403.                         <div class="form-inline center has-success">
  404.                             <div class="input-group" style="width: 100%;">
  405.                                 <span class="input-group-addon" id="basic-addon1"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></span>
  406.                                 <input type="text" class="form-control" id="ricercaClienteTxt" placeholder="{{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_inizia_a_scrivere", "dialog_ricerca_cliente").valoreUscita }}">
  407.                             </div>
  408.                         </div>
  409.                     </div>
  410.                     <div class="col-md-4">
  411.                         <div class="form-inline center has-success">
  412.                             <div class="input-group" style="width: 100%;">
  413.                                 <span class="input-group-addon" id="basic-addon1"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></span>
  414.                                 <input type="text" class="form-control" id="ricercaCittaTxt" placeholder="{{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_filtro_citta", "dialog_ricerca_cliente").valoreUscita }}">
  415.                             </div>
  416.                         </div>
  417.                     </div>
  418.                     <div class="col-md-4">
  419.                         <div class="form-inline center has-success">
  420.                             <div class="input-group" style="width: 100%;">
  421.                                 <span class="input-group-addon" id="basic-addon1"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></span>
  422.                                 <input type="text" class="form-control" id="ricercaProvinciaTxt" placeholder="{{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_filtro_provincia", "dialog_ricerca_cliente").valoreUscita }}">
  423.                             </div>
  424.                         </div>
  425.                     </div>
  426.                 </div>
  427.                 <table class="table table-striped table-responsive">
  428.                     <thead>
  429.                     <tr>
  430.                         <th>
  431.                             {{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_tab_col1_a", "dialog_ricerca_cliente").valoreUscita }}
  432.                             <br>
  433.                             {{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_tab_col1_b", "dialog_ricerca_cliente").valoreUscita }}
  434.                             <br>
  435.                             {{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_tab_col1_c", "dialog_ricerca_cliente").valoreUscita }}
  436.                         </th>
  437.                         <th>
  438.                             {{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_tab_col2_a", "dialog_ricerca_cliente").valoreUscita }}
  439.                             <br>
  440.                             {{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_tab_col2_b", "dialog_ricerca_cliente").valoreUscita }}
  441.                             <br>
  442.                             {{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_tab_col2_c", "dialog_ricerca_cliente").valoreUscita }}
  443.                         </th><th>
  444.                             {{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_tab_col3_a", "dialog_ricerca_cliente").valoreUscita }}
  445.                             <br>
  446.                             {{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_tab_col3_b", "dialog_ricerca_cliente").valoreUscita }}
  447.                             <br>
  448.                             {{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_tab_col3_c", "dialog_ricerca_cliente").valoreUscita }}
  449.                         </th>
  450.                     </tr>
  451.                     </thead>
  452.                     <tbody id="bodyTabellaRicercaCliente">
  453.                     </tbody>
  454.                 </table>
  455.             </div>
  456.             <div class="modal-footer">
  457.                 <button type="button" id="chiudiModalCercaCliente" class="btn btn-danger" data-dismiss="modal">{{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_chiudi_btn", "dialog_ricerca_cliente").valoreUscita }}</button>
  458.             </div>
  459.         </div><!-- /.modal-content -->
  460.     </div><!-- /.modal-dialog -->
  461. </div><!-- /.modal -->
  462. {% endif %}
  463. <div class="container-fluid contenitore_generale_body" >
  464.     <div class="row master-row-body">
  465.         <div class="col-md-12 master-col-body">
  466.             {% block body %}{% endblock %}
  467.         </div>
  468.     </div>
  469. </div><!-- /.container -->
  470. <script src="https://www.google.com/recaptcha/api.js?render={{ impostazioni.ritornaImpostazioneDaNome('ReCaptchaSiteKey') }}"></script>
  471. <script>
  472.     grecaptcha.ready(function() {
  473.         grecaptcha.execute('{{ impostazioni.ritornaImpostazioneDaNome('ReCaptchaSiteKey') }}', {action: 'homepage'}).then(function(token) {
  474.             $('.re-captcha-v3').val = token;
  475.         });
  476.     });
  477. </script>
  478. <!-- FOSJsRoutingBundle -->
  479. <script src="{{ asset('bundles/fosjsrouting/js/router.js') }}"></script>
  480. <script src="{{ path('fos_js_routing_js', { callback: 'fos.Router.setData' }) }}"></script>
  481. <!-- jQuery smartmenus plugin -->
  482. <script src="{{ asset('java_lib/jquery.smartmenus.min.js') }}"></script>
  483. <script src="{{ asset('java_lib/jquery.smartmenus.bootstrap.min.js') }}"></script>
  484. <script src="{{ asset('java_lib/jquery.stickytableheaders.min.js') }}" type="text/javascript"></script>
  485. <!-- SLICK CAROUSEL -->
  486. <script type="text/javascript" src="{{ asset('java_lib/slick-1.8.1/slick/slick.min.js') }}"></script>
  487. <!-- TINY SLIDER -->
  488. <script src="https://cdnjs.cloudflare.com/ajax/libs/tiny-slider/2.9.2/min/tiny-slider.js"></script>
  489. <!-- CORE NAV -->
  490. <script type="text/javascript" src="{{ asset('java_lib/custom_mf_sidebar/mf_sidebar.js') }}"></script>
  491. {#  <script type="text/javascript" src="https://unpkg.com/tabulator-tables@4.2.7/dist/js/tabulator.min.js"></script>#}
  492. <script type="text/javascript" src="https://unpkg.com/tabulator-tables@5.2.3/dist/js/tabulator.min.js"></script>
  493. <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.bundle.min.js" integrity="sha256-xKeoJ50pzbUGkpQxDYHD7o7hxe0LaOGeguUidbq6vis=" crossorigin="anonymous"></script>
  494. <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.min.js" integrity="sha256-Uv9BNBucvCPipKQ2NS9wYpJmi8DTOEfTA/nH2aoJALw=" crossorigin="anonymous"></script>
  495. <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>
  496. <script type="text/javascript">
  497.     {# Variabili utile per la sostituzione del carrello #}
  498.     let idCarrelloAttuale = '';
  499.     let stadioSostituzione = 0; {# Quando lo stadio è 1 allora ho già in memoria i due salti #}
  500.     {# FINE #}
  501.     var memorizzazioneAltriDatiUtente = {}
  502.     var lens = null;
  503.     var img = null;
  504.     {# Codice per zoom immagine #}
  505.     function imageZoom(imgID, resultID) {
  506.         if (lens != null){
  507.             lens.removeEventListener("mousemove", moveLens);
  508.             img.removeEventListener("mousemove", moveLens);
  509.             lens.removeEventListener("touchmove", moveLens);
  510.             img.removeEventListener("touchmove", moveLens);
  511.             lens.remove();
  512.             lens = null;
  513.         }
  514.         var result, cx, cy;
  515.         img = document.getElementById(imgID);
  516.         result = document.getElementById(resultID);
  517.         /* Create lens: */
  518.         lens = document.createElement("DIV");
  519.         lens.setAttribute("class", "img-zoom-lens");
  520.         /* Insert lens: */
  521.         img.parentElement.insertBefore(lens, img);
  522.         /* Calculate the ratio between result DIV and lens: */
  523.         cx = result.offsetWidth / lens.offsetWidth;
  524.         cy = result.offsetHeight / lens.offsetHeight;
  525.         /* Set background properties for the result DIV */
  526.         result.style.backgroundImage = "url('" + img.src + "')";
  527.         result.style.backgroundSize = (img.width * cx) + "px " + (img.height * cy) + "px";
  528.         /* Execute a function when someone moves the cursor over the image, or the lens: */
  529.         lens.addEventListener("mousemove", moveLens);
  530.         img.addEventListener("mousemove", moveLens);
  531.         /* And also for touch screens: */
  532.         lens.addEventListener("touchmove", moveLens);
  533.         img.addEventListener("touchmove", moveLens);
  534.         function moveLens(e) {
  535.             var pos, x, y;
  536.             /* Prevent any other actions that may occur when moving over the image */
  537.             e.preventDefault();
  538.             /* Get the cursor's x and y positions: */
  539.             pos = getCursorPos(e);
  540.             /* Calculate the position of the lens: */
  541.             x = pos.x - (lens.offsetWidth / 2);
  542.             y = pos.y - (lens.offsetHeight / 2);
  543.             /* Prevent the lens from being positioned outside the image: */
  544.             if (x > img.width - lens.offsetWidth) {x = img.width - lens.offsetWidth;}
  545.             if (x < 0) {x = 0;}
  546.             if (y > img.height - lens.offsetHeight) {y = img.height - lens.offsetHeight;}
  547.             if (y < 0) {y = 0;}
  548.             /* Set the position of the lens: */
  549.             lens.style.left = x + "px";
  550.             lens.style.top = y + "px";
  551.             /* Display what the lens "sees": */
  552.             result.style.backgroundPosition = "-" + (x * cx) + "px -" + (y * cy) + "px";
  553.         }
  554.         function getCursorPos(e) {
  555.             var a, x = 0, y = 0;
  556.             e = e || window.event;
  557.             /* Get the x and y positions of the image: */
  558.             a = img.getBoundingClientRect();
  559.             /* Calculate the cursor's x and y coordinates, relative to the image: */
  560.             x = e.pageX - a.left;
  561.             y = e.pageY - a.top;
  562.             /* Consider any page scrolling: */
  563.             x = x - window.pageXOffset;
  564.             y = y - window.pageYOffset;
  565.             return {x : x, y : y};
  566.         }
  567.     }
  568.     var randomRgbColor = function() {
  569.         var r = Math.floor(Math.random() * 255);
  570.         var g = Math.floor(Math.random() * 255);
  571.         var b = Math.floor(Math.random() * 255);
  572.         return "rgb(" + r + "," + g + "," + b + ")";
  573.     }
  574.     function toastMessage(messaggio, rosso = false) {
  575.         // Get the snackbar DIV
  576.         var x = document.getElementById("snackbar");
  577.         $(x).text(messaggio);
  578.         if (rosso){
  579.             $(x).css('background-color', 'red');
  580.             $(x).css('color', 'black');
  581.         }else{
  582.             $(x).css('background-color', 'black');
  583.             $(x).css('color', 'white');
  584.         }
  585.         // Add the "show" class to DIV
  586.         x.className = "show";
  587.         // After 3 seconds, remove the show class from DIV
  588.         setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000);
  589.     }
  590.     function ApriModalRichiestaPrezzo(idMappa){
  591.         $('#loadingMaster').show();
  592.         $.ajax({
  593.             dataType: 'html',
  594.             url: Routing.generate('richiesta_prezzo_modal', {'idMappa' : (idMappa) }),
  595.             async: true, //you won't need that if nothing in your following code is dependend of the result
  596.             success: function (response) {
  597.                 $('#modalRichiestaPrezzoBody').html(response);
  598.                 $('#modalRichiestaPrezzo').modal('toggle');
  599.                 $('#loadingMaster').hide();
  600.             },
  601.             error: function(XMLHttpRequest, textStatus, errorThrown) {
  602.                 $('#loadingMaster').hide();
  603.                 alert("Status: " + textStatus); alert("Error: " + errorThrown);
  604.             }
  605.         });
  606.     }
  607.     function ApriModalMagazziniSecondari(idMappa, qta){
  608.         $('#loadingMaster').show();
  609.         $.ajax({
  610.             dataType: 'html',
  611.             url: Routing.generate('magazzini_secondari_modal', {'idMappa' : (idMappa), 'qta' : (qta) }),
  612.             async: true, //you won't need that if nothing in your following code is dependend of the result
  613.             success: function (response) {
  614.                 $('#modalMagazziniSecondariBody').html(response);
  615.                 $('#modalMagazziniSecondari').modal('toggle');
  616.                 $('#loadingMaster').hide();
  617.             },
  618.             error: function(XMLHttpRequest, textStatus, errorThrown) {
  619.                 $('#loadingMaster').hide();
  620.                 alert("Status: " + textStatus); alert("Error: " + errorThrown);
  621.             }
  622.         });
  623.     }
  624.     function CountArticoliCarrello()
  625.     {
  626.         $.ajax({
  627.             type: "POST",
  628.             dataType: 'html',
  629.             url: Routing.generate('carrello_conta_articoli'),
  630.             async: true //you won't need that if nothing in your following code is dependend of the result
  631.         })
  632.         .done(function (response) {
  633.             let js = JSON.parse(response);
  634.             idCarrelloAttuale = js.idCarrello;
  635.             if(idCarrelloAttuale != ''){
  636.                 $('#modalDettaglioClienteSpostaCarrelloBtn').show();
  637.             }else{
  638.                 $('#modalDettaglioClienteSpostaCarrelloBtn').hide();
  639.             }
  640.             if (js.count == '0')
  641.                 $('#badgeArticoliCarello').html(" ");
  642.             else
  643.                 $('#badgeArticoliCarello').html(js.count);
  644.         })
  645.         DettaglioCarrelloJson();
  646.     }
  647.     function DettaglioCarrelloJson()
  648.     {
  649.         $.ajax({
  650.             type: "POST",
  651.             dataType: 'html',
  652.             url: Routing.generate('carrello_dettagli_json'),
  653.             async: true //you won't need that if nothing in your following code is dependend of the result
  654.         })
  655.             .done(function (response) {
  656.                 let js = JSON.parse(response);
  657.                 $("#badgeTotaleImponibileCarrello").html(" - € " + js.imponibile)
  658.             })
  659.     }
  660.     {% if is_granted('ROLE_ADMIN') or is_granted('ROLE_AGENTE') or is_granted('ROLE_COMMERCIALE') %}
  661.     function CambioTabRisorseCategorieSelect(altezza=350) {
  662.         let categoriaSelezionata = $('#tab-risorse-categorie-select').find('option:selected').val();
  663.         $.ajax({
  664.             type: "POST",
  665.             dataType: 'json',
  666.             data: {'tab': 'dati_da_categoria', 'categoria': (categoriaSelezionata)},
  667.             async: true,
  668.             url: Routing.generate('agente_dettaglio_carica_tab_anagrafica', {idAnagrafica: $("#id-anagrafica-da-utilizzare").val()}),
  669.             success: function (response) {
  670.                 var tableRisorseAnag = new Tabulator("#tabella-risorse", {
  671.                     height: (altezza + "px"),
  672.                     data:response.data,           //load row data from array
  673.                     layout:"fitDataFill",      //fit columns to width of table
  674.                     responsiveLayout:"collapse",  //hide columns that dont fit on the table
  675.                     columns: response.colonne,
  676.                 });
  677.                 tableRisorseAnag.on("rowClick", function(e, row){
  678.                     //e - the click event object
  679.                     //row - row component
  680.                     var valore = row.getCell('idRisorsa').getValue();
  681.                     var url = Routing.generate('agente_recupera_risorsa_anagrafica') + '?idRisorsa=' + valore;
  682.                     var win = window.open(url, '_blank');
  683.                     win.focus();
  684.                 });
  685.                 if('sorting' in response){
  686.                     let sort = [];
  687.                     for (const [key, value] of Object.entries(response.sorting)) {
  688.                         //value => {'field' => '', 'direction' => ''}
  689.                         sort.push({'column': value.field, 'dir': value.direction});
  690.                     }
  691.                     if(sort.length > 0){
  692.                         tableRisorseAnag.setSort(sort);
  693.                     }
  694.                 }
  695.             }
  696.         });
  697.     }
  698.     {% else %}
  699.     function CambioTabRisorseCategorieSelect() {
  700.         let categoriaSelezionata = $('#tab-risorse-categorie-select').find('option:selected').val();
  701.         $.ajax({
  702.             type: "POST",
  703.             dataType: 'json',
  704.             data: {'categoria': (categoriaSelezionata)},
  705.             async: true,
  706.             url: Routing.generate('storico_carica_risorse_anagrafiche'),
  707.             success: function (response) {
  708.                 var tableRisorseAnag = new Tabulator("#tabella-risorse", {
  709.                     height: "350px",
  710.                     data:response.data,           //load row data from array
  711.                     layout:"fitDataFill",      //fit columns to width of table
  712.                     responsiveLayout:"collapse",  //hide columns that dont fit on the table
  713.                     columns: response.colonne,
  714.                 });
  715.                 tableRisorseAnag.on("rowClick", function(e, row){
  716.                     //e - the click event object
  717.                     //row - row component
  718.                     var valore = row.getCell('idRisorsa').getValue();
  719.                     var url = Routing.generate('recupera_risorsa_anagrafica') + '?idRisorsa=' + valore;
  720.                     var win = window.open(url, '_blank');
  721.                     win.focus();
  722.                 });
  723.             }
  724.         });
  725.     }
  726.     {% endif %}
  727.     function ResetRicercaFiltroAvanzato(){
  728.         $("#cerca-filtro-btn").removeAttr("style")
  729.         filtroAvanzato = "";
  730.         document.getElementById('form-filtro-avanzato').reset();
  731.     }
  732.     function ResetRicerca(){
  733.         $("#ricercaVeloceTxt").val("");
  734.     }
  735.     {% if not (is_granted("ROLE_ADMIN") or is_granted("ROLE_COMMERCIALE") or is_granted("ROLE_AGENTE")) %}
  736.     function ApriDettaglioClienteLoggato(){
  737.         $('#loadingMaster').show();
  738.         $.ajax({
  739.             type: "POST",
  740.             dataType: 'html',
  741.             url: Routing.generate('utente_dettaglio_anagrafica'),
  742.             async: true,
  743.             success: function (response) {
  744.                 $('#loadingMaster').hide();
  745.                 $('#modalDettaglioClienteLoggato-body').html(response);
  746.                 $("#modalDettaglioClienteLoggato").modal('toggle');
  747.             },
  748.             error: function (xhr, ajaxOptions, thrownError) {
  749.                 $('#loadingMaster').hide();
  750.                 alert(xhr.status);
  751.                 alert(thrownError);
  752.             }
  753.         });
  754.     }
  755.     {% endif %}
  756.     {% if (is_granted("ROLE_ADMIN") or is_granted("ROLE_COMMERCIALE") or is_granted("ROLE_AGENTE")) %}
  757.     function ApriDettaglioClienteDialog(){
  758.         aggiornaVisualizzaAltriDatiUtente('V', '', function (response) {
  759.             let cookie = response;
  760.             $(".pulisci-selezione-cliente").hide();
  761.             if (cookie != "" && cookie && cookie.length > 0){
  762.                 let json = JSON.parse(cookie);
  763.                 $(".pulisci-selezione-cliente").show();
  764.                 $("#codiceClienteTxt").val(json.codice);
  765.                 $("#ragioneSocialeText").val(json.ragioneSociale);
  766.                 let tipoOrdine = json.hasOwnProperty("tipoOrdine") ? json.tipoOrdine : '';
  767.                 $("#tipo-ordine-input > option").each(function() {
  768.                     if($(this).val() ==tipoOrdine){
  769.                         $(this).attr("selected", "selected");
  770.                     } else {
  771.                         $(this).removeAttr("selected");
  772.                     }
  773.                 });
  774.                 $('#navbar-dettaglio-cliente').text(json.codice + ' - ' + json.ragioneSociale);
  775.                 $('#selezionaVariantiModalCliente').text('Cliente: ' + json.codice + ' - ' + json.ragioneSociale);
  776.                 memorizzazioneAltriDatiUtente = json;
  777.                 CaricaDettaglioCliente(json.id);
  778.             }
  779.         });
  780.         AggiornaStatoSelezioneCliente();
  781.         $("#modalDettaglioCliente").modal('show');
  782.     }
  783.     function SpostaCarrello(idAnagraficaDestinazione){
  784.         stadioSostituzione = 0;
  785.         $('#loadingMaster').show();
  786.         $.ajax({
  787.             type: "POST",
  788.             dataType: 'json',
  789.             url: Routing.generate('agente_sposta_carrello', {
  790.                 idCarrelloOrigine: (idCarrelloAttuale),
  791.                 idAnagraficaDestinazione: (idAnagraficaDestinazione)
  792.             }),
  793.             async: true,
  794.             success: function (response) {
  795.                 $('#loadingMaster').hide();
  796.                 let js = JSON.parse(response);
  797.                 if(js.successo == 'SI'){
  798.                     toastMessage(js.messaggio);
  799.                     CountArticoliCarrello();
  800.                 }else{
  801.                     toastMessage(js.messaggio, true);
  802.                 }
  803.             },
  804.             error: function(XMLHttpRequest, textStatus, errorThrown) {
  805.                 $('#loadingMaster').hide();
  806.                 alert("Status: " + textStatus); alert("Error: " + errorThrown);
  807.             }
  808.         });
  809.     }
  810.     function CaricaTabellaGeneraleClienti(rigaInizio) {
  811.         var str_ric = $("#ricercaClienteTxt").val();
  812.         var citta = $("#ricercaCittaTxt").val();
  813.         var provincia = $("#ricercaProvinciaTxt").val();
  814.         $.ajax({
  815.             type: "POST",
  816.             dataType: 'html',
  817.             data: {
  818.                 "data": {
  819.                     'ricerca': str_ric,
  820.                     'citta' : citta,
  821.                     'provincia' : provincia
  822.                 }
  823.             },
  824.             url: Routing.generate('agente_lista_clienti_ricerca', {
  825.                 rigaInzio: rigaInizio
  826.             }),
  827.             async: true,
  828.             success: function (response) {
  829.                 $('#bodyTabellaRicercaCliente').html(response);
  830.             },
  831.             error: function (xhr, ajaxOptions, thrownError) {
  832.                 alert(xhr.status);
  833.                 alert(thrownError);
  834.             }
  835.         });
  836.     }
  837.     function CaricaDettaglioCliente(id) {
  838.         $.ajax({
  839.             type: "POST",
  840.             dataType: 'html',
  841.             url: Routing.generate('agente_dettaglio_anagrafica', {
  842.                 id: (id), soloDati: 1
  843.             }),
  844.             async: true,
  845.             success: function (response) {
  846.                 $('.moda-dettaglio-cliente-body').html(response);
  847.                 $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
  848.                     let tabAperto = e.target; // newly activated tab
  849.                     let identificativo = tabAperto.hash.substring(1);
  850.                     let contenitore = $('#' + identificativo);
  851.                     if(identificativo != 'tab-home') {
  852.                         $(contenitore).html('');
  853.                         $.ajax({
  854.                             type: "POST",
  855.                             dataType: 'html',
  856.                             data: {'tab': (identificativo)},
  857.                             async: true,
  858.                             url: Routing.generate('agente_dettaglio_carica_tab_anagrafica', {idAnagrafica: id}),
  859.                             success: function (response) {
  860.                                 $(contenitore).html(response);
  861.                             },
  862.                             error: function (xhr, ajaxOptions, thrownError) {
  863.                                 alert(xhr.status);
  864.                                 alert(thrownError);
  865.                             }
  866.                         });
  867.                     }
  868.                 });
  869.             }
  870.         });
  871.     }
  872.     function VerificaStileBottoneNascondiPrezzi(){
  873.         if ($("#nascondiPrzBtnDettCliente").data("valore") == '0'){
  874.             $("#nascondiPrzBtnDettCliente").css("background-color", "#fff");
  875.         }else{
  876.             $("#nascondiPrzBtnDettCliente").css("background-color", "yellow");
  877.         }
  878.     }
  879.     
  880.     function VariaStatoBottoneNascondiPrezzi(){
  881.         if ($("#nascondiPrzBtnDettCliente").data("valore") == '0'){
  882.             $("#nascondiPrzBtnDettCliente").data("valore", '1')
  883.             VerificaStileBottoneNascondiPrezzi();
  884.         }else{
  885.             $("#nascondiPrzBtnDettCliente").data("valore", '0')
  886.             VerificaStileBottoneNascondiPrezzi();
  887.         }
  888.         let datiCliente = {
  889.             'codice' : memorizzazioneAltriDatiUtente.codice,
  890.             'ragioneSociale': memorizzazioneAltriDatiUtente.ragioneSociale,
  891.             'id' : memorizzazioneAltriDatiUtente.id,
  892.             'tipoOrdine' : $("#tipo-ordine-input").find(":selected").val(),
  893.             'nascondiPrezzi': $("#nascondiPrzBtnDettCliente").data('valore')
  894.         };
  895.         aggiornaVisualizzaAltriDatiUtente('M', JSON.stringify(datiCliente), function (response) {
  896.             memorizzazioneAltriDatiUtente = datiCliente;
  897.         });
  898.     }
  899.     function PulisciSelezioneCliente(dati){
  900.         aggiornaVisualizzaAltriDatiUtente('E', '', function (response) {
  901.             if(response.esito == 'OK') {
  902.                 AggiornaStatoSelezioneCliente();
  903.                 $("#codiceClienteTxt").val("");
  904.                 $("#ragioneSocialeText").val("");
  905.                 CountArticoliCarrello();
  906.                 memorizzazioneAltriDatiUtente = {}
  907.                 $('.moda-dettaglio-cliente-body').html("");
  908.             }else{
  909.                 alert('{{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_errore_pulisci_cliente", "dialog_ricerca_cliente").valoreUscita }}');
  910.             }
  911.         });
  912.     }
  913.     function AggiornaStatoSelezioneCliente() {
  914.         aggiornaVisualizzaAltriDatiUtente('V', '', function (response) {
  915.             let cck = response;
  916.             if (cck != "" && cck && cck.length > 0) {
  917.                 $(".pulisci-selezione-cliente").show();
  918.                 $(".top-bar-seleziona-cliente").css("background-color", "yellow");
  919.                 memorizzazioneAltriDatiUtente = JSON.parse(cck);
  920.             } else {
  921.                 $(".pulisci-selezione-cliente").hide();
  922.                 $(".top-bar-seleziona-cliente").css("background-color", "transparent");
  923.                 $('#navbar-dettaglio-cliente').text("");
  924.                 $('#selezionaVariantiModalCliente').text('');
  925.             }
  926.         });
  927.     }
  928.     {% endif %}
  929.     function aggiornaVisualizzaAltriDatiUtente(operazione, valore, callback = null){
  930.         $.ajax({
  931.             type: "POST",
  932.             dataType: 'json',
  933.             data: {'valore' : (valore)},
  934.             async: true,
  935.             url: Routing.generate({% if is_granted("ROLE_AGENTE") %}'agente_altro_dato'{% else %}'utente_altro_dato'{% endif %}, {
  936.                 operazione: (operazione)
  937.             }),
  938.             success: function (response){
  939.                 memorizzazioneAltriDatiUtente = valore;
  940.                 callback(response);
  941.             },
  942.             error: function (xhr, ajaxOptions, thrownError) {
  943.                 alert(xhr.status);
  944.                 alert(thrownError);
  945.             }
  946.         });
  947.     }
  948.     function adattaContenutoABarraSuperiore(){
  949.         $(".contenitore_generale_body").css("padding-top", $(".navbar-fixed-top").height() + "px")
  950.         $(".nav-side-menu").css("padding-top", $(".navbar-fixed-top").height() + "px")
  951.     }
  952.     $(document).ready(function () {
  953.         $(window).resize(function() {
  954.             adattaContenutoABarraSuperiore();
  955.         });
  956.         $(document).on("click", ".attiva-img-zoom", function (event){
  957.             event.stopImmediatePropagation();
  958.             event.stopPropagation();
  959.             $("#zoomImgImg").attr("src", $(this).attr("src"));
  960.             $("#modalZoomImg").modal('show');
  961.         });
  962.         $('#modalZoomImg').on("shown.bs.modal", function (){
  963.             imageZoom("zoomImgImg", "zoomImgResult");
  964.         });
  965.         $('.attiva-slick')
  966.             .on('init', function(slick) {
  967.                 $('.attiva-slick').fadeIn(3000);
  968.             })
  969.             .slick();
  970.         $('.attiva-tiny-slider').each(function (index, item) {
  971.             let arrConfig = $(item).data('configurazione');
  972.             tns(arrConfig);
  973.             $(item).css({ display: "block" });
  974.         });
  975.         $('.form-ordinazione-articolo').on("submit", function (e) {
  976.             let disponibilita = $(this).find('input[name="disponibilita"]').val();
  977.             let disponibilitaMagSecondari = $(this).find('input[name="disponibilita-mag-secondari"]').val();
  978.             if(disponibilita && disponibilita <= 0 ) {
  979.                 if(disponibilitaMagSecondari > 0) {
  980.                     e.preventDefault();
  981.                     ApriModalMagazziniSecondari($(this).find('input[name="id-mappa"]').val(), $(this).find('input[name="qta"]').val());
  982.                 }
  983.             }
  984.         });
  985.         $('[data-toggle="popover"]').popover();
  986.         $("#set_min_width").css("min-width", $(window).width() / 2);
  987.         $("#form_news").mouseleave(function () {
  988.             $("#set_min_width").css("display", "none");
  989.         });
  990.         $("#set_min_width").mouseenter(function () {
  991.             $("#set_min_width").css("display", "inline-block");
  992.         });
  993.         $("#set_min_width").mouseleave(function () {
  994.             $("#set_min_width").css("display", "none");
  995.         });
  996.         $('#cerca-btn-top').on('click', function () {
  997.             ResetRicercaFiltroAvanzato();
  998.             RicercaVeloce($("#ricercaVeloceTxt").val());
  999.         });
  1000.         $("#ricercaVeloceTxt").on("keypress", function(e) {
  1001.             if(e.which == 13) {
  1002.                 ResetRicercaFiltroAvanzato();
  1003.                 RicercaVeloce($("#ricercaVeloceTxt").val());
  1004.             }
  1005.         });
  1006.         var errori_validazione = [
  1007.             {% if errori_validazione is defined %}
  1008.             {% for err in errori_validazione %}
  1009.             "{{ err }}",
  1010.             {% endfor %}
  1011.             {% endif %}
  1012.         ];
  1013.         $.each(errori_validazione, function (item) {
  1014.             $("#form_" + errori_validazione[item]).addClass("dato-invalido");
  1015.         });
  1016.         CountArticoliCarrello();
  1017.         adattaContenutoABarraSuperiore();
  1018.         {% if (is_granted("ROLE_ADMIN") or is_granted("ROLE_COMMERCIALE") or is_granted("ROLE_AGENTE")) %}
  1019.         $("#ricercaClienteTxt, #ricercaCittaTxt, #ricercaProvinciaTxt").on("change paste keyup", function () {
  1020.             CaricaTabellaGeneraleClienti($("#inizioRiga").data('valore'));
  1021.         });
  1022.         $(".cercaCliente").on("focus, click", function () {
  1023.             stadioSostituzione = 0;
  1024.             $("#modalCercaCliente").modal('show');
  1025.         });
  1026.         $("#tipo-ordine-input").on("change", function (){
  1027.             aggiornaVisualizzaAltriDatiUtente('V', '', function (response) {
  1028.                 let cookie = response;
  1029.                 if (cookie != "" && cookie && cookie.length > 0){
  1030.                     let json = JSON.parse(cookie);
  1031.                     let datiCliente = {
  1032.                         'codice' : json.codice,
  1033.                         'ragioneSociale': json.ragioneSociale,
  1034.                         'id' : json.id,
  1035.                         'tipoOrdine' : $("#tipo-ordine-input").find(":selected").val(),
  1036.                         'nascondiPrezzi': $("#nascondiPrzBtnDettCliente").data('valore')
  1037.                     };
  1038.                     {% if (is_granted("ROLE_ADMIN") or is_granted("ROLE_COMMERCIALE") or is_granted("ROLE_AGENTE")) %}
  1039.                         VerificaStileBottoneNascondiPrezzi();
  1040.                     {% endif %}
  1041.                     aggiornaVisualizzaAltriDatiUtente('M', JSON.stringify(datiCliente), function (response) {
  1042.                         CountArticoliCarrello();
  1043.                         location.reload(); //Ricarico la pagina
  1044.                     });
  1045.                 }
  1046.             });
  1047.         });
  1048.         $("#bodyTabellaRicercaCliente").on("click", "tr", function () {
  1049.             $("#codiceClienteTxt").val($(this).data("codice"));
  1050.             $("#ragioneSocialeText").val($(this).data("ragione-sociale"));
  1051.             let datiCliente = {
  1052.                 'codice' : $(this).data("codice"),
  1053.                 'ragioneSociale': $(this).data("ragione-sociale"),
  1054.                 'id' : $(this).data("identificativo"),
  1055.                 'tipoOrdine' : $("#tipo-ordine-input").find(":selected").val(),
  1056.                 'nascondiPrezzi': $("#nascondiPrzBtnDettCliente").data('valore')
  1057.             };
  1058.             $('#navbar-dettaglio-cliente').text(datiCliente.codice + ' - ' + datiCliente.ragioneSociale);
  1059.             $('#selezionaVariantiModalCliente').text('Cliente: ' + datiCliente.codice + ' - ' + datiCliente.ragioneSociale);
  1060.             $("#modalCercaCliente").modal('toggle');
  1061.             aggiornaVisualizzaAltriDatiUtente('M', JSON.stringify(datiCliente), function (response) {
  1062.                 AggiornaStatoSelezioneCliente();
  1063.                 CountArticoliCarrello();
  1064.                 CaricaDettaglioCliente(datiCliente.id);
  1065.                 {% if (is_granted("ROLE_ADMIN") or is_granted("ROLE_COMMERCIALE") or is_granted("ROLE_AGENTE")) %}
  1066.                     VerificaStileBottoneNascondiPrezzi();
  1067.                 {% endif %}
  1068.             });
  1069.             if(stadioSostituzione == 1){
  1070.                 if(confirm('{{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_conferma_spostamento_carrello", "dialog_ricerca_cliente").valoreUscita }}')) {
  1071.                     SpostaCarrello($(this).data("identificativo"));
  1072.                 }
  1073.             }
  1074.         });
  1075.         $('#modalDettaglioClienteSpostaCarrelloBtn').on('click', function (event) {
  1076.            if(stadioSostituzione == 0){
  1077.                event.preventDefault();
  1078.                event.stopPropagation();
  1079.                stadioSostituzione = 1;
  1080.                $("#modalCercaCliente").modal('show');
  1081.            }
  1082.         });
  1083.         $('#modalCreaOfferteDaCarrello_creaBtn').on("click", function (event) {
  1084.             if(confirm("{{ traduzione.OttieniElementoDizionario("dialog_ricerca_cliente_conferma_generazione_offerta", "dialog_ricerca_cliente").valoreUscita }}")){
  1085.                 $("#creaOffertaDaCarrelloForm").submit();
  1086.             }
  1087.         });
  1088.         aggiornaVisualizzaAltriDatiUtente('V', '', function (response) {
  1089.             let cookie = response;
  1090.             $(".pulisci-selezione-cliente").hide();
  1091.             if (cookie != "" && cookie && cookie.length > 0){
  1092.                 let json = JSON.parse(cookie);
  1093.                 $(".pulisci-selezione-cliente").show();
  1094.                 $("#codiceClienteTxt").val(json.codice);
  1095.                 $("#ragioneSocialeText").val(json.ragioneSociale);
  1096.                 $("#nascondiPrzBtnDettCliente").data('valore', json.nascondiPrezzi)
  1097.                 let tipoOrdine = json.hasOwnProperty("tipoOrdine") ? json.tipoOrdine : '';
  1098.                 $("#tipo-ordine-input > option").each(function() {
  1099.                     if($(this).val() ==tipoOrdine){
  1100.                         $(this).attr("selected", "selected");
  1101.                     }else{
  1102.                         $(this).removeAttr("selected");
  1103.                     }
  1104.                 });
  1105.                 $('#navbar-dettaglio-cliente').text(json.codice + ' - ' + json.ragioneSociale);
  1106.                 $('#selezionaVariantiModalCliente').text('Cliente: ' + json.codice + ' - ' + json.ragioneSociale);
  1107.                 memorizzazioneAltriDatiUtente = json;
  1108.                 {% if (is_granted("ROLE_ADMIN") or is_granted("ROLE_COMMERCIALE") or is_granted("ROLE_AGENTE")) %}
  1109.                     VerificaStileBottoneNascondiPrezzi();
  1110.                 {% endif %}
  1111.                 CaricaQuadratiAlbero("");
  1112.             }
  1113.         });
  1114.         AggiornaStatoSelezioneCliente();
  1115.         {% if (is_granted("ROLE_ADMIN") or is_granted("ROLE_COMMERCIALE") or is_granted("ROLE_AGENTE")) %}
  1116.             VerificaStileBottoneNascondiPrezzi();
  1117.         {% endif %}
  1118.         CaricaTabellaGeneraleClienti(0);
  1119.         {# Verifico se l'utente ha effettuato il LOGIN #}
  1120.         {% elseif is_granted("IS_AUTHENTICATED_REMEMBERED") %}
  1121.         aggiornaVisualizzaAltriDatiUtente('V', '', function (response) {
  1122.             let cookie = response;
  1123.             $(".pulisci-selezione-cliente").hide();
  1124.             if (cookie != "" && cookie && cookie.length > 0){
  1125.                 let json = JSON.parse(cookie);
  1126.                 $(".pulisci-selezione-cliente").show();
  1127.                 $("#codiceClienteTxt").val(json.codice);
  1128.                 $("#ragioneSocialeText").val(json.ragioneSociale);
  1129.                 let tipoOrdine = json.hasOwnProperty("tipoOrdine") ? json.tipoOrdine : '';
  1130.                 $("#tipo-ordine-input > option").each(function() {
  1131.                     if($(this).val() ==tipoOrdine){
  1132.                         $(this).attr("selected", "selected");
  1133.                     }else{
  1134.                         $(this).removeAttr("selected");
  1135.                     }
  1136.                 });
  1137.                 {% if (is_granted("ROLE_ADMIN") or is_granted("ROLE_COMMERCIALE") or is_granted("ROLE_AGENTE")) %}
  1138.                     $('#navbar-dettaglio-cliente').text(json.codice + ' - ' + json.ragioneSociale);
  1139.                 {% endif %}
  1140.                 $('#selezionaVariantiModalCliente').text('Cliente: ' + json.codice + ' - ' + json.ragioneSociale);
  1141.                 $("#nascondiPrzBtnDettCliente").data('valore', json.nascondiPrezzi)
  1142.                 memorizzazioneAltriDatiUtente = json;
  1143.                 {% if (is_granted("ROLE_ADMIN") or is_granted("ROLE_COMMERCIALE") or is_granted("ROLE_AGENTE")) %}
  1144.                     VerificaStileBottoneNascondiPrezzi();
  1145.                 {% endif %}
  1146.                 CaricaQuadratiAlbero("");
  1147.             }
  1148.         });
  1149.         $("#tipo-ordine-input").on("change", function (){
  1150.             aggiornaVisualizzaAltriDatiUtente('V', '', function (response) {
  1151.                     let datiCliente = {
  1152.                         'codice' : '',
  1153.                         'ragioneSociale': '',
  1154.                         'id' : '',
  1155.                         'tipoOrdine' : $("#tipo-ordine-input").find(":selected").val(),
  1156.                         'nascondiPrezzi': $("#nascondiPrzBtnDettCliente").data('valore')
  1157.                     };
  1158.                 {% if (is_granted("ROLE_ADMIN") or is_granted("ROLE_COMMERCIALE") or is_granted("ROLE_AGENTE")) %}
  1159.                     VerificaStileBottoneNascondiPrezzi();
  1160.                 {% endif %}
  1161.                     aggiornaVisualizzaAltriDatiUtente('M', JSON.stringify(datiCliente), function (response) {
  1162.                         CountArticoliCarrello();
  1163.                         location.reload(); //Ricarico la pagina
  1164.                     });
  1165.             });
  1166.         });
  1167.         {% endif %}
  1168.         {% for flash_message in app.session.flashbag.get('notice')%}
  1169.             toastMessage("{{ flash_message }}");
  1170.         {% endfor %}
  1171.         {% for flash_message in app.session.flashbag.get('error')%}
  1172.             toastMessage("{{ flash_message }}", true);
  1173.         {% endfor %}
  1174.     });
  1175. </script>
  1176. {% block javascript %}{% endblock %}
  1177. <div class="pushContent"></div>
  1178. </body>
  1179. {% if app.request.get("_route") != 'admin_pagine_e_componenti_editor' %}
  1180.     {% if impostazioni.ritornaImpostazioneDaNome('MostraFooterSviluppatoDa') == '1' %}
  1181.         <footer class="navbar navbar-default navbar-fixed-bottom">
  1182.             <div style="margin-top: 15px;" class="container">
  1183.                 <span style="vertical-align: middle;"><a href="http://www.fogazzimirko.it">Sviluppato da Fogazzi Mirko © {{ "now"|date("Y") }}{% block footer %}{% endblock %}</a></span>
  1184.             </div>
  1185.         </footer>
  1186.     {% endif %}
  1187. {% endif %}
  1188. </html>