first commit
This commit is contained in:
151
admin/templates/shop-coupon/coupon-edit.php
Normal file
151
admin/templates/shop-coupon/coupon-edit.php
Normal 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>
|
||||
83
admin/templates/shop-coupon/view-list.php
Normal file
83
admin/templates/shop-coupon/view-list.php
Normal 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();
|
||||
Reference in New Issue
Block a user