src/Flexy/FrontBundle/Themes/Lasalle/templates/admin/statistics/admin/_content.html.twig line 1

  1. <turbo-frame id="render-stats" data-turbo-action="advance" >
  2.     
  3.     
  4.     {% if store is not defined %}
  5.         {% set store = null %}
  6.     {% endif %}
  7.     {% if year is not defined or app.request.get('year') == "0" %}
  8.             {% set year = null %}
  9.         
  10.     {% endif %}
  11.         {% if month is not defined or app.request.get('month') == "0" %}
  12.         {% set month = null %}
  13.     {% endif %}
  14.     
  15.     
  16.     
  17.     <div class="row header" >
  18.         <div class="col-4" >
  19.             <h2 style="font-weight:bold;font-size:16px;" class="title"><i class="fa-solid fa-chart-pie"></i> {{"Dashboard"|trans}} {{settings.get.projectName}}
  20.             <br>
  21.             {% if store != null %}
  22.                 <span class="badge badge-info p-1" ><i class="fa-solid fa-shop"></i> {{"Store"|trans}} : {{store}}</span>
  23.             {% endif %}
  24.             {% if year != null or month != null %}
  25.                 <span class="badge badge-info p-1" > 
  26.                 <i class="fa-solid fa-filter-circle-dollar"></i>
  27.                 {{"Result for priod"|trans}} :
  28.                 {% if year != null %}
  29.                     {{year}} 
  30.                 {% endif %}
  31.                 {% if month != null %}
  32.                 
  33.                     {{ ("2000-"~month)|date('F')|trans }}</span>
  34.                 {% endif %}
  35.             {% endif %}
  36.             
  37.             </h2>
  38.             
  39.         </div>
  40.         <div class="col-8" >
  41.             
  42.             <form action="{{path('admin_stats')}}"  method="POST">
  43.             
  44.                 <div class="row">
  45.                     <div class="col-2" >
  46.                         <button id="btn-filter-stats" class="d-none btn btn-success d-block btn-large" >Filtrer</button>
  47.                     </div>
  48.                     <div class="col-4" >
  49.                     {% if stores|length > 1 %}
  50.                         <select id="store-select" class="form-select" name="store" aria-label="Default select example">
  51.                             <option value="0" selected>{{"All stores"|trans}}</option>
  52.                             {% for singleStore in stores %}
  53.                                 <option {% if singleStore == store %}selected{% endif %} value="{{singleStore.id}}">
  54.                                     {{singleStore.name}}
  55.                                 </option>
  56.                             {% endfor %}
  57.                         </select>
  58.                         
  59.                         {% endif %}
  60.                     </div>
  61.                     
  62.                     <div class="col-3" >
  63.                         <select id="year-select" class="form-select" name="year" aria-label="Default select example">
  64.                             <option value="0">{{"All years"|trans}}</option>
  65.                             {% for singleYear in shopStatisticProvider.periodsOrdersOptions(store)|sort((a, b) => a.year < b.year ? 1 : -1) %}
  66.                                 <option {% if singleYear["year"] == year %}selected{% endif %} value="{{singleYear["year"]}}">
  67.                                     {{singleYear["year"]}}
  68.                                 </option>
  69.                             {% endfor %}
  70.                             
  71.                         </select>
  72.                     </div>
  73.                     <div class="col-3" >
  74.                         
  75.                             <select id="months-select" class="form-select" name="month" aria-label="Default select example">
  76.                             <option value="0">{{"All months"|trans}}</option>
  77.                             {% for singleYear in shopStatisticProvider.periodsOrdersOptions(store) %}
  78.                                 {% for singleMonth in singleYear["months"]|sort((a, b) => a.number < b.number ? 1 : -1) %}
  79.                                     {% if singleYear["year"] == year %}
  80.                                         <option {% if singleMonth["number"] == month %}selected{% endif %} value="{{singleMonth["number"]}}">
  81.                                              {{singleMonth["name"]}}
  82.                                         </option>
  83.                                     {% endif %}
  84.                                 {% endfor %}
  85.                             {% endfor %}
  86.                             
  87.                         </select>
  88.                         
  89.                         
  90.                     </div>
  91.                     
  92.                     
  93.                 </div>
  94.             </form>
  95.         </div>
  96.     </div>
  97.     <div class="row" >
  98.             <div class="col-12 col-md-5 p-4" >
  99.             <div class="row" >
  100.         <div class="col-4">
  101.             <div class="card p-3 mb-2 bg-purple-dark text-white">
  102.                 <h6 class="text-white stats-title"><i class="fa-solid fa-comment-dollar"></i> {{"Today"|trans}}</h6>
  103.                       
  104.                 <b>{{shopStatisticProvider.getRevenue(store,year,month)["today"]|number_format(0,",","")}} {{settings.get.currency|trans}}</b>
  105.             </div>
  106.         </div>
  107.         <div class="col-4">
  108.             <div class="card p-3 mb-2 bg-blue-dark text-white">
  109.                 <h6 class="text-white stats-title"><i class="fa-solid fa-comment-dollar"></i> {{"Yesterday"|trans}}</h6>
  110.                 <b>{{shopStatisticProvider.getRevenue(store,year,month)["yesterday"]|number_format(0,",","")}} {{settings.get.currency|trans}}</b>
  111.             </div>
  112.         </div>
  113.       
  114.        <div class="col-4">
  115.             <div class="card p-3 mb-2 bg-orange-dark text-white">
  116.                 <h6 class="text-white stats-title"><i class="fa-solid fa-comment-dollar"></i> Mois {{ "now"|date("F") }}</h6>
  117.            <b>{{shopStatisticProvider.getRevenue(store,year,month)["current_month"]|number_format(0,",","")}} {{settings.get.currency|trans}}</b>
  118.          </div>
  119.         </div>
  120.         <!--<div class="col-4">
  121.             <div class="card p-3 mb-2 bg-orange-dark text-white">
  122.                 <h6 class="text-white stats-title"><i class="fa-solid fa-comment-dollar"></i> {{"Average"|trans}}</h6>
  123.                 <b>{{shopStatisticProvider.getAverageRevenuePerDay("day")|number_format(0,",","")}} {{settings.get.currency|trans}}</b>
  124.             </div>
  125.         </div>-->
  126.         
  127.         <div class="col-12 mb-2">
  128.             <div class="card p-3">
  129.         
  130.                     {#{{ render_chart(shopStatisticProvider.chartRevenue(store,year,month)) }}#}
  131.                      
  132.         <div class="col-12 col-md-12 " >
  133.             <div class="card p-3" >
  134.                 <h6>Chiffre d'affaire par type d'abonnement</h6>
  135.                 
  136.                 <table class="table">
  137.                     <thead class="bg-purple-dark text-white">
  138.                         <tr>
  139.                         <th scope="col">{{"Product"|trans}}</th>
  140.                         <th scope="col">{{"Nombres \n des ventes"|trans}}</th>
  141.                         <th scope="col">{{"Revenue"|trans}}</th>
  142.                         </tr>
  143.                     </thead>
  144.                     <tbody>
  145.                     
  146.                      {% for singleProductRevenu in shopStatisticProvider.revenueByProducts(store,year,month) %}
  147.                         <tr>
  148.                             <td>{{singleProductRevenu.productName}}</td>
  149.                             <td>{{singleProductRevenu.totalSold}}</td>
  150.                             <td>
  151.                             <span  >
  152.                             <b>
  153.                             {{singleProductRevenu.revenue}} {{settings.get.currency|trans}}
  154.                             </b>
  155.                             </span></td>
  156.                         </tr>
  157.                     {% endfor %} 
  158.                     
  159.                     </tbody>
  160.                 </table>
  161.                 
  162.             {#    {% set revenueProductUrl = ea_url().setDashboard("App\\Controller\\Admin\\DashboardController").setController("App\\Flexy\\FrontBundle\\Themes\\Lasalle\\Controller\\ShopAdmin\\Product\\ProductRevenueCrudController").setAction("index") %}
  163.                     <a class="btn-btn-info" href="{{revenueProductUrl}}" data-turbo="false"  >Voir plus</a>#}
  164.             </div>
  165.         
  166.         </div>
  167.             </div>
  168.         </div>
  169.         
  170.             </div>
  171.             
  172.         </div>
  173.         <div class="col-12 col-md-7 p-4" >
  174.             <div class="row quick-stats">
  175.             {% for key, singleStat in shopStatisticProvider.quickStats(store,year,month) %}
  176.                 <div class="col-lg-4 col-6 mb-3">
  177.                     <div class="card p-3 bg-purple-dark text-white" >
  178.                         <div class="row">
  179.                             <div class="col-lg-3 col-12" >
  180.                                 <div class="icon-container text-purple">
  181.                                     {{singleStat["icon"]|raw}}
  182.                                 </div>
  183.                             </div>
  184.                             <div class="col-9" >
  185.                                 <div>
  186.                                     
  187.                                     <h6 class="stats-title text-white"><span>{{singleStat["all"]}} {{singleStat["unit"]|trans}}</span> <br>{{key|trans}}</h6>
  188.                                 </div>
  189.                             </div>
  190.                             <div class="col-12" >
  191.                                 <ul class="list-unstyled text-center mt-2">
  192.                                     <li><b>{{singleStat["new"]|number_format(0,",","")}} {{singleStat["unit"]|trans}}</b> {{"last week"|trans}}</li>
  193.                                     <li><b>{{singleStat["old"]|number_format(0,",","")}} {{singleStat["unit"]|trans}}</b> {{"last month"|trans}}</li>
  194.                                 </ul>
  195.                             </div>
  196.                         </div>
  197.                     </div>
  198.                 </div>
  199.             {% endfor %}
  200.                 
  201.             </div>
  202.         </div>
  203.     </div>
  204. <div class="row" >
  205.         
  206.         <div class="col-12" >
  207.             
  208.             <h5>Visite AdhΓ©rant </h5>
  209.         </div>
  210.         <div class="col-lg-9 col-md-9 col-sx-9">
  211.             
  212.                 
  213.                  {{ render_chart(shopStatisticProvider.chartVisteBymonths(store,year,month)) }}
  214.         </div>
  215.      
  216.         <div class="col-lg-3 col-md-3 col-sx-3">
  217.             <div class="card p-3 mb-2 bg-purple-dark text-white">
  218.                 <h6 class="text-white stats-title"><i class="fa-solid fa-people-group"></i> Visites {{"Yesterday"|trans}}</h6>
  219.                 <b>Pointage Manuel  {{shopStatisticProvider.getVisitYesterday(store,year,month)[0]["manuel"] }}<div style="float:right"><span style="font-size:16px;">πŸ‘©πŸ» </span>{{shopStatisticProvider.getVisitYesterday(store,year,month)[0]["female_manuel"]}} | <span style="font-size:16px;">πŸ‘¨πŸ»</span> {{shopStatisticProvider.getVisitYesterday(store,year,month)[0]["male_manuel"]}}</div></b>
  220.                 <b>Pointage Carte   {{shopStatisticProvider.getVisitYesterday(store,year,month)[0]["automatique"] }}<div style="float:right"><span style="font-size:16px;">πŸ‘©πŸ» </span> {{shopStatisticProvider.getVisitYesterday(store,year,month)[0]["female_automatique"]}} | <span style="font-size:16px;">πŸ‘¨πŸ»</span> {{shopStatisticProvider.getVisitYesterday(store,year,month)[0]["male_automatique"]}} </div></b>
  221.             </div>
  222.             <div class="card p-3 mb-2 bg-blue-dark text-white">
  223.                 <h6 class="text-white stats-title"><i class="fa-solid fa-people-group"></i> Visites {{"Today"|trans}} </h6>
  224.              
  225.                 <b>Pointage Manuel  {{shopStatisticProvider.getVisitToday(store,year,month)[0]["manuel"] }}<div style="float:right"><span style="font-size:16px;">πŸ‘©πŸ» </span>{{shopStatisticProvider.getVisitToday(store,year,month)[0]["female_manuel"]}} | <span style="font-size:16px;">πŸ‘¨πŸ»</span> {{shopStatisticProvider.getVisitToday(store,year,month)[0]["male_manuel"]}}</div></b>
  226.                 <b>Pointage Carte   {{shopStatisticProvider.getVisitToday(store,year,month)[0]["automatique"] }}<div style="float:right"><span style="font-size:16px;">πŸ‘©πŸ» </span> {{shopStatisticProvider.getVisitToday(store,year,month)[0]["female_automatique"]}} | <span style="font-size:16px;">πŸ‘¨πŸ»</span> {{shopStatisticProvider.getVisitToday(store,year,month)[0]["male_automatique"]}}</div></b>
  227.             </div>
  228.         </div>
  229.          
  230.          
  231.         
  232.                  
  233.     </div>
  234.     <div class="row mt-5" >
  235.     {# <div class="col-12" >
  236.             <h4>Stats chiffre d'affaire</h4>
  237.         </div> #}
  238.     {#    <div class="col-12 col-md-4" >
  239.             <div class="card p-3" >
  240.             
  241.                 
  242.                 {{ render_chart(shopStatisticProvider.chartRevenueByParentCategories(store,year,month)) }}
  243.             </div>
  244.         </div> #}
  245.     {#
  246.         <div class="col-12 col-md-4 d-none" >
  247.             <div class="card p-3" >
  248.                 <h6>Chiffre d'affaire par type d'abonnement</h6>
  249.                 
  250.                 <table class="table">
  251.                     <thead class="bg-purple-dark text-white">
  252.                         <tr>
  253.                         <th scope="col">{{"Product"|trans}}</th>
  254.                         <th scope="col">{{"Revenue"|trans}}</th>
  255.                         </tr>
  256.                     </thead>
  257.                     <tbody>
  258.                     
  259.                      {% for singleProductRevenu in shopStatisticProvider.revenueByProducts(store,year,month) %}
  260.                         <tr>
  261.                             <td>{{singleProductRevenu[0]}}</td>
  262.                             <td><span  >
  263.                             <b>
  264.                             {{singleProductRevenu.revenue}} {{settings.get.currency|trans}}
  265.                             </b>
  266.                             </span></td>
  267.                         </tr>
  268.                     {% endfor %} 
  269.                     
  270.                     </tbody>
  271.                 </table>
  272.                 
  273.                 {% set revenueProductUrl = ea_url().setDashboard("App\\Controller\\Admin\\DashboardController").setController("App\\Flexy\\FrontBundle\\Themes\\Lasalle\\Controller\\ShopAdmin\\Product\\ProductRevenueCrudController").setAction("index") %}
  274.                     <a class="btn-btn-info" href="{{revenueProductUrl}}" data-turbo="false"  >Voir plus</a>
  275.             </div>
  276.         
  277.         </div>
  278.         #}
  279.         <div class="col-12 col-md-8" >
  280.             <div class="card p-3" >
  281.                 <h6>Chiffre d'affaire par commercial</h6>
  282.                 <table class="table">
  283.                     <thead class="bg-purple-dark text-white">
  284.                         <tr>
  285.                         <th scope="col">{{"Agent"|trans}} </th>
  286.                         <th scope="col">{{"Revenue"|trans}}</th>
  287.                         </tr>
  288.                     </thead>
  289.                     <tbody>
  290.                     {% for singleAgentRevenu in shopStatisticProvider.revenueByAgents(store,year,month) %}
  291.                         <tr>
  292.                             <td>{{singleAgentRevenu.agentFirstName}} {{singleAgentRevenu.agentLastName}}</td>
  293.                             <td>
  294.                                 <span  >
  295.                             <b>
  296.                             {{singleAgentRevenu.revenue}} {{settings.get.currency|trans}}
  297.                             </b>
  298.                             </span>
  299.                             </td>
  300.                         </tr>
  301.                     {% endfor %}
  302.                     </tbody>
  303.                 </table>
  304.                 {% set revenueCategoryUrl = ea_url().setDashboard("App\\Controller\\Admin\\DashboardController").setController("App\\Flexy\\FrontBundle\\Themes\\Lasalle\\Controller\\ShopAdmin\\Product\\CategoryProductRevenueCrudController").setAction("index") %}
  305.                     <!--<a class="btn-btn-info" href="{{revenueCategoryUrl}}" data-turbo="false"  >Voir plus</a>-->
  306.             </div>
  307.         
  308.         </div>
  309.     </div>
  310.     
  311.     
  312. <script>
  313. document.addEventListener("turbo:load",function(){
  314.         $("#store-select,#year-select,#months-select").change(function(){
  315.             $("#btn-filter-stats").trigger("click");
  316.         });
  317.         $("#year-select").change(function(){
  318.             
  319.             $("#months-select").val(0).change();
  320.             $("#btn-filter-stats").trigger("click");
  321.         });
  322. });
  323. </script>
  324.     </turbo-frame>