You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ngcp-panel/share/templates/subscriber/preferences.tt

194 lines
8.0 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

[% site_config.title = 'Subscriber "' _ subscriber.username _ '@' _ subscriber.domain.domain _ '" Preferences' -%]
[%
helper.name = 'Subscriber';
helper.messages = messages;
helper.edit_preference = edit_preference;
helper.preference = preference;
helper.preference_meta = preference_meta;
helper.pref_groups = pref_groups;
helper.form = form;
helper.base_uri = c.uri_for(subscriber.id,'preferences');
helper.rewrite_rule_sets = rwr_sets;
helper.ncos_levels = ncos_levels;
helper.sound_sets = sound_sets;
helper.skip_head = 1;
%]
<div class="row">
<span>
<a class="btn btn-primary btn-large" href="[% c.uri_for() %]"><i class="icon-arrow-left"></i> Back</a>
</span>
</div>
[% IF helper.messages -%]
<div class="row">
[% FOREACH m IN helper.messages -%]
<div class="alert alert-[% m.type %]">[% m.text %]</div>
[% END -%]
</div>
[% END -%]
<div class="ngcp-separator"></div>
<div class="accordion" id="preference_groups">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#preference_groups" href="#collapse_cf">Call Forwards</a>
</div>
<div class="accordion-body collapse" id="collapse_cf">
<div class="accordion-inner">
<table class="table table-bordered table-striped table-highlight table-hover" id="preferences_table[% group.id %]">
<thead>
<tr>
<th>Type</th>
<th>Answer Timeout</th>
<th>Destinations</th>
<th>Period</th>
[% # one for actions -%]
<th class="ngcp-actions-column"></th>
</tr>
</thead>
<tbody>
[% FOR cf IN [ { type = "cfu", desc = "Unconditional" },
{ type = "cfb", desc = "Busy" },
{ type = "cft", desc = "Timeout" },
{ type = "cfna", desc = "Unavailable" } ] -%]
<tr class="sw_action_row">
[% # let's count the lines of dest/period per map for proper alignment: -%]
[%
FOR maps IN cf_destinations.${cf.type};
destinations.${loop.index} = maps.destinations.size;
periods.${loop.index} = maps.periods.size;
END;
-%]
<td>Call Forward [% cf.desc %]</td>
<td>
[% cf_ringtimeout _ 's' IF cf.type == "cft" && cf_destinations.${cf.type}.size %]
</td>
<td>
[% idx = 0 -%]
[% FOR maps IN cf_destinations.${cf.type} -%]
[% jdx = 0 -%]
[% FOR d IN maps.destinations -%]
[% d.destination %] <span class="pull-right">for [% d.timeout %]s</span><br/>
[% jdx = jdx + 1 %]
[% END -%]
[% WHILE jdx < periods.${idx} -%]
<br/>
[% jdx = jdx + 1 %]
[% END -%]
[% idx = idx + 1 -%]
[% '<br/>' UNLESS loop.index == loop.max -%]
[% END -%]
</td>
<td>
[% idx = 0 -%]
[% FOR maps IN cf_destinations.${cf.type} -%]
[% jdx = 0 -%]
[% UNLESS maps.periods.size -%]
always<br/>
[% jdx = jdx + 1 %]
[% END -%]
[% FOR p IN maps.periods -%]
[% jdx %]: [% p.year %] [% p.month %] [% p.mday %] [% p.wday %] [% p.hour %] [% p.minute %]<br/>
[% jdx = jdx + 1 %]
[% END -%]
[% WHILE jdx < destinations.${idx} -%]
<br/>
[% jdx = jdx + 1 %]
[% END -%]
[% idx = idx + 1 -%]
[% '<br/>' UNLESS loop.index == loop.max -%]
[% END -%]
</td>
<td class="ngcp-actions-column">
<div class="sw_actions">
<a class="btn btn-primary btn-small" href="[% c.uri_for_action("/subscriber/preferences_callforward", [c.req.captures.0], cf.type) %]"><i class="icon-edit"></i> Edit</a>
[% IF cf_mappings.${cf.type}.id -%]
<a class="btn btn-secondary btn-small" data-confirm="Delete" href="[% c.uri_for_action("/subscriber/preferences_callforward_delete", [c.req.captures.0, cf_mappings.${cf.type}.id]) %]"><i class="icon-edit"></i> Delete</a>
[% END -%]
</div>
</td>
</tr>
[% END -%]
</tbody>
</table>
</div>
</div>
</div>
[%
PROCESS 'helpers/pref_table.tt';
%]
[% IF edit_cf_flag -%]
[%
PROCESS "helpers/modal.tt";
modal_header(m.name = cf_description);
-%]
[% IF cf_form.has_for_js -%]
[% cf_form.render_repeatable_js %]
[% END -%]
[% cf_form.render %]
[%
modal_footer();
modal_script(m.close_target = c.uri_for_action('/subscriber/preferences', [c.req.captures.0]));
-%]
[% ELSIF edit_cfset_flag -%]
[%
PROCESS "helpers/modal.tt";
modal_header(m.name = cf_description);
-%]
<div class="modal-body">
[% IF cf_sets -%]
<table class="table table-bordered table-striped table-highlight table-hover">
<thead>
<tr>
<th>Name</th>
<th>Values</th>
<th></th>
</tr>
</thead>
<tbody>
[% FOREACH set IN cf_sets -%]
<tr class="sw_action_row">
<td>[% set.name %]</td>
<td>
[% FOREACH d IN set.destinations -%]
[% d.destination %] <span class="pull-right">after [% d.timeout %]s</span><br/>
[% END -%]
</td>
<td class="ngcp-actions-column">
<div class="sw_actions pull-right">
<a class="btn btn-small btn-primary" href="[% c.uri_for_action('/subscriber/preferences_callforward_destinationset_edit', [ c.req.captures.0, set.id ]) %]">
<i class="icon-edit"></i> Edit
</a>
<a class="btn btn-small btn-secondary" data-confirm="Delete" href="[% c.uri_for_action('/subscriber/preferences_callforward_destinationset_delete', [ c.req.captures.0, set.id ]) %]">
<i class="icon-trash"></i> Delete
</a>
</div>
</td>
</tr>
[% END -%]
</tbody>
</table>
[% END -%]
</div>
[%
modal_footer();
modal_script(m.close_target = c.uri_for_action('/subscriber/preferences', [c.req.captures.0]));
-%]
[% END -%]
[% # vim: set tabstop=4 syntax=html expandtab: -%]