|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469 |
- {% macro card_start(zone = "default", card ='primary', fullWidth = false, tools = false ) %}
- <div class="card card-{{ card }}">
- <div class="card-header">
- <h3 class="card-title">
- {% set label = "group."~zone %}
- {{ label|trans({}, 'lcshop')|raw }}
-
- </h3>
- {% if tools %}
- <div class="card-tools">
- {{ tools|raw }}
- </div>
- {% endif %}
- </div>
- <div class="card-body {{ fullWidth == true ? 'p-0' : 'row' }}">
-
- {% endmacro card_start %}
-
- {% macro card_end(overlay = false) %}
- </div>
- {% if overlay %}
- <div v-if="{{ overlay }}==true" class="overlay">
- <i class="fas fa-2x fa-sync-alt"></i>
- </div>
- {% endif %}
- </div>
- {% endmacro card_end %}
-
-
-
-
-
- {% macro startCard(col, zone = "default", card ='primary', fullWidth = false ) %}
- {% if col > 0 %}
- <div class="col-{{ col }}">{% endif %}
- <div class="card card-{{ card }}">
- <div class="card-header">
- <h3 class="card-title">
- {% set label = "group."~zone %}
- {{ label|trans({}, 'lcshop')|raw }}
- </h3>
- </div>
- <div class="card-body {{ fullWidth == true ? 'p-0' : 'row' }}">
-
- {% endmacro startCard %}
-
- {% macro cardOverlay(attr) %}
- </div>
- <div v-if="{{ attr }}==true" class="overlay">
- <i class="fas fa-2x fa-sync-alt"></i>
- </div>
- {% endmacro cardOverlay %}
-
- {% macro endCard(noCol = false) %}
- </div>
- </div>
- {% if noCol == false %}</div>{% endif %}
- {% endmacro endCard %}
-
-
-
-
- {% macro priceField(field, fieldTax, fieldName, behaviorPriceValue) %}
-
- <div class="form-group field-price col-12" v-show="behaviorPrice == '{{ behaviorPriceValue }}'">
- <div class="row">
- <div class="col-12">
- {{ form_label(field) }}
- </div>
- <div class="col-6">
- <div class="form-widget">
- <div class="input-group {{ fieldName }}">
- {{ form_widget(field, {'attr' : {'v-model': fieldName, '@change' : fieldName~'Updated'}}) }}
- <div class="input-group-append">
- <span class="input-group-text">€ HT
- {% if behaviorPriceValue == 'by-reference-unit' %}/ ${ unitReference }{% endif %}
- </span>
- </div>
- </div>
- </div>
- </div>
- <div class="col-6">
- <div class="input-group {{ fieldName }}WithTax">
- {{ form_widget(fieldTax, {'attr' : {'v-model': fieldName ~ 'WithTax', '@change' : fieldName~'WithTaxUpdated'}}) }}
- <div class="input-group-append">
- <span class="input-group-text">€ TTC
- {% if behaviorPriceValue == 'by-reference-unit' %}/ ${ unitReference }{% endif %}
- </span>
- </div>
- </div>
- </div>
- </div>
- </div>
-
- {% endmacro %}
-
- {% macro autoresizeField(field) %}
- <tr>
- <td>{{ form_label(field) }}</td>
- <td>
- <div class="autoresize">
- {{ form_widget(field, {'attr' : {rows : '1'}}) }}
- </div>
- </td>
- </tr>
- {% endmacro autoresizeField %}
-
- {% macro fieldReductionList(form, field, filterOn = false, filterType='string') %}
- <div class="col-12">
- <div class="form-group">
- <div class="form-group">
- {{ form_widget(attribute(form, field~'Active'), {"attr" : {'v-model' : 'reduction'~field|uc_first~'Active' } }) }}
- </div>
- <div class="form-widget" v-show="reduction{{ field|uc_first }}Active == true">
- {% set attr = {
- 'ref' : 'reduction'~field|uc_first ,
- 'v-model' : 'reduction'~field|uc_first
- } %}
- {{ form_widget(attribute(form, field), {"attr" : attr }) }}
- </div>
- </div>
- </div>
- {% endmacro fieldReductionList %}
-
- {% macro fieldReductionDateRange(form) %}
- <div class="col-12">
- <div class="form-group">
- <div class="form-group">
- {{ form_widget(form.permanent, {"attr" : {'v-model' : 'reductionPermanent' } }) }}
- </div>
- <div class="input-group" v-show="reductionPermanent == false">
- <div class="input-group-prepend">
- <span class="input-group-text"><i class="far fa-clock"></i></span>
- </div>
- <input type="text" class="form-control float-right date-time-range">
- <div class="hidden date-time-range-fields" style="display: none;">
- {{ form_widget(form.dateStart, {"attr" : {'class' : 'date-start'}}) }}
- {{ form_widget(form.dateEnd, {"attr" : {'class' : 'date-end'}}) }}
- </div>
- </div>
-
- </div>
- </div>
- {% endmacro fieldReductionDateRange %}
-
- {% macro fieldReductionValue(form) %}
- <div class="col-6">
- <div class="form-group">
- {{ form_label(form.value) }}
- <div class="input-group">
- {{ form_widget(form.value, {"attr" : {":required": "reductionActive", 'v-model' : 'reductionValue'}}) }}
- <div class="input-group-append">
- <span class="input-group-text">
- <span v-if="reductionUnit =='amount'">€</span>
- <span v-else-if="reductionUnit =='percent'">%</span>
- </span>
- </div>
- </div>
- </div>
- </div>
- {% endmacro fieldReductionValue %}
-
- {% macro fieldReductionBehaviorTaxRate(form) %}
- <div class="col-6" :class="reductionUnit == 'amount' ? '' : 'hidden'">
- {{ form_row(form.behaviorTaxRate, {"attr" : {":required": "reductionActive && reductionUnit=='amount'", 'v-model' : 'reductionBehaviorTaxRate'}}) }}
- </div>
- {% endmacro fieldReductionBehaviorTaxRate %}
-
- {% macro fieldReductionUnit(form) %}
- <div class="col-12">
- <div class="form-group">
- {{ form_label(form.unit) }}
- {% for field in form.unit %}
- {{ form_widget(field, {"attr" : {":required": "reductionActive", "v-model" : 'reductionUnit'}}) }}
- {% endfor %}
- </div>
- </div>
- {% endmacro fieldReductionUnit %}
-
- {% macro reductionCatalogForm(form) %}
- {{ _self.startCard(6, 'ReductionCatalog.info') }}
- <div class="col-12">
- {{ form_row(form.title, {'attr' : {":required": "reductionActive"}}) }}
- </div>
- {{ _self.fieldReductionUnit(form) }}
- {{ _self.fieldReductionValue(form) }}
- {{ _self.fieldReductionBehaviorTaxRate(form) }}
-
- {{ _self.endCard() }}
- {{ _self.startCard(6, 'ReductionCatalog.conditions','success') }}
-
- {{ _self.fieldReductionDateRange(form) }}
- {{ _self.fieldReductionList(form, 'groupUsers') }}
- {{ _self.fieldReductionList(form, 'users') }}
- {% if form.suppliers is defined %}
- {{ _self.fieldReductionList(form, 'suppliers') }}
- {% endif %}
- {% if form.productCategories is defined %}
- {{ _self.fieldReductionList(form, 'productCategories') }}
- {% endif %}
- {% if form.productFamilies is defined %}
- {{ _self.fieldReductionList(form, 'productFamilies') }}
- {% endif %}
-
- {{ _self.endCard() }}
-
- {% endmacro reductionCatalogForm %}
-
- {% macro reductionCatalogFormValues(formValues, isProductFamilyForm= false) %}
- <script>
- window.mixinReductionValues = {
- {% if formValues.status == false and isProductFamilyForm %}reductionActive: false,{% endif %}
- {% if formValues.permanent is not null and formValues.permanent == false %}reductionPermanent: false,{% endif %}
- {% if formValues.behaviorTaxRate %}reductionBehaviorTaxRate: '{{ formValues.behaviorTaxRate }}',{% endif %}
- {% if formValues.value %}reductionValue: parseFloat({{ formValues.value }}),{% endif %}
- {% if formValues.unit %}reductionUnit: "{{ formValues.unit }}",{% endif %}
- {% if formValues.groupUsers is not empty %}reductionGroupUsersActive: true,{% endif %}
- {% if formValues.groupUsers is not empty %}reductionGroupUsers: {{ formValues.groupUsers|json_encode }},{% endif %}
- {% if formValues.users is not empty %}reductionUsersActive: true,{% endif %}
- {% if formValues.users is not empty %}reductionUsers: {{ formValues.users|json_encode }},{% endif %}
- {% if formValues.suppliers is not empty %}reductionSuppliersActive: true,{% endif %}
- {% if formValues.suppliers is not empty %}reductionSuppliers: {{ formValues.suppliers|json_encode }},{% endif %}
- {% if formValues.productFamilies is not empty %}reductionProductFamiliesActive: true,{% endif %}
- {% if formValues.productFamilies is not empty %}reductionProductFamilies: {{ formValues.productFamilies|json_encode }},{% endif %}
- {% if formValues.productCategories is not empty %}reductionProductCategoriesActive: true,{% endif %}
- {% if formValues.productCategories is not empty %}reductionProductCategories: {{ formValues.productCategories|json_encode }},{% endif %}
- }
- </script>
- {% endmacro reductionCatalogFormValues %}
-
-
- {% macro box_info(class="bg-info", icon, label, value, button=false) %}
- {% embed '@LcShop/backend/default/block/embed_box.twig' %}
- {% trans_default_domain 'lcshop' %}
- {% block class %}{{ class }}{% endblock %}
- {% block icon %}{{ icon }}{% endblock %}
- {% block label %}{{ label|raw }}{% endblock %}
- {% block value %}{{ value|raw }}{% endblock %}
- {% if button %}
- {% block button %}{{ button|raw }}{% endblock %}
- {% endif %}
- {% endembed %}
- {% endmacro box_info %}
-
-
- {% macro form_row_append(field, append) %}
- <div class="form-group">
- {{ form_label(field) }}
- {{ _self.form_widget_append(field, append) }}
- </div>
- {% endmacro form_row_append %}
- {% macro form_widget_append(field, append) %}
- <div class="form-widget">
- <div class="input-group">
- {{ form_widget(field) }}
- <div class="input-group-append">
- <span class="input-group-text">{{ append }}</span>
- </div>
- </div>
- {{ form_help(field) }}
- </div>
- {% endmacro form_widget_append %}
-
- {% macro available_quantity_product(product) %}
-
- {% if product.productFamily.behaviorCountStock == constant("Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY") %}
- {{ product.productFamily.availableQuantity }}
- {% elseif product.productFamily.behaviorCountStock == constant("Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE") %}
- {{ product.productFamily.availableQuantity }}
- / {{ product.productFamily.unit.unitReference }}
-
- {% elseif product.productFamily.behaviorCountStock == constant("Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT") %}
- {{ product.availableQuantity }}
-
- {% endif %}
-
- {% endmacro available_quantity_product %}
-
-
- {% macro button(entity, action, id=null, class="success", title=null, icon=null) %}
-
- {% if title %}
- {% set trad = title %}
- {% else %}
- {% set trad = 'action.'~action %}
- {% endif %}
-
- {% if icon is null %}
- {% if action=="edit" %}{% set icon = 'pen' %}
- {% elseif action=="show" %}{% set icon = 'eye' %}
- {% endif %}
- {% endif %}
- {% set param = {action : action, entity: entity, referer: app.request.requestUri} %}
- {% if id %}{% set param = param|merge({id: id}) %}{% endif %}
- <a class="btn-sm btn-{{ class }}" data-toggle="tooltip" title="{{ trad|trans({}, "lcshop") }}"
- href="{{ path('easyadmin', param) }}">
- <i class="fas fa-{{ icon }}"></i>
- </a>
-
- {% endmacro button %}
- {% macro list_tickets(tickets) %}
- <table class="table table-condensed">
- <thead>
- <tr>
- <th>Sujet</th>
- <th>Statut</th>
- <th>Dernier message</th>
- <th></th>
- </tr>
- </thead>
- <tbody>
- {% for ticket in tickets %}
- <tr>
- <td>{{ ticket.subject }}</td>
- <td>
- {% set value = ticket.status %}
- {% include '@LcShop/backend/default/field/ticket_status.html.twig' %}
- </td>
- <td>
- {% set item = ticket %}
- {% include '@LcShop/backend/default/field/ticket_last_message.html.twig' %}
- </td>
- <td>
- {{ _self.button('Ticket', 'show', ticket.id) }}
- </td>
- </tr>
- {% endfor %}
- </tbody>
- </table>
- {% endmacro list_tickets %}
-
-
-
- {% macro list_reduction_credits(reductionCredits) %}
- <table class="table table-condensed">
- <thead>
- <tr>
- <th>Titre</th>
- <th>Montant</th>
- <th>En ligne</th>
- <th>Utilisé</th>
- <th></th>
- </tr>
- </thead>
- <tbody>
- {% for reductionCredit in reductionCredits %}
- {% set isUsed = orderUtils.isReductionCreditUsed(reductionCredit) %}
- <tr>
- <td>{{ reductionCredit.title }}</td>
- <td>
- {{ reductionCredit.value|format_price(false) }}
- </td>
- <td>
- {% include '@EasyAdmin/default/field_boolean.html.twig' with {value: reductionCredit.status} %}
- </td>
- <td>
- {% include '@EasyAdmin/default/field_boolean.html.twig' with {value: isUsed} %}
- </td>
- <td>
- {% if isUsed == false %}
- {{ _self.button('ReductionCredit', 'edit', reductionCredit.id, 'primary') }}
- {% endif %}
- </td>
- </tr>
- {% endfor %}
- </tbody>
- </table>
- {% endmacro list_reduction_credits %}
-
-
- {% macro list_reduction_carts(reductionCarts, user = false) %}
- <table class="table table-condensed">
- <thead>
- <tr>
- <th>Titre</th>
- <th>Montant</th>
- <th>Quantité utilisé</th>
- <th>Quantité restante</th>
- <th>En ligne</th>
- <th>Actions</th>
- </tr>
- </thead>
- <tbody>
- {% for reductionCart in reductionCarts %}
- <tr>
- <td>{{ reductionCart.title }}</td>
- <td>
- {% if reductionCart.value > 0 %}
- {{ reductionCart.value }}
- {% if reductionCart.unit == 'percent' %}%{% else %}€{% endif %}
-
- {% if reductionCart.appliedTo is defined and reductionCart.appliedTo|length > 0 %}
- sur
- {% if reductionCart.appliedTo == 'order-products' %}
- les produits
- {% endif %}
- {% endif %}
-
- ({% if reductionCart.behaviorTaxRate == 'tax-included' %}TTC{% else %}HT{% endif %})
- {% endif %}
-
- {% if reductionCart.freeShipping %}
- {% if reductionCart.value > 0 %}<br/>{% endif %}
- Livraison offerte
- {% endif %}
- </td>
-
- <td>
- {% if user is not null %}
- {% set totalUsed = orderUtils.getReductionCartUsedQuantityPerUser(reductionCart, user) %}
- {{ totalUsed }}
- {% endif %}
-
- </td>
- <td>
- {% if user is not null %}
- {{ reductionCart.availableQuantityPerUser - totalUsed }}
- {% endif %}
- </td>
- <td>
- {% include '@EasyAdmin/default/field_boolean.html.twig' with {value: reductionCart.status} %}
- </td>
- <td>
- {{ _self.button('ReductionCart', 'edit', reductionCart.id, 'primary') }}
- </td>
-
- </tr>
- {% endfor %}
- </tbody>
- </table>
- {% endmacro list_reduction_carts %}
-
-
-
- {% macro box_user_info(user) %}
- {% embed '@LcShop/backend/default/block/embed_box.twig' %}
- {% trans_default_domain 'lcshop' %}
- {% block class %}bg-info{% endblock %}
- {% block icon %}user{% endblock %}
- {% block label %}{{ "group.User.item"|trans({}, 'lcshop') }}{% endblock %}
- {% block value %}
- #{{ user.id }}
- {{ user.gender == 1 ? 'Mme.' : 'M.' }} {{ user.name }} {{ user.age < 200 ? '('~user.age~' ans)' : ''}}<br />
- {{ user.email }}<br />
-
- <span style="margin-top: 5px; display: inline-block;">
- <span data-toggle="tooltip" data-placement="bottom" title="Nombre de commandes" class="badge badge-info">
- {{ orderUtils.countValidOrderShopByUser(user) }} <i class="fa fa-shopping-cart"></i>
- </span>
- <span data-toggle="tooltip" data-placement="bottom" title="Total dépensés" class="badge badge-success">
- {{ orderUtils.getTotalSpentByUser(user) }} <i class="fa fa-euro-sign"></i>
- </span>
-
- <span data-toggle="tooltip" data-placement="bottom" title="Nombre de relivraisons" class="badge badge-warning">
- {{ orderUtils.countRedeliveryByUser(user) }} <i class="fa fa-undo"></i>
- </span>
- <span data-toggle="tooltip" data-placement="bottom" title="Nombre d'avoirs" class="badge badge-danger">
- {{ user.reductionCredits|length }} <i class="fa fa-backspace"></i>
- </span>
- </span>
-
- {% endblock %}
- {% block button %}
- <a class="btn btn-sm btn-secondary" href="{{ path('easyadmin', {"action" : 'show', 'entity': 'User', 'id': user.id}) }}">
- Voir la fiche
- </a>
- {% endblock %}
- {% endembed %}
- {% endmacro box_user_info %}
|