first commit

This commit is contained in:
2024-10-25 23:02:37 +02:00
commit faeb2e52e8
7653 changed files with 1095335 additions and 0 deletions

View File

@@ -0,0 +1,78 @@
<? $i = ( $this -> current_page - 1 ) * 10 + 1;?>
<? foreach ( $this -> products as $product ):?>
<tr>
<td>
<?= $i++;?>
</td>
<td>
<div class="product-image">
<? if ( $product['images'][0]['src'] ):?>
<img src="<?= $product['images'][0]['src'];?>" alt="<?= $product['images'][0]['alt'];?>" class="img-responsive">
<? else:?>
<img src="/admin/layout/images/no-image.png" alt="Brak zdjęcia" class="img-responsive">
<? endif;?>
</div>
<div class="product-name">
<a href="/admin/shop_product/product_edit/id=<?= $product['id'];?>">
<?= $product['languages']['pl']['name'];?>
</a>
<a href="#" class="text-muted duplicate-product" product-id="<?= $product['id'];?>">duplikuj</a>
</div>
<small class="text-muted"><?= \admin\factory\ShopProduct::product_categories( $product['id'] );?></small>
</td>
<td class="text-center">
<input type="text" class="product-price form-control text-right" product-id="<?= $product['id'];?>" value="<?= $product['price_brutto'];?>" style="max-width: 75px;">
</td>
<td class="text-center">
<input type="text" class="product-price-promo form-control text-right" product-id="<?= $product['id'];?>" value="<?= $product['price_brutto_promo'];?>" style="max-width: 75px;">
</td>
<td class="text-center">
<?= $product['promoted'] ? '<span class="text-success text-bold">tak</span>' : 'nie';?>
</td>
<td class="text-center">
<?= $product['status'] ? 'tak' : '<span class="text-danger text-bold">nie</span>';?>
</td>
<td class="text-center">
<span class="text-muted"><?= (int)\admin\factory\shopProduct::get_product_quantity_list( $product['id'] );?></span>
</td>
<td class="text-center">
<?
if ( $product['baselinker_product_name'] != "" ) {
echo "<span title='" . htmlspecialchars( $product['baselinker_product_name'] ) . "'>" . mb_substr( $product['baselinker_product_name'], 0, 25, 'UTF-8' ) . "...</span>";
echo "<br>";
echo "<span class='text-danger baselinker-delete-linking' product-id='" . $product['id'] . "'>";
echo "<i class='fa fa-times'></i>usuń powiązanie";
echo "</span>";
} else {
echo "<span class='text-danger baselinker-product-search' product-id='" . $product['id'] . "'>";
echo "nie przypisano <i class='fa fa-search'></i>";
echo "</span>";
}
?>
</td>
<td class="text-center">
<?
if ( $product['apilo_product_name'] != "" ) {
echo "<span title='" . htmlspecialchars( $product['apilo_product_name'] ) . "'>" . mb_substr( $product['apilo_product_name'], 0, 25, "UTF-8" ) . "...</span>";
echo "<br>";
echo "<span class='text-danger apilo-delete-linking' product-id='" . $product['id'] . "'>";
echo "<i class='fa fa-times'></i>usuń powiązanie";
echo "</span>";
} else {
echo "<span class='text-danger apilo-product-search' product-id='" . $product['id'] . "'>";
echo "nie przypisano <i class='fa fa-search'></i>";
echo "</span>";
}
?>
</td>
<td>
<a href='/admin/shop_product/product_combination/product_id=<?= $product['id'];?>'>kombinacje (<?= \admin\factory\shopProduct::count_product_combinations( $product['id'] );?>)</a>
</td>
<td class="text-center">
<a href='/admin/shop_product/product_edit/id=<?= $product['id'];?>'>edytuj</a>
</td>
<td class="text-center">
<a href='/admin/shop_product/product_unarchive/product_id=<?= $product['id'];?>' class="product-unarchive">przywróć</a>
</td>
</tr>
<? endforeach;?>

View File

@@ -0,0 +1,488 @@
<div class="panel">
<div class="panel-body">
<a href="/admin/shop_product/product_edit/" class="btn btn-success select-all">Dodaj produkt</a>
</div>
<div class="panel-body pn">
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped mbn" id="table-products">
<thead>
<tr>
<th style="width: 10px;">#</th>
<th>Nazwa</th>
<th class="text-center" style="width: 100px;">Cena</th>
<th class="text-center" style="width: 100px;">Cena promocyjna</th>
<th class="text-center" style="width: 25px;">Promowany</th>
<th class="text-center" style="width: 25px;">Aktywny</th>
<th class="text-center" style="width: 75px;">Stan MG</th>
<th class="text-center" style="width: 100px;">Baselinker</th>
<th class="text-center" style="width: 100px;">Apilo</th>
<th class="text-center" style="width: 100px;">Kombinacje</th>
<th class="text-center" style="width: 75px;">Edytuj</th>
<th class="text-center" style="width: 75px;">Przywróć</th>
</tr>
<tr>
<th></th>
<th>
<input type="text" class="form-control table-search" field_name="name|ean|sku" placeholder="szukaj..." value="<?= htmlspecialchars( $this -> query_array['name'], ENT_QUOTES, 'UTF-8');?>">
</th>
<th colspan="10"></th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr>
<td colspan="12">
<ul class="pagination" pagination_max="<?= $this -> pagination_max;?>">
<li>
<a href="#" page="1" title="pierwsza strona">
<i class="fa fa-angle-double-left"></i>
</a>
</li>
<li>
<a href="#" class="previous" page="<?= ( $this -> current_page - 1 > 1 ) ? ( $this -> current_page - 1 ) : 1;?>" title="poprzednia strona">
<i class="fa fa-angle-left" title="poprzednia strona"></i>
</a>
</li>
<li>
<div>
Strona <span id="current-page"><?= $this -> current_page;?></span> z <span id="max_page"><?= $this -> pagination_max;?></span>
</div>
</li>
<li>
<a href="#" class="next" page="<?= ( $this -> current_page + 1 < $this -> pagination_max ) ? ( $this -> current_page + 1 ) : $this -> pagination_max;?>" title="następna strona">
<i class="fa fa-angle-right"></i>
</a>
</li>
<li>
<a href="#" class="last" page="<?= $this -> pagination_max;?>" title="ostatnia strona">
<i class="fa fa-angle-double-right"></i>
</a>
</li>
</ul>
</td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
<script type="text/javascript">
$( function() {
ajax_load_products( <?= $this -> current_page;?>, null );
$( 'body' ).on( 'change', '.table-search', function() {
ajax_load_products( 1 );
});
$( 'body' ).on( 'click', '.pagination a', function() {
var current_page = $( this ).attr( 'page' );
ajax_load_products( current_page );
});
$( 'body' ).on( 'click', '.product-unarchive', function(e) {
e.preventDefault();
var href = $( this ).attr( 'href' );
$.alert({
title: 'Pytanie',
content: 'Na pewno chcesz przywrócić wybrany produkt z archiwum?',
type: 'orange',
closeIcon: true,
closeIconClass: 'fa fa-times',
typeAnimated: true,
animation: 'opacity',
columnClass: 'col-12 col-lg-10',
theme: 'supervan',
icon: 'fa fa-question',
buttons: {
cancel: {
text: 'Nie',
btnClass: 'btn-success',
action: function() {}
},
confirm: {
text: 'Tak',
btnClass: 'btn-danger',
keys: ['enter'],
action: function() {
document.location.href = href;
}
}
}
});
return false;
});
$( 'body' ).on( 'change', '.product-price-promo', function(e)
{
var price = $( this ).val();
price = price.replace( ' ', '' );
price = parseFloat( price.replace( ',', '.' ) * 1 );
price = number_format( price, 2, '.', '' );
$( this ).val( price );
var product_id = $( this ).attr( 'product-id' );
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/shop_product/product_change_price_brutto_promo/',
data:
{
product_id: product_id,
price: price
},
beforeSend: function()
{
$( '#overlay' ).show();
},
success: function( data )
{
$( '#overlay' ).hide();
response = jQuery.parseJSON( data );
if ( response.status !== 'ok' )
create_error( response.msg );
}
});
});
$( 'body' ).on( 'change', '.product-price', function(e)
{
var price = $( this ).val();
price = price.replace( ' ', '' );
price = parseFloat( price.replace( ',', '.' ) * 1 );
price = number_format( price, 2, '.', '' );
$( this ).val( price );
var product_id = $( this ).attr( 'product-id' );
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/shop_product/product_change_price_brutto/',
data:
{
product_id: product_id,
price: price
},
beforeSend: function()
{
$( '#overlay' ).show();
},
success: function( data )
{
$( '#overlay' ).hide();
response = jQuery.parseJSON( data );
if ( response.status !== 'ok' )
create_error( response.msg );
}
});
});
$( 'body' ).on( 'click', '.duplicate-product', function(e)
{
e.preventDefault();
var product_id = $( this ).attr( 'product-id' );
$.alert({
title: 'Pytanie',
content: 'Na pewno chcesz wykonać duplikat produktu?',
type: 'orange',
closeIcon: true,
closeIconClass: 'fa fa-times',
typeAnimated: true,
animation: 'opacity',
columnClass: 'col-12 col-lg-10',
theme: 'modern',
icon: 'fa fa-question',
buttons: {
confirm: {
text: 'Tak (produkt bez kombinacji)',
btnClass: 'btn-success',
keys: ['enter'],
action: function() {
document.location.href = '/admin/shop_product/duplicate_product/product-id=' + product_id;
}
},
confirm2: {
text: 'Tak (produkt z KOMBINACJAMI)',
btnClass: 'btn-primary',
keys: ['enter'],
action: function() {
document.location.href = '/admin/shop_product/duplicate_product/product-id=' + product_id + '&combination=1';
}
},
cancel: {
text: 'Nie',
btnClass: 'btn-dark',
action: function() {}
}
}
});
})
// apilo product search
$( 'body' ).on( 'click', '.apilo-product-search', function() {
var product_id = $( this ).attr( 'product-id' );
$.ajax({
type: 'POST',
cache: false,
url: '/admin/integrations/apilo_product_search/',
data: {
product_id: product_id
},
beforeSend: function() {
$( '#overlay' ).show();
},
success: function( response ) {
data = jQuery.parseJSON( response );
if ( data.status == 'SUCCESS' ) {
var html = '<div class="apilo-found-products">';
html += '<p>Znaleziono ' + data.products.length + ' produktów</p>';
html += '<select class="form-control apilo-product-select" product-id="' + product_id + '">';
$.each( data.products, function( index, value ) {
html += '<option value="' + value.id + '">' + value.name + ' SKU: ' + value.sku + '</option>';
});
html += '</select>';
html += '<button class="btn btn-success apilo-product-select-save" product-id="' + product_id + '">Zapisz</button>';
html += '</div>';
$( 'span.apilo-product-search[product-id="' + product_id + '"]' ).closest( 'td' ).append( html );
} else if ( data.status == 'error' ) {
$.alert({
title: 'Błąd',
content: data.msg,
type: 'red',
closeIcon: true,
closeIconClass: 'fa fa-times',
typeAnimated: true,
animation: 'opacity',
columnClass: 'col-12 col-lg-10',
theme: 'modern',
icon: 'fa fa-exclamation-triangle',
buttons: {
confirm: {
text: 'OK',
btnClass: 'btn-danger',
keys: ['enter'],
action: function() {}
}
}
});
}
}
});
});
// delete apilo product linking
$( 'body' ).on( 'click', '.apilo-delete-linking', function() {
var product_id = $( this ).attr( 'product-id' );
$.ajax({
type: 'POST',
cache: false,
url: '/admin/shop_product/apilo_product_select_delete/',
data: {
product_id: product_id
},
beforeSend: function() {
$( '#overlay' ).show();
},
success: function( response ) {
data = jQuery.parseJSON( response );
if ( data.status == 'ok' ) {
$( 'span.apilo-delete-linking[product-id="' + product_id + '"]' ).closest('td').html( '<span class="text-danger apilo-product-search" product-id="' + product_id + '">nie przypisano <i class="fa fa-search"></i></span>' );
}
}
});
});
// delete baselinker product linking
$( 'body' ).on( 'click', '.baselinker-delete-linking', function() {
var product_id = $( this ).attr( 'product-id' );
$.ajax({
type: 'POST',
cache: false,
url: '/admin/shop_product/baselinker_product_select_delete/',
data: {
product_id: product_id
},
beforeSend: function() {
$( '#overlay' ).show();
},
success: function( response ) {
data = jQuery.parseJSON( response );
if ( data.status == 'ok' ) {
$( 'span.baselinker-delete-linking[product-id="' + product_id + '"]' ).closest('td').html( '<span class="text-danger baselinker-product-search" product-id="' + product_id + '">nie przypisano <i class="fa fa-search"></i></span>' );
}
}
});
});
$( 'body' ).on( 'click', '.baselinker-product-search', function() {
var product_id = $( this ).attr( 'product-id' );
$.ajax({
type: 'POST',
cache: false,
url: '/admin/shop_product/baselinker_product_search/',
data: {
product_id: product_id
},
beforeSend: function() {
$( '#overlay' ).show();
},
success: function( response ) {
data = jQuery.parseJSON( response );
if ( data.status == 'SUCCESS' ) {
var html = '<div class="baselinker-found-products">';
html += '<p>Znaleziono ' + data.products.length + ' produktów</p>';
html += '<select class="form-control baselinker-product-select" product-id="' + product_id + '">';
$.each( data.products, function( index, value ) {
html += '<option value="' + value.product_id + '">' + value.name + ' SKU: ' + value.sku + '</option>';
});
html += '</select>';
html += '<button class="btn btn-success baselinker-product-select-save" product-id="' + product_id + '">Zapisz</button>';
html += '</div>';
$( 'span.baselinker-product-search[product-id="' + product_id + '"]' ).closest( 'td' ).append( html );
} else if ( data.status == 'error' ) {
$.alert({
title: 'Błąd',
content: data.msg,
type: 'red',
closeIcon: true,
closeIconClass: 'fa fa-times',
typeAnimated: true,
animation: 'opacity',
columnClass: 'col-12 col-lg-10',
theme: 'modern',
icon: 'fa fa-exclamation-triangle',
buttons: {
confirm: {
text: 'OK',
btnClass: 'btn-danger',
keys: ['enter'],
action: function() {}
}
}
});
}
}
});
});
// apilo product select save
$( 'body' ).on( 'click', '.apilo-product-select-save', function(){
var product_id = $( this ).attr( 'product-id' );
var apilo_product_id = $( '.apilo-product-select[product-id="' + product_id + '"]' ).val();
var apilo_product_name = $( '.apilo-product-select[product-id="' + product_id + '"] option:selected' ).text();
$.ajax({
type: 'POST',
cache: false,
url: '/admin/shop_product/apilo_product_select_save/',
data: {
product_id: product_id,
apilo_product_id: apilo_product_id,
apilo_product_name: apilo_product_name
},
beforeSend: function() {
$( '#overlay' ).show();
},
success: function( response ) {
data = jQuery.parseJSON( response );
if ( data.status == 'ok' ) {
$( '.apilo-product-select[product-id="' + product_id + '"]' ).closest( '.apilo-found-products' ).remove();
$( 'span.apilo-product-search[product-id="' + product_id + '"]' ).html( '<span title="' + apilo_product_name + '">' + apilo_product_name.substr( 0, 25 ) + '...</span>' ).removeClass( 'apilo-product-search' ).removeClass( 'text-danger' );
}
}
});
});
$( 'body' ).on( 'click', '.baselinker-product-select-save', function(){
var product_id = $( this ).attr( 'product-id' );
var baselinker_product_id = $( '.baselinker-product-select[product-id="' + product_id + '"]' ).val();
var baselinker_product_name = $( '.baselinker-product-select[product-id="' + product_id + '"] option:selected' ).text();
$.ajax({
type: 'POST',
cache: false,
url: '/admin/shop_product/baselinker_product_select_save/',
data: {
product_id: product_id,
baselinker_product_id: baselinker_product_id,
baselinker_product_name: baselinker_product_name
},
beforeSend: function() {
$( '#overlay' ).show();
},
success: function( response ) {
data = jQuery.parseJSON( response );
if ( data.status == 'ok' ) {
$( '.baselinker-product-select[product-id="' + product_id + '"]' ).closest( '.baselinker-found-products' ).remove();
$( 'span.baselinker-product-search[product-id="' + product_id + '"]' ).html( '<span title="' + baselinker_product_name + '">' + baselinker_product_name.substr( 0, 25 ) + '...</span>' ).removeClass( 'baselinker-product-search' ).removeClass( 'text-danger' );
}
}
});
});
});
function ajax_load_products( current_page ) {
var pagination_max = parseInt( $( '.pagination' ).attr( 'pagination_max' ) );
var query = '';
$( '.table-search' ).each(function(){
query += $( this ).attr( 'field_name' ) + '=' + $( this ).val() + '&';
});
current_page = parseInt( current_page );
$.ajax({
type: 'POST',
cache: false,
url: '/admin/shop_product/ajax_load_products_archive/',
data: {
current_page: current_page,
query: query
},
beforeSend: function() {
$( '#overlay' ).show();
},
success: function( response ) {
$( '#overlay' ).hide();
data = jQuery.parseJSON( response );
if ( data.status == 'ok' ) {
$( '#table-products tbody' ).html( data.html );
$( '.pagination .previous' ).attr( 'page', ( current_page - 1 > 1 ) ? ( current_page - 1 ) : 1 );
$( '.pagination .next' ).attr( 'page', ( current_page + 1 < pagination_max ) ? ( current_page + 1 ) : pagination_max );
$( '.pagination span' ).html( current_page );
if ( data.pagination_max ) {
$( '.pagination' ).attr( 'pagination_max', data.pagination_max );
$( '.pagination #max_page' ).html( data.pagination_max );
$( '.pagination .last' ).attr( 'page', data.pagination_max );
}
}
}
});
}
</script>

View File

@@ -0,0 +1,783 @@
<script type="text/javascript" src="/libraries/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/libraries/ckeditor/adapters/jquery.js"></script>
<script type="text/javascript" src="/libraries/jquery/sortable/sortable.js"></script>
<?
global $db;
ob_start();
?>
<div id="settings-tabs">
<ul class="resp-tabs-list settings-tabs">
<li><i class="fa fa-file"></i>Treść</li>
<li><i class="fa fa-wrench"></i>Ustawienia</li>
<li><i class="fa fa-globe"></i>SEO</li>
<li><i class="fa fa-share-alt"></i>Wyświetlanie</li>
<li><i class="fa fa-file-image-o"></i>Galeria</li>
<li><i class="fa fa-file-archive-o"></i>Załączniki</li>
</ul>
<div class="resp-tabs-container settings-tabs">
<div>
<div id="languages-main">
<ul class="resp-tabs-list languages-main htabs">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<li><? if ( $lg['id'] == \front\factory\Languages::default_language() ) echo '<i class="fa fa-star fa-lg text-system" title="Język domyślny"></i> ';?><?= $lg['name'];?></a></li>
<? endif;?>
<? endforeach; endif;?>
</ul>
<div class="resp-tabs-container languages-main">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<?
$languages = array();
$languages[''] = '---- wersja językowa ----';
if ( is_array( $this -> languages ) ) foreach ( $this -> languages as $lg_tmp )
{
if ( $lg_tmp['id'] != $lg['id'] )
$languages[ $lg_tmp['id'] ] = $lg_tmp['name'];
}
?>
<? if ( $lg['status'] ):?>
<div>
<?= \Html::select(
array(
'label' => 'Wyświetlaj treść z wersji',
'name' => 'copy_from[' . $lg['id'] . ']',
'values' => $languages,
'value' => $this -> article['languages'][ $lg['id'] ]['copy_from'],
)
);?>
<?= \Html::input(
array(
'label' => 'Tytuł',
'name' => 'title[' . $lg['id'] . ']',
'id' => 'title_' . $lg['id'],
'value' => $this -> article['languages'][ $lg['id'] ]['title'],
'inline' => true
)
);?>
<?= \Html::input_icon( [
'label' => 'Zdjęcie tytułowe',
'name' => 'main_image[' . $lg['id'] . ']',
'id' => 'main_image_' . $lg['id'],
'value' => htmlspecialchars( $this -> article['languages'][ $lg['id'] ]['main_image'] ),
'icon_content' => 'przeglądaj',
'inline' => true,
'icon_js' => "window.open ( '/libraries/filemanager-9.14.1/dialog.php?type=1&popup=1&field_id=main_image_" . $lg['id'] . "&akey=c3cb2537d25c0efc9e573d059d79c3b8', 'mywindow', 'location=1,status=1,scrollbars=1, width=1100,height=700');"
] );
?>
<?= \Html::textarea(
array(
'label' => 'Wstęp',
'name' => 'entry[' . $lg['id'] . ']',
'id' => 'entry_' . $lg['id'],
'value' => $this -> article['languages'][ $lg['id'] ]['entry'],
'inline' => true
)
);?>
<?= \Html::textarea(
array(
'label' => 'Treść',
'name' => 'text[' . $lg['id'] . ']',
'id' => 'text_' . $lg['id'],
'value' => $this -> article['languages'][ $lg['id'] ]['text'],
'inline' => true
)
);?>
<?= \Html::textarea( [
'label' => 'Spis treści',
'name' => 'table_of_contents[' . $lg['id'] . ']',
'id' => 'table_of_contents_' . $lg['id'],
'value' => $this -> article['languages'][ $lg['id'] ]['table_of_contents'],
'inline' => true
] );?>
<script type="text/javascript">
$( function() {
$( '#text_<?= $lg['id'];?>, #entry_<?= $lg['id'];?>, #table_of_contents_<?= $lg['id'];?>' ).ckeditor( {
toolbar : 'MyToolbar',
height:'250'
});
});
</script>
</div>
<? endif;?>
<? endforeach; endif;?>
</div>
<div class="clear"></div>
</div>
</div>
<div>
<?= \Html::input_switch(
array(
'label' => 'Opublikowany',
'name' => 'status',
'checked' => $this -> article['status'] == 1 or !$this -> article['id'] ? true : false
)
);?>
<?= \Html::input_switch(
array(
'label' => 'Pokaż tytuł',
'name' => 'show_title',
'checked' => $this -> article['show_title'] == 1 ? true : false
)
);?>
<?= \Html::input_switch( [
'label' => 'Pokaż spis treści',
'name' => 'show_table_of_contents',
'checked' => $this -> article['show_table_of_contents'] == 1 ? true : false
] );?>
<?= \Html::input_switch(
array(
'label' => 'Pokaż datę dodania',
'name' => 'show_date_add',
'checked' => $this -> article['show_date_add'] == 1 ? true : false
)
);?>
<?= \Html::input_switch(
array(
'label' => 'Pokaż datę modyfikacji',
'name' => 'show_date_modify',
'checked' => $this -> article['show_date_modify'] == 1 ? true : false
)
);?>
<?= \Html::input_switch(
array(
'label' => 'Powtórz wprowadzenie',
'name' => 'repeat_entry',
'checked' => $this -> article['repeat_entry'] == 1 ? true : false
)
);?>
<?= \Html::input_switch(
array(
'label' => 'Linki do portali społecznościowych',
'name' => 'social_icons',
'checked' => $this -> article['social_icons'] == 1 ? true : false
)
);?>
</div>
<div>
<div id="languages-seo">
<ul class="resp-tabs-list languages-seo htabs">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<li><? if ( $lg['id'] == \front\factory\Languages::default_language() ) echo '<i class="fa fa-star fa-lg text-system" title="Język domyślny"></i> ';?><?= $lg['name'];?></a></li>
<? endif;?>
<? endforeach; endif;?>
</ul>
<div class="resp-tabs-container languages-seo">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<div>
<?= \Html::input_icon(
array(
'label' => 'Link SEO',
'name' => 'seo_link[' . $lg['id'] . ']',
'id' => 'seo_link_' . $lg['id'],
'value' => $this -> article['languages' ][ $lg['id'] ]['seo_link'],
'icon_content' => 'generuj',
'icon_js' => 'generate_seo_links( "' . $lg['id'] . '", $( "#title_' . $lg['id'] . '" ).val(), ' . (int)$this -> article['id'] . ' );'
)
);?>
<?= \Html::input( [
'label' => 'Meta title',
'name' => 'meta_title[' . $lg['id'] . ']',
'id' => 'meta_title_' . $lg['id'],
'value' => $this -> article['languages'][ $lg['id'] ]['meta_title']
]
);?>
<?= \Html::textarea(
array(
'label' => 'Meta description',
'name' => 'meta_description[' . $lg['id'] . ']',
'id' => 'meta_description_' . $lg['id'],
'value' => $this -> article['languages'][ $lg['id'] ]['meta_description']
)
);?>
<?= \Html::textarea(
array(
'label' => 'Meta keywords',
'name' => 'meta_keywords[' . $lg['id'] . ']',
'id' => 'meta_keywords_' . $lg['id'],
'value' => $this -> article['languages'][ $lg['id'] ]['meta_keywords']
)
);?>
<?= \Html::input_switch( [
'label' => 'Blokuj indeksację',
'name' => 'noindex[' . $lg['id'] . ']',
'id' => 'noindex_' . $lg['id'],
'checked' => $this -> article['languages'][ $lg['id'] ]['noindex'] == 1 ? 1 : 0
]
);?>
<?= \Html::input_switch( [
'label' => 'Blokuj bezpośredni dostęp',
'name' => 'block_direct_access[' . $lg['id'] . ']',
'id' => 'block_direct_access_' . $lg['id'],
'checked' => $this -> article['languages'][ $lg['id'] ]['block_direct_access'] == 1 ? 1 : 0
] );?>
</div>
<? endif;?>
<? endforeach; endif;?>
</div>
<div class="clear"></div>
</div>
</div>
<div>
<?
$layouts[''] = '---- szablon domyślny ----';
if ( is_array( $this -> layouts ) ): foreach ( $this -> layouts as $layout ):
$layouts[ $layout['id'] ] = $layout['name'];
endforeach; endif;
?>
<?= \Html::select(
array(
'label' => 'Szablon',
'name' => 'layout_id',
'id' => 'layout_id',
'values' => $layouts,
'value' => $this -> article['layout_id']
)
);?>
<div class="form-group">
<label class="col-lg-4 control-label">Wyświetlaj na:</label>
<div class="col-lg-8">
<?
if ( is_array( $this -> menus ) ) foreach ( $this -> menus as $menu )
{
?>
<div class="menu_sortable">
<ol class="sortable" id="sortable_<?= $menu['id'];?>">
<li id="list_<?= $menu['id'];?>" class="menu_<?= $menu['id'];?>" menu="<?= $menu['id'];?>">
<div class="context_0 content content_menu" <? if ( !$menu['status'] ) echo 'style="color: #cc0000;"';?>>
<span class="disclose"><span></span></span>
Menu: <b><?= $menu['name'];?></b>
</div>
<?= \admin\view\Articles::subpages_list( \admin\factory\Pages::menu_pages( $menu['id'] ), $this -> article['pages'] );?>
</li>
</ol>
</div>
<?
}
?>
</div>
<div class="clear"></div>
</div>
</div>
<div>
<ul id="images-list">
<?
$images_count = 0;
if ( is_array( $this -> article['images'] ) ): foreach ( $this -> article['images'] as $img ):
?>
<li id="image-<?= $img['id'];?>">
<img class="article-image lozad" data-src="/libraries/thumb.php?img=<?= $img['src'];?>&w=300&h=300">
<a href="#" class="input-group-addon btn btn-danger article_image_delete" image-id="<?= $img['id'];?>">
<i class="fa fa-trash"></i>
</a>
<input type="text" class="form-control image-alt" value="<?= $img['alt'];?>" image-id="<?= $img['id'];?>" placeholder="atrybut alt...">
</li>
<?
$images_count++;
endforeach; endif;
?>
</ul>
<div id="images-uploader">You browser doesn't have Flash installed.</div>
</div>
<div>
<ul id="files-list">
<?
$files_count = 0;
if ( is_array( $this -> article['files'] ) ): foreach ( $this -> article['files'] as $file ):
if ( $file['name'] )
$name = $file['name'];
else
{
$name = explode( '/', $file['src'] );
$name = $name[ count( $name ) - 1 ];
}
?>
<li id="file-<?= $file['id'];?>">
<div class="input-group">
<input type="text" class="article_file_edit form-control" file_id="<?= $file['id'];?>" value="<?= $name;?>" />
<a href="#" class="input-group-addon btn btn-info article_file_delete" file_id="<?= $file['id'];?>">
<i class="fa fa-trash"></i>
</a>
</div>
</li>
<?
$files_count++;
endforeach; endif;
?>
</ul>
<div id="files-uploader">You browser doesn't have Flash installed.</div>
</div>
</div>
</div>
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'article-edit';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Edycja artykułu';
$grid -> fields = [
[
'db' => 'id',
'type' => 'hidden',
'value' => $this -> article['id']
]
];
$grid -> actions = [
'save' => [ 'url' => '/admin/articles/article_save/', 'back_url' => '/admin/articles/view_list/' ],
'cancel' => [ 'url' => '/admin/articles/view_list/' ]
];
$grid -> external_code = $out;
$grid -> persist_edit = true;
$grid -> id_param = 'id';
echo $grid -> draw();
?>
<link type="text/css" rel="stylesheet" href="/libraries/plupload/jquery.plupload.queue/css/jquery.plupload.queue.css" />
<script type="text/javascript" src="/libraries/plupload/plupload.js"></script>
<script type="text/javascript" src="/libraries/plupload/plupload.flash.js"></script>
<script type="text/javascript" src="/libraries/plupload/plupload.html5.js"></script>
<script type="text/javascript" src="/libraries/plupload/plupload.html4.js"></script>
<script type="text/javascript" src="/libraries/plupload/jquery.plupload.queue/jquery.plupload.queue.js"></script>
<script type="text/javascript" src="/libraries/plupload/i18n/pl.js"></script>
<script type="text/javascript" src="/libraries/jquery-nested-sortable/jquery.mjs.nestedSortable.js"></script>
<script type="text/javascript" src="/libraries/jquery/lozad.js"></script>
<script type="text/javascript">
var images_count = <?= $images_count;?>;
var files_count = <?= $files_count;?>;
$( function()
{
const observer = lozad();
observer.observe();
disable_menu();
var el = document.getElementById( 'images-list' );
var sortable = Sortable.create(el, {
onEnd: function ( evt ) {
var order = '';
$( '#images-list li' ).each( function()
{
if ( order !== '' )
order += ';';
order += $( this ).children( 'a' ).attr( 'image-id' );
});
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/articles/gallery_order_save/',
data:
{
article_id: '<?= $this -> article['id'];?>',
order: order
},
beforeSend: function()
{
$( '#overlay' ).show();
},
success: function( data )
{
$( '#overlay' ).hide();
response = jQuery.parseJSON( data );
if ( response.status !== 'ok' )
create_error( response.msg );
}
});
}
});
$( "#images-uploader" ).pluploadQueue(
{
runtimes: 'html5,flash,html4',
init:
{
Refresh: function(up)
{
$( ".plupload_buttons" ).css( "display", "inline" );
$( ".plupload_upload_status" ).css( "display", "inline" );
$( ".plupload_start" ).addClass( "plupload_disabled" );
$( ".plupload_start" ).removeClass( "plupload_disabled" );
},
UploadComplete: function()
{
$( ".plupload_buttons" ).css( "display", "inline" );
$( ".plupload_upload_status" ).css( "display", "inline" );
$( ".plupload_start" ).addClass( "plupload_disabled" );
$( ".plupload_start" ).removeClass( "plupload_disabled" );
},
FileUploaded: function( up, file, response )
{
data = jQuery.parseJSON( response.response );
$( '#images-list' ).append(
'<li id="image-' + data.image_id + '">' +
'<img class="article-image lozad" data-src="/libraries/thumb.php?img=' + data.data_link + '&w=300&h=300">' +
'<a href="#" class="input-group-addon btn btn-danger article_image_delete" image-id="' + data.image_id + '">' +
'<i class="fa fa-trash"></i>' +
'</a>' +
'<input type="text" class="form-control image-alt" value="" image-id="' + data.image_id + '" placeholder="atrybut alt...">' +
'</li>'
);
images_count++;
observer.observe();
$( 'html, body' ).animate({
scrollTop: $( "#images-uploader" ).offset().top
}, 1 );
}
},
url: '/libraries/plupload/upload-articles-images.php',
chunk_size: '1mb',
unique_names: false,
resize : {
width : <?= $this -> settings['image_px'] ? $this -> settings['image_px'] : '1920';?>,
height : <?= $this -> settings['image_px'] ? $this -> settings['image_px'] : '1920';?>,
quality : 95
},
filters: [
{ title: "Obrazki", extensions : "jpg, gif, png, bmp, jpeg" }
],
flash_swf_url: '/../libraries/plupload/plupload.flash.swf'
});
$( "#files-uploader" ).pluploadQueue(
{
runtimes: 'html5,flash,html4',
init:
{
Refresh: function( up )
{
$( ".plupload_buttons" ).css( "display", "inline" );
$( ".plupload_upload_status" ).css( "display", "inline" );
$( ".plupload_start" ).addClass( "plupload_disabled" );
$( ".plupload_start" ).removeClass( "plupload_disabled" );
},
FileUploaded: function( up, file, response )
{
data = jQuery.parseJSON( response.response );
$( '#files-list' ).append(
'<li id="file-' + data.file_id + '">' +
'<div class="input-group">' +
'<input type="text" class="form-control article_file_edit" file_id="' + data.file_id + '" value="' + data.file_name + '" />' +
'<a href="#" class="input-group-addon btn btn-info article_file_delete" file_id="' + data.file_id + '">' +
'<i class="fa fa-trash"></i>' +
'</a>' +
'</div>' +
'</li>'
);
files_count++;
}
},
url: '/libraries/plupload/upload-articles-files.php',
chunk_size: '1mb',
unique_names: false,
filters: [
{ title: "Wszystkie pliki", extensions: "*" }
],
flash_swf_url: '/../libraries/plupload/plupload.flash.swf'
});
$( '#settings-tabs' ).easyResponsiveTabs({
width: 'auto',
fit: true,
tabidentify: 'settings-tabs',
type: 'vertical'
});
$( '#languages-main' ).easyResponsiveTabs({
width: 'auto',
fit: true,
tabidentify: 'languages-main'
});
$( '#languages-seo' ).easyResponsiveTabs({
width: 'auto',
fit: true,
tabidentify: 'languages-seo'
});
$('ol.sortable').nestedSortable({
forcePlaceholderSize: true,
handle: 'div',
helper: 'clone',
items: 'li',
opacity: .6,
placeholder: 'placeholder',
revert: 250,
tabSize: 25,
tolerance: 'pointer',
toleranceElement: '> div',
maxLevels: 3,
isTree: true,
expandOnHover: 700,
isAllowed: function()
{
return false;
}
});
$( '.disclose' ).on( 'click', function() {
$( this ).closest( 'li' ).toggleClass( 'sort-collapsed' ).toggleClass( 'sort-expanded' );
});
$( '.disclose' ).mousedown( function(e) {
if ( e.which === 1 ) {
if ( $( this ).parent( 'div' ).hasClass( 'content_menu' ) )
{
var menu_id = $( this ).parent( 'div' ).parent( 'li' ).attr( 'menu' );
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data: {
a: 'cookie_menus',
menu_id: menu_id
}
});
}
else
{
var page_id = $( this ).parent( 'div' ).parent( 'li' ).attr( 'id' );
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data: {
a: 'cookie_pages',
page_id: page_id
}
});
}
}
});
<?php
$array = unserialize( $_COOKIE[ 'cookie_pages' ] );
if ( is_array( $array ) ): foreach ( $array as $key => $val ):
if ( $val ):
?>$( '.<?= $key;?>' ).children( 'div' ).children( 'span.disclose' ).click();<?
endif;
endforeach; endif;
$array = unserialize( $_COOKIE[ 'cookie_menus' ] );
if ( is_array( $array ) ): foreach ( $array as $key => $val ):
if ( $val ):
?>$( '.menu_<?= $key;?>' ).children( 'div' ).children( 'span.disclose' ).click();<?
endif;
endforeach; endif;
?>
$( 'body' ).on( 'change', '.image-alt', function()
{
var image_alt = $( this ).val();
var image_id = $( this ).attr( 'image-id' );
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data:
{
a: 'article_image_alt_change',
image_id: image_id,
image_alt: image_alt
},
beforeSend: function()
{
$( '#overlay' ).show();
},
success: function( data )
{
$( '#overlay' ).hide();
response = jQuery.parseJSON( data );
if ( response.status !== 'ok' )
create_error( response.msg );
}
});
});
$( 'body' ).on( 'change', '.article_file_edit', function()
{
var file_name = $( this ).val();
var file_id = $( this ).attr( 'file_id' );
$.ajax({
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data:
{
a: 'article_file_name_change',
file_id: file_id,
file_name: file_name
},
beforeSend: function()
{
$( '#overlay' ).show();
},
success: function( data )
{
$( '#overlay' ).hide();
response = jQuery.parseJSON( data );
if ( response.status !== 'ok' )
create_error( response.msg );
}
});
});
$( 'body' ).on( 'click', '.article_file_delete', function()
{
$( this ).blur();
var file_id = $( this ).attr( 'file_id' );
$.prompt( 'Na pewno chcesz usunąć wybrany plik?', {
title: 'Potwierdź?',
submit: function(e,v,m,f)
{
if ( v === true )
{
$.ajax({
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data:
{
a: 'article_file_delete',
file_id: file_id
},
beforeSend: function()
{
$( '#file-' + file_id ).children( 'input' ).addClass( 'disabled' );
$( '#file-' + file_id ).children( 'a' ).addClass( 'disabled' );
},
success: function( data )
{
response = jQuery.parseJSON( data );
if ( response.status === 'ok' )
$( '#file-' + file_id ).remove();
else
create_error( msg );
}
});
}
},
buttons: {
'tak': true,
'nie': false
},
focus: 0
});
});
$( 'body' ).on( 'click', '.article_image_delete', function()
{
$( this ).blur();
var image_id = $( this ).attr( 'image-id' );
$.prompt( 'Na pewno chcesz usunąć wybrane zdjęcie?',
{
title: 'Potwierdź?',
submit: function(e,v,m,f)
{
if ( v === true )
{
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data:
{
a: 'article_image_delete',
image_id: image_id
},
beforeSend: function()
{
$( '#overlay' ).show();
},
success: function( data )
{
$( '#overlay' ).hide();
response = jQuery.parseJSON( data );
if ( response.status === 'ok' )
$( '#image-' + image_id ).remove();
else
create_error( msg );
}
});
}
},
buttons: {
'tak': true,
'nie': false
},
focus: 0
});
return false;
});
});
function generate_seo_links( lang, title, article_id )
{
if ( title === '' )
return false;
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data:
{
a: 'generate_seo_link',
title: title,
article_id: article_id
},
beforeSend: function()
{
$( '#seo_link_' + lang ).parents( '.g-form-data' ).find( 'input, a' ).each( function()
{
$( this ).prop( 'disabled', true ).addClass( 'disabled' );
});
},
success: function( data ) {
$( '#seo_link_' + lang ).parents( '.g-form-data' ).find( 'input, a' ).each( function() {
$( this ).prop( 'disabled', false ).removeClass( 'disabled' );
});
response = jQuery.parseJSON( data );
if ( response.status === 'ok' )
$( '#seo_link_' + lang ).val( response.seo_link );
else
create_error( response.msg );
}
});
}
</script>
<script>CKEDITOR.dtd.$removeEmpty['span'] = false;</script>

View File

@@ -0,0 +1,67 @@
<?php
global $gdb;
$grid = new \grid( 'pp_articles' );
$grid -> gdb_opt = $gdb;
$grid -> sql = 'SELECT *'
. 'FROM ( '
. 'SELECT '
. 'id, date_add, date_modify, status, '
. '( SELECT title FROM pp_articles_langs AS pal, pp_langs AS pl WHERE lang_id = pl.id AND article_id = pa.id AND title != \'\' ORDER BY o ASC LIMIT 1 ) AS title '
. 'FROM '
. 'pp_articles AS pa WHERE status = -1 '
. ') AS q1 '
. 'WHERE '
. '1=1 [where] '
. 'ORDER BY '
. '[order_p1] [order_p2]';
$grid -> sql_count = 'SELECT '
. 'COUNT(0) FROM ( '
. 'SELECT '
. 'id, date_add, date_modify, status, '
. '( SELECT title FROM pp_articles_langs AS pal, pp_langs AS pl WHERE lang_id = pl.id AND article_id = pa.id AND title != \'\' ORDER BY o ASC LIMIT 1 ) AS title '
. 'FROM '
. 'pp_articles AS pa WHERE status = -1 '
. ') AS q1 '
. 'WHERE '
. '1=1 [where] ';
$grid -> debug = true;
$grid -> order = [ 'column' => 'date_add', 'type' => 'DESC' ];
$grid -> columns_view = [
[
'name' => 'Lp.',
'th' => [ 'class' => 'g-lp' ],
'td' => [ 'class' => 'g-center' ],
'autoincrement' => true
],
[
'name' => 'Tytuł',
'db' => 'id',
'replace' => [ 'sql' => "SELECT title FROM pp_articles_langs AS pal, pp_langs AS pl WHERE lang_id = pl.id AND article_id = [id] AND title != '' ORDER BY o ASC LIMIT 1" ]
],
[
'name' => 'Data dodania',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 140px;' ],
'php' => 'echo date( "Y-m-d H:i", strtotime( "[date_add]" ) );'
],
[
'name' => 'Data modyfikacji',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 140px;' ],
'php' => 'echo date( "Y-m-d H:i", strtotime( "[date_modify]" ) );'
],
[
'name' => 'Akcja',
'th' => [ 'class' => 'g-center' ],
'td' => [ 'class' => 'g-center', 'style' => 'width: 50px;' ],
'content' => '<a href="/admin/articles_archive/article_restore/id=[id]">przywróć</a>'
],
[
'name' => 'Akcja',
'action' => [ 'type' => 'delete', 'url' => '/admin/articles_archive/article_delete/id=[id]' ],
'th' => [ 'class' => 'g-center' ],
'td' => [ 'class' => 'g-center', 'style' => 'width: 50px;' ]
]
];
echo $grid -> draw();

View File

@@ -0,0 +1,115 @@
<?php
global $gdb;
$grid = new \grid( 'pp_articles' );
$grid -> gdb_opt = $gdb;
$grid -> sql = 'SELECT *'
. 'FROM ( '
. 'SELECT '
. 'id, date_add, date_modify, status, '
. '( SELECT title FROM pp_articles_langs AS pal, pp_langs AS pl WHERE lang_id = pl.id AND article_id = pa.id AND title != \'\' ORDER BY o ASC LIMIT 1 ) AS title, '
. '( SELECT login FROM pp_users AS pu WHERE pu.id = pa.modify_by ) AS user '
. 'FROM '
. 'pp_articles AS pa WHERE status != -1 '
. ') AS q1 '
. 'WHERE '
. '1=1 [where] '
. 'ORDER BY '
. '[order_p1] [order_p2]';
$grid -> sql_count = 'SELECT '
. 'COUNT(0) FROM ( '
. 'SELECT '
. 'id, date_add, date_modify, status, '
. '( SELECT title FROM pp_articles_langs AS pal, pp_langs AS pl WHERE lang_id = pl.id AND article_id = pa.id AND title != \'\' ORDER BY o ASC LIMIT 1 ) AS title, '
. '( SELECT login FROM pp_users AS pu WHERE pu.id = pa.modify_by ) AS user '
. 'FROM '
. 'pp_articles AS pa WHERE status != -1 '
. ') AS q1 '
. 'WHERE '
. '1=1 [where] ';
$grid -> debug = true;
$grid -> order = [ 'column' => 'date_add', 'type' => 'DESC' ];
$grid -> search = [
[ 'name' => 'Tytuł', 'db' => 'title', 'type' => 'text' ],
[ 'name' => 'Aktywny', 'db' => 'status', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ],
[ 'name' => 'Data dodania', 'db' => 'date_add', 'type' => 'date_range' ],
[ 'name' => 'Data modyfikacji', 'db' => 'date_modify', 'type' => 'date_range' ]
];
$grid -> columns_view = [
[
'name' => 'Lp.',
'th' => [ 'class' => 'g-lp' ],
'td' => [ 'class' => 'g-center' ],
'autoincrement' => true
],
[
'name' => 'Tytuł',
'db' => 'title',
'sort' => true,
'php' => 'echo "[title]"; echo "<small class=\'text-muted\'>" . \admin\factory\Articles::article_pages( [id] ) . "</small>";'
],
[
'name' => 'Aktywny',
'db' => 'status',
'replace' => [ 'array' => [ 0 => '<span style="color: #FF0000;">nie</span>', 1 => 'tak' ] ],
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
'sort' => true
],
[
'name' => 'Data dodania',
'db' => 'date_add',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 220px;' ],
'php' => 'echo date( "Y-m-d H:i", strtotime( "[date_add]" ) );'
],
[
'name' => 'Data modyfikacji',
'db' => 'date_modify',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 220px;' ],
'php' => 'echo date( "Y-m-d H:i", strtotime( "[date_modify]" ) );'
],
[
'name' => 'Modyfikowany przez',
'db' => 'user',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 220px;' ],
],
[
'name' => 'Akcja',
'db' => 'id',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 120px;' ],
'php' => 'echo "<a href=\'#\' class=\'button\' url=\'/" . \admin\factory\Articles::article_url( [id] ) . "\'>wybierz</a>";'
]
];
echo $grid -> draw();
?>
<style type="text/css">
body.sb-top.sb-top-sm .navbar.navbar-fixed-top + #sidebar_left + #content_wrapper {
padding-top: 0;
}
</style>
<script type="text/javascript">
function getUrlParam(paramName)
{
var reParam = new RegExp('(?:[\?&]|&amp;)' + paramName + '=([^&]+)', 'i');
var match = window.location.search.match(reParam);
return (match && match.length > 1) ? match[1] : '';
}
$( function()
{
$( '#sidebar_left, .navbar-fixed-top' ).hide();
var funcNum = getUrlParam('CKEditorFuncNum');
$( 'body' ).on( 'click', '.button', function()
{
window.opener.CKEDITOR.tools.callFunction(funcNum, $( this ).attr( 'url' ) );
window.close();
});
});
</script>

View File

@@ -0,0 +1,100 @@
<?php
global $gdb;
$grid = new \grid( 'pp_articles' );
$grid -> gdb_opt = $gdb;
$grid -> sql = 'SELECT *'
. 'FROM ( '
. 'SELECT '
. 'id, date_add, date_modify, status, '
. '( SELECT title FROM pp_articles_langs AS pal, pp_langs AS pl WHERE lang_id = pl.id AND article_id = pa.id AND title != \'\' ORDER BY o ASC LIMIT 1 ) AS title, '
. '( SELECT login FROM pp_users AS pu WHERE pu.id = pa.modify_by ) AS user '
. 'FROM '
. 'pp_articles AS pa WHERE status != -1 '
. ') AS q1 '
. 'WHERE '
. '1=1 [where] '
. 'ORDER BY '
. '[order_p1] [order_p2]';
$grid -> sql_count = 'SELECT '
. 'COUNT(0) FROM ( '
. 'SELECT '
. 'id, date_add, date_modify, status, '
. '( SELECT title FROM pp_articles_langs AS pal, pp_langs AS pl WHERE lang_id = pl.id AND article_id = pa.id AND title != \'\' ORDER BY o ASC LIMIT 1 ) AS title, '
. '( SELECT login FROM pp_users AS pu WHERE pu.id = pa.modify_by ) AS user '
. 'FROM '
. 'pp_articles AS pa WHERE status != -1 '
. ') AS q1 '
. 'WHERE '
. '1=1 [where] ';
$grid -> debug = true;
$grid -> order = [ 'column' => 'date_add', 'type' => 'DESC' ];
$grid -> search = [
[ 'name' => 'Tytuł', 'db' => 'title', 'type' => 'text' ],
[ 'name' => 'Aktywny', 'db' => 'status', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ],
[ 'name' => 'Data dodania', 'db' => 'date_add', 'type' => 'date_range' ],
[ 'name' => 'Data modyfikacji', 'db' => 'date_modify', 'type' => 'date_range' ]
];
$grid -> columns_view = [
[
'name' => 'Lp.',
'th' => [ 'class' => 'g-lp' ],
'td' => [ 'class' => 'g-center' ],
'autoincrement' => true
],
[
'name' => 'Tytuł',
'db' => 'title',
'sort' => true,
'php' => 'echo "<a href=\'/admin/articles/article_edit/id=[id]\'>[title]</a>"; echo "<small class=\'text-muted\'>" . \admin\factory\Articles::article_pages( [id] ) . "</small>";'
],
[
'name' => 'Aktywny',
'db' => 'status',
'replace' => [ 'array' => [ 0 => '<span style="color: #FF0000;">nie</span>', 1 => 'tak' ] ],
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
'sort' => true
],
[
'name' => 'Data dodania',
'db' => 'date_add',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 220px;' ],
'php' => 'echo date( "Y-m-d H:i", strtotime( "[date_add]" ) );'
],
[
'name' => 'Data modyfikacji',
'db' => 'date_modify',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 220px;' ],
'php' => 'echo date( "Y-m-d H:i", strtotime( "[date_modify]" ) );'
],
[
'name' => 'Modyfikowany przez',
'db' => 'user',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 220px;' ],
],
[
'name' => 'Edytuj',
'action' => [ 'type' => 'edit', 'url' => '/admin/articles/article_edit/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
],
[
'name' => 'Usuń',
'action' => [ 'type' => 'delete', 'url' => '/admin/articles/article_delete/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
]
];
$grid -> buttons = [
[
'label' => 'Dodaj artykuł',
'url' => '/admin/articles/article_edit/',
'icon' => 'fa-plus-circle',
'class' => 'btn-success'
]
];
echo $grid -> draw();

View File

@@ -0,0 +1,16 @@
<? if ( is_array( $this -> pages ) ):?>
<ol>
<? foreach ( $this -> pages as $page ):?>
<li id="list_<?= $page['id'];?>" idk="<?= $page['id'];?>" class="sort-nonesting list_<?= $page['id'];?>" menu="<?= $page['menu_id'];?>">
<div class="content <?= $this -> step < 2 ? $tmp = 'content_page' : $tmp = 'content_page_last_level';?>" <? if ( !$page['status'] ) echo 'style="color: #cc0000;"';?>>
<span class="disclose"><span></span></span>
<input type="checkbox" class="g-checkbox" name="pages[]" value="<?= $page['id'];?>" <? if ( is_array( $this -> article_pages ) and in_array( $page['id'], $this -> article_pages ) ):?>checked="checked"<? endif;?> /><?= $page['title'];?>
</div>
<?
if ( is_array( $page['subpages'] ) )
echo \admin\view\Articles::subpages_list( $page['subpages'], $this -> article_pages, $page['id'], $this -> step + 1 );
?>
</li>
<? endforeach;?>
</ol>
<? endif;?>

View File

@@ -0,0 +1,180 @@
<script type="text/javascript" src="/libraries/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/libraries/ckeditor/adapters/jquery.js"></script>
<?
\S::set_session( 'admin', true );
global $db;
ob_start();
?>
<div id="settings-tabs">
<ul class="resp-tabs-list settings-tabs">
<li><i class="fa fa-wrench"></i>Ustawienia</li>
<li><i class="fa fa-file"></i>Zawartość</li>
</ul>
<div class="resp-tabs-container settings-tabs">
<div>
<?= \Html::input(
array(
'label' => 'Nazwa',
'name' => 'name',
'id' => 'name',
'value' => $this -> banner['name'],
'class' => 'require'
) );
?>
<?= \Html::input_switch(
array(
'label' => 'Aktywny',
'name' => 'status',
'checked' => $this -> banner['status'] == 1 or ! $this -> banner['id'] ? true : false
)
);
?>
<?= Html::input(
array(
'label' => 'Data rozpoczęcia',
'name' => 'date_start',
'id' => 'date_start',
'value' => $this -> banner['date_start'],
'class' => 'date'
)
);
?>
<?= \Html::input(
array(
'label' => 'Data zakończenia',
'name' => 'date_end',
'id' => 'date_end',
'value' => $this -> banner['date_end'],
'class' => 'date'
) );
?>
<?= \Html::input_switch(
array(
'label' => 'Slajder / Strona główna',
'name' => 'home_page',
'checked' => $this -> banner['home_page'] == 1 ? true : false
)
);
?>
</div>
<div>
<div id="languages-main">
<ul class="resp-tabs-list languages-main htabs">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<li><?= $lg['name'];?></a></li>
<? endif;?>
<? endforeach;
endif;?>
</ul>
<div class="resp-tabs-container languages-main">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<div>
<?= \Html::input_icon(
array(
'label' => 'Obraz',
'name' => 'src[' . $lg['id'] . ']',
'id' => 'src_' . $lg['id'],
'value' => $this -> banner['languages'][ $lg['id'] ]['src'],
'icon_content' => 'przeglądaj',
'icon_js' => "window.open ( 'http://" . $_SERVER['SERVER_NAME'] . "/libraries/filemanager-9.14.1/dialog.php?type=1&popup=1&field_id=src_" . $lg['id'] . "&akey=c3cb2537d25c0efc9e573d059d79c3b8', 'mywindow', 'location=1,status=1,scrollbars=1, width=1100,height=700');"
)
);
?>
<?= \Html::input(
array(
'label' => 'Url',
'name' => 'url[' . $lg['id'] . ']',
'id' => 'url_' . $lg['id'],
'value' => $this -> banner['languages'][ $lg['id'] ]['url']
)
);
?>
<?= \Html::textarea(
array(
'label' => 'Kod html',
'name' => 'html[' . $lg['id'] . ']',
'id' => 'html_' . $lg['id'],
'value' => $this -> banner['languages'][$lg['id']]['html']
)
);
?>
<?= \Html::textarea(
array(
'label' => 'Treść',
'name' => 'text[' . $lg['id'] . ']',
'id' => 'text_' . $lg['id'],
'value' => $this -> banner['languages'][$lg['id']]['text']
)
);
?>
<script type="text/javascript">
$(function () {
$('#text_<?= $lg['id'];?>').ckeditor({
toolbar: 'MyTool',
height: '300'
});
});
</script>
</div>
<? endif;?>
<? endforeach; endif;?>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'banner-edit';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Edycja baneru';
$grid -> fields = [
[
'db' => 'id',
'type' => 'hidden',
'value' => $this -> banner['id']
]
];
$grid -> external_code = $out;
$grid -> actions = [
'save' => [ 'url' => '/admin/banners/banner_save/', 'back_url' => '/admin/banners/view_list/' ],
'cancel' => [ 'url' => '/admin/banners/view_list/' ]
];
$grid -> persist_edit = true;
$grid -> id_param = 'id';
echo $grid -> draw();
?>
<script type="text/javascript">
$(function ()
{
disable_menu();
$('input[type="text"].date').datetimepicker({
format: "YYYY-MM-DD",
pickTime: false
});
$( '#settings-tabs' ).easyResponsiveTabs({
width: 'auto',
fit: true,
tabidentify: 'settings-tabs',
type: 'vertical'
});
$('#languages-main').easyResponsiveTabs({
width: 'auto',
fit: true,
tabidentify: 'languages-main'
});
});
</script>
<script>CKEDITOR.dtd.$removeEmpty['span'] = false;</script>

View File

@@ -0,0 +1,78 @@
<?php
global $gdb;
$grid = new \grid( 'pp_banners' );
$grid -> gdb_opt = $gdb;
$grid -> order = [ 'column' => 'name', 'type' => 'ASC' ];
$grid -> search = [
[ 'name' => 'Nazwa', 'db' => 'name', 'type' => 'text' ],
[ 'name' => 'Aktywny', 'db' => 'status', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ]
];
$grid -> columns_view = [
[
'name' => 'Lp.',
'th' => [ 'class' => 'g-lp' ],
'td' => [ 'class' => 'g-center' ],
'autoincrement' => true
],
[
'name' => 'Nazwa',
'db' => 'name',
'php' => 'echo "<a href=\'/admin/banners/banner_edit/id=[id]\'>[name]</a>";',
'sort' => true
],
[
'name' => 'Aktywny',
'db' => 'status',
'replace' => [ 'array' => [ 0 => '<span style="color: #FF0000;">nie</span>', 1 => 'tak' ] ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
'td' => [ 'class' => 'g-center' ]
],
[
'name' => 'Strona główna',
'db' => 'home_page',
'replace' => [ 'array' => [ 0 => 'nie', 1 => '<span class="text-system">tak</span>' ] ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
'td' => [ 'class' => 'g-center' ]
],
[
'name' => 'Slajder',
'db' => 'home_page',
'replace' => [ 'array' => [ 1 => 'nie', 0 => '<span class="text-system">tak</span>' ] ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
'td' => [ 'class' => 'g-center' ]
],
[
'name' => 'Data rozpoczęcia',
'th' => [ 'class' => 'g-center', 'style' => 'width: 140px;' ],
'td' => [ 'class' => 'g-center' ],
'php' => 'if ( "[date_start]" ) echo date( "Y-m-d", strtotime( "[date_start]" ) ); else echo "-";'
],
[
'name' => 'Data zakończenia',
'th' => [ 'class' => 'g-center', 'style' => 'width: 140px;' ],
'td' => [ 'class' => 'g-center' ],
'php' => 'if ( "[date_end]" ) echo date( "Y-m-d", strtotime( "[date_end]" ) ); else echo "-";'
],
[
'name' => 'Edytuj',
'action' => [ 'type' => 'edit', 'url' => '/admin/banners/banner_edit/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
],
[
'name' => 'Usuń',
'action' => [ 'type' => 'delete', 'url' => '/admin/banners/banner_delete/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
]
];
$grid -> buttons = [
[
'label' => 'Dodaj baner',
'url' => '/admin/banners/banner_edit/',
'icon' => 'fa-plus-circle',
'class' => 'btn-success'
]
];
echo $grid -> draw();

View File

@@ -0,0 +1,33 @@
<form method="POST" action="/admin/baselinker/bundling_products_save/">
<table class="table mbn table-hover table-striped table-bordered">
<thead>
<tr>
<th>Nazwa produktu</th>
<th>SKU</th>
<th>Produkt w Baselinker</th>
</tr>
</thead>
<tbody>
<? foreach ( $this -> products as $product ):?>
<tr>
<td><?= $product['name'];?> - <?= $product['id'];?></td>
<td><?= $product['sku'];?></td>
<td>
<select class="form-control" name="product_<?= $product['id'];?>">
<option value="">--- wybierz produkt ---</option>
<? foreach ( $this -> baselinker_products as $product_baselinker ):?>
<option value="<?= $product_baselinker['product_id'];?>"
<? if ( $product_baselinker['product_id'] == $product['baselinker_product_id'] or ( $product['sku'] == $product_baselinker['sku'] and $product['sku'] != "" ) ):?>selected="selected"<? endif;?>
>
<?= $product_baselinker['name'] . ' - ' . $product_baselinker['sku'];?>
<? endforeach;?>
</select>
</td>
</tr>
<? endforeach;?>
</tbody>
</table>
<button class="btn btn-success btn-sm">
<i class="fa fa-check-circle mr5"></i>Zapisz
</button>
</form>

View File

@@ -0,0 +1,250 @@
<div class="dashboard-summary">
<div class="panel panel-tile text-center">
<div class="panel-body bg-primary">
<h1 class="fs35 mbn"><?= number_format( $this -> summary_sales, 2, '.', ' ' );?> zł</h1>
<h6 class="text-white">wartość zamówień</h6>
</div>
</div>
<div class="panel panel-tile text-center">
<div class="panel-body bg-success">
<h1 class="fs35 mbn"><?= $this -> summary_orders;?></h1>
<h6 class="text-white">ilość zamówień</h6>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="dashboard-content">
<div class="dashboard-title">
Ostatnie zamówienia
</div>
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th scope="col">Data zamówienia</th>
<th scope="col">Nr zamówienia</th>
<th scope="col">Status</th>
<th scope="col" class="text-right">Wartość</th>
<th scope="col">Klient</th>
<th scope="col">Email</th>
<th scope="col">Telefon</th>
</tr>
</thead>
<tbody>
<? if ( \S::is_array_fix( $this -> last_orders ) ): foreach ( $this -> last_orders as $order ):?>
<tr class="status-<?= $order['status'];?>">
<td><?= date( "Y-m-d H:i", strtotime( $order['date_order'] ) );?></td>
<td>
<a href="/admin/shop_order/order_details/order_id=<?= $order['id'];?>"><?= $order['number'];?></a>
</td>
<td class="order-status"><?= $this -> order_statuses[ $order['status'] ];?></td>
<td class="text-right"><?= $order['summary'];?> zł</td>
<td><?= $order['client'];?></td>
<td><?= $order['client_email'];?></td>
<td><?= $order['client_phone'];?></td>
</tr>
<? endforeach; endif;?>
</tbody>
</table>
</div>
</div>
</div>
<div class="col-12">
<div class="dashboard-content">
<div class="dashboard-title">
Sprzedaż z ostatnich 24 m-cy
</div>
<div id="sale"></div>
</div>
</div>
<div class="col-12">
<div class="dashboard-content">
<div class="dashboard-title">
Sprzedaż wg godzin i dni
</div>
<?
$min = 999999999999999999;
for ( $i = 0; $i < 24; $i++ )
{
for ( $j = 1; $j < 8; $j++ )
{
if ( $max < $this -> sales_grid[$j][$i] )
$max = $this -> sales_grid[$j][$i];
if ( $min > (int) $this -> sales_grid[$j][$i] )
$min = (int) $this -> sales_grid[$j][$i];
}
}
?>
<div class="table-responsive">
<table class="sales-grid table">
<? for ( $i = 0; $i < 24; $i++ ):?>
<tr>
<td><?= $i;?></td>
<? for ( $j = 1; $j < 8; $j++ ):?>
<td style="background: rgba( 10, 92, 150, <?= (int) $this -> sales_grid[$j][$i] * 100 / $max / 100;?> ); <? if ( (int) $this -> sales_grid[$j][$i] * 100 / $max > 50 ):?> color: #FFF;<? endif;?>"><?= (int) $this -> sales_grid[$j][$i];?></td>
<? endfor;?>
</tr>
<? endfor;?>
<tr>
<td></td>
<td>poniedziałek | <? $sum = 0; for ( $i = 0; $i < 24; $i++ ): $sum += $this -> sales_grid[ 1 ][$i]; endfor; echo $sum;?></td>
<td>wtorek | <? $sum = 0; for ( $i = 0; $i < 24; $i++ ): $sum += $this -> sales_grid[ 2 ][$i]; endfor; echo $sum;?></td>
<td>środa | <? $sum = 0; for ( $i = 0; $i < 24; $i++ ): $sum += $this -> sales_grid[ 3 ][$i]; endfor; echo $sum;?></td>
<td>czwartek | <? $sum = 0; for ( $i = 0; $i < 24; $i++ ): $sum += $this -> sales_grid[ 4 ][$i]; endfor; echo $sum;?></td>
<td>piątek | <? $sum = 0; for ( $i = 0; $i < 24; $i++ ): $sum += $this -> sales_grid[ 5 ][$i]; endfor; echo $sum;?></td>
<td>sobota | <? $sum = 0; for ( $i = 0; $i < 24; $i++ ): $sum += $this -> sales_grid[ 6 ][$i]; endfor; echo $sum;?></td>
<td>niedziela | <? $sum = 0; for ( $i = 0; $i < 24; $i++ ): $sum += $this -> sales_grid[ 7 ][$i]; endfor; echo $sum;?></td>
</tr>
</table>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xl-6">
<div class="dashboard-content">
<div class="dashboard-title">
Najczęściej kupowane produkty
</div>
<div class="table-responsive">
<table class="table table-hover dashboard-products">
<thead>
<tr>
<th scope="col">Zdjęcie</th>
<th scope="col">Nazwa</th>
<th scope="col" class="text-center">Ilość</th>
<th scope="col" class="text-right">Wartość</th>
</tr>
</thead>
<tbody>
<? if ( \S::is_array_fix( $this -> best_sales_products ) ): foreach ( $this -> best_sales_products as $row ):?>
<? $product = \shop\Product::getFromCache( (int)$row['parent_product_id'], \front\factory\Languages::default_language() );?>
<tr>
<td>
<?
$img = '../' . $product['images'][0]['src'];
if ( file_exists( $img ) )
echo '<img src="'. $product['images'][0]['src'] . '">';
?>
</td>
<td><?= $product -> language['name'];?></td>
<td class="text-center"><?= $row['quantity_summary'];?></td>
<td class="text-right"><?= number_format( $row['sales'], 2, '.', " " );?> zł</td>
</tr>
<? endforeach; endif;?>
</tbody>
</table>
</div>
</div>
</div>
<div class="col-xl-6">
<div class="dashboard-content">
<div class="dashboard-title">
Najczęściej oglądane produkty
</div>
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th scope="col">Zdjęcie</th>
<th scope="col">Nazwa</th>
<th scope="col" class="text-center">Ilość</th>
</tr>
</thead>
<tbody>
<? if ( \S::is_array_fix( $this -> most_view_products ) ): foreach ( $this -> most_view_products as $row ):?>
<? $product = new \shop\Product( $row['id'] );?>
<tr>
<td>
<?
$img = '../' . $product['images'][0]['src'];
if ( file_exists( $img ) )
echo '<img src="'. $product['images'][0]['src'] . '">';
?>
</td>
<td><?= $product['language']['name'];?></td>
<td class="text-center"><?= $row['visits'];?></td>
</tr>
<? endforeach; endif;?>
</tbody>
</table>
</div>
</div>
</div>
<script type="text/javascript" src="/libraries/apexcharts/apexcharts.js"></script>
<script type="text/javascript">
$(function () {
var options = {
series: [{
name: 'Sprzedaż',
data: [ <? for ( $i = 23; $i >= 0; $i-- ) { echo number_format( (float)$this -> sales[$i]['sales'], 0 , '.', "" ); if ( $i != 0 ) echo ','; }?> ]
}],
chart: {
height: 600,
type: 'bar',
},
plotOptions: {
bar: {
dataLabels: {
position: 'top',
},
}
},
dataLabels: {
enabled: true,
formatter: function (val) {
return parseFloat(val).toFixed(0) + " zł";
},
offsetY: -20,
style: {
fontSize: '12px',
colors: ["#304758"]
}
},
stroke: {
curve: 'smooth'
},
xaxis: {
categories: [ <? for ( $i = 23; $i >= 0; $i-- ) { echo "'" . $this -> sales[$i]['date'] . "'"; if ( $i != 0 ) echo ','; }?> ],
position: 'bottom',
axisBorder: {
show: false
},
axisTicks: {
show: false
},
crosshairs: {
fill: {
type: 'gradient',
gradient: {
colorFrom: '#D8E3F0',
colorTo: '#BED1E6',
stops: [0, 100],
opacityFrom: 0.4,
opacityTo: 0.5,
}
}
}
},
yaxis: {
axisBorder: {
show: false
},
axisTicks: {
show: false,
},
labels: {
show: false,
formatter: function (val) {
return parseFloat(val).toFixed(2) + " zł";
}
}
}
};
var chart = new ApexCharts(document.querySelector("#sale"), options);
chart.render();
});
</script>

View File

@@ -0,0 +1,91 @@
<script type="text/javascript" src="/libraries/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/libraries/ckeditor/adapters/jquery.js"></script>
<?
global $db;
ob_start();
?>
<div id="settings-tabs">
<ul class="resp-tabs-list settings-tabs">
<li><i class="fa fa-file"></i>Treść</li>
</ul>
<div class="resp-tabs-container settings-tabs">
<div>
<div id="languages-main">
<ul class="resp-tabs-list languages-main htabs">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<li><?= $lg['name'];?></a></li>
<? endif;?>
<? endforeach; endif;?>
</ul>
<div class="resp-tabs-container languages-main">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<div>
<?= \Html::input(
array(
'label' => 'Tekst',
'name' => 'text[' . $lg['id'] . ']',
'id' => 'text_' . $lg['id'],
'value' => $this -> unit['languages'][ $lg['id'] ]['text'],
'inline' => true
)
);?>
</div>
<? endif;?>
<? endforeach; endif;?>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'unit-edit';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Edycja jednostki miary';
$grid -> fields = [
[
'db' => 'id',
'type' => 'hidden',
'value' => $this -> unit['id']
]
];
$grid -> actions = [
'save' => [ 'url' => '/admin/dictionaries/unit_save/', 'back_url' => '/admin/dictionaries/view_list/' ],
'cancel' => [ 'url' => '/admin/dictionaries/view_list/' ]
];
$grid -> external_code = $out;
$grid -> persist_edit = true;
$grid -> id_param = 'id';
echo $grid -> draw();
?>
<script type="text/javascript">
$( function()
{
disable_menu();
$( '#settings-tabs' ).easyResponsiveTabs({
width: 'auto',
fit: true,
tabidentify: 'settings-tabs',
type: 'vertical'
});
$( '#languages-main' ).easyResponsiveTabs({
width: 'auto',
fit: true,
tabidentify: 'languages-main'
});
});
</script>
<script>CKEDITOR.dtd.$removeEmpty['span'] = false;</script>

View File

@@ -0,0 +1,67 @@
<?php
global $gdb;
$grid = new \grid( 'pp_dictionaries_units' );
$grid -> gdb_opt = $gdb;
$grid -> sql = 'SELECT *'
. 'FROM ( '
. 'SELECT '
. 'id,'
. '( SELECT text FROM pp_units_langs AS psl, pp_langs AS pl WHERE lang_id = pl.id AND unit_id = ps.id AND text != \'\' ORDER BY o ASC LIMIT 1 ) AS text '
. 'FROM '
. 'pp_units AS ps '
. ') AS q1 '
. 'WHERE '
. '1=1 [where] '
. 'ORDER BY '
. '[order_p1] [order_p2]';
$grid -> sql_count = 'SELECT '
. 'COUNT(0) FROM ( '
. 'SELECT '
. 'id,'
. '( SELECT text FROM pp_units_langs AS psl, pp_langs AS pl WHERE lang_id = pl.id AND unit_id = ps.id AND text != \'\' ORDER BY o ASC LIMIT 1 ) AS text '
. 'FROM '
. 'pp_units AS ps '
. ') AS q1 '
. 'WHERE '
. '1=1 [where] ';
$grid -> debug = true;
$grid -> order = [ 'column' => 'id', 'type' => 'ASC' ];
$grid -> search = [
[ 'name' => 'Tekst', 'db' => 'text', 'type' => 'text' ]
];
$grid -> columns_view = [
[
'name' => 'Lp.',
'th' => [ 'class' => 'g-lp' ],
'td' => [ 'class' => 'g-center' ],
'autoincrement' => true
],
[
'name' => 'Tekst',
'db' => 'text',
'php' => 'echo "<a href=\'/admin/dictionaries/unit_edit/id=[id]\'>[text]</a>";',
'sort' => true
],
[
'name' => 'Edytuj',
'action' => [ 'type' => 'edit', 'url' => '/admin/dictionaries/unit_edit/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
],
[
'name' => 'Usuń',
'action' => [ 'type' => 'delete', 'url' => '/admin/dictionaries/unit_delete/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
]
];
$grid -> buttons = [
[
'label' => 'Dodaj jednostkę miary',
'url' => '/admin/dictionaries/unit_edit/',
'icon' => 'fa-plus-circle',
'class' => 'btn-success'
]
];
echo $grid -> draw();

View File

@@ -0,0 +1 @@
<iframe src="/libraries/filemanager-9.14.1/dialog.php?akey=c3cb2537d25c0efc9e573d059d79c3b8" style="border: 0px; width: 100%; height: 800px; background: #FFF; padding: 5px;"></iframe>

View File

@@ -0,0 +1,29 @@
<?
$out = '<a ';
$out .= 'class="btn ' . $this -> params['class'] . '" ';
if ( $this -> params['style'] )
$out .= 'style="' . $this -> params['style'] . '" ';
if ( $this -> params['js'] )
$out .= 'onclick="' . htmlspecialchars( $this -> params['js'] ) . '" ';
if ( $this -> params['url'] )
$out .= 'href="' . htmlspecialchars( $this -> params['url'] ) . '" ';
if ( $this -> params['id'] )
$out .= 'id="' . $this -> params['id'] . '" ';
if ( $this -> params['title'] )
$out .= 'title="' . htmlspecialchars( $this -> params['title'] ) . '" ';
if ( $this -> params['target'] )
$out .= 'target="' . $this -> params['target'] . '" ';
$out .= '>';
if ( $this -> params['icon'] )
$out .= '<i class="fa ' . $this -> params['icon'] . ' mr5"></i>';
$out .= $this -> params['text'];
$out .= '</a>';
echo $out;

View File

@@ -0,0 +1,8 @@
<div class="form-group row">
<label class="col-lg-3 control-label"><?= $this -> params['label'];?>:</label>
<div class="col-lg-9">
<p class="form-control-static" id="<?= $this -> params['id'];?>">
<?= $this -> params['text'];?>
</p>
</div>
</div>

View File

@@ -0,0 +1,72 @@
<?
if ( $this -> params['label'] )
{
$out .= '<div class="form-group row ';
if ( $this -> params['inline'] )
$out .= 'pl10 pr10';
$out .= '">';
$out .= '<label class="';
if ( !$this -> params['inline'] )
$out .= 'col-lg-4 ';
if ( $this -> params['inline'] )
$out .= 'col-12 mb5 ';
$out .= 'control-label">' . $this -> params['label'] . ':</label>';
$out .= '<div class="';
if ( !$this -> params['inline'] )
$out .= 'col-lg-8';
if ( $this -> params['inline'] )
$out .= 'col-12 ';
$out .= '">';
}
$out .= '<div class="input-group">';
$out .= '<input ';
$out .= 'type="' . $this -> params['type'] . '" ';
if ( $this -> params['id'] )
$out .= 'id="' . $this -> params['id'] . '" ';
if ( $this -> params['class'] or $this -> params['label'] )
{
if ( $this -> params['label'] )
$out .= 'class="' . $this -> params['class'] . ' form-control" ';
else if ( $this -> params['class'] )
$out .= 'class="' . $this -> params['class'] . '" ';
}
$out .= 'name="' . $this -> params['name'] . '" ';
$out .= 'value="' . $this -> secureHTML( $this -> params['value'] ) . '" ';
if ( $this -> params['js'] )
$out .= 'onchange="' . htmlspecialchars( $this -> params['js'] ) . '" ';
if ( $this -> params['js_key'] )
$out .= 'onkeyup="' . htmlspecialchars( $this -> params['js_key'] ) . '" ';
if ( $this -> params['style'] )
$out .= 'style="' . $this -> params['style'] . '" ';
if ( $this -> params['readonly'] )
$out .= 'readonly="readonly" ';
if ( $this -> params['autocomplete'] == 'off' )
$out .= 'autocomplete="off" ';
$out .= ' />';
$out .= '<span class="input-group-addon btn btn-info ' . $this -> params['icon_class'] . '"';
if ( $this -> params['icon_js'] )
$out .= 'onclick="' . htmlspecialchars( $this -> params['icon_js'] ) . '" ';
$out .= '>';
$out .= $this -> params['icon_content'];
$out .= '</span>';
$out .= '</div>';
if ( $this -> params['label'] )
{
$out .= '</div>';
$out .= '</div>';
}
echo $out;

View File

@@ -0,0 +1,27 @@
<?
$out .= '<div class="form-group row">';
$out .= '<label class="col-lg-4 control-label" ';
if ( $this -> params['id'] )
$out .= 'for="' . $this -> params['id'] . '" ';
else
$out .= 'for="' . $this -> params['name'] . '" ';
$out .= '>' . $this -> params['label'] . ':</label>';
$out .= '<div class="col-lg-8">';
$out .= '<input class="icheck" ';
if ( $this -> params['id'] )
$out .= 'id="' . $this -> params['id'] . '" ';
else
$out .= 'id="' . $this -> params['name'] . '" ';
$out .= 'name="' . $this -> params['name'] . '" type="checkbox"';
if ( $this -> params['checked'] )
$out .= 'checked="checked" ';
$out .= '>';
$out .= '</div>';
$out .= '</div>';
echo $out;

View File

@@ -0,0 +1,62 @@
<?
if ( $this -> params['label'] )
{
$out .= '<div class="form-group row ';
if ( $this -> params['inline'] )
$out .= 'pl10 pr10';
$out .= '">';
$out .= '<label class="';
if ( !$this -> params['inline'] )
$out .= 'col-lg-4 ';
if ( $this -> params['inline'] )
$out .= 'col-12 mb5 ';
$out .= 'control-label">' . $this -> params['label'] . ':</label>';
$out .= '<div class="';
if ( !$this -> params['inline'] )
$out .= 'col-lg-8';
if ( $this -> params['inline'] )
$out .= 'col-12 ';
$out .= '">';
}
$out .= '<input ';
$out .= 'type="' . $this -> params['type'] . '" ';
if ( $this -> params['id'] )
$out .= 'id="' . $this -> params['id'] . '" ';
if ( $this -> params['class'] or $this -> params['label'] )
{
if ( $this -> params['label'] )
$out .= 'class="' . $this -> params['class'] . ' form-control" ';
else if ( $this -> params['class'] )
$out .= 'class="' . $this -> params['class'] . '" ';
}
$out .= 'name="' . $this -> params['name'] . '" ';
$out .= 'value="' . $this -> secureHTML( $this -> params['value'] ) . '" ';
if ( $this -> params['style'] )
$out .= 'style="' . $this -> params['style'] . '" ';
if ( $this -> params['js'] )
$out .= 'onchange="' . htmlspecialchars( $this -> params['js'] ) . '" ';
if ( $this -> params['js_key'] )
$out .= 'onkeyup="' . htmlspecialchars( $this -> params['js_key'] ) . '" ';
if ( $this -> params['readonly'] )
$out .= 'readonly="readonly" ';
if ( $this -> params['autocomplete'] == 'off' )
$out .= 'autocomplete="off" ';
$out .= ' />';
if ( $this -> params['label'] )
{
$out .= '</div>';
$out .= '</div>';
}
echo $out;

View File

@@ -0,0 +1,8 @@
<div class="panel <?= $this -> params['class'];?>">
<div class="panel-heading">
<span class="panel-title"><?= $this -> params['title'];?></span>
</div>
<div class="panel-body">
<?= $this -> params['content'];?>
</div>
</div>

View File

@@ -0,0 +1,56 @@
<?
if ( $this -> params['label'] )
{
$out .= '<div class="form-group row ';
if ( $this -> params['inline'] )
$out .= 'pl10 pr10';
$out .= '">';
$out .= '<label class="';
if ( !$this -> params['inline'] )
$out .= 'col-lg-4 ';
if ( $this -> params['inline'] )
$out .= 'mb5 ';
$out .= 'control-label">' . $this -> params['label'] . ':</label>';
$out .= '<div class="';
if ( !$this -> params['inline'] )
$out .= 'col-lg-8';
$out .= '">';
}
$out .= '<select ';
if ( $this -> params['id'] )
$out .= 'id="' . $this -> params['id'] . '" ';
if ( $this -> params['class'] or $this -> params['label'] )
{
if ( $this -> params['label'] )
$out .= 'class="' . $this -> params['class'] . ' form-control" ';
else if ( $this -> params['class'] )
$out .= 'class="' . $this -> params['class'] . '" ';
}
$out .= 'name="' . $this -> params['name'] . '" ';
if ( $this -> params['style'] )
$out .= 'style="' . $this -> params['style'] . '" ';
$out .= '>';
if ( $this -> params['empty'] )
$out .= '<option value="">--- ' . mb_strtolower( $this -> params['label'], 'UTF-8' ) . ' ---</option>';
if ( is_array( $this -> params['values'] ) ) foreach ( $this -> params['values'] as $key => $val )
{
$out .= '<option value="' . $key . '"'; if ( $key == $this -> params['value'] ) $out .= 'selected="selected"'; $out .='>' . $val . '</option>';
}
$out .= '</select>';
if ( $this -> params['label'] )
{
$out .= '</div>';
$out .= '</div>';
}
echo $out;

View File

@@ -0,0 +1,54 @@
<?
if ( $this -> params['label'] )
{
$out .= '<div class="form-group row ';
if ( $this -> params['inline'] )
$out .= 'pl10 pr10';
$out .= '">';
$out .= '<label class="';
if ( !$this -> params['inline'] )
$out .= 'col-lg-4 ';
if ( $this -> params['inline'] )
$out .= 'col-12 mb5 ';
$out .= 'control-label">' . $this -> params['label'] . ':</label>';
$out .= '<div class="';
if ( !$this -> params['inline'] )
$out .= 'col-lg-8';
if ( $this -> params['inline'] )
$out .= 'col-12 ';
$out .= '">';
}
$out .= '<textarea ';
if ( $this -> params['id'] )
$out .= 'id="' . $this -> params['id'] . '" ';
if ( $this -> params['class'] or $this -> params['label'] )
{
if ( $this -> params['label'] )
$out .= 'class="' . $this -> params['class'] . ' form-control" ';
else if ( $this -> params['class'] )
$out .= 'class="' . $this -> params['class'] . '" ';
}
if ( $this -> params['js'] )
$out .= 'onchange="' . htmlspecialchars( $this -> params['js'] ) . '" ';
if ( $this -> params['js_key'] )
$out .= 'onkeyup="' . htmlspecialchars( $this -> params['js_key'] ) . '" ';
$out .= 'name="' . $this -> params['name'] . '" ';
if ( $this -> params['style'] )
$out .= 'style="' . $this -> params['style'] . '" ';
$out .= ' rows="' . $this -> params['rows'] . '">' . $this -> secureHTML( $this -> params['value'] ) . '</textarea>';
if ( $this -> params['label'] )
{
$out .= '</div>';
$out .= '</div>';
}
echo $out;

View File

@@ -0,0 +1,247 @@
<div class="panel panel-danger">
<div class="panel-heading">
<span class="panel-title">Ustawienia apilo.com</span>
</div>
<div class="panel-body">
<div class="row">
<div class="col-lg-6">
<div class="form-group mb10">
<label class="col-lg-3 control-label" for="inputDefault">Włącz synchronizację z apilo.com</label>
<div class="col-lg-9">
<div class="bs-component">
<div class="input-group">
<select class="form-control" id="enabled" name="enabled">
<option value="">--- wybierz ---</option>
<option value="0" <? if ( !$this -> settings['enabled'] ):?>selected<? endif;?>>nie</option>
<option value="1" <? if ( $this -> settings['enabled'] ):?>selected<? endif;?>>tak</option>
</select>
<span class="input-group-addon cursor" field-id="enabled">
<i class="fa fa-save"></i>
</span>
</div>
</div>
</div>
</div>
<div class="form-group mb10">
<label class="col-lg-3 control-label" for="inputDefault">Włącz synchronizację produktów</label>
<div class="col-lg-9">
<div class="bs-component">
<div class="input-group">
<select class="form-control" id="sync_products" name="sync_products">
<option value="">--- wybierz ---</option>
<option value="0" <? if ( !$this -> settings['sync_products'] ):?>selected<? endif;?>>nie</option>
<option value="1" <? if ( $this -> settings['sync_products'] ):?>selected<? endif;?>>tak</option>
</select>
<span class="input-group-addon cursor" field-id="sync_products">
<i class="fa fa-save"></i>
</span>
</div>
</div>
</div>
</div>
<div class="form-group mb10">
<label class="col-lg-3 control-label" for="inputDefault">Włącz synchronizację zamówień</label>
<div class="col-lg-9">
<div class="bs-component">
<div class="input-group">
<select class="form-control" id="sync_orders" name="sync_orders">
<option value="">--- wybierz ---</option>
<option value="0" <? if ( !$this -> settings['sync_orders'] ):?>selected<? endif;?>>nie</option>
<option value="1" <? if ( $this -> settings['sync_orders'] ):?>selected<? endif;?>>tak</option>
</select>
<span class="input-group-addon cursor" field-id="sync_orders">
<i class="fa fa-save"></i>
</span>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label" for="inputDefault">Data rozpoczęcia synchronizacji zamówień</label>
<div class="col-lg-9">
<div class="bs-component">
<div class="input-group">
<input class="form-control" type="text" id="sync_orders_date_start" name="sync_orders_date_start" placeholder="" value="<?= $this -> settings['sync_orders_date_start'];?>">
<span class="input-group-addon cursor" field-id="sync_orders_date_start">
<i class="fa fa-save"></i>
</span>
</div>
</div>
</div>
</div>
<div class="form-group mb10">
<label class="col-lg-3 control-label" for="inputDefault">Platforma</label>
<div class="col-lg-9">
<div class="bs-component">
<div class="input-group">
<?
$platform_list = unserialize( $this -> settings['platform-list'] );
?>
<select class="form-control" id="platform-id" name="platform-id">
<option value="">--- wybierz platformę ---</option>
<? foreach ( $platform_list as $platform ):?>
<option value="<?= $platform['id'];?>" <? if ( $this -> settings['platform-id'] == $platform['id'] ):?>selected<? endif;?>><?= $platform['name'];?> <?= $platform['description'];?></option>
<? endforeach;?>
</select>
<span class="input-group-addon cursor" field-id="platform-id">
<i class="fa fa-save"></i>
</span>
</div>
</div>
</div>
</div>
<div class="form-group mb10">
<label class="col-lg-3 control-label" for="inputDefault">Client ID</label>
<div class="col-lg-9">
<div class="bs-component">
<div class="input-group">
<input class="form-control" type="text" id="client-id" name="client-id" placeholder="" value="<?= $this -> settings['client-id'];?>">
<span class="input-group-addon cursor" field-id="client-id">
<i class="fa fa-save"></i>
</span>
</div>
</div>
</div>
</div>
<div class="form-group mb10">
<label class="col-lg-3 control-label" for="inputDefault">Client Secret</label>
<div class="col-lg-9">
<div class="bs-component">
<div class="input-group">
<input class="form-control" type="text" id="client-secret" name="client-secret" placeholder="" value="<?= $this -> settings['client-secret'];?>">
<span class="input-group-addon cursor" field-id="client-secret">
<i class="fa fa-save"></i>
</span>
</div>
</div>
</div>
</div>
<div class="form-group mb10">
<label class="col-lg-3 control-label" for="inputDefault">ID cennika</label>
<div class="col-lg-9">
<div class="bs-component">
<div class="input-group">
<input class="form-control" type="text" id="pricelist_id" name="pricelist_id" placeholder="" value="<?= $this -> settings['pricelist_id'];?>">
<span class="input-group-addon cursor" field-id="pricelist_id">
<i class="fa fa-save"></i>
</span>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label" for="inputDefault">Authorization Code</label>
<div class="col-lg-9">
<div class="bs-component">
<div class="input-group">
<input class="form-control" type="text" id="authorization-code" name="authorization-code" placeholder="" value="<?= $this -> settings['authorization-code'];?>" <? if ( $this -> settings['access-token'] ):?>readonly<? endif;?>>
<? if ( !$this -> settings['access-token'] ):?>
<span class="input-group-addon cursor" field-id="authorization-code">
<i class="fa fa-save"></i>
</span>
<? endif;?>
</div>
</div>
</div>
</div>
<? if ( $this -> settings['access-token'] ):?>
<div class="form-group">
<label class="col-lg-3 control-label" for="inputDefault">Access Token</label>
<div class="col-lg-9">
<div class="bs-component">
<div class="input-group">
<input class="form-control" type="text" id="access-token" name="access-token" placeholder="" value="<?= $this -> settings['access-token'];?>" readonly>
</div>
</div>
</div>
</div>
<? endif;?>
<? if ( $this -> settings['access-token-expire-at'] ):?>
<div class="form-group">
<label class="col-lg-3 control-label" for="inputDefault">Access Token Expire At</label>
<div class="col-lg-9">
<div class="bs-component">
<div class="input-group">
<input class="form-control" type="text" id="access-token-expire-at" name="access-token-expire-at" placeholder="" value="<?= $this -> settings['access-token-expire-at'];?>" readonly>
</div>
</div>
</div>
</div>
<? endif;?>
<? if ( $this -> settings['refresh-token'] ):?>
<div class="form-group">
<label class="col-lg-3 control-label" for="inputDefault">Refresh Token</label>
<div class="col-lg-9">
<div class="bs-component">
<div class="input-group">
<input class="form-control" type="text" id="refresh-token" name="refresh-token" placeholder="" value="<?= $this -> settings['refresh-token'];?>" readonly>
</div>
</div>
</div>
</div>
<? endif;?>
<? if ( $this -> settings['refresh-token-expire-at'] ):?>
<div class="form-group">
<label class="col-lg-3 control-label" for="inputDefault">Refresh Token Expire At</label>
<div class="col-lg-9">
<div class="bs-component">
<div class="input-group">
<input class="form-control" type="text" id="refresh-token-expire-at" name="refresh-token-expire-at" placeholder="" value="<?= $this -> settings['refresh-token-expire-at'];?>" readonly>
</div>
</div>
</div>
</div>
<? endif;?>
</div>
<div class="col-lg-6">
<? if ( !$this -> settings['access-token'] ):?>
<a href="#" class="btn btn-primary btn-block apilo-authorization">Autoryzuj się w apilo.com</a>
<? else:?>
<a href="/admin/integrations/get_payment_types_list/" class="btn btn-primary btn-block">Pobierz listę metod płatności</a>
<a href="/admin/integrations/get_carrier_account_list/" class="btn btn-primary btn-block">Pobierz listę kont przewoźników</a>
<a href="/admin/integrations/get_status_types_list/" class="btn btn-primary btn-block">Pobierz statusy zamówień</a>
<a href="/admin/integrations/get_platform_list/" class="btn btn-primary btn-block">Pobierz listę platform</a>
<? endif;?>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(function() {
$( 'body' ).on( 'click', '.apilo-authorization', function() {
$.ajax({
url: '/admin/integrations/apilo_authorization/',
type: 'POST',
success: function( response ) {
response = JSON.parse( response );
if ( response.status == 'ok' ) {
location.reload();
}
}
});
});
$('body').on('click', '.input-group-addon', function() {
var field_id = $(this).attr('field-id');
var value = $('#' + field_id).val();
$.ajax({
url: '/admin/integrations/apilo_settings_save/',
type: 'POST',
data: {
field_id: field_id,
value: value
},
success: function(response) {
response = JSON.parse(response);
if (response.status == 'ok') {
$('#' + field_id).val(response.value);
$('#' + field_id).closest('.form-group').addClass('has-success');
setTimeout(function() {
$('#' + field_id).closest('.form-group').removeClass('has-success');
}, 5000);
}
}
});
})
});
</script>

View File

@@ -0,0 +1,139 @@
<div class="panel panel-danger">
<div class="panel-heading">
<span class="panel-title">Ustawienia baselinker.com</span>
</div>
<div class="panel-body">
<div class="row">
<div class="col-lg-6">
<div class="form-group">
<label class="col-lg-3 control-label" for="inputDefault">Baselinker API</label>
<div class="col-lg-9">
<div class="bs-component">
<div class="input-group">
<input class="form-control" type="text" id="api_code" name="api_code" placeholder="" value="<?= $this -> settings['api_code'];?>">
<span class="input-group-addon cursor" field-id="api_code">
<i class="fa fa-save"></i>
</span>
</div>
</div>
</div>
</div>
<!-- magazyn -->
<? $storages_list = unserialize( $this -> settings['storages_list'] );?>
<div class="form-group mb10">
<label class="col-lg-3 control-label" for="inputDefault">Magazyn</label>
<div class="col-lg-9">
<div class="bs-component">
<div class="input-group">
<select name="storage_id" id="storage_id" class="form-control">
<option value="">--- wybierz ---</option>
<? foreach ( $storages_list as $storage ):?>
<option value="<?= $storage['storage_id'];?>" <? if ( $this -> settings['storage_id'] == $storage['storage_id'] ):?>selected<? endif;?>><?= $storage['name'];?></option>
<? endforeach;?>
</select>
<span class="input-group-addon cursor" field-id="storage_id">
<i class="fa fa-save"></i>
</span>
</div>
</div>
</div>
</div>
<div class="form-group mb10">
<label class="col-lg-3 control-label" for="inputDefault">Włącz synchronizację z baselinker.com</label>
<div class="col-lg-9">
<div class="bs-component">
<div class="input-group">
<select class="form-control" id="enabled" name="enabled">
<option value="">--- wybierz ---</option>
<option value="0" <? if ( !$this -> settings['enabled'] ):?>selected<? endif;?>>nie</option>
<option value="1" <? if ( $this -> settings['enabled'] ):?>selected<? endif;?>>tak</option>
</select>
<span class="input-group-addon cursor" field-id="enabled">
<i class="fa fa-save"></i>
</span>
</div>
</div>
</div>
</div>
<div class="form-group mb10">
<label class="col-lg-3 control-label" for="inputDefault">Włącz synchronizację produktów</label>
<div class="col-lg-9">
<div class="bs-component">
<div class="input-group">
<select class="form-control" id="sync_products" name="sync_products">
<option value="">--- wybierz ---</option>
<option value="0" <? if ( !$this -> settings['sync_products'] ):?>selected<? endif;?>>nie</option>
<option value="1" <? if ( $this -> settings['sync_products'] ):?>selected<? endif;?>>tak</option>
</select>
<span class="input-group-addon cursor" field-id="sync_products">
<i class="fa fa-save"></i>
</span>
</div>
</div>
</div>
</div>
<div class="form-group mb10">
<label class="col-lg-3 control-label" for="inputDefault">Włącz synchronizację zamówień</label>
<div class="col-lg-9">
<div class="bs-component">
<div class="input-group">
<select class="form-control" id="sync_orders" name="sync_orders">
<option value="">--- wybierz ---</option>
<option value="0" <? if ( !$this -> settings['sync_orders'] ):?>selected<? endif;?>>nie</option>
<option value="1" <? if ( $this -> settings['sync_orders'] ):?>selected<? endif;?>>tak</option>
</select>
<span class="input-group-addon cursor" field-id="sync_orders">
<i class="fa fa-save"></i>
</span>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label" for="inputDefault">Data rozpoczęcia synchronizacji zamówień</label>
<div class="col-lg-9">
<div class="bs-component">
<div class="input-group">
<input class="form-control" type="text" id="sync_orders_date_start" name="sync_orders_date_start" placeholder="" value="<?= $this -> settings['sync_orders_date_start'];?>">
<span class="input-group-addon cursor" field-id="sync_orders_date_start">
<i class="fa fa-save"></i>
</span>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-6">
<a href="/admin/integrations/baselinker_get_order_status_list/" class="btn btn-primary btn-block">Pobierz statusy zamówień</a>
<!-- pobierz listę magazynów -->
<a href="/admin/integrations/baselinker_get_storages_list/" class="btn btn-primary btn-block">Pobierz listę magazynów</a>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(function() {
$('body').on('click', '.input-group-addon', function() {
var field_id = $(this).attr('field-id');
var value = $('#' + field_id).val();
$.ajax({
url: '/admin/integrations/baselinker_settings_save/',
type: 'POST',
data: {
field_id: field_id,
value: value
},
success: function(response) {
response = JSON.parse(response);
if (response.status == 'ok') {
$('#' + field_id).val(response.value);
$('#' + field_id).closest('.form-group').addClass('has-success');
setTimeout(function() {
$('#' + field_id).closest('.form-group').removeClass('has-success');
}, 5000);
}
}
});
})
});
</script>

View File

@@ -0,0 +1,119 @@
<div class="panel panel-danger">
<div class="panel-heading">
<span class="panel-title">Ustawienia sellasist.com</span>
</div>
<div class="panel-body">
<div class="row">
<div class="col-lg-6">
<div class="form-group">
<label class="col-lg-3 control-label" for="inputDefault">Sellasist API</label>
<div class="col-lg-9">
<div class="bs-component">
<div class="input-group">
<input class="form-control" type="text" id="api_code" name="api_code" placeholder="" value="<?= $this -> settings['api_code'];?>">
<span class="input-group-addon cursor" field-id="api_code">
<i class="fa fa-save"></i>
</span>
</div>
</div>
</div>
</div>
<div class="form-group mb10">
<label class="col-lg-3 control-label" for="inputDefault">Włącz synchronizację z sellasist.com</label>
<div class="col-lg-9">
<div class="bs-component">
<div class="input-group">
<select class="form-control" id="enabled" name="enabled">
<option value="">--- wybierz ---</option>
<option value="0" <? if ( !$this -> settings['enabled'] ):?>selected<? endif;?>>nie</option>
<option value="1" <? if ( $this -> settings['enabled'] ):?>selected<? endif;?>>tak</option>
</select>
<span class="input-group-addon cursor" field-id="enabled">
<i class="fa fa-save"></i>
</span>
</div>
</div>
</div>
</div>
<div class="form-group mb10">
<label class="col-lg-3 control-label" for="inputDefault">Włącz synchronizację produktów</label>
<div class="col-lg-9">
<div class="bs-component">
<div class="input-group">
<select class="form-control" id="sync_products" name="sync_products">
<option value="">--- wybierz ---</option>
<option value="0" <? if ( !$this -> settings['sync_products'] ):?>selected<? endif;?>>nie</option>
<option value="1" <? if ( $this -> settings['sync_products'] ):?>selected<? endif;?>>tak</option>
</select>
<span class="input-group-addon cursor" field-id="sync_products">
<i class="fa fa-save"></i>
</span>
</div>
</div>
</div>
</div>
<div class="form-group mb10">
<label class="col-lg-3 control-label" for="inputDefault">Włącz synchronizację zamówień</label>
<div class="col-lg-9">
<div class="bs-component">
<div class="input-group">
<select class="form-control" id="sync_orders" name="sync_orders">
<option value="">--- wybierz ---</option>
<option value="0" <? if ( !$this -> settings['sync_orders'] ):?>selected<? endif;?>>nie</option>
<option value="1" <? if ( $this -> settings['sync_orders'] ):?>selected<? endif;?>>tak</option>
</select>
<span class="input-group-addon cursor" field-id="sync_orders">
<i class="fa fa-save"></i>
</span>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label" for="inputDefault">Data rozpoczęcia synchronizacji zamówień</label>
<div class="col-lg-9">
<div class="bs-component">
<div class="input-group">
<input class="form-control" type="text" id="sync_orders_date_start" name="sync_orders_date_start" placeholder="" value="<?= $this -> settings['sync_orders_date_start'];?>">
<span class="input-group-addon cursor" field-id="sync_orders_date_start">
<i class="fa fa-save"></i>
</span>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-6">
<a href="/admin/integrations/get_sellasist_status_types_list/" class="btn btn-primary btn-block">Pobierz statusy zamówień</a>
<a href="/admin/integrations/get_sellasist_payment_types_list/" class="btn btn-primary btn-block">Pobierz metody płatności</a>
<a href="/admin/integrations/get_sellasist_shipments_list/" class="btn btn-primary btn-block">Pobierz metody dostawy</a>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(function() {
$('body').on('click', '.input-group-addon', function() {
var field_id = $(this).attr('field-id');
var value = $('#' + field_id).val();
$.ajax({
url: '/admin/integrations/sellasist_settings_save/',
type: 'POST',
data: {
field_id: field_id,
value: value
},
success: function(response) {
response = JSON.parse(response);
if (response.status == 'ok') {
$('#' + field_id).val(response.value);
$('#' + field_id).closest('.form-group').addClass('has-success');
setTimeout(function() {
$('#' + field_id).closest('.form-group').removeClass('has-success');
}, 5000);
}
}
});
})
});
</script>

View File

@@ -0,0 +1,126 @@
<div class="panel panel-danger">
<div class="panel-heading">
<span class="panel-title">Ustawienia shopPRO</span>
</div>
<div class="panel-body">
<div class="row">
<div class="col-lg-6">
<div class="form-group mb10">
<label class="col-lg-3 control-label" for="inputDefault">Włącz integrację z innym sklepem ShopPRO</label>
<div class="col-lg-9">
<div class="bs-component">
<div class="input-group">
<select class="form-control" id="enabled" name="enabled">
<option value="">--- wybierz ---</option>
<option value="0" <? if ( !$this -> settings['enabled'] ):?>selected<? endif;?>>nie</option>
<option value="1" <? if ( $this -> settings['enabled'] ):?>selected<? endif;?>>tak</option>
</select>
<span class="input-group-addon cursor" field-id="enabled">
<i class="fa fa-save"></i>
</span>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label" for="inputDefault">DB host</label>
<div class="col-lg-9">
<div class="bs-component">
<div class="input-group">
<input class="form-control" type="text" id="db_host" name="db_host" placeholder="" value="<?= $this -> settings['db_host'];?>">
<span class="input-group-addon cursor" field-id="db_host">
<i class="fa fa-save"></i>
</span>
</div>
</div>
</div>
</div>
<!-- DB użytkownik -->
<div class="form-group">
<label class="col-lg-3 control-label" for="inputDefault">DB użytkownik</label>
<div class="col-lg-9">
<div class="bs-component">
<div class="input-group">
<input class="form-control" type="text" id="db_user" name="db_user" placeholder="" value="<?= $this -> settings['db_user'];?>">
<span class="input-group-addon cursor" field-id="db_user">
<i class="fa fa-save"></i>
</span>
</div>
</div>
</div>
</div>
<!-- DB hasło -->
<div class="form-group">
<label class="col-lg-3 control-label" for="inputDefault">DB hasło</label>
<div class="col-lg-9">
<div class="bs-component">
<div class="input-group">
<input class="form-control" type="text" id="db_password" name="db_password" placeholder="" value="<?= $this -> settings['db_password'];?>">
<span class="input-group-addon cursor" field-id="db_password">
<i class="fa fa-save"></i>
</span>
</div>
</div>
</div>
</div>
<!-- DB nazwa bazy -->
<div class="form-group">
<label class="col-lg-3 control-label" for="inputDefault">DB nazwa</label>
<div class="col-lg-9">
<div class="bs-component">
<div class="input-group">
<input class="form-control" type="text" id="db_name" name="db_name" placeholder="" value="<?= $this -> settings['db_name'];?>">
<span class="input-group-addon cursor" field-id="db_name">
<i class="fa fa-save"></i>
</span>
</div>
</div>
</div>
</div>
<!-- domena -->
<div class="form-group">
<label class="col-lg-3 control-label" for="inputDefault">domena</label>
<div class="col-lg-9">
<div class="bs-component">
<div class="input-group">
<input class="form-control" type="text" id="domain" name="domain" placeholder="" value="<?= $this -> settings['domain'];?>">
<span class="input-group-addon cursor" field-id="domain">
<i class="fa fa-save"></i>
</span>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-6">
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(function() {
$('body').on('click', '.input-group-addon', function() {
var field_id = $(this).attr('field-id');
var value = $('#' + field_id).val();
$.ajax({
url: '/admin/integrations/shoppro_settings_save/',
type: 'POST',
data: {
field_id: field_id,
value: value
},
success: function(response) {
response = JSON.parse(response);
if (response.status == 'ok') {
$('#' + field_id).val(response.value);
$('#' + field_id).closest('.form-group').addClass('has-success');
setTimeout(function() {
$('#' + field_id).closest('.form-group').removeClass('has-success');
}, 5000);
}
}
});
})
});
</script>

View File

@@ -0,0 +1,101 @@
<?
global $db;
ob_start();
?>
<?
if ( $this -> language['id'] )
{
echo \Html::input(
array(
'type' => 'hidden',
'name' => 'id',
'value' => $this -> language['id']
)
);
echo \Html::input(
array(
'type' => 'hidden',
'name' => 'o',
'value' => $this -> language['o']
)
);
echo \Html::input(
array(
'label' => 'Język',
'type' => 'text',
'class' => 'require',
'name' => 'name',
'value' => $this -> language['name']
)
);
}
else
{
echo \Html::input(
array(
'type' => 'hidden',
'name' => 'o',
'value' => $this -> order + 1
)
);
echo \Html::input(
array(
'label' => 'Język',
'type' => 'text',
'class' => 'require',
'name' => 'name'
)
);
echo \Html::input(
array(
'label' => 'ID (2 znaki)',
'class' => 'require',
'type' => 'text',
'name' => 'id'
)
);
}
?>
<?= \Html::input_switch(
array(
'label' => 'Aktywny',
'name' => 'status',
'checked' => $this -> language['status'] == 1 ? true : false
)
);?>
<?= \Html::input_switch(
array(
'label' => 'Domyślny',
'name' => 'start',
'checked' => $this -> language['start'] == 1 ? true : false
)
);?>
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'language-edit';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Edycja języka';
$grid -> external_code = $out;
$grid -> actions = [
'save' => [ 'url' => '/admin/languages/language_save/', 'back_url' => '/admin/languages/view_list/' ],
'cancel' => [ 'url' => '/admin/languages/view_list/' ]
];
$grid -> persist_edit = true;
$grid -> id_param = 'id';
echo $grid -> draw();
?>
<script type="text/javascript">
$( function()
{
disable_menu();
$( 'input[type="text"].date' ).datetimepicker({
format: "YYYY-MM-DD",
pickTime: false
});
});
</script>

View File

@@ -0,0 +1,58 @@
<?php
global $gdb;
$grid = new \grid( 'pp_langs' );
$grid -> gdb_opt = $gdb;
$grid -> order = [ 'column' => 'o', 'type' => 'ASC' ];
$grid -> search = [
[ 'name' => 'Język', 'db' => 'name', 'type' => 'text' ],
[ 'name' => 'Aktywny', 'db' => 'status', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ],
[ 'name' => 'Domyślny', 'db' => 'start', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ]
];
$grid -> columns_view = [
[
'name' => 'Lp.',
'th' => [ 'class' => 'g-lp' ],
'td' => [ 'class' => 'g-center' ],
'autoincrement' => true
],
[
'name' => 'Domyślny',
'db' => 'start',
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
'td' => [ 'class' => 'g-center' ],
'php' => 'if ( [start] ) echo "<span class=\'text-system\'>tak</span>"; else echo "nie";'
],
[
'name' => 'Aktywny',
'db' => 'status',
'replace' => [ 'array' => [ 0 => '<span style="color: #FF0000;">nie</span>', 1 => 'tak' ] ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
'td' => [ 'class' => 'g-center' ]
],
[
'name' => 'Język',
'db' => 'name'
],
[
'name' => 'Edytuj',
'action' => [ 'type' => 'edit', 'url' => '/admin/languages/language_edit/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
],
[
'name' => 'Usuń',
'action' => [ 'type' => 'delete', 'url' => '/admin/languages/language_delete/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
]
];
$grid -> buttons = [
[
'label' => 'Dodaj język',
'url' => '/admin/languages/language_edit/',
'icon' => 'fa-plus-circle',
'class' => 'btn-success'
]
];
echo $grid -> draw();

View File

@@ -0,0 +1,60 @@
<?
global $db;
ob_start();
?>
<?
echo \Html::input(
array(
'type' => 'text',
'label' => 'Tekst',
'name' => 'text',
'class' => 'require',
'value' => $this -> translation['text']
)
);
if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $language ):
echo \Html::input(
array(
'type' => 'text',
'label' => $language['name'],
'name' => $language['id'],
'value' => $this -> translation[$language['id']]
) );
endforeach;
endif;
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'translation-edit';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Edycja tłumaczenia';
$grid -> fields = [
[
'db' => 'id',
'type' => 'hidden',
'value' => $this -> translation['id']
]
];
$grid -> external_code = $out;
$grid -> actions = [
'save' => [ 'url' => '/admin/languages/translation_save/', 'back_url' => '/admin/languages/translation_list/' ],
'cancel' => [ 'url' => '/admin/languages/translation_list/' ]
];
$grid -> persist_edit = true;
$grid -> id_param = 'id';
echo $grid -> draw();
?>
<script type="text/javascript">
$(function ()
{
disable_menu();
$('input[type="text"].date').datetimepicker({
format: "YYYY-MM-DD",
pickTime: false
});
});
</script>

View File

@@ -0,0 +1,44 @@
<?php
global $gdb;
$grid = new \grid( 'pp_langs_translations' );
$grid -> gdb_opt = $gdb;
$grid -> order = [ 'column' => 'text', 'type' => 'ASC' ];
$grid -> search = [
[ 'name' => 'Tekst', 'db' => 'text', 'type' => 'text' ]
];
$grid -> columns_view = [
[
'name' => 'Lp.',
'th' => [ 'class' => 'g-lp' ],
'td' => [ 'class' => 'g-center' ],
'autoincrement' => true
],
[
'name' => 'Tekst',
'db' => 'text',
'php' => 'echo "<a href=\'/admin/languages/translation_edit/id=[id]\'>[text]</a>";',
'sort' => true
],
[
'name' => 'Edytuj',
'action' => [ 'type' => 'edit', 'url' => '/admin/languages/translation_edit/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
],
[
'name' => 'Usuń',
'action' => [ 'type' => 'delete', 'url' => '/admin/languages/translation_delete/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
]
];
$grid -> buttons = [
[
'label' => 'Dodaj tłumaczenie',
'url' => '/admin/languages/translation_edit/',
'icon' => 'fa-plus-circle',
'class' => 'btn-success'
]
];
echo $grid -> draw();

View File

@@ -0,0 +1,253 @@
<link rel="stylesheet" href="/libraries/codemirror/lib/codemirror.css" />
<link rel="stylesheet" href="/libraries/codemirror/theme/material.css" />
<script type="text/javascript" src="/libraries/jquery-nested-sortable/jquery.mjs.nestedSortable.js"></script>
<script type="text/javascript" src="/libraries/codemirror/lib/codemirror.js"></script>
<script type="text/javascript" src="/libraries/codemirror/mode/css/css.js"></script>
<script type="text/javascript" src="/libraries/codemirror/mode/xml/xml.js"></script>
<script type="text/javascript" src="/libraries/codemirror/mode/javascript/javascript.js"></script>
<script type="text/javascript" src="/libraries/codemirror/mode/htmlmixed/htmlmixed.js"></script>
<script type="text/javascript" src="/libraries/codemirror/addon/mode/multiplex.js"></script>
<script type="text/javascript">
$( function()
{
var code_html = CodeMirror.fromTextArea( document.getElementById( "html" ),{
lineWrapping: true,
mode: "text/html"
});
code_html.on( 'change', function(cm) {
$( '#html' ).val( cm.getValue() );
});
code_html.setOption( "theme", 'material' );
code_html.setSize( null, 700 );
var code_css = CodeMirror.fromTextArea( document.getElementById( "css" ),{
lineWrapping: true,
mode: "css"
});
code_css.on( 'change', function(cm) {
$( '#css' ).val( cm.getValue() );
});
code_css.setOption( "theme", 'material' );
code_css.setSize( null, 700 );
var code_js = CodeMirror.fromTextArea( document.getElementById( "js" ),{
lineWrapping: true,
mode: "javascript"
});
code_js.on( 'change', function(cm) {
$( '#js' ).val( cm.getValue() );
});
code_js.setOption( "theme", 'material' );
code_js.setSize( null, 700 );
disable_menu();
$( '#layout-tabs' ).easyResponsiveTabs(
{
width: 'auto',
fit: true,
tabidentify: 'layout-tabs',
type: 'vertical'
});
$( 'body' ).on( 'click', '.select-page', function()
{
$( this ).parent( 'div' ).children( 'div.icheckbox_minimal-blue' ).children( 'input' ).iCheck( 'toggle' );
});
$('ol.sortable').nestedSortable(
{
forcePlaceholderSize: true,
handle: 'div',
helper: 'clone',
items: 'li',
opacity: .6,
placeholder: 'placeholder',
revert: 250,
tabSize: 25,
tolerance: 'pointer',
toleranceElement: '> div',
maxLevels: 3,
isTree: true,
expandOnHover: 700,
isAllowed: function()
{
return false;
}
});
$( '.disclose' ).on( 'click', function()
{
$( this ).closest( 'li' ).toggleClass( 'sort-collapsed' ).toggleClass( 'sort-expanded' );
});
$( '.disclose' ).mousedown( function(e)
{
if ( e.which === 1 ) {
if ( $( this ).parent( 'div' ).hasClass( 'content_menu' ) )
{
var menu_id = $( this ).parent( 'div' ).parent( 'li' ).attr( 'menu' );
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data: {
a: 'cookie_menus',
menu_id: menu_id
}
});
}
else
{
var page_id = $( this ).parent( 'div' ).parent( 'li' ).attr( 'id' );
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data: {
a: 'cookie_pages',
page_id: page_id
}
});
}
}
});
<?php
$array = unserialize( $_COOKIE[ 'cookie_pages' ] );
if ( is_array( $array ) ): foreach ( $array as $key => $val ):
if ( $val ):
?>$( '.<?= $key;?>' ).children( 'div' ).children( 'span.disclose' ).click();<?
endif;
endforeach; endif;
$array = unserialize( $_COOKIE[ 'cookie_menus' ] );
if ( is_array( $array ) ): foreach ( $array as $key => $val ):
if ( $val ):
?>$( '.menu_<?= $key;?>' ).children( 'div' ).children( 'span.disclose' ).click();<?
endif;
endforeach; endif;
?>
});
</script>
<?
global $db;
ob_start();
?>
<div id="layout-tabs">
<ul class="resp-tabs-list layout-tabs">
<li><i class="fa fa-wrench"></i>Ustawienia</li>
<li><i class="fa fa-html5"></i>HTML</li>
<li><i class="fa fa-html5"></i>CSS</li>
<li><i class="fa fa-html5"></i>JS</li>
</ul>
<div class="resp-tabs-container layout-tabs">
<div>
<?= \Html::input(
array(
'label' => 'Nazwa',
'name' => 'name',
'id' => 'name',
'value' => $this -> layout['name']
)
);?>
<?= \Html::input_switch(
array(
'label' => 'Szablon domyślny',
'name' => 'status',
'checked' => $this -> layout['status'] == 1 ? true : false
)
);?>
<?= \Html::input_switch(
array(
'label' => 'Szablon domyślny (kategorie)',
'name' => 'categories_default',
'checked' => $this -> layout['categories_default'] == 1 ? true : false
)
);?>
<div class="form-group">
<label class="col-lg-4 control-label">Strony:</label>
<div class="col-lg-8">
<? if ( is_array( $this -> menus ) ): foreach ( $this -> menus as $menu ):?>
<div class="menu_sortable">
<ol class="sortable" id="sortable_<?= $menu['id'];?>">
<li id="list_<?= $menu['id'];?>" class="menu_<?= $menu['id'];?>" menu="<?= $menu['id'];?>">
<div class="context_0 content content_menu" <? if ( !$menu['status'] ) echo 'style="color: #cc0000;"';?>>
<span class="disclose"><span></span></span>
Menu: <b><?= $menu['name'];?></b>
</div>
<?= \admin\view\Layouts::subpages_list( \admin\factory\Pages::menu_pages( $menu['id'] ), $this -> layout['pages'] );?>
</li>
</ol>
</div>
<? endforeach; endif;?>
</div>
</div>
<div class="form-group">
<label class="col-lg-4 control-label">Kategorie:</label>
<div class="col-lg-8">
<div class="menu_sortable">
<ol class="sortable" id="sortable">
<? if ( is_array( $this -> categories ) ): foreach ( $this -> categories as $category ):?>
<li id="list_<?= $category['id'];?>" class="category_<?= $category['id'];?>" category="<?= $category['id'];?>">
<div class="context_0 content content_menu">
<span class="disclose"><span></span></span>
<? if ( !$category['status'] ) echo '<i class="fa fa-ban fa-lg text-danger" title="Kategoria nieaktywna"></i>';?>
<input type="checkbox" class="g-checkbox" name="categories[]" value="<?= $category['id'];?>" <? if ( is_array( $this -> layout['categories'] ) and in_array( $category['id'], $this -> layout['categories'] ) ):?>checked="checked"<? endif;?> />
<b><?= $category['languages'][$this -> dlang]['title'];?></b>
</div>
<?= \Tpl::view( 'shop-product/subcategories-list', [
'categories' => \admin\factory\ShopCategory::subcategories( $category['id'] ),
'product_categories' => $this -> layout['categories'],
'dlang' => $this -> dlang
] );?>
</li>
<? endforeach; endif;?>
</ol>
</div>
</div>
</div>
</div>
<div>
<textarea name="html" id="html" style="width: 100%; height: 500px; border: 0; padding: 10px; margin: -10px 0 -15px; font-size: 12px; box-sizing: border-box;"><?= htmlspecialchars( $this -> layout['html'] );?></textarea>
</div>
<div>
<textarea name="css" id="css" style="width: 100%; height: 500px; border: 0; padding: 10px; margin: -10px 0 -15px; font-size: 12px; box-sizing: border-box;"><?= htmlspecialchars( $this -> layout['css'] );?></textarea>
</div>
<div>
<textarea name="js" id="js" style="width: 100%; height: 500px; border: 0; padding: 10px; margin: -10px 0 -15px; font-size: 12px; box-sizing: border-box;"><?= htmlspecialchars( $this -> layout['js'] );?></textarea>
</div>
</div>
<div class="clear"></div>
</div>
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'layout-edit';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Edycja szablonu';
$grid -> fields = [
[
'db' => 'id',
'type' => 'hidden',
'value' => $this -> layout['id']
]
];
$grid -> actions = [
'save' => [ 'url' => '/admin/layouts/layout_save/', 'back_url' => '/admin/layouts/view_list/' ],
'cancel' => [ 'url' => '/admin/layouts/view_list/' ]
];
$grid -> external_code = $out;
$grid -> persist_edit = true;
$grid -> id_param = 'id';
echo $grid -> draw();
?>

View File

@@ -0,0 +1,54 @@
<?php
global $gdb;
$grid = new \grid( 'pp_layouts' );
$grid -> gdb_opt = $gdb;
$grid -> order = [ 'column' => 'name', 'type' => 'ASC' ];
$grid -> search = [
[ 'name' => 'Nazwa', 'db' => 'name', 'type' => 'text' ],
[ 'name' => 'Szablon domyślny', 'db' => 'status', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ]
];
$grid -> columns_view = [
[
'name' => 'Lp.',
'th' => [ 'class' => 'g-lp' ],
'td' => [ 'class' => 'g-center' ],
'autoincrement' => true
],
[
'name' => 'Nazwa',
'db' => 'name',
'php' => 'echo "<a href=\'/admin/layouts/layout_edit/id=[id]\'>[name]</a>";',
'sort' => true
],
[
'name' => 'Szablon domyślny',
'db' => 'status',
'replace' => [ 'array' => [ 0 => 'nie', 1 => '<span class="text-system">tak</span>' ] ],
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ]
],
[
'name' => 'Szablon domyślny (kategorie)',
'db' => 'categories_default',
'replace' => [ 'array' => [ 0 => 'nie', 1 => '<span class="text-system">tak</span>' ] ],
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ]
],
[
'name' => 'Akcja',
'action' => [ 'type' => 'edit', 'url' => '/admin/layouts/layout_edit/id=[id]' ],
'th' => [ 'class' => 'g-center' ],
'td' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ]
],
[
'name' => 'Akcja',
'action' => [ 'type' => 'delete', 'url' => '/admin/layouts/layout_delete/id=[id]' ],
'th' => [ 'class' => 'g-center' ],
'td' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ]
]
];
$grid -> buttons = [
[ 'label' => 'Dodaj szablon', 'url' => '/admin/layouts/layout_edit/', 'icon' => 'fa-plus-circle', 'class' => 'btn-success' ]
];
echo $grid -> draw();

View File

@@ -0,0 +1,16 @@
<? if ( is_array( $this -> pages ) ):?>
<ol>
<? foreach ( $this -> pages as $page ):?>
<li id="list_<?= $page['id'];?>" idk="<?= $page['id'];?>" class="list_<?= $page['id'];?>" menu="<?= $page['menu_id'];?>">
<div class="content <?= $this -> step < 2 ? $tmp = 'content_page' : $tmp = 'content_page_last_level';?>" <? if ( !$page['status'] ) echo 'style="color: #cc0000;"';?>>
<span class="disclose"><span></span></span>
<input type="checkbox" class="g-checkbox" name="pages[]" value="<?= $page['id'];?>" <? if ( is_array( $this -> layout_pages ) and in_array( $page['id'], $this -> layout_pages ) ):?>checked="checked"<? endif;?> /><?= $page['title'];?>
</div>
<?
if ( is_array( $page['subpages'] ) )
echo \admin\view\Layouts::subpages_list( $page['subpages'], $this -> layout_pages, $page['id'], $this -> step + 1 );
?>
</li>
<? endforeach;?>
</ol>
<? endif;?>

View File

@@ -0,0 +1,67 @@
<script type="text/javascript" src="/libraries/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/libraries/ckeditor/adapters/jquery.js"></script>
<?
global $db;
ob_start();
?>
<?= \Html::input(
array(
'label' => 'Nazwa',
'name' => 'name',
'id' => 'name',
'value' => $this -> email_template['name'],
'inline' => true,
'readonly' => $this -> email_template['is_admin'] ? true : false
)
);?>
<?= \Html::textarea(
array(
'label' => 'Treść',
'name' => 'text',
'id' => 'text',
'value' => $this ->email_template['text'],
'inline' => true
)
);?>
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'email-templates-edit';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Edycja szablonu newslettera';
$grid -> fields = [
[
'db' => 'id',
'type' => 'hidden',
'value' => $this -> email_template['id']
]
];
$grid -> external_code = $out;
$grid -> actions = [
'save' => [
'url' => '/admin/newsletter/template_save/',
'back_url' => $this -> email_template['is_admin'] ? '/admin/newsletter/email_templates_admin/' : '/admin/newsletter/email_templates_user/'
],
'cancel' => [
'url' => $this -> email_template['is_admin'] ? '/admin/newsletter/email_templates_admin/' : '/admin/newsletter/email_templates_user/'
]
];
$grid -> persist_edit = true;
$grid -> id_param = 'id';
echo $grid -> draw();
?>
<script type="text/javascript">
$( function()
{
disable_menu();
$( '#text' ).ckeditor(
{
toolbar : 'MyTool',
height:'350'
});
});
</script>

View File

@@ -0,0 +1,28 @@
<?php
global $gdb;
$grid = new \grid( 'pp_newsletter_templates' );
$grid -> gdb_opt = $gdb;
$grid -> order = [ 'column' => 'name', 'type' => 'ASC' ];
$grid -> where = [ 'is_admin' => 1 ];
$grid -> columns_view = [
[
'name' => 'Lp.',
'th' => [ 'class' => 'g-lp' ],
'td' => [ 'class' => 'g-center' ],
'autoincrement' => true
],
[
'name' => 'Nazwa',
'db' => 'name',
'php' => 'echo "<a href=\'/admin/newsletter/email_template_edit/id=[id]\'>[name]</a>";',
'sort' => true
],
[
'name' => 'Edytuj',
'action' => [ 'type' => 'edit', 'url' => '/admin/newsletter/email_template_edit/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
]
];
echo $grid -> draw();

View File

@@ -0,0 +1,42 @@
<?php
global $gdb;
$grid = new \grid( 'pp_newsletter_templates' );
$grid -> gdb_opt = $gdb;
$grid -> order = [ 'column' => 'name', 'type' => 'ASC' ];
$grid -> where = [ 'is_admin' => 0 ];
$grid -> columns_view = [
[
'name' => 'Lp.',
'th' => [ 'class' => 'g-lp' ],
'td' => [ 'class' => 'g-center' ],
'autoincrement' => true
],
[
'name' => 'Nazwa',
'db' => 'name',
'php' => 'echo "<a href=\'/admin/newsletter/email_template_edit/id=[id]\'>[name]</a>";',
'sort' => true
],
[
'name' => 'Edytuj',
'action' => [ 'type' => 'edit', 'url' => '/admin/newsletter/email_template_edit/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
],
[
'name' => 'Usuń',
'action' => [ 'type' => 'delete', 'url' => '/admin/newsletter/email_template_delete/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
]
];
$grid -> buttons = [
[
'label' => 'Dodaj szablon',
'url' => '/admin/newsletter/email_template_edit/',
'icon' => 'fa-plus-circle',
'class' => 'btn-success'
]
];
echo $grid -> draw();

View File

@@ -0,0 +1,30 @@
<?php
global $gdb;
$grid = new \grid( 'pp_newsletter' );
$grid -> gdb_opt = $gdb;
$grid -> order = [ 'column' => 'email', 'type' => 'ASC' ];
$grid -> search = [
[ 'name' => 'Email', 'db' => 'email', 'type' => 'text' ]
];
$grid -> columns_view = [
[
'name' => 'Lp.',
'th' => [ 'class' => 'g-lp' ],
'td' => [ 'class' => 'g-center' ],
'autoincrement' => true
],
[
'name' => 'Email',
'db' => 'email',
'sort' => true
],
[
'name' => 'Potwierdzony',
'db' => 'status',
'sort' => true,
'replace' => [ 'array' => [ 0 => '<span style="color: #FF0000;">nie</span>', 1 => 'tak' ] ]
]
];
$grid -> actions = [ 'delete' => true ];
echo $grid -> draw();

View File

@@ -0,0 +1,131 @@
<?
global $db;
ob_start();
?>
<div class="form-group row">
<label class="col-lg-4 control-label">Zakres dat:</label>
<div class="col-lg-8">
<div class="input-group">
<input type="text" id="dates" name="dates" data="search-column:date_add;search-type:date_range" class="form-control date-range require" value="">
<span class="input-group-addon cursor date-range-icon">
<i class="fa fa-calendar"></i>
</span>
</div>
</div>
</div>
<div class="form-group row">
<label class="col-12 control-label">lub / i</label>
</div>
<?
$templates[''] = '---- szablon ----';
if ( is_array( $this -> templates ) ): foreach ( $this -> templates as $template ):
$templates[ $template['id'] ] = $template['name'];
endforeach; endif;
?>
<?= \Html::select(
array(
'label' => 'Szablon',
'name' => 'template',
'id' => 'template',
'values' => $templates,
'value' => $this -> templates['id']
));?>
<div class="form-group row">
<label class="col-12 control-label">Podgląd:</label>
<div class="col-12">
<div id="newsletter-preview"></div>
</div>
</div>
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'newsletter-prepare';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Wysyłka newslettera - przygotowanie';
$grid -> default_buttons = false;
$grid -> external_code = $out;
$grid -> buttons = [
[
'label' => 'Wyślij newsletter',
'class' => 'btn-success',
'icon' => 'fa-send',
'js' => 'send_newsletter();'
]
];
echo $grid -> draw();
?>
<script type="text/javascript">
function send_newsletter()
{
var dates = $( '#dates' ).val();
var template = $('#template').val();
if ( !dates && !template )
$.prompt( 'Proszę wybrać zakres dat lub szablon.', { title: 'Błąd' } );
$( '#fg-newsletter-prepare' ).submit();
return false;
}
$( function()
{
$( '#fg-newsletter-prepare' ).attr( 'action', '/admin/newsletter/send/' );
$( 'body' ).on( 'change', '#dates', function()
{
var dates = $( this ).val();
var template = $('#template').val();
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data: {
a: 'newsletter-preview',
dates: dates,
template: template
},
beforeSend: function()
{
$( '#overlay' ).show();
},
success: function( response )
{
$( '#overlay' ).hide();
$( '#newsletter-preview' ).html( response );
}
});
});
$( 'body' ).on( 'change', '#template', function()
{
var dates = $( '#dates' ).val();
var template = $( this ).val();
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data: {
a: 'newsletter-preview',
template: template,
dates: dates
},
beforeSend: function()
{
$( '#overlay' ).show();
},
success: function( response )
{
$( '#overlay' ).hide();
$( '#newsletter-preview' ).html( response );
}
});
});
});
</script>

View File

@@ -0,0 +1,41 @@
<div style="border-bottom: 1px solid #ccc;">
<?= $this -> settings['newsletter_header'] ? $this -> settings['newsletter_header'] : '<p style="text-align: center;">--- brak zdefiniowanego nagłówka ---</p>';?>
</div>
<div style="border-bottom: 1px solid #ccc; padding: 10px 0 0 0;">
<? if ( is_array( $this -> template ) ):?>
<div style="padding: 10px; background: #F1F1F1; margin-bottom: 10px">
<?=$this -> template['text']?>
</div>
<? endif;?>
<? if ( is_array( $this -> articles ) ):?>
<? foreach ( $this -> articles as $article ):?>
<? $article['language']['seo_link'] ? $url = $article['language']['seo_link'] : $url = 'a-' . $article['id'] . '-' . \S::seo( $article['language']['title'] );?>
<div style="padding: 10px; background: #F1F1F1; margin-bottom: 10px">
<?
$article['language']['seo_link'] ? $url = $article['language']['seo_link'] : $url = 'a-' . $article['id'] . '-' . \S::seo( $article['language']['title'] );
?>
<a href="http://<?= $_SERVER['SERVER_NAME'];?>/<?= $url;?>" title="<?= $article['language']['title'];?>" style="margin-bottom: 10px; display: block; font-size: 14px; color: #5b7fb1; font-weight: 600;">
<?= $article['language']['title'];?>
</a>
<div>
<?
if ( $article['language']['entry'] )
echo $article['language']['entry'];
else
echo $article['language']['text'];
?>
</div>
<div style="clear: both;"></div>
</div>
<? endforeach;?>
<? else:?>
<? if ( $this -> dates ):?>
<div style="padding: 10px; background: #F1F1F1; margin-bottom: 10px; text-align: center;">
--- brak artykułów w danym okresie ---
</div>
<? endif;?>
<? endif;?>
</div>
<div style="border-bottom: 1px solid #ccc; padding: 10px 0 0 0;">
<?= $this -> settings['newsletter_footer'] ? $this -> settings['newsletter_footer'] : '<p style="text-align: center;">--- brak zdefiniowanej stopki ---</p>';?>
</div>

View File

@@ -0,0 +1,51 @@
<script type="text/javascript" src="/libraries/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/libraries/ckeditor/adapters/jquery.js"></script>
<script type="text/javascript">
$( function()
{
$( 'textarea' ).ckeditor(
{
toolbar : 'MyTool',
height: '150'
});
});
</script>
<?
global $db;
ob_start();
echo \Html::textarea(
array(
'label' => 'Nagłówek',
'name' => 'newsletter_header',
'id' => 'newsletter_header',
'value' => $this -> settings['newsletter_header'],
'inline' => true
)
);
echo \Html::textarea(
array(
'label' => 'Stopka',
'name' => 'newsletter_footer',
'id' => 'newsletter_footer',
'value' => $this -> settings['newsletter_footer'],
'inline' => true
)
);
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'settings-edit';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Edycja ustawień';
$grid -> actions = [
'save' => [ 'url' => '/admin/newsletter/settings_save/', 'back_url' => '/admin/newsletter/settings/' ],
];
$grid -> external_code = $out;
echo $grid -> draw();
?>
<script>CKEDITOR.dtd.$removeEmpty['span'] = false;</script>
<style type="text/css">#g-edit-cancel { display: none; }</style>

View File

@@ -0,0 +1,42 @@
<?php
global $gdb;
$grid = new \gridEdit;
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Zapisz menu';
$grid -> fields = [
[
'db' => 'id',
'type' => 'hidden',
'value' => $this -> menu['id']
],
[
'name' => 'Nazwa',
'db' => 'name',
'type' => 'text',
'value' => $this -> menu['name'],
'params' => [ 'class' => 'require' ]
],
[
'name' => 'Aktywne',
'db' => 'status',
'type' => 'input_switch',
'checked' => $this -> menu['status'] ? true : false,
'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ]
]
];
$grid -> actions = [
'save' => [ 'url' => '/admin/pages/menu_save/', 'back_url' => '/admin/pages/view_list/' ],
'cancel' => [ 'url' => '/admin/pages/view_list/' ]
];
$grid -> persist_edit = true;
$grid -> id_param = 'id';
echo $grid -> draw();
?>
<script type="text/javascript">
$( document ).ready( function()
{
disable_menu();
});
</script>

View File

@@ -0,0 +1,89 @@
<?
global $gdb;
ob_start();
?>
<ol class="sortable" id="article-list">
<?
if ( is_array( $this -> articles ) ) foreach ( $this -> articles as $article )
{
?>
<li id="list_<?= $article['article_id'];?>">
<div class="content <? if ( !$article['status'] ) echo 'text-danger';?>"><span class="disclose"><span></span></span> <?= $article['title'];?></div>
</li>
<?
}
?>
</ol>
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> default_buttons = false;
$grid -> external_code = $out;
$grid -> title = 'Lista artykułów';
$grid -> buttons = [
[
'label' => 'Wstecz',
'url' => '/admin/pages/view_list/',
'icon' => 'fa-reply',
'class' => 'btn-dark'
]
];
echo $grid -> draw();
?>
<script type="text/javascript" src="/libraries/jquery-nested-sortable/jquery.mjs.nestedSortable.js"></script>
<script type="text/javascript">
$( document ).ready( function()
{
$( 'ol.sortable' ).nestedSortable(
{
forcePlaceholderSize: true,
handle: 'div',
helper: 'clone',
items: 'li',
opacity: .6,
placeholder: 'placeholder',
revert: 250,
tabSize: 25,
tolerance: 'pointer',
toleranceElement: '> div',
maxLevels: 1,
isTree: true,
expandOnHover: 700,
save_articles_order: true
});
});
function save_articles_order()
{
articles = $( 'ol.sortable' ).nestedSortable( 'toArray', { startDepthCount: 0 } );
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data:
{
a: 'save_articles_order',
page_id: <?= $this -> page_id;?>,
articles: articles
},
beforeSend: function()
{
$.prompt( 'Trwa zapisywanie...', { title: 'Proszę czekać' } );
},
success: function( data )
{
$( '.jqibox' ).remove();
response = jQuery.parseJSON( data );
if ( response.status === 'error' )
create_error( response.msg );
}
});
}
</script>

View File

@@ -0,0 +1,400 @@
<script type="text/javascript">
var link_lang = '';
$( function()
{
disable_menu();
$('body').on( 'change', '#page_type', function ()
{
var page_type = $(this).val();
if ( page_type == 0 || page_type == 1 || page_type == 2 )
{
$( '#articles_limit' ).parents( '.form-group' ).show();
$( '#link-content' ).addClass( 'hide' );
$( '#category-content' ).addClass( 'hide' );
$( '#sort_type' ).parents( '.form-group' ).show();
}
else if ( page_type == 3 )
{
$( '#link-content' ).removeClass( 'hide' );
$( '#articles_limit' ).parents( '.form-group' ).hide();
$( '#sort_type' ).parents( '.form-group' ).hide();
$( '#category-content' ).addClass( 'hide' );
}
else if ( page_type == 5 )
{
$( '#category-content' ).removeClass( 'hide' );
$( '#articles_limit' ).parents( '.form-group' ).hide();
$( '#sort_type' ).parents( '.form-group' ).hide();
$( '#link-content' ).addClass( 'hide' );
}
else
{
$( '#articles_limit' ).parents( '.form-group' ).hide();
$( '#link-content' ).addClass( 'hide' );
$( '#category-content' ).addClass( 'hide' );
$( '#sort_type' ).parents( '.form-group' ).hide();
}
});
$( '#settings-tabs' ).easyResponsiveTabs({
width: 'auto',
fit: true,
tabidentify: 'settings-tabs',
type: 'vertical'
});
$( '#page_type' ).trigger( 'change' );
$( 'body').on( 'click', '.url-select', function() {
$( '#link_' + link_lang ).val( $( this ).attr( 'url' ) );
$.magnificPopup.close();
});
$( 'body').on( 'click', '.category-select', function() {
$( '#category_id' ).val( $( this ).attr( 'category-id' ) );
$( '#category_title' ).val( $( this ).attr( 'category-title' ) );
$.magnificPopup.close();
});
});
function generate_seo_links( lang, title, page_id )
{
if ( title === '' )
return false;
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data: {
a: 'generate_seo_link',
title: title,
page_id: page_id
},
beforeSend: function()
{
$( '#overlay' ).show();
},
success: function( data )
{
$( '#overlay' ).hide();
response = jQuery.parseJSON( data );
if ( response.status === 'ok' )
$( '#seo_link_' + lang ).val( response.seo_link );
else
create_error( response.msg );
}
});
}
function pages_url_browser( lang_id ) {
link_lang = lang_id;
$.magnificPopup.open({
removalDelay: 500,
items: {
src: '/admin/pages/pages_url_browser/modal=true'
},
type: 'ajax',
overflowY: 'scroll'
});
}
function category_url_browser() {
$.magnificPopup.open({
removalDelay: 500,
items: {
src: '/admin/shop_category/category_url_browser/modal=true'
},
type: 'ajax',
overflowY: 'scroll'
});
}
</script>
<?
global $db;
ob_start();
?>
<div id="settings-tabs">
<ul class="resp-tabs-list settings-tabs">
<li><i class="fa fa-file"></i>Treść</li>
<li><i class="fa fa-wrench"></i>Ustawienia</li>
<li><i class="fa fa-globe"></i>SEO</li>
</ul>
<div class="resp-tabs-container settings-tabs">
<div>
<div class="panel">
<div class="panel-heading">
<ul class="nav panel-tabs-border panel-tabs">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<li>
<a href="#laguages-main-<?= $lg['id'];?>" data-toggle="tab" aria-expanded="true"><? if ( $lg['id'] == \front\factory\Languages::default_language() ) echo '<i class="fa fa-star fa-lg text-system" title="Język domyślny"></i> ';?><?= $lg['name'];?></a>
</li>
<? endif;?>
<? endforeach; endif;?>
</ul>
</div>
<div class="panel-body">
<div class="tab-content pn br-n">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<div id="laguages-main-<?= $lg['id'];?>" class="tab-pane <? if ( !$z01++ ):?>active<? endif;?>">
<?= \Html::input(
array(
'label' => 'Nazwa strony',
'name' => 'title[' . $lg['id'] . ']',
'id' => 'title_' . $lg['id'],
'value' => $this -> page[ 'languages' ][ $lg['id'] ]['title'],
)
);?>
</div>
<? endif;?>
<? endforeach; endif;?>
</div>
</div>
</div>
</div>
<div style="padding: 15px;">
<?
if ( is_array( $this -> menus ) ): foreach ( $this -> menus as $menu ):
$menus[ $menu['id'] ] = $menu['name'];
endforeach; endif;
?>
<?= \Html::select(
array(
'label' => 'Menu',
'name' => 'menu_id',
'values' => $menus,
'value' => $this -> page['id'] ? $this -> page['menu_id'] : $this -> menu_id
)
);?>
<?= \Html::select(
array(
'label' => 'Typ strony',
'name' => 'page_type',
'id' => 'page_type',
'values' => \admin\factory\Pages::$_page_types,
'value' => $this -> page['page_type']
)
);?>
<div id="link-content" class="hide">
<div class="panel">
<div class="panel-heading">
<ul class="nav panel-tabs-border panel-tabs">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<li>
<a href="#languages-links-<?= $lg['id'];?>" data-toggle="tab" aria-expanded="true"><? if ( $lg['id'] == \front\factory\Languages::default_language() ) echo '<i class="fa fa-star fa-lg text-system" title="Język domyślny"></i> ';?><?= $lg['name'];?></a>
</li>
<? endif;?>
<? endforeach; endif;?>
</ul>
</div>
<div class="panel-body">
<div class="tab-content pn br-n">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<div id="languages-links-<?= $lg['id'];?>" class="tab-pane <? if ( !$z02++ ):?>active<? endif;?>">
<?= \Html::input_icon( [
'label' => 'Link',
'name' => 'link[' . $lg['id'] . ']',
'id' => 'link_' . $lg['id'],
'value' => $this -> page['languages'][$lg['id']]['link'],
'icon_class' => 'fa fa-link',
'icon_js' => 'pages_url_browser( "' . $lg['id'] . '");'
] );
?>
</div>
<? endif;?>
<? endforeach; endif;?>
</div>
</div>
</div>
</div>
<div id="category-content" class="hide">
<div id="languages-category">
<?= \Html::input(
array(
'type' => 'hidden',
'name' => 'category_id',
'id' => 'category_id',
'value' => $this -> page['category_id']
)
);
?>
<?= \Html::input_icon(
array(
'label' => 'Kategoria',
'name' => 'category_title',
'id' => 'category_title',
'value' => $this -> page['category_id'] ? \admin\factory\ShopCategory::category_title( $this -> page['category_id'] ) : '',
'icon_class' => 'fa fa-link',
'icon_js' => 'category_url_browser();'
)
);
?>
</div>
</div>
<?= \Html::select(
array(
'label' => 'Sortowanie artykułów',
'name' => 'sort_type',
'id' => 'sort_type',
'values' => \admin\factory\Pages::$_sort_types,
'value' => $this -> page['sort_type']
)
);?>
<?
$layouts[''] = '---- szablon ----';
if ( is_array( $this -> layouts ) ): foreach ( $this -> layouts as $layout ):
$layouts[ $layout['id'] ] = $layout['name'];
endforeach; endif;
?>
<?= \Html::select(
array(
'label' => 'Szablon',
'name' => 'layout_id',
'id' => 'layout_id',
'values' => $layouts,
'value' => $this -> page['layout_id']
)
);?>
<?= \Html::input(
array(
'label' => 'Liczba artykułów na stronę',
'name' => 'articles_limit',
'id' => 'articles_limit',
'value' => $this -> page['articles_limit'] ? $this -> page['articles_limit'] : 2
)
);?>
<?= \Html::input_switch(
array(
'label' => 'Pokaż tytuł',
'name' => 'show_title',
'checked' => $this -> page['show_title'] == 1 or !$this -> page['id'] ? true : false
)
);?>
<?= \Html::input_switch(
array(
'label' => 'Aktywna',
'name' => 'status',
'checked' => $this -> page['status'] == 1 or !$this -> page['id'] ? true : false
)
);?>
<?= \Html::input_switch(
array(
'label' => 'Strona startowa',
'name' => 'start',
'checked' => $this -> page['start'] == 1 ? true : false
)
);?>
</div>
<div>
<div class="panel">
<div class="panel-heading">
<ul class="nav panel-tabs-border panel-tabs">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<li>
<a href="#languages-seo-<?= $lg['id'];?>" data-toggle="tab" aria-expanded="true"><? if ( $lg['id'] == \front\factory\Languages::default_language() ) echo '<i class="fa fa-star fa-lg text-system" title="Język domyślny"></i> ';?><?= $lg['name'];?></a>
</li>
<? endif;?>
<? endforeach; endif;?>
</ul>
</div>
<div class="panel-body">
<div class="tab-content pn br-n">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<div id="languages-seo-<?= $lg['id'];?>" class="tab-pane <? if ( !$z03++ ):?>active<? endif;?>">
<?= \Html::input_icon( [
'label' => 'Link SEO',
'name' => 'seo_link[' . $lg['id'] . ']',
'id' => 'seo_link_' . $lg['id'],
'value' => $this -> page['languages' ][ $lg['id'] ]['seo_link'],
'icon_content' => 'generuj',
'icon_js' => 'generate_seo_links( "' . $lg['id'] . '", $( "#title_' . $lg['id'] . '" ).val(), ' . (int)$this -> page['id'] . ' );'
] );?>
<?= \Html::input( [
'label' => 'Tytuł strony (h1)',
'name' => 'page_title[' . $lg['id'] . ']',
'id' => 'page_title_' . $lg['id'],
'value' => $this -> page['languages' ][ $lg['id'] ]['page_title']
] );?>
<?= \Html::input( [
'label' => 'Meta title',
'name' => 'meta_title[' . $lg['id'] . ']',
'id' => 'meta_title_' . $lg['id'],
'value' => $this -> page['languages'][ $lg['id'] ]['meta_title']
] );?>
<?= \Html::textarea( [
'label' => 'Meta description',
'name' => 'meta_description[' . $lg['id'] . ']',
'id' => 'meta_description_' . $lg['id'],
'value' => $this -> page['languages'][ $lg['id'] ]['meta_description']
] );?>
<?= \Html::textarea( [
'label' => 'Meta keywords',
'name' => 'meta_keywords[' . $lg['id'] . ']',
'id' => 'meta_keywords_' . $lg['id'],
'value' => $this -> page['languages'][ $lg['id'] ]['meta_keywords']
] );?>
<?= \Html::select( [
'label' => 'Blokuj indeksację',
'name' => 'noindex[' . $lg['id'] . ']',
'id' => 'noindex_' . $lg['id'],
'values' => [ 0 => 'nie', 1 => 'tak' ],
'value' => $this -> page['languages'][ $lg['id'] ]['noindex'] == 1 ? 1 : 0
] );?>
<?= \Html::input( [
'label' => 'Rel canonical',
'name' => 'canonical[' . $lg['id'] . ']',
'id' => 'canonical_' . $lg['id'],
'value' => $this -> page['languages'][ $lg['id'] ]['canonical']
] );?>
</div>
<? endif;?>
<? endforeach; endif;?>
</div>
</div>
</div>
</div>
</div>
<div class="clear"></div>
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'page-edit';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Edycja strony';
$grid -> fields = [
[
'db' => 'id',
'type' => 'hidden',
'value' => $this -> page['id']
],
[
'db' => 'parent_id',
'type' => 'hidden',
'value' => $this -> page['id'] ? $this -> page['parent_id'] : $this -> parent_id
]
];
$grid -> actions = [
'save' => [ 'url' => '/admin/pages/page_save/', 'back_url' => '/admin/pages/view_list/' ],
'cancel' => [ 'url' => '/admin/pages/view_list/' ]
];
$grid -> external_code = $out;
$grid -> persist_edit = true;
$grid -> id_param = 'id';
echo $grid -> draw();
?>

View File

@@ -0,0 +1,162 @@
<?
global $gdb;
ob_start();
if ( is_array( $this -> menus ) ) foreach ( $this -> menus as $menu )
{
?>
<div class="menu_sortable">
<ol class="sortable" id="sortable_<?= $menu['id'];?>" menu-id="<?= $menu['id'];?>">
<li id="list_<?= $menu['id'];?>" class="menu_<?= $menu['id'];?>" menu="<?= $menu['id'];?>">
<div class="context_0 content content_menu">
<span class="disclose"><span></span></span>
<? if ( !$menu['status'] ) echo '<i class="fa fa-ban fa-lg text-danger" title="Menu nieaktywne"></i>';?>
Menu: <b><?= $menu['name'];?></b>
</div>
<?= \admin\view\Pages::subpages_browse_list( \admin\factory\Pages::menu_pages( $menu['id'] ) );?>
</li>
</ol>
</div>
<?
}
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'pages-list';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Lista stron';
$grid -> default_buttons = false;
$grid -> external_code = $out;
echo $grid -> draw();
?>
<style type="text/css">
<? if ( $this -> modal ): echo '.mfp-container'; endif;?> body.sb-top.sb-top-sm .navbar.navbar-fixed-top + #sidebar_left + #content_wrapper {
padding-top: 0;
}
<? if ( $this -> modal ): echo '.mfp-container'; endif;?> #content {
padding: 27px 0 0;
}
<? if ( $this -> modal ): echo '.mfp-container'; endif;?> #content > .row {
margin: 0;
}
<? if ( $this -> modal ): echo '.mfp-container'; endif;?> #content > .row > .col-lg-9 {
padding: 0;
width: 100%;
float: none;
}
</style>
<script type="text/javascript" src="/libraries/jquery-nested-sortable/jquery.mjs.nestedSortable.js"></script>
<script type="text/javascript">
var menu_id = 0;
function getUrlParam(paramName)
{
var reParam = new RegExp('(?:[\?&]|&amp;)' + paramName + '=([^&]+)', 'i');
var match = window.location.search.match(reParam);
return (match && match.length > 1) ? match[1] : '';
}
$( document ).ready( function()
{
<? if ( !$this -> modal ):?>
$( '#sidebar_left, .navbar-fixed-top' ).hide();
<? endif;?>
var funcNum = getUrlParam('CKEditorFuncNum');
$( 'body' ).on( 'click', '.button', function()
{
if ( funcNum )
{
window.opener.CKEDITOR.tools.callFunction(funcNum, $( this ).attr( 'url' ) );
window.close();
}
});
$( 'ol.sortable' ).nestedSortable(
{
forcePlaceholderSize: true,
handle: 'div',
helper: 'clone',
items: 'li',
opacity: .9,
placeholder: 'placeholder',
revert: 250,
tabSize: 45,
tolerance: 'pointer',
toleranceElement: '> div',
maxLevels: 3,
isTree: true,
expandOnHover: 700,
stop: function() {
save_pages_order();
}
});
$( '.disclose' ).on( 'click', function()
{
$( this ).closest( 'li' ).toggleClass( 'sort-collapsed' ).toggleClass( 'sort-expanded' );
});
$( ".sortable *" ).mousedown( function(e)
{
menu_id = $( this ).parents( 'ol.sortable' ).attr( 'menu-id' );
});
$( '.disclose' ).mousedown( function(e)
{
if ( e.which === 1 ) {
if ( $( this ).parent( 'div' ).hasClass( 'content_menu' ) )
{
var menu_id = $( this ).parent( 'div' ).parent( 'li' ).attr( 'menu' );
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data: {
a: 'cookie_menus',
menu_id: menu_id
}
});
}
else
{
var page_id = $( this ).parent( 'div' ).parent( 'li' ).attr( 'id' );
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data: {
a: 'cookie_pages',
page_id: page_id
}
});
}
}
});
<?php
$array = unserialize( $_COOKIE[ 'cookie_pages' ] );
if ( is_array( $array ) ): foreach ( $array as $key => $val ):
if ( $val ):
?>$( '.<?= $key;?>' ).children( 'div' ).children( 'span.disclose' ).click();<?
endif;
endforeach; endif;
$array = unserialize( $_COOKIE[ 'cookie_menus' ] );
if ( is_array( $array ) ): foreach ( $array as $key => $val ):
if ( $val ):
?>$( '.menu_<?= $key;?>' ).children( 'div' ).children( 'span.disclose' ).click();<?
endif;
endforeach; endif;
?>
});
</script>

View File

@@ -0,0 +1,208 @@
<?
global $gdb;
ob_start();
if ( is_array( $this -> menus ) ) foreach ( $this -> menus as $menu )
{
?>
<div class="menu_sortable">
<ol class="sortable" id="sortable_<?= $menu['id'];?>" menu-id="<?= $menu['id'];?>">
<li id="list_<?= $menu['id'];?>" class="menu_<?= $menu['id'];?>" menu="<?= $menu['id'];?>">
<div class="context_0 content content_menu">
<span class="disclose"><span></span></span>
<? if ( !$menu['status'] ) echo '<i class="fa fa-ban fa-lg text-danger" title="Menu nieaktywne"></i>';?>
<b>Menu: <?= $menu['name'];?></b>
<div class="btn-group ml20 pull-right">
<a href="/admin/pages/menu_edit/id=<?= $menu['id'];?>" title="Edytuj menu" class="btn btn-sm btn-system">
<i class="fa fa-file-text"></i> <span class="hidden-xs">Edytuj menu</span>
</a>
<a href="#" title="Usuń menu" class="btn btn-sm btn-danger menu-delete" menu-id="<?= $menu['id'];?>">
<i class="fa fa-trash"></i> <span class="hidden-xs">Usuń menu</span>
</a>
<a href="/admin/pages/page_edit/pid=0&menu_id=<?= $menu['id'];?>" title="Dodaj stronę" class="btn btn-sm btn-success">
<i class="fa fa-plus-circle"></i> <span class="hidden-xs">Dodaj stronę</span>
</a>
</div>
</div>
<?= \Tpl::view( 'pages/subpages-list', [
'pages' => \admin\factory\Pages::menu_pages( $menu['id'] ),
'menu_id' => $menu['id']
] );
?>
</li>
</ol>
</div>
<?
}
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'pages-list';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Lista stron';
$grid -> default_buttons = false;
$grid -> buttons = [
[
'label' => 'Dodaj menu',
'url' => '/admin/pages/menu_edit/',
'icon' => 'fa-plus-circle',
'class' => 'btn-success'
]
];
$grid -> external_code = $out;
echo $grid -> draw();
?>
<script type="text/javascript" src="/libraries/jquery-nested-sortable/jquery.mjs.nestedSortable.js"></script>
<script type="text/javascript">
var menu_id = 0;
$( document ).ready( function()
{
$( 'body' ).on( 'click', '.menu-delete', function()
{
var menu_id = $( this ).attr( 'menu-id' );
$.prompt( "Na pewno chcesz usunąć wybrane menu?",
{
title: "Potwierdź?",
buttons: { "Tak": true, "Nie": false },
submit: function( e, v, m, f )
{
if ( v === true )
document.location.href = '/admin/pages/menu_delete/id=' + menu_id;
}
});
});
$( 'body' ).on( 'click', '.page-delete', function()
{
var page_id = $( this ).attr( 'page-id' );
$.prompt( "Na pewno chcesz usunąć wybraną stronę?",
{
title: "Potwierdź?",
buttons: { "Tak": true, "Nie": false },
submit: function( e, v, m, f )
{
if ( v === true )
document.location.href = '/admin/pages/page_delete/id=' + page_id;
}
});
});
$( 'ol.sortable' ).nestedSortable(
{
forcePlaceholderSize: true,
handle: 'div',
helper: 'clone',
items: 'li',
opacity: .9,
placeholder: 'placeholder',
revert: 250,
tabSize: 45,
tolerance: 'pointer',
toleranceElement: '> div',
maxLevels: 4,
isTree: true,
expandOnHover: 700,
stop: function() {
save_pages_order();
}
});
$( '.disclose' ).on( 'click', function()
{
$( this ).closest( 'li' ).toggleClass( 'sort-collapsed' ).toggleClass( 'sort-expanded' );
});
$( ".sortable *" ).mousedown( function(e)
{
menu_id = $( this ).parents( 'ol.sortable' ).attr( 'menu-id' );
});
$( '.disclose' ).mousedown( function(e)
{
if ( e.which === 1 ) {
if ( $( this ).parent( 'div' ).hasClass( 'content_menu' ) )
{
var menu_id = $( this ).parent( 'div' ).parent( 'li' ).attr( 'menu' );
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data: {
a: 'cookie_menus',
menu_id: menu_id
}
});
}
else
{
var page_id = $( this ).parent( 'div' ).parent( 'li' ).attr( 'id' );
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data: {
a: 'cookie_pages',
page_id: page_id
}
});
}
}
});
<?php
$array = unserialize( $_COOKIE[ 'cookie_pages' ] );
if ( is_array( $array ) ): foreach ( $array as $key => $val ):
if ( $val ):
?>$( '.<?= $key;?>' ).children( 'div' ).children( 'span.disclose' ).click();<?
endif;
endforeach; endif;
$array = unserialize( $_COOKIE[ 'cookie_menus' ] );
if ( is_array( $array ) ): foreach ( $array as $key => $val ):
if ( $val ):
?>$( '.menu_<?= $key;?>' ).children( 'div' ).children( 'span.disclose' ).click();<?
endif;
endforeach; endif;
?>
});
function save_pages_order( )
{
pages = $( '#sortable_' + menu_id ).nestedSortable( 'toArray', { startDepthCount: 0 } );
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data:
{
a: 'save_pages_order',
menu_id: menu_id,
pages: pages
},
beforeSend: function()
{
$.prompt( 'Trwa zapisywanie...', { title: 'Proszę czekać' } );
},
success: function( data )
{
$( '.jqibox' ).remove();
response = jQuery.parseJSON( data );
if ( response.status === 'error' )
create_error( response.msg );
}
});
}
</script>

View File

@@ -0,0 +1,77 @@
<? if ( is_array( $this -> pages ) ):?>
<? $settings = \front\factory\Settings::settings_details();?>
<ol>
<? foreach ( $this -> pages as $page ):?>
<li id="list_<?= $page['id'];?>" idk="<?= $page['id'];?>" class="list_<?= $page['id'];?>" menu="<?= $page['menu_id'];?>">
<div class="content">
<span class="disclose"><span></span></span>
<?
if ( !$page['status'] )
echo '<i class="fa fa-ban fa-lg text-danger" title="Strona nieaktywna"></i>';
if ( $page['start'] )
echo '<i class="fa fa-star fa-lg text-system" title="Strona startowa"></i>';
echo $page['title'];
if ( is_array( $page['languages'] ) ):
echo '<div class="btn-group flags" style="display: inline-block;">';
foreach ( $page['languages'] as $lg )
echo '<img src="/admin/layout/lang-' . $lg['lang_id'] . '.jpg" />';
echo '</div>';
endif;
$default_language = \front\factory\Languages::default_language();
if ( is_array( $page['languages'] ) ):
foreach ( $page['languages'] as $lg ):
echo '<div class="btn-group ml20 pull-right">';
echo '<a href="#" title="Wybierz stronę" class="btn btn-sm btn-system button url-select" url="';
if ( $settings['links_structure'] )
{
if ( $lg['seo_link'] )
{
$seo = '/' . \admin\factory\Pages::google_url_preview( $page['id'],
$lg['title'], $lg['lang_id'], 0, 0,
$lg['seo_link'] );
echo $seo;
}
else
{
$seo = '/' . \admin\factory\Pages::google_url_preview( $page['id'],
$lg['title'], $lg['lang_id'], 0, 0, 0 );
echo $seo;
}
}
else
{
if ( $lg['seo_link'] )
{
if ( $default_language != $lg['lang_id'] )
echo '/' . $lg['lang_id'];
echo '/' . $lg['seo_link'];
}
else
{
if ( $default_language != $lg['lang_id'] )
echo '/' . $lg['lang_id'];
echo '/s-' . $page['id'] . '-' . \S::seo( $lg['title'] );
}
}
echo '">';
echo '<i class="fa fa-check"></i> <span class="hidden-xs">' . strtoupper( $lg['lang_id'] ) . '</span>';
echo '</a>';
echo '</div>';
endforeach;
endif;
?>
</div>
<?
if ( is_array( $page['subpages'] ) )
echo \admin\view\Pages::subpages_browse_list( $page['subpages'],
$page['id'], $this -> step + 1 );
?>
</li>
<? endforeach;?>
</ol>
<? endif;?>

View File

@@ -0,0 +1,60 @@
<? if ( is_array( $this -> pages ) ):?>
<ol>
<? foreach ( $this -> pages as $page ):?>
<li id="list_<?= $page['id'];?>" idk="<?= $page['id'];?>" class="list_<?= $page['id'];?>" menu="<?= $page['menu_id'];?>">
<div class="content">
<div class="menu-box-title">
<span class="disclose"><span></span></span>
<? if ( !$page['status'] ) echo '<i class="fa fa-ban fa-lg text-danger" title="Strona nieaktywna"></i>';?>
<? if ( $page['start'] ) echo '<i class="fa fa-star fa-lg text-system" title="Strona startowa"></i>';?>
<?= $page['title'];?>
<?
if ( is_array( $page['languages'] ) ):
echo '<div class="btn-group flags" style="display: inline-block;">';
foreach ( $page['languages'] as $lg )
echo '<img src="/admin/layout/lang-' . $lg['lang_id'] . '.jpg" />';
echo '</div>';
endif;
?>
</div>
<? if ( $this -> step < 3 ):?>
<div class="btn-group ml20 pull-right">
<a href="/admin/pages/page_edit/id=<?= $page['id'];?>&menu_id=<?= $page['menu_id'];?>" title="Edytuj stronę" class="btn btn-sm btn-system">
<i class="fa fa-file-text"></i> <span class="hidden-xs">Edytuj stronę</span>
</a>
<a href="#" title="Usuń stronę" class="btn btn-sm btn-danger page-delete" page-id="<?= $page['id'];?>">
<i class="fa fa-trash"></i> <span class="hidden-xs">Usuń stronę</span>
</a>
<a href="/admin/pages/page_articles/id=<?= $page['id'];?>" title="Lista artykułów" class="btn btn-sm btn-info" page-id="<?= $page['id'];?>">
<i class="fa fa-bars"></i> <span class="hidden-xs">Lista artykułów</span>
</a>
<a href="/admin/pages/page_edit/pid=<?= $page['id'];?>&menu_id=<?= $page['menu_id'];?>" title="Dodaj podstronę" class="btn btn-sm btn-success">
<i class="fa fa-plus-circle"></i> <span class="hidden-xs">Dodaj podstronę</span>
</a>
</div>
<? else:?>
<div class="btn-group ml20 pull-right">
<a href="/admin/pages/page_edit/id=<?= $page['id'];?>&menu_id=<?= $page['menu_id'];?>" title="Edytuj stronę" class="btn btn-sm btn-system">
<i class="fa fa-file-text"></i> <span class="hidden-xs">Edytuj stronę</span>
</a>
<a href="#" title="Usuń stronę" class="btn btn-sm btn-danger page-delete" page-id="<?= $page['id'];?>">
<i class="fa fa-trash"></i> <span class="hidden-xs">Usuń stronę</span>
</a>
<a href="/admin/pages/page_articles/id=<?= $page['id'];?>" title="Lista artykułów" class="btn btn-sm btn-info" page-id="<?= $page['id'];?>">
<i class="fa fa-bars"></i> <span class="hidden-xs">Lista artykułów</span>
</a>
</div>
<? endif;?>
</div>
<?= \Tpl::view( 'pages/subpages-list', [
'pages' => \admin\factory\Pages::menu_pages( $this -> menu_id, $page['id'] ),
'menu_id' => $this -> menu_id,
'parent_id' => $page['id'],
'step' => $this -> step + 1
] );
?>
</li>
<? endforeach;?>
</ol>
<? endif;?>

View File

@@ -0,0 +1,123 @@
<script type="text/javascript" src="/libraries/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/libraries/ckeditor/adapters/jquery.js"></script>
<?
global $db;
ob_start();
?>
<div id="settings-tabs">
<ul class="resp-tabs-list settings-tabs">
<li><i class="fa fa-file"></i>Treść</li>
<li><i class="fa fa-wrench"></i>Ustawienia</li>
</ul>
<div class="resp-tabs-container settings-tabs">
<div>
<div id="languages-main">
<ul class="resp-tabs-list languages-main htabs">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<li><?= $lg['name'];?></a></li>
<? endif;?>
<? endforeach; endif;?>
</ul>
<div class="resp-tabs-container languages-main">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<div>
<?= \Html::input(
array(
'label' => 'Tytuł',
'name' => 'title[' . $lg['id'] . ']',
'id' => 'title_' . $lg['id'],
'value' => $this -> container['languages'][ $lg['id'] ]['title'],
'inline' => true
)
);?>
<?= \Html::textarea(
array(
'label' => 'Treść',
'name' => 'text[' . $lg['id'] . ']',
'id' => 'text_' . $lg['id'],
'value' => $this -> container['languages'][ $lg['id'] ]['text'],
'inline' => true
)
);?>
<script type="text/javascript">
$( function() {
$( '#text_<?= $lg['id'];?>' ).ckeditor( {
toolbar : 'MyToolbar',
height:'300'
});
});
</script>
</div>
<? endif;?>
<? endforeach; endif;?>
</div>
<div class="clear"></div>
</div>
</div>
<div>
<?= \Html::input_switch(
array(
'label' => 'Aktywny',
'name' => 'status',
'checked' => $this -> container['status'] == 1 or !$this -> container['id'] ? true : false
)
);?>
<?= \Html::input_switch(
array(
'label' => 'Pokaż tytuł',
'name' => 'show_title',
'checked' => $this -> container['show_title'] == 1 ? true : false
)
);?>
</div>
</div>
</div>
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'container-edit';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Edycja kontenera statycznego';
$grid -> fields = [
[
'db' => 'id',
'type' => 'hidden',
'value' => $this -> container['id']
]
];
$grid -> actions = [
'save' => [ 'url' => '/admin/scontainers/container_save/', 'back_url' => '/admin/scontainers/view_list/' ],
'cancel' => [ 'url' => '/admin/scontainers/view_list/' ]
];
$grid -> external_code = $out;
$grid -> persist_edit = true;
$grid -> id_param = 'id';
echo $grid -> draw();
?>
<script type="text/javascript">
$( function()
{
disable_menu();
$( '#settings-tabs' ).easyResponsiveTabs({
width: 'auto',
fit: true,
tabidentify: 'settings-tabs',
type: 'vertical'
});
$( '#languages-main' ).easyResponsiveTabs({
width: 'auto',
fit: true,
tabidentify: 'languages-main'
});
});
</script>
<script>CKEDITOR.dtd.$removeEmpty['span'] = false;</script>

View File

@@ -0,0 +1,79 @@
<?php
global $gdb;
$grid = new \grid( 'pp_scontainers' );
$grid -> gdb_opt = $gdb;
$grid -> sql = 'SELECT *'
. 'FROM ( '
. 'SELECT '
. 'id, status, '
. '( SELECT title FROM pp_scontainers_langs AS psl, pp_langs AS pl WHERE lang_id = pl.id AND container_id = ps.id AND title != \'\' ORDER BY o ASC LIMIT 1 ) AS title '
. 'FROM '
. 'pp_scontainers AS ps '
. ') AS q1 '
. 'WHERE '
. '1=1 [where] '
. 'ORDER BY '
. '[order_p1] [order_p2]';
$grid -> sql_count = 'SELECT '
. 'COUNT(0) FROM ( '
. 'SELECT '
. 'id, status, '
. '( SELECT title FROM pp_scontainers_langs AS psl, pp_langs AS pl WHERE lang_id = pl.id AND container_id = ps.id AND title != \'\' ORDER BY o ASC LIMIT 1 ) AS title '
. 'FROM '
. 'pp_scontainers AS ps '
. ') AS q1 '
. 'WHERE '
. '1=1 [where] ';
$grid -> debug = true;
$grid -> order = [ 'column' => 'id', 'type' => 'DESC' ];
$grid -> search = [
[ 'name' => 'Tytuł', 'db' => 'title', 'type' => 'text' ],
[ 'name' => 'Aktywny', 'db' => 'status', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ]
];
$grid -> columns_view = [
[
'name' => 'Lp.',
'th' => [ 'class' => 'g-lp' ],
'td' => [ 'class' => 'g-center' ],
'autoincrement' => true
],
[
'name' => 'Tytuł',
'db' => 'title',
'php' => 'echo "<a href=\'/admin/scontainers/container_edit/id=[id]\'>[title]</a>";',
'sort' => true
],
[
'name' => 'Kod',
'php' => 'echo "[KONTENER:[id]]";'
],
[
'name' => 'Aktywny',
'db' => 'status',
'replace' => [ 'array' => [ 0 => '<span style="color: #FF0000;">nie</span>', 1 => 'tak' ] ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
'td' => [ 'class' => 'g-center' ]
],
[
'name' => 'Edytuj',
'action' => [ 'type' => 'edit', 'url' => '/admin/scontainers/container_edit/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
],
[
'name' => 'Usuń',
'action' => [ 'type' => 'delete', 'url' => '/admin/scontainers/container_delete/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
]
];
$grid -> buttons = [
[
'label' => 'Dodaj kontener',
'url' => '/admin/scontainers/container_edit/',
'icon' => 'fa-plus-circle',
'class' => 'btn-success'
]
];
echo $grid -> draw();

View File

@@ -0,0 +1,381 @@
<script type="text/javascript" src="/libraries/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/libraries/ckeditor/adapters/jquery.js"></script>
<script type="text/javascript">
$( function()
{
$( '#settings-tabs' ).easyResponsiveTabs(
{
width: 'auto',
fit: true,
tabidentify: 'settings-tabs',
type: 'vertical'
});
$('#languages-main').easyResponsiveTabs({
width: 'auto',
fit: true,
tabidentify: 'languages-main'
});
$( '#additional_info, #shop_bank_account_info' ).ckeditor(
{
toolbar: 'MyTool',
height: '150'
});
});
</script>
<?
global $db;
ob_start();
?>
<div id="settings-tabs">
<ul class="resp-tabs-list settings-tabs">
<li><i class="fa fa-paper-plane"></i>Dane kontaktowe</li>
<li><i class="fa fa-dollar"></i>Sklep</li>
<li><i class="fa fa-shopping-cart"></i>Produkty</li>
<li><i class="fa fa-envelope"></i>Poczta</li>
<li><i class="fa fa-bars"></i>Pozostałe</li>
<li><i class="fa fa-cog"></i>System</li>
<li><i class="fa fa-line-chart"></i>Konwersje</li>
</ul>
<div class="resp-tabs-container settings-tabs">
<div>
<?= \Html::input(
array(
'label' => 'Nazwa firmy',
'name' => 'firm_name',
'id' => 'firm_name',
'value' => $this -> settings['firm_name']
)
);?>
<?= \Html::textarea(
array(
'label' => 'Dodatkowe informacje',
'name' => 'additional_info',
'id' => 'additional_info',
'value' => $this -> settings['additional_info']
)
);?>
<?= \Html::input_switch(
array(
'label' => 'Mapa',
'name' => 'google_maps',
'checked' => $this -> settings['google_maps'] == 1 ? true : false
)
);?>
<?= \Html::textarea(
array(
'label' => 'Mapa - adres',
'name' => 'firm_adress',
'id' => 'firm_adress',
'value' => $this -> settings['firm_adress']
)
);?>
</div>
<div>
<?= \Html::textarea(
array(
'label' => 'Dane do przelewu',
'name' => 'shop_bank_account_info',
'id' => 'shop_bank_account_info',
'value' => $this -> settings['shop_bank_account_info'],
'rows' => 10,
'ckeditor' => true
)
);?>
<?= \Html::input( [
'label' => 'Klucz API HotPay',
'name' => 'hotpay_api',
'id' => 'hotpay_api',
'value' => $this -> settings['hotpay_api']
] );?>
<?= \Html::input_switch( [
'label' => 'Tpay.com - tryb sandbox',
'name' => 'tpay_sandbox',
'checked' => $this -> settings['tpay_sandbox'] == 1 ? true : false
] );?>
<?= \Html::input( [
'label' => 'Tpay.com ID',
'name' => 'tpay_id',
'id' => 'tpay_id',
'value' => $this -> settings['tpay_id']
] );?>
<?= \Html::input( [
'label' => 'Tpay.com - kod bezpieczeństwa',
'name' => 'tpay_security_code',
'id' => 'tpay_security_code',
'value' => $this -> settings['tpay_security_code']
] );?>
<?= \Html::input_switch( [
'label' => 'Przelewy24.pl - tryb sandbox',
'name' => 'przelewy24_sandbox',
'checked' => $this -> settings['przelewy24_sandbox'] == 1 ? true : false
] );?>
<?= \Html::input( [
'label' => 'Przelewy24.pl - merchant ID',
'name' => 'przelewy24_merchant_id',
'id' => 'przelewy24_merchant_id',
'value' => $this -> settings['przelewy24_merchant_id']
] );?>
<?= \Html::input( [
'label' => 'Przelewy24.pl - klucz CRC',
'name' => 'przelewy24_crc_key',
'id' => 'przelewy24_crc_key',
'value' => $this -> settings['przelewy24_crc_key']
] );?>
<?= \Html::input( [
'label' => 'Darmowa dostawa od',
'class' => 'number-format',
'name' => 'free_delivery',
'id' => 'free_delivery',
'value' => $this -> settings['free_delivery']
] );?>
<?= \Html::textarea( [
'label' => 'Ankieta Ekomi',
'name' => 'ekomi_survey',
'id' => 'ekomi_survey',
'value' => $this -> settings['ekomi_survey'],
'rows' => 10
] );?>
</div>
<div>
<div id="languages-main">
<ul class="resp-tabs-list languages-main htabs">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<li><? if ( $lg['id'] == \front\factory\Languages::default_language() ) echo '<i class="fa fa-star fa-lg text-system" title="Język domyślny"></i> ';?><?= $lg['name'];?></a></li>
<? endif;?>
<? endforeach; endif;?>
</ul>
<div class="resp-tabs-container languages-main">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<?
$languages = array();
$languages[''] = '---- wersja językowa ----';
if ( is_array( $this -> languages ) ) foreach ( $this -> languages as $lg_tmp )
{
if ( $lg_tmp['id'] != $lg['id'] )
$languages[ $lg_tmp['id'] ] = $lg_tmp['name'];
}
?>
<? if ( $lg['status'] ):?>
<div>
<?= \Html::input(
array(
'label' => 'Komunikat gdy stan magazynowy równy 0',
'name' => 'warehouse_message_zero[' . $lg['id'] . ']',
'id' => 'warehouse_message_zero_' . $lg['id'],
'value' => $this -> settings[ 'warehouse_message_zero_' . $lg['id'] ],
'inline' => true
)
);?>
<?= \Html::input(
array(
'label' => 'Komunikat gdy stan magazynowy większy niż 0',
'name' => 'warehouse_message_nonzero[' . $lg['id'] . ']',
'id' => 'warehouse_message_nonzero_' . $lg['id'],
'value' => $this -> settings[ 'warehouse_message_nonzero_' . $lg['id'] ],
'inline' => true
)
);?>
</div>
<? endif;?>
<? endforeach; endif;?>
</div>
<div class="clear"></div>
</div>
</div>
<div>
<?= \Html::input_switch(
array(
'label' => 'Formularz kontaktowy',
'name' => 'contact_form',
'checked' => $this -> settings['contact_form'] == 1 ? true : false
)
);?>
<?= \Html::input(
array(
'label' => 'Email kontaktowy',
'name' => 'contact_email',
'id' => 'contact_email',
'value' => $this -> settings['contact_email']
)
);?>
<?= \Html::input(
array(
'label' => 'Email - host',
'name' => 'email_host',
'id' => 'email_host',
'value' => $this -> settings['email_host']
)
);?>
<?= \Html::input(
array(
'label' => 'Email - port',
'name' => 'email_port',
'id' => 'email_port',
'value' => $this -> settings['email_port']
)
);?>
<?= \Html::input(
array(
'label' => 'Email - login',
'name' => 'email_login',
'id' => 'email_login',
'value' => $this -> settings['email_login']
)
);?>
<?= \Html::input(
array(
'label' => 'Email - hasło',
'name' => 'email_password',
'id' => 'email_password',
'value' => $this -> settings['email_password']
)
);?>
</div>
<div>
<?= \Html::input(
array(
'label' => 'Facebook link',
'name' => 'facebook_link',
'id' => 'facebook_link',
'value' => $this -> settings['facebook_link']
)
);?>
<?= Html::input( [
'label' => 'Piksel Facebook',
'name' => 'piksel',
'id' => 'piksel',
'value' => $this -> settings['piksel']
]
);
?>
<?= \Html::textarea(
array(
'label' => 'Kod statystyk',
'name' => 'statistic_code',
'id' => 'statistic_code',
'value' => $this -> settings['statistic_code'],
'rows' => 10
)
);?>
<?= \Html::textarea(
array(
'label' => 'Własne reguły htacess',
'name' => 'htaccess',
'id' => 'htaccess',
'value' => $this -> settings['htaccess'],
'rows' => 10
)
);?>
<?= \Html::textarea(
array(
'label' => 'Własne reguły robots.txt',
'name' => 'robots',
'id' => 'robots',
'value' => $this -> settings['robots'],
'rows' => 10
)
);?>
</div>
<div>
<?= \Html::input_switch(
array(
'label' => 'Aktualizacja',
'name' => 'update',
'checked' => $this -> settings['update'] == 1 ? true : false
)
);?>
<?= Html::input( [
'label' => 'Numer licencji',
'name' => 'update_key',
'id' => 'update_key',
'value' => $this -> settings['update_key']
]
);
?>
<?= \Html::input_switch(
array(
'label' => 'Strona konstrukcyjna',
'name' => 'devel',
'checked' => $this -> settings['devel'] == 1 ? true : false
)
);?>
<?= \Html::input_switch( [
'label' => 'Lazy loading obrazów',
'name' => 'lazy_loading',
'checked' => $this -> settings['lazy_loading'] == 1 ? true : false
] );?>
<?= \Html::input_switch( [
'label' => 'Generowanie obrazków WEBP',
'name' => 'generate_webp',
'checked' => $this -> settings['generate_webp'] == 1 ? true : false
] );?>
<?= \Html::input_switch( [
'label' => 'Infinitescroll',
'name' => 'infinitescroll',
'checked' => $this -> settings['infinitescroll'] == 1 ? true : false
] );?>
<?= \Html::input_switch(
array(
'label' => 'Htaccess cache',
'name' => 'htaccess_cache',
'checked' => $this -> settings['htaccess_cache'] == 1 ? true : false
)
);?>
</div>
<div>
<?= Html::input( [
'label' => 'Google Tag Manager - ID',
'name' => 'google_tag_manager_id',
'id' => 'google_tag_manager_id',
'value' => $this -> settings['google_tag_manager_id']
] ); ?>
<?= \Html::textarea( [
'label' => 'Własny kod GTM JS (bez tagu script)',
'name' => 'own_gtm_js',
'id' => 'own_gtm_js',
'value' => $this -> settings['own_gtm_js'],
'rows' => 10
] );?>
<?= \Html::textarea( [
'label' => 'Własny kod GTM HTML',
'name' => 'own_gtm_html',
'id' => 'own_gtm_html',
'value' => $this -> settings['own_gtm_html'],
'rows' => 10
] );?>
</div>
</div>
<div class="clear"></div>
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'settings-edit';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Edycja ustawień';
$grid -> actions = [
'save' => [ 'url' => '/admin/settings/settings_save/', 'back_url' => '/admin/settings/view/' ],
];
$grid -> external_code = $out;
echo $grid -> draw();
?>
<script>CKEDITOR.dtd.$removeEmpty['span'] = false;</script>
<style type="text/css">#g-edit-cancel { display: none; }</style>
<script type="text/javascript">
$( document).ready( function ()
{
$( '.popover-btn' ).popover(
{
trigger: 'hover',
html: true
});
});
</script>

View File

@@ -0,0 +1,55 @@
<div class="panel panel-widget draft-widget" value-number="<?= $this -> i;?>">
<div class="panel-heading with-buttons">
<span class="panel-title">Wartość <?= $this -> i;?></span>
<div class="btn btn-danger btn-value-remove">
<i class="fa fa-trash"></i> Usuń wartość
</div>
</div>
<div class="panel-body p20">
<div class="row">
<div class="col-lg-6">
<div class="mb20">
<input type="radio" id="default_value<?=$this -> value['id'];?>" name="default_value" value="<?= ( $this -> i - 1 );?>" <? if ( $this -> value['is_default'] ):?>checked<? endif;?>>
<label for="default_value<?=$this -> value['id'];?>">Wartość domyślna</label>
</div>
<div class="row form-group">
<div class="col-xs-8">
<div class="input-group">
<input class="form-control" name="impact_on_the_price[]" type="text" value="<?= $this -> value['impact_on_the_price'];?>" placeholder="wpływ na cenę produktu...">
<span class="input-group-addon">
<i class="fa fa-usd"></i>
</span>
</div>
</div>
</div>
</div>
<div class="col-lg-6">
<div class="tab-block mb25">
<ul class="nav nav-tabs nav-tabs-right tabs-border">
<? $z = 0;?>
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<li class="<? if ( !$z++ ):?>active<? endif;?>">
<a href="#tab<?= $this -> i;?>_<?= $lg['id'];?>" data-toggle="tab" aria-expanded="true"><?= $lg['name'];?></a>
</li>
<? endif;?>
<? endforeach; endif;?>
</ul>
<div class="tab-content">
<? $z = 0;?>
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<div id="tab<?= $this -> i;?>_<?= $lg['id'];?>" class="tab-pane <? if ( !$z++ ):?>active<? endif;?>">
<? if ( $this -> attribute['type'] == 0 ):?>
<input type="hidden" name="ids[<?= $lg['id'];?>][]" value="<?= $this -> value['id'];?>" />
<input type="text" class="name-<?= $i;?> form-control" name="name[<?= $lg['id'];?>][]" value="<?= $this -> value['languages'][$lg['id']]['name'];?>">
<? endif;?>
</div>
<? endif;?>
<? endforeach; endif;?>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,106 @@
<script type="text/javascript" src="/libraries/framework/vendor/plugins/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/libraries/framework/vendor/plugins/ckeditor/adapters/jquery.js"></script>
<?php
global $db;
ob_start();
?>
<div id="settings-tabs">
<ul class="resp-tabs-list settings-tabs">
<li><i class="fa fa-file"></i>Treść</li>
<li><i class="fa fa-wrench"></i>Ustawienia</li>
</ul>
<div class="resp-tabs-container settings-tabs">
<div>
<div id="languages-main">
<ul class="resp-tabs-list languages-main htabs">
<?php if (is_array($this -> languages)) : foreach ($this -> languages as $lg) : ?>
<?php if ($lg['status']) : ?>
<li><?php echo $lg['name']; ?></a></li>
<?php endif; ?>
<?php endforeach; endif; ?>
</ul>
<div class="resp-tabs-container languages-main">
<?php if (is_array($this -> languages)) : foreach ($this -> languages as $lg) : ?>
<?php if ($lg['status']) : ?>
<div>
<?= \Html::input( [
'label' => 'Tytuł',
'name' => 'name[' . $lg['id'] . ']',
'id' => 'name_' . $lg['id'],
'value' => $this -> attribute['languages'][ $lg['id'] ]['name'],
'inline' => true,
] ); ?>
</div>
<?php endif; ?>
<?php endforeach; endif; ?>
</div>
<div class="clear"></div>
</div>
</div>
<div>
<?= \Html::input_switch( [
'label' => 'Aktywny',
'name' => 'status',
'checked' => $this -> attribute['status'] || !$this -> attribute['id'] ? true : false,
] );?>
<?= \Html::select( [
'label' => 'Typ',
'name' => 'type',
'values' => [0 => 'tekst'],//, 1 => 'kolor', 2 => 'wzór'],
'value' => $this -> attribute['type'],
] );?>
<?= \Html::input( [
'label' => 'Kolejność',
'name' => 'o',
'id' => 'o',
'value' => $this -> attribute['o'],
] );?>
</div>
</div>
</div>
<?php
$out = ob_get_clean();
$grid = new \gridEdit();
$grid -> id = 'attribute-edit';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Edycja cechy';
$grid -> fields = [
[
'db' => 'id',
'type' => 'hidden',
'value' => $this -> attribute['id'],
],
];
$grid -> actions = [
'save' => ['url' => '/admin/shop_attribute/attribute_save/', 'back_url' => '/admin/shop_attribute/view_list/'],
'cancel' => ['url' => '/admin/shop_attribute/view_list/'],
];
$grid -> external_code = $out;
$grid -> persist_edit = true;
$grid -> id_param = 'id';
echo $grid -> draw();
?>
<script type="text/javascript">
$( function()
{
disable_menu();
$( '#settings-tabs' ).easyResponsiveTabs({
width: 'auto',
fit: true,
tabidentify: 'settings-tabs',
type: 'vertical'
});
$( '#languages-main' ).easyResponsiveTabs({
width: 'auto',
fit: true,
tabidentify: 'languages-main'
});
});
</script>
<script>CKEDITOR.dtd.$removeEmpty['span'] = false;</script>

View File

@@ -0,0 +1,95 @@
<?php
global $gdb;
$grid = new \grid('pp_shop_attributes');
$grid -> gdb_opt = $gdb;
$grid -> sql = 'SELECT *'
. 'FROM ( '
. 'SELECT '
. 'id, status, type, o, '
. '( SELECT psal.name FROM pp_shop_attributes_langs AS psal, pp_langs AS pl WHERE lang_id = pl.id AND attribute_id = psa.id AND psal.name != \'\' ORDER BY o ASC LIMIT 1 ) AS name '
. 'FROM '
. 'pp_shop_attributes AS psa '
. ') AS q1 '
. 'WHERE '
. '1=1 [where] '
. 'ORDER BY '
. '[order_p1] [order_p2]';
$grid -> sql_count = 'SELECT '
. 'COUNT(0) FROM ( '
. 'SELECT '
. 'id, status, type, o, '
. '( SELECT psal.name FROM pp_shop_attributes_langs AS psal, pp_langs AS pl WHERE lang_id = pl.id AND attribute_id = psa.id AND psal.name != \'\' ORDER BY o ASC LIMIT 1 ) AS name '
. 'FROM '
. 'pp_shop_attributes AS psa '
. ') AS q1 '
. 'WHERE '
. '1=1 [where] ';
$grid -> debug = true;
$grid -> order = [ 'column' => 'o', 'type' => 'ASC' ];
$grid -> search = [
['name' => 'Nazwa', 'db' => 'name', 'type' => 'text'],
['name' => 'Aktywny', 'db' => 'status', 'type' => 'select', 'replace' => ['array' => [0 => 'nie', 1 => 'tak']]],
];
$grid -> columns_view = [
[
'name' => 'Lp.',
'th' => ['class' => 'g-lp'],
'td' => ['class' => 'g-center'],
'autoincrement' => true,
],
[
'name' => 'Kolejność',
'td' => [ 'class' => 'g-center', 'style' => 'width: 100px' ],
'db' => 'o',
'sort' => true,
],
[
'name' => 'Nazwa',
'db' => 'name',
'php' => 'echo "<a href=\'/admin/shop_attribute/attribute_edit/id=[id]\'>[name]</a>";',
'sort' => true,
],
[
'name' => 'Typ',
'db' => 'type',
'replace' => ['array' => [0 => 'tekst', 1 => 'kolor', 2 => 'wzór']],
'td' => ['class' => 'g-center'],
'th' => ['class' => 'g-center', 'style' => 'width: 150px;'],
'sort' => true,
], [
'name' => 'Aktywny',
'db' => 'status',
'replace' => ['array' => [0 => '<span style="color: #FF0000;">nie</span>', 1 => 'tak']],
'td' => ['class' => 'g-center'],
'th' => ['class' => 'g-center', 'style' => 'width: 150px;'],
'sort' => true,
], [
'name' => 'Wartości',
'td' => ['class' => 'g-center'],
'th' => ['class' => 'g-center', 'style' => 'width: 150px;'],
'php' => 'echo "<a href=\'/admin/shop_attribute/values_edit/attribute-id=[id]\'>edytuj wartości</a>";',
],
[
'name' => 'Edytuj',
'action' => ['type' => 'edit', 'url' => '/admin/shop_attribute/attribute_edit/id=[id]'],
'th' => ['class' => 'g-center', 'style' => 'width: 70px;'],
'td' => ['class' => 'g-center'],
],
[
'name' => 'Usuń',
'action' => ['type' => 'delete', 'url' => '/admin/shop_attribute/delete_attribute/id=[id]'],
'th' => ['class' => 'g-center', 'style' => 'width: 70px;'],
'td' => ['class' => 'g-center'],
],
];
$grid -> buttons = [
[
'label' => 'Dodaj cechę',
'url' => '/admin/shop_attribute/attribute_edit/',
'icon' => 'fa-plus-circle',
'class' => 'btn-success',
],
];
echo $grid -> draw();

View File

@@ -0,0 +1,138 @@
<div class="panel panel-widget draft-widget" value-numer="<?= $this -> i;?>">
<div class="panel-heading with-buttons">
<span class="panel-title">Edycja wartości dla cechy: <?= $this -> attribute['languages']['pl']['name'];?></span>
<div class="buttons">
<a class="btn btn-success btn-save" href="#">
<i class="fa fa-save"></i> zapisz
</a>
<a class="btn btn-dark" href="/admin/shop_attribute/view_list/">
<i class="fa fa-ban"></i> wstecz
</a>
</div>
</div>
<div class="panel-body p20">
<button class="btn btn-success mb10 btn-value-add">
<i class="fa fa-plus-circle mr5"></i>Dodaj wartość
</button>
<div class="values-content">
<?
if ( $this -> values ):
foreach ( $this -> values as $value ):
echo \Tpl::view( 'shop-attribute/_partials/value', [
'i' => ++$i,
'value' => $value,
'languages' => $this -> languages,
'attribute' => $this -> attribute
] );
endforeach;
endif;
?>
</div>
</div>
</div>
<script type="text/javascript">
$(function ()
{
disable_menu();
$( 'body' ).on( 'click', '.btn-save', function()
{
var values = jQuery( '.dashboard-page' ).find( 'input, select, textarea' ).serializeObject();
jQuery.ajax({
type: 'POST',
cache: false,
url: '/admin/shop_attribute/values_save/',
data: {
values: JSON.stringify( values ),
attribute_id: <?= $this -> attribute['id'];?>,
},
beforeSend: function() {
jQuery( '#overlay' ).show();
},
success: function( response ) {
var data = jQuery.parseJSON( response );
jQuery( '#overlay' ).hide();
if ( data.status === 'ok' )
{
var msg = "Zapisano wartości atrybutu";
alert_message( msg );
}
else
{
if ( data.msg )
var msg = data.msg;
else
var msg = "Przepraszamy. Podczas wczytywania danych wystąpił błąd. Prosimy spróbować ponownie.";
create_error( msg );
}
}
});
});
$( 'body').on( 'click', '.btn-value-add', function ()
{
var maxVal = Math.max.apply(null, $('div[value-number]').map(function() {
var val = parseInt($(this).attr('value-number'));
return isNaN(val) ? 0 : val; // Jeżeli wartość nie jest liczbą, zwróć 0
}).get());
if (!isFinite(maxVal)) {
maxVal = 0;
}
$.ajax({
url: '/admin/shop_attribute/attribute_value_tpl/',
type: 'POST',
data: {
i: maxVal + 1,
value: null,
languages: <?= json_encode( $this -> languages );?>,
attribute: <?= json_encode( $this -> attribute );?>
},
success: function( response )
{
$('.values-content').append(response);
}
});
});
$( 'body' ).on( 'click', '.btn-value-remove', function()
{
var button = $( this );
$.alert({
title: 'Potwierdź',
content: 'Na pewno chcesz usunąć wybraną wartość?',
type: 'orange',
closeIcon: true,
closeIconClass: 'fa fa-close',
typeAnimated: true,
animation: 'opacity',
autoClose: 'confirm|10000',
useBootstrap: false,
theme: 'modern',
autoClose: 'cancel|10000',
icon: 'fa fa-exclamation',
buttons:
{
confirm:
{
text: 'TAK usuń',
btnClass: 'btn-orange',
keys: ['enter'],
action: function()
{
button.closest( '.panel' ).remove();
}
},
cancel:
{
text: 'anuluj',
btnClass: 'btn-blue',
action: function() {}
}
}
});
});
});
</script>

View File

@@ -0,0 +1,163 @@
<?
global $gdb;
ob_start();
?>
<div class="menu_sortable">
<ol class="sortable" id="sortable">
<? if ( is_array( $this -> categories ) ): foreach ( $this -> categories as $category ):?>
<li id="list_<?= $category['id'];?>" class="category_<?= $category['id'];?>" category="<?= $category['id'];?>">
<div class="context_0 content content_menu">
<span class="disclose"><span></span></span>
<? if ( !$category['status'] ) echo '<i class="fa fa-ban fa-lg text-danger" title="Kategoria nieaktywna"></i>';?>
<b><?= $category['languages'][$this -> dlang]['title'];?></b>
<div class="btn-group ml20 pull-right">
<a href="/admin/shop_category/category_edit/id=<?= $category['id'];?>" title="Edytuj kategorię" class="btn btn-sm btn-system">
<i class="fa fa-file-text"></i> <span class="hidden-xs">Edytuj kategorię</span>
</a>
<a href="#" title="Usuń kategorię" class="btn btn-sm btn-danger category-delete" category-id="<?= $category['id'];?>">
<i class="fa fa-trash"></i> <span class="hidden-xs">Usuń kategorię</span>
</a>
<a href="/admin/shop_category/category_products/id=<?= $category['id'];?>" title="Lista produktów" class="btn btn-sm btn-info" category-id="<?= $category['id'];?>">
<i class="fa fa-bars"></i> <span class="hidden-xs">Lista produków</span>
</a>
<a href="/admin/shop_category/category_edit/pid=<?= $category['id'];?>" title="Dodaj podkategorię" class="btn btn-sm btn-success">
<i class="fa fa-plus-circle"></i> <span class="hidden-xs">Dodaj podkategorię</span>
</a>
</div>
</div>
<?= \Tpl::view( 'shop-category/subcategories-list', [
'categories' => \admin\factory\ShopCategory::subcategories( $category['id'] ),
'level' => $this -> level + 1,
'dlang' => $this -> dlang
] );?>
</li>
<? endforeach; endif;?>
</ol>
</div>
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'pages-list';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Lista kategorii';
$grid -> default_buttons = false;
$grid -> buttons = [
[
'label' => 'Dodaj kategorię',
'url' => '/admin/shop_category/category_edit/',
'icon' => 'fa-plus-circle',
'class' => 'btn-success'
]
];
$grid -> external_code = $out;
echo $grid -> draw();
?>
<script type="text/javascript" src="/libraries/jquery-nested-sortable/jquery.mjs.nestedSortable.js"></script>
<script type="text/javascript">
$( document ).ready( function()
{
$( 'body' ).on( 'click', '.category-delete', function()
{
var category_id = $( this ).attr( 'category-id' );
$.prompt( "Na pewno chcesz usunąć wybraną kategorię?",
{
title: "Potwierdź?",
buttons: { "Tak": true, "Nie": false },
submit: function( e, v, m, f )
{
if ( v === true )
document.location.href = '/admin/shop_category/category_delete/id=' + category_id;
}
});
});
$( 'ol.sortable' ).nestedSortable(
{
forcePlaceholderSize: true,
handle: 'div',
helper: 'clone',
items: 'li',
opacity: .9,
placeholder: 'placeholder',
revert: 250,
tabSize: 45,
tolerance: 'pointer',
toleranceElement: '> div',
maxLevels: 4,
isTree: true,
expandOnHover: 700,
protectRoot: false,
stop: function() {
save_categories_order();
}
});
$( '.disclose' ).on( 'click', function()
{
$( this ).closest( 'li' ).toggleClass( 'sort-collapsed' ).toggleClass( 'sort-expanded' );
});
$( '.disclose' ).mousedown( function(e)
{
if ( e.which === 1 )
{
var category_id = $( this ).parent( 'div' ).parent( 'li' ).attr( 'id' );
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data: {
a: 'cookie_categories',
category_id: category_id
}
});
}
});
<?php
$array = unserialize( $_COOKIE[ 'cookie_categories' ] );
if ( is_array( $array ) ): foreach ( $array as $key => $val ):
if ( $val ):
?>$( '#<?= $key;?>' ).children( 'div' ).children( 'span.disclose' ).click();<?
endif;
endforeach; endif;
?>
});
function save_categories_order( )
{
categories = $( '#sortable' ).nestedSortable( 'toArray', { startDepthCount: 0 } );
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data:
{
a: 'save_categories_order',
categories: categories
},
beforeSend: function()
{
$.prompt( 'Trwa zapisywanie...', { title: 'Proszę czekać' } );
},
success: function( data )
{
$( '.jqibox' ).remove();
response = jQuery.parseJSON( data );
if ( response.status === 'error' )
create_error( response.msg );
}
});
}
</script>

View File

@@ -0,0 +1,106 @@
<?
global $gdb;
ob_start();
?>
<div class="menu_sortable">
<ol class="sortable" id="sortable">
<? if ( is_array( $this -> categories ) ): foreach ( $this -> categories as $category ):?>
<li id="list_<?= $category['id'];?>" class="category_<?= $category['id'];?>" category="<?= $category['id'];?>">
<div class="context_0 content content_menu">
<span class="disclose"><span></span></span>
<? if ( !$category['status'] ) echo '<i class="fa fa-ban fa-lg text-danger" title="Kategoria nieaktywna"></i>';?>
<b><?= $category['languages'][$this -> dlang]['title'];?></b>
<div class="btn-group ml20 pull-right">
<a href="#" title="Wybierz kategorię" class="btn btn-sm btn-system button category-select" category-title="<?= $category['languages'][$this -> dlang]['title'];?>" category-id="<?= $category['id'];?>">
<i class="fa fa-check"></i> <span class="hidden-xs">wybierz</span>
</a>
</div>
</div>
<?= \Tpl::view( 'shop-category/subcategory-browse-list', [
'categories' => \admin\factory\ShopCategory::subcategories( $category['id'] ),
'level' => $this -> level + 1,
'dlang' => $this -> dlang
] );?>
</li>
<? endforeach; endif;?>
</ol>
</div>
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'pages-list';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = false;
$grid -> title = 'Lista kategorii';
$grid -> default_buttons = false;
$grid -> external_code = $out;
echo $grid -> draw();
?>
<style type="text/css">
.mfp-container body.sb-top.sb-top-sm .navbar.navbar-fixed-top + #sidebar_left + #content_wrapper {
padding-top: 0;
}
.mfp-container #content {
padding: 27px 0 0;
}
.mfp-container #content > .row {
margin: 0;
}
.mfp-container #content > .row > .col-lg-9 {
padding: 0;
width: 100%;
float: none;
}
</style>
<script type="text/javascript" src="/libraries/jquery-nested-sortable/jquery.mjs.nestedSortable.js"></script>
<script type="text/javascript">
$( document ).ready( function() {
$( 'ol.sortable' ).nestedSortable({
forcePlaceholderSize: true,
handle: 'div',
helper: 'clone',
items: 'li',
opacity: .9,
placeholder: 'placeholder',
revert: 250,
tabSize: 45,
tolerance: 'pointer',
toleranceElement: '> div',
maxLevels: 4,
isTree: true,
expandOnHover: 700,
protectRoot: false
});
$( '.disclose' ).on( 'click', function() {
$( this ).closest( 'li' ).toggleClass( 'sort-collapsed' ).toggleClass( 'sort-expanded' );
});
$( '.disclose' ).mousedown( function(e) {
if ( e.which === 1 ) {
var category_id = $( this ).parent( 'div' ).parent( 'li' ).attr( 'id' );
$.ajax({
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data: {
a: 'cookie_categories',
category_id: category_id
}
});
}
});
<?php
$array = unserialize( $_COOKIE[ 'cookie_categories' ] );
if ( is_array( $array ) ): foreach ( $array as $key => $val ):
if ( $val ):
?>$( '#<?= $key;?>' ).children( 'div' ).children( 'span.disclose' ).click();<?
endif;
endforeach; endif;
?>
});
</script>

View File

@@ -0,0 +1,266 @@
<script type="text/javascript" src="/libraries/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/libraries/ckeditor/adapters/jquery.js"></script>
<script type="text/javascript">
$( function()
{
disable_menu();
$( '#settings-tabs' ).easyResponsiveTabs({
width: 'auto',
fit: true,
tabidentify: 'settings-tabs',
type: 'vertical'
});
$( '#languages-main' ).easyResponsiveTabs({
width: 'auto',
fit: true,
tabidentify: 'languages-main'
});
$( '#languages-seo' ).easyResponsiveTabs({
width: 'auto',
fit: true,
tabidentify: 'languages-seo'
});
$( '#page_type' ).trigger( 'change' );
});
function generate_seo_links( lang, title, category_id )
{
if ( title === '' )
return false;
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data: {
a: 'generate_seo_link',
title: title,
category_id: category_id
},
beforeSend: function()
{
$( '#overlay' ).show();
},
success: function( data )
{
$( '#overlay' ).hide();
response = jQuery.parseJSON( data );
if ( response.status === 'ok' )
$( '#seo_link_' + lang ).val( response.seo_link );
else
create_error( response.msg );
}
});
}
</script>
<?
global $db;
ob_start();
?>
<div id="settings-tabs">
<ul class="resp-tabs-list settings-tabs">
<li><i class="fa fa-file"></i>Treść</li>
<li><i class="fa fa-wrench"></i>Ustawienia</li>
<li><i class="fa fa-globe"></i>SEO</li>
</ul>
<div class="resp-tabs-container settings-tabs">
<div>
<div id="languages-main">
<ul class="resp-tabs-list languages-main htabs">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<li><? if ( $lg['id'] == \front\factory\Languages::default_language() ) echo '<i class="fa fa-star fa-lg text-system" title="Język domyślny"></i> ';?><?= $lg['name'];?></a></li>
<? endif;?>
<? endforeach; endif;?>
</ul>
<div class="resp-tabs-container languages-main">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<div>
<?= \Html::input(
array(
'label' => 'Nazwa kategorii',
'name' => 'title[' . $lg['id'] . ']',
'id' => 'title_' . $lg['id'],
'value' => $this -> category[ 'languages' ][ $lg['id'] ]['title'],
'inline' => true
)
);?>
<?= \Html::textarea(
array(
'label' => 'Opis kategorii',
'name' => 'text[' . $lg['id'] . ']',
'id' => 'text_' . $lg['id'],
'value' => $this -> category['languages'][ $lg['id'] ]['text'],
'inline' => true
)
);?>
<?= \Html::textarea(
array(
'label' => 'Opis kategorii (rozwinięcie)',
'name' => 'text_hidden[' . $lg['id'] . ']',
'id' => 'text_hidden_' . $lg['id'],
'value' => $this -> category['languages'][ $lg['id'] ]['text_hidden'],
'inline' => true
)
);?>
<?= \Html::textarea( [
'label' => 'Dodatkowy tekst (nad produktami)',
'name' => 'additional_text[' . $lg['id'] . ']',
'id' => 'additional_text_' . $lg['id'],
'value' => $this -> category['languages'][ $lg['id'] ]['additional_text'],
'inline' => true
] );?>
<script type="text/javascript">
$( function() {
$( '#text_<?= $lg['id'];?>, #text_hidden_<?= $lg['id'];?>, #additional_text_<?= $lg['id'];?>' ).ckeditor( {
toolbar : 'MyToolbar',
height:'250'
});
});
</script>
</div>
<? endif;?>
<? endforeach; endif;?>
</div>
<div class="clear"></div>
</div>
</div>
<div style="padding: 15px;">
<?= \Html::input_switch(
array(
'label' => 'Aktywna',
'name' => 'status',
'checked' => $this -> category['status'] == 1 or !$this -> category['id'] ? true : false
)
);?>
<?= \Html::select(
[
'label' => 'Sortowanie produktów',
'name' => 'sort_type',
'id' => 'sort_type',
'values' => \admin\factory\ShopCategory::$_sort_types,
'value' => $this -> category['sort_type']
]
);?>
<?= \Html::input_switch(
array(
'label' => 'Wyświetlić podkategorie',
'name' => 'view_subcategories',
'checked' => $this -> category['view_subcategories'] == 1 ? true : false
)
);?>
</div>
<div>
<div id="languages-seo">
<ul class="resp-tabs-list languages-seo htabs">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<li><? if ( $lg['id'] == \front\factory\Languages::default_language() ) echo '<i class="fa fa-star fa-lg text-system" title="Język domyślny"></i> ';?><?= $lg['name'];?></a></li>
<? endif;?>
<? endforeach; endif;?>
</ul>
<div class="resp-tabs-container languages-seo">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<div>
<?= \Html::input_icon(
array(
'label' => 'Link SEO',
'name' => 'seo_link[' . $lg['id'] . ']',
'id' => 'seo_link_' . $lg['id'],
'value' => $this -> category['languages' ][ $lg['id'] ]['seo_link'],
'icon_content' => 'generuj',
'icon_js' => 'generate_seo_links( "' . $lg['id'] . '", $( "#title_' . $lg['id'] . '" ).val(), ' . (int)$this -> category['id'] . ' );'
)
);?>
<?= \Html::input(
array(
'label' => 'Tytuł kategorii (h1)',
'name' => 'category_title[' . $lg['id'] . ']',
'id' => 'category_title_' . $lg['id'],
'value' => $this -> category['languages' ][ $lg['id'] ]['category_title']
)
);?>
<?= \Html::input(
array(
'label' => 'Meta title',
'name' => 'meta_title[' . $lg['id'] . ']',
'id' => 'meta_title_' . $lg['id'],
'value' => $this -> category['languages'][ $lg['id'] ]['meta_title']
)
);?>
<?= \Html::textarea(
array(
'label' => 'Meta description',
'name' => 'meta_description[' . $lg['id'] . ']',
'id' => 'meta_description_' . $lg['id'],
'value' => $this -> category['languages'][ $lg['id'] ]['meta_description']
)
);?>
<?= \Html::textarea(
array(
'label' => 'Meta keywords',
'name' => 'meta_keywords[' . $lg['id'] . ']',
'id' => 'meta_keywords_' . $lg['id'],
'value' => $this -> category['languages'][ $lg['id'] ]['meta_keywords']
)
);?>
<?= \Html::select(
array(
'label' => 'Blokuj indeksację',
'name' => 'noindex[' . $lg['id'] . ']',
'id' => 'noindex_' . $lg['id'],
'values' => array(
0 => 'nie', 1 => 'tak'
),
'value' => $this -> category['languages'][ $lg['id'] ]['noindex'] == 1 ? 1 : 0
)
);?>
</div>
<? endif;?>
<? endforeach; endif;?>
</div>
<div class="clear"></div>
</div>
</div>
</div>
<div class="clear"></div>
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'category-edit';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Edycja kategorii';
$grid -> fields = [
[
'db' => 'id',
'type' => 'hidden',
'value' => $this -> category['id']
],
[
'db' => 'parent_id',
'type' => 'hidden',
'value' => $this -> category['id'] ? $this -> category['parent_id'] : $this -> pid
]
];
$grid -> actions = [
'save' => [ 'url' => '/admin/shop_category/save/', 'back_url' => '/admin/shop_category/view_list/' ],
'cancel' => [ 'url' => '/admin/shop_category/view_list/' ]
];
$grid -> external_code = $out;
$grid -> persist_edit = true;
$grid -> id_param = 'id';
echo $grid -> draw();
?>

View File

@@ -0,0 +1,89 @@
<?
global $gdb;
ob_start();
?>
<ol class="sortable" id="article-list">
<?
if ( is_array( $this -> products ) ) foreach ( $this -> products as $product )
{
?>
<li id="list_<?= $product['product_id'];?>">
<div class="content <? if ( !$product['status'] ) echo 'text-danger';?>"><span class="disclose"><span></span></span> <?= $product['name'];?></div>
</li>
<?
}
?>
</ol>
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> default_buttons = false;
$grid -> external_code = $out;
$grid -> title = 'Lista produktów';
$grid -> buttons = [
[
'label' => 'Wstecz',
'url' => '/admin/shop_category/view_list/',
'icon' => 'fa-reply',
'class' => 'btn-dark'
]
];
echo $grid -> draw();
?>
<script type="text/javascript" src="/libraries/jquery-nested-sortable/jquery.mjs.nestedSortable.js"></script>
<script type="text/javascript">
$( document ).ready( function()
{
$( 'ol.sortable' ).nestedSortable(
{
forcePlaceholderSize: true,
handle: 'div',
helper: 'clone',
items: 'li',
opacity: .6,
placeholder: 'placeholder',
revert: 250,
tabSize: 25,
tolerance: 'pointer',
toleranceElement: '> div',
maxLevels: 1,
isTree: true,
expandOnHover: 700,
save_articles_order: true
});
});
function save_articles_order()
{
products = $( 'ol.sortable' ).nestedSortable( 'toArray', { startDepthCount: 0 } );
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data:
{
a: 'save_products_order',
category_id: <?= $this -> category_id;?>,
products: products
},
beforeSend: function()
{
$.prompt( 'Trwa zapisywanie...', { title: 'Proszę czekać' } );
},
success: function( data )
{
$( '.jqibox' ).remove();
response = jQuery.parseJSON( data );
if ( response.status === 'error' )
create_error( response.msg );
}
});
}
</script>

View File

@@ -0,0 +1,34 @@
<? if ( is_array( $this -> categories ) ):?>
<ol>
<? foreach ( $this -> categories as $category ):?>
<li id="list_<?= $category['id'];?>" class="list_<?= $category['id'];?>" category="<?= $category['id'];?>">
<div class="context_0 content content_menu">
<span class="disclose"><span></span></span>
<? if ( !$category['status'] ) echo '<i class="fa fa-ban fa-lg text-danger" title="Kategoria nieaktywna"></i>';?>
<b><?= $category['languages'][$this -> dlang]['title'];?></b>
<div class="btn-group ml20 pull-right">
<a href="/admin/shop_category/category_edit/id=<?= $category['id'];?>" title="Edytuj kategorię" class="btn btn-sm btn-system">
<i class="fa fa-file-text"></i> <span class="hidden-xs">Edytuj kategorię</span>
</a>
<a href="#" title="Usuń kategorię" class="btn btn-sm btn-danger category-delete" category-id="<?= $category['id'];?>">
<i class="fa fa-trash"></i> <span class="hidden-xs">Usuń kategorię</span>
</a>
<a href="/admin/shop_category/category_products/id=<?= $category['id'];?>" title="Lista produktów" class="btn btn-sm btn-info" category-id="<?= $category['id'];?>">
<i class="fa fa-bars"></i> <span class="hidden-xs">Lista produków</span>
</a>
<? if ( $this -> level < 2 ):?>
<a href="/admin/shop_category/category_edit/pid=<?= $category['id'];?>" title="Dodaj podkategorię" class="btn btn-sm btn-success">
<i class="fa fa-plus-circle"></i> <span class="hidden-xs">Dodaj podkategorię</span>
</a>
<? endif;?>
</div>
</div>
<?= \Tpl::view( 'shop-category/subcategories-list', [
'categories' => \admin\factory\ShopCategory::subcategories( $category['id'] ),
'level' => $this -> level + 1,
'dlang' => $this -> dlang
] );?>
</li>
<? endforeach;?>
</ol>
<? endif;?>

View File

@@ -0,0 +1,23 @@
<? if ( is_array( $this -> categories ) ):?>
<ol>
<? foreach ( $this -> categories as $category ):?>
<li id="list_<?= $category['id'];?>" class="list_<?= $category['id'];?>" category="<?= $category['id'];?>">
<div class="context_0 content content_menu">
<span class="disclose"><span></span></span>
<? if ( !$category['status'] ) echo '<i class="fa fa-ban fa-lg text-danger" title="Kategoria nieaktywna"></i>';?>
<b><?= $category['languages'][$this -> dlang]['title'];?></b>
<div class="btn-group ml20 pull-right">
<a href="#" title="Wybierz kategorię" class="btn btn-sm btn-system button category-select" category-title="<?= $category['languages'][$this -> dlang]['title'];?>" category-id="<?= $category['id'];?>">
<i class="fa fa-check"></i> <span class="hidden-xs">wybierz</span>
</a>
</div>
</div>
<?= \Tpl::view( 'shop-category/subcategory-browse-list', [
'categories' => \admin\factory\ShopCategory::subcategories( $category['id'] ),
'level' => $this -> level + 1,
'dlang' => $this -> dlang
] );?>
</li>
<? endforeach;?>
</ol>
<? endif;?>

View File

@@ -0,0 +1,48 @@
<div class="site-title"><?php echo $this->name . ' ' . $this->surname; ?></div>
<div class="site-subtitle">Łączne zakupy w wysokości: <?php echo $this->total_spent; ?> zł</div>
<br/>
<?
global $gdb;
$grid = new \grid( 'pp_shop_orders' );
$grid -> gdb_opt = $gdb;
$grid->src = $this->orders_info;
$grid -> debug = true;
$grid -> order = [ 'column' => 'date_order', 'type' => 'DESC' ];
$grid -> search = [];
$grid -> columns_view = [
[
'name' => 'Lp.',
'th' => [ 'class' => 'g-lp' ],
'td' => [ 'class' => 'g-center' ],
'autoincrement' => true
], [
'name' => 'Data zamówienia',
'db' => 'date_order',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 175px;' ],
], [
'name' => 'Wartość',
'db' => 'summary',
'td' => [ 'class' => 'g-right' ],
'th' => [ 'class' => 'g-right', 'style' => 'width: 150px;' ],
'php' => 'echo number_format( "[summary]", 2, ".", " " ) . " zł";',
], [
'name' => 'Typ płatności',
'db' => 'payment_method',
'th' => [ 'style' => 'width: 350px;' ],
], [
'name' => 'Rodzaj transportu',
'db' => 'transport',
'th' => [ 'style' => 'width: 350px;' ],
], [
'name' => 'Wiadomość',
'db' => 'message',
],
];
echo $grid -> draw();
?>

View File

@@ -0,0 +1,84 @@
<div class="site-title">Lista klientów</div>
<?php
global $gdb;
$grid = new \grid( '__shop_clients' );
$grid -> gdb_opt = $gdb;
$grid->sql = "
SELECT
MAX( client_id ) AS client_id, client_name, client_surname, client_email, MAX( client_phone ) AS client_phone, MAX( client_city ) AS client_city, COUNT(*) AS total_orders, SUM(summary) AS total_spent,
CASE
WHEN MAX(client_id) IS NOT NULL
THEN 'Zarejestrowany'
ELSE
'Gość'
END AS client_type
FROM pp_shop_orders
WHERE client_name IS NOT NULL AND client_surname IS NOT NULL AND client_email IS NOT NULL
GROUP BY client_name, client_surname, client_email
ORDER BY
CASE
WHEN MAX(client_id) IS NOT NULL THEN 1
ELSE 2
END,
client_name ASC";
$grid -> sql_count = "
SELECT COUNT(*)
FROM ( SELECT client_name, client_surname, client_email
FROM pp_shop_orders
WHERE client_name IS NOT NULL AND client_surname IS NOT NULL AND client_email IS NOT NULL
GROUP BY client_name, client_surname, client_email
) AS unique_clients";
$grid -> order = [ 'column' => 'date_order', 'type' => 'DESC' ];
$grid -> search = [];
$grid -> columns_view = [
[
'name' => 'Lp.',
'th' => [ 'class' => 'g-lp' ],
'td' => [ 'class' => 'g-center' ],
'autoincrement' => true
], [
'name' => 'Typ klienta',
'db' => 'client_type',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 100px;' ],
], [
'name' => 'Nazwisko, imię',
'th' => [ 'style' => 'width: 225px;' ],
'php' => 'echo "[client_surname]" . " " . "[client_name]";',
], [
'name' => 'Email',
'db' => 'client_email',
'th' => [ 'style' => 'width: 150px;' ],
],
[
'name' => 'Telefon',
'db' => 'client_phone',
'th' => [ 'style' => 'width: 150px;' ],
], [
'name' => 'Miasto',
'db' => 'client_city',
'th' => [ 'style' => 'width: 150px;' ],
], [
'name' => 'Wartość zamówień',
'db' => 'total_spent',
'td' => [ 'class' => 'g-right' ],
'th' => [ 'class' => 'g-right', 'style' => 'width: 150px;' ],
'php' => 'echo number_format( "[total_spent]", 2, ".", " " ) . " zł";',
], [
'name' => 'Ilosc zamówień',
'db' => 'total_orders',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
'php' => 'echo "<a href=\'/admin/shop_clients/clients_details/?name=[client_name]&surname=[client_surname]&email=[client_email]&total_spent=[total_spent]\'>[total_orders]</a>";'
], [
'name' => 'Akcje',
'th' => [ 'class' => 'g-center', 'style' => 'width: 100px;' ],
'td' => [ 'class' => 'g-center' ],
'php' => 'echo "<a href=\'/admin/shop_clients/clients_details/?name=[client_name]&surname=[client_surname]&email=[client_email]&total_spent=[total_spent]\'>zobacz zamówienia</a>";',
]
];
echo $grid -> draw();

View File

@@ -0,0 +1,151 @@
<script type="text/javascript" src="/libraries/framework/vendor/plugins/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/libraries/framework/vendor/plugins/ckeditor/adapters/jquery.js"></script>
<script type="text/javascript" src="/libraries/jquery/sortable/sortable.js"></script>
<?
global $db;
ob_start();
?>
<div id="settings-tabs">
<ul class="resp-tabs-list settings-tabs">
<li><i class="fa fa-wrench"></i>Ustawienia</li>
</ul>
<div class="resp-tabs-container settings-tabs">
<div>
<?= \Html::input([
'label' => 'Nazwa',
'name' => 'name',
'id' => 'name',
'value' => $this -> coupon['name']
]); ?>
<?= \Html::input_switch([
'label' => 'Wysłany',
'name' => 'send',
'checked' => $this -> coupon['send'] == 1 ? true : false
]); ?>
<?= \Html::input_switch([
'label' => 'Aktywny',
'name' => 'status',
'checked' => $this -> coupon['status'] == 1 ? true : false
]); ?>
<?= \Html::input_switch( [
'label' => 'Użyty',
'name' => 'used',
'checked' => $this -> coupon['used'] == 1 ? true : false,
]); ?>
<?= \Html::select([
'label' => 'Typ kuponu',
'name' => 'type',
'values' => [ 1 => 'Rabat procentowy na koszyk'],
'value' => $this -> coupo['type'],
]); ?>
<?= \Html::input([
'label' => 'Wartość',
'class' => 'number-format',
'name' => 'amount',
'id' => 'amount',
'value' => $this -> coupon['amount']
]); ?>
<?= \Html::input_switch([
'label' => 'Kupon jednorazowy',
'name' => 'one_time',
'checked' => $this -> coupon['one_time'] == 1 ? true : false
]); ?>
<?= \Html::input_switch([
'label' => 'Dotyczy również produktów przecenionych',
'name' => 'include_discounted_product',
'checked' => $this -> coupon['include_discounted_product'] == 1 ? true : false,
]); ?>
<div class="form-group row">
<label class="col-lg-4 control-label">Ogranicz promocję do wybranych kategorii:</label>
<div class="col-lg-8">
<div class="menu_sortable">
<ol class="sortable" id="sortable">
<?
if ( is_array( $this -> categories ) )
{
foreach ( $this -> categories as $category )
{
?>
<li id="list_<?= $category[ 'id' ];?>" class="category_<?= $category[ 'id' ];?>" category="<?= $category[ 'id' ];?>">
<div class="context_0 content content_menu">
<span class="disclose"><span></span></span>
<? if ( !$category[ 'status' ] ) echo '<i class="fa fa-ban fa-lg text-danger" title="Kategoria nieaktywna"></i>';?>
<input type="checkbox" class="g-checkbox" name="categories[]" value="<?= $category[ 'id' ];?>" <? if ( is_array( json_decode( $this -> coupon['categories'] ) ) and in_array( $category[ 'id' ], json_decode( $this -> coupon['categories'] ) ) ):?>checked="checked"<? endif;?> />
<b><?= $category[ 'languages' ][ $this -> dlang ][ 'title' ];?></b>
</div>
<?=
\Tpl::view( 'shop-product/subcategories-list', [
'categories' => \admin\factory\ShopCategory::subcategories( $category[ 'id' ] ),
'product_categories' => json_decode( $this -> coupon['categories'] ),
'dlang' => $this -> dlang
] );
?>
</li>
<?
}
}
?>
</ol>
</div>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid->id = 'coupon-edit';
$grid->gdb_opt = $gdb;
$grid->include_plugins = true;
$grid->title = $this -> coupon['id'] ? 'Edycja kuponu: <u>' . $this -> coupon['name'] . '</u>' : 'Nowy kupon';
$grid->fields = [
[
'db' => 'id',
'type' => 'hidden',
'value' => $this -> coupon['id']
]
];
$grid->actions = [
'save' => ['url' => '/admin/shop_coupon/coupon_save/', 'back_url' => '/admin/shop_coupon/view_list/'],
'cancel' => ['url' => '/admin/shop_coupon/view_list/']
];
$grid->external_code = $out;
$grid->persist_edit = true;
$grid->id_param = 'id';
echo $grid->draw();
?>
<link type="text/css" rel="stylesheet" href="/libraries/plupload/jquery.plupload.queue/css/jquery.plupload.queue.css">
<link type="text/css" rel="stylesheet" href="/libraries/selectize/css/selectize.css">
<link type="text/css" rel="stylesheet" href="/libraries/selectize/css/selectize.default.css">
<script type="text/javascript" src="/libraries/plupload/plupload.js"></script>
<script type="text/javascript" src="/libraries/plupload/plupload.flash.js"></script>
<script type="text/javascript" src="/libraries/plupload/plupload.html5.js"></script>
<script type="text/javascript" src="/libraries/plupload/plupload.html4.js"></script>
<script type="text/javascript" src="/libraries/plupload/jquery.plupload.queue/jquery.plupload.queue.js"></script>
<script type="text/javascript" src="/libraries/plupload/i18n/pl.js"></script>
<script type="text/javascript" src="/libraries/jquery-nested-sortable/jquery.mjs.nestedSortable.js"></script>
<script type="text/javascript" src="/libraries/jquery/lozad.js"></script>
<script type="text/javascript" src="/libraries/selectize/js/standalone/selectize.js"></script>
<script type="text/javascript">
$(function() {
const observer = lozad();
observer.observe();
disable_menu();
$('#settings-tabs').easyResponsiveTabs({
width: 'auto',
fit: true,
tabidentify: 'settings-tabs',
type: 'vertical'
});
});
</script>

View File

@@ -0,0 +1,83 @@
<?php
global $gdb;
$grid = new \grid( 'pp_shop_coupon' );
$grid -> gdb_opt = $gdb;
$grid -> debug = true;
$grid -> order = [ 'column' => 'name', 'type' => 'ASC' ];
$grid -> search = [
[ 'name' => 'Nazwa', 'db' => 'name', 'type' => 'text' ],
[ 'name' => 'Aktywny', 'db' => 'status', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ],
[ 'name' => 'Użyty', 'db' => 'used', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ],
[ 'name' => 'Wysłany', 'db' => 'send', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ]
];
$grid -> columns_view = [
[
'name' => 'Lp.',
'th' => [ 'class' => 'g-lp' ],
'td' => [ 'class' => 'g-center' ],
'autoincrement' => true
], [
'name' => 'Aktywny',
'db' => 'status',
'replace' => [ 'array' => [ 0 => '<span style="color: #FF0000;">nie</span>', 1 => 'tak' ] ],
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
'sort' => true
], [
'name' => 'Nazwa',
'db' => 'name',
'sort' => true,
'php' => 'echo "<a href=\'/admin/shop_coupon/coupon_edit/id=[id]\'>[name]</a>";'
], [
'name' => 'Typ kuponu',
'db' => 'type',
'replace' => [ 'array' => [ 1 => 'Rabat procentowy na koszyk' ] ]
], [
'name' => 'Wartość',
'db' => 'amount',
'php' => 'if ( [type] == 1 ) echo "[amount]%";'
], [
'name' => 'Kupon jednorazowy',
'db' => 'one_time',
'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ],
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ]
], [
'name' => 'Wysłany',
'db' => 'send',
'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ],
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ]
], [
'name' => 'Użyty',
'db' => 'used',
'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ],
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ]
], [
'name' => 'Data użycia',
'db' => 'date_used',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ]
], [
'name' => 'Edytuj',
'action' => [ 'type' => 'edit', 'url' => '/admin/shop_coupon/coupon_edit/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
], [
'name' => 'Usuń',
'action' => [ 'type' => 'delete', 'url' => '/admin/shop_coupon/coupon_delete/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
]
];
$grid -> buttons = [
[
'label' => 'Dodaj kupon',
'url' => '/admin/shop_coupon/coupon_edit/',
'icon' => 'fa-plus-circle',
'class' => 'btn-success'
]
];
echo $grid -> draw();

View File

@@ -0,0 +1,553 @@
<?
global $db;
ob_start();
?>
<div class="details order-details">
<div class="row">
<div class="col-lg-8">
<div class="row">
<div class="col-sm-6 col-xl-5">
<div class="text-big">Numer zamówienia: <b id="order-number"><?= $this -> order[ 'number' ];?></b> <i class="fa fa-copy" onclick="copyToClipboard( 'order-number' ); return false;"></i></div>
<div>Data zamówienia <b><?= $this -> order[ 'date_order' ];?></b></div>
<br>
<div class="text-big">Dane osoby kupującej:</div>
<div><b id="order-user-name"><?= $this -> order[ 'client_name' ];?> <?= $this -> order[ 'client_surname' ];?></b> <i class="fa fa-copy" onclick="copyToClipboard( 'order-user-name' ); return false;"></i></div>
<? if ( $this -> order[ 'client_firm' ] ):?>
<div><b><?= $this -> order[ 'client_firm' ];?></b></div>
<? endif;?>
<? if ( $this -> order[ 'client_street' ] ):?>
<div><b id="order-street"><?= $this -> order[ 'client_street' ];?></b> <i class="fa fa-copy" onclick="copyToClipboard( 'order-street' ); return false;"></i></div>
<? endif;?>
<div>
<? if ( $this -> order[ 'client_postal_code' ] ):?>
<b id="order-postal-code"><?= $this -> order[ 'client_postal_code' ];?></b> <i class="fa fa-copy" onclick="copyToClipboard( 'order-postal-code' ); return false;"></i>
<? endif;?>
<? if ( $this -> order[ 'client_city' ] ):?>
<b id="order-city"><?= $this -> order[ 'client_city' ];?></b> <i class="fa fa-copy" onclick="copyToClipboard( 'order-city' ); return false;"></i>
<? endif;?>
</div>
<div><b><a href="mailto:<?= $this -> order[ 'client_email' ];?>" id="order-user-email"><?= $this -> order[ 'client_email' ];?></a></b> <i class="fa fa-copy" onclick="copyToClipboard( 'order-user-email' ); return false;"></i></div>
<div><b><a href="tel:<?= $this -> order[ 'client_phone' ];?>" id="order-user-phone"><?= $this -> order[ 'client_phone' ];?></a></b> <i class="fa fa-copy" onclick="copyToClipboard( 'order-user-phone' ); return false;"></i></div>
<div class="resend_order_confirmation_email">
<button class="btn btn-primary">wyślij ponownie mail z potwierdzeniem zamówienia</button>
</div>
</div>
<div class="col-sm-6 col-xl-7">
<div class="panel">
<div class="panel-body">
<div>Kwota zamówienia <b><?= $this -> order[ 'summary' ];?> zł</b></div>
<br>
<div><?= strip_tags( $this -> order[ 'transport' ] );?>: <b><?= $this -> order[ 'transport_cost' ];?> zł</b></div>
<? if ( $this -> order['transport_id'] == 2 and $this -> order[ 'inpost_paczkomat' ] ):?>
<? $paczkomat = explode( '|', $this -> order[ 'inpost_paczkomat' ] );?>
<div>Paczkomat: <b id="order-paczkomat"><?= $paczkomat[0];?></b> | <?= $paczkomat[1];?> <i class="fa fa-copy" onclick="copyToClipboard( 'order-paczkomat' ); return false;"></i></div>
<? endif;?>
<br/>
<div>
<b><?= $this -> order[ 'payment_method' ];?> </b>
</div>
</div>
</div>
<div class="paid-status panel">
<div class="panel-body">
<? if ( $this -> order['paid'] ):?>
<a href="/admin/shop_order/set_order_as_unpaid/order_id=<?= $this -> order['id'];?>" class="set_order_as_unpaid">
<span><i class="fa fa-dollar"></i></span>
<b>Oznacz zamówienie jako nieopłacone</b>
</a>
<? else:?>
<a href="/admin/shop_order/set_order_as_paid/order_id=<?= $this -> order['id'];?>" class="set_order_as_paid">
<span class="danger"><i class="fa fa-dollar"></i></span>
<b>Oznacz zamówienie jako opłacone</b>
</a>
<? endif;?>
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-6 col-lg-4">
<div class="order-status text-big">
<?= $this -> order_statuses[ $this -> order[ 'status' ] ];?>
</div>
<div class="form-group status_select">
<select class="form-control" id="order-status">
<? foreach ( $this -> order_statuses as $key => $val ):?>
<option value="<?= $key;?>" <? if ( $key == $this -> order[ 'status' ] ):?>selected="selected"<? endif;?>>
<?= $val;?>
</option>
<? endforeach;?>
</select>
</div>
<div class="row">
<div class="col-12 buttons">
<button class="btn btn-primary order_status_change_email">zmień status i wyślij email</button>
<button class="btn btn-success order_status_change">zmień status</button>
</div>
<div class="col-12 order-history">
<? if ( \S::is_array_fix( $this -> order['statuses'] ) ): foreach ( $this -> order['statuses'] as $status ):?>
<div><b><?= date( 'Y-m-d H:i', strtotime( $status['date'] ) );?></b>: <?= $this -> order_statuses[$status['status_id']];?> <? if ( $status['mail'] ):?><i class="fa fa-envelope-o"></i><? endif;?></div>
<? endforeach; endif;?>
</div>
</div>
</div>
<div class="d-none d-lg-block col-lg-4">
</div>
<div class="d-none d-lg-block col-lg-4">
</div>
<div class="col-sm-6 col-lg-4">
<div class="text-big">Wiadomość do zamówienia:</div>
<div> <b> <?= $this -> order[ 'message' ];?> </b></div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Zdjęcie</th>
<th scope="col">Nazwa</th>
<th scope="col" class="tab-center">Ilość</th>
<th scope="col" class="tab-right">Cena / szt:</th>
<th scope="col" class="tab-right">Cena / szt (po rabacie):</th>
<th scope="col" class="tab-right">Suma (po rabacie):</th>
</tr>
</thead>
<tbody>
<? if ( is_array( $this -> order[ 'products' ] ) ): foreach ( $this -> order[ 'products' ] as $product ):?>
<?
if ( $id = \admin\factory\ShopProduct::get_product_parent_id( $product['product_id'] ) )
$product_id = $id;
else
$product_id = $product['product_id'];
?>
<tr class="order-product-details">
<td class="product-image">
<? if ( $product['product_id'] ):?>
<img src="<?= \shop\Product::getProductImg( (int)$product_id );?>">
<? endif;?>
</td>
<td>
<a href="<?= \shop\Product::getProductUrl( (int)$product_id );?>" target="_blank"><?= $product[ 'name' ];?></a>
<br />
<div class="atributes">
<?= $product[ 'attributes' ];?>
</div>
<div class="custom-fields">
<?= $product[ 'custom_fields' ];?>
</div>
<div class="product-message">
<?= $product[ 'message' ] != '' ? '<strong>Wiadomość:</strong> ' . $product['message'] : '';?>
</div>
</td>
<td class="tab-center"><?= $product[ 'quantity' ];?></td>
<td class="tab-right"><?= \S::decimal( $product[ 'price_brutto' ] );?> zł</td>
<td class="tab-right"><?= \S::decimal( $product[ 'price_brutto_promo' ] );?> zł</td>
<td class="tab-right"><?= \S::decimal( $product[ 'price_brutto_promo' ] * $product[ 'quantity' ] );?> zł</td>
</tr>
<? endforeach; endif;?>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<form>
<div class="form-group">
<label for="notes">Notatki</label>
<textarea class="form-control" id="notes" rows="10"><?= $this -> order['notes'];?></textarea>
</div>
</form>
</div>
</div>
</div>
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'order-details';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Szczegóły zamówienia: ' . $this -> order[ 'number' ];
$grid -> buttons = [
[
'label' => 'Wstecz',
'url' => '/admin/shop_order/view_list/',
'icon' => 'fa-reply',
'class' => 'btn btn-dark btn-sm mr5'
], [
'label' => 'Edytuj zamówienie',
'url' => '/admin/shop_order/order_edit/order_id=' . $this -> order['id'],
'icon' => 'fa-pencil',
'class' => 'btn btn-danger btn-sm mr5 ml5'
]
];
if ( $this -> prev_order_id )
{
$grid -> buttons[] = [
'label' => 'Poprzednie zamówienie',
'url' => '/admin/shop_order/order_details/order_id=' . $this -> prev_order_id,
'icon' => 'fa-arrow-left',
'class' => 'btn btn-success btn-sm mr5 ml5'
];
}
if ( $this -> next_order_id )
{
$grid -> buttons[] = [
'label' => 'Następne zamówienie',
'url' => '/admin/shop_order/order_details/order_id=' . $this -> next_order_id,
'icon' => 'fa-arrow-right',
'class' => 'btn btn-success btn-sm mr5 ml5'
];
}
$grid -> default_buttons = false;
$grid -> external_code = $out;
echo $grid -> draw();
?>
<script type="text/javascript">
$( function()
{
var timer = '';
$( '#notes' ).keyup( function()
{
var _this = $( this);
clearTimeout( timer );
timer = setTimeout( function()
{
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/shop_order/notes_save/',
data:
{
order_id: <?= $this -> order['id'];?>,
notes: _this.val()
},
beforeSend: function()
{
},
success: function( response )
{
var time = 0;
}
});
}, 500 );
});
});
// set_order_as_unpaid
$( 'body' ).on( 'click', '.set_order_as_unpaid', function(e) {
var href = $( this ).attr( 'href' );
$.alert({
title: 'Pytanie',
content: 'Zmienić zamówienie na nieopłacone?',
type: 'orange',
closeIcon: true,
closeIconClass: 'fa fa-times',
typeAnimated: true,
animation: 'opacity',
columnClass: 'col-12 col-lg-10',
theme: 'modern',
icon: 'fa fa-question',
buttons: {
confirm: {
text: 'Tak',
btnClass: 'btn-success',
keys: ['enter'],
action: function() {
document.location.href = href;
}
},
cancel: {
text: 'Nie',
btnClass: 'btn-dark',
action: function() {}
}
}
});
return false;
});
// set_order_as_paid
$( 'body' ).on( 'click', '.set_order_as_paid', function(e) {
var href = $( this ).attr( 'href' );
$.alert({
title: 'Pytanie',
content: 'Zmienić zamówienie na opłacone?',
type: 'orange',
closeIcon: true,
closeIconClass: 'fa fa-times',
typeAnimated: true,
animation: 'opacity',
columnClass: 'col-12 col-lg-10',
theme: 'modern',
icon: 'fa fa-question',
buttons: {
confirm: {
text: 'Tak',
btnClass: 'btn-success',
keys: ['enter'],
action: function() {
document.location.href = href;
}
},
confirm2: {
text: 'Tak (wyślij mail)',
btnClass: 'btn-primary',
keys: ['enter'],
action: function() {
document.location.href = href + '&send_mail=1';
}
},
cancel: {
text: 'Nie',
btnClass: 'btn-dark',
action: function() {}
}
}
});
return false;
});
$('body').on('click', '.order_status_change_email', function() {
$.alert({
title: 'Pytanie',
content: 'Na pewno chcesz wysłać mail o zmianie statusu?',
type: 'orange',
closeIcon: true,
closeIconClass: 'fa fa-times',
typeAnimated: true,
animation: 'opacity',
columnClass: 'col-12 col-lg-10',
theme: 'modern',
icon: 'fa fa-question',
buttons: {
confirm: {
text: 'Tak',
btnClass: 'btn-success',
keys: ['enter'],
action: function() {
order_status_change(<?= $this -> order[ 'id' ];?>, $('#order-status').val(), true);
}
},
cancel: {
text: 'Nie',
btnClass: 'btn-dark',
action: function() {}
}
}
});
return false;
});
$( 'body' ).on( 'click', '.resend_order_confirmation_email button', function() {
$.alert({
title: 'Pytanie',
content: 'Na pewno chcesz wysłać mail o złożonym zamówieniu?',
type: 'orange',
closeIcon: true,
closeIconClass: 'fa fa-times',
typeAnimated: true,
animation: 'opacity',
columnClass: 'col-12 col-lg-10',
theme: 'modern',
icon: 'fa fa-question',
buttons: {
confirm: {
text: 'Tak',
btnClass: 'btn-success',
keys: ['enter'],
action: function()
{
$.ajax({
type: 'POST',
cache: false,
url: '/admin/shop_order/order_resend_confirmation_email/',
data: {
order_id: <?= $this -> order['id'];?>
},
beforeSend: function()
{
$( '#overlay' ).show();
},
success: function(response)
{
$( '#overlay' ).hide();
data = jQuery.parseJSON(response);
if ( data.result === true )
{
return $.alert({
title: 'Informacja',
content: 'Wiadomość została wysłana',
type: 'orange',
closeIcon: true,
closeIconClass: 'fa fa-close',
typeAnimated: true,
animation: 'opacity',
autoClose: 'confirm|10000',
columnClass: 'col-12 col-lg-10',
theme: 'modern',
icon: 'fa fa-info',
buttons: {
confirm: {
text: 'Zamknij',
btnClass: 'btn-success',
keys: ['enter'],
action: function() {
location.reload();
}
}
}
});
}
if ( data.result === false)
{
return $.alert({
title: 'Błąd',
content: 'Podczas wysyłania wiadomości wystąpił błąd',
type: 'orange',
closeIcon: true,
closeIconClass: 'fa fa-close',
typeAnimated: true,
animation: 'opacity',
columnClass: 'col-12 col-lg-10',
theme: 'modern',
icon: 'fa fa-exclamation',
buttons: {
confirm: {
text: 'Zamknij',
btnClass: 'btn-danger',
keys: ['enter'],
action: function() {
location.reload();
}
}
}
});
}
}
});
}
},
cancel: {
text: 'Nie',
btnClass: 'btn-dark',
action: function() {}
}
}
});
return false;
});
$('body').on('click', '.order_status_change', function() {
order_status_change(<?= $this -> order[ 'id' ];?>, $('#order-status').val(), false);
return false;
});
function order_status_change($order_id, $status, $email) {
$.ajax({
type: 'POST',
cache: false,
url: '/admin/shop_order/order_status_change/',
data: {
order_id: $order_id,
status: $status,
email: $email
},
beforeSend: function() {
$('#overlay').show();
},
success: function(response) {
$('#overlay').hide();
data = jQuery.parseJSON(response);
if (data.email === true) {
return $.alert({
title: 'Informacja',
content: 'Wiadomość o zmiane statusu została wysłana',
type: 'orange',
closeIcon: true,
closeIconClass: 'fa fa-close',
typeAnimated: true,
animation: 'opacity',
autoClose: 'confirm|10000',
columnClass: 'col-12 col-lg-10',
theme: 'modern',
icon: 'fa fa-info',
buttons: {
confirm: {
text: 'Zamknij',
btnClass: 'btn-success',
keys: ['enter'],
action: function() {
location.reload();
}
}
}
});
}
if (data.email === false) {
return $.alert({
title: 'Błąd',
content: 'Podczas wysyłania wiadomości wystąpił błąd',
type: 'orange',
closeIcon: true,
closeIconClass: 'fa fa-close',
typeAnimated: true,
animation: 'opacity',
columnClass: 'col-12 col-lg-10',
theme: 'modern',
icon: 'fa fa-exclamation',
buttons: {
confirm: {
text: 'Zamknij',
btnClass: 'btn-danger',
keys: ['enter'],
action: function() {
location.reload();
}
}
}
});
}
if (data.result == true) {
return $.alert({
title: 'Informacja',
content: 'Status zamówienia został zmieniony',
type: 'orange',
closeIcon: true,
closeIconClass: 'fa fa-close',
typeAnimated: true,
animation: 'opacity',
autoClose: 'confirm|10000',
columnClass: 'col-12 col-lg-10',
theme: 'modern',
icon: 'fa fa-info',
buttons: {
confirm: {
text: 'Zamknij',
btnClass: 'btn-success',
keys: ['enter'],
action: function() {
location.reload();
}
}
}
});
}
}
});
}
</script>

View File

@@ -0,0 +1,248 @@
<?
global $db;
ob_start();
?>
<input type="hidden" name="order_id" value="<?= $this -> order['id'];?>">
<div class="details">
<div class="row">
<div class="col-xl-8">
<div class="row">
<div class="col-md-6">
<div class="text-big">Numer zamówienia: <b id="order-number"><?= $this -> order[ 'number' ];?></b> <i class="fa fa-copy" onclick="copyToClipboard( 'order-number' ); return false;"></i></div>
<div>Data zamówienia <b><?= $this -> order[ 'date_order' ];?></b></div>
<br>
<div class="text-big">Dane osoby kupującej:</div>
<div class="row">
<div class="col-sm-6">
<input type="text" class="form-control" name="client_name" value="<?= $this -> order[ 'client_name' ];?>" placeholder="Imię">
</div>
<div class="col-sm-6">
<input type="text" class="form-control" name="client_surname" value="<?= $this -> order[ 'client_surname' ];?>" placeholder="Nazwisko">
</div>
</div>
<div class="row">
<div class="col-12">
<input type="text" class="form-control" name="client_firm" value="<?= $this -> order[ 'client_firm' ];?>" placeholder="Firma">
</div>
</div>
<div class="row">
<div class="col-12">
<input type="text" class="form-control" name="client_street" value="<?= $this -> order[ 'client_street' ];?>" placeholder="Ulica">
</div>
</div>
<div class="row">
<div class="col-sm-6">
<input type="text" class="form-control" name="client_postal_code" value="<?= $this -> order[ 'client_postal_code' ];?>" placeholder="Kod pocztowy">
</div>
<div class="col-sm-6">
<input type="text" class="form-control" name="client_city" value="<?= $this -> order[ 'client_city' ];?>" placeholder="Miasto">
</div>
</div>
<div class="row">
<div class="col-12">
<input type="text" class="form-control" name="client_email" value="<?= $this -> order[ 'client_email' ];?>" placeholder="Email">
</div>
</div>
<div class="row">
<div class="col-12">
<input type="text" class="form-control" name="client_phone" value="<?= $this -> order[ 'client_phone' ];?>" placeholder="Telefon">
</div>
</div>
</div>
<div class="col-md-6">
<div>Kwota zamówienia <b><?= $this -> order[ 'summary' ];?> zł</b></div>
<br>
<div class="row">
<div class="col-12">
<select name="transport_id" class="form-control" id="transport_id">
<option value="0">--- wybierz formę transportu ---</option>
<? if ( \S::is_array_fix( $this -> transport ) ): foreach ( $this -> transport as $transport_tmp ):?>
<option value="<?= $transport_tmp['id'];?>" <? if ( $this -> order['transport_id'] == $transport_tmp['id'] ):?>selected="selected"<? endif;?>>
<?= $transport_tmp['name'];?> - <?= $transport_tmp['cost'];?> zł
</option>
<? endforeach; endif;?>
</select>
</div>
</div>
<div class="row row-flex">
<div class="col-12">
<div class="input-group">
<input type="text" class="form-control" name="inpost_paczkomat" id="inpost_paczkomat" value="<?= $this -> order[ 'inpost_paczkomat' ];?>" placeholder="Paczkomat">
<span class="input-group-addon btn btn-danger btn-paczkomat">
<i class="fa fa-folder"></i>
</span>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<select name="payment_method_id" class="form-control" id="payment_method_id">
<option value="0">--- wybierz formę płatności ---</option>
<? if ( \S::is_array_fix( $this -> payment_methods ) ): foreach ( $this -> payment_methods as $payment_method ):?>
<option value="<?= $payment_method['id'];?>" <? if ( $this -> order['payment_method_id'] == $payment_method['id'] ):?>selected="selected"<? endif;?>>
<?= $payment_method['name'];?>
</option>
<? endforeach; endif;?>
</select>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-4">
<div class="order-status text-big">
<?= $this -> order_statuses[ $this -> order[ 'status' ] ];?>
</div>
<div class="form-group status_select">
<select class="form-control" id="order-status">
<? foreach ( $this -> order_statuses as $key => $val ):?>
<option value="<?= $key;?>" <? if ( $key==$this -> order[ 'status' ] ):?>selected="selected"
<? endif;?>><?= $val;?>
</option>
<? endforeach;?>
</select>
</div>
<div class="row">
<div class="col-12 buttons">
<button class="btn btn-primary order_status_change_email">zmień status i wyślij email</button>
<button class="btn btn-success order_status_change">zmień status</button>
</div>
<div class="col-12 order-history">
<? if ( \S::is_array_fix( $this -> order['statuses'] ) ): foreach ( $this -> order['statuses'] as $status ):?>
<div><b><?= date( 'Y-m-d H:i', strtotime( $status['date'] ) );?></b>: <?= $this -> order_statuses[$status['status_id']];?></div>
<? endforeach; endif;?>
</div>
</div>
</div>
<div class="col-md-4">
</div>
<div class="col-md-4">
</div>
<div class="col-md-4">
<div class="text-big">Wiadomość do zamówienia:</div>
<div> <b> <?= $this -> order[ 'message' ];?> </b></div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Zdjęcie</th>
<th scope="col">Nazwa</th>
<th scope="col" class="tab-center">Ilość</th>
<th scope="col" class="tab-right">Cena / szt:</th>
<th scope="col" class="tab-right">Cena / szt (po rabacie):</th>
<th scope="col" class="tab-right">Suma (po rabacie):</th>
</tr>
</thead>
<tbody>
<? if ( is_array( $this -> order[ 'products' ] ) ): foreach ( $this -> order[ 'products' ] as $product ):?>
<tr class="order-product-details">
<td class="product-image">
<? if ( $product['product_id'] ):?>
<img src="<?= \shop\Product::getProductImg( (int)$product['product_id'] );?>">
<? endif;?>
</td>
<td>
<a href="<?= \shop\Product::getProductUrl( (int)$product['product_id'] );?>" target="_blank"><?= $product[ 'name' ];?></a>
<br />
<div class="atributes">
<?= $product[ 'attributes' ];?>
</div>
<br />
<div class="product-message">
<?= $product[ 'message' ] != '' ? '<strong>Wiadomość:</strong> ' . $product['message'] : '';?>
</div>
</td>
<td class="tab-center"><?= $product[ 'quantity' ];?></td>
<td class="tab-right"><?= $product[ 'price_brutto' ];?> zł</td>
<td class="tab-right"><?= $product[ 'price_brutto_promo' ];?> zł</td>
<td class="tab-right"><?= $product[ 'price_brutto_promo' ] * $product[ 'quantity' ];?> zł</td>
</tr>
<? endforeach; endif;?>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<form>
<div class="form-group">
<label for="note">Notatki</label>
<textarea class="form-control" id="note" rows="10"></textarea>
</div>
</form>
</div>
</div>
</div>
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'order-details';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Szczegóły zamówienia: ' . $this -> order[ 'number' ];
$grid -> buttons = [
[
'label' => 'Zapisz zamówienie',
'icon' => 'fa-save',
'class' => 'btn btn-success btn-sm mr5 ml5',
'id' => 'order-save'
],
[
'label' => 'Wstecz',
'url' => '/admin/shop_order/order_details/order_id=' . $this -> order['id'],
'icon' => 'fa-reply',
'class' => 'btn btn-dark btn-sm mr5'
]
];
$grid -> default_buttons = false;
$grid -> external_code = $out;
echo $grid -> draw();
?>
<div class="inpost-map-container">
<a href="#" onclick="$( '.inpost-map-container' ).hide(); return false;" class="inpost-hide"><?= \S::lang( 'zamknij' );?></a>
<div id="inpost-map"></div>
</div>
<link class="footer" rel="stylesheet" type="text/css" href="https://geowidget.easypack24.net/css/easypack.css">
<script class="footer" type="text/javascript" src="https://geowidget.easypack24.net/js/sdk-for-javascript.js"></script>
<script type="text/javascript">
$( function()
{
$( 'body' ).on( 'change', '#transport_id', function()
{
if ( $( this ).val() != '2' )
$( '#inpost_paczkomat' ).closest( '.row' ).hide();
else
$( '#inpost_paczkomat' ).closest( '.row' ).show();
});
$( 'body' ).on( 'click', '.btn-paczkomat', function()
{
window.easyPackAsyncInit = function () {
easyPack.init({
mapType: 'osm',
searchType: 'osm',
});
var map = easyPack.mapWidget( 'inpost-map', function(point)
{
$( '#inpost_paczkomat' ).val( point.name + ' | ' + point.address.line1 + ', ' + point.address.line2 );
$( '.inpost-map-container' ).hide();
});
};
$( '.inpost-map-container' ).show();
});
$( 'body' ).on( 'click', '#order-save', function(e)
{
e.preventDefault();
$( '#fg-order-details' ).attr( 'method', 'POST' ).attr( 'action', '/admin/shop_order/order_save/' ).submit();
});
});
</script>

View File

@@ -0,0 +1,147 @@
<?php
global $gdb;
$grid = new \grid( 'pp_shop_order' );
$grid -> gdb_opt = $gdb;
$grid->sql = '
SELECT
q1.*,
shop_order.total_orders
FROM (
SELECT
id,
number,
date_order,
CONCAT(client_name, \' \', client_surname) AS client,
client_email,
CONCAT(client_street, \', \', client_postal_code, \' \', client_city) AS address,
status,
client_phone,
transport,
payment_method,
summary,
paid
FROM
pp_shop_orders AS pso
) AS q1
LEFT JOIN (
SELECT
client_email,
COUNT(*) AS total_orders
FROM
pp_shop_orders
WHERE
client_name IS NOT NULL AND client_surname IS NOT NULL AND client_email IS NOT NULL
GROUP BY
client_email
) AS shop_order ON q1.client_email = shop_order.client_email
WHERE
1=1 [where]
ORDER BY
[order_p1] [order_p2]
';
$grid->sql_count = '
SELECT COUNT(0)
FROM (
SELECT
id,
number,
date_order,
CONCAT(client_name, \' \', client_surname) AS client,
client_email,
CONCAT(client_street, \', \', client_postal_code, \' \', client_city) AS address,
status,
client_phone,
transport,
payment_method,
summary,
paid
FROM
pp_shop_orders AS pso
) AS q1
WHERE
1=1 [where]
';
$grid -> debug = true;
$grid -> order = [ 'column' => 'date_order', 'type' => 'DESC' ];
$grid -> search = [
[ 'name' => 'Nr zamówienia', 'db' => 'number', 'type' => 'text' ],
[ 'name' => 'Data zamówienia', 'db' => 'date_order', 'type' => 'date_range' ],
[ 'name' => 'Status', 'db' => 'status', 'type' => 'select', 'replace' => [ 'array' => \shop\Order::order_statuses() ] ],
[ 'name' => 'Klient', 'db' => 'client', 'type' => 'text' ],
[ 'name' => 'Adres', 'db' => 'address', 'type' => 'text' ],
// [ 'name' => 'Email', 'db' => 'client_email', 'type' => 'text' ],
[ 'name' => 'Telefon', 'db' => 'client_phone', 'type' => 'text' ],
[ 'name' => 'Dostawa', 'db' => 'transport', 'type' => 'text' ],
[ 'name' => 'Płatność', 'db' => 'payment_method', 'type' => 'text' ]
];
$grid -> columns_view = [
[
'name' => 'Lp.',
'th' => [ 'class' => 'g-lp' ],
'td' => [ 'class' => 'g-center' ],
'autoincrement' => true
], [
'name' => 'Data dodania',
'db' => 'date_order',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
'php' => 'echo date( "Y-m-d H:i", strtotime( "[date_order]" ) );',
'sort' => true
], [
'name' => 'Nr zamówienia',
'db' => 'number',
'sort' => true,
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
'php' => 'echo "<a href=\'/admin/shop_order/order_details/order_id=[id]\'>" . htmlspecialchars( \'[number]\' ) . "</a>";'
], [
'name' => '',
'db' => 'paid',
'sort' => true,
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 25px;' ],
'php' => 'if ( [paid] === 1 ) echo "<i class=\'fa fa-check text-success\'></i>"; else echo "<i class=\'fa fa-times text-dark\'></i>";'
], [
'name' => 'Status',
'db' => 'status',
'sort' => true,
'th' => [ 'style' => 'width: 250px;' ],
'td' => [ 'class' => 'order-status' ],
'replace' => [ 'array' => \shop\Order::order_statuses() ]
], [
'name' => 'Wartość',
'db' => 'summary',
'sort' => true,
'td' => [ 'class' => 'g-right' ],
'th' => [ 'class' => 'g-right', 'style' => 'width: 90px;' ],
'php' => 'echo "[summary] zł"; echo "<script>$( \"tr#[id]\" ).addClass( \"status-[status]\" );</script>";'
], [
'name' => 'Klient',
'db' => 'client',
'php' => 'echo "[client] | zamówienia: <strong>[total_orders]</strong>";'
], [
'name' => 'Adres',
'db' => 'address',
], [
'name' => 'Email',
'db' => 'client_email',
], [
'name' => 'Telefon',
'db' => 'client_phone',
], [
'name' => 'Dostawa',
'db' => 'transport',
], [
'name' => 'Płatność',
'db' => 'payment_method',
], [
'name' => 'Usuń',
'action' => [ 'type' => 'delete', 'url' => '/admin/shop_order/order_delete/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
]
];
echo $grid -> draw();

View File

@@ -0,0 +1,79 @@
<?php
global $gdb;
foreach ( $this -> apilo_payment_types_list as $payment_type )
{
$payment_types[ $payment_type['id'] ] = $payment_type['name'];
}
// sellasist payment methods
$sellasist_payment_types_list = [];
foreach ( $this -> sellasist_payment_types_list as $sellasist_payment_type )
$sellasist_payment_types_list[ $sellasist_payment_type['id'] ] = $sellasist_payment_type['title'];
$grid = new \grid( 'pp_shop_payment_methods' );
$grid -> gdb_opt = $gdb;
$grid -> debug = true;
$grid -> order = [ 'column' => 'id', 'type' => 'ASC' ];
$grid -> search = [
[ 'name' => 'Nazwa', 'db' => 'name', 'type' => 'text' ],
[ 'name' => 'Aktywny', 'db' => 'status', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ]
];
$grid -> columns_view = [
[
'name' => 'Lp.',
'th' => [ 'class' => 'g-lp' ],
'td' => [ 'class' => 'g-center' ],
'autoincrement' => true
], [
'name' => 'Nazwa',
'db' => 'name'
], [
'name' => 'Aktywny',
'db' => 'status',
'replace' => [ 'array' => [ 0 => '<span style="color: #FF0000;">nie</span>', 1 => 'tak' ] ],
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ]
], [
'name' => 'Typ płatności Apilo',
'db' => 'apilo_payment_type_id',
'replace' => [ 'array' => $payment_types ],
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ]
], [
'name' => 'Typ płatności Sellasist',
'db' => 'sellasist_payment_type_id',
'replace' => [ 'array' => $sellasist_payment_types_list ],
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ]
]
];
$grid -> columns_edit = [
[
'name' => 'Nazwa',
'db' => 'name',
'type' => 'text',
'readonly-edit' => true
], [
'name' => 'Opis',
'db' => 'description',
'type' => 'textarea'
], [
'db' => 'apilo_payment_type_id',
'type' => 'select',
'name' => 'Typ płatności Apilo',
'replace' => [ 'array' => $payment_types ],
], [
'db' => 'sellasist_payment_type_id',
'type' => 'select',
'name' => 'Typ płatności Sellasist',
'replace' => [ 'array' => $sellasist_payment_types_list ],
], [
'name' => 'Aktywny',
'db' => 'status',
'type' => 'select',
'default_value' => 1,
'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ]
]
];
$grid -> actions = [ 'edit' => true ];
echo $grid -> draw();

View File

@@ -0,0 +1,162 @@
<script type="text/javascript" src="/libraries/framework/vendor/plugins/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/libraries/framework/vendor/plugins/ckeditor/adapters/jquery.js"></script>
<?
global $db;
ob_start();
?>
<div id="settings-tabs">
<ul class="resp-tabs-list settings-tabs">
<li><i class="fa fa-file"></i>Ogólne</li>
<li><i class="fa fa-file"></i>Opis</li>
<li><i class="fa fa-globe"></i>SEO</li>
</ul>
<div class="resp-tabs-container settings-tabs">
<div>
<?= \Html::input( [
'label' => 'Nazwa',
'class' => 'require',
'name' => 'name',
'id' => 'name',
'value' => $this -> producer['name']
] );?>
<?= \Html::input_switch( [
'label' => 'Aktywny',
'name' => 'status',
'checked' => $this -> producer['status'] == 1 ? true : false
] );?>
<?= \Html::input_icon( [
'label' => 'Logo',
'name' => 'img',
'id' => 'img',
'value' => $this -> producer['img'],
'icon_content' => 'przeglądaj',
'icon_js' => "window.open ( 'http://" . $_SERVER['SERVER_NAME'] . "/libraries/filemanager-9.14.1/dialog.php?type=1&popup=1&field_id=img&akey=c3cb2537d25c0efc9e573d059d79c3b8', 'mywindow', 'location=1,status=1,scrollbars=1, width=1100,height=700');"
] );
?>
</div>
<div>
<div class="languages-main">
<ul class="resp-tabs-list languages-main htabs">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg[ 'status' ] ):?>
<li><? if ( $lg[ 'id' ] == \front\factory\Languages::default_language() ) echo '<i class="fa fa-star fa-lg text-system" title="Język domyślny"></i> ';?><?= $lg[ 'name' ];?></li>
<? endif;?>
<? endforeach; endif;?>
</ul>
<div class="resp-tabs-container languages-main">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<?
$languages = array ();
$languages[''] = '---- wersja językowa ----';
if ( is_array( $this -> languages ) ) foreach ( $this -> languages as $lg_tmp )
{
if ( $lg_tmp[ 'id' ] != $lg[ 'id' ] )
$languages[ $lg_tmp[ 'id' ] ] = $lg_tmp[ 'name' ];
}
?>
<? if ( $lg[ 'status' ] ):?>
<div>
<?= \Html::textarea( [
'label' => 'Opis',
'name' => 'description[' . $lg['id'] . ']',
'id' => 'description_' . $lg['id'],
'value' => $this -> producer['languages'][$lg[ 'id']]['description'],
'inline' => true
] );?>
<script type="text/javascript">
$(function () {
$( '#description_<?= $lg[ 'id' ];?>').ckeditor({
toolbar: 'MyToolbar',
height: '250'
});
});
</script>
</div>
<? endif;?>
<? endforeach; endif;?>
</div>
<div class="clear"></div>
</div>
</div>
<div>
<div class="languages-main">
<ul class="resp-tabs-list languages-main htabs">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg[ 'status' ] ):?>
<li><? if ( $lg[ 'id' ] == \front\factory\Languages::default_language() ) echo '<i class="fa fa-star fa-lg text-system" title="Język domyślny"></i> ';?><?= $lg[ 'name' ];?></li>
<? endif;?>
<? endforeach; endif;?>
</ul>
<div class="resp-tabs-container languages-main">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<?
$languages = array ();
$languages[''] = '---- wersja językowa ----';
if ( is_array( $this -> languages ) ) foreach ( $this -> languages as $lg_tmp )
{
if ( $lg_tmp[ 'id' ] != $lg[ 'id' ] )
$languages[ $lg_tmp[ 'id' ] ] = $lg_tmp[ 'name' ];
}
?>
<? if ( $lg[ 'status' ] ):?>
<div>
<?= \Html::input( [
'label' => 'Meta title',
'name' => 'meta_title[' . $lg['id'] . ']',
'id' => 'meta_title_' . $lg[ 'id' ],
'value' => $this -> producer['languages'][$lg['id']]['meta_title']
] );?>
</div>
<? endif;?>
<? endforeach; endif;?>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'producer-edit';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Edycja producenta';
$grid -> fields = [
[
'db' => 'id',
'type' => 'hidden',
'value' => $this -> producer['id']
]
];
$grid -> actions = [
'save' => [ 'url' => '/admin/shop_producer/save/', 'back_url' => '/admin/shop_producer/list/' ],
'cancel' => [ 'url' => '/admin/shop_producer/list/' ]
];
$grid -> external_code = $out;
$grid -> persist_edit = true;
$grid -> id_param = 'id';
echo $grid -> draw();
?>
<script type="text/javascript">
$( function()
{
disable_menu();
$( '#settings-tabs' ).easyResponsiveTabs({
width: 'auto',
fit: true,
tabidentify: 'settings-tabs',
type: 'vertical'
});
$('.languages-main').easyResponsiveTabs({
width: 'auto',
fit: true,
tabidentify: 'languages-main'
});
});
</script>

View File

@@ -0,0 +1,73 @@
<?php
global $gdb;
$grid = new \grid( 'shop_producer' );
$grid -> gdb_opt = $gdb;
$grid -> sql = 'SELECT *'
. 'FROM ( '
. 'SELECT '
. 'id, name, status, img '
. 'FROM '
. 'pp_shop_producer '
. ') AS q1 '
. 'WHERE '
. '1=1 [where] '
. 'ORDER BY '
. '[order_p1] [order_p2]';
$grid -> sql_count = 'SELECT '
. 'COUNT(0) FROM ( '
. 'SELECT '
. 'id, name, status, img '
. 'FROM '
. 'pp_shop_producer '
. ') AS q1 '
. 'WHERE '
. '1=1 [where] ';
$grid -> debug = true;
$grid -> order = [ 'column' => 'name', 'type' => 'ASC' ];
$grid -> search = [
[ 'name' => 'Nazwa', 'db' => 'name', 'type' => 'text' ],
[ 'name' => 'Aktywny', 'db' => 'status', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ]
];
$grid -> columns_view = [
[
'name' => 'Lp.',
'th' => [ 'class' => 'g-lp' ],
'td' => [ 'class' => 'g-center' ],
'autoincrement' => true
], [
'name' => 'Nazwa',
'db' => 'name',
'sort' => true,
'php' => 'echo "<a href=\'/admin/shop_producer/edit/id=[id]\'>[name]</a>";'
], [
'name' => 'Logo',
'db' => 'img'
], [
'name' => 'Aktywny',
'db' => 'status',
'replace' => [ 'array' => [ 0 => '<span style="color: #FF0000;">nie</span>', 1 => 'tak' ] ],
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
'sort' => true
], [
'name' => 'Edytuj',
'action' => [ 'type' => 'edit', 'url' => '/admin/shop_producer/edit/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
], [
'name' => 'Usuń',
'action' => [ 'type' => 'delete', 'url' => '/admin/shop_producer/delete/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
]
];
$grid -> buttons = [
[
'label' => 'Dodaj producenta',
'url' => '/admin/shop_producer/edit/',
'icon' => 'fa-plus-circle',
'class' => 'btn-success'
]
];
echo $grid -> draw();

View File

@@ -0,0 +1,84 @@
<?
ob_start();
?>
<div id="settings-tabs">
<ul class="resp-tabs-list settings-tabs">
<li><i class="fa fa-wrench"></i>Ustawienia</li>
</ul>
<div class="resp-tabs-container settings-tabs">
<div>
<?= \Html::input( [
'label' => 'Nazwa',
'name' => 'name',
'id' => 'name',
'value' => $this -> set[ 'name' ],
] );
?>
<?=
\Html::input_switch( [
'label' => 'Aktywny',
'name' => 'status',
'checked' => $this -> set[ 'status' ] == 1 ? true : false
] );
?>
<div class="form-group row">
<label class="col-lg-4 control-label">Produkty do kompletu:</label>
<div class="col-lg-8">
<select id="set_products_id" multiple name="set_products_id[]" placeholder="produkty do kompletu">
<option value="">wybierz produkt...</option>
<? foreach ( $this -> products as $key => $val ):?>
<? if ( $key != $this -> product[ 'id' ] ):?>
<option value="<?= $key;?>" <? if ( in_array( $key, $this -> set[ 'products' ] ) ):?>selected<? endif;?>><?= $val;?></option>
<? endif;?>
<? endforeach;?>
</select>
</div>
</div>
</div>
</div>
</div>
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'set-edit';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Edycja kompletu produktów: <u>' . '' . '</u>';
$grid -> fields = [
[
'db' => 'id',
'type' => 'hidden',
'value' => $this -> set[ 'id' ]
]
];
$grid -> actions = [
'save' => [ 'url' => '/admin/shop_product_sets/save/', 'back_url' => '/admin/shop_product_sets/view_list/' ],
'cancel' => [ 'url' => '/admin/shop_product_sets/view_list/' ]
];
$grid -> external_code = $out;
$grid -> persist_edit = true;
$grid -> id_param = 'id';
echo $grid -> draw();
?>
<link type="text/css" rel="stylesheet" href="/libraries/selectize/css/selectize.css">
<link type="text/css" rel="stylesheet" href="/libraries/selectize/css/selectize.default.css">
<script type="text/javascript" src="/libraries/selectize/js/standalone/selectize.js"></script>
<script type="text/javascript">
$( function()
{
$('#settings-tabs').easyResponsiveTabs({
width: 'auto',
fit: true,
tabidentify: 'settings-tabs',
type: 'vertical'
});
$('#set_products_id').selectize({
maxItems: 999,
plugins: ['remove_button']
});
});
</script>

View File

@@ -0,0 +1,76 @@
<?php
global $gdb;
$grid = new \grid( 'pp_shop_product_sets' );
$grid -> gdb_opt = $gdb;
$grid -> limit = 10;
$grid -> sql = 'SELECT *'
. 'FROM ( '
. 'SELECT '
. 'id, name, status '
. 'FROM '
. 'pp_shop_product_sets AS psps '
. ') AS q1 '
. 'WHERE '
. '1=1 [where] '
. 'ORDER BY '
. '[order_p1] [order_p2]';
$grid -> sql_count = 'SELECT '
. 'COUNT(0) FROM ( '
. 'SELECT '
. 'id, name, status '
. 'FROM '
. 'pp_shop_product_sets AS psps '
. ') AS q1 '
. 'WHERE '
. '1=1 [where] ';
$grid -> debug = true;
$grid -> order = [ 'column' => 'name', 'type' => 'ASC' ];
$grid -> search = [
[ 'name' => 'Nazwa', 'db' => 'name', 'type' => 'text' ],
[ 'name' => 'Aktywny', 'db' => 'status', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ]
];
$grid -> columns_view = [
[
'name' => 'Lp.',
'th' => [ 'class' => 'g-lp' ],
'td' => [ 'class' => 'g-center' ],
'autoincrement' => true
],
[
'name' => 'Nazwa',
'db' => 'name',
'sort' => true,
'php' => 'echo "<a href=\'/admin/shop_product_sets/set_edit/id=[id]\'>" . htmlspecialchars( \'[name]\' ) . "</a>";'
],
[
'name' => 'Aktywny',
'db' => 'status',
'replace' => [ 'array' => [ 0 => '<span class="text-danger">nie</span>', 1 => 'tak' ] ],
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
'sort' => true
],
[
'name' => 'Edytuj',
'action' => [ 'type' => 'edit', 'url' => '/admin/shop_product_sets/set_edit/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
],
[
'name' => 'Usuń',
'action' => [ 'type' => 'delete', 'url' => '/admin/shop_product_sets/set_delete/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
]
];
$grid -> buttons = [
[
'label' => 'Dodaj komplet produktów',
'url' => '/admin/shop_product_sets/set_edit/',
'icon' => 'fa-plus-circle',
'class' => 'btn-success'
]
];
echo $grid -> draw();
?>

View File

@@ -0,0 +1,223 @@
<div class="panel mb50 panel-primary">
<div class="panel-heading">
<span class="panel-title">Masowa edycja produktów</span>
</div>
<div class="panel-body">
<button class="btn btn-dark select-all">Zaznacz wszystkie</button>
<button class="btn btn-default btn-outline-dark deselect-all">Odznacz wszystkie</button>
</div>
<div class="panel-body">
<div class="form-group mb10">
<label class="col-lg-3 control-label" for="inputDefault">Ustaw cenę promocyjną (minus X procent)</label>
<div class="col-lg-9">
<div class="bs-component">
<div class="input-group">
<input class="form-control" type="text" id="discount_percent" name="discount_percent">
<span class="input-group-addon cursor" field-id="discount_percent">
<i class="fa fa-save"></i>
</span>
</div>
</div>
</div>
</div>
</div>
<div class="panel-body">
<div class="row">
<div class="col-lg-6">
<? foreach ( $this -> products as $key => $product ):?>
<div class="checkbox-custom fill mb5">
<input type="checkbox" name="products[]" id="product<?= $key;?>" value="<?= $key;?>">
<label for="product<?= $key;?>"><?= $product;?></label>
</div>
<? endforeach;?>
</div>
<div class="col-lg-6">
<div class="menu_sortable">
<ol class="sortable" id="sortable">
<? if ( is_array( $this -> categories ) ): foreach ( $this -> categories as $category ):?>
<li id="list_<?= $category['id'];?>" class="category_<?= $category['id'];?>" category="<?= $category['id'];?>">
<div class="context_0 content content_menu">
<span class="disclose"><span></span></span>
<? if ( !$category['status'] ) echo '<i class="fa fa-ban fa-lg text-danger" title="Kategoria nieaktywna"></i>';?>
<b><?= $category['languages'][$this -> dlang]['title'];?></b>
</div>
<?= \Tpl::view( 'shop-product/subcategories-list', [
'categories' => \admin\factory\ShopCategory::subcategories( $category['id'] ),
'level' => $this -> level + 1,
'dlang' => $this -> dlang
] );?>
</li>
<? endforeach; endif;?>
</ol>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="/libraries/jquery-nested-sortable/jquery.mjs.nestedSortable.js"></script>
<script type="text/javascript">
$( document ).ready( function()
{
$( 'ol.sortable' ).nestedSortable(
{
forcePlaceholderSize: true,
handle: 'div',
helper: 'clone',
items: 'li',
opacity: .9,
placeholder: 'placeholder',
revert: 250,
tabSize: 45,
tolerance: 'pointer',
toleranceElement: '> div',
maxLevels: 4,
isTree: true,
expandOnHover: 700,
protectRoot: false
});
$( '.disclose' ).on( 'click', function()
{
$( this ).closest( 'li' ).toggleClass( 'sort-collapsed' ).toggleClass( 'sort-expanded' );
});
$( '.disclose' ).mousedown( function(e) {
if ( e.which === 1 ) {
var category_id = $( this ).parent( 'div' ).parent( 'li' ).attr( 'id' );
$.ajax({
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data: {
a: 'cookie_categories',
category_id: category_id
}
});
}
});
<?php
$array = unserialize( $_COOKIE[ 'cookie_categories' ] );
if ( is_array( $array ) ): foreach ( $array as $key => $val ):
if ( $val ):
?>$( '#<?= $key;?>' ).children( 'div' ).children( 'span.disclose' ).click();<?
endif;
endforeach; endif;
?>
$( '.select-all' ).click( function()
{
$( '.checkbox-custom input' ).prop( 'checked', true );
});
$( '.deselect-all' ).click( function()
{
$( '.checkbox-custom input' ).prop( 'checked', false );
});
$( 'body' ).on( 'click', '#sortable input[type="checkbox"]', function(){
if ( $( this ).is( ':checked' ) ) {
$.ajax({
url: '/admin/shop_product/get_products_by_category/',
type: 'post',
data: {
category_id: $( this ).val()
},
success: function(data) {
data = JSON.parse(data);
if ( data.status == 'ok' ) {
$.each( data.products, function( key, value ) {
$( '#product' + value ).prop( 'checked', true );
});
}
}
})
} else {
$.ajax({
url: '/admin/shop_product/get_products_by_category/',
type: 'post',
data: {
category_id: $( this ).val()
},
success: function(data) {
data = JSON.parse(data);
if ( data.status == 'ok' ) {
$.each( data.products, function( key, value ) {
$( '#product' + value ).prop( 'checked', false );
});
}
}
})
}
});
$( 'body' ).on( 'click', 'span[field-id="discount_percent"]', function()
{
$( '.ajax-msg' ).remove();
var discount_percent = $( '#discount_percent' ).val();
var products = [];
$( 'input[name="products[]"]:checked' ).each( function(){
products.push( $( this ).val() );
});
function saveProduct(index) {
if (index < products.length) {
$.ajax({
url: '/admin/shop_product/mass_edit_save/',
type: 'post',
data: {
discount_percent: discount_percent,
products: [products[index]]
},
success: function(data) {
data = JSON.parse(data);
if ( data.status == 'ok') {
if ( data.price_brutto_promo )
$( 'label[for="product' + products[index] + '"]' ).append( ' <span class="ajax-msg text-success">cena promocyjna: ' + data.price_brutto_promo + ' zł, cena zwykła: ' + data.price_brutto + '</span>' );
else
$( 'label[for="product' + products[index] + '"]' ).append( ' <span class="ajax-msg text-success">cena zwykła: ' + data.price_brutto + '</span>' );
} else {
alert('Błąd przy zapisie produktu: ', products[index]);
}
// Wywołanie dla następnego produktu
saveProduct(index + 1);
},
error: function(err) {
alert('Błąd przy zapisie produktu: ', err);
// Można dodać obsługę błędu lub przerwać proces
}
});
} else {
$.alert({
title: 'Informacja',
content: 'Zakończono zapisywanie produktów',
type: 'orange',
closeIcon: true,
closeIconClass: 'fa fa-close',
typeAnimated: true,
animation: 'opacity',
autoClose: 'confirm|10000',
useBootstrap: false,
theme: 'modern',
autoClose: 'cancel|10000',
icon: 'fa fa-exclamation',
buttons:
{
confirm:
{
text: 'Zamknij',
btnClass: 'btn-blue',
keys: ['enter'],
action: function() {}
}
}
});
}
}
if (products.length > 0) {
saveProduct(0); // Rozpoczęcie od pierwszego produktu
}
});
});
</script>

View File

@@ -0,0 +1,223 @@
<div class="g-container" data="table:order-details">
<div class="panel panel-info panel-border top">
<div class="panel-heading">
<span class="panel-title">Kobinacje produktu: <?= $this -> product['languages'][ $this -> default_language ]['name'];?></span>
</div>
<div class="panel-heading p10 pl15" id="g-menu" style="height: auto;">
<a class="btn btn btn-dark btn-sm mr5 btn-sm mr5" href="/admin/shop_product/view_list/"><i class="fa fa-reply mr5"></i>Wstecz</a>
</div>
<div class="panel-body">
<div class="row">
<div class="col-lg-7 col-xl-9">
<div class="table-responsive">
<table class="table table-hover table-bordered table-condensed">
<thead>
<tr>
<th></th>
<th>Kombinacja</th>
<th>SKU</th>
<th>Stan magazynowy</th>
<th>Cena netto</th>
<th>Zam. SM 0</th>
<th>Baselinker</th>
<th style="width: 100px;">Opcje</th>
</tr>
</thead>
<tbody>
<? if ( \S::is_array_fix( $this -> product_permutations ) ): foreach ( $this -> product_permutations as $product ):?>
<tr>
<td></td>
<td>
<?
$attributes = explode( '|', $product['permutation_hash'] );
foreach ( $attributes as $attribute ):
$attribute_tmp = explode( '-', $attribute );
echo \admin\factory\ShopAttribute::get_attribute_name_by_id( $attribute_tmp[0] ) . ' - <b>' . \admin\factory\ShopAttribute::get_attribute_value_by_id( $attribute_tmp[1] ) . '</b>';
if ( $attribute != end( $attributes ) )
echo ', ';
endforeach;
?>
</td>
<td>
<input type="text" name="sku" value="<?= $product['sku'];?>" class="form-control" style="max-width: 100px;" onchange="$.ajax({ type: 'POST', cache: false, url: '/admin/shop_product/product_combination_sku_save/', data: { product_id: <?= $product['id'];?>, sku: $( this ).val() } } );">
</td>
<td>
<input type="text" name="quantity" value="<?= $product['quantity'];?>" class="form-control" style="max-width: 100px;" onchange="$.ajax({ type: 'POST', cache: false, url: '/admin/shop_product/product_combination_quantity_save/', data: { product_id: <?= $product['id'];?>, quantity: $( this ).val() } } );">
</td>
<td>
<input type="text" name="price" value="<?= $product['price_netto'];?>" class="form-control" style="max-width: 100px;" onchange="$.ajax({ type: 'POST', cache: false, url: '/admin/shop_product/product_combination_price_save/', data: { product_id: <?= $product['id'];?>, price: $( this ).val() } } );">
</td>
<td>
<input type="checkbox" name="stock_0_buy" <? if ( $product['stock_0_buy'] ): echo 'checked="checked"'; endif;?> onchange="$.ajax({ type: 'POST', cache: false, url: '/admin/shop_product/product_combination_stock_0_buy_save/', data: { product_id: <?= $product['id'];?>, stock_0_buy: $( this ).is( ':checked' ) } } );">
</td>
<td>
<?
if ( $product['baselinker_product_name'] != "" )
echo "<span title='" . $product['baselinker_product_name'] . "'>" . substr( $product['baselinker_product_name'], 0, 25 ) . "...</span>";
else
echo "<span class='text-danger baselinker-product-search' product-id='" . $product['id'] . "'>nie przypisano <i class='fa fa-search'></i></span>";
?>
</td>
<td class="text-center">
<a href="/admin/shop_product/delete_combination/combination_id=<?= $product['id'];?>&product_id=<?= $product['parent_id'];?>" class="btn btn-danger btn-delete-permutation"><i class="fa fa-trash"></i></a>
</td>
</tr>
<? endforeach; endif;?>
</tbody>
</table>
</div>
</div>
<div class="col-lg-5 col-xl-3">
<form action="/admin/shop_product/generate_combination/product_id=<?= $this -> product['id'];?>" method="POST">
<button type="submit" class="btn btn-success" style="margin-bottom: 25px;">Wygeneruj kombinacje</button>
<? foreach ( $this -> attributes as $attribute ):?>
<div class="combination-attribute">
<div class="title">
<?= $attribute['languages'][ $this -> default_language ]['name'];?>
</div>
<ul class="values">
<? foreach ( $attribute['values'] as $value ):?>
<li>
<input type="checkbox" class="g-checkbox" name="attribute_<?= $attribute['id'];?>[]" value="<?= $value['id'];?>"> <?= $value['languages'][ $this -> default_language ]['name'];?>
</li>
<? endforeach;?>
</ul>
</div>
<? endforeach;?>
</form>
</div>
</div>
</div>
</div>
</div>
<link rel="stylesheet" type="text/css" href="/libraries/grid/plugins/icheck/skins/minimal/minimal.css">
<link rel="stylesheet" type="text/css" href="/libraries/grid/plugins/icheck/skins/minimal/blue.css">
<script type="text/javascript" src="/libraries/grid/plugins/icheck/icheck.min.js"></script>
<script type="text/javascript">
$( function()
{
$( '.g-checkbox, .g-radio' ).iCheck({
checkboxClass: 'icheckbox_minimal-blue',
radioClass: 'iradio_minimal-blue'
});
$( 'body' ).on( 'click', '.btn-delete-permutation', function(e)
{
e.preventDefault();
var href = $( this ).attr( 'href' );
$.alert(
{
title: 'Pytanie',
content: 'Na pewno chcesz usunąć wybraną kombinację?',
type: 'orange',
closeIcon: true,
closeIconClass: 'fa fa-times',
typeAnimated: true,
animation: 'opacity',
columnClass: 'col-12 col-lg-10',
theme: 'modern',
icon: 'fa fa-question',
buttons: {
cancel: {
text: 'Nie',
btnClass: 'btn-dark',
action: function() {}
},
confirm: {
text: 'Tak',
btnClass: 'btn-danger',
keys: ['enter'],
action: function() {
document.location.href = href;
}
}
}
});
return false;
});
$( 'body' ).on( 'click', '.baselinker-product-search', function() {
var product_id = $( this ).attr( 'product-id' );
$.ajax({
type: 'POST',
cache: false,
url: '/admin/shop_product/baselinker_product_search/',
data: {
product_id: product_id
},
beforeSend: function() {
$( '#overlay' ).show();
},
success: function( response ) {
data = jQuery.parseJSON( response );
if ( data.status == 'SUCCESS' ) {
$('.baselinker-found-products').remove();
var html = '<div class="baselinker-found-products">';
html += '<p>Znaleziono ' + data.products.length + ' produktów</p>';
html += '<select class="form-control baselinker-product-select" product-id="' + product_id + '">';
$.each( data.products, function( index, value ) {
html += '<option value="' + value.product_id + '">' + value.name + ' SKU: ' + value.sku + '</option>';
});
html += '</select>';
html += '<button class="btn btn-success baselinker-product-select-save" product-id="' + product_id + '">Zapisz</button>';
html += '</div>';
$( 'span[product-id="' + product_id + '"]' ).closest( 'td' ).append( html );
} else if ( data.status == 'error' ) {
$.alert({
title: 'Błąd',
content: data.msg,
type: 'red',
closeIcon: true,
closeIconClass: 'fa fa-times',
typeAnimated: true,
animation: 'opacity',
columnClass: 'col-12 col-lg-10',
theme: 'modern',
icon: 'fa fa-exclamation-triangle',
buttons: {
confirm: {
text: 'OK',
btnClass: 'btn-danger',
keys: ['enter'],
action: function() {}
}
}
});
}
}
});
});
$( 'body' ).on( 'click', '.baselinker-product-select-save', function(){
var product_id = $( this ).attr( 'product-id' );
var baselinker_product_id = $( '.baselinker-product-select[product-id="' + product_id + '"]' ).val();
var baselinker_product_name = $( '.baselinker-product-select[product-id="' + product_id + '"] option:selected' ).text();
$.ajax({
type: 'POST',
cache: false,
url: '/admin/shop_product/baselinker_product_select_save/',
data: {
product_id: product_id,
baselinker_product_id: baselinker_product_id,
baselinker_product_name: baselinker_product_name
},
beforeSend: function() {
$( '#overlay' ).show();
},
success: function( response ) {
data = jQuery.parseJSON( response );
if ( data.status == 'ok' ) {
$( '.baselinker-product-select[product-id="' + product_id + '"]' ).closest( '.baselinker-found-products' ).remove();
$( 'span[product-id="' + product_id + '"]' ).html( '<span title="' + baselinker_product_name + '">' + baselinker_product_name.substr( 0, 25 ) + '...</span>' ).removeClass( 'baselinker-product-search' ).removeClass( 'text-danger' );
}
}
});
});
});
</script>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,136 @@
<? $i = ( $this -> current_page - 1 ) * 10 + 1;?>
<? foreach ( $this -> products as $product ):?>
<tr>
<td>
<?= $i++;?>
</td>
<td>
<div class="product-image">
<? if ( $product['images'][0]['src'] ):?>
<img src="<?= $product['images'][0]['src'];?>" alt="<?= $product['images'][0]['alt'];?>" class="img-responsive">
<? else:?>
<img src="/admin/layout/images/no-image.png" alt="Brak zdjęcia" class="img-responsive">
<? endif;?>
</div>
<div class="product-name">
<a href="/admin/shop_product/product_edit/id=<?= $product['id'];?>">
<?= $product['languages']['pl']['name'];?>
</a>
<a href="#" class="text-muted duplicate-product" product-id="<?= $product['id'];?>">duplikuj</a>
</div>
<small class="text-muted product-categories"><?= \admin\factory\ShopProduct::product_categories( $product['id'] );?></small>
<small class="text-muted product-categories">SKU: <?= $product['sku'];?>, EAN: <?= $product['ean'];?></small>
</td>
<td class="text-center">
<input type="text" class="product-price form-control text-right" product-id="<?= $product['id'];?>" value="<?= $product['price_brutto'];?>" style="width: 75px;">
</td>
<td class="text-center">
<input type="text" class="product-price-promo form-control text-right" product-id="<?= $product['id'];?>" value="<?= $product['price_brutto_promo'];?>" style="width: 75px;">
</td>
<td class="text-center">
<?= $product['promoted'] ? '<span class="text-success text-bold">tak</span>' : 'nie';?>
</td>
<td class="text-center">
<?= $product['status'] ? 'tak' : '<span class="text-danger text-bold">nie</span>';?>
</td>
<td class="text-center">
<span class="text-muted"><?= (int)\admin\factory\shopProduct::get_product_quantity_list( $product['id'] );?></span>
</td>
<? if ( $this -> baselinker_enabled ):?>
<td class="text-center">
<?
if ( $product['baselinker_product_name'] != "" ) {
echo "<span title='" . htmlspecialchars( $product['baselinker_product_name'] ) . "'>" . mb_substr( $product['baselinker_product_name'], 0, 25, 'UTF-8' ) . "...</span>";
echo "<br>";
echo "<span class='text-danger baselinker-delete-linking' product-id='" . $product['id'] . "'>";
echo "<i class='fa fa-times'></i>usuń powiązanie";
echo "</span>";
} else {
echo "<span class='text-danger baselinker-product-search' product-id='" . $product['id'] . "'>";
echo "nie przypisano <i class='fa fa-search'></i>";
echo "</span>";
}
?>
</td>
<? endif;?>
<? if ( $this -> apilo_enabled ):?>
<td class="text-center">
<?
if ( $product['apilo_product_name'] != "" ) {
echo "<span title='" . htmlspecialchars( $product['apilo_product_name'] ) . "'>" . mb_substr( $product['apilo_product_name'], 0, 25, "UTF-8" ) . "...</span>";
echo "<br>";
echo "<span class='text-danger apilo-delete-linking' product-id='" . $product['id'] . "'>";
echo "<i class='fa fa-times'></i>usuń powiązanie";
echo "</span>";
} else {
echo "<span class='text-danger apilo-product-search' product-id='" . $product['id'] . "'>";
echo "nie przypisano <i class='fa fa-search'></i>";
echo "</span>";
}
?>
</td>
<? endif;?>
<!-- sellasist -->
<? if ( $this -> sellasist_enabled ):?>
<td class="text-center">
<?
if ( $product['sellasist_product_name'] != "" ) {
echo "<span title='" . htmlspecialchars( $product['sellasist_product_name'] ) . "'>" . mb_substr( $product['sellasist_product_name'], 0, 25, "UTF-8" ) . "...</span>";
echo "<br>";
echo "<span class='text-danger sellasist-delete-linking' product-id='" . $product['id'] . "'>";
echo "<i class='fa fa-times'></i>usuń powiązanie";
echo "</span>";
} else {
echo "<span class='text-danger sellasist-product-search' product-id='" . $product['id'] . "'>";
echo "nie przypisano <i class='fa fa-search'></i>";
echo "</span>";
}
?>
</td>
<? endif;?>
<td>
<a href='/admin/shop_product/product_combination/product_id=<?= $product['id'];?>'>kombinacje (<?= \admin\factory\shopProduct::count_product_combinations( $product['id'] );?>)</a>
</td>
<td class="text-center">
<a href='/admin/shop_product/product_edit/id=<?= $product['id'];?>'>edytuj</a>
</td>
<td class="text-center">
<a href='/admin/shop_product/product_archive/product_id=<?= $product['id'];?>' class="product-delete">usuń</a>
</td>
</tr>
<? if ( $this -> show_xml_data ):?>
<tr>
<td colspan="12">
<div class="product-xml-data">
<!-- input nazwa produktu XML -->
<input type="text" class="form-control product_xml_name" value="<?= $product['languages']['pl']['xml_name'];?>" placeholder="Nazwa produktu XML (PL)" product-id="<?= $product['id'];?>" lang-id="pl">
<!-- input custom_label_0 -->
<div class="custom_label_0_container">
<input type="text" class="form-control custom_label_0" value="<?= $product['custom_label_0'];?>" placeholder="custom_label_0" product-id="<?= $product['id'];?>" label-type="custom_label_0">
<div class="custom_label_0_suggestions" label-type="custom_label_0"></div>
</div>
<!-- input custom_label_1 -->
<div class="custom_label_1_container">
<input type="text" class="form-control custom_label_1" value="<?= $product['custom_label_1'];?>" placeholder="custom_label_1" product-id="<?= $product['id'];?>" label-type="custom_label_1">
<div class="custom_label_1_suggestions" label-type="custom_label_1"></div>
</div>
<!-- input custom_label_2 -->
<div class="custom_label_2_container">
<input type="text" class="form-control custom_label_2" value="<?= $product['custom_label_2'];?>" placeholder="custom_label_2" product-id="<?= $product['id'];?>" label-type="custom_label_2">
<div class="custom_label_2_suggestions" label-type="custom_label_2"></div>
</div>
<!-- input custom_label_3 -->
<div class="custom_label_3_container">
<input type="text" class="form-control custom_label_3" value="<?= $product['custom_label_3'];?>" placeholder="custom_label_3" product-id="<?= $product['id'];?>" label-type="custom_label_3">
<div class="custom_label_3_suggestions" label-type="custom_label_3"></div>
</div>
<!-- input custom_label_4 -->
<div class="custom_label_4_container">
<input type="text" class="form-control custom_label_4" value="<?= $product['custom_label_4'];?>" placeholder="custom_label_4" product-id="<?= $product['id'];?>" label-type="custom_label_4">
<div class="custom_label_4_suggestions" label-type="custom_label_4"></div>
</div>
</div>
</td>
</tr>
<? endif;?>
<? endforeach;?>

View File

@@ -0,0 +1,851 @@
<div class="panel">
<div class="panel-body">
<a href="/admin/shop_product/product_edit/" class="btn btn-success">Dodaj produkt</a>
<!-- przycisk pokaż dane z XML -->
<? if ( !$this -> show_xml_data ):?>
<a href="/admin/shop_product/view_list/show_xml_data=true" class="btn btn-dark">Pokaż dane z XML</a>
<? else:?>
<a href="/admin/shop_product/view_list/show_xml_data=false" class="btn btn-danger">Ukryj dane z XML</a>
<? endif;?>
<? if ( $this -> shoppro_enabled ):?>
<a href="#" class="btn btn-danger btn-shoppro-product-import">Pobierz produkt z shopPRO</a>
<? endif;?>
</div>
<div class="panel-body pn">
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped mbn" id="table-products">
<thead>
<tr>
<th style="width: 10px;">#</th>
<th>Nazwa</th>
<th class="text-center" style="width: 100px;">Cena</th>
<th class="text-center" style="width: 100px;">Cena promocyjna</th>
<th class="text-center" style="width: 25px;">Promowany</th>
<th class="text-center" style="width: 25px;">Aktywny</th>
<th class="text-center" style="width: 75px;">Stan MG</th>
<? if ( $this -> baselinker_enabled ):?>
<th class="text-center" style="width: 100px;">Baselinker</th>
<? endif;?>
<? if ( $this -> apilo_enabled ):?>
<th class="text-center" style="width: 100px;">Apilo</th>
<? endif;?>
<? if ( $this -> sellasist_enabled ):?>
<th class="text-center" style="width: 100px;">Sellasist</th>
<? endif;?>
<th class="text-center" style="width: 100px;">Kombinacje</th>
<th class="text-center" style="width: 75px;">Edytuj</th>
<th class="text-center" style="width: 75px;">Archiwizuj</th>
</tr>
<tr>
<th></th>
<th>
<input type="text" class="form-control table-search" field_name="name|ean|sku" placeholder="szukaj..." value="<?= htmlspecialchars( $this -> query_array['name|ean|sku'], ENT_QUOTES, 'UTF-8');?>">
</th>
<th colspan="10"></th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr>
<td colspan="12">
<ul class="pagination" pagination_max="<?= $this -> pagination_max;?>">
<li>
<a href="#" page="1" title="pierwsza strona">
<i class="fa fa-angle-double-left"></i>
</a>
</li>
<li>
<a href="#" class="previous" page="<?= ( $this -> current_page - 1 > 1 ) ? ( $this -> current_page - 1 ) : 1;?>" title="poprzednia strona">
<i class="fa fa-angle-left" title="poprzednia strona"></i>
</a>
</li>
<li>
<div>
Strona <span id="current-page"><?= $this -> current_page;?></span> z <span id="max_page"><?= $this -> pagination_max;?></span>
</div>
</li>
<li>
<a href="#" class="next" page="<?= ( $this -> current_page + 1 < $this -> pagination_max ) ? ( $this -> current_page + 1 ) : $this -> pagination_max;?>" title="następna strona">
<i class="fa fa-angle-right"></i>
</a>
</li>
<li>
<a href="#" class="last" page="<?= $this -> pagination_max;?>" title="ostatnia strona">
<i class="fa fa-angle-double-right"></i>
</a>
</li>
</ul>
</td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
<script type="text/javascript">
$( function() {
ajax_load_products( <?= $this -> current_page;?>, null );
$( 'body' ).on( 'change', '.table-search', function() {
ajax_load_products( 1 );
});
$( 'body' ).on( 'click', '.pagination a', function() {
var current_page = $( this ).attr( 'page' );
ajax_load_products( current_page );
});
$( 'body' ).on( 'click', '.btn-shoppro-product-import', function(e)
{
e.preventDefault();
// show alert with form with product_id field
$.alert({
title: 'Import produktu',
content: 'Wprowadź ID produktu z shopPRO',
type: 'orange',
closeIcon: true,
closeIconClass: 'fa fa-times',
typeAnimated: true,
animation: 'opacity',
columnClass: 'col-12 col-lg-8',
theme: 'material',
icon: 'fa fa-exclamation-triangle',
buttons: {
confirm: {
text: 'Importuj',
btnClass: 'btn-success',
keys: ['enter'],
action: function() {
var product_id = $( '#shoppro-product-id' ).val();
if ( product_id )
{
document.location.href = '/admin/integrations/shoppro_product_import/product_id=' + product_id;
}
}
},
cancel: {
text: 'Anuluj',
btnClass: 'btn-danger',
action: function() {}
}
},
onOpenBefore: function() {
this.setContent( '<input type="text" class="form-control" id="shoppro-product-id" placeholder="ID produktu z shopPRO">' );
}
});
});
$( 'body' ).on( 'click', '.product-delete', function(e) {
e.preventDefault();
var href = $( this ).attr( 'href' );
$.alert({
title: 'Pytanie',
content: 'Na pewno chcesz przenieść wybrany produkt do archiwum?',
type: 'orange',
closeIcon: true,
closeIconClass: 'fa fa-times',
typeAnimated: true,
animation: 'opacity',
columnClass: 'col-12 col-lg-10',
theme: 'supervan',
icon: 'fa fa-question',
buttons: {
cancel: {
text: 'Nie',
btnClass: 'btn-success',
action: function() {}
},
confirm: {
text: 'Tak',
btnClass: 'btn-danger',
keys: ['enter'],
action: function() {
document.location.href = href;
}
}
}
});
return false;
});
$( 'body' ).on( 'change', '.product-price-promo', function(e)
{
var price = $( this ).val();
price = price.replace( ' ', '' );
price = parseFloat( price.replace( ',', '.' ) * 1 );
price = number_format( price, 2, '.', '' );
$( this ).val( price );
var product_id = $( this ).attr( 'product-id' );
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/shop_product/product_change_price_brutto_promo/',
data:
{
product_id: product_id,
price: price
},
beforeSend: function()
{
$( '#overlay' ).show();
},
success: function( data )
{
$( '#overlay' ).hide();
response = jQuery.parseJSON( data );
if ( response.status !== 'ok' )
create_error( response.msg );
}
});
});
$( 'body' ).on( 'change', '.product-price', function(e)
{
var price = $( this ).val();
price = price.replace( ' ', '' );
price = parseFloat( price.replace( ',', '.' ) * 1 );
price = number_format( price, 2, '.', '' );
$( this ).val( price );
var product_id = $( this ).attr( 'product-id' );
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/shop_product/product_change_price_brutto/',
data:
{
product_id: product_id,
price: price
},
beforeSend: function()
{
$( '#overlay' ).show();
},
success: function( data )
{
$( '#overlay' ).hide();
response = jQuery.parseJSON( data );
if ( response.status !== 'ok' )
create_error( response.msg );
}
});
});
$( 'body' ).on( 'click', '.duplicate-product', function(e)
{
e.preventDefault();
var product_id = $( this ).attr( 'product-id' );
$.alert({
title: 'Pytanie',
content: 'Na pewno chcesz wykonać duplikat produktu?',
type: 'orange',
closeIcon: true,
closeIconClass: 'fa fa-times',
typeAnimated: true,
animation: 'opacity',
columnClass: 'col-12 col-lg-10',
theme: 'modern',
icon: 'fa fa-question',
buttons: {
confirm: {
text: 'Tak (produkt bez kombinacji)',
btnClass: 'btn-success',
keys: ['enter'],
action: function() {
document.location.href = '/admin/shop_product/duplicate_product/product-id=' + product_id;
}
},
confirm2: {
text: 'Tak (produkt z KOMBINACJAMI)',
btnClass: 'btn-primary',
keys: ['enter'],
action: function() {
document.location.href = '/admin/shop_product/duplicate_product/product-id=' + product_id + '&combination=1';
}
},
cancel: {
text: 'Nie',
btnClass: 'btn-dark',
action: function() {}
}
}
});
})
// sellasist product search
$( 'body' ).on( 'click', '.sellasist-product-search', function() {
var product_id = $( this ).attr( 'product-id' );
$.ajax({
type: 'POST',
cache: false,
url: '/admin/integrations/sellasist_product_search/',
data: {
product_id: product_id
},
beforeSend: function() {
$( '#overlay' ).show();
},
success: function( response ) {
data = jQuery.parseJSON( response );
if ( data.status == 'SUCCESS' ) {
var html = '<div class="sellasist-found-products">';
html += '<p>Znaleziono ' + data.products.length + ' produktów</p>';
html += '<select class="form-control sellasist-product-select" product-id="' + product_id + '">';
$.each( data.products, function( index, value ) {
html += '<option value="' + value.id + '">' + value.name + ' SKU: ' + value.symbol + '</option>';
});
html += '</select>';
html += '<button class="btn btn-success sellasist-product-select-save" product-id="' + product_id + '">Zapisz</button>';
html += '</div>';
$( 'span.sellasist-product-search[product-id="' + product_id + '"]' ).closest( 'td' ).append( html );
} else if ( data.status == 'error' ) {
$.alert({
title: 'Błąd',
content: data.msg,
type: 'red',
closeIcon: true,
closeIconClass: 'fa fa-times',
typeAnimated: true,
animation: 'opacity',
columnClass: 'col-12 col-lg-10',
theme: 'modern',
icon: 'fa fa-exclamation-triangle',
buttons: {
confirm: {
text: 'OK',
btnClass: 'btn-danger',
keys: ['enter'],
action: function() {}
}
}
});
}
}
});
});
// apilo product search
$( 'body' ).on( 'click', '.apilo-product-search', function() {
var product_id = $( this ).attr( 'product-id' );
$.ajax({
type: 'POST',
cache: false,
url: '/admin/integrations/apilo_product_search/',
data: {
product_id: product_id
},
beforeSend: function() {
$( '#overlay' ).show();
},
success: function( response ) {
data = jQuery.parseJSON( response );
if ( data.status == 'SUCCESS' )
{
if ( data.products.length == 0 )
{
var html = '<div class="baselinker-found-products">';
html += '<p>Nie znaleziono produktów</p>';
// button to create product on baselinker
html += '<a href="/admin/integrations/apilo_create_product/product-id=' + product_id + '" class="btn btn-success btn_apilo_create_product" product_id="' + product_id + '">Utwórz produkt</a>';
html += '</div>';
$( 'span.apilo-product-search[product-id="' + product_id + '"]' ).closest( 'td' ).append( html );
}
else
{
var html = '<div class="apilo-found-products">';
html += '<p>Znaleziono ' + data.products.length + ' produktów</p>';
html += '<select class="form-control apilo-product-select" product-id="' + product_id + '">';
$.each( data.products, function( index, value ) {
html += '<option value="' + value.id + '">' + value.name + ' SKU: ' + value.sku + '</option>';
});
html += '</select>';
html += '<button class="btn btn-success apilo-product-select-save" product-id="' + product_id + '">Zapisz</button>';
html += '</div>';
$( 'span.apilo-product-search[product-id="' + product_id + '"]' ).closest( 'td' ).append( html );
}
}
else if ( data.status == 'error' )
{
$.alert({
title: 'Błąd',
content: data.msg,
type: 'red',
closeIcon: true,
closeIconClass: 'fa fa-times',
typeAnimated: true,
animation: 'opacity',
columnClass: 'col-12 col-lg-10',
theme: 'modern',
icon: 'fa fa-exclamation-triangle',
buttons: {
confirm: {
text: 'OK',
btnClass: 'btn-danger',
keys: ['enter'],
action: function() {}
}
}
});
}
}
});
});
// sellasist product delete linking
$( 'body' ).on( 'click', '.sellasist-delete-linking', function() {
var product_id = $( this ).attr( 'product-id' );
$.ajax({
type: 'POST',
cache: false,
url: '/admin/integrations/sellasist_product_select_delete/',
data: {
product_id: product_id
},
beforeSend: function() {
$( '#overlay' ).show();
},
success: function( response ) {
data = jQuery.parseJSON( response );
if ( data.status == 'ok' ) {
$( 'span.sellasist-delete-linking[product-id="' + product_id + '"]' ).closest('td').html( '<span class="text-danger sellasist-product-search" product-id="' + product_id + '">nie przypisano <i class="fa fa-search"></i></span>' );
}
}
});
});
// delete apilo product linking
$( 'body' ).on( 'click', '.apilo-delete-linking', function() {
var product_id = $( this ).attr( 'product-id' );
$.ajax({
type: 'POST',
cache: false,
url: '/admin/integrations/apilo_product_select_delete/',
data: {
product_id: product_id
},
beforeSend: function() {
$( '#overlay' ).show();
},
success: function( response ) {
data = jQuery.parseJSON( response );
if ( data.status == 'ok' ) {
$( 'span.apilo-delete-linking[product-id="' + product_id + '"]' ).closest('td').html( '<span class="text-danger apilo-product-search" product-id="' + product_id + '">nie przypisano <i class="fa fa-search"></i></span>' );
}
}
});
});
// delete baselinker product linking
$( 'body' ).on( 'click', '.baselinker-delete-linking', function() {
var product_id = $( this ).attr( 'product-id' );
$.ajax({
type: 'POST',
cache: false,
url: '/admin/integrations/baselinker_product_select_delete/',
data: {
product_id: product_id
},
beforeSend: function() {
$( '#overlay' ).show();
},
success: function( response ) {
data = jQuery.parseJSON( response );
if ( data.status == 'ok' ) {
$( 'span.baselinker-delete-linking[product-id="' + product_id + '"]' ).closest('td').html( '<span class="text-danger baselinker-product-search" product-id="' + product_id + '">nie przypisano <i class="fa fa-search"></i></span>' );
}
}
});
});
// aplio product create button click with alert confirmation
$( 'body' ).on( 'click', '.btn_apilo_create_product', function(e)
{
e.preventDefault();
var product_id = $( this ).attr( 'product_id' );
$.alert(
{
title: 'Pytanie',
content: 'Na pewno chcesz utworzyć produkt w bazie Apilo?',
type: 'orange',
closeIcon: true,
closeIconClass: 'fa fa-times',
typeAnimated: true,
animation: 'opacity',
columnClass: 'col-12 col-lg-10',
theme: 'modern',
icon: 'fa fa-question',
buttons:
{
confirm:
{
text: 'Tak',
btnClass: 'btn-success',
keys: ['enter'],
action: function()
{
document.location.href = '/admin/integrations/apilo_create_product/product_id=' + product_id;
}
},
cancel:
{
text: 'Nie',
btnClass: 'btn-danger',
action: function() {}
}
}
});
});
// baselinker product create button click with alert confirmation
$( 'body' ).on( 'click', '.btn-create-product', function(e) {
e.preventDefault();
var product_id = $( this ).attr( 'product-id' );
$.alert({
title: 'Pytanie',
content: 'Na pewno chcesz utworzyć produkt w bazie Baselinker?',
type: 'orange',
closeIcon: true,
closeIconClass: 'fa fa-times',
typeAnimated: true,
animation: 'opacity',
columnClass: 'col-12 col-lg-10',
theme: 'modern',
icon: 'fa fa-question',
buttons: {
confirm: {
text: 'Tak',
btnClass: 'btn-success',
keys: ['enter'],
action: function() {
document.location.href = '/admin/integrations/baselinker_create_product/product_id=' + product_id;
}
},
cancel: {
text: 'Nie',
btnClass: 'btn-danger',
action: function() {}
}
}
});
});
$( 'body' ).on( 'click', '.baselinker-product-search', function() {
var product_id = $( this ).attr( 'product-id' );
$.ajax({
type: 'POST',
cache: false,
url: '/admin/integrations/baselinker_product_search/',
data: {
product_id: product_id
},
beforeSend: function() {
$( '#overlay' ).show();
},
success: function( response ) {
data = jQuery.parseJSON( response );
if ( data.status == 'SUCCESS' )
{
if ( data.products.length == 0 )
{
var html = '<div class="baselinker-found-products">';
html += '<p>Nie znaleziono produktów</p>';
// button to create product on baselinker
html += '<a href="/admin/integrations/baselinker_create_product/product-id=' + product_id + '" class="btn btn-success btn-create-product" product-id="' + product_id + '">Utwórz produkt</a>';
html += '</div>';
$( 'span.baselinker-product-search[product-id="' + product_id + '"]' ).closest( 'td' ).append( html );
}
else
{
var html = '<div class="baselinker-found-products">';
html += '<p>Znaleziono ' + data.products.length + ' produktów</p>';
html += '<select class="form-control baselinker-product-select" product-id="' + product_id + '">';
$.each( data.products, function( index, value ) {
html += '<option value="' + value.product_id + '">' + value.name + ' SKU: ' + value.sku + '</option>';
});
html += '</select>';
html += '<button class="btn btn-success baselinker-product-select-save" product-id="' + product_id + '">Zapisz</button>';
html += '</div>';
$( 'span.baselinker-product-search[product-id="' + product_id + '"]' ).closest( 'td' ).append( html );
}
}
else if ( data.status == 'error' )
{
$.alert({
title: 'Błąd',
content: data.msg,
type: 'red',
closeIcon: true,
closeIconClass: 'fa fa-times',
typeAnimated: true,
animation: 'opacity',
columnClass: 'col-12 col-lg-10',
theme: 'modern',
icon: 'fa fa-exclamation-triangle',
buttons: {
confirm: {
text: 'OK',
btnClass: 'btn-danger',
keys: ['enter'],
action: function() {}
}
}
});
}
}
});
});
// sellasist product select save
$( 'body' ).on( 'click', '.sellasist-product-select-save', function(){
var product_id = $( this ).attr( 'product-id' );
var sellasist_product_id = $( '.sellasist-product-select[product-id="' + product_id + '"]' ).val();
var sellasist_product_name = $( '.sellasist-product-select[product-id="' + product_id + '"] option:selected' ).text();
$.ajax({
type: 'POST',
cache: false,
url: '/admin/integrations/sellasist_product_select_save/',
data: {
product_id: product_id,
sellasist_product_id: sellasist_product_id,
sellasist_product_name: sellasist_product_name
},
beforeSend: function() {
$( '#overlay' ).show();
},
success: function( response ) {
data = jQuery.parseJSON( response );
if ( data.status == 'ok' ) {
$( '.sellasist-product-select[product-id="' + product_id + '"]' ).closest( '.sellasist-found-products' ).remove();
$( 'span.sellasist-product-search[product-id="' + product_id + '"]' ).html( '<span title="' + sellasist_product_name + '">' + sellasist_product_name.substr( 0, 25 ) + '...</span>' ).removeClass( 'sellasist-product-search' ).removeClass( 'text-danger' );
}
}
});
});
// apilo product select save
$( 'body' ).on( 'click', '.apilo-product-select-save', function(){
var product_id = $( this ).attr( 'product-id' );
var apilo_product_id = $( '.apilo-product-select[product-id="' + product_id + '"]' ).val();
var apilo_product_name = $( '.apilo-product-select[product-id="' + product_id + '"] option:selected' ).text();
$.ajax({
type: 'POST',
cache: false,
url: '/admin/integrations/apilo_product_select_save/',
data: {
product_id: product_id,
apilo_product_id: apilo_product_id,
apilo_product_name: apilo_product_name
},
beforeSend: function() {
$( '#overlay' ).show();
},
success: function( response ) {
data = jQuery.parseJSON( response );
if ( data.status == 'ok' ) {
$( '.apilo-product-select[product-id="' + product_id + '"]' ).closest( '.apilo-found-products' ).remove();
$( 'span.apilo-product-search[product-id="' + product_id + '"]' ).html( '<span title="' + apilo_product_name + '">' + apilo_product_name.substr( 0, 25 ) + '...</span>' ).removeClass( 'apilo-product-search' ).removeClass( 'text-danger' );
}
}
});
});
$( 'body' ).on( 'click', '.baselinker-product-select-save', function(){
var product_id = $( this ).attr( 'product-id' );
var baselinker_product_id = $( '.baselinker-product-select[product-id="' + product_id + '"]' ).val();
var baselinker_product_name = $( '.baselinker-product-select[product-id="' + product_id + '"] option:selected' ).text();
$.ajax({
type: 'POST',
cache: false,
url: '/admin/integrations/baselinker_product_select_save/',
data: {
product_id: product_id,
baselinker_product_id: baselinker_product_id,
baselinker_product_name: baselinker_product_name
},
beforeSend: function() {
$( '#overlay' ).show();
},
success: function( response ) {
data = jQuery.parseJSON( response );
if ( data.status == 'ok' ) {
$( '.baselinker-product-select[product-id="' + product_id + '"]' ).closest( '.baselinker-found-products' ).remove();
$( 'span.baselinker-product-search[product-id="' + product_id + '"]' ).html( '<span title="' + baselinker_product_name + '">' + baselinker_product_name.substr( 0, 25 ) + '...</span>' ).removeClass( 'baselinker-product-search' ).removeClass( 'text-danger' );
}
}
});
});
$( 'body' ).on( 'change', '.product_xml_name', function() {
var product_id = $( this ).attr( 'product-id' );
var product_xml_name = $( this ).val();
var lang_id = $( this ).attr( 'lang-id' );
$.ajax({
type: 'POST',
cache: false,
url: '/admin/shop_product/product_xml_name_save/',
data: {
product_id: product_id,
product_xml_name: product_xml_name,
lang_id: lang_id
},
beforeSend: function() {
$( '#overlay' ).show();
},
success: function( response ) {
$( '#overlay' ).hide();
}
});
});
// save custom_label on change
$( 'body' ).on( 'change', '.custom_label_0, .custom_label_1, .custom_label_2, .custom_label_3, .custom_label_4', function() {
var element = $( this );
var product_id = element.attr( 'product-id' );
var custom_label = element.val();
var label_type = element.attr( 'label-type' );
$.ajax({
type: 'POST',
cache: false,
url: '/admin/shop_product/product_custom_label_save/',
data: {
product_id: product_id,
custom_label: custom_label,
label_type: label_type
},
beforeSend: function() {
$( '#overlay' ).show();
},
success: function( response ) {
$( '#overlay' ).hide();
// hide after 1 seconds
setTimeout(function(){
element.parent( '.' + label_type + '_container' ).find( '.' + label_type + '_suggestions' ).hide();
}, 1000);
}
});
});
// on keyup
$( 'body' ).on( 'keyup', '.custom_label_0, .custom_label_1, .custom_label_2, .custom_label_3, .custom_label_4', function() {
var element = $( this );
var product_id = element.attr( 'product-id' );
var custom_label = element.val();
var label_type = element.attr( 'label-type' );
$.ajax({
type: 'POST',
cache: false,
url: '/admin/shop_product/product_custom_label_suggestions/',
data: {
custom_label: custom_label,
label_type: label_type
},
beforeSend: function() {
},
success: function( response ) {
var data = jQuery.parseJSON( response );
var suggestions = "";
if ( data.suggestions.length > 0 ) {
for ( var i = 0; i < data.suggestions.length; i++ ) {
suggestions += "<div>" + data.suggestions[i].label + "</div>";
}
element.parent( '.' + label_type + '_container' ).find( '.' + label_type + '_suggestions' ).html( suggestions ).show();
} else {
element.parent( '.' + label_type + '_container' ).find( '.' + label_type + '_suggestions' ).hide();
}
}
});
});
});
$( 'body' ).on( 'click', '.custom_label_0_suggestions div, .custom_label_1_suggestions div, .custom_label_2_suggestions div, .custom_label_3_suggestions div, .custom_label_4_suggestions div', function(){
var element = $( this );
var label_type = element.parent().attr( 'label-type' );
var custom_label = element.html();
element.parents( '.' + label_type + '_container' ).find( 'input' ).val( custom_label );
// trigger change
element.parents( '.' + label_type + '_container' ).find( 'input' ).trigger( 'change' );
element.parents( '.' + label_type + '_container' ).find( '.' + label_type + '_suggestions' ).hide();
});
function ajax_load_products( current_page ) {
var pagination_max = parseInt( $( '.pagination' ).attr( 'pagination_max' ) );
var query = '';
$( '.table-search' ).each(function(){
query += $( this ).attr( 'field_name' ) + '=' + $( this ).val() + '&';
});
current_page = parseInt( current_page );
$.ajax({
type: 'POST',
cache: false,
url: '/admin/shop_product/ajax_load_products/',
data: {
current_page: current_page,
query: query
},
beforeSend: function() {
$( '#overlay' ).show();
},
success: function( response ) {
$( '#overlay' ).hide();
data = jQuery.parseJSON( response );
if ( data.status == 'ok' ) {
$( '#table-products tbody' ).html( data.html );
$( '.pagination .previous' ).attr( 'page', ( current_page - 1 > 1 ) ? ( current_page - 1 ) : 1 );
$( '.pagination .next' ).attr( 'page', ( current_page + 1 < pagination_max ) ? ( current_page + 1 ) : pagination_max );
$( '.pagination span' ).html( current_page );
if ( data.pagination_max ) {
$( '.pagination' ).attr( 'pagination_max', data.pagination_max );
$( '.pagination #max_page' ).html( data.pagination_max );
$( '.pagination .last' ).attr( 'page', data.pagination_max );
}
}
}
});
}
</script>

View File

@@ -0,0 +1,70 @@
<script type="text/javascript" src="/libraries/framework/vendor/plugins/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/libraries/framework/vendor/plugins/ckeditor/adapters/jquery.js"></script>
<?php
global $db;
ob_start();
if ( \S::is_array_fix( $this -> product -> permutations ) )
{
foreach ( $this -> product -> permutations as $permutation )
{
?>
<div class="form-group row">
<label class="col-lg-4 control-label default-value">
<?
$data = explode( '_', $permutation );
foreach ( $data as $row )
{
echo \shop\ProductAttribute::getAttributeNameByValue( $row, \front\factory\Languages::default_language()) . ': <span class="text-muted">' . \shop\ProductAttribute::getValueName( $row, \front\factory\Languages::default_language() ) . '</span>';
if ( $row !== end( $data ) )
echo ' | ';
}
echo '</label>';
echo '<div class="col-lg-8">';
echo '<input type="text" class="form-control" name="permutation_' . $permutation . '" value="' . \shop\Product::getPermutationQuantity( $this -> product -> id, $permutation ) . '">';
echo '</div>';
echo '</div>';
}
}
else
{
echo '<div class="form-group row">';
echo ' <label class="col-lg-4 control-label default-value">Produkt bez atrybutów (lub z 1 atrybutem i jedną wartością):</label>';
echo '<div class="col-lg-8">';
echo '<input type="text" class="form-control" name="permutation_0" value="' . \admin\factory\ShopProduct::permutation_quantity( $this -> product -> id, 0 ) . '">';
echo '</div>';
echo '</div>';
}
?>
<?php
$out = ob_get_clean();
$grid = new \gridEdit();
$grid -> id = 'stock';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Stany magazynowe: <u>'.$this -> product -> language['name'].'</u>';
$grid -> fields = [
[
'db' => 'id',
'type' => 'hidden',
'value' => $this -> product -> id,
],
];
$grid -> actions = [
'save' => ['url' => '/admin/shop_product/stock_save/', 'back_url' => '/admin/shop_product/view_list/'],
'cancel' => ['url' => '/admin/shop_product/view_list/'],
];
$grid -> external_code = $out;
$grid -> persist_edit = true;
$grid -> id_param = 'id';
echo $grid -> draw();
?>
<script type="text/javascript">
$( function()
{
disable_menu();
});
</script>

View File

@@ -0,0 +1,22 @@
<? if ( is_array( $this -> categories ) ):?>
<ol>
<? foreach ( $this -> categories as $category ):?>
<li id="list_<?= $category[ 'id' ];?>" class="list_<?= $category[ 'id' ];?>" category="<?= $category[ 'id' ];?>">
<div class="context_0 content content_menu">
<span class="disclose"><span></span></span>
<? if ( !$category[ 'status' ] ) echo '<i class="fa fa-ban fa-lg text-danger" title="Kategoria nieaktywna"></i>';?>
<input type="checkbox" class="g-checkbox" name="<?= $this -> name ? $this -> name : 'categories[]';?>" value="<?= $category[ 'id' ];?>" <? if ( is_array( $this -> product_categories ) and in_array( $category[ 'id' ], $this -> product_categories ) ):?>checked="checked"<? endif;?> />
<b><?= $category[ 'languages' ][ $this -> dlang ][ 'title' ];?></b>
</div>
<?=
\Tpl::view( 'shop-product/subcategories-list', [
'categories' => \admin\factory\ShopCategory::subcategories( $category[ 'id' ] ),
'product_categories' => $this -> product_categories,
'dlang' => $this -> dlang,
'name' => $this -> name
] );
?>
</li>
<? endforeach;?>
</ol>
<? endif;?>

View File

@@ -0,0 +1,257 @@
<script type="text/javascript" src="/libraries/jquery/sortable/sortable.js"></script>
<?
global $db;
ob_start();
?>
<div id="settings-tabs">
<ul class="resp-tabs-list settings-tabs">
<li><i class="fa fa-wrench"></i>Ustawienia</li>
</ul>
<div class="resp-tabs-container settings-tabs">
<div>
<?=
\Html::input( [
'label' => 'Nazwa',
'name' => 'name',
'id' => 'name',
'value' => $this -> promotion['name']
] );
?>
<?=
\Html::input_switch( [
'label' => 'Aktywna',
'name' => 'status',
'checked' => $this -> promotion['status'] == 1 ? true : false
] );
?>
<?=
\Html::input_switch( [
'label' => 'Łącz z kuponami rabatowymi',
'name' => 'include_coupon',
'checked' => $this -> promotion['include_coupon'] == 1 ? true : false
] );
?>
<?=
\Html::input_switch( [
'label' => 'Uwzględnij produkty przecenione',
'name' => 'include_product_promo',
'checked' => $this -> promotion['include_product_promo'] == 1 ? true : false
] );
?>
<?=
\Html::select( [
'label' => 'Warunki promocji',
'id' => 'condition_type',
'name' => 'condition_type',
'values' => \shop\Promotion::$condition_type,
'value' => $this -> promotion['condition_type'],
] );
?>
<?=
\Html::select( [
'label' => 'Typ rabatu',
'id' => 'discount_type',
'name' => 'discount_type',
'values' => \shop\Promotion::$discount_type,
'value' => $this -> promotion['discount_type'],
] );
?>
<?= \Html::input( [
'label' => 'Min. ilość produktów z danej kategorii',
'class' => 'int-format',
'name' => 'min_product_count',
'id' => 'min_product_count',
'value' => $this -> promotion['min_product_count']
] );?>
<?= \Html::input( [
'label' => 'Cena najtańszego produktu',
'class' => 'number-format',
'name' => 'price_cheapest_product',
'id' => 'price_cheapest_product',
'value' => $this -> promotion['price_cheapest_product']
] );
?>
<?=
\Html::input( [
'label' => 'Wartość',
'class' => 'number-format',
'name' => 'amount',
'id' => 'amount',
'value' => $this -> promotion['amount']
] );
?>
<?=
\Html::input( [
'label' => 'Data do',
'class' => 'date',
'name' => 'date_to',
'id' => 'date_to',
'value' => $this -> promotion['date_to']
] );
?>
<div class="form-group row">
<label class="col-lg-4 control-label">Kategorie grupa I:</label>
<div class="col-lg-8">
<div class="menu_sortable">
<ol class="sortable" id="sortable">
<?
if ( is_array( $this -> categories ) )
{
foreach ( $this -> categories as $category )
{
?>
<li id="list_<?= $category[ 'id' ];?>" class="category_<?= $category[ 'id' ];?>" category="<?= $category[ 'id' ];?>">
<div class="context_0 content content_menu">
<span class="disclose"><span></span></span>
<? if ( !$category[ 'status' ] ) echo '<i class="fa fa-ban fa-lg text-danger" title="Kategoria nieaktywna"></i>';?>
<input type="checkbox" class="g-checkbox" name="categories[]" value="<?= $category[ 'id' ];?>" <? if ( is_array( json_decode( $this -> promotion['categories'] ) ) and in_array( $category[ 'id' ], json_decode( $this -> promotion['categories'] ) ) ):?>checked="checked"<? endif;?> />
<b><?= $category[ 'languages' ][ $this -> dlang ][ 'title' ];?></b>
</div>
<?=
\Tpl::view( 'shop-product/subcategories-list', [
'categories' => \admin\factory\ShopCategory::subcategories( $category[ 'id' ] ),
'product_categories' => json_decode( $this -> promotion['categories'] ),
'dlang' => $this -> dlang
] );
?>
</li>
<?
}
}
?>
</ol>
</div>
</div>
<div class="clear"></div>
</div>
<div class="form-group row">
<label class="col-lg-4 control-label">Kategoria grupa II:</label>
<div class="col-lg-8">
<div class="menu_sortable">
<ol class="sortable" id="sortable2">
<?
if ( is_array( $this -> categories ) )
{
foreach ( $this -> categories as $category )
{
?>
<li id="list_<?= $category[ 'id' ];?>" class="category_<?= $category[ 'id' ];?>" category="<?= $category[ 'id' ];?>">
<div class="context_0 content content_menu">
<span class="disclose"><span></span></span>
<? if ( !$category[ 'status' ] ) echo '<i class="fa fa-ban fa-lg text-danger" title="Kategoria nieaktywna"></i>';?>
<input type="checkbox" class="g-checkbox" name="condition_categories[]" value="<?= $category[ 'id' ];?>" <? if ( is_array( json_decode( $this -> promotion['condition_categories'] ) ) and in_array( $category[ 'id' ], json_decode( $this -> promotion['condition_categories'] ) ) ):?>checked="checked"<? endif;?> />
<b><?= $category[ 'languages' ][ $this -> dlang ][ 'title' ];?></b>
</div>
<?=
\Tpl::view( 'shop-product/subcategories-list', [
'categories' => \admin\factory\ShopCategory::subcategories( $category[ 'id' ] ),
'product_categories' => json_decode( $this -> promotion['condition_categories'] ),
'dlang' => $this -> dlang,
'name' => 'condition_categories[]'
] );
?>
</li>
<?
}
}
?>
</ol>
</div>
</div>
</div>
</div>
</div>
</div>
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'promotion-edit';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = $this -> promotion['id'] ? 'Edycja promocji: <u>' . $this -> promotion['name'] . '</u>' : 'Nowa promocja';
$grid -> fields = [
[
'db' => 'id',
'type' => 'hidden',
'value' => $this -> promotion['id']
]
];
$grid -> actions = [
'save' => [ 'url' => '/admin/shop_promotion/save/', 'back_url' => '/admin/shop_promotion/view_list/' ],
'cancel' => [ 'url' => '/admin/shop_promotion/view_list/' ]
];
$grid -> external_code = $out;
$grid -> persist_edit = true;
$grid -> id_param = 'id';
echo $grid -> draw();
?>
<link type="text/css" rel="stylesheet" href="/libraries/selectize/css/selectize.css">
<link type="text/css" rel="stylesheet" href="/libraries/selectize/css/selectize.default.css">
<script type="text/javascript" src="/libraries/plupload/jquery.plupload.queue/jquery.plupload.queue.js"></script>
<script type="text/javascript" src="/libraries/jquery-nested-sortable/jquery.mjs.nestedSortable.js"></script>
<script type="text/javascript" src="/libraries/selectize/js/standalone/selectize.js"></script>
<script type="text/javascript">
function condition_type_change()
{
if ( $( '#condition_type' ).val() == 1 || $( '#condition_type' ).val() == 2 )
{
$( '#discount_type' ).closest( '.row' ).show();
$( '#amount' ).closest( '.row' ).show();
$( '#sortable2' ).closest( '.row' ).show();
$( '#min_product_count' ).closest( '.row' ).hide();
$( '#price_cheapest_product' ).closest( '.row' ).hide();
}
if ( $( '#condition_type' ).val() == 3 )
{
$( '#discount_type' ).closest( '.row' ).hide();
$( '#amount' ).closest( '.row' ).hide();
$( '#sortable2' ).closest( '.row' ).hide();
$( '#min_product_count' ).closest( '.row' ).show();
$( '#price_cheapest_product' ).closest( '.row' ).show();
}
}
$(function ()
{
condition_type_change();
$( 'body' ).on( 'change', '#condition_type', function()
{
condition_type_change();
});
disable_menu();
$('#settings-tabs').easyResponsiveTabs({
width: 'auto',
fit: true,
tabidentify: 'settings-tabs',
type: 'vertical'
});
$('ol.sortable').nestedSortable({
forcePlaceholderSize: true,
handle: 'div',
helper: 'clone',
items: 'li',
opacity: .9,
placeholder: 'placeholder',
revert: 250,
tabSize: 45,
tolerance: 'pointer',
toleranceElement: '> div',
maxLevels: 2,
isTree: true,
expandOnHover: 700,
protectRoot: false
});
$('.disclose').on('click', function ()
{
$(this).closest('li').toggleClass('sort-collapsed').toggleClass('sort-expanded');
});
});
</script>

View File

@@ -0,0 +1,59 @@
<?php
global $gdb;
$grid = new \grid( 'pp_shop_promotion' );
$grid -> gdb_opt = $gdb;
$grid -> debug = true;
$grid -> order = [ 'column' => 'id', 'type' => 'DESC' ];
$grid -> search = [
[ 'name' => 'Nazwa', 'db' => 'name', 'type' => 'text' ],
[ 'name' => 'Aktywny', 'db' => 'status', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ]
];
$grid -> columns_view = [
[
'name' => 'Lp.',
'th' => [ 'class' => 'g-lp' ],
'td' => [ 'class' => 'g-center' ],
'autoincrement' => true
], [
'name' => 'Aktywny',
'db' => 'status',
'replace' => [ 'array' => [ 0 => '<span style="color: #FF0000;">nie</span>', 1 => 'tak' ] ],
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
'sort' => true
], [
'name' => 'Nazwa',
'db' => 'name',
'sort' => true,
'php' => 'echo "<a href=\'/admin/shop_promotion/edit/id=[id]\'>[name]</a>";'
], [
'name' => 'Typ kuponu',
'db' => 'condition_type',
'replace' => [ 'array' => \shop\Promotion::$condition_type ]
], [
'name' => 'Data do',
'db' => 'date_to',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ]
], [
'name' => 'Edytuj',
'action' => [ 'type' => 'edit', 'url' => '/admin/shop_promotion/edit/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
], [
'name' => 'Usuń',
'action' => [ 'type' => 'delete', 'url' => '/admin/shop_promotion/promotion_delete/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
]
];
$grid -> buttons = [
[
'label' => 'Dodaj promocję',
'url' => '/admin/shop_promotion/edit/',
'icon' => 'fa-plus-circle',
'class' => 'btn-success'
]
];
echo $grid -> draw();

View File

@@ -0,0 +1,108 @@
<script type="text/javascript" src="/libraries/framework/vendor/plugins/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/libraries/framework/vendor/plugins/ckeditor/adapters/jquery.js"></script>
<?
global $db;
$apilo_status_types_list[''] = '--- wybierz status apilo.com ---';
foreach ( $this -> apilo_order_status_list as $apilo_status )
{
$apilo_status_types_list[ $apilo_status['id'] ] = $apilo_status['name'];
}
// statusy sellasist
$sellasist_status_types_list[''] = '--- wybierz status sellasist ---';
foreach ( $this -> sellasist_status_types_list as $sellasist_status )
{
$sellasist_status_types_list[ $sellasist_status['id'] ] = $sellasist_status['name'];
}
// baselinker order_status_list
$baselinker_order_status_list[''] = '--- wybierz status baselinker ---';
foreach ( $this -> baselinker_order_status_list as $baselinker_status )
{
$baselinker_order_status_list[ $baselinker_status['id'] ] = $baselinker_status['name'];
}
ob_start();
?>
<div id="settings-tabs">
<ul class="resp-tabs-list settings-tabs">
<li><i class="fa fa-file"></i>Ogólne</li>
</ul>
<div class="resp-tabs-container settings-tabs">
<div>
<?= \Html::input( [
'label' => 'Status',
'class' => 'require',
'name' => 'name',
'id' => 'name',
'readonly' => true,
'value' => $this -> status['status']
] );?>
<?= \Html::input( [
'label' => 'Kolor',
'name' => 'color',
'id' => 'color',
'value' => $this -> status['color']
] );?>
<?= \Html::select( [
'label' => 'Status z Apilo',
'name' => 'apilo_status_id',
'id' => 'apilo_status_id',
'values' => $apilo_status_types_list,
'value' => $this -> status['apilo_status_id']
] );?>
<!-- statust sellasist -->
<?= \Html::select( [
'label' => 'Status z Sellasist',
'name' => 'sellasist_status_id',
'id' => 'sellasist_status_id',
'values' => $sellasist_status_types_list,
'value' => $this -> status['sellasist_status_id']
] );?>
<!-- status baselinker -->
<?= \Html::select( [
'label' => 'Status z Baselinker',
'name' => 'baselinker_status_id',
'id' => 'baselinker_status_id',
'values' => $baselinker_order_status_list,
'value' => $this -> status['baselinker_status_id']
] );?>
</div>
</div>
</div>
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'status-edit';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Edycja statusu zamówienia';
$grid -> fields = [
[
'db' => 'id',
'type' => 'hidden',
'value' => $this -> status['id']
]
];
$grid -> actions = [
'save' => [ 'url' => '/admin/shop_statuses/status_save/', 'back_url' => '/admin/shop_statuses/view_list/' ],
'cancel' => [ 'url' => '/admin/shop_statuses/view_list/' ]
];
$grid -> external_code = $out;
$grid -> persist_edit = true;
$grid -> id_param = 'id';
echo $grid -> draw();
?>
<script type="text/javascript">
$( function()
{
disable_menu();
$( '#settings-tabs' ).easyResponsiveTabs({
width: 'auto',
fit: true,
tabidentify: 'settings-tabs',
type: 'vertical'
});
});
</script>

View File

@@ -0,0 +1,60 @@
<?php
global $gdb;
foreach ( $this -> apilo_order_status_list as $apilo_status )
{
$apilo_order_status_list[ $apilo_status['id'] ] = $apilo_status['name'];
}
// sellasist statuses
$sellasist_status_types_list = [];
foreach ( $this -> sellasist_order_status_list as $sellasist_status )
{
$sellasist_order_status_list[ $sellasist_status['id'] ] = $sellasist_status['name'];
}
// baselinker order_status_list
$baselinker_order_status_list = [];
foreach ( $this -> baselinker_order_status_list as $baselinker_status )
{
$baselinker_order_status_list[ $baselinker_status['id'] ] = $baselinker_status['name'];
}
$grid = new \grid( 'pp_shop_statuses' );
$grid -> gdb_opt = $gdb;
$grid -> debug = true;
$grid -> order = [ 'column' => 'o', 'type' => 'ASC' ];
$grid -> search = [
[ 'name' => 'Status', 'db' => 'status', 'type' => 'text' ]
];
$grid -> columns_view = [
[
'name' => 'Lp.',
'th' => [ 'class' => 'g-lp' ],
'td' => [ 'class' => 'g-center' ],
'autoincrement' => true
], [
'name' => 'Status',
'db' => 'status'
], [
'name' => 'Kolor',
'db' => 'color'
], [
'name' => 'Status Apilo',
'db' => 'apilo_status_id',
'replace' => [ 'array' => $apilo_order_status_list ],
], [
'name' => 'Status Sellasist',
'db' => 'sellasist_status_id',
'replace' => [ 'array' => $sellasist_order_status_list ],
], [
'name' => 'Status Baselinker',
'db' => 'baselinker_status_id',
'replace' => [ 'array' => $baselinker_order_status_list ],
], [
'name' => 'Edytuj',
'action' => [ 'type' => 'edit', 'url' => '/admin/shop_statuses/status_edit/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
]
];
echo $grid -> draw();

View File

@@ -0,0 +1,153 @@
<script type="text/javascript" src="/libraries/framework/vendor/plugins/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/libraries/framework/vendor/plugins/ckeditor/adapters/jquery.js"></script>
<?
global $db;
$carrier_accounts[''] = '--- wybierz konto przewoźnika ---';
foreach ( $this -> apilo_carrier_account_list as $carrier_account )
{
$carrier_accounts[ $carrier_account['id'] ] = $carrier_account['name'];
}
// sellasist_shipments_methods
$sellasist_shipments_methods[''] = '--- wybierz metodę wysyłki ---';
foreach ( $this -> sellasist_shipments_methods as $sellasist_shipments_method )
{
$sellasist_shipments_methods[ $sellasist_shipments_method['id'] ] = $sellasist_shipments_method['title'];
}
ob_start();
?>
<div id="settings-tabs">
<ul class="resp-tabs-list settings-tabs">
<li><i class="fa fa-file"></i>Ogólne</li>
<li><i class="fa fa-wrench"></i>Powiązane metody płatności</li>
</ul>
<div class="resp-tabs-container settings-tabs">
<div>
<?= \Html::input(
array(
'label' => 'Nazwa',
'class' => 'require',
'name' => 'name',
'id' => 'name',
'readonly' => true,
'value' => $this -> transport_details['name']
)
);?>
<?= \Html::input(
array(
'label' => 'Nazwa widoczna',
'name' => 'name_visible',
'id' => 'name_visible',
'value' => $this -> transport_details['name_visible']
)
);?>
<?= \Html::input(
array(
'label' => 'Opis',
'name' => 'description',
'id' => 'description',
'value' => $this -> transport_details['description']
)
);?>
<?= \Html::input(
array(
'label' => 'Koszt (PLN)',
'class' => 'number-format require',
'name' => 'cost',
'id' => 'cost',
'value' => $this -> transport_details['cost']
)
);?>
<?= \Html::input(
array(
'label' => 'Maks. WP',
'class' => 'number-format require',
'name' => 'max_wp',
'id' => 'max_wp',
'value' => $this -> transport_details['max_wp']
)
);?>
<?= \Html::input_switch( [
'label' => 'Domyślna forma dostawy',
'name' => 'default',
'checked' => $this -> transport_details['default'] == 1 ? true : false
] );?>
<?= \Html::input_switch(
array(
'label' => 'Aktywny',
'name' => 'status',
'checked' => $this -> transport_details['status'] == 1 ? true : false
)
);?>
<?= \Html::input_switch( [
'label' => 'Darmowa dostawa',
'name' => 'delivery_free',
'checked' => $this -> transport_details['delivery_free'] == 1 ? true : false
] );?>
<?= \Html::select( [
'label' => 'Kurier z Apilo',
'name' => 'apilo_carrier_account_id',
'id' => 'apilo_carrier_account_id',
'values' => $carrier_accounts,
'value' => $this -> transport_details['apilo_carrier_account_id']
] );?>
<!-- sellasist_shipments_methods -->
<?= \Html::select( [
'label' => 'Metoda wysyłki z Sellasist',
'name' => 'sellasist_shipment_method_id',
'id' => 'sellasist_shipment_method_id',
'values' => $sellasist_shipments_methods,
'value' => $this -> transport_details['sellasist_shipment_method_id']
] );?>
</div>
<div>
<? if ( is_array( $this -> payments_list ) ): foreach ( $this -> payments_list as $payment_method ):?>
<div class="form-group">
<div class="col-lg-12">
<div class="list">
<input type="checkbox" class="g-checkbox" name="payment_methods[]" value="<?= $payment_method['id'];?>" <? if ( in_array( $payment_method['id'], $this -> transport_details['payment_methods'] ) ):?>checked="checked"<? endif;?> />
<span class="bold <? if ( !$payment_method['status'] ):?>text-muted<? endif;?>"><?= $payment_method['name'];?></span>
</div>
</div>
</div>
<? endforeach; endif;?>
</div>
</div>
</div>
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'transport-edit';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Edycja rodzaju transportu';
$grid -> fields = [
[
'db' => 'id',
'type' => 'hidden',
'value' => $this -> transport_details['id']
]
];
$grid -> actions = [
'save' => [ 'url' => '/admin/shop_transport/transport_save/', 'back_url' => '/admin/shop_transport/view_list/' ],
'cancel' => [ 'url' => '/admin/shop_transport/view_list/' ]
];
$grid -> external_code = $out;
$grid -> persist_edit = true;
$grid -> id_param = 'id';
echo $grid -> draw();
?>
<script type="text/javascript">
$( function()
{
disable_menu();
$( '#settings-tabs' ).easyResponsiveTabs({
width: 'auto',
fit: true,
tabidentify: 'settings-tabs',
type: 'vertical'
});
});
</script>

View File

@@ -0,0 +1,83 @@
<?php
global $gdb;
foreach ( $this -> apilo_carrier_account_list as $carrier_account )
{
$carrier_accounts[ $carrier_account['id'] ] = $carrier_account['name'];
}
// sellasist_shipments_methods
$sellasist_shipments_methods = [];
foreach ( $this -> sellasist_shipments_methods as $sellasist_shipments_method )
{
$sellasist_shipments_methods[ $sellasist_shipments_method['id'] ] = $sellasist_shipments_method['title'];
}
$grid = new \grid( 'pp_shop_transports' );
$grid -> gdb_opt = $gdb;
$grid -> debug = true;
$grid -> order = [ 'column' => 'name', 'type' => 'ASC' ];
$grid -> search = [
[ 'name' => 'Nazwa', 'db' => 'name', 'type' => 'text' ],
[ 'name' => 'Aktywny', 'db' => 'status', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ]
];
$grid -> columns_view = [
[
'name' => 'Lp.',
'th' => [ 'class' => 'g-lp' ],
'td' => [ 'class' => 'g-center' ],
'autoincrement' => true
], [
'name' => 'Domyślna FT',
'db' => 'default',
'replace' => [ 'array' => [ 0 => '<span style="color: #FF0000;">nie</span>', 1 => 'tak' ] ],
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
'sort' => true
], [
'name' => 'Aktywny',
'db' => 'status',
'replace' => [ 'array' => [ 0 => '<span style="color: #FF0000;">nie</span>', 1 => 'tak' ] ],
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
'sort' => true
],
[
'name' => 'Koszt',
'db' => 'cost',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
'php' => 'echo \\S::decimal( [cost] ) . " zł";',
'sort' => true
],
[
'name' => 'Maks. WP',
'db' => 'max_wp',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
'sort' => true
],
[
'name' => 'Nazwa',
'db' => 'name',
'sort' => true,
'php' => 'echo "<a href=\'/admin/shop_transport/transport_edit/id=[id]\'>[name]</a>";'
], [
'name' => 'Typ kuriera Apilo',
'db' => 'apilo_carrier_account_id',
'th' => [ 'class' => 'g-center' ],
'td' => [ 'class' => 'g-center' ],
'replace' => [ 'array' => $carrier_accounts ],
], [
'name' => 'Typ kuriera Sellasist',
'db' => 'sellasist_shipment_method_id',
'th' => [ 'class' => 'g-center' ],
'td' => [ 'class' => 'g-center' ],
'replace' => [ 'array' => $sellasist_shipments_methods ],
], [
'name' => 'Edytuj',
'action' => [ 'type' => 'edit', 'url' => '/admin/shop_transport/transport_edit/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
]
];
echo $grid -> draw();

View File

@@ -0,0 +1,232 @@
<? global $user, $settings;?>
<!DOCTYPE html>
<html>
<head>
<title>shopPro</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="www.project-pro.pl - internetowe rozwiązania dla biznesu">
<link rel='stylesheet' type="text/css" href='https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700'>
<link rel="stylesheet" type="text/css" href="/libraries/framework/skin/default_skin/css/theme.css">
<link rel="stylesheet" type="text/css" href="/libraries/framework/vendor/plugins/magnific/magnific-popup.css">
<link rel="stylesheet" type="text/css" href="/libraries/framework/vendor/plugins/datepicker/css/bootstrap-datetimepicker.css">
<link rel="stylesheet" type="text/css" href="/libraries/framework/vendor/jquery/jquery_ui/jquery-ui.structure.min.css">
<link rel="stylesheet" type="text/css" href="/libraries/framework/vendor/jquery/jquery_ui/jquery-ui.theme.min.css">
<link rel="stylesheet" type="text/css" href="/libraries/framework/vendor/plugins/daterange/daterangepicker.css">
<link rel="stylesheet" type="text/css" href="/libraries/jquery-confirm/jquery-confirm.min.css">
<link rel="stylesheet" type="text/css" href="/libraries/easy-tabs/css/easy-responsive-tabs.css">
<link rel="stylesheet" type="text/css" href="/libraries/bootstrap-4.5.2-dist/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="/libraries/font-awesome-4.7.0/css/font-awesome.css">
<link rel="stylesheet" type="text/css" href="/libraries/grid/plugins/icheck/skins/square/blue.css">
<script type="text/javascript" src="/libraries/framework/vendor/jquery/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="/libraries/framework/vendor/jquery/jquery_ui/jquery-ui.min.js"></script>
<script type="text/javascript" src="/libraries/framework/js/utility/utility.js"></script>
<script type="text/javascript" src="/libraries/framework/vendor/plugins/magnific/jquery.magnific-popup.js"></script>
<script type="text/javascript" src="/libraries/easy-tabs/js/easyResponsiveTabs.js"></script>
<script type="text/javascript" src="/libraries/framework/vendor/plugins/moment/moment.js"></script>
<script type="text/javascript" src="/libraries/framework/vendor/plugins/moment/pl.js"></script>
<script type="text/javascript" src="/libraries/framework/vendor/plugins/datepicker/js/bootstrap-datetimepicker.js"></script>
<script type="text/javascript" src="/libraries/framework/vendor/plugins/daterange/daterangepicker.js"></script>
<script type="text/javascript" src="/libraries/jquery-confirm/jquery-confirm.min.js"></script>
<script type="text/javascript" src="/libraries/bootstrap-4.5.2-dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/libraries/bootstrap-4.5.2-dist/js/bootstrap.bundle.min.js"></script>
<script type="text/javascript" src="/libraries/grid/plugins/icheck/icheck.js"></script>
<script type="text/javascript" src="/libraries/functions.js"></script>
<script type="text/javascript" src="/admin/js/functions.js"></script>
<link rel="stylesheet" href="/admin/layout/style-css/style.css" />
</head>
<body>
<div class="admin-page">
<div class="menu">
<div class="logo sticky-top">
shop<b>Pro</b>
<span>ver. <?= \S::get_version();?></span><br>
<? if ( $settings[ 'update' ] and \S::get_new_version() > \S::get_version() ):?>
<a href="/admin/update/main_view/" class="label label-danger">aktualizacja</a>
<? endif;?>
</div>
<div class="menu-content">
<ul>
<li><a href="/admin/dashboard/main_view/"><img src="/admin/layout/icon/icon-menu/bxs-dashboard.svg">Pulpit</a></li>
</ul>
<div class="title">
Sklep
</div>
<ul>
<li> <a href="/admin/shop_order/view_list/"><img src="/admin/layout/icon/icon-menu/shopping-cart.svg">Zamówienia</a></li>
<li> <a href="/admin/shop_clients/view_list/"><img src="/admin/layout/icon/icon-menu/people-fill.svg">Klienci</a></li>
<li><a href="/admin/shop_category/view_list/"><img src="/admin/layout/icon/icon-menu/bxs-category-alt.svg">Kategorie</a></li>
<li><a href="/admin/shop_product/view_list/"><img src="/admin/layout/icon/icon-menu/shopping-basket.svg">Produkty</a></li>
<li><a href="/admin/shop_product/mass_edit/"><i class="fa fa-bars"></i>Masowa edycja</a></li>
<li>
<a href="/admin/shop_producer/list/">
<i class="fa fa-user"></i>Producenci
</a>
</li>
<li>
<a href="/admin/shop_product_sets/view_list/">
<i class="fa fa-bars"></i>Komplety Produktów
</a>
</li>
<li><a href="/admin/shop_attribute/view_list/"><img src="/admin/layout/icon/icon-menu/star-filled.svg">Cechy produktów</a></li>
<li><a href="/admin/shop_transport/view_list/"><img src="/admin/layout/icon/icon-menu/bus.svg">Rodzaje transportu</a></li>
<li><a href="/admin/shop_payment_method/view_list/"><img src="/admin/layout/icon/icon-menu/coins-fill.svg">Metody płatności</a></li>
<li>
<a href="/admin/shop_statuses/view_list/"><i class="fa fa-bars"></i>Statusy zamówień</a>
</li>
<li><a href="/admin/shop_coupon/view_list/"><img src="/admin/layout/icon/icon-menu/piggy-bank-coins.svg">Kody rabatowe</a></li>
<li><a href="/admin/shop_promotion/view_list/"><img src="/admin/layout/icon/icon-menu/burst-sale.svg">Promocje</a></li>
</ul>
<div class="title">Zawartość</div>
<ul>
<li><a href="/admin/pages/view_list/"><img src="/admin/layout/icon/icon-menu/menu(1).svg">Konfiguracja menu</a></li>
<li><a href="/admin/articles/view_list/"><img src="/admin/layout/icon/icon-menu/note.svg">Artykuły</a></li>
<li><a href="/admin/articles_archive/view_list/"><img src="/admin/layout/icon/icon-menu/baseline-sticky-note-2.svg">Archiwum artykułów</a></li>
<li><a href="/admin/scontainers/view_list/"><img src="/admin/layout/icon/icon-menu/view-cols.svg">Zawartość statyczna</a></li>
</ul>
<div class="title">
Newsletter
</div>
<ul>
<li><a href="/admin/newsletter/prepare/"><img src="/admin/layout/icon/icon-menu/package(1).svg">Wysyłka - przygotowanie</a></li>
<li><a href="/admin/newsletter/emails_list/"><img src="/admin/layout/icon/icon-menu/bx-at.svg">Baza emaili</a></li>
<li><a href="/admin/newsletter/email_templates_user/"><img src="/admin/layout/icon/icon-menu/template(1).svg">Szablony użytkownika</a></li>
<li><a href="/admin/newsletter/email_templates_admin/"><img src="/admin/layout/icon/icon-menu/template.svg">Szablony administracyjne</a></li>
<li><a href="/admin/newsletter/settings/"><img src="/admin/layout/icon/icon-menu/baseline-settings.svg">Ustawienia</a></li>
</ul>
<div class="title">
Pozostałe
</div>
<ul>
<li><a href="/admin/filemanager/draw/"><img src="/admin/layout/icon/icon-menu/file-image-outlined.svg">Manadżer plików</a></li>
<li><a href="/admin/banners/view_list/"><img src="/admin/layout/icon/icon-menu/photo-video.svg">Banery</a></li>
</ul>
<div class="title">
Konfiguracja
</div>
<ul>
<li><a href="/admin/users/view_list/"><img src="/admin/layout/icon/icon-menu/people-fill.svg">Użytkownicy</a></li>
<li><a href="/admin/languages/view_list/"><img src="/admin/layout/icon/icon-menu/letter-aa.svg">Jęzki</a></li>
<li><a href="/admin/languages/translation_list/"><img src="/admin/layout/icon/icon-menu/language.svg">Tłumaczenia</a></li>
<li><a href="/admin/settings/view/"><img src="/admin/layout/icon/icon-menu/baseline-settings.svg">Ustawienia</a></li>
<li><a href="/admin/layouts/view_list/"><img src="/admin/layout/icon/icon-menu/calendar-settings.svg">Szablony</a></li>
</ul>
<div class="title">
Słowniki
</div>
<ul>
<li>
<a href="/admin/dictionaries/view_list/">
<i class="fa fa-puzzle-piece" aria-hidden="true"></i>Jednostki miary
</a>
</li>
</ul>
<div class="title">
Archiwum
</div>
<ul>
<li>
<a href="/admin/archive/products_list/">
<i class="fa fa-trash" aria-hidden="true"></i>Produkty
</a>
</li>
</ul>
<div class="title">
Integracje
</div>
<ul>
<li>
<a href="/admin/integrations/sellasist_settings/">
<i class="fa fa-cogs" aria-hidden="true"></i>sellasist.pl
</a>
</li>
<li>
<a href="/admin/integrations/apilo_settings/">
<i class="fa fa-cogs" aria-hidden="true"></i>apilo.com
</a>
</li>
<li>
<a href="/admin/integrations/baselinker_settings/">
<i class="fa fa-cogs" aria-hidden="true"></i>baselinker.com
</a>
</li>
<li>
<a href="/admin/integrations/shoppro_settings/">
<i class="fa fa-cogs" aria-hidden="true"></i>shopPRO
</a>
</li>
</ul>
</div>
<div class="preview">
<a href="/" target="_blank"><img src="/admin/layout/icon/icon-menu/chevrons-right.svg">Podgląd</a>
</div>
</div>
<div class="mobile-menu-btn" id="mobile-menu-btn">
<i class="fa fa-bars"></i>
</div>
<div class="site-content">
<div class="container-fluid">
<div class="row">
<div class="col-12 top-user">
<div class="dropdown">
<?
if ( $user[ 'name' ] or $user[ 'surname' ] )
echo $user[ 'surname' ] . ' ' . $user[ 'name' ];
else
echo $user[ 'login' ];
?>
<img src="/admin/layout/icon/user-avatar-filled.svg" alt="avatar" >
<div class="dropdown-content">
<a href="/admin/?s-action=user-logout"><span class="fa fa-power-off"></span>Wyloguj się</a>
</div>
</div>
</div>
</div>
<?
if ( $alert = \S::get_session( 'alert' ) ):
\S::alert( false );
?>
<div class="row">
<div class=" col-12">
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<i class="fa fa-info pr10"></i>
<?= $alert;?>
</div>
</div>
</div>
<? endif;?>
<div class="row">
<div class="col-12 dashboard-page">
<?= $this -> content;?>
</div>
</div>
</div>
</div>
</div>
<script class="footer" type="text/javascript">
$(document).ready(function () {
var user_agent = navigator.userAgent.toLowerCase();
var click_event = user_agent.match(/(iphone|ipod|ipad)/) ? "touchend" : "click";
$('body').on(click_event, '#mobile-menu-btn', function ()
{
if ($(this).hasClass('active'))
{
$(this).removeClass('active');
$( '.menu' ).removeClass( 'visible' );
$( '#mobile-menu-btn i' ).addClass( 'fa-bars' ).removeClass( 'fa-times' );
$( '.site-content' ).removeClass( 'with-menu' );
}
else
{
$(this).addClass('active');
$( '.menu' ).addClass( 'visible' );
$( '.site-content' ).addClass( 'with-menu' );
$( '#mobile-menu-btn i' ).addClass( 'fa-times' ).removeClass( 'fa-bars' );
}
});
});
</script>
</body>
</html>

View File

@@ -0,0 +1,85 @@
<!DOCTYPE html>
<html>
<head>
<title>shopPro</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="www.project-pro.pl - internetowe rozwiązania dla biznesu">
<link rel="stylesheet" type="text/css" href="/libraries/bootstrap-4.5.2-dist/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="/libraries/font-awesome-4.7.0/css/font-awesome.css">
<link rel="stylesheet" href="/admin/layout/style-css/style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript" src="/libraries/bootstrap-4.5.2-dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/libraries/bootstrap-4.5.2-dist/js/bootstrap.bundle.min.js"></script>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,600;0,700;0,800;1,300;1,400;1,600;1,700;1,800&display=swap" rel="stylesheet">
</head>
<body>
<div id="main">
<div class="container-fluid">
<div class="row">
<div class="col-sm-8 col-md-6 col-lg-4 unlogged-panel">
<div class="login-panel">
<div class="login-panel-content">
<div class="login-shoppro">
shop<b>Pro</b>
</div>
<div class="title">
Witaj ponownie!
</div>
<div class="subtitle">
Zaloguj się do panelu administratora <b>shopPro</b>.
</div>
<?
if ( $alert = \S::get_session( 'alert' ) ):
\S::alert( false );
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<i class="icon fa fa-ban "></i><?= $alert;?>
</div>
<? endif;
?>
<form method="POST" action="/admin/" class="form-horizontal" rol="form">
<input type="hidden" name="s-action" value="user-logon" />
<div class="form-group form-inline row">
<div class="col-12">
<div class="input-group input-login">
<div class="input-group-prepend">
<span class="input-group-text icon"> <i class="fa fa-user"></i></span>
</div>
<input type="text" name="login" id="login" class="form-control"/>
</div>
</div>
</div>
<div class="form-group form-inline row">
<div class="col-12">
<div class="input-group input-password">
<div class="input-group-prepend">
<span class="input-group-text icon"><i class="fa fa-lock"></i></span>
</div>
<input type="password" name="password" id="password" class="form-control"/>
</div>
</div>
</div>
<div class="sumbit">
<button class="btn">Zaloguj się</button>
</div>
</form>
<div class="copyright">
<a href="https://www.project-pro.pl/"> &copy; <?= date( 'Y' );?> Project-Pro</a>
</div>
</div>
</div>
</div>
<div class="col-sm-4 col-md-6 col-lg-8 unlogged-bg">
</div>
</div>
</div>
<div class="home">
<a href="/"><img src="/admin/layout/images/home.svg" alt="HOME"></a>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,178 @@
<?
global $db;
ob_start();
?>
<?= \Html::form_text(
array(
'label' => 'Twoja wersja systemu',
'id' => 'ver',
'text' => $this -> ver
)
);?>
<?= \Html::form_text(
array(
'label' => 'Aktualna wersja systemu',
'text' => $this -> new_ver,
'id' => 'new_ver'
)
);?>
<?
$ver_new = $this->new_ver;
$ver= $this->ver;
$valuemax = ($ver_new - $ver)*1000;
?>
<div class="progress-box hidden">
<div class="version">
<h3> Aktualizacja <p class="version_curent">0</p> / <p class="version_diff">0</p></h3>
</div>
<div class="progress ">
<div class="progress-bar progress-bar-info progress-bar-striped active" role="progressbar"
accesskey=""aria-valuenow="" aria-valuemin="0" aria-valuemax="<?=$valuemax?>" style="width:">
</div>
</div>
</div>
<div class="row">
<? if ( $this -> ver < $this -> new_ver ):?>
<div class="form-group col-lg-6 text-right">
<div class="">
<a href="#" class="btn btn-system btn-sm mb5" id="confirm">Aktualizuj do wyższej wersji</a>
</div>
</div>
<? endif;?>
<? if ( $this -> ver < $this -> new_ver ):?>
<div class="form-group col-lg-6">
<div class="">
<a href="#" class="btn btn-system btn-sm mb5" id="confirmUpdateAll">Aktualizuj do najwyższej wersji</a>
</div>
</div>
<? endif;?>
</div>
<? if ( $this -> ver < $this -> new_ver ):?>
<div class="text-danger text-center">* Przed aktualizacją systemu zalecane jest wykonanie pełnej kopii zapasowej.</div>
<div class="clear"></div>
<?endif;?>
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'update-view';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Aktualizacja systemu';
$grid -> default_buttons = false;
$grid -> external_code = $out;
echo $grid -> draw();
?>
<?
ob_start();
echo $versions = file_get_contents( 'http://www.shoppro.project-dc.pl/updates/changelog.php' );
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'changelog';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Changelog';
$grid -> default_buttons = false;
$grid -> external_code = $out;
echo $grid -> draw();
?>
<script type="text/javascript">
var version_current = <?= $this -> ver;?>;
var version_new = <?= $this -> new_ver;?>;
var version_diff = Math.round((version_new - version_current )* 1000);
var width = 0;
var ac_lp = 0;
$( document ).ready( function()
{
$( 'body' ).on( 'click', '#confirm', function()
{
$.prompt( 'Na pewno chcesz dokonać aktualizacji systemu?',
{
title: 'Potwierdź?',
submit: function(e,v,m,f)
{
if ( v == true )
document.location.href = '/admin/update/update/';
},
buttons: {
'tak': true, 'nie': false
},
focus: 1
});
});
$( 'body' ).on( 'click', '#confirmUpdateAll', function()
{
$.prompt( 'Na pewno chcesz dokonać aktualizacji systemu?',
{
title: 'Potwierdź?',
submit: function(e,v,m,f)
{
if ( v == true )
{
$('.progress-box').removeClass('hidden');
$('#confirm').css('pointer-events','none');
$('#confirmUpdateAll').css('pointer-events','none');
$('.version_diff').html(version_diff);
updateAll( version_current, version_new, version_diff, width, ac_lp);
}
},
buttons: {
'tak': true, 'nie': false
}
});
});
});
function updateAll( version_current, version_new, version_diff, width, ac_lp)
{
$.ajax(
{
url: '/admin/update/updateAll/',
type: 'POST',
data:
{
version_current: version_current
},
success: function( data )
{
response = jQuery.parseJSON( data );
if ( response.status == true )
{
ac_lp = ac_lp + 1;
$('.version_curent').html(ac_lp);
width = width + ((1/version_diff)*100);
$('.progress-bar').attr("style", "width:"+ width +"%");
if( response.version < version_new )
{
updateAll( response.version, version_new, version_diff, width, ac_lp );
}
else
{
$.prompt( "Aktualizacja przebiegła pomyślnie.",
{
title: 'Informacja',
close: function(e,v,m,f){
window.location.href ="/admin/update/main_view/";
}
});
}
}
else
{
$.prompt( "W trakcie aktualizacji systemu wystąpił błąd. Proszę spróbować ponownie." ,
{
title: 'Błąd',
close: function(e,v,m,f){
window.location.href ="/admin/update/main_view/";
}
});
}
}
}
);
};
</script>

View File

@@ -0,0 +1,81 @@
<?php
global $gdb, $config;
$this -> user['id'] ? $password_param = 'optional' : $password_param = 'require';
$grid = new \gridEdit;
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Zapisz użytkownika';
$grid -> fields = [
[
'db' => 'id',
'type' => 'hidden',
'value' => $this -> user['id']
],
[
'db' => 'admin',
'type' => 'hidden',
'value' => '1'
],
[
'name' => 'Login',
'db' => 'login',
'type' => 'text',
'value' => $this -> user['login'],
'params' => [ 'class' => 'require', 'function' => 'check_login' ]
],
[
'name' => 'Aktywny',
'db' => 'status',
'type' => 'input_switch',
'checked' => $this -> user['status'] ? true : false
],
[
'name' => 'Hasło',
'db' => 'password',
'type' => 'text',
'params' => [ 'class' => $password_param, 'min' => 5 ]
],
[
'name' => 'Hasło - powtórz',
'db' => 'password_re',
'type' => 'text',
'params' => [ 'class' => $password_param, 'min' => 5, 'equal' => 'password', 'error_txt' => 'Podane hasła są różne' ]
]
];
$grid -> actions = [
'save' => [ 'url' => '/admin/users/user_save/', 'back_url' => '/admin/users/view_list/' ],
'cancel' => [ 'url' => '/admin/users/view_list/' ]
];
echo $grid -> draw();
?>
<script type="text/javascript">
$( function()
{
disable_menu();
});
function check_login()
{
var response = null;
$.ajax({
type: 'POST',
cache: false,
async: false,
url: '/admin/ajax.php',
data:
{
a: 'check_login',
login: $.trim( $( '#login' ).val() ),
user_id: <?= (int)$this -> user['id'];?>
},
success: function( data )
{
response = $.parseJSON( data );
}
});
return response;
}
</script>

View File

@@ -0,0 +1,47 @@
<?php
global $gdb;
$grid = new \grid( 'pp_users' );
$grid -> gdb_opt = $gdb;
$grid -> order = [ 'column' => 'login', 'type' => 'ASC' ];
$grid -> where = [ 'id[!]' => 1 ];
$grid -> search = [
[ 'name' => 'Login', 'db' => 'login', 'type' => 'text' ],
[ 'name' => 'Aktywny', 'db' => 'status', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ]
];
$grid -> columns_view = [
[
'name' => 'Lp.',
'th' => [ 'class' => 'g-lp' ],
'td' => [ 'class' => 'g-center' ],
'autoincrement' => true
],
[
'name' => 'Aktywny',
'db' => 'status',
'replace' => [ 'array' => [ 0 => '<span style="color: #FF0000;">nie</span>', 1 => 'tak' ] ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
'td' => [ 'class' => 'g-center' ]
],
[
'name' => 'Login',
'db' => 'login',
'sort' => true
],
[
'name' => 'Edytuj',
'action' => [ 'type' => 'edit', 'url' => '/admin/users/user_edit/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 50px;' ],
'td' => [ 'class' => 'g-center' ]
],
[
'name' => 'Usuń',
'action' => [ 'type' => 'delete', 'url' => '/admin/users/user_delete/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 50px;' ],
'td' => [ 'class' => 'g-center' ]
]
];
$grid -> buttons = [
[ 'label' => 'Dodaj użytkownika', 'url' => '/admin/users/user_edit/', 'icon' => 'fa-plus-circle', 'class' => 'btn-success' ]
];
echo $grid -> draw();