<h1>{{ 'Stock'|trans }}</h1><form id="stock"> <table class="table table-bordered table-striped"> <thead> <tr> <th class="text-center"><label for="brand">{{ "Brand"|trans}}</label></th> <th class="text-center"><label for="category">{{ "Category"|trans }}</label></th> <th class="text-center"><label for="model">{{ "Model"|trans }}</label></th> <th class="text-center"><label for="color">{{ "Color"|trans }}</label></th> {% if is_granted('ROLE_SUPER_ADMIN') and shop is not defined %} <th class="text-center"><label>{{ "Shop"|trans }}</label></th> {% endif %} <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> {% if is_granted('ROLE_ADMIN') %} <th class="text-center" colspan="4"><label>{{ "Price"|trans }}</label></th> {% else %} {% set colspan =0 %} {% if app.user.shop and app.user.shop.getSetting('is-point-of-sale')==false %} {% set colspan=1 %} {% endif %} {% if app.user.shop and app.user.shop.getSetting('show-public-prices') %} {% set colspan=colspan+2 %} {% endif %} <th class="text-center" colspan="{{ colspan }}"><label>{{ "Price"|trans }}</label></th> {% endif %} <th class="text-center"><label>{{ "Qty"|trans }}</label></th> <th></th> </tr> <tr> <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> <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> <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> <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> {% if is_granted('ROLE_SUPER_ADMIN') and shop is not defined %} <th> <select class="form-select" name="shop" onchange="submit()"> <option value="">Any</option> {% for shopId, shop in shops %} <option value="{{ shopId }}" {{ shopId==app.request.get("shop")?'selected':'' }}>{{ shop }}</option> {% endfor %} </select> </th> {% endif %} <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> {% if is_granted('ROLE_ADMIN') %} <th class="text-center text-nowrap">{{ "In"|trans }}<br/> HT</th> <th class="text-center text-nowrap">{{ "Out"|trans }}<br/> HT</th> <th class="text-center text-nowrap">{{ "Public conseillé"|trans }}<br/> HT</th> <th class="text-center text-nowrap">{{ "Public conseillé"|trans }}<br/> TTC</th> {% else %} {% if app.user.shop and app.user.shop.getSetting('is-point-of-sale')==false %} <th class="text-center text-nowrap">{{ "Out"|trans }}<br/> HT</th> {% endif %} {% if app.user.shop and app.user.shop.getSetting('show-public-prices')==true %} <th class="text-center text-nowrap">{{ "Public conseillé"|trans }}<br/> HT</th> <th class="text-center text-nowrap">{{ "Public conseillé"|trans }}<br/> TTC</th> {% endif %} {% endif %} <th></th> </tr> </thead> <tbody> {% for stock in stocks %} <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 }}"> <td>{{ stock.model.manufacturer.name }}</td> <td>{{ stock.model.category }}</td> <td style="width: 20rem">{{ stock.model.name }}</td> <td>{{ stock.color.name }}</td> {% if is_granted('ROLE_SUPER_ADMIN') and shop is not defined %} <td >{{ stock.shop.name }}</td> {% endif %} <td>{{ stock.grade }}</td> {% if is_granted('ROLE_ADMIN') %} <td class="text-end">{{ (stock.price / 100)|format_number({fraction_digit: 2}) }}</td> <td class="text-end">{{ (stock.userPrice / 100)|format_number({fraction_digit: 2}) }}</td> <td class="text-end">{{ (stock.publicPrice/ 100)|format_number({fraction_digit: 2}) }}</td> <td class="text-end">{{ ((stock.publicPrice*1.2)/ 100)|format_number({fraction_digit: 2}) }}</td> {% else %} {% if app.user.shop and app.user.shop.getSetting('is-point-of-sale')==false %} <td class="text-end">{{ (stock.userPrice / 100)|format_number({fraction_digit: 2}) }}</td> {% endif %} {% if app.user.shop and app.user.shop.getSetting('show-public-prices')==true %} <td class="text-end">{{ (stock.publicPrice/ 100)|format_number({fraction_digit: 2}) }}</td> <td class="text-end">{{ ((stock.publicPrice*1.2)/ 100)|format_number({fraction_digit: 2}) }}</td> {% endif %} {% endif %} <td id="st_{{ stock.id }}" class="text-end " style="background-color: {{ stock.qty>0?'#20c997':'#ffcd39'}}">{{ stock.qty<=-1?'7 jours':stock.qty }}</td> <td class="text-nowrap"> {% if is_granted('ROLE_SUPER_ADMIN') %} <a class="btn btn-outline-secondary" href="{{ path('app_model_edit',{'id':stock.model.id}) }}" >Edit</a> {% else %} <div class="input-group input-group-sm "> <input type="number" size="2" min='0' max="{{ stock.qty<=-1?1:stock.qty }}" value="" class="form-control qty"/> <a class="btn btn-outline-secondary addToCart" ><i class="bi bi-cart-plus"></i></a> </div> {% endif %} </td> </tr> {% else %} <tr> <td colspan="8">{{ "no records found"|trans }}</td> </tr> {% endfor %} </tbody> </table></form>