first commit
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace KupShop\BonusProgramBundle\Admin\Actions;
|
||||
|
||||
use KupShop\AdminBundle\Admin\Actions\AbstractAction;
|
||||
use KupShop\AdminBundle\Admin\Actions\ActionResult;
|
||||
use KupShop\AdminBundle\Admin\Actions\IAction;
|
||||
use KupShop\AdminBundle\Util\ActivityLog;
|
||||
use KupShop\BonusProgramBundle\BonusProgramBundle;
|
||||
use Query\Operator;
|
||||
|
||||
class EditBonusPointsAction extends AbstractAction implements IAction
|
||||
{
|
||||
public function getTypes(): array
|
||||
{
|
||||
return ['users'];
|
||||
}
|
||||
|
||||
public function getName(): string
|
||||
{
|
||||
return translate('addOrRemovePoints', 'bonus_program');
|
||||
}
|
||||
|
||||
public function showInMassEdit()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function execute(&$data, array $config, string $type): ActionResult
|
||||
{
|
||||
$result = new ActionResult(true);
|
||||
$userId = $this->getId();
|
||||
|
||||
if (empty($config['bonusPoints'])) {
|
||||
return new ActionResult(false, translate('noPointsEntered', 'bonus_program'));
|
||||
}
|
||||
|
||||
$bonusPoints = $config['bonusPoints'];
|
||||
$adminNote = trim($config['adminNote']) == '' ? translate('notePlaceholder', 'bonus_program') : $config['adminNote'];
|
||||
$status = $config['status'] ?? 'active';
|
||||
|
||||
$newPoints = [
|
||||
'id_user' => $userId,
|
||||
'points' => $bonusPoints,
|
||||
'note' => $adminNote,
|
||||
'status' => $status,
|
||||
];
|
||||
|
||||
sqlQueryBuilder()
|
||||
->insert('bonus_points')
|
||||
->directValues($newPoints)
|
||||
->setValue('date_created', 'NOW()')
|
||||
->execute();
|
||||
|
||||
$userEmail = sqlQueryBuilder()
|
||||
->select('email')
|
||||
->from('users', 'u')
|
||||
->where(Operator::equals(['id' => $userId]))
|
||||
->execute()
|
||||
->fetchOne();
|
||||
|
||||
addActivityLog(
|
||||
ActivityLog::SEVERITY_NOTICE,
|
||||
ActivityLog::TYPE_CHANGE,
|
||||
sprintf('Provedena ruční úprava bodů u uživatele "%s": '.$bonusPoints, $userEmail ?? ''),
|
||||
$newPoints,
|
||||
[BonusProgramBundle::LOG_TAG_BONUS_PROGRAM]
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace KupShop\BonusProgramBundle\Admin;
|
||||
|
||||
class BonusProgramExchange extends \Window
|
||||
{
|
||||
protected $tableName = 'bonus_points_exchange';
|
||||
|
||||
public function get_vars()
|
||||
{
|
||||
$vars = parent::get_vars();
|
||||
|
||||
$vars['body']['data']['languages'] = json_decode($vars['body']['data']['languages'] ?? '', true) ?? [];
|
||||
|
||||
$this->unserializeCustomData($vars['body']['data']);
|
||||
|
||||
return $vars;
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$data = parent::getData();
|
||||
|
||||
if (getVal('Submit')) {
|
||||
$data['active'] = $data['active'] === 'Y' ? 1 : 0;
|
||||
$data['languages'] = json_encode($data['languages'] ?? []);
|
||||
$this->serializeCustomData($data);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
return BonusProgramExchange::class;
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace KupShop\BonusProgramBundle\Admin\Tabs;
|
||||
|
||||
use KupShop\AdminBundle\Admin\WindowTab;
|
||||
|
||||
class BonusProgramSettingsWindowTab extends WindowTab
|
||||
{
|
||||
protected $title = 'flapBonusProgram';
|
||||
|
||||
protected $template = 'BonusProgramSettingsWindowTab.tpl';
|
||||
|
||||
public static function getTypes()
|
||||
{
|
||||
return [
|
||||
'settings' => 1,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace KupShop\BonusProgramBundle\Admin\Tabs;
|
||||
|
||||
use KupShop\AdminBundle\Admin\WindowTab;
|
||||
use KupShop\BonusProgramBundle\Utils\BonusProvider;
|
||||
use KupShop\KupShopBundle\Util\Compat\ServiceContainer;
|
||||
|
||||
class BonusProgramUsersWindowTab extends WindowTab
|
||||
{
|
||||
protected $title = 'flapBonusProgram';
|
||||
|
||||
protected $template = 'BonusProgramUsersWindowTab.tpl';
|
||||
|
||||
public function isVisible(): bool
|
||||
{
|
||||
return parent::isVisible() && $this->getAction() !== 'add';
|
||||
}
|
||||
|
||||
public static function getTypes()
|
||||
{
|
||||
return [
|
||||
'users' => 1,
|
||||
];
|
||||
}
|
||||
|
||||
public function getVars($smarty_tpl_vars)
|
||||
{
|
||||
$ID = $this->getID();
|
||||
|
||||
$bonusProvider = ServiceContainer::getService(BonusProvider::class);
|
||||
|
||||
$data['active_points'] = $bonusProvider->getActivePointsAmount($ID);
|
||||
$data['points_history'] = $bonusProvider->getPointsHistory($ID);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function handleUpdate()
|
||||
{
|
||||
if (getVal('Submit') == 'manualUpdate') {
|
||||
$data = getVal('manual');
|
||||
if (!empty($data['points']) && ($points = intval($data['points']))) {
|
||||
$this->insertSQL('bonus_points', [
|
||||
'id_user' => $this->getID(),
|
||||
'points' => $points,
|
||||
'date_created' => date('Y-m-d H:i:s'),
|
||||
'note' => $data['note'],
|
||||
'status' => 'active', ]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
$txt_str['BonusProgramExchange'] = [
|
||||
'toolbar_list' => 'Výměna bodů',
|
||||
'toolbar_add' => 'Přidat výměnu',
|
||||
|
||||
'flapBonusProgramExchange' => 'Výměna bodů',
|
||||
'titleAdd' => 'Přidat výměnu bodů',
|
||||
'titleEdit' => 'Upravit výměnu bodů',
|
||||
|
||||
'position' => 'Pořadí',
|
||||
'name' => 'Název',
|
||||
'dateCreated' => 'Datum vytvoření',
|
||||
'requiredPoints' => 'Potřebný počet bodů',
|
||||
'generatedCode' => 'Generovaný kód',
|
||||
'active' => 'Aktivní',
|
||||
'languages' => 'Jazyk',
|
||||
'languagesTooltip' => 'Výměna bodů bude viditelná pouze ve vybraných jazycích. Pokud nevyberete žádný jazyk, tak bude výměna viditelná ve všech jazycích.',
|
||||
'description' => 'Popis',
|
||||
];
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
$txt_str['bonusProgramSettingsWindowTab'] = [
|
||||
'flapBonusProgram' => 'Věrnostní program',
|
||||
];
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
$txt_str['bonusProgramUsersWindowTab'] = [
|
||||
'flapBonusProgram' => 'Věrnostní program',
|
||||
];
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
$txt_str['bonus_program'] = [
|
||||
'order_no' => 'Objednávka č.',
|
||||
'points_added' => 'Na účet uživatele přičteno {POINTS} bodů.',
|
||||
'add' => 'Přičíst',
|
||||
'points' => 'bodů',
|
||||
'or' => 'nebo',
|
||||
'multiply' => 'Vynásobit',
|
||||
'percentFromPrice' => '% z ceny',
|
||||
'multiplyTitle' => 'Počet bodů, které zákazník získá za koupi produktu, se vynásobí tímto koeficientem. Aby se jednalo o výhodnou nabídku, použijte číslo větší než 1.',
|
||||
'percentFromPriceTitle' => 'Zadejte kolik procent z ceny produktů v objednávce se má převést na body. Například: Zadáte 10% a produkty na objednávce dohromady stojí 2000 Kč. Definovaný uživatel získá nákupem produktu 200 bodů (2000x0.1).',
|
||||
'coefficient' => 'koeficient',
|
||||
'onePoint' => '1 bod = ',
|
||||
'userName' => 'Uživatel',
|
||||
'customerPoints' => 'Zákazník má body',
|
||||
|
||||
'bonus_points_earning' => 'Zisk bodů',
|
||||
'bonus_points_earningDescription' => 'Nastavení výpočtu získaných věrnostních bodů.',
|
||||
|
||||
'bonus_points' => 'Přidat body',
|
||||
'bonus_pointsDescription' => 'Uživatel dostane bonusové body za jejich objednávku.',
|
||||
|
||||
'bonus_points_other_rec' => 'Přidat body jinému uživateli',
|
||||
'bonus_points_other_recDescription' => 'Definovaný uživatel dostane body za provedenou objednávku.',
|
||||
|
||||
'bonus_program' => 'Uplatnění bodů',
|
||||
'bonus_programDescription' => 'Uplatnění věrnostních bodů.',
|
||||
|
||||
'flapBonusProgram' => 'Věrnostní program',
|
||||
'increaseBy' => 'Přičtení bodů po',
|
||||
'increaseByTitle' => 'Počet dní, po kterých dojde k přičtění bodů ke kontu uživatele. Pokud je vyplněna 0, jsou body přičteny ihned.',
|
||||
'days' => 'dnech',
|
||||
'nullPoints' => 'Vynulování bodů po',
|
||||
'notifyExpiry' => 'E-mail o vynulování',
|
||||
'notifyExpiryTitle' => 'Počet dní před expirací bodů, kdy bude zákazníkovi o expiraci odeslán e-mail.',
|
||||
'notifyExpireBefore' => 'dní dopředu',
|
||||
|
||||
'nullPointsTitle' => 'K vynulování bonusové konta dojde, pokud zákazník nevytvoří po definovaný počet dní žádnou objednávku.',
|
||||
'increasedAmount' => 'Zvýšené množství bodů',
|
||||
'actionBeginning' => 'Začátek akce',
|
||||
'actionEnd' => 'Konec akce',
|
||||
'cheaperCoupons' => 'Levnější kupóny',
|
||||
'cheaperCouponsTitle' => 'Hodnoty kupónu budou vydělěny koeficientem.',
|
||||
'morePoints' => 'Větší příděl bodů',
|
||||
'morePointsTitle' => 'Přidělované body budou vynásobeny koeficientem.',
|
||||
'enableForB2B' => 'Aktivní pro B2B',
|
||||
|
||||
'userHasPoints' => 'Uživatel má celkem',
|
||||
'inBonusProgram' => 've věrnostním programu.',
|
||||
'editPoints' => 'Úprava bodů',
|
||||
'manualEdit' => 'Možnost ručně přidat nebo odebrat body',
|
||||
'count' => 'Počet',
|
||||
'note' => 'Poznámka',
|
||||
'notePlaceholder' => 'Úprava bodů administrátorem',
|
||||
'savePoints' => 'Uložit body',
|
||||
'history' => 'Historie bodů',
|
||||
'state' => 'Stav',
|
||||
'noPointNow' => 'Prozatím nemáte žádné body.',
|
||||
'active' => 'Aktivní',
|
||||
'invoice' => 'Faktura',
|
||||
'waitForActivation' => 'čeká na aktivaci',
|
||||
'stop' => 'stornováno',
|
||||
'date' => 'Datum',
|
||||
'noPointsNow' => 'Nyní nemáte žádné body',
|
||||
'order' => 'Objednávka',
|
||||
|
||||
'pointsFromPrice' => 'Vypočítávat body z ceny produktu',
|
||||
'pointsFromPriceHelp' => 'Zadejte kolik procent z ceny produktu se má převést na body. Například: Zadáte 10% a produkt stojí 200 Kč. Zákazník získá nákupem produktu 20 bodů (200x0.1). Počet bodů nastavený na kartě produktu má větší prioritu. Některé eshopy mají výpočet získaných bodů upravený na míru a proto se nemusí toto pole brát v potaz.',
|
||||
'pointsRounding' => 'Zaokrouhlování bodů',
|
||||
'pointsPrecision' => 'desetinná místa',
|
||||
'pointsSumRounding' => 'Zaokrouhlit až celkový součet bodů',
|
||||
'pointsSumRoundingHelp' => 'Pokud je zaškrtnuto, tak se zaokrouhlení provede až na konci, kdy jsou všechny body vypočítané z produktů sečteny. Pokud není zaškrtnuto, tak se zaokrouhlení aplikuje na spočtené body každého produktu.',
|
||||
|
||||
'addOrRemovePoints' => 'Přidat nebo odebrat body',
|
||||
'editHere' => 'Zde můžete ručne přidat nebo odebrat body',
|
||||
'noPointsEntered' => 'Nebyl zadán počet bodů',
|
||||
|
||||
'pointsCalcType' => 'Způsob výpočtu bodů',
|
||||
'pointsCalcType_perc' => 'Procentuálně',
|
||||
'pointsCalcType_price' => 'Bod za částku',
|
||||
'pointPerPrice' => 'Za každých',
|
||||
'earnOnePoint' => 'získat 1 bod',
|
||||
|
||||
'activityLogTag' => 'Věrnostní program',
|
||||
];
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
$txt_str['bonusProgramSettingsWindowTab'] = [
|
||||
'flapBonusProgram' => 'Bonus program',
|
||||
];
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
$txt_str['bonusProgramUsersWindowTab'] = [
|
||||
'flapBonusProgram' => 'Bonus program',
|
||||
];
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
$txt_str['bonus_program'] = [
|
||||
'order_no' => 'Order No.',
|
||||
'points_added' => '{POINTS} added to the user\'s account.',
|
||||
'add' => 'Add',
|
||||
'points' => 'points',
|
||||
'or' => 'or',
|
||||
'multiply' => 'Multiply',
|
||||
'multiplyTitle' => 'Added point are going to be multiplied by the coefficient',
|
||||
'coefficient' => 'coefficient',
|
||||
'onePoint' => '1 point = ',
|
||||
'customerPoints' => 'Customer has points',
|
||||
|
||||
'bonus_points_earning' => 'Points earning',
|
||||
'bonus_points_earningDescription' => 'Bonus points earning.',
|
||||
|
||||
'bonus_points' => 'Add points',
|
||||
'bonus_pointsDescription' => 'User is going to get bonus points for their order.',
|
||||
|
||||
'bonus_program' => 'Bonus program',
|
||||
'bonus_programDescription' => 'Applying bonus program',
|
||||
|
||||
'flapBonusProgram' => 'Bonus Program',
|
||||
'increaseBy' => 'Increase points after',
|
||||
'increaseByTitle' => 'Number of days before the points are added to the user\'s account. 0 means points are added immediately.',
|
||||
'days' => 'days',
|
||||
'nullPoints' => 'Null points after',
|
||||
'nullPointsTitle' => 'Points are going to be removed if user is not going to make an order within set amount of days.',
|
||||
'increasedAmount' => 'Increase amount of points',
|
||||
'actionBeginning' => 'Beginning of the action',
|
||||
'actionEnd' => 'End of the action',
|
||||
'cheaperCoupons' => 'Cheaper coupons',
|
||||
'cheaperCouponsTitle' => ' Values of the coupon are going to be divided by the coefficient.',
|
||||
'morePoints' => 'Increased amount of points',
|
||||
'morePointsTitle' => 'Added points are going to be multiplied by the coefficient.',
|
||||
'enableForB2B' => 'Active for B2B',
|
||||
|
||||
'userHasPoints' => 'User has',
|
||||
'inBonusProgram' => 'in bonus program.',
|
||||
'editPoints' => 'Edit Points',
|
||||
'manualEdit' => 'Option to manually add or remove points',
|
||||
'count' => 'Count',
|
||||
'note' => 'Note',
|
||||
'notePlaceholder' => 'Edit points by administrator',
|
||||
'savePoints' => 'Save points',
|
||||
'history' => 'Points history',
|
||||
'state' => 'State',
|
||||
'noPointNow' => 'For now you don\'t have any points.',
|
||||
'active' => 'Active',
|
||||
'invoice' => 'Invoice',
|
||||
'waitForActivation' => 'awaits for activation',
|
||||
'stop' => 'storno',
|
||||
'date' => 'Date',
|
||||
'noPointsNow' => 'You have no points now',
|
||||
'order' => 'Order',
|
||||
|
||||
'pointsFromPrice' => 'Calculate points from product price',
|
||||
'pointsFromPriceHelp' => '',
|
||||
'pointsRounding' => 'Round direction',
|
||||
'pointsPrecision' => 'decimal places',
|
||||
'pointsSumRounding' => 'Round up the total points',
|
||||
'pointsSumRoundingHelp' => 'If checked, the rounding is done at the end when all the points calculated from the products are added up. If unchecked, rounding is applied to the calculated points of each product.',
|
||||
|
||||
'addOrRemovePoints' => 'Add or remove points',
|
||||
'editHere' => 'Here you can add or remove points manually',
|
||||
'noPointsEntered' => 'The number of points was not entered',
|
||||
|
||||
'pointsCalcType' => 'Method of calculating points',
|
||||
'pointsCalcType_perc' => 'Percentage',
|
||||
'pointsCalcType_price' => 'Point per amount',
|
||||
'pointPerPrice' => 'For every',
|
||||
'earnOnePoint' => 'earn 1 point',
|
||||
|
||||
'activityLogTag' => 'Bonus program',
|
||||
];
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace KupShop\BonusProgramBundle\Admin\lists;
|
||||
|
||||
use KupShop\AdminBundle\AdminList\BaseList;
|
||||
|
||||
class BonusProgramExchangeList extends BaseList
|
||||
{
|
||||
use \AdminListSortable;
|
||||
|
||||
protected $template = 'listSortable.tpl';
|
||||
|
||||
protected $tableName = 'bonus_points_exchange';
|
||||
|
||||
public function customizeTableDef($tableDef)
|
||||
{
|
||||
$tableDef = parent::customizeTableDef($tableDef);
|
||||
|
||||
$tableDef['id'] = 'id';
|
||||
$tableDef['fields'] = [
|
||||
'position' => ['field' => 'position', 'render' => 'renderPosition', 'size' => '70px', 'translate' => true],
|
||||
'ID' => ['field' => 'id', 'size' => 0.3, 'visible' => 'N'],
|
||||
'name' => ['field' => 'name', 'translate' => true],
|
||||
'requiredPoints' => ['field' => 'points', 'translate' => true],
|
||||
'active' => ['field' => 'active', 'translate' => true, 'render' => 'renderBoolean'],
|
||||
'dateCreated' => ['field' => 'date_created', 'translate' => true, 'render' => 'renderDate'],
|
||||
];
|
||||
|
||||
return $tableDef;
|
||||
}
|
||||
|
||||
public function getQuery()
|
||||
{
|
||||
return sqlQueryBuilder()
|
||||
->select('*')
|
||||
->from($this->getTableName())
|
||||
->orderBy('position');
|
||||
}
|
||||
|
||||
public function handle()
|
||||
{
|
||||
parent::handle();
|
||||
|
||||
$item = getVal('moved_item');
|
||||
|
||||
if (!empty($item)) {
|
||||
$this->saveList($item, $this->getTableName());
|
||||
exit('{}');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return BonusProgramExchangeList::class;
|
||||
@@ -0,0 +1,55 @@
|
||||
<div id="flapBonusProgram" class="tab-pane fade in boxFlex">
|
||||
<div class="row bottom-space">
|
||||
<div class="col-md-11">
|
||||
<h1 class="h4 main-panel-title">{'flapBonusProgram'|translate:'bonus_program'}</h1>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<a href="javascript:help('bonusProgram');"><i class="btn btn-info bi bi-question-circle"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-2 control-label">
|
||||
<label>{'increaseBy'|translate:'bonus_program'}</label>
|
||||
<a class="help-tip" data-toggle="tooltip"
|
||||
title="{'increaseByTitle'|translate:'bonus_program'}"><i
|
||||
class="bi bi-question-circle"></i></a>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control input-sm" name="data[bonus_program][activate_time]" size="30"
|
||||
value="{$body.data.bonus_program.activate_time}">
|
||||
<span class="input-group-addon">{'days'|translate:'bonus_program'}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-2 control-label">
|
||||
<label>{'nullPoints'|translate:'bonus_program'}</label>
|
||||
<a class="help-tip" data-toggle="tooltip"
|
||||
title="{'nullPointsTitle'|translate:'bonus_program'}"><i
|
||||
class="bi bi-question-circle"></i></a>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control input-sm" name="data[bonus_program][remove_time]" size="30"
|
||||
value="{$body.data.bonus_program.remove_time}">
|
||||
<span class="input-group-addon">{'days'|translate:'bonus_program'}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-2 control-label">
|
||||
<label>{'notifyExpiry'|translate:'bonus_program'}</label>
|
||||
<a class="help-tip" data-toggle="tooltip"
|
||||
title="{'notifyExpiryTitle'|translate:'bonus_program'}"><i
|
||||
class="bi bi-question-circle"></i></a>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control input-sm" name="data[bonus_program][expiry_email_time]" size="30"
|
||||
value="{$body.data.bonus_program.expiry_email_time}">
|
||||
<span class="input-group-addon">{'notifyExpireBefore'|translate:'bonus_program'}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,57 @@
|
||||
<div id="flapBonusProgram" class="tab-pane fade in boxFlex">
|
||||
<h1 class="h4 main-panel-title">{'flapBonusProgram'|translate:'bonus_program'}</h1>
|
||||
|
||||
{block 'points-sum-row'}
|
||||
<div class="row">
|
||||
<div class="col-xs-12 benefit-program">
|
||||
<div class="benefit-program-inner">
|
||||
<p class="icons_star">{'userHasPoints'|translate:'bonus_program'} <strong>{$tab.data.active_points} {'points'|translate:'bonus_program'}</strong> {'inBonusProgram'|translate:'bonus_program'}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
|
||||
{* <div class="row">*}
|
||||
{* <div class="col-md-3">*}
|
||||
{* <a href="#" class="btn btn-primary btn-block" data-action="KupShop\BonusProgramBundle\Admin\Actions\EditBonusPointsAction">*}
|
||||
{* <span>{'addOrRemovePoints'|translate:'bonus_program'}</span>*}
|
||||
{* </a>*}
|
||||
{* </div>*}
|
||||
{* </div>*}
|
||||
|
||||
{block 'custom-data'}
|
||||
{/block}
|
||||
|
||||
<h1 class="h4">{'history'|translate:'bonus_program'}</h1>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<table class="table-orders table">
|
||||
<tr>
|
||||
{block "bonus-program-header"}
|
||||
<th>{'date'|translate:'bonus_program'}</th>
|
||||
<th>{'count'|translate:'bonus_program'}</th>
|
||||
<th>{'note'|translate:'bonus_program'}</th>
|
||||
<th>{'order'|translate:'bonus_program'}</th>
|
||||
<th>{'state'|translate:'bonus_program'}</th>
|
||||
{/block}
|
||||
</tr>
|
||||
|
||||
{block "bonus-program-items"}
|
||||
{foreach $tab.data.points_history as $point}
|
||||
<tr>
|
||||
<td>{$point.date_created|date_format:"%d. %m. %Y"}<span class="hidden-sm-down"> {$point.date_created|date_format:"%H:%M"}</span></td>
|
||||
<td><strong>{if $point.points > 0 }+{/if}{$point.points}</strong></td>
|
||||
<td>{$point.note}</td>
|
||||
<td>{if $point.id_order}<a href="javascript:nw('orders', '{$point.id_order}', '');" download>{'order_no'|translate:'bonus_program'} {$point.order_no}</a>{/if}</td>
|
||||
<td>{if $point.status == 'active'}{'active'|translate}{elseif $point.status == 'inactive'}{'waitForActivation'|translate:'bonus_program'}{else}{'stop'|translate:'bonus_program'}{/if}</a></td>
|
||||
</tr>
|
||||
{foreachelse}
|
||||
<tr>
|
||||
<td colspan="5">{'noPointsNow'|translate:'bonus_program'}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{/block}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,32 @@
|
||||
{extends file="actions/action.tpl"}
|
||||
{block "action"}
|
||||
<div class="form-group">
|
||||
<div class="col-md-2 control-label"><label>{'add'|translate:'bonus_program'}</label></div>
|
||||
<div class="col-md-3">
|
||||
<div class="input-group">
|
||||
<input type="number" min=0 class="form-control input-sm" name="{$name}[data][discount]" maxlength="11" value="{$data.discount}">
|
||||
<span class="input-group-addon">
|
||||
{'points'|translate:'bonus_program'}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 control-label" style="white-space: nowrap;">{'or'|translate:'bonus_program'}
|
||||
<label>{'multiply'|translate:'bonus_program'}</label>
|
||||
<a class="help-tip" data-toggle="tooltip"
|
||||
title="{'multiplyTitle'|translate:'bonus_program'}"
|
||||
style="position: static;"><i
|
||||
class="bi bi-question-circle"></i></a>
|
||||
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">
|
||||
{'coefficient'|translate:'bonus_program'}
|
||||
</span>
|
||||
<input type="number" class="form-control input-sm" name="{$name}[data][coefficient]" value="{$data.coefficient}" maxlength="2" min="0" max="100" step="0.1" style="min-width: 55px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{include 'block.productsFilter.tpl' filter_size=2 filter=$data.filter filterName=$name filterInputName=$name|cat:'[data][filter]'}
|
||||
{/block}
|
||||
@@ -0,0 +1,125 @@
|
||||
{extends file="actions/action.tpl"}
|
||||
{block "action"}
|
||||
<div class="form-group">
|
||||
<div class="col-md-4 control-label">
|
||||
<label><strong>{'pointsCalcType'|translate:'bonus_program'}</strong></label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="radio" style="margin-right: 15px">
|
||||
<input type="radio" class="check" name="{$name}[data][points_calculation_type]" value="perc" data-calculation-type-select
|
||||
{if $data.points_calculation_type == "perc"}checked="checked"{/if} id="type_percentage"/>
|
||||
<label for="type_percentage">{'pointsCalcType_perc'|translate:'bonus_program'}</label>
|
||||
</div>
|
||||
<div class="radio">
|
||||
<input type="radio" class="check" name="{$name}[data][points_calculation_type]" value="price" data-calculation-type-select
|
||||
{if $data.points_calculation_type == "price"}checked="checked"{/if} id="type_price"/>
|
||||
<label for="type_price">{'pointsCalcType_price'|translate:'bonus_program'}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="form-group" data-calculation-type="perc" style="display: none">
|
||||
<div class="col-md-4 control-label">
|
||||
<label>{'pointsFromPrice'|translate:'bonus_program'}</label>
|
||||
<a class="help-tip" data-toggle="tooltip" title="{'pointsFromPriceHelp'|translate:'bonus_program'}"><i class="bi bi-question-circle"></i></a>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="input-group">
|
||||
<input type="number" class="form-control input-sm"
|
||||
name="{$name}[data][points_from_price_percent]"
|
||||
value="{$data.points_from_price_percent}"
|
||||
maxlength="2" min="0" max="100" step="0.0001" style="min-width: 55px;">
|
||||
<span class="input-group-addon">%</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" data-calculation-type="price" style="display: none">
|
||||
<div class="col-md-4 control-label">
|
||||
<label>{'pointPerPrice'|translate:'bonus_program'}</label>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="input-group">
|
||||
<input type="number" class="form-control input-sm"
|
||||
name="{$name}[data][points_from_price_value]"
|
||||
value="{$data.points_from_price_value}"
|
||||
style="min-width: 55px;">
|
||||
<span class="input-group-addon" style="padding: 0px; border: 0px; min-width: 50px;">
|
||||
{get_contexts currency=1 assign='contexts'}
|
||||
<select class="selecter" name="{$name}[data][points_from_price_currency]">
|
||||
{foreach $contexts.currency->getAll() as $currency}
|
||||
<option value="{$currency->getId()}" {if $data.points_from_price_currency == $currency->getId()}selected{/if}>{$currency->getId()}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</span>
|
||||
<span class="input-group-addon">{'earnOnePoint'|translate:'bonus_program'}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-4 control-label">
|
||||
<label>{'pointsRounding'|translate:'bonus_program'}</label>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
{$selected = $data.points_round_direction|default:'round'}
|
||||
{print_select
|
||||
name="{$name}[data][points_round_direction]" selected=$selected
|
||||
var=[
|
||||
'round' => translate('Mathematically', 'settings'),
|
||||
'ceil' => translate('WayUp', 'settings'),
|
||||
'floor' => translate('WayDown', 'settings')
|
||||
]}
|
||||
</div>
|
||||
<div class="col-md-2 control-label" style="padding-left: 0px;">
|
||||
<label style="white-space: nowrap;">{'pointsPrecision'|translate:'bonus_program'}</label>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
{$selected = $data.points_precision|default:0}
|
||||
{print_select name="{$name}[data][points_precision]" var=[0 => 0, 1 => 1, 2 => 2] selected=$selected}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-8 col-md-offset-1">
|
||||
<input type="hidden" name="{$name}[data][points_sum_rounding]" value="N">
|
||||
<div class="checkbox">
|
||||
<input id="{$name}[data][points_sum_rounding]" class="check" type="checkbox" name="{$name}[data][points_sum_rounding]"
|
||||
value="Y" {if $data.points_sum_rounding == 'Y'}checked{/if} />
|
||||
<label for="{$name}[data][points_sum_rounding]">
|
||||
{'pointsSumRounding'|translate:'bonus_program'}
|
||||
<a class="help-tip" data-toggle="tooltip" title="{'pointsSumRoundingHelp'|translate:'bonus_program'}"><i class="bi bi-question-circle"></i></a>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{include 'block.productsFilter.tpl' filter_size=2 filterName=$name filterInputName=$name|cat:'[data][filter]'
|
||||
filter=$data.filter filterEnabled=!empty($data.filter)}
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
switchCalculationType('{$data.points_calculation_type}');
|
||||
});
|
||||
|
||||
$('[data-calculation-type-select]').on('change', function () {
|
||||
switchCalculationType($(this).val());
|
||||
});
|
||||
|
||||
function switchCalculationType(type) {
|
||||
// Get all elements with the data-calculation-type attribute
|
||||
const elements = document.querySelectorAll('[data-calculation-type]');
|
||||
|
||||
// Iterate over the elements and hide/show based on the type
|
||||
elements.forEach(element => {
|
||||
if (element.getAttribute('data-calculation-type') === type) {
|
||||
element.style.display = 'block';
|
||||
} else {
|
||||
element.style.display = 'none';
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
@@ -0,0 +1,43 @@
|
||||
{extends file="actions/action.tpl"}
|
||||
{block "action"}
|
||||
<div class="form-group">
|
||||
<div class="col-md-2 control-label"><label>{'userName'|translate:'bonus_program'}</label></div>
|
||||
<div class="col-md-4">
|
||||
<select name="{$name}[data][other_receiver_user_id]" class="selecter"
|
||||
data-autocomplete="users" data-preload="users">
|
||||
{if {$data.other_receiver_user_id}}
|
||||
<option value="{$data.other_receiver_user_id}"
|
||||
selected>{$data.other_receiver_user_id}</option>
|
||||
{/if}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-2 control-label"><label>{'count'|translate:'bonus_program'}</label></div>
|
||||
<div class="col-md-3">
|
||||
<div class="input-group">
|
||||
<input type="number" min=0 class="form-control input-sm" name="{$name}[data][other_receiver_fixed_amount]" maxlength="11" value="{$data.other_receiver_fixed_amount}">
|
||||
<span class="input-group-addon">
|
||||
{'points'|translate:'bonus_program'}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 control-label" style="white-space: nowrap;">
|
||||
<label>{'percentFromPrice'|translate:'bonus_program'}</label>
|
||||
<a class="help-tip" data-toggle="tooltip"
|
||||
title="{'percentFromPriceTitle'|translate:'bonus_program'}"
|
||||
style="position: static;"><i
|
||||
class="bi bi-question-circle"></i></a>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="input-group">
|
||||
|
||||
<input type="number" class="form-control input-sm" name="{$name}[data][other_receiver_percent_from_price]"
|
||||
value="{$data.other_receiver_percent_from_price}" maxlength="2" min="0" max="100" step="0.1" style="min-width: 55px;">
|
||||
<span class="input-group-addon">%</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{include 'block.productsFilter.tpl' filter_size=2 filter=$data.other_receiver_filter filterName=$name filterInputName=$name|cat:'[data][other_receiver_filter]' filterEnabled=true}
|
||||
{/block}
|
||||
@@ -0,0 +1,33 @@
|
||||
{extends "actions/action.tpl"}
|
||||
|
||||
{block "action"}
|
||||
<div class="form-group">
|
||||
<div class="col-md-2 control-label"><label>{'onePoint'|translate:'bonus_program'}</label></div>
|
||||
<div class="col-md-4">
|
||||
<div class="input-group">
|
||||
<input type="number" min=0 step="0.0001" class="form-control input-sm" name="{$name}[data][discount]" maxlength="11" value="{$data.discount}" required>
|
||||
<span class="input-group-addon" style="padding: 0px; border: 0px; min-width: 50px;">
|
||||
<select name="{$name}[data][unit]" class="selecter">
|
||||
{get_contexts currency=1 assign='contexts'}
|
||||
{foreach $contexts.currency->getAll() as $currency}
|
||||
<option value="{$currency->getId()}" {$currency->getId()|selected:$data.unit}>{$currency->getId()}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-10 col-md-offset-2">
|
||||
<input type="hidden" name="{$name}[data][divideDiscountPrice]" value="N">
|
||||
<div class="checkbox">
|
||||
{$divideDiscountPrice = $object->getDivideDiscountPrice($data)}
|
||||
<input id="{$name}" class="check" type="checkbox" name="{$name}[data][divideDiscountPrice]"
|
||||
value="Y" {if $divideDiscountPrice}checked{/if} />
|
||||
<label for="{$name}">{'divideDiscountPrice'|translate:'OrderDiscounts'}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{include 'block.productsFilter.tpl' filter_size=2 filterName=$name filterInputName=$name|cat:'[data][filter]' filter=$data.filter filterActivatable=true}
|
||||
{/block}
|
||||
@@ -0,0 +1,19 @@
|
||||
<h1 class="h4 main-panel-title">{'editPoints'|translate:'bonus_program'}<span data-attachment="" class="badge badge-default pull-right"></span></h1>
|
||||
<p class="m-b-3">{'editHere'|translate:'bonus_program'}</p>
|
||||
<div class="form-group form-group-flex">
|
||||
<div class="col-md-3 control-label">
|
||||
<label>{'count'|translate:'bonus_program'}</label>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<input type="number" class="form-control" name="config[bonusPoints]">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group form-group-flex">
|
||||
<div class="col-md-3 control-label">
|
||||
<label>{'note'|translate:'bonus_program'}</label>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<input type="text" class="form-control" name="config[adminNote]" placeholder="{'notePlaceholder'|translate:'bonus_program'}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<div class="form-group">
|
||||
<div class="col-md-3 control-label">
|
||||
<label>{'customerPoints'|translate:'bonus_program'}</label>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="input-group">
|
||||
<input type="number" class="form-control input-sm" name="{$name}[data][min]" value="{$data.min}" placeholder="Od" />
|
||||
<span class="input-group-btn"></span>
|
||||
<input type="number" class="form-control input-sm" name="{$name}[data][max]" value="{$data.max}" placeholder="Do" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,96 @@
|
||||
{extends "[shared]/window.tpl"}
|
||||
|
||||
{block tabs}
|
||||
{windowTab id='flapBonusProgramExchange'}
|
||||
{/block}
|
||||
|
||||
{block tabsContent}
|
||||
<div id="flapOrderDiscount" class="tab-pane fade active in boxFlex window-order-discounts">
|
||||
<div class="row">
|
||||
<div class="form-group">
|
||||
<div class="col-md-2 control-label">
|
||||
<label>{'name'|translate}</label>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control input-sm" name="data[name]" maxlength="100"
|
||||
value="{$body.data.name}" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group">
|
||||
<div class="col-md-2 control-label">
|
||||
<label>{'requiredPoints'|translate}</label>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control input-sm" name="data[points]" maxlength="100"
|
||||
value="{$body.data.points}" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group">
|
||||
<div class="col-md-2 control-label">
|
||||
<label>{'generatedCode'|translate}</label>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<select class="selecter" name="data[id_discount]" data-autocomplete="generated_coupons" data-preload="generated_coupons">
|
||||
{if $body.data.id_discount}
|
||||
<option value="{$body.data.id_discount}">{$body.data.id_discount}</option>
|
||||
{/if}
|
||||
</select>
|
||||
</div>
|
||||
{if $body.data.id_discount}
|
||||
<div class="col-md-4">
|
||||
<a href="javascript:nw('OrderDiscountsCoupons', '{$body.data.id_discount}');" onclick="" id="coupons-edit"
|
||||
<span class="badge" title="Upravit generovaný kód">
|
||||
<i class="glyphicon glyphicon-cog"></i>
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group">
|
||||
<div class="col-md-2 control-label">
|
||||
<label>{'active'|translate}</label>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
{print_toggle name='active' value=$body.data.active|default:'Y'}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group">
|
||||
<div class="col-md-2 control-label">
|
||||
<label>{'languages'|translate}</label>
|
||||
<a class="help-tip" data-toggle="tooltip" title="{'languagesTooltip'|translate}">
|
||||
<i class="bi bi-question-circle"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
{get_contexts language=1 assign='contexts'}
|
||||
<select class="selecter" name="data[languages][]" multiple>
|
||||
{foreach $contexts.language->getSupported() as $language}
|
||||
<option value="{$language->getId()}" {if in_array($language->getId(), $body.data.languages)}selected{/if}>{$language->getName()}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{block 'shop-spec'}
|
||||
{/block}
|
||||
<div class="row">
|
||||
<div class="form-group">
|
||||
<div class="col-md-2 control-label">
|
||||
<label>{'description'|translate}</label>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<textarea name="data[description]">{$body.data.description}</textarea>
|
||||
{insert_wysiwyg target="data[description]"}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
Reference in New Issue
Block a user