Bill cleanup

A bit of cleanup
This commit is contained in:
Rosiak
2015-12-25 00:54:13 +01:00
parent 1ea0e4f710
commit d134af0ecb
3 changed files with 204 additions and 193 deletions
+1 -1
View File
@@ -29,6 +29,6 @@
You are about to delete this bill.
</div>
<div class="form-actions">
<button id="deleteBtn" type="submit" class="btn btn-danger" disabled="disabled"><i class="icon-trash icon-white"></i> <strong>Delete Bill</strong></button>
<button id="deleteBtn" type="submit" class="btn btn-danger" disabled="disabled"><i class="fa fa-trash"></i> <strong>Delete Bill</strong></button>
</div>
</form>
+42 -31
View File
@@ -1,5 +1,4 @@
<?php
require 'includes/javascript-interfacepicker.inc.php';
// This needs more verification. Is it already added? Does it exist?
@@ -63,7 +62,6 @@ if ($bill_data['bill_type'] == 'cdr') {
}//end if
?>
<form id="edit" name="edit" method="post" action="" class="form-horizontal" role="form">
<input type=hidden name="action" value="update_bill">
<script type="text/javascript">
@@ -73,17 +71,21 @@ function billType() {
}
</script>
<h3>Bill Properties</h3>
<hr>
<div class="form-group">
<label class="col-sm-2 control-label" for="bill_name"><strong>Description</strong></label>
<div class="col-sm-4">
<label class="control-label" for="bill_name">
<h5><strong>Description</strong></h5>
</label>
<input class="form-control input-sm" name="bill_name" value="<?php echo $bill_data['bill_name']; ?>" />
</div>
<div class="col-sm-6">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="bill_type"><strong>Billing Type</strong></label>
<div class="col-sm-10">
<div class="col-sm-4">
<label class="control-label" for="bill_type">
<h5><strong>Billing Type</strong></h5>
</label>
<br>
<div class="radio">
<label>
<input type="radio" name="bill_type" value="cdr" onchange="javascript: billType();"
@@ -116,8 +118,6 @@ if ($bill_data['bill_type'] == 'quota') {
?>
>
<div class="form-group">
<div class="col-sm-2">
</div>
<div class="col-sm-2">
<input class="form-control input-sm" type="text" name="bill_cdr" value="<?php echo $cdr['data']; ?>">
</div>
@@ -140,8 +140,6 @@ if ($bill_data['bill_type'] == 'cdr') {
?>
>
<div class="form-group">
<div class="col-sm-2">
</div>
<div class="col-sm-2">
<input class="form-control input-sm" type="text" name="bill_quota" value="<?php echo $quota['data']; ?>">
</div>
@@ -157,8 +155,10 @@ if ($bill_data['bill_type'] == 'cdr') {
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="bill_day"><strong>Billing Day</strong></label>
<div class="col-sm-2">
<label class="control-label" for="bill_day">
<h5><strong>Billing Day</strong></h5>
</label>
<select name="bill_day" class="form-control input">
<?php
for ($x = 1; $x < 32; $x++) {
@@ -170,35 +170,45 @@ for ($x = 1; $x < 32; $x++) {
</select>
</div>
</div>
<br>
<h3>Optional Information</h3>
<hr>
<div class="form-group">
<label class="col-sm-2 control-label" for="bill_custid"><strong>Customer&nbsp;Reference</strong></label>
<div class="col-sm-4">
<label class="control-label" for="bill_custid">
<h5><strong>Customer&nbsp;Reference</strong></h5>
</label>
<input class="form-control input-sm" type="text" name="bill_custid" value="<?php echo $bill_data['bill_custid']; ?>" />
</div>
<div class="col-sm-6">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="bill_ref"><strong>Billing Reference</strong></label>
<div class="col-sm-4">
<label class="control-label" for="bill_ref">
<h5><strong>Billing Reference</strong></h5>
</label>
<input class="form-control input-sm" type="text" name="bill_ref" value="<?php echo $bill_data['bill_ref']; ?>" />
</div>
<div class="col-sm-6">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="bill_notes"><strong>Notes</strong></label>
<div class="col-sm-4">
<label class="control-label" for="bill_notes">
<h5><strong>Notes</strong></h5>
</label>
<textarea rows="3" class="form-control input-sm" name="bill_notes" value="<?php echo $bill_data['bill_notes']; ?>"></textarea>
</div>
</div>
<button type="submit" class="btn btn-success" name="Submit" value="Save" /><i class="icon-ok icon-white"></i> <strong>Save Properties</strong></button>
<button type="submit" class="btn btn-success" name="Submit" value="Save" /><i class="fa fa-check"></i> <strong>Save Properties</strong></button>
</form>
<br>
<h3>Billed Ports</h3>
<hr>
<div class="form-group">
<?php
//This needs a proper cleanup
$ports = dbFetchRows(
'SELECT * FROM `bill_ports` AS B, `ports` AS P, `devices` AS D
WHERE B.bill_id = ? AND P.port_id = B.port_id
@@ -219,40 +229,43 @@ if (is_array($ports)) {
$portbtn = str_replace("overlib('", "overlib('<div style=\'border: 5px solid #e5e5e5; background: #fff; padding: 10px;\'>", $portbtn);
$portbtn = str_replace("<div>',;", "</div></div>',", $portbtn);
$portalias = (empty($port['ifAlias']) ? '' : ' - '.$port['ifAlias'].'');
$devicebtn = str_replace('">'.$port['hostname'], '" style="color: #000;"><i class="glyphicon glyphicon-asterisk"></i> '.$port['hostname'], $devicebtn);
$portbtn = str_replace('">'.strtolower($port['ifName']), '" style="color: #000;"><i class="glyphicon glyphicon-random"></i> '.$port['ifName'].''.$portalias, $portbtn);
$devicebtn = str_replace('">'.$port['hostname'], '" style="color: #000;"><i class="fa fa-asterisk"></i> '.$port['hostname'], $devicebtn);
$portbtn = str_replace('">'.strtolower($port['ifName']), '" style="color: #000;"><i class="fa fa-random"></i> '.$port['ifName'].''.$portalias, $portbtn);
echo ' <form action="" class="form-inline" method="post" name="delete'.$port['port_id']."\" style=\"display: none;\">\n";
echo " <input type=\"hidden\" name=\"action\" value=\"delete_bill_port\" />\n";
echo ' <input type="hidden" name="port_id" value="'.$port['port_id']."\" />\n";
echo " </form>\n";
echo " <div class=\"btn-toolbar\">\n";
echo " <div class=\"btn-group\" style=\"width: 600px;\">\n";
// echo(" <a class=\"btn btn-danger\" href=\"javascript:;\" onclick=\"document.delete".$port['port_id'].".submit();\" style=\"color: #fff;\"><i class=\"icon-trash icon-white\"></i></a>\n");
echo ' '.$devicebtn."\n";
echo ' '.$portbtn."\n";
echo " </div>\n";
echo " <div class=\"btn-group\">\n";
echo ' <a class="btn btn-danger btn-mini" href="javascript:;" onclick="document.forms[\'delete'.$port['port_id']."'].submit();\" style=\"color: #fff;\"><i class=\"icon-minus-sign icon-white\"></i> <strong>Remove Interface</strong></a>\n";
echo ' <a class="btn btn-danger btn-mini" href="javascript:;" onclick="document.forms[\'delete'.$port['port_id']."'].submit();\" style=\"color: #fff;\"><i class=\"fa fa-minus\"></i> <strong>Remove Interface</strong></a>\n";
echo " </div>\n";
echo " </div>\n";
}//end foreach
}
if (!$emptyCheck) {
echo " <div class=\"alert alert-info\">\n";
echo " <i class=\"icon-info-sign\"></i> <strong>There are no ports assigned to this bill</strong>\n";
echo " <i class=\"fa fa-info\"></i> <strong>There are no ports assigned to this bill</strong>\n";
echo " </div>\n";
}
}//end if
}
?>
</div>
</fieldset>
<form action="" method="post" class="form-horizontal" role="form">
<input type="hidden" name="action" value="add_bill_port" />
<input type="hidden" name="bill_id" value="<?php echo $bill_id; ?>" />
<br>
<h3>Add Port</h3>
<hr>
<div class="form-group">
<label class="col-sm-2 control-label" for="device"><strong>Device</strong></label>
<div class="col-sm-4">
<label class="control-label" for="device">
<h5><strong>Device</strong></h5>
</label>
<select class="form-control input-sm" id="device" name="device" onchange="getInterfaceList(this)">
<option value=''>Select a device</option>
<?php
@@ -273,16 +286,14 @@ foreach ($devices as $device) {
?>
</select>
</div>
<div class="col-sm-6">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="port_id"><strong>Interface</strong></label>
<div class="col-sm-4">
<label class="control-label" for="port_id">
<h5><strong>Port</strong></h5>
</label>
<select class="form-control input-sm" id="port_id" name="port_id"></select>
</div>
<div class="col-sm-6">
<div>
</div>
<button type="submit" class="btn btn-primary" name="Submit" value=" Add " /><i class="icon-plus-sign icon-white"></i> <strong>Add Interface</strong></button>
<button type="submit" class="btn btn-primary" name="Submit" value=" Add " /><i class="fa fa-plus"></i> <strong>Add Interface</strong></button>
</form>
+1 -1
View File
@@ -37,6 +37,6 @@
Are you sure you want to reset all <strong>MySQL</strong> and/or <strong>RRD</strong> data for all interface on this bill?
</div>
<div class="form-actions">
<button id="resetBtn" type="submit" class="btn btn-danger" disabled="disabled"><i class="icon-refresh icon-white"></i> <strong>Reset Bill</strong></button>
<button id="resetBtn" type="submit" class="btn btn-danger" disabled="disabled"><i class="fa fa-refresh"></i> <strong>Reset Bill</strong></button>
</div>
</form>