- Added styling for input group add-ons and additional fields in SCSS. - Updated shop coupon view to include a new column for usage count. - Display coupon code and amount in order details if applicable. - Improved product edit template to handle custom fields with required validation. - Modified product save logic to include custom field requirements. - Enhanced decimal normalization function for better input handling. - Implemented checkbox normalization for form submissions. - Updated custom fields in product templates to reflect required status. - Fixed URL for fetching changelog updates.
88 lines
4.8 KiB
PHP
88 lines
4.8 KiB
PHP
<?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' => 'Użyto X razy',
|
|
'db' => 'used_count',
|
|
'td' => [ 'class' => 'g-center' ],
|
|
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
|
|
], [
|
|
'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(); |