first commit
This commit is contained in:
@@ -0,0 +1 @@
|
||||
<?php echo select_tag('config[allegro_pl_state]', options_for_select($states, $default, array('include_custom' => __('Wybierz'))));
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* @var AllegroApiOffer $value
|
||||
*/
|
||||
if ($value->isNew())
|
||||
{
|
||||
$url = '@stAllegroPlugin?action=chooseProductEdit&product_id=' . (isset($forward_parameters['product_id']) ? $forward_parameters['product_id'] : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
$url = '@stAllegroPlugin?action=assignProductEdit&id=' . $value->getId() . '&product_id=' . (isset($forward_parameters['product_id']) ? $forward_parameters['product_id'] : 0);
|
||||
}
|
||||
?>
|
||||
<?php echo $value->getAllegroAuction()->getProduct()->getName() ?> (<?php echo $value->getAllegroAuction()->getProduct()->getCode() ?>)<br>
|
||||
<?php echo st_get_admin_button('edit', __('zmień'), $url, array('size' => 'small', 'class' => 'bs-mt-2')) ?>
|
||||
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
/**
|
||||
* @var AllegroApiOffer $value
|
||||
*/
|
||||
use_helper('stAllegro', 'stJQueryTools');
|
||||
|
||||
$default = array();
|
||||
$name = $name.'[id]';
|
||||
$categoryFieldId = get_id_from_name($name);
|
||||
$api = stAllegroApi::getInstance();
|
||||
$ids = array();
|
||||
|
||||
if ($value->getCategory() && $value->getCategory()->id)
|
||||
{
|
||||
$path = $api->getCategoryPath($value->getCategory()->id);
|
||||
|
||||
if ($path)
|
||||
{
|
||||
$categoryName = array();
|
||||
|
||||
foreach ($path as $category)
|
||||
{
|
||||
$ids[] = $category->id;
|
||||
$categoryName[] = $category->name;
|
||||
}
|
||||
|
||||
$default = array(array("id" => $value->getCategory()->id, 'name' => implode(' / ', $categoryName) . ' (' . $value->getCategory()->id . ')'));
|
||||
}
|
||||
}
|
||||
|
||||
echo st_tokenizer_input_tag('allegro_category', st_url_for('@stAllegroGetAjaxCategoryToken'), $default, array(
|
||||
'id' => 'st-allegro-edit-category-input',
|
||||
'tokenizer' => array(
|
||||
'hintText' => __('Wpisz szukaną frazę lub numer kategorii'),
|
||||
'tokenLimit' => 1,
|
||||
'sortable' => true,
|
||||
'minChars' => 3,
|
||||
'onAdd' => ' function (item) {
|
||||
$.preloader.show();
|
||||
|
||||
var options = [];
|
||||
|
||||
$(".st_product_options_picker select").each(function() {
|
||||
options.push($(this).val());
|
||||
});
|
||||
|
||||
var data = { id: ' . $sf_request->getParameter('id', 0) . ', category_id: item.id, product_id: ' . $sf_request->getParameter('product_id', 0) . ', "options": options.join(",") };
|
||||
|
||||
var offerProduct = $("#allegro_api_offer_product_id");
|
||||
|
||||
if (offerProduct.data("parameters")) {
|
||||
data.parameters = offerProduct.data("parameters");
|
||||
offerProduct.data("parameters", null);
|
||||
}
|
||||
|
||||
$("#'.$categoryFieldId.'").val(item.id);
|
||||
|
||||
$.post("'.st_url_for('stAllegroBackend/ajaxUpdateOfferForm').'", data, function(response) {
|
||||
if (typeof tinymce !== "undefined") {
|
||||
tinymce.remove();
|
||||
}
|
||||
|
||||
$("#st-allegro-offer-form-container").html(response);
|
||||
|
||||
$.preloader.hide();
|
||||
|
||||
if (item.ids) {
|
||||
$.updateCategoryPath(item.ids);
|
||||
}
|
||||
});
|
||||
}',
|
||||
'onDelete' => 'function() { $(".allegro-category-container").hide(); }',
|
||||
))
|
||||
);
|
||||
|
||||
echo input_hidden_tag($name, $value->getCategory() ? $value->getCategory()->id : null);
|
||||
?>
|
||||
|
||||
<?php echo st_get_admin_button('stCategory', __('Wybierz kategorię'), '#', array(
|
||||
'id' => 'st-allegro-edit-category-overlay-trigger',
|
||||
'size' => 'small',
|
||||
'class' => 'bs-mt-2',
|
||||
)) ?>
|
||||
|
||||
<?php echo modal('st-allegro-edit-category-overlay', __('Drzewo kategorii'), array(
|
||||
'remote_url' => st_url_for('@stAllegroPlugin?action=ajaxCategoryTree'),
|
||||
'trigger' => '#st-allegro-edit-category-overlay-trigger',
|
||||
)) ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function($) {
|
||||
let path = '<?php echo implode(",", $ids) ?>';
|
||||
|
||||
$.updateCategoryPath = function(current) {
|
||||
path = current;
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
let tokeninput = $('#st-allegro-edit-category-input');
|
||||
let modal = $('#st-allegro-edit-category-overlay');
|
||||
|
||||
tokeninput.on('update_category_path', function(e, path) {
|
||||
tokeninput.tokenInput('clear');
|
||||
var namePath = [];
|
||||
var idPath = [];
|
||||
|
||||
$.each(path, function() {
|
||||
var category = this;
|
||||
idPath.push(this.id);
|
||||
namePath.push(this.name);
|
||||
});
|
||||
|
||||
tokeninput.tokenInput('add', { 'id': idPath[idPath.length - 1], 'name': namePath.join(' / '), 'ids': idPath.join(',') });
|
||||
});
|
||||
|
||||
modal
|
||||
.on('click', '.submit', function() {
|
||||
var jstree = $('#jstree');
|
||||
jstree.css({ 'visibility': 'hidden' });
|
||||
|
||||
var categoryId = jstree.find('input:radio:checked').attr('value');
|
||||
|
||||
tokeninput.tokenInput('clear');
|
||||
|
||||
if (categoryId > 0) {
|
||||
var treeApi = $.jstree._reference(jstree);
|
||||
var namePath = treeApi.get_path($('#jstree-' + categoryId));
|
||||
namePath.splice(0, 1);
|
||||
|
||||
var idsPath = treeApi.get_path($('#jstree-' + categoryId), true);
|
||||
idsPath.splice(0, 1);
|
||||
|
||||
var cids = [];
|
||||
|
||||
$.each(idsPath, function() {
|
||||
cids.push(this.replace('jstree-', ''));
|
||||
});
|
||||
|
||||
path = cids.join(',');
|
||||
|
||||
tokeninput.tokenInput('add', { 'id': categoryId, 'name': namePath.join(' / ') });
|
||||
}
|
||||
|
||||
modal.trigger('hide');
|
||||
})
|
||||
.on('remote.parameters', function() {
|
||||
return {
|
||||
'path': path,
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
use_helper('stAdminGenerator', 'stAllegroParameter');
|
||||
?>
|
||||
|
||||
<div id="st-allegro-parameters-required">
|
||||
<?php
|
||||
foreach ($parameters as $parameter)
|
||||
{
|
||||
if ($parameter->id == 219809 && !isset($values[$parameter->id]))
|
||||
{
|
||||
$values[$parameter->id] = stAllegroApi::arrayToObject(array(
|
||||
'values' => array($product->getCode())
|
||||
));
|
||||
}
|
||||
|
||||
if ($parameter->id == 237194 && !isset($values[$parameter->id]) && $product->getProducer())
|
||||
{
|
||||
$values[$parameter->id] = stAllegroApi::arrayToObject(array(
|
||||
'values' => array($product->getProducer()->getName())
|
||||
));
|
||||
}
|
||||
|
||||
if ($parameter->id == 225693 && !isset($values[$parameter->id]) && $product->getManCode())
|
||||
{
|
||||
$values[$parameter->id] = stAllegroApi::arrayToObject(array(
|
||||
'values' => array($product->getManCode())
|
||||
));
|
||||
}
|
||||
|
||||
if ($parameter->required)
|
||||
{
|
||||
st_allegro_parameter($name, $parameter, $values, $dependencies);
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div id="st-allegro-parameters-more"><?php
|
||||
foreach ($parameters as $parameter)
|
||||
{
|
||||
if ($parameter->id == 219809 && !isset($values[$parameter->id]))
|
||||
{
|
||||
$values[$parameter->id] = stAllegroApi::arrayToObject(array(
|
||||
'values' => array($product->getCode())
|
||||
));
|
||||
}
|
||||
|
||||
if ($parameter->id == 237194 && !isset($values[$parameter->id]) && $product->getProducer())
|
||||
{
|
||||
$values[$parameter->id] = stAllegroApi::arrayToObject(array(
|
||||
'values' => array($product->getProducer()->getName())
|
||||
));
|
||||
}
|
||||
|
||||
if (isset($parameter->options->isGTIN) && $parameter->options->isGTIN && $product->getManCode())
|
||||
{
|
||||
$values[$parameter->id] = stAllegroApi::arrayToObject(array(
|
||||
'values' => array($product->getManCode())
|
||||
));
|
||||
}
|
||||
|
||||
if (!$parameter->required)
|
||||
{
|
||||
st_allegro_parameter($name, $parameter, $values, $dependencies);
|
||||
}
|
||||
}
|
||||
|
||||
echo input_hidden_tag('st_allegro_parameter_dependency', json_encode($dependencies));
|
||||
?></div>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php echo input_password_tag('config[client_secret]', $config->get('client_secret'), array('size' => 60)) ?>
|
||||
<?php if (!$config->get('access_token')): ?>
|
||||
<script>
|
||||
jQuery(function($) {
|
||||
$('#sf_fieldset_warunki_reklamacji___gwarancji___zwrot__w').hide();
|
||||
});
|
||||
</script>
|
||||
<?php endif ?>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
// auto-generated by sfPropelAdmin
|
||||
// date: 2019/05/14 13:06:43
|
||||
?>
|
||||
<?php
|
||||
echo st_get_admin_actions_head('style="margin-top: 10px; float: right"');
|
||||
|
||||
if (!$config->get('access_token'))
|
||||
{
|
||||
echo st_get_admin_action('save', __('Zaloguj do Allegro'), null, array("name" => "login",));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo st_get_admin_action('save', __('Zaloguj ponownie do Allegro'), null, array("name" => "login",));
|
||||
echo st_get_admin_action('save', __('Zapisz', null, 'stAdminGeneratorPlugin'), null, array("name" => "save",));
|
||||
}
|
||||
|
||||
echo st_get_admin_actions_foot();
|
||||
@@ -0,0 +1,25 @@
|
||||
<table class="st_record_list st_record_manager" cellspacing="0" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php echo __('ID');?></th>
|
||||
<th><?php echo __('Nazwa aukcji');?></th>
|
||||
<th><?php echo __('Numer aukcji');?></th>
|
||||
<th><?php echo __('Koszt wystawienia');?></th>
|
||||
<th><?php echo __('Komunikat błędu');?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($messages as $id => $message):?>
|
||||
<?php $auction = AllegroAuctionPeer::retrieveByPK($id)?>
|
||||
<?php if (is_object($auction)):?>
|
||||
<tr>
|
||||
<td><?php echo st_external_link_to($auction->getId(), 'stProduct/allegroEdit?id='.$auction->getId().'&product_id='.$auction->getProductId(), array('target'=>'_blank'));?></td>
|
||||
<td><?php echo st_external_link_to($auction->getName(), 'stProduct/allegroEdit?id='.$auction->getId().'&product_id='.$auction->getProductId(), array('target'=>'_blank'));?></td>
|
||||
<td><?php echo ($message === true && $auction->getAuctionId()) ? st_external_link_to($auction->getAuctionId(), $auction->getAuctionLink(), array('target'=>'_blank')) : '-';?></td>
|
||||
<td><?php echo ($message === true && $auction->getAuctionCost()) ? $auction->getAuctionCost() : '-';?></td>
|
||||
<td><?php echo ($message !== true) ? __($message, null, 'stAllegroMessages') : '-';?></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -0,0 +1,461 @@
|
||||
<?php
|
||||
|
||||
$issued = false;
|
||||
|
||||
function st_allegro_section_type($items)
|
||||
{
|
||||
$type = strtolower($items[0]->type);
|
||||
|
||||
if (isset($items[1]))
|
||||
{
|
||||
$type .= '-'.strtolower($items[1]->type);
|
||||
}
|
||||
|
||||
return $type;
|
||||
}
|
||||
?>
|
||||
|
||||
<script type="text/x-template" id="allegro-section-controls-tpl">
|
||||
<ul class="tabs">
|
||||
<li><a data-type="text" href="#"><?php echo __('Opis') ?></a></li>
|
||||
<li><a data-type="image" href="#"><?php echo __('Zdjęcie') ?></a></li>
|
||||
<li><a data-type="text-image" href="#"><?php echo __('Opis + Zdjęcie') ?></a></li>
|
||||
<li><a data-type="image-text" href="#"><?php echo __('Zdjęcie + Opis') ?></a></li>
|
||||
<li><a data-type="image-image" href="#"><?php echo __('Zdjęcie + Zdjęcie') ?></a></li>
|
||||
</ul>
|
||||
<div class="panes">
|
||||
<div class="flex">
|
||||
<div class="text"><textarea id="text-editor"></textarea></div>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<div class="image"><a href="#"><span></span></a></div>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<div class="text"><textarea id="text-image-editor"></textarea></div>
|
||||
<div class="image"><a href="#"><span></span></a></div>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<div class="image"><a href="#"><span></span></a></div>
|
||||
<div class="text"><textarea id="image-text-editor"></textarea></div>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<div class="image"><a href="#"><span></span></a></div>
|
||||
<div class="image"><a href="#"><span></span></a></div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/x-template" id="allegro-description-image-select-modal-tpl">
|
||||
<div id="allegro-description-image-select-modal" class="popup_window">
|
||||
<div class="close"><img src="/images/backend/beta/gadgets/close.png" alt="<?php echo __('Zamknij', null, 'stBackend') ?>" /></div>
|
||||
<h2><?php echo __('Wybierz zdjęcie') ?></h2>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/x-template" id="allegro-section-text-tpl">
|
||||
<div class="section bs-mb-3" data-type="text">
|
||||
<div class="header flex">
|
||||
<div class="title"><h3><?php echo __("Edycja sekcji") ?></h3></div>
|
||||
<div class="tools"><a class="remove" href="#"><?php echo st_admin_get_icon('close') ?></a></div>
|
||||
</div>
|
||||
<div class="section-controls tinymce-container"></div>
|
||||
<div class="section-content flex">
|
||||
<div class="text"></div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/x-template" id="allegro-section-image-tpl">
|
||||
<div class="section bs-mb-3" data-type="text-image">
|
||||
<div class="header flex">
|
||||
<div class="title"><h3><?php echo __("Edycja sekcji") ?></h3></div>
|
||||
<div class="tools"><a class="remove" href="#"><?php echo st_admin_get_icon('close') ?></a></div>
|
||||
</div>
|
||||
<div class="section-controls tinymce-container"></div>
|
||||
<div class="section-content flex">
|
||||
<div class="image"><?php echo st_admin_get_icon('add-photo', array('size' => 24)) ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/x-template" id="allegro-section-text-image-tpl">
|
||||
<div class="section bs-mb-3" data-type="text-image">
|
||||
<div class="header flex">
|
||||
<div class="title"><h3><?php echo __("Edycja sekcji") ?></h3></div>
|
||||
<div class="tools"><a class="remove" href="#"><?php echo st_admin_get_icon('close') ?></a></div>
|
||||
</div>
|
||||
<div class="section-controls tinymce-container"></div>
|
||||
<div class="section-content flex">
|
||||
<div class="text"></div>
|
||||
<div class="image"><?php echo st_admin_get_icon('add-photo', array('size' => 24)) ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/x-template" id="allegro-section-image-text-tpl">
|
||||
<div class="section bs-mb-3" data-type="image-text">
|
||||
<div class="header flex">
|
||||
<div class="title"><h3><?php echo __("Edycja sekcji") ?></h3></div>
|
||||
<div class="tools"><a class="remove" href="#"><?php echo st_admin_get_icon('close') ?></a></div>
|
||||
</div>
|
||||
<div class="section-controls tinymce-container"></div>
|
||||
<div class="section-content flex">
|
||||
<div class="image"><?php echo st_admin_get_icon('add-photo', array('size' => 24)) ?></div>
|
||||
<div class="text"></div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/x-template" id="allegro-section-image-image-tpl">
|
||||
<div class="section bs-mb-3" data-type="image-image">
|
||||
<div class="header flex">
|
||||
<div class="title"><h3><?php echo __("Edycja sekcji") ?></h3></div>
|
||||
<div class="tools"><a class="remove" href="#"><?php echo st_admin_get_icon('close') ?></a></div>
|
||||
</div>
|
||||
<div class="section-controls tinymce-container"></div>
|
||||
<div class="section-content flex">
|
||||
<div class="image"><?php echo st_admin_get_icon('add-photo', array('size' => 24)) ?></div>
|
||||
<div class="image"><?php echo st_admin_get_icon('add-photo', array('size' => 24)) ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<?php echo modal('allegro-description-image-select-modal', __('Wybierz zdjęcie'), array(
|
||||
'width' => 960,
|
||||
)) ?>
|
||||
|
||||
<div class="row">
|
||||
<div id="allegro-description">
|
||||
<?php foreach ($value as $section): ?>
|
||||
<div class="section bs-mb-3" data-type="<?php echo st_allegro_section_type($section->items) ?>">
|
||||
<div class="header flex">
|
||||
<div class="title"><h3><?php echo __("Edycja sekcji") ?></h3></div>
|
||||
<div class="tools"><a class="remove" href="#"><?php echo st_admin_get_icon('close') ?></a></div>
|
||||
</div>
|
||||
<div class="section-controls tinymce-container"></div>
|
||||
<div class="section-content flex">
|
||||
<?php foreach ($section->items as $content): ?>
|
||||
<?php if ($content->type == 'TEXT'): ?>
|
||||
<div class="text"><?php echo $content->content ?></div>
|
||||
<?php endif ?>
|
||||
<?php if ($content->type == 'IMAGE'): ?>
|
||||
<div class="image" data-value="<?php echo $content->url ?>">
|
||||
<img src="<?php echo $content->url ?>">
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach ?>
|
||||
<?php echo input_hidden_tag($name, json_encode(stAllegroApi::objectToArray($value)), array('id' => 'allegro_auction_text')); ?>
|
||||
<?php if (!$issued): ?>
|
||||
<div class="text-right">
|
||||
<?php echo st_get_admin_button('add', __('Dodaj sekcję'), '#', array('size' => 'small', 'id' => 'allegro-description-add-section', 'name' => 'add')) ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (!$issued): ?>
|
||||
<script type="text/javascript">
|
||||
jQuery(function($) {
|
||||
const imageSelectModal = $('#allegro-description-image-select-modal');
|
||||
let sectionContents = { text: undefined, image: { 0: undefined, 1: undefined } };
|
||||
let firstInit = true;
|
||||
const container = $('#allegro-description');
|
||||
const tinymceConfig = {
|
||||
version: "<?php echo sfRichTextEditorTinyMCE::VERSION ?>",
|
||||
language: "<?php echo strtolower(substr(sfContext::getInstance()->getUser()->getCulture(), 0, 2)) ?>"
|
||||
};
|
||||
|
||||
function cleanupHTML(html) {
|
||||
|
||||
var dom = $('<div>'+html+'</div>');
|
||||
|
||||
dom.find('*').each(function () {
|
||||
var tag = $(this);
|
||||
if (tag.parents(tag.prop('tagName')).length) {
|
||||
tag.contents().unwrap();
|
||||
}
|
||||
});
|
||||
|
||||
html = dom.html();
|
||||
|
||||
return html
|
||||
.replace(/<b>/g, '<strong>')
|
||||
.replace(/<\/b>/g, '</strong>')
|
||||
}
|
||||
|
||||
function resetActiveSection() {
|
||||
$.each(['text-editor', 'image-text-editor', 'text-image-editor'], function() {
|
||||
tinymce.remove('#'+this);
|
||||
});
|
||||
|
||||
container.find('.section.active').removeClass('active').find('.section-controls').html("");
|
||||
}
|
||||
|
||||
var updateSectionContents = function(selectedTab, sectionContent) {
|
||||
switch(selectedTab.data('type'))
|
||||
{
|
||||
case 'text':
|
||||
sectionContent.html('<div class="text">'+sectionContents['text']+'</div>');
|
||||
break;
|
||||
case 'image':
|
||||
sectionContent.html('<div class="image" data-value="'+sectionContents['image'][0]+'"><img src="'+sectionContents['image'][0]+'"></div>');
|
||||
break;
|
||||
case 'text-image':
|
||||
sectionContent.html('<div class="text">'+sectionContents['text']+'</div><div class="image" data-value="'+sectionContents['image'][1]+'"><img src="'+sectionContents['image'][1]+'"></div>');
|
||||
break;
|
||||
case 'image-text':
|
||||
sectionContent.html('<div class="image" data-value="'+sectionContents['image'][0]+'"><img src="'+sectionContents['image'][0]+'"></div><div class="text">'+sectionContents['text']+'</div>');
|
||||
break;
|
||||
case 'image-image':
|
||||
sectionContent.html('<div class="image" data-value="'+sectionContents['image'][0]+'"><img src="'+sectionContents['image'][0]+'"></div><div class="image" data-value="'+sectionContents['image'][1]+'"><img src="'+sectionContents['image'][1]+'"></div>');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
container.on('click', '.section', function() {
|
||||
let pane = null;
|
||||
let tab = null;
|
||||
const section = $(this);
|
||||
|
||||
if (section.hasClass('active')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!section.data('allegro-init')) {
|
||||
section.data('allegro-init', true);
|
||||
section.find('.remove').click(function() {
|
||||
resetActiveSection();
|
||||
section.remove();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
const sectionControls = section.find('.section-controls').html($('#allegro-section-controls-tpl').html());
|
||||
const sectionContent = section.find('.section-content');
|
||||
let tabInitialIndex = sectionControls.find('.tabs a[data-type="'+section.data('type')+'"]').closest('li').index();
|
||||
|
||||
resetActiveSection();
|
||||
|
||||
if (container.find('.section').length > 1) {
|
||||
section.find('.tools').show();
|
||||
} else {
|
||||
section.find('.tools').hide();
|
||||
}
|
||||
|
||||
section.addClass('active');
|
||||
|
||||
sectionContents = { text: undefined, image: { 0: undefined, 1: undefined } };
|
||||
|
||||
sectionContent.children('div').each(function(index) {
|
||||
const elem = $(this);
|
||||
if (elem.hasClass('image')) {
|
||||
sectionContents[elem.attr('class')][index] = elem.data('value');
|
||||
} else {
|
||||
sectionContents[elem.attr('class')] = elem.html();
|
||||
}
|
||||
});
|
||||
|
||||
sectionControls.find('.panes').on('click', '.image > a', function() {
|
||||
const link = $(this);
|
||||
let index = link.parent().index();
|
||||
|
||||
imageSelectModal.one('modal.show', function(e, modal) {
|
||||
const images = $('#st-allegro-edit-images .image-url');
|
||||
|
||||
modal.getElement().one('click', 'a.description-image', function() {
|
||||
let value = $(this).data('value');
|
||||
sectionContents['image'][index] = value;
|
||||
link.children('span').css({ 'background-image': 'url('+value+')' });
|
||||
updateSectionContents(tab, sectionContent);
|
||||
modal.hide();
|
||||
return false;
|
||||
});
|
||||
|
||||
if (images.length > 0) {
|
||||
let list = [];
|
||||
|
||||
$.each(images, function() {
|
||||
let url = $(this).val();
|
||||
list.push('<li><a href="#" data-value="'+url+'" class="description-image"><img src="'+url+'"></a><li>');
|
||||
});
|
||||
|
||||
modal.updateContent('<ul>'+list.join('')+'</ul>');
|
||||
} else {
|
||||
modal.updateContent('Musisz wpierw wybrać zdjęcia do aukcji');
|
||||
}
|
||||
});
|
||||
|
||||
imageSelectModal.data('api').show();
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
sectionControls.find('.tabs').tabs('#allegro-description div.panes > div', {
|
||||
initialIndex: tabInitialIndex,
|
||||
onClick: function() {
|
||||
pane = this.getCurrentPane();
|
||||
tab = this.getCurrentTab();
|
||||
|
||||
let init = pane.data('allegro-init');
|
||||
const tpl = $($('#allegro-section-'+section.data('type')+'-tpl'));
|
||||
|
||||
if (!init) {
|
||||
pane.data('allegro-init', true);
|
||||
|
||||
if (tab.data('type') != 'image-image') {
|
||||
const textarea = pane.find('.text textarea').get(0);
|
||||
tinymce.init({
|
||||
target: textarea,
|
||||
skin: "custom",
|
||||
plugins: ["lists", "autoresize", "paste"],
|
||||
browser_spellcheck: true,
|
||||
menubar: false,
|
||||
convert_urls: false,
|
||||
toolbar: "undo redo | formatselect | bold | bullist numlist",
|
||||
valid_elements: "b,strong,p,h1,h2,ul,ol,li",
|
||||
valid_children: "h1[-],h2[-],li[strong|p|b],p[strong|b],ol[li],ul[li]",
|
||||
block_formats: 'Paragraph=p;Header 1=h1;Header 2=h2;',
|
||||
resize: true,
|
||||
force_p_newlines: true,
|
||||
language: tinymceConfig.language,
|
||||
width: "100%",
|
||||
autoresize_max_height: 304,
|
||||
autoresize_min_height: 304,
|
||||
cache_suffix: "?v="+tinymceConfig.version,
|
||||
entity_encoding: "raw",
|
||||
keep_styles: false,
|
||||
allow_conditional_comments: false,
|
||||
content_css: ["/css/backend/stTinyMCEContent.css"],
|
||||
setup: function(editor) {
|
||||
editor.on('keydown', function(e) {
|
||||
if (e.shiftKey && e.key == 'Enter') {
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
init_instance_callback: function (editor) {
|
||||
let updated = true;
|
||||
// editor.shortcuts.remove('shift+enter');
|
||||
editor.focus();
|
||||
|
||||
if (!sectionContents['text']) {
|
||||
sectionContents['text'] = '';
|
||||
}
|
||||
|
||||
if (sectionContents['text'].length) {
|
||||
sectionContents['text'] = cleanupHTML(sectionContents['text']);
|
||||
}
|
||||
|
||||
editor.setContent(sectionContents['text']);
|
||||
|
||||
sectionContents['text'] = editor.getContent();
|
||||
|
||||
updateSectionContents(tab, sectionContent);
|
||||
|
||||
editor.on('blur', function (e) {
|
||||
let content = editor.getContent();
|
||||
|
||||
if (content.length) {
|
||||
content = cleanupHTML(content);
|
||||
}
|
||||
|
||||
editor.setContent(content);
|
||||
|
||||
sectionContents['text'] = content;
|
||||
sectionContent.find('.text').html(content);
|
||||
updated = false;
|
||||
});
|
||||
|
||||
editor.on('focus', function() {
|
||||
if (!updated) {
|
||||
editor.setContent(sectionContents['text']);
|
||||
updated = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (firstInit) {
|
||||
firstInit = false;
|
||||
$('#allegro_auction_name').click().focus();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
const editor = tinymce.get(tab.data('type')+'-editor');
|
||||
if (editor) {
|
||||
editor.focus();
|
||||
}
|
||||
|
||||
updateSectionContents(tab, sectionContent);
|
||||
}
|
||||
|
||||
if (tab.data('type') != 'text') {
|
||||
|
||||
pane.find('.image').each(function() {
|
||||
const image = $(this);
|
||||
if (sectionContents['image'][image.index()]) {
|
||||
image.find('a > span').css({ 'background-image': 'url('+sectionContents['image'][image.index()]+')' });
|
||||
} else {
|
||||
image.removeAttr('style');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
section.data('type', tab.data('type'));
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
container.find('.section').first().click();
|
||||
|
||||
$('#allegro-description-add-section').click(function() {
|
||||
const section = $($('#allegro-section-text-tpl').html());
|
||||
const btn = $(this);
|
||||
|
||||
btn.parent().before(section);
|
||||
|
||||
section.click();
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
const form = $('#allegro_auction_text').closest('form');
|
||||
|
||||
form.submit(function() {
|
||||
const sections = [];
|
||||
|
||||
container.find('.section').each(function() {
|
||||
const section = $(this);
|
||||
|
||||
const items = [];
|
||||
|
||||
section.find('.section-content > div').each(function() {
|
||||
const item = $(this);
|
||||
if (item.hasClass('text')) {
|
||||
let content = $(this).html();
|
||||
content = content.replace(/<strong>/g, '<b>').replace(/<\/strong>/g, '</b>');
|
||||
items.push({
|
||||
'type': 'TEXT',
|
||||
'content': content,
|
||||
});
|
||||
} else {
|
||||
items.push({
|
||||
'type': 'IMAGE',
|
||||
'url': $(this).data('value'),
|
||||
});
|
||||
}
|
||||
});
|
||||
sections.push({ 'items': items });
|
||||
});
|
||||
|
||||
// console.log(sections);
|
||||
|
||||
// return false;
|
||||
|
||||
$('#allegro_auction_text').val(JSON.stringify({ 'sections': sections }));
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php endif ?>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php modal_block_start(); ?>
|
||||
<form action="<?php echo st_url_for('@stAllegroPlugin?action=ajaxProductSearch') ?>" class="admin_form" method="post">
|
||||
<div class="search-box">
|
||||
<?php echo input_tag('product_search[phrase]', null, array(
|
||||
'placeholder' => __('Podaj nazwę lub kod produktu (EAN, ISBN itp.)'),
|
||||
'size' => 40,
|
||||
)); ?>
|
||||
<button class="button" type="submit"><?php echo __('Szukaj') ?></button>
|
||||
</div>
|
||||
<div class="products-container"></div>
|
||||
</form>
|
||||
<?php modal_block_end("st-allegro-assign-product-modal", __("Wybierz produkt Allegro"), array(
|
||||
'trigger' => '#st-allegro-assign-product-modal-trigger',
|
||||
'width' => 980,
|
||||
'height' => 0,
|
||||
));
|
||||
|
||||
include st_admin_get_template_path(__FILE__);
|
||||
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
/**
|
||||
* @var AllegroApiOffer $allegro_api_offer
|
||||
*/
|
||||
use_stylesheet('backend/stAllegroPlugin.css?v6');
|
||||
$config = stConfig::getInstance('stAllegroBackend');
|
||||
?>
|
||||
<div id="st-allegro-offer-form-container" class="bs-mx-0">
|
||||
<?php if ($allegro_api_offer->getCategory() && $allegro_api_offer->getCategory()->id): ?>
|
||||
<?php echo st_get_component('stAllegroBackend', 'offerForm', array('offer' => $allegro_api_offer)) ?>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
jQuery(function($){
|
||||
var price = <?php echo $allegro_api_offer->getAllegroAuction()->getProduct()->getPriceBrutto() ?>;
|
||||
var stock = <?php echo $allegro_api_offer->getAllegroAuction()->getProduct()->getStock() ?>;
|
||||
var commission = <?php echo json_encode($config->get('offer_product_commission', array())) ?>;
|
||||
var selectAllegroProductUrl = '<?php echo st_url_for('@stAllegroPlugin?action=ajaxSelectAllegroProduct') ?>';
|
||||
|
||||
// imageContainer.find('.add-image').before("<div>testowa</div>");
|
||||
|
||||
$('.st_product_options_picker').on('options_change', function(event, productPrice, productStock, manCode, options) {
|
||||
if (undefined !== productStock) {
|
||||
stock = productStock;
|
||||
}
|
||||
|
||||
if (undefined !== productPrice) {
|
||||
price = Number(productPrice);
|
||||
}
|
||||
|
||||
if (price && commission.commission > 0) {
|
||||
price = price + price * (Number(commission.commission) / 100);
|
||||
if (commission.round_type == 'full_buck') {
|
||||
price = Math.round(price);
|
||||
}
|
||||
}
|
||||
|
||||
$('#allegro_api_offer_selling_mode_price_amount').val(price.toFixed(2));
|
||||
$('#allegro_api_offer_stock_available').val(stock);
|
||||
$('#st-allegro-edit-stock-product').html(stock);
|
||||
$('#allegro_api_offer_parameters_string_225693').val(manCode);
|
||||
});
|
||||
|
||||
var assignProductModal = $('#st-allegro-assign-product-modal');
|
||||
|
||||
assignProductModal.find('form').submit(function(e) {
|
||||
var form = $(this);
|
||||
var submitButton = form.find('[type=submit]:focus');
|
||||
var pagination = form.data('pagination');
|
||||
var lastPageId = form.data('last-page-id');
|
||||
var query = form.serialize();
|
||||
var pageId = null;
|
||||
var preloader = assignProductModal.find('.preloader');
|
||||
|
||||
if (submitButton.prop('name') == 'next_page') {
|
||||
pagination.push(lastPageId);
|
||||
pageId = submitButton.val();
|
||||
} else if (submitButton.prop('name') == 'prev_page') {
|
||||
var pagination = form.data('pagination');
|
||||
pageId = pagination.pop();
|
||||
} else {
|
||||
pagination = [];
|
||||
lastPageId = null;
|
||||
pageId = null;
|
||||
}
|
||||
|
||||
lastPageId = pageId;
|
||||
|
||||
form.data('pagination', pagination);
|
||||
form.data('last-page-id', lastPageId);
|
||||
|
||||
if (pageId) {
|
||||
query += '&product_search[page.id]=' + pageId;
|
||||
}
|
||||
|
||||
assignProductModal.trigger("preloader.show");
|
||||
|
||||
$.post(form.prop('action'), query, function(response) {
|
||||
form.find('.products-container').html(response).scrollTop(0);
|
||||
assignProductModal.trigger("preloader.hide");
|
||||
|
||||
if (pagination && pagination.length > 0) {
|
||||
form.find('button[name=prev_page]').show();
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
assignProductModal.on('modal.hide', function() {
|
||||
var form = assignProductModal.find('form');
|
||||
form.data('pagination', null);
|
||||
form.data('last-page-id', null);
|
||||
assignProductModal.find('.products-container').html('');
|
||||
});
|
||||
|
||||
assignProductModal.on("click", '.allegro-product', function() {
|
||||
var product = $(this);
|
||||
assignProductModal.trigger("preloader.show");
|
||||
var tokenInput = $('#st-allegro-edit-category-input');
|
||||
var selectedProduct = $('#st-allegro-selected-product');
|
||||
|
||||
$.post(selectAllegroProductUrl, { product: product.data('id') }, function(response) {
|
||||
selectedProduct.html(product.prop('outerHTML'));
|
||||
assignProductModal.trigger("preloader.hide");
|
||||
assignProductModal.trigger("hide");
|
||||
var offerProduct = $('#allegro_api_offer_product_id');
|
||||
|
||||
offerProduct.val(product.data('id'));
|
||||
offerProduct.data('parameters', response.product.parameters);
|
||||
tokenInput.trigger('update_category_path', [ response.category_path ]);
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,7 @@
|
||||
<div class="st-allegro-edit-stock">
|
||||
<?php echo input_tag($name . '[available]', $value && $value->available ? $value->available : 1, array('class' => 'number-type update-pricing-fee-preview', 'data-precision' => 0, 'data-min' => 0, 'data-max' => 10000, 'size' => "6")) ?>
|
||||
<?php echo select_tag($name . '[unit]', options_for_select(array('UNIT' => __("Sztuk"), "SET" => __('Kompletów'), "PAIR" => __("Par")), $value ? $value->unit : null)) ?>
|
||||
</div>
|
||||
<div style="padding-top: 5px;">
|
||||
<?php echo __('dostępnych w magazynie: ') ?> <span id="st-allegro-edit-stock-product"><?php echo $params['product']->getStock() ?></span>
|
||||
</div>
|
||||
@@ -0,0 +1 @@
|
||||
<?php echo date('d-m-Y H:i:s', stConfig::getInstance('stAllegroPlugin')->get('expires'));
|
||||
@@ -0,0 +1 @@
|
||||
<?php echo input_tag('filters[name]', isset($filters['name']) ? $filters['name'] : null, array('disabled' => isset($filters['number']) && $filters['number'])); ?>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php echo input_tag('filters[number]', isset($filters['number']) ? $filters['number'] : null, array('class' => 'string-type')); ?>
|
||||
|
||||
<script>
|
||||
jQuery(function($) {
|
||||
$('#filters_number').change(function() {
|
||||
var input = $(this);
|
||||
var form = input.closest('form');
|
||||
|
||||
var filters = form.find('input[type!=submit],select').not(input).not('[type=image]');
|
||||
|
||||
filters.prop('disabled', input.val().length > 0);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
echo input_tag('filters[price][from]', isset($filters['price']['from']) ? $filters['price']['from'] : null, array(
|
||||
'size' => 10,
|
||||
'class' => 'range-filter',
|
||||
'disabled' => isset($filters['number']) && $filters['number'],
|
||||
'data-format' => 'decimal',
|
||||
));
|
||||
echo ' - ';
|
||||
echo input_tag('filters[price][to]', isset($filters['price']['to']) ? $filters['price']['to'] : null, array(
|
||||
'size' => 10,
|
||||
'class' => 'range-filter',
|
||||
'disabled' => isset($filters['number']) && $filters['number'],
|
||||
'data-format' => 'decimal',
|
||||
));
|
||||
@@ -0,0 +1 @@
|
||||
<?php echo input_tag('filters[product_code]', isset($filters['product_code']) ? $filters['product_code'] : null, array('disabled' => isset($filters['number']) && $filters['number'])); ?>
|
||||
@@ -0,0 +1 @@
|
||||
<?php echo select_tag('filters[status]', options_for_select(stAllegroApi::getStatusList(), isset($filters['status']) ? $filters['status'] : null, array('include_custom' => '---')), array('disabled' => isset($filters['number']) && $filters['number']));
|
||||
@@ -0,0 +1 @@
|
||||
<?php echo input_tag('filters[order_auctions]', isset($filters['order_auctions']) ? $filters['order_auctions'] : null); ?>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
if (isset($related_object) && $related_object instanceof Product)
|
||||
{
|
||||
echo st_get_partial('stProduct/header', array('related_object' => $related_object, 'title' => $title));
|
||||
}
|
||||
else
|
||||
{
|
||||
include st_admin_get_template_path(__FILE__);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<table class="st_record_list st_record_manager" cellspacing="0" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="25%"><?php echo __('Nazwa aukcji');?></th>
|
||||
<th width="8%"><?php echo __('Numer aukcji');?></th>
|
||||
<th width="10%"><?php echo __('Numer zamówienia');?></th>
|
||||
<th><?php echo __('Komunikat');?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($messages as $id => $message):?>
|
||||
<?php list($auctionId, $orderId) = explode('_', $id);?>
|
||||
<?php $auction = AllegroAuctionPeer::retrieveByPK($auctionId);?>
|
||||
<?php $order = OrderPeer::retrieveByPK($orderId);?>
|
||||
<?php if (is_object($auction)): ?>
|
||||
<tr>
|
||||
<td><?php echo st_external_link_to($auction->getName(), '@stAllegroPlugin?action=edit&id=' . $auction->getAuctionId() . '&product_id=' . $auction->getProductId(), array('target'=>'_blank'));?></td>
|
||||
<td><?php echo st_external_link_to($auction->getAuctionId(), '@stAllegroPlugin?action=edit&id=' . $auction->getAuctionId() . '&product_id=' . $auction->getProductId(), array('target'=>'_blank'));?></td>
|
||||
<td><?php echo is_object($order) ? st_external_link_to($order->getNumber(), 'stOrder/edit?id='.$orderId, array('target'=>'_blank')) : '-';?></td>
|
||||
<td><?php echo ($message !== true) ? __($message, null, 'stAllegroMessages') : '-';?></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php use_helper('stOrder', 'stDate') ?>
|
||||
<?php if ($orders): $currency = CurrencyPeer::retrieveByIso('PLN') ?>
|
||||
<table class="st_record_list st_record_manager" cellspacing="0" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="10%"><?php echo __('Numer zamówienia');?></th>
|
||||
<th><?php echo __('Złożone') ?></th>
|
||||
<th><?php echo __('Kwota') ?></th>
|
||||
<th><?php echo __('Oferty');?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($orders as $order):?>
|
||||
<tr>
|
||||
<td><a href="<?php echo st_url_for('@stOrder?action=edit&id=' . $order['id']) ?>" target="_blank"><?php echo $order['number'] ?></a></td>
|
||||
<td><?php echo st_format_date($order['created_at']) ?></td>
|
||||
<td><?php echo st_order_price_format($order['total_amount'], $currency) ?></td>
|
||||
<td>
|
||||
<?php foreach ($order['offers'] as $id): ?>
|
||||
<p><a href="<?php echo url_for('@stAllegroPlugin?action=edit&id=' . $id) ?>" target="_blank"><?php echo $id ?></a></p>
|
||||
<?php endforeach ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php else: ?>
|
||||
<p>
|
||||
<?php echo __('Brak nowych zamówień') ?>
|
||||
</p>
|
||||
<?php endif ?>
|
||||
@@ -0,0 +1,123 @@
|
||||
<?php use_helper('stAdminGenerator', 'Object', 'stAllegro', 'stAllegroParameter', 'stProgressBar');?>
|
||||
<?php
|
||||
$product_id = '';
|
||||
|
||||
if (isset($product))
|
||||
{
|
||||
$product_id = $product->getId();
|
||||
st_include_partial('stProduct/header', array('title' => __('Lista ofert', null, 'stAllegroBackend'), 'related_object' => $product, 'route' => null));
|
||||
st_include_component('stProduct', 'editMenu', array('related_object' => $product));
|
||||
}
|
||||
else
|
||||
{
|
||||
st_include_partial('stAllegroBackend/header', array('title' => __('Lista ofert', null, 'stAllegroBackend')));
|
||||
st_include_component('stAllegroBackend', 'listMenu');
|
||||
}
|
||||
?>
|
||||
|
||||
<div id="sf_admin_content">
|
||||
<?php if (!$config->get('offers_updated')): ?>
|
||||
<div style="margin: 100px auto; display: block; width: 303px; text-align: center"><?php echo progress_bar('stAllegroPluginUpdateProducts', 'stAllegroProductUpdateBar', 'execute', AllegroAuctionPeer::doCount(new Criteria())); ?></div>
|
||||
<?php else: ?>
|
||||
<?php st_include_partial('stAdminGenerator/message') ?>
|
||||
<?php st_include_partial('stAllegroBackend/list_filters', array('filters' => $filters, 'forward_parameters' => array('product_id' => $product_id))) ?>
|
||||
<?php if ($pager->getNbResults() > 0): ?>
|
||||
<?php st_include_partial('stAllegroBackend/list_pager', array('pager' => $pager, 'forward_parameters' => array(), 'url' => st_url_for('@stAllegroPlugin?action=list&product_id='.$product_id), 'prefix' => 'head')) ?>
|
||||
<form action="<?php echo url_for('@stAllegroPlugin?action=list&product_id='.$product_id) ?>" 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 style="width: 5%"> </th>
|
||||
<th style="width: 40%"><?php echo __('Tytuł') ?></th>
|
||||
<th><?php echo __('Kod produktu') ?></th>
|
||||
<th><?php echo __('Sztuk') ?></th>
|
||||
<th><?php echo __('W magazynie') ?></th>
|
||||
<th><?php echo __('Cena') ?></th>
|
||||
<th><?php echo __('Sprzedano') ?></th>
|
||||
<th><?php echo __('Status') ?></th>
|
||||
<th><?php echo __('Numer') ?></th>
|
||||
<th width="1%"> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($offers->offers as $index => $offer):
|
||||
$editUrl = url_for('@stAllegroPlugin?action=edit&id=' . $offer->id . '&product_id='.$product_id);
|
||||
$auction = AllegroAuctionPeer::retrieveByAuctionNumber($offer->id);
|
||||
?>
|
||||
|
||||
<tr class="<?php echo $index % 2 ? 'highlight' : '' ?>">
|
||||
<td>
|
||||
<ul class="st_object_actions">
|
||||
<li><a href="<?php echo $editUrl ?>" data-admin-action="edit"><img src="/images/backend/beta/icons/16x16/edit.png" class="tooltip"></a></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<a href="<?php echo $editUrl ?>" data-admin-action="edit">
|
||||
<img src="<?php echo $offer->primaryImage && $offer->primaryImage->url ? $offer->primaryImage->url : 'https://assets.allegrostatic.com/metrum/placeholder/placeholder-2447b7d18a.svg' ?>" style="max-width: 100%; min-width: 10px">
|
||||
</a>
|
||||
</td>
|
||||
<td style="white-space: normal"><a href="<?php echo $editUrl ?>" data-admin-action="edit"><?php echo $offer->name ?></a></td>
|
||||
<td><?php echo st_allegro_product_code($auction) ?></td>
|
||||
<td><?php echo $offer->stock ? $offer->stock->available : '' ?></td>
|
||||
<td><?php
|
||||
if ($auction && $auction->getProduct())
|
||||
{
|
||||
$auction->getProductOptionsArray();
|
||||
echo $auction->getProduct()->getStock();
|
||||
stNewProductOptions::clearCache($auction->getProduct());
|
||||
}
|
||||
?></td>
|
||||
<td><?php echo $offer->sellingMode ? stCurrency::formatPrice($offer->sellingMode->price->amount) . ' ' . $offer->sellingMode->price->currency : '' ?></td>
|
||||
<td><?php echo $offer->stock ? $offer->stock->sold : '' ?></td>
|
||||
<td>
|
||||
<?php echo st_allegro_status_label($offer->publication->status) ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if ($offer->publication->status == stAllegroApi::STATUS_ACTIVE): ?>
|
||||
<a href="<?php echo stAllegroApi::getOfferUrl($offer->id) ?>" target="_blank"><?php echo $offer->id ?></a>
|
||||
<?php else: ?>
|
||||
<?php echo $offer->id ?>
|
||||
<?php endif ?>
|
||||
</td>
|
||||
<td>
|
||||
<ul class="st_object_actions">
|
||||
<?php if ($offer->publication->status == stAllegroApi::STATUS_INACTIVE): ?>
|
||||
<li><a href="<?php echo url_for('@stAllegroPlugin?action=delete&id=' . $offer->id . '&product_id='.$product_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>
|
||||
<?php endif ?>
|
||||
<?php if ($offer->publication->status == stAllegroApi::STATUS_ACTIVE || $offer->publication->status == 'ENDED'): ?>
|
||||
<li><a href="<?php echo url_for('@stAllegroPlugin?action=duplicate&id=' . $offer->id . '&product_id='.$product_id) ?>"><img src="/images/backend/icons/duplicate.png" title="<?php echo __('Wystaw podobną') ?>" class="list_tooltip"></a></li>
|
||||
<?php endif ?>
|
||||
<?php if ($offer->publication->status == stAllegroApi::STATUS_ACTIVE): ?>
|
||||
<li><a href="<?php echo stAllegroApi::getOfferUrl($offer->id) ?>" target="_blank"><img src="/images/backend/icons/view.png" title="<?php echo __('Zobacz ofertę') ?>" class="list_tooltip"></a></li>
|
||||
<?php endif ?>
|
||||
</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 ofert") ?></p>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<?php if ($product_id): ?>
|
||||
<div id="list_actions">
|
||||
<?php echo st_get_admin_actions(array(
|
||||
array('type' => 'add', 'label' => __('Dodaj'), 'action' => '@stAllegroPlugin?action=edit&product_id='.$product_id),
|
||||
)); ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
|
||||
<script>
|
||||
jQuery(function($) {
|
||||
$('#list_actions').stickyBox();
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
||||
<?php st_include_partial('stAllegroBackend/footer');?>
|
||||
@@ -0,0 +1 @@
|
||||
<?php echo $allegro_auction->getAuctionId() ? st_external_link_to($allegro_auction->getAuctionId(), $allegro_auction->getAuctionLink(), array('target' => '_blank')) : '-';
|
||||
@@ -0,0 +1,7 @@
|
||||
<ul class="st_object_actions">
|
||||
<?php if($allegro_auction->getAuctionId()):?>
|
||||
<li><?php echo link_to(image_tag('/images/backend/icons/view.png', array('alt' => __('Podgląd'), 'title' => __('Podgląd'))), 'stProduct/allegroEdit?id='.$allegro_auction->getId().'&product_id='.$allegro_auction->getProductId().'&list=stAllegroPlugin');?></li>
|
||||
<?php else:?>
|
||||
<li><?php echo link_to(image_tag('/images/backend/icons/edit.png', array('alt' => __('Edycja'), 'title' => __('Edycja'))), 'stProduct/allegroEdit?id='.$allegro_auction->getId().'&product_id='.$allegro_auction->getProductId().'&list=stAllegroPlugin');?></li>
|
||||
<?php endif;?>
|
||||
</ul>
|
||||
@@ -0,0 +1 @@
|
||||
<?php echo st_external_link_to($allegro_auction->getProduct()->getCode(), 'stProduct/edit?id='.$allegro_auction->getProductId());
|
||||
@@ -0,0 +1 @@
|
||||
<?php echo $allegro_auction->getAuctionId() ? ($allegro_auction->getEnded() ? __('Zakończona') : __('Wystawiona')) : __('Do wystawienia');
|
||||
@@ -0,0 +1,299 @@
|
||||
<?php use_helper('stAdminGenerator', 'stAllegro', 'stAllegroParameter', 'stAllegroDelivery', 'stPartial');?>
|
||||
|
||||
<fieldset>
|
||||
<h2><?php echo __('Format sprzedaży') ?></h2>
|
||||
<div class="content">
|
||||
<?php echo st_admin_get_form_field('allegro_api_offer[selling_mode][price][amount]', __("Cena"), $offer->getSellingMode()->price ? $offer->getSellingMode()->price->amount : 0, 'input_tag', array(
|
||||
'class' => 'number-type update-pricing-fee-preview',
|
||||
'required' => true,
|
||||
'size' => 10,
|
||||
'data-precision' => 2,
|
||||
'data-min' => 0,
|
||||
'data-max' => 10000000,
|
||||
'postfix' => $offer->getSellingMode()->price ? $offer->getSellingMode()->price->currency : 'PLN'
|
||||
)) ?>
|
||||
<?php echo input_hidden_tag('allegro_api_offer[selling_mode][price][currency]', $offer->getSellingMode() && $offer->getSellingMode()->price ? $offer->getSellingMode()->price->currency : 'PLN'); ?>
|
||||
<?php echo st_admin_get_form_field('allegro_api_offer[stock]', __("Ilość"), $offer->getStock(), '_edit_stock', array('maxlength' => 50, 'size' => 60, 'required' => true, 'product' => $offer->getAllegroAuction()->getProduct())) ?>
|
||||
<?php echo st_admin_get_form_field('allegro_api_offer[publication][duration]', __("Czas trwania"), $offer->getPublication() ? $offer->getPublication()->duration : null, 'st_allegro_duration_time_select_tag', array('required' => true, 'disabled' => $offer->getPublication() && isset($offer->getPublication()->status) && $offer->getPublication()->status != stAllegroApi::STATUS_INACTIVE)) ?>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<h2><?php echo __('Dostawa i płatność') ?></h2>
|
||||
<div class="content">
|
||||
<?php echo st_admin_get_form_field('allegro_api_offer[delivery][shipping_rates][id]', __("Cennik dostawy"), $offer->getDelivery() && $offer->getDelivery()->shippingRates ? $offer->getDelivery()->shippingRates->id : null, 'st_allegro_shippin_rates_select_tag', array('required' => true)) ?>
|
||||
<?php echo st_admin_get_form_field('allegro_api_offer[delivery][handling_time]', __("Czas wysyłki"), $offer->getDelivery() ? $offer->getDelivery()->handlingTime : null, 'st_allegro_delivery_times_select_tag', array('required' => true)) ?>
|
||||
<?php echo st_admin_get_form_field('allegro_api_offer[payments][invoice]', __("Opcje faktury"), $offer->getPayments() ? $offer->getPayments()->invoice : null, 'st_allegro_payments_invoice_select_tag', array('required' => true)) ?>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<h2><?php echo __('Zdjęcia') ?></h2>
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<?php echo st_get_partial('stAllegroBackend/offer_images', array('images' => $offer->getImages() ? $offer->getImages() : array(), 'product' => $offer->getAllegroAuction()->getProduct(), 'name' => 'allegro_api_offer[images]')) ?>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<h2><?php echo __('Opis') ?></h2>
|
||||
<div class="content">
|
||||
<?php echo st_admin_get_form_field('allegro_api_offer[description]', false, $offer->getDescription()->sections, 'partial', array(
|
||||
'partial' => 'stAllegroBackend/description',
|
||||
)) ?>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<h2><?php echo __('Cechy przedmiotu') ?></h2>
|
||||
<div class="content">
|
||||
<?php echo st_get_component('stAllegroBackend', 'categoryParameters', array('offer' => $offer, 'name' => 'allegro_api_offer[parameters]', 'product' => $offer->getAllegroAuction()->getProduct())) ?>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<h2><?php echo __('Warunki oferty') ?></h2>
|
||||
<div class="content">
|
||||
<?php echo st_admin_get_form_field('allegro_api_offer[after_sales_services][return_policy][id]', __("Warunki zwrotów"), $offer->getAfterSalesServices() && $offer->getAfterSalesServices()->returnPolicy ? $offer->getAfterSalesServices()->returnPolicy->id : null, 'st_allegro_return_policy_select_tag') ?>
|
||||
<?php echo st_admin_get_form_field('allegro_api_offer[after_sales_services][implied_warranty][id]', __("Reklamacje"), $offer->getAfterSalesServices() && $offer->getAfterSalesServices()->impliedWarranty ? $offer->getAfterSalesServices()->impliedWarranty->id : null, 'st_allegro_implied_warranty_select_tag') ?>
|
||||
<?php echo st_admin_get_form_field('allegro_api_offer[after_sales_services][warranty][id]', __("Gwarancje"), $offer->getAfterSalesServices() && $offer->getAfterSalesServices()->warranty ? $offer->getAfterSalesServices()->warranty->id : null, 'st_allegro_warranty_select_tag') ?>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<h2><?php echo __('Opcje promowania') ?></h2>
|
||||
<div class="content">
|
||||
<?php echo st_admin_get_form_field('allegro_api_offer[promotion][emphasized_highlight_bold_package]', __("Pakiet promowania"), "true", 'checkbox_tag', array("checked" => $offer->getPromotion() ? $offer->getPromotion()->emphasizedHighlightBoldPackage : false, 'class' => 'update-pricing-fee-preview')) ?>
|
||||
<?php echo st_admin_get_form_field('allegro_api_offer[promotion][emphasized]', __("Wyróżnienie"), "true", 'checkbox_tag', array("checked" => $offer->getPromotion() ? $offer->getPromotion()->emphasized : false, 'class' => 'update-pricing-fee-preview')) ?>
|
||||
<?php echo st_admin_get_form_field('allegro_api_offer[promotion][bold]', __("Pogrubienie"), "true", 'checkbox_tag', array("checked" => $offer->getPromotion() ? $offer->getPromotion()->bold : false, 'class' => 'update-pricing-fee-preview')) ?>
|
||||
<?php echo st_admin_get_form_field('allegro_api_offer[promotion][highlight]', __("Podświetlenie"), "true", 'checkbox_tag', array("checked" => $offer->getPromotion() ? $offer->getPromotion()->highlight : false, 'class' => 'update-pricing-fee-preview')) ?>
|
||||
<?php echo st_admin_get_form_field('allegro_api_offer[promotion][department_page]', __("Oferta promowania na stronie kategorii"), "true", 'checkbox_tag', array("checked" => $offer->getPromotion() ? $offer->getPromotion()->departmentPage : false, 'class' => 'update-pricing-fee-preview')) ?>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<h2><?php echo __('Podsumowanie') ?></h2>
|
||||
<div class="content">
|
||||
<div id="st-allegro-pricing-free-preview-container" class="row">
|
||||
<?php echo st_get_component('stAllegroBackend', 'pricingFeePreview', array(
|
||||
'category' => $offer->getCategory()->id,
|
||||
'quantity' => $offer->getStock()->available,
|
||||
'price' => $offer->getSellingMode()->price->amount,
|
||||
"bold" => $offer->getPromotion() ? $offer->getPromotion()->bold : false,
|
||||
"highlight" => $offer->getPromotion() ? $offer->getPromotion()->highlight : false,
|
||||
"departmentPage" => $offer->getPromotion() ? $offer->getPromotion()->departmentPage : false,
|
||||
"emphasized" => $offer->getPromotion() ? $offer->getPromotion()->emphasized : false,
|
||||
"emphasizedHighlightBoldPackage" => $offer->getPromotion() ? $offer->getPromotion()->emphasizedHighlightBoldPackage : false,
|
||||
"offerId" => $offer->getId() ? $offer->getId() : null,
|
||||
"status" => $offer->getPublication() && isset($offer->getPublication()->status) ? $offer->getPublication()->status : null,
|
||||
)) ?>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
|
||||
<div id="edit_actions">
|
||||
<div style="float: left">
|
||||
<?php
|
||||
$actions = array(
|
||||
array('type' => 'list', 'label' => __('Lista'), 'action' => '@stAllegroPlugin?action=list&product_id=' . $sf_request->getParameter('product_id')),
|
||||
);
|
||||
|
||||
if (!$sf_request->getParameter('product_id'))
|
||||
{
|
||||
$actions[] = array('type' => 'edit', 'label' => __('Edycja produktu'), 'action' => '@stProduct?action=edit&id=' . $offer->getAllegroAuction()->getProduct()->getId());
|
||||
}
|
||||
else
|
||||
{
|
||||
$actions[] = array('type' => 'list', 'label' => __('Lista wszystkich ofert'), 'action' => '@stAllegroPlugin?action=list');
|
||||
}
|
||||
|
||||
echo st_get_admin_actions($actions);
|
||||
?>
|
||||
</div>
|
||||
<div style="float: right">
|
||||
<?php
|
||||
$actions = array();
|
||||
|
||||
$actions[] = array('type' => 'save', 'label' => __('Zapisz'));
|
||||
|
||||
if (!$offer->getPublication() || !isset($offer->getPublication()->status) || $offer->getPublication()->status == stAllegroApi::STATUS_INACTIVE)
|
||||
{
|
||||
if ($offer->getId())
|
||||
{
|
||||
$actions = array_merge(array(array('type' => 'delete', 'label' => __('Usuń'), 'action' => '@stAllegroPlugin?action=delete&id=' . $sf_request->getParameter('id') . '&product_id=' . $sf_request->getParameter('product_id'), 'params' => array('confirm' => __('Jesteś pewien, że chcesz usunąć szkic')))), $actions);
|
||||
}
|
||||
|
||||
$actions[] = array('type' => 'save', 'label' => __('Wystaw'), 'params' => array('name' => 'publish'));
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($offer->getPublication() && ($offer->getPublication()->status == stAllegroApi::STATUS_ACTIVE || $offer->getPublication()->status == stAllegroApi::STATUS_ENDED))
|
||||
{
|
||||
$actions = array_merge(array(array('type' => 'duplicate', 'label' => __('Wystaw podobną'), 'action' => '@stAllegroPlugin?action=duplicate&id=' . $sf_request->getParameter('id') . '&product_id=' . $sf_request->getParameter('product_id'))), $actions);
|
||||
}
|
||||
|
||||
if ($offer->getPublication() && $offer->getPublication()->status == stAllegroApi::STATUS_ENDED)
|
||||
{
|
||||
$actions[] = array('type' => 'save', 'label' => __('Wznów'), 'params' => array('name' => 'publish'));
|
||||
}
|
||||
|
||||
if ($offer->getPublication() && $offer->getPublication()->status == stAllegroApi::STATUS_ACTIVE)
|
||||
{
|
||||
$actions = array_merge(array(array('type' => 'delete', 'label' => __('Zakończ'), 'action' => '@stAllegroPlugin?action=end&id=' . $sf_request->getParameter('id') . '&product_id=' . $sf_request->getParameter('product_id'), 'params' => array('confirm' => __('Jesteś pewien, że chcesz zakończyć ofertę')))), $actions);
|
||||
}
|
||||
}
|
||||
|
||||
echo st_get_admin_actions($actions);
|
||||
?>
|
||||
</div>
|
||||
<div class="clr"></div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function($) {
|
||||
$(document).ready(function() {
|
||||
$('#edit_actions').stickyBox();
|
||||
<?php if ($offer->getAllegroAuction()->getProduct()->isNew()): ?>
|
||||
$('.st_product_options_picker').trigger('options_change');
|
||||
<?php endif ?>
|
||||
$('.update-pricing-fee-preview').change(function() {
|
||||
var form = $(this).closest('form');
|
||||
console.log(form);
|
||||
$.post('<?php echo url_for('@stAllegroPlugin?action=ajaxFeePreviewUpdate&id=' . ($offer->getId() ? $offer->getId() : 0)) . '&status=' . ($offer->getPublication() && isset($offer->getPublication()->status) ? $offer->getPublication()->status : '') ?>', form.serialize(), function(response) {
|
||||
$('#st-allegro-pricing-free-preview-container').html(response);
|
||||
});
|
||||
});
|
||||
|
||||
var container = $('#st-allegro-offer-form-container');
|
||||
|
||||
container.find('.number-type').change(function() {
|
||||
var input = $(this);
|
||||
var min = input.data('min');
|
||||
var max = input.data('max');
|
||||
var precision = input.data('precision');
|
||||
var value = input.val();
|
||||
|
||||
value = stPrice.fixNumberFormat(value, precision);
|
||||
|
||||
if (value < min) {
|
||||
value = min.toFixed(precision);
|
||||
} else if (value > max) {
|
||||
value = max.toFixed(precision);
|
||||
}
|
||||
|
||||
input.val(value);
|
||||
});
|
||||
|
||||
container.find('.string-type').change(function() {
|
||||
var input = $(this);
|
||||
input.val(input.val().trim());
|
||||
});
|
||||
|
||||
var parameterDependency = JSON.parse($('#st_allegro_parameter_dependency').val());
|
||||
|
||||
function arrayIntersect(array1, array2) {
|
||||
var array = array1.filter(function(n) {
|
||||
return array2.indexOf(n) !== -1;
|
||||
});
|
||||
|
||||
return array.length > 0;
|
||||
}
|
||||
|
||||
function updateParameterDependencies(parameterId, valueIds) {
|
||||
if (parameterDependency && parameterDependency[parameterId]) {
|
||||
$.each(parameterDependency[parameterId], function(parameterDependencyId, dependency) {
|
||||
if (dependency.required && dependency.required.length > 0) {
|
||||
var parameterContainer = container.find('.st_allegro_offer_parameter_' + parameterDependencyId);
|
||||
var label = parameterContainer.find('label');
|
||||
|
||||
if (arrayIntersect(dependency.required, valueIds)) {
|
||||
label.addClass("required");
|
||||
} else {
|
||||
label.removeClass("required");
|
||||
}
|
||||
}
|
||||
|
||||
if (dependency.display && dependency.display.length > 0) {
|
||||
|
||||
var parameterContainer = container.find('.st_allegro_offer_parameter_' + parameterDependencyId);
|
||||
|
||||
if (arrayIntersect(dependency.display, valueIds)) {
|
||||
parameterContainer.show();
|
||||
} else {
|
||||
parameterContainer.hide();
|
||||
}
|
||||
}
|
||||
|
||||
var parameter = container.find('[data-parameter-id='+parameterDependencyId+']');
|
||||
|
||||
|
||||
|
||||
if (parameter.is("select")) {
|
||||
parameter.children().each(function() {
|
||||
var child = $(this);
|
||||
if (!child.data('depends-on-value-ids') || arrayIntersect(child.data('depends-on-value-ids'), valueIds)) {
|
||||
child.show();
|
||||
} else {
|
||||
child.hide();
|
||||
if (parameter.val() == child.val()) {
|
||||
parameter.val(null);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
parameter.trigger('chosen:update');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
container.find('.st_allegro_parameter').change(function() {
|
||||
var formControl = $(this);
|
||||
var row = formControl.closest('.row');
|
||||
|
||||
if (formControl.is("[type=checkbox]")) {
|
||||
if (formControl.prop("checked")) {
|
||||
var selectedIds = row.data("selected-ids");
|
||||
selectedIds.push(formControl.val());
|
||||
row.data("selected-ids", selectedIds);
|
||||
} else {
|
||||
var selectedIds = row.data("selected-ids");
|
||||
var index = selectedIds.indexOf(formControl.val());
|
||||
|
||||
if (index > -1) {
|
||||
selectedIds.splice(index, 1);
|
||||
}
|
||||
|
||||
row.data("selected-ids", selectedIds);
|
||||
}
|
||||
}
|
||||
|
||||
if (formControl.is("select") || formControl.is("[type=checkbox]")) {
|
||||
if (formControl.data('custom-value-enabled')) {
|
||||
var custom = row.find('.st_allegro_parameter_dictionary_custom');
|
||||
|
||||
if (formControl.is("[type=checkbox]")) {
|
||||
if (formControl.data('ambiguous-value-id') == formControl.val())
|
||||
{
|
||||
if (formControl.prop("checked")) {
|
||||
custom.show().prop("disabled", false);
|
||||
} else {
|
||||
custom.hide().prop("disabled", true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (formControl.data('ambiguous-value-id') == formControl.val()) {
|
||||
custom.show().prop("disabled", false);
|
||||
} else {
|
||||
custom.hide().prop("disabled", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (formControl.is("select")) {
|
||||
updateParameterDependencies(formControl.data('parameter-id'), [ formControl.val() ]);
|
||||
} else if (formControl.is("[type=checkbox]")) {
|
||||
updateParameterDependencies(formControl.data('parameter-id'), row.data("selected-ids"));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(document).trigger('chosen:init', '#st-allegro-offer-form-container select');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,49 @@
|
||||
<div id="st-allegro-edit-images">
|
||||
<?php foreach ($images as $image): ?><div class="image" data-value="<?php echo $image->url ?>">
|
||||
<div class="image-overlay">
|
||||
<a href="#" class="delete" data-action="delete"><?php echo st_admin_get_icon('remove') ?></a>
|
||||
</div>
|
||||
<div class="thumbnail" style="background-image: url(<?php echo $image->url ?>)"></div>
|
||||
<input type="hidden" name="<?php echo $name ?>[][url]" value="<?php echo $image->url ?>" class="image-url">
|
||||
</div><?php endforeach ?><a href="#" class="add-image" id="st-allegro-offer-add-image-modal-trigger"></a>
|
||||
</div>
|
||||
|
||||
<?php echo modal('st-allegro-offer-add-image-modal', __('Dodaj zdjęcia produktu'), array(
|
||||
'remote_url' => st_url_for('@stAllegroPlugin?action=ajaxUploadOfferImages&product=' . $product->getId()),
|
||||
'trigger' => '#st-allegro-offer-add-image-modal-trigger',
|
||||
'width' => 960,
|
||||
)) ?>
|
||||
|
||||
<script id="add-offer-image-tpl" type="text/x-template">
|
||||
<div class="image" data-value="##image##">
|
||||
<div class="image-overlay">
|
||||
<a href="#" class="delete" data-action="delete"><?php echo st_admin_get_icon('remove') ?></a>
|
||||
</div>
|
||||
<div class="thumbnail" style="background-image: url(##image##)"></div>
|
||||
<input type="hidden" name="<?php echo $name ?>[][url]" value="##image##" class="image-url">
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
jQuery(function($) {
|
||||
$('#st-allegro-edit-images').on('click', 'a.delete', function() {
|
||||
var link = $(this);
|
||||
|
||||
link.closest('.image').remove();
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
var imageList = $('#st-allegro-edit-images');
|
||||
imageList.sortable({
|
||||
placeholder: "image-placeholder",
|
||||
tolerance: 'pointer',
|
||||
items: '> div',
|
||||
forcePlaceholderSize: false,
|
||||
cursor: 'move',
|
||||
handle: '.image-overlay',
|
||||
opacity: 0.5,
|
||||
});
|
||||
imageList.disableSelection();
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php use_helper('stPrice') ?>
|
||||
<?php $product_commission = $config->get('offer_product_commission', array('commission' => 0, 'round_type' => 'none')); ?>
|
||||
<?php echo input_tag('config[offer_product_commission][commission]', $product_commission['commission'], array('size' => 6)) ?>
|
||||
<?php echo st_price_add_format_behavior('config_offer_product_commission_commission', 1) ?>
|
||||
|
||||
<?php echo select_tag('config[offer_product_commission][round_type]', options_for_select(array(
|
||||
'none' => __('Nie zaokrąglaj'),
|
||||
'full_buck' => __('Zaokrąglaj do pełnych złotych')
|
||||
), $product_commission['round_type'])) ?>
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php foreach (AllegroAuctionPeer::doSelectAuctionIdsByOrder($order) as $auction_id): ?>
|
||||
<p><a href="<?php echo url_for('@stAllegroPlugin?action=edit&id=' . $auction_id) ?>" target="_blank"><?php echo $auction_id ?></a></p>
|
||||
<?php endforeach ?>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* @var AllegroApiOffer $allegro_api_offer
|
||||
*/
|
||||
|
||||
echo $allegro_api_offer->getSellingMode()->price->amount . ' ' . $allegro_api_offer->getSellingMode()->price->currency;
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
$message = !$status || $status == "INACTIVE" ? __('Przy wystawieniu oferty') : __('Przy zapisaniu oferty');
|
||||
?>
|
||||
<table cellspacing="0" cellpadding="0" class="st_record_list record_list" style="width: 100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php echo __('Opłata') ?></th>
|
||||
<th><?php echo __('Data naliczenia opłaty') ?></th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($fees->quotes as $index => $quote): ?>
|
||||
<tr>
|
||||
<td><?php echo $quote->name ?></td>
|
||||
<td><?php echo $quotes && isset($quotes->quotes[$index]) ? stAllegroApi::formatDate($quotes->quotes[$index]->nextDate) : $message ?></td>
|
||||
<td><?php echo $quote->fee->amount ?> <?php echo $quote->fee->currency ?> / <?php echo stAllegroApi::getIntervalToDays($quote->cycleDuration) ?> <?php echo __('dni') ?></td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* @var AllegroApiOffer $allegro_api_offer
|
||||
*/
|
||||
echo content_tag('span', image_tag($allegro_api_offer->getPrimaryImage() ? $allegro_api_offer->getPrimaryImage() : st_asset_get_blank_path(), array('style' => 'max-width: 32px')), array(
|
||||
'class' => 'd-flex',
|
||||
));
|
||||
@@ -0,0 +1,7 @@
|
||||
<div id="st-allegro-selected-product"><?php echo $value->getProduct() && isset($value->getProduct()->id) ? st_allegro_selected_product($value->getProduct()->id) : '' ?></div>
|
||||
<?php echo input_hidden_tag($name.'[id]', $value->getProduct() && isset($value->getProduct()->id) ? $value->getProduct()->id : null) ?>
|
||||
<?php echo st_get_admin_button('default', __("Wybierz produkt"), '#', array(
|
||||
'id' => 'st-allegro-assign-product-modal-trigger',
|
||||
'size' => 'small',
|
||||
'class' => 'bs-mt-2'
|
||||
)) ?>
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* @var AllegroApiOffer $value
|
||||
*/
|
||||
if (!$sf_request->hasErrors() && null === $value->getShopProduct() && $forward_parameters['product_id'])
|
||||
{
|
||||
$value->setShopProductId($forward_parameters['product_id']);
|
||||
}
|
||||
|
||||
$id = get_id_from_name($name);
|
||||
$selected = $value->getShopProduct() ? array(array('id' => $value->getShopProduct()->getId(), 'name' => $value->getShopProduct()->getName(), 'code' => $value->getShopProduct()->getCode())) : null;
|
||||
|
||||
echo st_allegro_product_search('shop_product', $selected, array(
|
||||
'required' => true,
|
||||
'tokenizer' => array(
|
||||
'onAdd' => ' function (item) {
|
||||
$.preloader.show();
|
||||
$.get("'.st_url_for('stAllegroBackend/ajaxGetProductOptionsPicker').'", { id: item.id }, function(response) {
|
||||
const row = $("#admin_edit_form .row_shop_product_options");
|
||||
if (response.length > 0) {
|
||||
row.find(".field").html(response);
|
||||
row.removeClass("hidden");
|
||||
} else {
|
||||
row.addClass("hidden");
|
||||
}
|
||||
$.preloader.hide();
|
||||
});
|
||||
|
||||
$("#'.$id.'").val(item.id);
|
||||
}',
|
||||
'onDelete' => 'function() {
|
||||
$("#admin_edit_form .row_shop_product_options").addClass("hidden");
|
||||
}',
|
||||
)
|
||||
));
|
||||
|
||||
echo input_hidden_tag($name, $value->getShopProduct() ? $value->getShopProduct()->getId() : null);
|
||||
?>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* @var AllegroApiOffer $value
|
||||
*/
|
||||
if ($value->getAllegroAuction()->productHasOptions())
|
||||
{
|
||||
echo st_get_component('stProductOptionsBackend', 'optionPicker', array('product' => $value->getAllegroAuction()->getProduct(), 'namespace' => $name, 'selected' => $value->getAllegroAuction()->getProductOptionsArray()));
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<div id="jstree" style="padding: 0px 10px 10px 0px; overflow: auto; max-height: 350px;"></div>
|
||||
|
||||
<div class="bs-mt-3 text-right">
|
||||
<button class="submit" type="button">
|
||||
<?php echo __('Wybierz', null, 'stAllegroBackend');?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function($) {
|
||||
$.getScript('/jQueryTools/jstree/js/jstree.min.js?v1', function() {
|
||||
var jstree = $('#jstree');
|
||||
jstree.jstree({
|
||||
themes: {
|
||||
url: "/jQueryTools/jstree/themes/default/style.css",
|
||||
theme: 'default'
|
||||
},
|
||||
html_data: {
|
||||
ajax: {
|
||||
url: function(node) {
|
||||
var id = node ? node.attr('id').replace('jstree-', '') : 0;
|
||||
return "<?php echo st_url_for('@stAllegroPlugin?action=ajaxCategoryChildren'); ?>?id="+id+"&path=<?php echo implode(',', $path) ?>";
|
||||
},
|
||||
type: 'POST'
|
||||
},
|
||||
data: '<?php echo $tree;?>'
|
||||
},
|
||||
plugins: ["themes", "html_data"]
|
||||
});
|
||||
|
||||
jstree.click(function(event) {
|
||||
var target = $(event.target).filter('input:radio');
|
||||
|
||||
if (target.length) {
|
||||
var id = event.target.value;
|
||||
jstree.data('selected', id);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,2 @@
|
||||
<?php echo st_get_component('stProductOptionsBackend', 'optionPicker', array('product' => $product, 'namespace' => 'product_options'));
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php use_helper('stAllegroParameter', 'stAllegro') ?>
|
||||
|
||||
<?php echo st_get_partial('stAdminGenerator/message') ?>
|
||||
|
||||
<?php if (!$sf_flash->has('warning')): ?>
|
||||
<?php if ($result && $result->products): ?>
|
||||
<div class="products">
|
||||
<?php foreach($result->products as $product): ?>
|
||||
<?php st_allegro_product($product) ?>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
<div class="pagination">
|
||||
<div class="prev control">
|
||||
<button type="submit" name="prev_page" style="display: none"><img src="https://assets.allegrostatic.com/metrum/icon/arrowhead-9148b8f39c.svg"> <?php echo __('Poprzednia') ?></button>
|
||||
</div>
|
||||
<?php if ($result->nextPage && $result->nextPage->id): ?>
|
||||
<div class="next control">
|
||||
<button type="submit" name="next_page" value="<?php echo $result->nextPage->id ?>"><?php echo __('Następna') ?> <img src="https://assets.allegrostatic.com/metrum/icon/arrowhead-9148b8f39c.svg"></button>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="message product-not-found"><?php echo __('Szukany produkt nie istnieje') ?></div>
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/**
|
||||
* @var Product $product
|
||||
*/
|
||||
/**
|
||||
* @var sfAsset $image
|
||||
*/
|
||||
use_helper('stAsset', 'stAdminGenerator')
|
||||
?>
|
||||
|
||||
<?php echo st_get_partial('stAdminGenerator/message') ?>
|
||||
|
||||
<form action="<?php echo url_for('@stAllegroPlugin?action=ajaxUploadOfferImages&product='. $product->getId()) ?>" method="post">
|
||||
<div class="images">
|
||||
<?php foreach ($product->getImages() as $image):
|
||||
/**
|
||||
* Generate thumbnail image workaround
|
||||
*/
|
||||
st_asset_image_path($image, 'allegro', 'product', true);
|
||||
$url = st_asset_image_path($image, 'allegro', 'product', false, true);
|
||||
?>
|
||||
<label class="image">
|
||||
<span style="background-image: url(<?php echo $url ?>)"></span>
|
||||
<input name="images[]" type="checkbox" value="<?php echo $image->getId() ?>">
|
||||
</label>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
|
||||
<div class="submit">
|
||||
<?php echo st_get_admin_actions(array(
|
||||
array('type' => 'add', 'label' => __('Dodaj'))
|
||||
)) ?>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
jQuery(function($){
|
||||
var tpl = $('#add-offer-image-tpl').html();
|
||||
|
||||
var addImageOverlay = $('#st-allegro-offer-add-image-modal');
|
||||
|
||||
addImageOverlay.find('form').submit(function() {
|
||||
var form = $(this);
|
||||
var url = form.prop('action');
|
||||
|
||||
// $(document).trigger("preloader", "show");
|
||||
|
||||
var imageContainer = $('#st-allegro-edit-images');
|
||||
|
||||
addImageOverlay.trigger('preloader.show');
|
||||
|
||||
$.post(url, form.serialize(), function(response) {
|
||||
if (typeof response === 'object' && response.images) {
|
||||
$.each(response.images, function() {
|
||||
var image = $(tpl.replace(/##image##/g, this));
|
||||
|
||||
imageContainer.find('.add-image').before(image);
|
||||
});
|
||||
|
||||
imageContainer.trigger('st-update-input-value');
|
||||
var api = addImageOverlay.data('overlay');
|
||||
api.getOverlay().find('input[type=checkbox]').prop("checked", false);
|
||||
api.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
addImageOverlay.find('.content').html(response);
|
||||
}
|
||||
|
||||
addImageOverlay.trigger('preloader.hide');
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php use_helper('stAdminGenerator', 'stProgressBar');?>
|
||||
<?php st_include_partial('stAllegroBackend/header', array('title' => __('Import zamówień'))); ?>
|
||||
|
||||
<?php st_include_partial('stAllegroBackend/list_menu') ?>
|
||||
|
||||
<?php st_admin_section_start() ?>
|
||||
<?php if($count > 0): ?>
|
||||
<?php echo progress_bar('stAllegroPluginImportOrder', 'stAllegroOrderBar', 'importOrder', $count); ?>
|
||||
<?php else:?>
|
||||
<div class="text-center bs-p-4">
|
||||
<?php echo __("Brak nowych zamówień do importu");?>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<?php st_admin_section_end() ?>
|
||||
|
||||
<?php st_include_partial('stAllegroBackend/footer', array('related_object' => null));?>
|
||||
Reference in New Issue
Block a user