first commit
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
class stAllegroDeliveryBackendActions extends autoStAllegroDeliveryBackendActions
|
||||
{
|
||||
public function preExecute()
|
||||
{
|
||||
$config = stConfig::getInstance('stAllegroBackend');
|
||||
$i18n = $this->getContext()->getI18N();
|
||||
|
||||
if (!$config->get('enable'))
|
||||
{
|
||||
$this->setFlash('warning', $i18n->__('Aby korzystać z Allegro musisz je wpierw włączyć w konfiguracji'));
|
||||
return $this->redirect('@stAllegroPlugin?action=config');
|
||||
}
|
||||
|
||||
if ($config->get('access_token'))
|
||||
{
|
||||
try
|
||||
{
|
||||
$api = stAllegroApi::getInstance();
|
||||
$api->getBasicInfoAboutUser();
|
||||
}
|
||||
catch(stAllegroException $e)
|
||||
{
|
||||
$message = stAllegroApi::getLastErrorsAsString('<br>');
|
||||
|
||||
if ($message == 'Unauthorized')
|
||||
{
|
||||
$message = $i18n->__('Błędna autoryzacja, sprawdź poprawność wprowadzonych danych dostępowych do API', null, 'stAllegroBackend');
|
||||
}
|
||||
|
||||
if (strpos($message, 'Invalid refresh token') !== false || strpos($message, 'Access token expired') !== false)
|
||||
{
|
||||
$message = $i18n->__('Token dostępu nie może zostać odświeżony automatycznie proszę ponownie zalogować się do Allegro', null, 'stAllegroBackend');
|
||||
}
|
||||
|
||||
$this->setFlash('error', $message, true);
|
||||
|
||||
return $this->redirect('@stAllegroPlugin?action=config');
|
||||
}
|
||||
}
|
||||
elseif (!$config->get('access_token'))
|
||||
{
|
||||
$this->setFlash('error', $i18n->__('Błędna autoryzacja, sprawdź poprawność wprowadzonych danych dostępowych do API', null, 'stAllegroBackend'));
|
||||
|
||||
return $this->redirect('@stAllegroPlugin?action=config');
|
||||
}
|
||||
}
|
||||
|
||||
protected function saveAllegroApiShippingRate($allegro_api_shipping_rate)
|
||||
{
|
||||
try
|
||||
{
|
||||
parent::saveAllegroApiShippingRate($allegro_api_shipping_rate);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
foreach (stAllegroApi::getLastErrors() as $error)
|
||||
{
|
||||
if ($error->path == "name")
|
||||
{
|
||||
$this->getRequest()->setError('allegro_api_shipping_rate{name}', $error->userMessage);
|
||||
}
|
||||
elseif ($error->path)
|
||||
{
|
||||
$error->path = str_replace("items[", "rates[", $error->path);
|
||||
$this->getRequest()->setError($error->path, $error->userMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->getRequest()->setError('{allegro_api}', $error->userMessage . ' ('. $error->message .')');
|
||||
}
|
||||
}
|
||||
|
||||
// echo "<pre>".var_export(stAllegroApi::getLastErrors(), true)."</pre>";
|
||||
}
|
||||
}
|
||||
|
||||
protected function getLabels()
|
||||
{
|
||||
$labels = parent::getLabels();
|
||||
|
||||
$labels['{allegro_api}'] = 'Allegro API';
|
||||
|
||||
$labels['rates'] = 'Cennik';
|
||||
|
||||
return $labels;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
class stAllegroDeliveryBackendComponents extends autoStAllegroDeliveryBackendComponents {
|
||||
|
||||
public function executeRates() {
|
||||
$api = stAllegroApi::getInstance();
|
||||
|
||||
$deliveryGroups = array(
|
||||
"Allegro InPost" => array(),
|
||||
"Kurier" => array(),
|
||||
"Paczka" => array(),
|
||||
"List" => array(),
|
||||
"Odbiór w punkcie" => array(),
|
||||
"Inny sposób dostawy" => array(),
|
||||
"Wysyłka za granicę" => array(),
|
||||
);
|
||||
|
||||
$methods = $api->getDeliveryMethods();
|
||||
|
||||
usort($methods, function($m1, $m2) {
|
||||
$search = array('Ę','Ó', 'Ą', 'Ś', 'Ł', 'Ż', 'Ź', 'Ć', 'Ń', 'ę', 'ó', 'ą', 'ś', 'ł', 'ż', 'ź', 'ć', 'ń');
|
||||
$replace = array('E', 'O', 'A', 'S', 'L', 'Z', 'Z', 'C', 'N', 'e', 'o', 'a', 's', 'l', 'z', 'z', 'c', 'n');
|
||||
return strnatcmp(str_replace($search, $replace, $m1->name), str_replace($search, $replace, $m2->name));
|
||||
});
|
||||
|
||||
foreach ($methods as $method)
|
||||
{
|
||||
if (!$method->shippingRatesConstraints->allowed)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (in_array($method->name, array("Austria","Belgia","Białoruś","Bułgaria","Chorwacja","Cypr","Czechy","Dania","Estonia","Finlandia","Francja","Grecja","Hiszpania","Holandia","Irlandia","Litwa","Luksemburg","Łotwa","Malta","Niemcy","Norwegia","Portugalia","Rosja","Rumunia","Słowacja","Słowenia","Szwecja","Ukraina","Węgry","Wielka Brytania","Włochy")))
|
||||
{
|
||||
$deliveryGroups["Wysyłka za granicę"][$method->paymentPolicy][$method->id] = $method;
|
||||
}
|
||||
elseif (preg_match('/Allegro miniKurier24|Allegro Kurier24|Allegro Paczkomaty/i', $method->name))
|
||||
{
|
||||
$deliveryGroups["Allegro InPost"][$method->paymentPolicy][$method->id] = $method;
|
||||
}
|
||||
elseif (false !== strpos($method->name, 'Kurier') || preg_match('/Dostawa przez sprzedającego|Przesyłka kurierska/i', $method->name))
|
||||
{
|
||||
$deliveryGroups["Kurier"][$method->paymentPolicy][$method->id] = $method;
|
||||
}
|
||||
elseif (preg_match('/Paczka pocztowa ekonomiczna|Paczka pocztowa priorytetowa|Paczka24|Paczka48/i', $method->name) && false === strpos($method->name, 'Odbiór w Punkcie'))
|
||||
{
|
||||
$deliveryGroups["Paczka"][$method->paymentPolicy][$method->id] = $method;
|
||||
}
|
||||
elseif (false !== strpos($method->name, 'List'))
|
||||
{
|
||||
$deliveryGroups["List"][$method->paymentPolicy][$method->id] = $method;
|
||||
}
|
||||
elseif (preg_match('/Paczka w RUCHU|Paczka 24 odbiór w punkcie|Punkty Poczta, Żabka, Orlen, Ruch|Paczkomaty 24\/7|Odbiór osobisty w punkcie sprzedawcy|Odbiór w punkcie|Punkty Poczta/i', $method->name))
|
||||
{
|
||||
$deliveryGroups["Odbiór w punkcie"][$method->paymentPolicy][$method->id] = $method;
|
||||
}
|
||||
else
|
||||
{
|
||||
$deliveryGroups["Inny sposób dostawy"][$method->paymentPolicy][$method->id] = $method;
|
||||
}
|
||||
}
|
||||
|
||||
$this->deliveryGroups = $deliveryGroups;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
generator:
|
||||
class: stAdminGenerator
|
||||
param:
|
||||
model_class: AllegroApiShippingRate
|
||||
theme: simple
|
||||
|
||||
head:
|
||||
package: stAllegroPlugin
|
||||
|
||||
list:
|
||||
title: "Cenniki dostaw"
|
||||
display: [name]
|
||||
fields:
|
||||
name: {name: Nazwa}
|
||||
object_actions:
|
||||
_edit: -
|
||||
actions:
|
||||
_create: {name: "Dodaj"}
|
||||
select_actions: []
|
||||
edit:
|
||||
display: [name, ~rates]
|
||||
fields:
|
||||
name: {name: Nazwa}
|
||||
rates: {name: Cennik}
|
||||
actions:
|
||||
_list: {name: "Lista"}
|
||||
_save: {name: "Zapisz"}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php use_helper('stAdminGenerator', 'Object', 'stAllegroDelivery');?>
|
||||
<?php st_include_partial('stAllegroDeliveryBackend/header', array('title' => __('Edycja cennika dostawy', null, 'stAllegroDeliveryBackend')));?>
|
||||
<?php st_include_component('stAllegroBackend', 'configMenu'); ?>
|
||||
|
||||
<div id="sf_admin_content">
|
||||
<?php st_include_partial('stAdminGenerator/message', array('labels' => $labels)) ?>
|
||||
<form action="<?php echo $sf_request->hasParameter('id') ? url_for('@stAllegroDelivery?action=edit&id='.$sf_request->getParameter('id')) : url_for('@stAllegroDelivery?action=edit') ?>" class="admin_form" method="post">
|
||||
<fieldset>
|
||||
<div class="content">
|
||||
<?php echo st_admin_get_form_field('delivery[name]', __("Nazwa"), $delivery['name'], 'input_tag', array('maxlength' => 64, 'size' => 60)) ?>
|
||||
<?php echo st_admin_get_form_field('delivery', __('Cennik'), null, 'component', array(
|
||||
'module' => 'stAllegroDeliveryBackend',
|
||||
'component' => 'deliveries',
|
||||
'delivery' => $delivery,
|
||||
'type' => 'custom',
|
||||
)) ?>
|
||||
</div>
|
||||
</fieldset>
|
||||
<div id="edit_actions">
|
||||
<div style="float: left">
|
||||
<?php echo st_get_admin_actions(array(
|
||||
array('type' => 'list', 'label' => __('Lista'), 'action' => '@stAllegroDelivery?action=list'),
|
||||
)); ?>
|
||||
</div>
|
||||
<div style="float: right">
|
||||
<?php echo st_get_admin_actions(array(
|
||||
array('type' => 'save', 'label' => __('Zapisz'))
|
||||
)) ?>
|
||||
</div>
|
||||
<div class="clr"></div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function($) {
|
||||
$(document).ready(function() {
|
||||
$('#edit_actions').stickyBox();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php st_include_partial('stAllegroDeliveryBackend/footer');?>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php use_stylesheet('backend/stAllegroPlugin.css');?>
|
||||
<?php echo select_tag('allegro_delivery[environment]', options_for_select(stAllegroEnv::getEnvironments(), $allegro_delivery->getEnvironment()), array('id' => 'st-allegro-delivery-edit-environment', 'disabled' => ($allegro_delivery->isNew() ? '' : 'disabled')));?>
|
||||
|
||||
<?php if ($allegro_delivery->isNew()):?>
|
||||
<script type="text/javascript">
|
||||
jQuery(function($) {
|
||||
$(document).ready(function() {
|
||||
showDelivery();
|
||||
|
||||
$('#st-allegro-delivery-edit-environment').change(function () {
|
||||
showDelivery();
|
||||
});
|
||||
|
||||
function showDelivery() {
|
||||
var type = $('#st-allegro-delivery-edit-environment option:selected').val();
|
||||
$('#st-allegro-delivery-edit-delivery').html('<img id="st-allegro-delivery-edit-delivery-loading" src="/images/frontend/theme/default2/loading.gif" alt=""/>');
|
||||
|
||||
$.ajax({
|
||||
url: "<?php echo st_url_for('@stAllegroDelivery?action=ajaxDelivery');?>?<?php if(!$allegro_delivery->isNew()) echo 'id='.$allegro_delivery->getId().'&';?>namespace=allegro_delivery&environment=" + type,
|
||||
cache: false
|
||||
}).done(function(html) {
|
||||
$('#st-allegro-delivery-edit-delivery').html(html);
|
||||
})
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php endif;?>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
echo checkbox_tag('allegro_delivery[is_default]', TRUE, $allegro_delivery->getIsDefault(), array('disabled' => $allegro_delivery->getIsDefault()));
|
||||
|
||||
if ($allegro_delivery->getIsDefault())
|
||||
echo input_hidden_tag('allegro_delivery[is_default]', TRUE);
|
||||
@@ -0,0 +1,62 @@
|
||||
|
||||
<?php use_helper('stAdminGenerator') ?>
|
||||
|
||||
<?php st_include_partial('stAllegroBackend/header', array(
|
||||
'title' => __('Cenniki'),
|
||||
)) ?>
|
||||
|
||||
<?php st_include_component('stAllegroBackend', 'configMenu'); ?>
|
||||
<div id="sf_admin_content">
|
||||
|
||||
<?php if ($shippingRates): ?>
|
||||
<form action="<?php echo url_for('@stAllegroDelivery?action=list') ?>" id="record_list_form">
|
||||
<table cellspacing="0" cellpadding="0" class="st_record_list record_list" style="width: 100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="1%"> </th>
|
||||
|
||||
<th><?php echo __('Nazwa') ?></th>
|
||||
|
||||
<th width="1%"> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($shippingRates as $index => $shippingRate): ?>
|
||||
|
||||
<tr class="<?php echo $index % 2 ? 'highlight' : '' ?>">
|
||||
<td>
|
||||
<ul class="st_object_actions">
|
||||
<li><a href="<?php echo url_for('@stAllegroDelivery?action=edit&id=' . $shippingRate->id) ?>" data-admin-confirm="" data-admin-action="edit"><img src="/images/backend/beta/icons/16x16/edit.png" title="edit" class="tooltip"></a></li>
|
||||
</ul>
|
||||
</td>
|
||||
|
||||
<td class="column_list_image"><?php echo $shippingRate->name ?></td>
|
||||
<td>
|
||||
<ul class="st_object_actions">
|
||||
<!-- <li><a href="<?php //echo url_for('@stAllegroDelivery?delete=edit&id=' . $shippingRate->id) ?>" data-admin-confirm="Jesteś pewien?" data-admin-action="delete"><img src="/images/backend/beta/icons/16x16/remove.png" title="delete" class="tooltip"></a></li> -->
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
<?php else: ?>
|
||||
<div style="width: 98.2%; min-height: 50px; border: 1px solid #ccc; padding: 10px;">
|
||||
<p id="st_record_list-empty"><?php echo __("Brak cenników") ?></p>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<div id="list_actions">
|
||||
<?php echo st_get_admin_actions(array(
|
||||
array('type' => 'add', 'label' => __('Dodaj'), 'action' => '@stAllegroDelivery?action=edit'),
|
||||
)); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php st_include_partial('stAllegroBackend/footer') ?>
|
||||
|
||||
<script>
|
||||
jQuery(function($) {
|
||||
$('#list_actions').stickyBox();
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
$environments = stAllegroEnv::getEnvironments();
|
||||
echo ($environments[$allegro_delivery->getEnvironment()]);
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
st_include_partial('stAllegroBackend/config_menu', [
|
||||
'related_object' => isset($related_object) ? $related_object : null,
|
||||
'forward_parameters' => isset($forward_parameters) ? $forward_parameters : null,
|
||||
]);
|
||||
@@ -0,0 +1,7 @@
|
||||
<div id="st-allegro-delivery-edit-delivery">
|
||||
<?php if($allegro_delivery->isNew()):?>
|
||||
<img id="st-allegro-delivery-edit-delivery-loading" src="/images/frontend/theme/default2/loading.gif" alt=""/>
|
||||
<?php else:?>
|
||||
<?php echo st_get_component('stAllegroDeliveryBackend', 'deliveries', array('id' => $allegro_delivery->getId(), 'namespace' => 'allegro_delivery', 'environment' => $allegro_delivery->getEnvironment(), 'show' => !$allegro_delivery->isNew()));?>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
@@ -0,0 +1,146 @@
|
||||
<?php
|
||||
use_helper('stPrice');
|
||||
/**
|
||||
* @var AllegroApiShippingRate $allegro_api_shipping_rate
|
||||
*/
|
||||
?>
|
||||
|
||||
|
||||
<div id="allegro-deliveries" class="bs-mt-1">
|
||||
<div class="visibility-toggle">
|
||||
<?php echo st_get_admin_button('default', __('Pokaż wszystkie'), '#', array('class' => 'show-all', 'size' => 'small')) ?>
|
||||
<?php echo st_get_admin_button('default', __('Pokaż tylko zaznaczone'), '#', array('class' => 'show-only-selected bs-d-none bs-ms-0', 'size' => 'small')) ?>
|
||||
</div>
|
||||
<?php $errorId = 0 ?>
|
||||
<?php foreach ($deliveryGroups as $group => $types): ?>
|
||||
<?php foreach ($types as $type => $deliveryMethods): $index = 0 ?>
|
||||
<div class="allegro-delivery-group bs-d-none" style="margin-top: 15px;">
|
||||
<b><?php echo __($group) ?> - <?php echo $type == 'IN_ADVANCE' ? __('Płatność z góry') : __('Płatność przy odbiorze') ?></b>
|
||||
<?php st_admin_table_start(array(
|
||||
array('label' => __('Aktywna')),
|
||||
array('label' => __('Metoda dostawy'), 'width' => '80%', 'align' => 'left'),
|
||||
array('label' => __('Pierwsza sztuka')),
|
||||
array('label' => __('Maks. w paczce')),
|
||||
array('label' => __('Kolejna sztuka')),
|
||||
), array('class' => 'allegro-delivery-table')) ?>
|
||||
<tbody>
|
||||
<?php foreach ($deliveryMethods as $method):
|
||||
$rate = $allegro_api_shipping_rate->getRate($method->id);
|
||||
$constrains = $method->shippingRatesConstraints;
|
||||
$namespace = $name.'['.$method->id.']';
|
||||
$index++;
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo st_admin_checkbox_tag($namespace.'[active]', 1, null !== $rate, array('class' => 'active')) ?></td>
|
||||
<td <?php if ($rate && $sf_request->hasError('rates['.$errorId.'].deliveryMethod.id')): ?>class="form-error tooltip text-left" title="<?php echo htmlspecialchars($sf_request->getError('rates['.$errorId.'].deliveryMethod.id')) ?>"<?php else: ?>class="text-left"<?php endif ?>>
|
||||
<?php echo $method->name ?>
|
||||
<?php if ($rate && $sf_request->hasError('rates['.$errorId.'].deliveryMethod.id')): ?>
|
||||
<?php echo st_admin_get_icon('error') ?>
|
||||
<?php endif ?>
|
||||
</td>
|
||||
<td <?php if ($rate && $sf_request->hasError('rates['.$errorId.'].firstItemPrice.amount')): ?>class="form-error tooltip" title="<?php echo htmlspecialchars($sf_request->getError('rates['.$errorId.'].firstItemPrice.amount')) ?>"<?php endif ?>>
|
||||
<?php echo input_tag($namespace.'[first_item_rate][amount]', stCurrency::formatPrice($rate ? $rate['first_item_rate']['amount'] : $constrains->firstItemRate->min), array(
|
||||
'style' => 'width: 60px',
|
||||
'maxlength' => 10,
|
||||
'disabled' => !$rate,
|
||||
'class' => 'price',
|
||||
'data-format' => 'decimal',
|
||||
'data-format-min-value' => $constrains->firstItemRate->min,
|
||||
'data-format-max-value' => $constrains->firstItemRate->max,
|
||||
)) ?>
|
||||
<?php echo input_hidden_tag($namespace.'[first_item_rate][currency]', $rate ? $rate['next_item_rate']['currency'] : 'PLN', array('class' => 'hidden', 'disabled' => !$rate)) ?>
|
||||
<?php if ($rate && $sf_request->hasError('rates['.$errorId.'].firstItemPrice.amount')): ?>
|
||||
<?php echo st_admin_get_icon('error') ?>
|
||||
<?php endif ?>
|
||||
</td>
|
||||
<td <?php if ($rate && $sf_request->hasError('rates['.$errorId.'].maxQuantityPerPackage')): ?>class="form-error tooltip" title="<?php echo htmlspecialchars($sf_request->getError('rates['.$errorId.'].maxQuantityPerPackage')) ?>"<?php endif ?>>
|
||||
<?php echo input_tag($namespace.'[max_quantity_per_package]', $rate ? $rate['max_quantity_per_package'] : 1, array(
|
||||
'style' => 'width: 60px',
|
||||
'maxlength' => 10,
|
||||
'disabled' => !$rate,
|
||||
'class' => 'price',
|
||||
'data-format' => 'integer',
|
||||
'data-format-min-value' => 1,
|
||||
'data-format-max-value' => $constrains->maxQuantityPerPackage->max,
|
||||
)) ?>
|
||||
<?php if ($rate && $sf_request->hasError('rates['.$errorId.'].maxQuantityPerPackage')): ?>
|
||||
<?php echo st_admin_get_icon('error') ?>
|
||||
<?php endif ?>
|
||||
</td>
|
||||
<td <?php if ($rate && $sf_request->hasError('rates['.$errorId.'].nextItemPrice.amount')): ?>class="form-error tooltip" title="<?php echo htmlspecialchars($sf_request->getError('rates['.$errorId.'].nextItemPrice.amount')) ?>"<?php endif ?>>
|
||||
<?php echo input_tag($namespace.'[next_item_rate][amount]', stCurrency::formatPrice($rate ? $rate['next_item_rate']['amount'] : $constrains->nextItemRate->min), array(
|
||||
'style' => 'width: 60px; vertical-align: middle',
|
||||
'maxlength' => 10,
|
||||
'disabled' => !$rate,
|
||||
'class' => 'price',
|
||||
'data-format' => 'decimal',
|
||||
'data-format-min-value' => $constrains->nextItemRate->min,
|
||||
'data-format-max-value' => $constrains->nextItemRate->max,
|
||||
)) ?>
|
||||
<?php echo input_hidden_tag($namespace.'[next_item_rate][currency]', $rate ? $rate['next_item_rate']['currency'] : 'PLN', array('class' => 'hidden', 'disabled' => !$rate)) ?>
|
||||
<?php if ($rate && $sf_request->hasError('rates['.$errorId.'].nextItemPrice.amount')): ?>
|
||||
<?php echo st_admin_get_icon('error') ?>
|
||||
<?php endif ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if (null !== $rate) $errorId++ ?>
|
||||
<?php endforeach ?>
|
||||
</tbody>
|
||||
<?php st_admin_table_end() ?>
|
||||
</div>
|
||||
<?php endforeach ?>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function($) {
|
||||
$(document).ready(function() {
|
||||
var allegroDeliveries = $('#allegro-deliveries');
|
||||
|
||||
allegroDeliveries.find('.active').change(function() {
|
||||
let checkbox = $(this);
|
||||
let tr = checkbox.closest('tr');
|
||||
|
||||
tr.find('.price,.hidden').prop('disabled', !checkbox.prop('checked'));
|
||||
});
|
||||
|
||||
allegroDeliveries.find('.visibility-toggle').on('click', 'a', function() {
|
||||
let link = $(this);
|
||||
|
||||
if (link.hasClass('show-all')) {
|
||||
link.closest('div').find('.show-only-selected').removeClass('bs-d-none');
|
||||
link.addClass('bs-d-none');
|
||||
let group = allegroDeliveries.find('.allegro-delivery-group').removeClass('bs-d-none');
|
||||
allegroDeliveries.find('.allegro-delivery-table tbody tr').removeClass('bs-d-none');
|
||||
} else {
|
||||
link.closest('div').find('.show-all').removeClass('bs-d-none');
|
||||
link.addClass('bs-d-none');
|
||||
showChecked();
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
function showChecked () {
|
||||
let trs = $('#allegro-deliveries table tbody tr');
|
||||
|
||||
$('.allegro-delivery-group').addClass('bs-d-none');
|
||||
|
||||
trs.each(function() {
|
||||
let tr = $(this);
|
||||
let checked = tr.find('[type="checkbox"]').prop("checked");
|
||||
|
||||
if (checked) {
|
||||
tr.removeClass('bs-d-none');
|
||||
tr.closest('.allegro-delivery-group').removeClass('bs-d-none');
|
||||
} else {
|
||||
tr.addClass('bs-d-none');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
showChecked();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1 @@
|
||||
<?php echo st_get_component('stAllegroDeliveryBackend', 'deliveries', array('id' => $id, 'auction' => $auction, 'namespace' => $namespace, 'environment' => $environment, 'show' => $show));
|
||||
Reference in New Issue
Block a user