client_groups functionality added to promo update function

This commit is contained in:
4Giedrius committed 2014-11-14 12:06:40 +02:00
1 parent 2e044c27d4
commit bfeb22c543
2 files changed
+20

No files matched your search

+8
View File
@@ -672,6 +672,14 @@ class Service implements InjectionAwareInterface
}
}
if(isset($data['client_groups'])) {
if(empty($data['client_groups'])) {
$model->client_groups = NULL;
} else {
$model->client_groups = json_encode($data['client_groups']);
}
}
if(isset($data['periods']) && is_array($data['periods'])) {
$model->periods = json_encode($data['periods']);
}
@@ -131,6 +131,18 @@
</div>
<div class="fix"></div>
</div>
<div class="rowElem">
<label>{% trans 'Periods (Select none to apply to all client groups)' %}</label>
<div class="formRight">
{% set client_groups = admin.client_group_get_pairs %}
<select name="client_groups[]" multiple="multiple" class="multiple" size="{{groups|length}}">
{% for id, client_group in client_groups %}
<option value="{{id}}" {% if id in promo.client_groups %}selected="selected"{% endif %}>{{ client_group }}</option>
{% endfor %}
</select>
</div>
<div class="fix"></div>
</div>
<input type="submit" value="{% trans 'Update' %}" class="greyishBtn submitForm" />
<input type="hidden" name="id" value="{{ promo.id }}" />
</fieldset>