@@ -208,7 +208,6 @@ class ProductFamilyController extends AdminController | |||
protected function editAction() | |||
{ | |||
$this->dispatch(EasyAdminEvents::PRE_EDIT); | |||
$id = $this->request->query->get('id'); | |||
@@ -265,7 +264,7 @@ class ProductFamilyController extends AdminController | |||
if ($editForm->get('stayOnPage')->getData() != "false" || $this->request->get('submitAndStay') !== null) { | |||
$refererUrl = $this->request->query->get('referer', ''); | |||
return $this->redirectToRoute('easyadmin', ['entity' => 'ProductFamily', 'action' => 'edit', 'id' => $id, 'referer' => $refererUrl]); | |||
return $this->redirectToRoute('easyadmin', ['entity' => 'ProductFamily', 'action' => 'edit', 'id' => $id, 'referer' => $refererUrl, 'ajax' => $this->request->query->get('ajax')]); | |||
} else { | |||
return $this->redirectToReferrer(); | |||
} |
@@ -46,6 +46,11 @@ trait PriceTrait | |||
return $this->getTaxRate() ; | |||
} | |||
public function getBuyingPriceInherited(): ?float | |||
{ | |||
return $this->getBuyingPrice() ; | |||
} | |||
public function getBuyingPrice(): ?float | |||
{ | |||
return $this->buyingPrice; |
@@ -887,4 +887,24 @@ abstract class ProductFamily extends AbstractDocumentEntity implements ProductPr | |||
return $this; | |||
} | |||
public function getFieldBuyingPrice() | |||
{ | |||
if($this->getBehaviorPrice() === self::BEHAVIOR_PRICE_BY_PIECE) { | |||
return 'buyingPrice' ; | |||
} | |||
elseif($this->getBehaviorPrice() === self::BEHAVIOR_PRICE_BY_REFERENCE_UNIT) { | |||
return 'buyingPriceByRefUnit' ; | |||
} | |||
} | |||
public function getFieldPrice() | |||
{ | |||
if($this->getBehaviorPrice() === self::BEHAVIOR_PRICE_BY_PIECE) { | |||
return 'price' ; | |||
} | |||
elseif($this->getBehaviorPrice() === self::BEHAVIOR_PRICE_BY_REFERENCE_UNIT) { | |||
return 'priceByRefUnit' ; | |||
} | |||
} | |||
} |
@@ -40,14 +40,16 @@ trait ProductPropertyTrait | |||
*/ | |||
protected $propertyExpirationDate; | |||
public function getBuyingPriceByRefUnit(): ?float | |||
{ | |||
return $this->buyingPriceByRefUnit; | |||
} | |||
public function getBuyingPriceByRefUnitInherited(): ?float | |||
{ | |||
return $this->getBuyingPriceByRefUnit() ; | |||
} | |||
public function setBuyingPriceByRefUnit(?float $buyingPriceByRefUnit): self | |||
{ | |||
$this->buyingPriceByRefUnit = $buyingPriceByRefUnit; |
@@ -674,13 +674,39 @@ table th .select2-container--default .select2-selection--single { | |||
border-color: #222; | |||
} | |||
/* line 244, ../../sass/backend/custom.scss */ | |||
.layout-ajax #edit-productfamily-form .card-sections { | |||
width: 100%; | |||
position: fixed; | |||
left: 0px; | |||
top: 0px; | |||
z-index: 10; | |||
} | |||
/* line 252, ../../sass/backend/custom.scss */ | |||
.layout-ajax #edit-productfamily-form .form { | |||
padding-top: 50px; | |||
} | |||
/* line 256, ../../sass/backend/custom.scss */ | |||
.layout-ajax #edit-productfamily-form .card-footer { | |||
display: none; | |||
} | |||
/* line 261, ../../sass/backend/custom.scss */ | |||
.layout-ajax #edit-productfamily-form .in-advanced-editing-table .form { | |||
padding-top: 0px; | |||
} | |||
/* line 264, ../../sass/backend/custom.scss */ | |||
.layout-ajax #edit-productfamily-form .in-advanced-editing-table .card-sections, | |||
.layout-ajax #edit-productfamily-form .in-advanced-editing-table .row-note { | |||
display: none; | |||
} | |||
/* ORDER */ | |||
/* line 246, ../../sass/backend/custom.scss */ | |||
/* line 274, ../../sass/backend/custom.scss */ | |||
.table-order-summary { | |||
width: 100%; | |||
} | |||
/* line 249, ../../sass/backend/custom.scss */ | |||
/* line 277, ../../sass/backend/custom.scss */ | |||
.order-product-item.redelivery { | |||
background: rgba(18, 104, 253, 0.38) !important; | |||
} | |||
@@ -688,36 +714,36 @@ table th .select2-container--default .select2-selection--single { | |||
/*.select2-container--bootstrap .select2-selection{max-width: none;}*/ | |||
/*.order-product-item{margin: 15px 0; padding: 0;}*/ | |||
/* Product */ | |||
/* line 254, ../../sass/backend/custom.scss */ | |||
/* line 282, ../../sass/backend/custom.scss */ | |||
.product-form-modal { | |||
display: none; | |||
} | |||
/* line 255, ../../sass/backend/custom.scss */ | |||
/* line 283, ../../sass/backend/custom.scss */ | |||
.product-form.modal .form-check-label { | |||
font-style: italic; | |||
color: #666; | |||
text-align: left; | |||
} | |||
/* line 256, ../../sass/backend/custom.scss */ | |||
/* line 284, ../../sass/backend/custom.scss */ | |||
.products-collection-table .inherited { | |||
color: #888; | |||
font-style: italic; | |||
font-weight: initial; | |||
} | |||
/* line 257, ../../sass/backend/custom.scss */ | |||
/* line 285, ../../sass/backend/custom.scss */ | |||
.products-collection-table td { | |||
position: relative; | |||
} | |||
/* line 258, ../../sass/backend/custom.scss */ | |||
/* line 286, ../../sass/backend/custom.scss */ | |||
.card-body.p-0 .products-collection-table tbody > tr > td:first-of-type, .card-body.p-0 .products-collection-table tbody > tr > th:first-of-type, .card-body.p-0 .products-collection-table thead > tr > td:first-of-type, .card-body.p-0 .products-collection-table thead > tr > th:first-of-type { | |||
padding-left: 0.35rem; | |||
} | |||
/* line 259, ../../sass/backend/custom.scss */ | |||
/* line 287, ../../sass/backend/custom.scss */ | |||
.products-collection-table .btn-empty-field { | |||
position: absolute; | |||
right: 3px; | |||
@@ -726,14 +752,14 @@ table th .select2-container--default .select2-selection--single { | |||
padding: 0px; | |||
} | |||
/* line 260, ../../sass/backend/custom.scss */ | |||
/* line 288, ../../sass/backend/custom.scss */ | |||
#lc-product-family-edit .products-collection-table { | |||
table-layout: fixed; | |||
/* background-clip: padding-box;*/ | |||
border-collapse: collapse; | |||
} | |||
/* line 261, ../../sass/backend/custom.scss */ | |||
/* line 289, ../../sass/backend/custom.scss */ | |||
#lc-product-family-edit .products-collection-table th { | |||
font-size: 13px; | |||
border-left: 1px solid #dee2e6; | |||
@@ -743,22 +769,22 @@ table th .select2-container--default .select2-selection--single { | |||
position: relative; | |||
} | |||
/* line 262, ../../sass/backend/custom.scss */ | |||
/* line 290, ../../sass/backend/custom.scss */ | |||
#lc-product-family-edit .products-collection-table tfoot th { | |||
border-top: 2px solid #dee2e6; | |||
} | |||
/* line 263, ../../sass/backend/custom.scss */ | |||
/* line 291, ../../sass/backend/custom.scss */ | |||
#lc-product-family-edit .products-collection-table th span { | |||
white-space: initial; | |||
} | |||
/* line 264, ../../sass/backend/custom.scss */ | |||
/* line 292, ../../sass/backend/custom.scss */ | |||
#lc-product-family-edit .products-collection-table th:last-child { | |||
border-right: 1px solid #dee2e6; | |||
} | |||
/* line 265, ../../sass/backend/custom.scss */ | |||
/* line 293, ../../sass/backend/custom.scss */ | |||
#lc-product-family-edit .products-collection-table td { | |||
border-left: 1px solid #dee2e6; | |||
text-align: center; | |||
@@ -766,26 +792,26 @@ table th .select2-container--default .select2-selection--single { | |||
border-bottom: 1px solid #dee2e6; | |||
} | |||
/* line 266, ../../sass/backend/custom.scss */ | |||
/* line 294, ../../sass/backend/custom.scss */ | |||
#lc-product-family-edit .products-collection-table td:last-child { | |||
border-right: 1px solid #dee2e6; | |||
white-space: nowrap; | |||
} | |||
/* line 267, ../../sass/backend/custom.scss */ | |||
/* line 295, ../../sass/backend/custom.scss */ | |||
#lc-product-family-edit .btn-add-product { | |||
margin: 20px 0; | |||
float: right; | |||
} | |||
/* line 268, ../../sass/backend/custom.scss */ | |||
/* line 296, ../../sass/backend/custom.scss */ | |||
#lc-product-family-edit .inherited { | |||
color: #888; | |||
font-style: italic; | |||
font-weight: initial; | |||
} | |||
/* line 269, ../../sass/backend/custom.scss */ | |||
/* line 297, ../../sass/backend/custom.scss */ | |||
#lc-product-family-edit .products-collection-table td .value { | |||
min-width: 80%; | |||
margin: auto; | |||
@@ -793,79 +819,79 @@ table th .select2-container--default .select2-selection--single { | |||
cursor: pointer; | |||
} | |||
/* line 270, ../../sass/backend/custom.scss */ | |||
/* line 298, ../../sass/backend/custom.scss */ | |||
#lc-product-family-edit .products-collection-table td .modal { | |||
text-align: left; | |||
} | |||
/* line 271, ../../sass/backend/custom.scss */ | |||
/* line 299, ../../sass/backend/custom.scss */ | |||
table.products-collection-table th.main-info, td.buyingPrice, td.multiplyingFactor, td.priceWithTax { | |||
background: #eeeeee; | |||
background-clip: padding-box; | |||
text-decoration: underline; | |||
} | |||
/* line 273, ../../sass/backend/custom.scss */ | |||
/* line 301, ../../sass/backend/custom.scss */ | |||
table.products-collection-table tr.disabled { | |||
opacity: 0.5; | |||
} | |||
/* line 274, ../../sass/backend/custom.scss */ | |||
/* line 302, ../../sass/backend/custom.scss */ | |||
.table-striped tbody .tr-sep { | |||
border-top: 2px solid #888; | |||
} | |||
/* DeliveryZone */ | |||
/* line 278, ../../sass/backend/custom.scss */ | |||
/* line 306, ../../sass/backend/custom.scss */ | |||
#autocomplete-cities { | |||
position: relative; | |||
} | |||
/* line 282, ../../sass/backend/custom.scss */ | |||
/* line 310, ../../sass/backend/custom.scss */ | |||
#autocomplete-cities .ui-autocomplete { | |||
left: 30%; | |||
top: 41px; | |||
margin-left: 18px; | |||
} | |||
/* line 288, ../../sass/backend/custom.scss */ | |||
/* line 316, ../../sass/backend/custom.scss */ | |||
.head-reminders { | |||
margin-top: 15px; | |||
} | |||
/* TABLEAU DE BORD */ | |||
/* line 291, ../../sass/backend/custom.scss */ | |||
/* line 319, ../../sass/backend/custom.scss */ | |||
.todo-list > li { | |||
position: relative; | |||
} | |||
/* line 292, ../../sass/backend/custom.scss */ | |||
/* line 320, ../../sass/backend/custom.scss */ | |||
.todo-list > li .text { | |||
margin-left: 30px; | |||
} | |||
/* line 293, ../../sass/backend/custom.scss */ | |||
/* line 321, ../../sass/backend/custom.scss */ | |||
.todo-list > li .tools { | |||
position: absolute; | |||
top: 4px; | |||
right: 15px; | |||
} | |||
/* line 295, ../../sass/backend/custom.scss */ | |||
/* line 323, ../../sass/backend/custom.scss */ | |||
#addTicketMessageForm { | |||
margin-top: 30px; | |||
border-top: 2px dotted #eee; | |||
padding-top: 30px; | |||
} | |||
/* line 297, ../../sass/backend/custom.scss */ | |||
/* line 325, ../../sass/backend/custom.scss */ | |||
#dashboard .list-btn-statistic { | |||
display: flex; | |||
flex-wrap: wrap; | |||
justify-content: center; | |||
} | |||
/* line 298, ../../sass/backend/custom.scss */ | |||
/* line 326, ../../sass/backend/custom.scss */ | |||
#dashboard .btn-statistic { | |||
width: 120px; | |||
height: 70px; | |||
@@ -874,62 +900,62 @@ table.products-collection-table tr.disabled { | |||
line-height: 1rem; | |||
} | |||
/* line 299, ../../sass/backend/custom.scss */ | |||
/* line 327, ../../sass/backend/custom.scss */ | |||
#dashboard .btn-statistic small { | |||
margin-bottom: 10px; | |||
display: block; | |||
} | |||
/* line 300, ../../sass/backend/custom.scss */ | |||
/* line 328, ../../sass/backend/custom.scss */ | |||
#dashboard .btn-statistic .value { | |||
display: block; | |||
} | |||
/* line 302, ../../sass/backend/custom.scss */ | |||
/* line 330, ../../sass/backend/custom.scss */ | |||
#dashboard #range_date_interval { | |||
margin-bottom: 20px; | |||
} | |||
/* line 303, ../../sass/backend/custom.scss */ | |||
/* line 331, ../../sass/backend/custom.scss */ | |||
#dashboard #range_date_interval label { | |||
float: left; | |||
margin-right: 20px; | |||
} | |||
/* line 304, ../../sass/backend/custom.scss */ | |||
/* line 332, ../../sass/backend/custom.scss */ | |||
#dashboard #range_date_interval .form-check { | |||
float: left; | |||
margin-right: 10px; | |||
} | |||
/* line 305, ../../sass/backend/custom.scss */ | |||
/* line 333, ../../sass/backend/custom.scss */ | |||
#dashboard .table-condensed .btn, #dashboard .table-condensed .btn-sm { | |||
white-space: nowrap; | |||
} | |||
/* Tickets */ | |||
/* line 311, ../../sass/backend/custom.scss */ | |||
/* line 339, ../../sass/backend/custom.scss */ | |||
#ticket-list .btn-sm { | |||
display: block; | |||
} | |||
/* line 317, ../../sass/backend/custom.scss */ | |||
/* line 345, ../../sass/backend/custom.scss */ | |||
#toast-container { | |||
width: 350px; | |||
} | |||
/* line 318, ../../sass/backend/custom.scss */ | |||
/* line 346, ../../sass/backend/custom.scss */ | |||
.toast { | |||
float: right; | |||
} | |||
/* line 320, ../../sass/backend/custom.scss */ | |||
/* line 348, ../../sass/backend/custom.scss */ | |||
#toast-container:before:hover { | |||
opacity: 1; | |||
cursor: pointer; | |||
} | |||
/* line 324, ../../sass/backend/custom.scss */ | |||
/* line 352, ../../sass/backend/custom.scss */ | |||
#toast-close-all { | |||
border: 0; | |||
position: absolute; |
@@ -1,6 +1,8 @@ | |||
// Reference array sent to dynamic staticRenderFns | |||
var staticRenderFns = []; | |||
$(window).on('load', function () { | |||
/*var appProductFamily ; | |||
lcInitProductFamily() ;*/ | |||
Vue.component('product-unit-price', { | |||
mixins: [mixinUnit, mixinPrice, mixinTemplate], | |||
@@ -331,7 +333,6 @@ $(window).on('load', function () { | |||
watch: {} | |||
}); | |||
appProductFamily = new Vue({ | |||
el: '#lc-product-family-edit', | |||
mixins: [mixinReduction], | |||
@@ -625,5 +626,8 @@ $(window).on('load', function () { | |||
for (var key in formProductTemplate) { | |||
appProductFamily.formProducts[key] = formProductTemplate[key]; | |||
} | |||
}); | |||
function lcInitProductFamily() { | |||
} |
@@ -239,7 +239,35 @@ table th .select2-container--default .select2-selection--single{padding:0.3rem 0 | |||
.field-price .input-group.priceByRefUnitWithTax input,.field-price .input-group.priceByRefUnitWithTax .input-group-text{font-weight: bold; border-color: #222 } | |||
.input-group.multiplyingFactor input,.input-group.multiplyingFactor .input-group-text{font-weight: bold; border-color: #222 } | |||
.layout-ajax { | |||
#edit-productfamily-form { | |||
.card-sections { | |||
width: 100%; | |||
position: fixed; | |||
left: 0px; | |||
top: 0px; | |||
z-index: 10; | |||
} | |||
.form { | |||
padding-top: 50px; | |||
} | |||
.card-footer { | |||
display: none; | |||
} | |||
.in-advanced-editing-table { | |||
.form { | |||
padding-top: 0px ; | |||
} | |||
.card-sections, | |||
.row-note { | |||
display: none; | |||
} | |||
} | |||
} | |||
} | |||
/* ORDER */ | |||
@@ -4,24 +4,33 @@ | |||
{% if action.group is defined and action.group==true %} | |||
{% set dropdownAction = dropdownAction|merge({(loop.index0): action}) %} | |||
{% else %} | |||
{% set display_button = true %} | |||
{% if 'list' == action.name %} | |||
{% set action_href = request_parameters.referer|default('') ? request_parameters.referer|easyadmin_urldecode : path('easyadmin', request_parameters|merge({ action: 'list' })) %} | |||
{% elseif 'method' == action.type %} | |||
{% set action_href = path('easyadmin', request_parameters|merge({ action: action.name, id: item_id })) %} | |||
{% elseif 'route' == action.type %} | |||
{% set action_href = path(action.name, request_parameters|merge({ action: action.name, id: item_id })) %} | |||
{% elseif 'productfamily_advanced_editing' == action.type %} | |||
{% set action_href = path('easyadmin', request_parameters|merge({ action: action.action, id: item_id })) %} | |||
{% if action.name == 'products' and not item.activeProducts %} | |||
{% set display_button = false %} | |||
{% endif %} | |||
{% endif %} | |||
{{ include(action.template, { | |||
action: action, | |||
action_href: action_href, | |||
is_dropdown: is_dropdown|default(false), | |||
item: item, | |||
item_id: item_id, | |||
request_parameters: request_parameters, | |||
translation_domain: translation_domain, | |||
trans_parameters: trans_parameters, | |||
}, with_context = false) }} | |||
{% if display_button %} | |||
{{ include(action.template, { | |||
action: action, | |||
action_href: action_href, | |||
is_dropdown: is_dropdown|default(false), | |||
item: item, | |||
item_id: item_id, | |||
request_parameters: request_parameters, | |||
translation_domain: translation_domain, | |||
trans_parameters: trans_parameters, | |||
}, with_context = false) }} | |||
{% endif %} | |||
{% endif %} | |||
{% endfor %} | |||
{% if dropdownAction|length > 0 %} |
@@ -0,0 +1,34 @@ | |||
{% form_theme form with easyadmin_config('design.form_theme') only %} | |||
{% set _entity_config = easyadmin_entity(app.request.query.get('entity')) %} | |||
{% set _entity_id = attribute(entity, _entity_config.primary_key_field_name) %} | |||
{% trans_default_domain _entity_config.translation_domain %} | |||
{% set _trans_parameters = { '%entity_name%': _entity_config.name|trans, '%entity_label%': _entity_config.label|trans, '%entity_id%': _entity_id } %} | |||
{% extends '@LcShop/backend/default/layout/layout-ajax.html.twig' %} | |||
{% block ajax %} | |||
{% block entity_form %} | |||
{{ form(form) }} | |||
{% endblock entity_form %} | |||
{% block head_stylesheets %} | |||
{{ parent() }} | |||
<link rel="stylesheet" | |||
href="{{ asset('bundles/lcshop/css/backend/adminlte/plugins/jquery-ui/jquery-ui.min.css') }}"> | |||
{% endblock %} | |||
{% block plugin_javascript %} | |||
{{ parent() }} | |||
<script src="{{ asset('bundles/lcshop/js/backend/plugin/jquery-ui/jquery-ui.min.js') }}"></script> | |||
<script type="text/javascript"> | |||
var CKEDITOR_BASEPATH = "{{ ckeditor_base_path("/bundles/fosckeditor/") }}"; | |||
</script> | |||
<script type="text/javascript" src="{{ asset('bundles/fosckeditor/ckeditor.js') }}"></script> | |||
{% endblock %} | |||
{% block script_javascript %} | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/default/init-edit.js') }}"></script> | |||
{% endblock %} | |||
{% endblock %} |
@@ -1,14 +1,9 @@ | |||
{% trans_default_domain 'EasyAdminBundle' %} | |||
<div class="custom-control custom-switch custom-switch-on-success custom-switch-off-danger" data-propertyname="{{ field_options.property }}"> | |||
<input type="checkbox" class="custom-control-input" id="customSwitch{{ item.id }}-{{ field_options.property }}" {{ value == true ? 'checked' }}> | |||
<label class="custom-control-label" for="customSwitch{{ item.id }}-{{ field_options.property }}">{{ field_options.label }}</label> | |||
</div> | |||
{# | |||
{% block toggle %} | |||
<div class="custom-control custom-switch custom-switch-on-success custom-switch-off-danger" data-propertyname="{{ field_options.property }}"> | |||
<input type="checkbox" class="custom-control-input" id="customSwitch{{ item.id }}-{{ field_options.property }}" {{ value == true ? 'checked' }}> | |||
<label class="custom-control-label" for="customSwitch{{ item.id }}-{{ field_options.property }}">{% block label %}{{ field_options.label }}{% endblock %}</label> | |||
</div> | |||
{% endblock %} | |||
{% if value == true %} | |||
<span class="badge badge-success">{{ 'label.true'|trans }}</span> | |||
{% else %} | |||
<span class="badge badge-danger">{{ 'label.false'|trans }}</span> | |||
{% endif %} | |||
#} |
@@ -1,5 +1,28 @@ | |||
{% trans_default_domain "lcshop" %} | |||
<div class="layout-ajax"> | |||
{% block ajax %} | |||
{% block head_stylesheets %} | |||
<link rel="stylesheet" href="{{ asset('bundles/lcshop/css/backend/adminlte/plugins/fontawesome-free/css/all.min.css') }}"> | |||
<link rel="stylesheet" href="{{ asset('bundles/lcshop/css/backend/adminlte/adminlte.css') }}"> | |||
<link rel="stylesheet" href="{{ asset('bundles/lcshop/css/backend/custom.css') }}"> | |||
{% endblock %} | |||
{% endblock %} | |||
{% block plugin_javascript %} | |||
<!-- jQuery --> | |||
<script src="{{ asset('bundles/lcshop/js/backend/plugin/jquery/jquery.min.js') }}"></script> | |||
<!-- Bootstrap 4 --> | |||
<script src="{{ asset('bundles/lcshop/js/backend/plugin/bootstrap/bootstrap.bundle.min.js') }}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/plugin/toastr/toastr.min.js') }}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/plugin/select2/select2.full.min.js') }}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/plugin/bootstrap/bootstrap-switch.min.js') }}"></script> | |||
<!-- AdminLTE App --> | |||
<script src="{{ asset('bundles/lcshop/js/backend/plugin/adminlte.min.js') }}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/default/utils.js') }}"></script> | |||
{% endblock plugin_javascript %} | |||
{% block script_javascript %} | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/default/init-common.js') }}"></script> | |||
{% endblock script_javascript %} | |||
{% endblock %} | |||
</div> |
@@ -87,12 +87,11 @@ | |||
{% set _fields_visible_by_user = fields|filter((metadata, field) => easyadmin_is_granted(metadata.permission)) %} | |||
{% set _number_of_hidden_results = 0 %} | |||
{% set _list_item_actions = easyadmin_get_actions_for_list_item(_entity_config.name) %} | |||
<div class="row"> | |||
<div class="row" id="{% block list_id %}{% endblock %}"> | |||
<div class="col-12"> | |||
<div class="card card-outline card-primary"> | |||
<div class="card-header"> | |||
{% block card_header %} | |||
<h2 class="card-title text-lg "> | |||
<div class="btn-group"> | |||
{% set itemsPerPage = [10,20,30,50,100,200] %} | |||
@@ -322,8 +321,7 @@ | |||
{% else %} | |||
{# the empty string concatenation is needed when the primary key is an object (e.g. an Uuid object) #} | |||
{% set _item_id = '' ~ attribute(item, _entity_config.primary_key_field_name) %} | |||
<tr data-id="{{ _item_id }}"> | |||
<tr id="tr-entity-id-{{ _item_id }}" data-id="{{ _item_id }}"> | |||
{% if _has_batch_actions %} | |||
<td><input type="checkbox" class="form-batch-checkbox" | |||
value="{{ _item_id }}"></td> | |||
@@ -335,8 +333,7 @@ | |||
<td class="{{ isSortingField ? 'sorted' }} {{ metadata.dataType|lower }} {{ metadata.css_class }}" {{ easyadmin_config('design.rtl') ? 'dir="rtl"' }}> | |||
{% if (field == 'title' or field== 'id') and (metadata.dataType=="string" or metadata.dataType=="integer") %} | |||
{% if (field == 'title' or field== 'id') and (metadata.dataType=="string" or metadata.dataType=="integer") and _entity_config.name != 'ProductFamilyAdvancedEditing' %} | |||
<a class="link-as-text" | |||
href="{{ path('easyadmin', _request_parameters|merge({ action: 'edit', id: item.id })) }}"> | |||
{{ easyadmin_render_field_for_list_view(_entity_config.name, item, metadata) }} |
@@ -233,12 +233,12 @@ | |||
{% set _translation_domain = easyadmin.entity.translation_domain %} | |||
{% set _trans_parameters = { '%entity_name%': easyadmin.entity.name|trans(domain = _translation_domain), '%entity_label%': easyadmin.entity.label|trans(domain = _translation_domain) } %} | |||
{# the 'save' action is hardcoded for the 'edit' and 'new' views #} | |||
<button type="submit" name="save_and_leave" class="btn btn-primary action-save"> | |||
<span class="btn-label">{{ 'action.save'|trans(_trans_parameters, _translation_domain) }}</span> | |||
</button> | |||
{% if easyadmin.entity.name =='ProductFamily' %} | |||
<button name="submitAndStay" value="1" type="submit" class="btn btn-success action-save"> | |||
<button name="submitAndStay" value="1" type="submit" class="btn btn-success action-save action-save-and-stay"> | |||
<span class="btn-label">{{ 'action.saveAndStay'|trans(_trans_parameters, _translation_domain) }}</span> | |||
</button> | |||
{% endif %} |
@@ -1,4 +1,6 @@ | |||
{% extends app.request.query.get('action') == 'edit' ? '@LcShop/backend/default/edit.html.twig' : '@LcShop/backend/default/new.html.twig' %} | |||
{% extends app.request.query.get('action') == 'edit' | |||
? (app.request.query.get('ajax') == 1 ? '@LcShop/backend/default/edit-ajax.html.twig' : '@LcShop/backend/default/edit.html.twig') | |||
: '@LcShop/backend/default/new.html.twig' %} | |||
{% block entity_form %} | |||
{% include '@LcShop/backend/productfamily/form.html.twig' %} | |||
@@ -20,5 +22,8 @@ | |||
{% block script_javascript %} | |||
{{ parent() }} | |||
{% include '@LcShop/backend/default/block/script-vuejs.html.twig' %} | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/productfamily/vuejs-product-family.js')|lc_cache }}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/script/productfamily/vuejs-product-family.js') }}"></script> | |||
<script> | |||
lcInitProductFamily() ; | |||
</script> | |||
{% endblock %} |
@@ -3,8 +3,8 @@ | |||
{% import '@LcShop/backend/productfamily/macros.html.twig' as product_family_macros %} | |||
{% set formValues = form.vars.value %} | |||
<div id="lc-product-family-edit"> | |||
<div class="card card-light"> | |||
<div id="lc-product-family-edit" class="{% if app.request.query.get('inAdvancedEditingTable') %}in-advanced-editing-table{% endif %}"> | |||
<div class="card card-light card-sections"> | |||
<div class="lc-vue-js-container card-header p-0 border-bottom-0"> | |||
<ul class="nav nav-tabs" id="nav-params"> | |||
<li class="nav-item" v-for="section in sectionsArray"> | |||
@@ -17,7 +17,6 @@ | |||
<span class="glyphicon glyphicon-triangle-bottom"></span> | |||
<i class="fa fa-exclamation-circle invalid-form"></i> | |||
</a> | |||
</li> | |||
</ul> | |||
</div> | |||
@@ -49,6 +48,8 @@ | |||
{% if formValues.activeProducts %}activeProducts: "{{ formValues.activeProducts }}",{% endif %} | |||
{% if formValues.giftVoucherActive %}giftVoucherActive: "{{ formValues.giftVoucherActive }}",{% endif %} | |||
{% if formValues.productsQuantityAsTitle %}productsQuantityAsTitle: {{ formValues.productsQuantityAsTitle }},{% endif %} | |||
{% set current_section = app.request.query.get('currentSection') %} | |||
{% if current_section is defined and current_section|length > 0 %}currentSection: "{{ current_section }}",{% endif %} | |||
{% if form.sections.vars.value %}section: {{ form.sections.vars.value[0] }},{% endif %} | |||
}; | |||
@@ -104,7 +105,7 @@ | |||
</div> | |||
</div> | |||
{% if entity.note|striptags !="" %} | |||
<div class="row"> | |||
<div class="row row-note"> | |||
{{ macros.startCard(12, 'ProductFamily.note', 'light') }} | |||
{{ entity.note|raw }} | |||
{{ macros.endCard() }} | |||
@@ -114,7 +115,6 @@ | |||
</div> | |||
{{ form_widget(form.stayOnPage, {"attr": {"v-model": "stayOnPage"}}) }} | |||
</div> | |||
{{ form_end(form) }} | |||
@@ -23,7 +23,7 @@ | |||
{{ productFamily.unit.unitReference }} | |||
{% endif %} | |||
</strong> | |||
</span> | |||
</span> | |||
<br /> | |||
{% endfor %} | |||
{% endmacro total_order_product_family %} |
@@ -79,19 +79,42 @@ class ProductPriceUtils | |||
public function getBuyingPrice(ProductPropertyInterface $product) | |||
{ | |||
if ($product->getBehaviorPriceInherited() == 'by-piece') { | |||
return $product->getBuyingPriceInherited(); | |||
return $product->getBuyingPriceInherited() ; | |||
} | |||
elseif ($product->getBehaviorPriceInherited() == 'by-reference-unit') { | |||
if ($product->getQuantityInherited() > 0) { | |||
return $product->getBuyingPriceByRefUnitInherited() * ($product->getQuantityInherited() / $product->getUnitInherited()->getCoefficient()); | |||
}else{ | |||
} | |||
else { | |||
return 0; | |||
} | |||
} | |||
} | |||
public function getMultiplyingFactor(ProductPropertyInterface $product){ | |||
public function getBuyingPriceWithTax(ProductPropertyInterface $product) | |||
{ | |||
return $this->applyTax( | |||
$this->getBuyingPrice($product), | |||
$product->getTaxRateInherited()->getValue() | |||
); | |||
} | |||
public function getBuyingPriceByRefUnit(ProductPropertyInterface $product) | |||
{ | |||
return $product->getBuyingPriceByRefUnitInherited() ; | |||
} | |||
public function getBuyingPriceByRefUnitWithTax(ProductPropertyInterface $product) | |||
{ | |||
return $this->applyTax( | |||
$this->getBuyingPriceByRefUnit($product), | |||
$product->getTaxRateInherited()->getValue() | |||
); | |||
} | |||
public function getMultiplyingFactor(ProductPropertyInterface $product) | |||
{ | |||
return $this->round($this->getPriceWithTax($product) / $this->getBuyingPrice($product)); | |||
} | |||
@@ -181,4 +181,19 @@ class ProductFamilyUtils | |||
} | |||
} | |||
public function getMultiplyingFactor($productFamily) | |||
{ | |||
if($productFamily->getBehaviorPrice() == ProductFamily::BEHAVIOR_PRICE_BY_PIECE) { | |||
if($productFamily->getBuyingPrice() > 0) { | |||
return number_format($this->priceUtils->getPriceWithTax($productFamily) / $productFamily->getBuyingPrice(), 3) ; | |||
} | |||
} | |||
elseif($productFamily->getBehaviorPrice() == ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT) { | |||
if($productFamily->getBuyingPriceByRefUnit() > 0) { | |||
return number_format($this->priceUtils->getPriceByRefUnitWithTax($productFamily) / $productFamily->getBuyingPriceByRefUnit(), 3) ; | |||
} | |||
} | |||
} | |||
} |