WIP
- Coupon Add/Edit/Delete rule AJAX
This commit is contained in:
@@ -203,8 +203,12 @@ abstract class CouponRuleAbstract implements CouponRuleInterface
|
|||||||
$validator['availableOperators'] = $translatedOperators;
|
$validator['availableOperators'] = $translatedOperators;
|
||||||
$translatedInputs[$key] = $validator;
|
$translatedInputs[$key] = $validator;
|
||||||
}
|
}
|
||||||
|
$validators = array();
|
||||||
|
$validators['inputs'] = $translatedInputs;
|
||||||
|
$validators['setOperators'] = $this->operators;
|
||||||
|
$validators['setValues'] = $this->values;
|
||||||
|
|
||||||
return $translatedInputs;
|
return $validators;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -184,8 +184,9 @@ class CouponController extends BaseAdminController
|
|||||||
);
|
);
|
||||||
|
|
||||||
/** @var CouponRuleInterface $rule */
|
/** @var CouponRuleInterface $rule */
|
||||||
foreach ($rules as $rule) {
|
foreach ($rules->getRules() as $rule) {
|
||||||
$args['rulesObject'][] = array(
|
$args['rulesObject'][] = array(
|
||||||
|
'serviceId' => $rule->getServiceId(),
|
||||||
'name' => $rule->getName(),
|
'name' => $rule->getName(),
|
||||||
'tooltip' => $rule->getToolTip(),
|
'tooltip' => $rule->getToolTip(),
|
||||||
'validators' => $rule->getValidators()
|
'validators' => $rule->getValidators()
|
||||||
@@ -338,15 +339,15 @@ class CouponController extends BaseAdminController
|
|||||||
{
|
{
|
||||||
$this->checkAuth('ADMIN', 'admin.coupon.read');
|
$this->checkAuth('ADMIN', 'admin.coupon.read');
|
||||||
|
|
||||||
if (!$this->getRequest()->isXmlHttpRequest()) {
|
// if (!$this->getRequest()->isXmlHttpRequest()) {
|
||||||
$this->redirect(
|
// $this->redirect(
|
||||||
$this->getRoute(
|
// $this->getRoute(
|
||||||
'admin',
|
// 'admin',
|
||||||
array(),
|
// array(),
|
||||||
Router::ABSOLUTE_URL
|
// Router::ABSOLUTE_URL
|
||||||
)
|
// )
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
/** @var ConstraintFactory $constraintFactory */
|
/** @var ConstraintFactory $constraintFactory */
|
||||||
$constraintFactory = $this->container->get('thelia.constraint.factory');
|
$constraintFactory = $this->container->get('thelia.constraint.factory');
|
||||||
|
|||||||
@@ -24,6 +24,9 @@
|
|||||||
namespace Thelia\Core\Template\Loop;
|
namespace Thelia\Core\Template\Loop;
|
||||||
|
|
||||||
use Propel\Runtime\ActiveQuery\Criteria;
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
|
use Thelia\Constraint\ConstraintFactory;
|
||||||
|
use Thelia\Constraint\Rule\CouponRuleInterface;
|
||||||
|
use Thelia\Core\HttpFoundation\Request;
|
||||||
use Thelia\Core\Template\Element\BaseI18nLoop;
|
use Thelia\Core\Template\Element\BaseI18nLoop;
|
||||||
use Thelia\Core\Template\Element\LoopResult;
|
use Thelia\Core\Template\Element\LoopResult;
|
||||||
use Thelia\Core\Template\Element\LoopResultRow;
|
use Thelia\Core\Template\Element\LoopResultRow;
|
||||||
@@ -84,10 +87,27 @@ class Coupon extends BaseI18nLoop
|
|||||||
$coupons = $this->search($search, $pagination);
|
$coupons = $this->search($search, $pagination);
|
||||||
|
|
||||||
$loopResult = new LoopResult();
|
$loopResult = new LoopResult();
|
||||||
|
/** @var ConstraintFactory $constraintFactory */
|
||||||
|
$constraintFactory = $this->container->get('thelia.constraint.factory');
|
||||||
|
|
||||||
|
/** @var Request $request */
|
||||||
|
$request = $this->container->get('request');
|
||||||
|
/** @var Lang $lang */
|
||||||
|
$lang = $request->getSession()->getLang();
|
||||||
|
|
||||||
|
|
||||||
/** @var MCoupon $coupon */
|
/** @var MCoupon $coupon */
|
||||||
foreach ($coupons as $coupon) {
|
foreach ($coupons as $coupon) {
|
||||||
$loopResultRow = new LoopResultRow();
|
$loopResultRow = new LoopResultRow();
|
||||||
|
$rules = $constraintFactory->unserializeCouponRuleCollection(
|
||||||
|
$coupon->getSerializedRules()
|
||||||
|
);
|
||||||
|
|
||||||
|
$cleanedRules = array();
|
||||||
|
/** @var CouponRuleInterface $rule */
|
||||||
|
foreach ($rules->getRules() as $key => $rule) {
|
||||||
|
$cleanedRules[] = $rule->getToolTip();
|
||||||
|
}
|
||||||
$loopResultRow->set("ID", $coupon->getId())
|
$loopResultRow->set("ID", $coupon->getId())
|
||||||
->set("IS_TRANSLATED", $coupon->getVirtualColumn('IS_TRANSLATED'))
|
->set("IS_TRANSLATED", $coupon->getVirtualColumn('IS_TRANSLATED'))
|
||||||
->set("LOCALE", $locale)
|
->set("LOCALE", $locale)
|
||||||
@@ -95,13 +115,13 @@ class Coupon extends BaseI18nLoop
|
|||||||
->set("TITLE", $coupon->getVirtualColumn('i18n_TITLE'))
|
->set("TITLE", $coupon->getVirtualColumn('i18n_TITLE'))
|
||||||
->set("SHORT_DESCRIPTION", $coupon->getVirtualColumn('i18n_SHORT_DESCRIPTION'))
|
->set("SHORT_DESCRIPTION", $coupon->getVirtualColumn('i18n_SHORT_DESCRIPTION'))
|
||||||
->set("DESCRIPTION", $coupon->getVirtualColumn('i18n_DESCRIPTION'))
|
->set("DESCRIPTION", $coupon->getVirtualColumn('i18n_DESCRIPTION'))
|
||||||
->set("EXPIRATION_DATE", $coupon->getExpirationDate())
|
->set("EXPIRATION_DATE", $coupon->getExpirationDate($lang->getDateFormat()))
|
||||||
->set("USAGE_LEFT", $coupon->getMaxUsage())
|
->set("USAGE_LEFT", $coupon->getMaxUsage())
|
||||||
->set("IS_CUMULATIVE", $coupon->getIsCumulative())
|
->set("IS_CUMULATIVE", $coupon->getIsCumulative())
|
||||||
->set("IS_REMOVING_POSTAGE", $coupon->getIsRemovingPostage())
|
->set("IS_REMOVING_POSTAGE", $coupon->getIsRemovingPostage())
|
||||||
->set("IS_ENABLED", $coupon->getIsEnabled())
|
->set("IS_ENABLED", $coupon->getIsEnabled())
|
||||||
->set("AMOUNT", $coupon->getAmount())
|
->set("AMOUNT", $coupon->getAmount())
|
||||||
->set("APPLICATION_CONDITIONS", $coupon->getRules());
|
->set("APPLICATION_CONDITIONS", $cleanedRules);
|
||||||
$loopResult->addRow($loopResultRow);
|
$loopResult->addRow($loopResultRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -556,6 +556,7 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
|
|||||||
$serializedRules = $constraintFactory->serializeCouponRuleCollection($rules);
|
$serializedRules = $constraintFactory->serializeCouponRuleCollection($rules);
|
||||||
$coupon1->setSerializedRules($serializedRules);
|
$coupon1->setSerializedRules($serializedRules);
|
||||||
|
|
||||||
|
$coupon1->setMaxUsage(40);
|
||||||
$coupon1->setIsCumulative(1);
|
$coupon1->setIsCumulative(1);
|
||||||
$coupon1->setIsRemovingPostage(0);
|
$coupon1->setIsRemovingPostage(0);
|
||||||
$coupon1->save();
|
$coupon1->save();
|
||||||
@@ -606,6 +607,7 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
|
|||||||
$serializedRules = $constraintFactory->serializeCouponRuleCollection($rules);
|
$serializedRules = $constraintFactory->serializeCouponRuleCollection($rules);
|
||||||
$coupon2->setSerializedRules($serializedRules);
|
$coupon2->setSerializedRules($serializedRules);
|
||||||
|
|
||||||
|
$coupon1->setMaxUsage(-1);
|
||||||
$coupon2->setIsCumulative(0);
|
$coupon2->setIsCumulative(0);
|
||||||
$coupon2->setIsRemovingPostage(1);
|
$coupon2->setIsRemovingPostage(1);
|
||||||
$coupon2->save();
|
$coupon2->save();
|
||||||
|
|||||||
@@ -10,103 +10,103 @@
|
|||||||
{include file="includes/coupon_breadcrumb.html"}
|
{include file="includes/coupon_breadcrumb.html"}
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
{loop type="coupon" name="read_coupon" id={$couponId} backend_context="true"}
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h1>Coupons : <small>Read coupon n°1</small></h1>
|
<h1>{intl l='Coupon : '}<small>#CODE</small></h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<section class="row">
|
<section class="row">
|
||||||
<div class="col-md-12 general-block-decorator">
|
<div class="col-md-12 general-block-decorator">
|
||||||
{loop type="coupon" name="read_coupon" id=1 backend_context="true"}
|
|
||||||
<div class="alert alert-info">
|
|
||||||
<span class="glyphicon glyphicon-question-sign"></span>
|
|
||||||
{if #IS_ENABLED}{else}This coupon is disabled, you can enable to the bottom of this form.{/if}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<table class="table table-striped">
|
<div class="alert alert-info">
|
||||||
<tbody>
|
<span class="glyphicon glyphicon-question-sign"></span>
|
||||||
<tr>
|
{if #IS_ENABLED}{else}{intl l='This coupon is disabled, you can enable to the bottom of this form.'}{/if}
|
||||||
<td>Code</td>
|
</div>
|
||||||
<td>#CODE</td>
|
|
||||||
</tr>
|
<table class="table table-striped">
|
||||||
<tr>
|
<tbody>
|
||||||
<td>Title</td>
|
<tr>
|
||||||
<td>#TITLE</td>
|
<td>{intl l='Title'}</td>
|
||||||
</tr>
|
<td>#TITLE</td>
|
||||||
<tr>
|
</tr>
|
||||||
<td>Expiration date</td>
|
<tr>
|
||||||
<td>EXPIRATION_DATE</td>
|
<td>{intl l='Expiration date'}</td>
|
||||||
</tr>
|
<td>#EXPIRATION_DATE</td>
|
||||||
<tr>
|
</tr>
|
||||||
<td>Usage left</td>
|
<tr>
|
||||||
<td>
|
<td>{intl l='Usage left'}</td>
|
||||||
{if #USAGE_LEFT}
|
<td>
|
||||||
<span class="label label-success">
|
{if #USAGE_LEFT}
|
||||||
#USAGE_LEFT
|
|
||||||
</span>
|
|
||||||
{else}
|
|
||||||
<span class="label label-important">
|
|
||||||
0
|
|
||||||
</span>
|
|
||||||
{/if}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan="2">#SHORT_DESCRIPTION</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan="2">#DESCRIPTION</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan="2">
|
|
||||||
{if #IS_CUMULATIVE}
|
|
||||||
<span class="label label-success">
|
|
||||||
{intl l="May be cumulative"}
|
|
||||||
</span>
|
|
||||||
{else}
|
|
||||||
<span class="label label-important">
|
|
||||||
{intl l="Can't be cumulative"}
|
|
||||||
</span>
|
|
||||||
{/if}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan="2">
|
|
||||||
{if #IS_REMOVING_POSTAGE}
|
|
||||||
<span class="label label-important">
|
|
||||||
{intl l="Will remove postage"}
|
|
||||||
</span>
|
|
||||||
{else}
|
|
||||||
<span class="label label-success">
|
<span class="label label-success">
|
||||||
{intl l="Won't remove postage"}
|
#USAGE_LEFT
|
||||||
|
</span>
|
||||||
|
{else}
|
||||||
|
<span class="label label-important">
|
||||||
|
0
|
||||||
|
</span>
|
||||||
|
{/if}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">#SHORT_DESCRIPTION</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">#DESCRIPTION</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
{if #IS_CUMULATIVE}
|
||||||
|
<span class="label label-success">
|
||||||
|
{intl l="May be cumulative"}
|
||||||
|
</span>
|
||||||
|
{else}
|
||||||
|
<span class="label label-important">
|
||||||
|
{intl l="Can't be cumulative"}
|
||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Amount</td>
|
<td colspan="2">
|
||||||
<td>#AMOUNT</td>
|
{if #IS_REMOVING_POSTAGE}
|
||||||
</tr>
|
<span class="label label-important">
|
||||||
<tr>
|
{intl l="Will remove postage"}
|
||||||
<td>Conditions of application</td>
|
</span>
|
||||||
<td>
|
{else}
|
||||||
<ul class="list-unstyled">
|
<span class="label label-success">
|
||||||
<li>Total cart supperior to 400 €</li>
|
{intl l="Won't remove postage"}
|
||||||
<li><span class="label label-info">OR</span></li>
|
</span>
|
||||||
<li>At least 4 products</li>
|
{/if}
|
||||||
</ul>
|
</td>
|
||||||
</td>
|
</tr>
|
||||||
</tr>
|
<tr>
|
||||||
<tr>
|
<td>{intl l='Amount'}</td>
|
||||||
<td>Actions</td>
|
<td>#AMOUNT</td>
|
||||||
<td>
|
</tr>
|
||||||
<a href="#url" class="btn btn-default btn-primary btn-medium"><span class="icon-edit icon-white"></span> Edit</a>
|
<tr>
|
||||||
<a href="#url" class="btn btn-default btn-success btn-medium" data-toggle="confirm" data-target="#enable"><span class="glyphicon glyphicon-ok"></span> Enabled</a>
|
<td>{intl l='Application field'}</td>
|
||||||
</td>
|
<td>
|
||||||
</tr>
|
<ul class="list-unstyled">
|
||||||
</tbody>
|
{foreach from=$APPLICATION_CONDITIONS item=rule name=rulesForeach}
|
||||||
</table>
|
{if !$smarty.foreach.rulesForeach.first}
|
||||||
|
<li><span class="label label-info">{intl l='And'}</span></li>
|
||||||
|
{/if}
|
||||||
|
<li>{$rule nofilter}</li>
|
||||||
|
{/foreach}
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{intl l='Actions'}</td>
|
||||||
|
<td>
|
||||||
|
<a href="#url" class="btn btn-default btn-primary btn-medium"><span class="icon-edit icon-white"></span> {intl l='Edit'}</a>
|
||||||
|
<a href="#url" class="btn btn-default btn-success btn-medium" data-toggle="confirm" data-target="#enable"><span class="glyphicon glyphicon-ok"></span> {intl l='Enabled'}</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
{/loop}
|
{/loop}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@@ -121,7 +121,4 @@
|
|||||||
<script src="{$asset_url}"></script>
|
<script src="{$asset_url}"></script>
|
||||||
{/javascripts}
|
{/javascripts}
|
||||||
|
|
||||||
{javascripts file='assets/bootstrap-editable/js/bootstrap-editable.js'}
|
|
||||||
<script src="{$asset_url}"></script>
|
|
||||||
{/javascripts}
|
|
||||||
{/block}
|
{/block}
|
||||||
|
|||||||
@@ -37,29 +37,86 @@
|
|||||||
$(function($){
|
$(function($){
|
||||||
miniBrowser(0, '/test_to_remove/datas_coupon_edit.json');
|
miniBrowser(0, '/test_to_remove/datas_coupon_edit.json');
|
||||||
|
|
||||||
$('#effect').on('change', function (e) {
|
|
||||||
var optionSelected = $("option:selected", this);
|
|
||||||
$('#effectToolTip').html(optionSelected.attr("data-description"));
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#category-rule').on('change', function (e) {
|
|
||||||
$('#rule-add-operators-values').html('<div class="loading" ></div>');
|
|
||||||
var url = "{$urlAjaxGetRuleInput}";
|
|
||||||
url = url.replace('ruleId', $(this).val())
|
|
||||||
console.log(url);
|
// Init Rules
|
||||||
$.ajax({
|
var initRule = function() {
|
||||||
url: url,
|
var rules = [];
|
||||||
statusCode: {
|
{foreach from=$rulesObject key=k item=rule}
|
||||||
404: function() {
|
var rule = [];
|
||||||
$('#rule-add-operators-values').html(
|
rule['serviceId'] = '{$rule.serviceId nofilter}';
|
||||||
'{intl l='Please select another rule'}'
|
rule['operators'] = [];
|
||||||
);
|
rule['values'] = [];
|
||||||
}
|
|
||||||
}
|
{foreach from=$rule.validators.setOperators key=input item=operator}
|
||||||
}).done(function(data) {
|
rule['operators']['{$input nofilter}'] = '{$operator nofilter}';
|
||||||
$('#rule-add-operators-values').html(data);
|
rule['values']['{$input nofilter}'] = '{$rule.validators.setValues[$input] nofilter}';
|
||||||
|
{/foreach}
|
||||||
|
rules.push(rule);
|
||||||
|
{/foreach}
|
||||||
|
|
||||||
|
return rules;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save Rules AJAX
|
||||||
|
var saveRuleAjax = function() {
|
||||||
|
console.log(rules);
|
||||||
|
console.log('save');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove 1 Rule then Save Rules AJAX
|
||||||
|
var removeRuleAjax = function($id) {
|
||||||
|
rules.slice($id, 1);
|
||||||
|
saveRuleAjax();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add 1 Rule then Save Rules AJAX
|
||||||
|
var addRuleAjax = function() {
|
||||||
|
rules.pop(ruleToSave);
|
||||||
|
saveRuleAjax();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var rules = initRule();
|
||||||
|
console.log(rules);
|
||||||
|
|
||||||
|
|
||||||
|
// Reload effect inputs when changing effect
|
||||||
|
var onEffectChange = function() {
|
||||||
|
$('#effect').on('change', function (e) {
|
||||||
|
var optionSelected = $("option:selected", this);
|
||||||
|
$('#effectToolTip').html(optionSelected.attr("data-description"));
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
onEffectChange();
|
||||||
|
|
||||||
|
// Reload rule inputs when changing effect
|
||||||
|
var onRuleChange = function() {
|
||||||
|
$('#category-rule').on('change', function (e) {
|
||||||
|
$('#rule-add-operators-values').html('<div class="loading" ></div>');
|
||||||
|
var url = "{$urlAjaxGetRuleInput}";
|
||||||
|
url = url.replace('ruleId', $(this).val())
|
||||||
|
console.log(url);
|
||||||
|
$.ajax({
|
||||||
|
url: url,
|
||||||
|
statusCode: {
|
||||||
|
404: function() {
|
||||||
|
$('#rule-add-operators-values').html(
|
||||||
|
'{intl l='Please select another rule'}'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).done(function(data) {
|
||||||
|
$('#rule-add-operators-values').html(data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
onRuleChange();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -167,9 +167,6 @@
|
|||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<caption class="clearfix">
|
<caption class="clearfix">
|
||||||
{intl l='Rules'}
|
{intl l='Rules'}
|
||||||
<a class="btn btn-default btn-primary pull-right" title="{intl l='Add a new rule'}">
|
|
||||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
|
||||||
</a>
|
|
||||||
</caption>
|
</caption>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -178,9 +175,15 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{foreach from=$rulesObject item=rule}
|
{foreach from=$rulesObject item=rule name=rulesForeach}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{$rule.tooltip}</td>
|
<td>
|
||||||
|
{if !$smarty.foreach.rulesForeach.first}
|
||||||
|
<span class="label label-info">{intl l='And'}</span>
|
||||||
|
{/if}
|
||||||
|
{$rule.tooltip nofilter}
|
||||||
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<a href="#url" class="btn btn-default btn-primary btn-medium"><span class="glyphicon glyphicon-edit"></span> {intl l='Edit'}</a>
|
<a href="#url" class="btn btn-default btn-primary btn-medium"><span class="glyphicon glyphicon-edit"></span> {intl l='Edit'}</a>
|
||||||
<a href="#url" class="btn btn-default btn-danger btn-medium" data-toggle="confirm" data-target="#delete"><span class="glyphicon glyphicon-remove"></span> {intl l='Delete'}</a>
|
<a href="#url" class="btn btn-default btn-danger btn-medium" data-toggle="confirm" data-target="#delete"><span class="glyphicon glyphicon-remove"></span> {intl l='Delete'}</a>
|
||||||
@@ -194,9 +197,32 @@
|
|||||||
|
|
||||||
<section class="row">
|
<section class="row">
|
||||||
<div class="col-md-12 general-block-decorator clearfix">
|
<div class="col-md-12 general-block-decorator clearfix">
|
||||||
<a title="{intl l='Save this rule'}" class="btn btn-default btn-primary pull-right">
|
<table class="table table-striped">
|
||||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
<caption class="clearfix">
|
||||||
</a>
|
{intl l='Add a Rule'}
|
||||||
|
<a title="{intl l='Save this rule'}" class="btn btn-default btn-primary pull-right">
|
||||||
|
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||||
|
</a>
|
||||||
|
</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>{intl l='Conditions link'}</th>
|
||||||
|
<th>{intl l='Rule Type'}</th>
|
||||||
|
<th>{intl l='Operator'}</th>
|
||||||
|
<th>{intl l='Value'}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td></tr>
|
||||||
|
<td></tr>
|
||||||
|
<td></tr>
|
||||||
|
<td></tr>
|
||||||
|
</td>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div id="rule-add-organizer" class="form-group col-md-2">
|
<div id="rule-add-organizer" class="form-group col-md-2">
|
||||||
<label for="type">{intl l='Condition type :'}</label>
|
<label for="type">{intl l='Condition type :'}</label>
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
{*test*}
|
{foreach from=$inputs.inputs key=name item=input}
|
||||||
{*{$ruleId}*}
|
|
||||||
{*{$inputs|var_dump}*}
|
|
||||||
|
|
||||||
{foreach from=$inputs key=name item=input}
|
|
||||||
<label for="operator">{$input.title}</label>
|
<label for="operator">{$input.title}</label>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
@@ -71,4 +67,15 @@
|
|||||||
{*</tr>*}
|
{*</tr>*}
|
||||||
{*</tbody></table>*}
|
{*</tbody></table>*}
|
||||||
{*</div>*}
|
{*</div>*}
|
||||||
{*</div>*}
|
{*</div>*}
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var ruleToSave = [];
|
||||||
|
ruleToSave['serviceId'] = '{$ruleId}';
|
||||||
|
ruleToSave['operators'] = [];
|
||||||
|
ruleToSave['values'] = [];
|
||||||
|
{foreach from=$inputs.inputs key=name item=input}
|
||||||
|
ruleToSave['operators']['{$name nofilter}'] = 'to set';
|
||||||
|
ruleToSave['values']['{$name nofilter}'] = 'to set';
|
||||||
|
{/foreach}
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user