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/customer/details.tt

693 lines
34 KiB

[% site_config.title = 'Customer Details for #' _ contract.id _ " (" _ product.name _ ")" -%]
[%
lock_levels = [
{ level = 0, text = "none" },
{ level = 1, text = "foreign calls" },
{ level = 2, text = "all outgoing calls" },
{ level = 3, text = "incoming and outgoing" },
{ level = 4, text = "global (including web login)" },
];
-%]
<div class="row">
<span>
<a class="btn btn-primary btn-large" href="[% c.uri_for('/back') %]"><i class="icon-arrow-left"></i> Back</a>
</span>
[% IF !c.user.read_only && (c.user.roles == 'admin' || c.user.roles == 'reseller') -%]
<span>
<a class="btn btn-primary btn-large" href="[% c.uri_for_action('/contract/edit', [ contract.id ]) %]"><i class="icon-edit"></i> Edit</a>
</span>
[% END -%]
</div>
[% back_created = 1 -%]
<div class="row">
[% FOREACH m IN messages -%]
<div class="alert alert-[% m.type %]">[% m.text %]</div>
[% END -%]
[% IF contract.status != "active" -%]
<div class="alert">Customer is <b>[% contract.status %]</b></div>
[% END -%]
</div>
<div class="ngcp-separator"></div>
<div class="accordion" id="customer_details">
[% IF c.user.is_superuser -%]
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#customer_details" href="#collapse_reseller">Reseller</a>
</div>
<div class="accordion-body collapse" id="collapse_reseller">
<div class="accordion-inner">
<table class="table table-bordered table-striped table-highlight table-hover">
<thead>
<th>Name</th>
<th>Value</th>
</thead>
<tbody>
<tr>
<td>#</td>
<td>[% contract.contact.reseller.id %]</td>
</tr>
<tr>
<td>Name</td>
<td>[% contract.contact.reseller.name %]</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
[% END -%]
[% IF c.user.roles == 'admin' || c.user.roles == 'reseller' %]
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#customer_details" href="#collapse_contact">Contact Details</a>
</div>
<div class="accordion-body collapse" id="collapse_contact">
<div class="accordion-inner">
[% UNLESS c.user.read_only -%]
<span>
<a class="btn btn-primary btn-large" href="[% c.uri_for('/contact', contact_hash.id, 'edit') %]"><i class="icon-edit"></i> Edit Contact</a>
</span>
<div class="ngcp-separator"></div>
[% END -%]
<table class="table table-bordered table-striped table-highlight table-hover">
<thead>
<th>Name</th>
<th>Value</th>
</thead>
<tbody>
<tr>
<td>Email</td>
<td>[% contact_hash.email%]</td>
</tr>
<tr>
<td>Name</td>
<td>[% contact_hash.firstname %] [% contact_hash.lastname %]</td>
</tr>
<tr>
<td>Company</td>
<td>[% contact_hash.company%]</td>
</tr>
<tr>
<td>Address</td>
<td>
[% contact_hash.street %]<br/>
[% contact_hash.postcode %] [% contact_hash.city %]<br/>
[% contact_hash.country %]
</td>
</tr>
<tr>
<td>Phone/Fax</td>
<td>
Mobile: [% contact_hash.mobilenumber %]<br/>
Fixed: [% contact_hash.phonenumber %]<br/>
Fax: [% contact_hash.faxnumber %]<br/>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#customer_details" href="#collapse_bilprofs">Billing Profiles</a>
</div>
<div class="accordion-body collapse" id="collapse_bilprofs">
<div class="accordion-inner">
<table class="table table-bordered table-striped table-highlight table-hover">
<thead>
<tr>
<th>Date</th>
<th>Billing Profile Name</th>
</tr>
</thead>
<tbody>
[% FOR mapping IN contract.billing_mappings.all -%]
<tr class="sw_action_row">
<td>
[% mapping.start_date ? mapping.start_date : 'NULL' %] - [% mapping.end_date.defined ? mapping.end_date : 'NULL' %]
</td>
<td>[% mapping.billing_profile.name %]</td>
</tr>
[% END -%]
</tbody>
</table>
</div>
</div>
</div>
[% END -%]
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#customer_details" href="#collapse_subs">Subscribers</a>
</div>
<div class="accordion-body collapse" id="collapse_subs">
<div class="accordion-inner">
<a class="btn btn-large btn-primary" href="[% c.uri_for_action('/customer/subscriber_create', [ c.req.captures.0 ]) %]"><i class="icon-star"></i> Create Subscriber</a>
<div class="ngcp-separator"></div>
<table class="table table-bordered table-striped table-highlight table-hover" id="subscribers_table">
<thead>
<tr>
<th>SIP URI</th>
<th>Primary Number</th>
[% IF c.config.features.cloudpbx && product.class == 'pbxaccount' -%]
<th>PBX Group</th>
[% END -%]
<th>Registered Devices</th>
<th class="ngcp-actions-column"></th>
</tr>
</thead>
<tbody>
[% FOR subscriber IN subscribers -%]
<tr class="sw_action_row">
<td>[% subscriber.username %]@[% subscriber.domain %]</td>
<td>[% subscriber.primary_number.cc %] [% subscriber.primary_number.ac %] [% subscriber.primary_number.sn %]</td>
[% IF c.config.features.cloudpbx && product.class == 'pbxaccount' -%]
<td>
[% subscriber.voip_pbx_group.name -%]
</td>
[% END -%]
<td>
[% FOR location IN subscriber.locations -%]
[% location.user_agent %]<br/>
[% END -%]
</td>
<td class="ngcp-actions-column">
<div class="sw_actions">
<a class="btn btn-primary btn-small" href="[% c.uri_for_action("/subscriber/details", [subscriber.id]) %]"><i class="icon-th-list"></i> Details</a>
<a class="btn btn-tertiary btn-small" href="[% c.uri_for_action("/subscriber/preferences", [subscriber.id]) %]"><i class="icon-list"></i> Preferences</a>
[% IF (!c.user.readonly && (c.user.role == 'admin' || c.user.role == 'reseller')) || c.user.uuid != subscriber.uuid -%]
<a class="btn btn-secondary btn-small" href="[% c.uri_for_action("/subscriber/terminate", [subscriber.id]) %]" data-confirm="Terminate"><i class="icon-remove"></i> Terminate</a>
[% END -%]
</div>
</td>
</tr>
[% END -%]
</tbody>
</table>
</div>
</div>
</div>
[% IF c.config.features.cloudpbx && product.class == 'pbxaccount' && subscribers.size -%]
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#customer_details" href="#collapse_pbxgroups">PBX Groups</a>
</div>
<div class="accordion-body collapse" id="collapse_pbxgroups">
<div class="accordion-inner">
<a class="btn btn-large btn-primary" href="[% c.uri_for_action('/customer/pbx_group_create', [ c.req.captures.0 ]) %]"><i class="icon-star"></i> Create PBX Group</a>
<div class="ngcp-separator"></div>
<table class="table table-bordered table-striped table-highlight table-hover" id="subscribers_table">
<thead>
<tr>
<th>Name</th>
<th>SIP URI</th>
<th>Primary Number</th>
<th>Hunting Policy</th>
<th>Hunting Timeout</th>
<th class="ngcp-actions-column"></th>
</tr>
</thead>
<tbody>
[% FOR subscriber IN pbx_groups -%]
<tr class="sw_action_row">
<td>[% subscriber.voip_pbx_group.name %]</td>
<td>[% subscriber.username %]@[% subscriber.domain %]</td>
<td>[% subscriber.primary_number.cc %] [% subscriber.primary_number.ac %] [% subscriber.primary_number.sn %]</td>
<td>[% subscriber.voip_pbx_group.hunt_policy %]</td>
<td>[% subscriber.voip_pbx_group.hunt_policy_timeout %]</td>
<td class="ngcp-actions-column">
<div class="sw_actions">
[% UNLESS c.user.readonly -%]
<a class="btn btn-secondary btn-small" href="[% c.uri_for_action("/subscriber/terminate", [subscriber.id]) %]" data-confirm="Terminate"><i class="icon-remove"></i> Terminate</a>
<a class="btn btn-primary btn-small" href="[% c.uri_for_action("/customer/pbx_group_edit", [contract.id, subscriber.voip_pbx_group.id]) %]"><i class="icon-edit"></i> Edit</a>
[% END -%]
<a class="btn btn-primary btn-small" href="[% c.uri_for_action("/subscriber/details", [subscriber.id]) %]"><i class="icon-th-list"></i> Details</a>
<a class="btn btn-tertiary btn-small" href="[% c.uri_for_action("/subscriber/preferences", [subscriber.id]) %]"><i class="icon-list"></i> Preferences</a>
</div>
</td>
</tr>
[% END -%]
</tbody>
</table>
</div>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#customer_details" href="#collapse_pbxdevs">PBX Devices</a>
</div>
<div class="accordion-body collapse" id="collapse_pbxdevs">
<div class="accordion-inner">
<a class="btn btn-large btn-primary" href="[% c.uri_for_action('/customer/pbx_device_create', [ c.req.captures.0 ]) %]"><i class="icon-star"></i> Create PBX Device</a>
<div class="ngcp-separator"></div>
<table class="table table-bordered table-striped table-highlight table-hover" id="subscribers_table">
<thead>
<tr>
<th></th>
<th>Station Name</th>
<th>Subscriber</th>
<th>MAC Address / Identifier</th>
<th>Device Profile</th>
<th class="ngcp-actions-column"></th>
</tr>
</thead>
<tbody>
[% FOR dev IN pbx_devices -%]
<tr class="sw_action_row">
<td><img src="[% c.uri_for_action('/device/devmod_download_frontimage', [ dev.profile.config.device.id]) %]" style="height:40px"/></td>
<td>[% dev.station_name %]</td>
<td>
<ul style="list-style-type:none; margin-left:0">
[% FOR line IN dev.autoprov_field_device_lines.all -%]
<li>[% line.linerange_num %]/[% line.key_num %]: [% line.provisioning_voip_subscriber.username %]@[% line.provisioning_voip_subscriber.domain.domain %]<span class="pull-right">[% line.line_type %]</span></li>
[% END -%]
</ul>
</td>
<td>[% dev.identifier %]</td>
<td>[% dev.profile.name %]</td>
<td class="ngcp-actions-column">
<div class="sw_actions">
[% UNLESS c.user.readonly -%]
<a class="btn btn-secondary btn-small" href="[% c.uri_for_action("/customer/pbx_device_delete", [contract.id, dev.id])%]" data-confirm="Delete"><i class="icon-remove"></i> Delete</a>
<a class="btn btn-primary btn-small" href="[% c.uri_for_action("/customer/pbx_device_edit", [contract.id, dev.id]) %]"><i class="icon-edit"></i> Edit</a>
<a class="btn btn-primary btn-small" href="[% c.uri_for_action("/customer/pbx_device_sync", [contract.id, dev.id]) %]"><i class="icon-edit"></i> Sync Device</a>
[% END -%]
</div>
</td>
</tr>
[% END -%]
</tbody>
</table>
</div>
</div>
</div>
[% END -%]
[% IF
c.config.features.cloudpbx &&
(c.user.roles == 'admin' || c.user.roles == 'reseller' || c.user.roles == 'subscriberadmin')
-%]
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#customer_details" href="#collapse_soundsets">Sound Sets</a>
</div>
<div class="accordion-body collapse" id="collapse_soundsets">
<div class="accordion-inner">
[%
helper.name = 'Sound Sets';
helper.dt_columns = soundset_dt_columns;
helper.ajax_uri = c.uri_for_action('/sound/contract_ajax', [ c.req.captures.0 ]);
UNLESS c.user.read_only;
helper.dt_buttons = [
{ name = 'Edit', uri = "/sound/'+full.id+'/edit", class = 'btn-small btn-primary', icon = 'icon-edit' },
{ name = 'Delete', uri = "/sound/'+full.id+'/delete", class = 'btn-small btn-secondary', icon = 'icon-trash' },
{ name = 'Files', uri = "/sound/'+full.id+'/handles", class = 'btn-small btn-tertiary', icon = 'icon-list' },
];
helper.top_buttons = [
{ name = 'Create Sound Set', uri = c.uri_for('/sound/create'), icon = 'icon-star', accordion_button = 1 },
];
ELSE;
helper.dt_buttons = [
{ name = 'Files', uri = "/sound/'+full.id+'/handles", class = 'btn-small btn-tertiary', icon = 'icon-list' },
];
END;
PROCESS 'helpers/datatables.tt';
%]
</div>
</div>
</div>
[% END -%]
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#customer_details" href="#collapse_balance">Contract Balance</a>
</div>
<div class="accordion-body collapse" id="collapse_balance">
<div class="accordion-inner">
<table class="table table-bordered table-striped table-highlight table-hover">
<thead>
<tr>
<th></th>
<th>Cash</th>
<th>Free time</th>
<th class="ngcp-actions-column"></th>
</tr>
</thead>
<tbody>
<tr class="sw_action_row">
<td>Current totals</td>
<td>[% balance.cash_balance %]</td>
<td>[% balance.free_time_balance %]</td>
<td class="ngcp-actions-column">
<div class="sw_actions pull-right">
<a class="btn btn-small btn-primary"
href="[% c.uri_for_action("/customer/edit_balance", [contract.id]) %]">
<i class="icon-edit"></i> Edit
</a>
</div>
</td>
</tr>
<tr>
<td>Spent this interval</td>
<td>[% balance.cash_balance_interval %]</td>
<td>[% balance.free_time_balance_interval %]</td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
[% IF c.user.roles == 'admin' || c.user.roles == 'reseller' %]
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#customer_details" href="#collapse_fraud">Fraud Limits</a>
</div>
<div class="accordion-body collapse" id="collapse_fraud">
<div class="accordion-inner">
<table class="table table-bordered table-striped table-highlight table-hover">
<thead>
<tr>
<th></th>
<th>Limit</th>
<th>Lock Level</th>
<th>Notify</th>
<th class="ngcp-actions-column"></th>
</tr>
</thead>
<tbody>
<tr class="sw_action_row">
<td>Monthly Settings</td>
[% fraud_def_message = (fraud.fraud_interval_limit.defined ? "none" : "billing profile default") %]
<td>[% fraud.fraud_interval_limit.defined ? fraud.fraud_interval_limit : fraud_def_message %]</td>
<td>
[% IF fraud.fraud_interval_lock.defined -%]
<select disabled="disabled">
[% FOR l IN lock_levels -%]
<option [% fraud.fraud_interval_lock == l.level ? 'selected="selected"' : '' %]>[% l.text %]</option>
[% END -%]
</select>
[% ELSE -%]
[% fraud_def_message %]
[% END -%]
</td>
<td>[% fraud.fraud_interval_notify.defined ? fraud.fraud_interval_notify : fraud_def_message %]</td>
<td class="ngcp-actions-column">
<div class="sw_actions pull-right">
<a class="btn btn-small btn-primary"
href="[% c.uri_for_action("/customer/edit_fraud", [c.req.captures.0], "month") %]">
<i class="icon-edit"></i> Edit</i>
</a>
<a class="btn btn-small btn-secondary" data-confirm="Delete"
href="[% c.uri_for_action("/customer/delete_fraud", [c.req.captures.0], "month") %]">
<i class="icon-trash"></i> Delete</i>
</a>
</div>
</td>
</tr>
<tr class="sw_action_row">
<td>Daily Settings</td>
[% fraud_def_message = (fraud.fraud_daily_limit.defined ? "none" : "billing profile default") %]
<td>[% fraud.fraud_daily_limit.defined ? fraud.fraud_daily_limit : fraud_def_message %]</td>
<td>
[% IF fraud.fraud_daily_lock.defined -%]
<select disabled="disabled">
[% FOR l IN lock_levels -%]
<option [% fraud.fraud_daily_lock == l.level ? 'selected="selected"' : '' %]>[% l.text %]</option>
[% END -%]
</select>
[% ELSE -%]
[% fraud_def_message %]
[% END -%]
</td>
<td>[% fraud.fraud_daily_notify.defined ? fraud.fraud_daily_notify : fraud_def_message %]</td>
<td class="ngcp-actions-column">
<div class="sw_actions pull-right">
<a class="btn btn-small btn-primary"
href="[% c.uri_for_action("/customer/edit_fraud", [c.req.captures.0], "day") %]">
<i class="icon-edit"></i> Edit</i>
</a>
<a class="btn btn-small btn-secondary" data-confirm="Delete"
href="[% c.uri_for_action("/customer/delete_fraud", [c.req.captures.0], "day") %]">
<i class="icon-trash"></i> Delete</i>
</a>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
[% END -%]
</div>
[% IF create_flag == 1 -%]
[%
IF form.has_for_js;
form.render_repeatable_js;
END;
PROCESS "helpers/modal.tt";
modal_header(m.create_flag = create_flag,
m.name = description.defined ? description : "Subscriber");
form.render;
modal_footer();
modal_script(m.close_target = close_target);
-%]
[% ELSIF edit_flag == 1 -%]
[%
IF form.has_for_js;
form.render_repeatable_js;
END;
PROCESS "helpers/modal.tt";
modal_header(m.create_flag=0,
m.name = "Settings");
form.render;
modal_footer();
modal_script(m.close_target = close_target);
-%]
[% ELSIF devsync_flag == 1 -%]
[%
PROCESS "helpers/modal.tt";
modal_header(m.create_flag=0, m.edit_flag=0,
m.name = "Deployed Device");
form.render;
modal_footer();
modal_script(m.close_target = close_target);
-%]
<script>
$('input#sync').click(function(e) {
var full_params = "";
var timer; var loaded = 0;
var ip = $('form#devsyncform input#ip').val();
$('form#devsyncform .form_messages').empty();
// Add the iframe with a unique name
var iframe = document.createElement("iframe");
var uniqueString = "spa_autoconf_post";
document.body.appendChild(iframe);
iframe.style.display = "none";
iframe.contentWindow.name = uniqueString;
iframe.onload = function(e) {
$('input#ip').removeAttr("disabled");
clearTimeout(timer);
if(!loaded) {
loaded = 1;
$('form#devsyncform .form_messages').prepend('<div class="alert alert-success" style="margin:10px">Successfully pushed provisioning settings to device. If the device does not reboot, try to sync it <a target="_blank" href="' + autoprov_uri + '?' + full_params + '">manually</a></div>');
} else {
console.log("iframe loaded after timer");
}
}
// construct a form with hidden inputs, targeting the iframe
if(!ip.length) {
return 0;
}
var autoprov_uri = "[% autoprov_uri %]";
console.log("before uri: " + autoprov_uri);
autoprov_uri = autoprov_uri.replace('__NGCP_CLIENT_IP__', ip);
console.log("after uri: " + autoprov_uri);
$('form#devsyncform').attr('target', uniqueString);
$('form#devsyncform').attr('action', autoprov_uri);
$('form#devsyncform').attr('method', "[% autoprov_method %]");
console.log("method=[% autoprov_method %], uri=" + autoprov_uri);
[% FOR p IN autoprov_params -%]
var input = document.createElement("input");
input.type = "hidden";
input.name = "[% p.key %]";
if(full_params.length > 0)
full_params += '&';
full_params += input.name;
[%# IF p.value.defined -%]
input.value = "[% p.value %]";
full_params += '=' + input.value;
[%# END -%]
$('form#devsyncform').append(input);
[% END -%]
timer = setTimeout(function() {
console.log("timeout hit");
$('input#ip').removeAttr("disabled");
if(loaded) {
console.log("iframe already loaded, we're fine?");
} else {
$('form#devsyncform .form_messages').prepend('<div class="alert alert-error" style="margin:10px">Failed to push provisioning settings to device. Is the IP Address reachable from your browser? Try to trigger the sync <a target="_blank" href="' + autoprov_uri + '?' + full_params + '">manually</a></div>');
}
loaded = 1;
// TODO: get iframe by id
var iframes = document.getElementsByTagName('iframe');
for (var i = 0; i < iframes.length; i++) {
iframes[i].parentNode.removeChild(iframes[i]);
}
}, 5000);
$('form#devsyncform').submit(function() {
$('input#ip').attr("disabled", "disabled");
});
});
</script>
[% END -%]
[% IF c.config.features.cloudpbx -%]
<script>
var aaData;
var AddLineHandler = (function() {
function AddLineHandler(){};
AddLineHandler.prototype.onAdd = function(index) {
console.log("new line added, index is", index);
handle_add_line(index);
};
AddLineHandler.prototype.onRm = function(index) {
console.log("old line removed, index is", index);
//handle_rm_line(index);
};
return AddLineHandler;
})();
var repeatadd_handler = new AddLineHandler();
function handle_add_line(line_id) {
console.log("add line_id " + line_id);
$('#line\\.' + line_id + '\\.line option').remove();
$('#line\\.' + line_id + '\\.line').append('<option value=""></option>');
for(var i = 0; i < aaData.length; ++i) {
var range = aaData[i];
$('#line\\.' + line_id + '\\.line').append('<option value=""></option>');
for(var j = 0; j < range.num_lines; ++j) {
$('#line\\.' + line_id + '\\.line').append('<option id="line.' + line_id + '.line.' + j + '" value="' + range.id + '.' + i + '.' + j + '">' + range.name + ' - Key/Line ' + j + '</option>');
}
}
$('#line\\.' + line_id + '\\.line').change(function(obj) {
handle_change_line(obj, 'invalid');
});
}
function handle_change_line(obj, active_type) {
var range_id;
var range_num;
var key_num;
var line_id = $(obj.currentTarget).attr("id").replace(/^line\.(\d+)\..+$/, "$1");
console.log("handling change of line " + line_id);
$(obj.currentTarget).find('option:selected').each(function() {
console.log("selected line key ", $(this).attr('value'));
range_id = $(this).attr('value').replace(/^(\d+)\.(\d+)\.(\d+)$/, "$1");
range_num = $(this).attr('value').replace(/^(\d+)\.(\d+)\.(\d+)$/, "$2");
key_num = $(this).attr('value').replace(/^(\d+)\.(\d+)\.(\d+)$/, "$3");
});
var range = aaData[range_num];
console.log("setting line_id " + line_id + ", range for range_num " + range_num + " is ", range);
$('#line\\.' + line_id + '\\.type option').remove();
if(range && +range.can_private) { // cast to int
$('#line\\.' + line_id + '\\.type').append('<option value="private"' + (active_type == 'private' ? ' selected="selected"' : '') + '>Private Line</option>');
}
if(range && +range.can_shared) {
$('#line\\.' + line_id + '\\.type').append('<option value="shared"' + (active_type == 'shared' ? ' selected="selected"' : '') + '>Shared Line</option>');
}
if(range && +range.can_blf) {
$('#line\\.' + line_id + '\\.type').append('<option value="blf"' + (active_type == 'blf' ? ' selected="selected"' : '') + '>BLF Key</option>');
}
}
[% IF create_flag == 1 -%]
$('.ngcp-linekey-select option').remove();
$('.ngcp-linetype-select option').remove();
[% ELSIF edit_flag == 1 -%]
var linekeys = {
[% FOR line IN pbx_device.autoprov_field_device_lines.all -%]
'[% line.linerange_id %].[% line.linerange_num %].[% line.key_num %]':'[% line.line_type %]'[% line == bx_device.autoprov_field_device_lines.all.last ? '' : ',' %]
[% END -%]
};
var prof_id;
$('div.controls #profile_id option:selected').each(function() {
prof_id = $(this).attr('value');
});
console.log("querying lines for profile id " + prof_id);
$.ajax({
url: "/device/profile/" + prof_id + "/lines/ajax",
}).done(function(data) {
aaData = data.aaData;
console.log("got edit data", data);
$('.ngcp-linekey-select').each(function() {
var key_val;
$(this).find('option:selected').each(function(){
key_val = $(this).attr("value");
});
console.log("key_val=" + key_val + ", type=" + linekeys[key_val]);
var obj = { currentTarget: $(this)};
handle_change_line(obj, linekeys[key_val]);
});
});
[% END -%]
$('div.controls #profile_id').change(function() {
$('.ngcp-linekey-select option').remove();
$('.ngcp-linetype-select option').remove();
console.log("profile_id changed");
var prof_id;
$('div.controls #profile_id option:selected').each(function() {
prof_id = $(this).attr('value');
});
console.log("querying lines for profile id " + prof_id);
$.ajax({
url: "/device/profile/" + prof_id + "/lines/ajax",
}).done(function(data) {
aaData = data.aaData;
console.log("got data", data);
// foreach line/key repeatable block:
$('#line .controls .control-group.hfh-repinst').each(function(line_index, line_value) {
console.log("handling line block");
console.log("line_index", line_index);
console.log("line_value", line_value);
var line_id = $(line_value).attr("id").replace(/^.+\.(\d+)$/, "$1");
handle_add_line(line_id);
});
});
});
</script>
[% END -%]
[% # vim: set tabstop=4 syntax=html expandtab: -%]