templates/stock/_list.html.twig line 1

Open in your IDE?
  1. <h1>{{ 'Stock'|trans }}</h1>
  2. <form id="stock">
  3.     <table class="table table-bordered table-striped">
  4.         <thead>
  5.         <tr>
  6.             <th class="text-center"><label for="brand">{{ "Brand"|trans}}</label></th>
  7.             <th class="text-center"><label for="category">{{ "Category"|trans }}</label></th>
  8.             <th class="text-center"><label for="model">{{ "Model"|trans }}</label></th>
  9.             <th class="text-center"><label for="color">{{ "Color"|trans }}</label></th>
  10.             {% if is_granted('ROLE_SUPER_ADMIN') and shop is not defined %}
  11.                 <th class="text-center"><label>{{ "Shop"|trans }}</label></th>
  12.             {%  endif %}
  13.             <th class="text-center"><label for="grade">Grade {%  if app.user.shop and app.user.shop.id==3 %} <a href="https://www.bak2life.fr/fr/" target="_blank"><i class="bi bi-question-circle"></i></a>{%  endif %}</label></th>
  14.             {% if is_granted('ROLE_ADMIN') %}
  15.                 <th class="text-center" colspan="4"><label>{{ "Price"|trans }}</label></th>
  16.             {%  else %}
  17.             {%  set colspan =0 %}
  18.                 {%  if app.user.shop and app.user.shop.getSetting('is-point-of-sale')==false %}
  19.                     {% set colspan=1 %}
  20.                 {% endif %}
  21.                 {%  if app.user.shop and app.user.shop.getSetting('show-public-prices') %}
  22.                     {% set colspan=colspan+2 %}
  23.                 {% endif %}
  24.                 <th class="text-center" colspan="{{ colspan }}"><label>{{ "Price"|trans }}</label></th>
  25.             {% endif %}
  26.             <th class="text-center"><label>{{ "Qty"|trans }}</label></th>
  27.             <th></th>
  28.         </tr>
  29.         <tr>
  30.             <th><select class="form-select" name="brand" onchange="submit()"><option value="">{{ "Any"|trans }}</option>{%  for manufacturerId, manufacturer in manufacturers %}<option value="{{ manufacturerId }}" {{ manufacturerId==app.request.get("brand")?'selected':'' }}>{{ manufacturer }}</option> {%  endfor %}</select></th>
  31.             <th><select class="form-select" name="category" onchange="submit()"><option value="">{{ "Any"|trans }}</option>{%  for categoryId, category in categories %}<option value="{{ categoryId }}" {{ categoryId==app.request.get("category")?'selected':'' }}>{{ category }}</option> {%  endfor %}</select></th>
  32.             <th><select class="form-select" name="model" onchange="submit()"><option value="">{{ "Any"|trans }}</option>{%  for modelId, model in models %}<option value="{{ modelId }}" {{ modelId==app.request.get("model")?'selected':'' }}>{{ model }}</option> {%  endfor %}</select></th>
  33.             <th><select class="form-select" name="color" onchange="submit()"><option value="">{{ "Any"|trans }}</option>{%  for colorId, color in colors %}<option value="{{ colorId }}" {{ colorId==app.request.get("color")?'selected':'' }}>{{ color }}</option> {%  endfor %}</select></th>
  34.             {% if is_granted('ROLE_SUPER_ADMIN') and shop is not defined %}
  35.                 <th>
  36.                     <select class="form-select" name="shop" onchange="submit()">
  37.                         <option value="">Any</option>
  38.                         {%  for shopId, shop in shops %}
  39.                             <option value="{{ shopId }}" {{ shopId==app.request.get("shop")?'selected':'' }}>{{ shop }}</option>
  40.                         {%  endfor %}
  41.                     </select>
  42.                 </th>
  43.             {%  endif %}
  44.             <th><select class="form-select" name="grade" onchange="submit()"><option value="">Any</option>{%  for gradeId, grade in grades %}<option value="{{ gradeId }}" {{ gradeId==app.request.get("grade")?'selected':'' }}>{{ grade }}</option> {%  endfor %}</select></th>
  45.             {% if is_granted('ROLE_ADMIN') %}
  46.                 <th class="text-center text-nowrap">{{ "In"|trans }}<br/> HT</th>
  47.                 <th class="text-center text-nowrap">{{ "Out"|trans }}<br/> HT</th>
  48.                 <th class="text-center text-nowrap">{{ "Public conseillé"|trans }}<br/> HT</th>
  49.                 <th class="text-center text-nowrap">{{ "Public conseillé"|trans }}<br/> TTC</th>
  50.             {%  else %}
  51.                 {%  if app.user.shop and app.user.shop.getSetting('is-point-of-sale')==false %}
  52.                     <th class="text-center text-nowrap">{{ "Out"|trans }}<br/> HT</th>
  53.                 {%  endif %}
  54.                 {%  if app.user.shop and app.user.shop.getSetting('show-public-prices')==true %}
  55.                     <th class="text-center text-nowrap">{{ "Public conseillé"|trans }}<br/> HT</th>
  56.                     <th class="text-center text-nowrap">{{ "Public conseillé"|trans }}<br/> TTC</th>
  57.                 {% endif %}
  58.             {% endif %}
  59.             <th></th>
  60.         </tr>
  61.         </thead>
  62.         <tbody>
  63.         {% for stock in stocks %}
  64.             <tr class="product-row" data-stock="{{ stock.id }}" data-model="{{ stock.model.id }}" data-color="{{ stock.color.id }}" data-grade="{{ stock.grade }}" data-qty="{{ stock.qty<=-1?1:stock.qty }}">
  65.                 <td>{{ stock.model.manufacturer.name }}</td>
  66.                 <td>{{ stock.model.category }}</td>
  67.                 <td style="width: 20rem">{{ stock.model.name }}</td>
  68.                 <td>{{ stock.color.name }}</td>
  69.                 {% if is_granted('ROLE_SUPER_ADMIN') and shop is not defined %}
  70.                     <td >{{ stock.shop.name }}</td>
  71.                 {%  endif %}
  72.                 <td>{{ stock.grade }}</td>
  73.                 {% if is_granted('ROLE_ADMIN') %}
  74.                     <td class="text-end">{{ (stock.price / 100)|format_number({fraction_digit: 2})  }}</td>
  75.                     <td class="text-end">{{ (stock.userPrice / 100)|format_number({fraction_digit: 2})  }}</td>
  76.                     <td class="text-end">{{ (stock.publicPrice/ 100)|format_number({fraction_digit: 2})  }}</td>
  77.                     <td class="text-end">{{ ((stock.publicPrice*1.2)/ 100)|format_number({fraction_digit: 2})  }}</td>
  78.                 {%  else %}
  79.                     {%  if app.user.shop and app.user.shop.getSetting('is-point-of-sale')==false %}
  80.                         <td class="text-end">{{ (stock.userPrice / 100)|format_number({fraction_digit: 2})  }}</td>
  81.                     {%  endif %}
  82.                     {%  if app.user.shop and app.user.shop.getSetting('show-public-prices')==true %}
  83.                         <td class="text-end">{{ (stock.publicPrice/ 100)|format_number({fraction_digit: 2})  }}</td>
  84.                         <td class="text-end">{{ ((stock.publicPrice*1.2)/ 100)|format_number({fraction_digit: 2})  }}</td>
  85.                     {%  endif %}
  86.                 {%  endif %}
  87.                 <td id="st_{{ stock.id }}" class="text-end " style="background-color: {{ stock.qty>0?'#20c997':'#ffcd39'}}">{{ stock.qty<=-1?'7 jours':stock.qty }}</td>
  88.                 <td class="text-nowrap">
  89.                     {% if is_granted('ROLE_SUPER_ADMIN') %}
  90.                         <a class="btn btn-outline-secondary" href="{{ path('app_model_edit',{'id':stock.model.id}) }}" >Edit</a>
  91.                     {%  else %}
  92.                         <div class="input-group input-group-sm ">
  93.                             <input type="number" size="2" min='0' max="{{ stock.qty<=-1?1:stock.qty }}"  value="" class="form-control qty"/>
  94.                             <a class="btn btn-outline-secondary addToCart" ><i class="bi bi-cart-plus"></i></a>
  95.                         </div>
  96.                     {% endif %}
  97.                 </td>
  98.             </tr>
  99.         {% else %}
  100.             <tr>
  101.                 <td colspan="8">{{ "no records found"|trans }}</td>
  102.             </tr>
  103.         {% endfor %}
  104.         </tbody>
  105.     </table>
  106. </form>