Optimised Service Display, extended SSL module functionality

This commit is contained in:
Deon George
2016-07-27 14:25:17 +10:00
parent 3d3c38b0a0
commit 5ab2d6205f
30 changed files with 455 additions and 258 deletions

View File

@@ -100,10 +100,11 @@ $(document).ready(function() {
});
');
// @todo Move this to automatically add this if a date format is used
Block::factory()
->type('form-horizontal')
->title('Add/View Charge')
->title_icon('icon-wrench')
->title_icon('fa fa-wrench')
->body(View::factory('service/admin/add'));
}
@@ -169,7 +170,7 @@ $(document).ready(function() {
Block::factory()
->type('form-horizontal')
->title(sprintf('%s: %s %s',_('Update Service'),$id,$so->name()))
->title_icon('icon-wrench')
->title_icon('fa fa-wrench')
->body(View::factory('service/admin/edit')
->set('o',$so)
->set('plugin_form',$so->plugin_edit())

View File

@@ -156,7 +156,7 @@ class Model_Service extends ORM_OSB {
/**
* List invoices for this service
*/
public function invoice_list($due=FALSE) {
public function invoice_list($due=FALSE,$num=NULL) {
$result = array();
$x = $this->invoice->distinct('id');
@@ -165,6 +165,9 @@ class Model_Service extends ORM_OSB {
if ($due)
$x->where_unprocessed();
if (! is_null($num))
$x->limit($num);
foreach ($x->find_all() as $io)
if (! $due OR $io->due())
array_push($result,$io);

View File

@@ -1,42 +1,29 @@
<div class="span11">
<div class="col-md-11">
<fieldset>
<legend>Update Service</legend>
<div class="row">
<?php echo StaticList_YesNo::form('status',$o->status,FALSE,array('label'=>'Active','class'=>'span1')); ?>
</div> <!-- /row -->
<?php echo StaticList_YesNo::form('status',$o->status,FALSE,array('label'=>'Active')); ?>
<div class="row">
<?php echo StaticList_RecurSchedule::form('recur_schedule',$o->recur_schedule,FALSE,array('label'=>'Billing Period','required'));?>
</div> <!-- /row -->
<?php echo StaticList_RecurSchedule::form('recur_schedule',$o->recur_schedule,FALSE,array('label'=>'Billing Period','required'));?>
<div class="row">
<div class="input-append date" id="date_next_invoice_label">
<?php echo Form::input('date_next_invoice_label',$o->display('date_next_invoice'),array('class'=>'span2','label'=>'Date Next Invoice','add-on'=>'<i class="icon-calendar"></i>','disabled')); ?>
</div>
<label for="date_next_invoice_label">Date Next Invoice</label>
<div class="input-group col-md-3">
<input type="text" id="date_next_invoice_label" value="<?php echo $o->display('date_next_invoice'); ?>" class="form-control" placeholder="Date Next Invoice">
<span class="input-group-addon" id="basic-addon1"><i class="fa fa-calendar"></i></span>
</div>
<?php echo Form::hidden('date_next_invoice',$o->date_next_invoice); ?>
<?php echo Form::hidden('date_next_invoice',$o->date_next_invoice); ?>
</div> <!-- /row -->
<?php echo StaticList_YesNo::form('taxable',$o->taxable,FALSE,array('label'=>'Taxable')); ?>
<div class="row">
<?php echo StaticList_YesNo::form('taxable',$o->taxable,FALSE,array('label'=>'Taxable','class'=>'span1')); ?>
</div> <!-- /row -->
<?php echo StaticList_YesNo::form('suspend_billing',$o->suspend_billing,FALSE,array('label'=>'Suspend Billing')); ?>
<div class="row">
<?php echo StaticList_YesNo::form('suspend_billing',$o->suspend_billing,FALSE,array('label'=>'Suspend Billing','class'=>'span1')); ?>
</div> <!-- /row -->
<div class="row">
<?php echo Form::input('price_override',$o->price_override,array('label'=>'Override Price','class'=>'span1')); ?>
</div> <!-- /row -->
<?php echo Form::input('price_override',$o->price_override,array('label'=>'Override Price')); ?>
</fieldset>
<?php if ($plugin_form) { echo $plugin_form; } ?>
<div class="row">
<div class="offset2">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn">Cancel</button>
</div>
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn">Cancel</button>
</div>
</div> <!-- /span -->
</div> <!-- /col-md-11 -->

View File

@@ -1,46 +1,44 @@
<!-- o = Service -->
<div class="col-md-5">
<fieldset>
<legend>Service Information</legend>
<fieldset>
<legend>Service Information</legend>
<div class="dl-horizontal">
<dt>Account</dt>
<dd><?php printf('%s (%s)',$o->account->name(),$o->account->accnum()); ?></dd>
<div class="dl-horizontal">
<dt>Account</dt>
<dd><?php printf('%s (%s)',$o->account->name(),$o->account->accnum()); ?></dd>
<?php if ($o->external_billing) : ?>
<dt>External Billed</dt>
<dd><?php echo $o->display('external_billing'); ?></dd>
<?php else : ?>
<dt>Service Active</dt>
<dd><?php echo $o->display('status'); ?></dd>
<?php if ($o->external_billing) : ?>
<dt>External Billed</dt>
<dd><?php echo $o->display('external_billing'); ?></dd>
<dt>Billing Period</dt>
<dd><?php echo $o->display('recur_schedule');?></dd>
<?php else : ?>
<dt>Service Active</dt>
<dd><?php echo $o->display('status'); ?></dd>
<dt>Cost</dt>
<dd><?php echo (! is_null($o->price_override) ? sprintf('<strike>%s</strike> ',$o->price(TRUE,TRUE,TRUE)) : ''). $o->price(TRUE,TRUE); if ($o->pending_change()) echo ' *'; ?></dd>
<dt>Billing Period</dt>
<dd><?php echo $o->display('recur_schedule');?></dd>
<dt>Cost</dt>
<dd><?php echo (! is_null($o->price_override) ? sprintf('<strike>%s</strike> ',$o->price(TRUE,TRUE,TRUE)) : ''). $o->price(TRUE,TRUE); if ($o->pending_change()) echo ' *'; ?></dd>
<!-- @todo -->
<?php if (is_null($o->price) OR ($o->price<=$o->product->price($o->price_group,$o->recur_schedule,'base'))) : ?>
<dt>Service</dt>
<dd><?php echo HTML::anchor('product/view/'.$o->product_id,$o->product->title()); ?></dd>
<?php endif ?>
<dt>Invoiced To</dt>
<dd><?php echo $o->invoiced_to(TRUE); ?></dd>
<dt>Paid To</dt>
<dd><?php echo $o->paid_to(TRUE); ?></dd>
<dt>Date Next Invoice</dt>
<dd><?php printf($o->suspend_billing ? '<strike>%s</strike>' : '%s',$o->display('date_next_invoice')); ?></dd>
<dt>Current Invoices Due</dt>
<dd><?php echo $o->due(TRUE); ?></dd>
<?php if (is_null($o->price) OR ($o->price<=$o->product->price($o->price_group,$o->recur_schedule,'base'))) : ?>
<dt>Service</dt>
<dd><?php echo HTML::anchor('product/view/'.$o->product_id,$o->product->title()); ?></dd>
<?php endif ?>
</div> <!-- /dl-horizontal -->
</fieldset>
<?php echo $o->product->feature_summary(); ?>
</div> <!-- /span -->
<dt>Invoiced To</dt>
<dd><?php echo $o->invoiced_to(TRUE); ?></dd>
<dt>Paid To</dt>
<dd><?php echo $o->paid_to(TRUE); ?></dd>
<dt>Date Next Invoice</dt>
<dd><?php printf($o->suspend_billing ? '<strike>%s</strike>' : '%s',$o->display('date_next_invoice')); ?></dd>
<dt>Current Invoices Due</dt>
<dd><?php echo $o->due(TRUE); ?></dd>
<?php endif ?>
</div> <!-- /dl-horizontal -->
</fieldset>
<?php echo $o->product->feature_summary(); ?>

View File

@@ -0,0 +1,18 @@
<!-- o = Model_Service -->
<fieldset>
<legend>Invoices for this Service</legend>
<?php echo Table::factory()
->data($o->invoice_list(FALSE,20))
->columns(array(
'id'=>'ID',
'void'=>'Void',
'date_orig'=>'Date',
'due_date'=>'Due',
'total(TRUE)'=>'Amount',
'due(TRUE)'=>'Due',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','invoice/view/')),
)); ?>
</fieldset>

View File

@@ -0,0 +1,6 @@
<!-- o = Model_Service -->
<fieldset>
<legend>Next Invoice Charges</legend>
<?php echo Invoice::instance()->add_service($o)->render('html','body',array('noid'=>TRUE)); ?>
</fieldset>

View File

@@ -1,104 +1,39 @@
<?php echo View::factory('service/info')->set('o',$o); ?>
<?php echo $o->service_view(); ?>
<div class="col-md-5">
<?php
echo View::factory('service/info')->set('o',$o);
<?php if ($o->service_billing->loaded()) : ?>
<div class="span5">
<fieldset>
<legend>Automatic Payment Details</legend>
if ($o->status AND ! $o->external_billing) :
echo View::factory('service/user/invoice/next')->set('o',$o);
endif;
<div class="dl-horizontal">
<dt>Direct Payment</dt>
<dd><?php echo $o->service_billing->checkout->display('name'); ?></dd>
<?php if (! is_null($o->service_billing->checkout_amount)) : ?>
<dt>Standard Amount</dt>
<dd><?php echo $o->service_billing->display('checkout_amount'); ?></dd>
<?php endif ?>
</div> <!-- /dl-horizontal -->
</fieldset>
</div> <!-- /span -->
<?php endif ?>
if ($o->service_billing->loaded()) :
echo View::factory('service/user/view/payment')->set('o',$o);
endif;
?>
</div>
<div class="col-md-6">
<?php echo $o->service_view(); ?>
</div>
<div class="col-md-5">
<?php echo View::factory('service/user/invoice/list')->set('o',$o); ?>
</div>
<?php if ($o->charges()) : ?>
<div class="span5">
<fieldset>
<legend>Service Charges to Bill: <?php echo $o->charges(TRUE,TRUE); ?></legend>
<?php echo Table::factory()
->data($o->charge_list(TRUE))
->columns(array(
'date_orig'=>'Date',
'description'=>'Description',
'total(TRUE)'=>'Amount',
)); ?>
</fieldset>
</div> <!-- /span -->
<div class="col-md-7">
<?php echo View::factory('service/user/view/charges')->set('o',$o); ?>
</div>
<?php endif ?>
<?php if ($o->status AND ! $o->external_billing) : ?>
<div class="span5">
<fieldset>
<legend>Next Invoice Charges</legend>
<?php echo Invoice::instance()->add_service($o)->render('html','body',array('noid'=>TRUE)); ?>
</fieldset>
</div> <!-- /span -->
<?php endif ?>
<div class="span5">
<fieldset>
<legend>Invoices for this Service</legend>
<?php echo Table::factory()
->data($o->invoice_list())
->columns(array(
'id'=>'ID',
'void'=>'Void',
'date_orig'=>'Date',
'due_date'=>'Due',
'total(TRUE)'=>'Amount',
'due(TRUE)'=>'Due',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','invoice/view/')),
)); ?>
</fieldset>
</div> <!-- /span -->
<?php $x=$o->service_memo->find_all(); if ($x->count()) : ?>
<div class="span5">
<fieldset>
<legend>Service Memos</legend>
<?php echo Table::factory()
->data($x)
->columns(array(
'id'=>'ID',
'date_orig'=>'Date',
'account->name()'=>'Account',
'memo'=>'Memo',
)); ?>
</fieldset>
</div> <!-- /span -->
<div class="col-md-7">
<?php echo View::factory('service/user/view/memos')->set('o',$o); ?>
</div>
<?php endif ?>
<?php $x=$o->email()->find_all(); if ($x->count()) : ?>
<div class="span5">
<fieldset>
<legend>Emails about this service</legend>
<?php echo Table::factory()
->data($x)
->columns(array(
'id'=>'ID',
'date_orig'=>'Date',
'resolve("subject")'=>'Subject',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','email/view/')),
))
->postproc(array(
'resolve("subject")'=>array('trim'=>45),
)); ?>
</fieldset>
</div> <!-- /span -->
<div class="col-md-7">
<?php echo View::factory('service/user/view/emails')->set('o',$o); ?>
</div>
<?php endif ?>

View File

@@ -0,0 +1,12 @@
<!-- o = Model_Service -->
<fieldset>
<legend>Service Charges to Bill: <?php echo $o->charges(TRUE,TRUE); ?></legend>
<?php echo Table::factory()
->data($o->charge_list(TRUE))
->columns(array(
'date_orig'=>'Date',
'description'=>'Description',
'total(TRUE)'=>'Amount',
)); ?>
</fieldset>

View File

@@ -0,0 +1,17 @@
<fieldset>
<legend>Emails about this service</legend>
<?php echo Table::factory()
->data($o->email()->limit(20)->find_all())
->columns(array(
'id'=>'ID',
'date_orig'=>'Date',
'resolve("subject")'=>'Subject',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','email/view/')),
))
->postproc(array(
'resolve("subject")'=>array('trim'=>45),
)); ?>
</fieldset>

View File

@@ -0,0 +1,13 @@
<!-- o = Model_Service -->
<fieldset>
<legend>Service Memos</legend>
<?php echo Table::factory()
->data($o->service_memo->find_all())
->columns(array(
'id'=>'ID',
'date_orig'=>'Date',
'account->name()'=>'Account',
'memo'=>'Memo',
)); ?>
</fieldset>

View File

@@ -0,0 +1,13 @@
<!-- o = Model_Service -->
<fieldset>
<legend>Automatic Payment Details</legend>
<div class="dl-horizontal">
<dt>Direct Payment</dt>
<dd><?php echo $o->service_billing->checkout->display('name'); ?></dd>
<?php if (! is_null($o->service_billing->checkout_amount)) : ?>
<dt>Standard Amount</dt>
<dd><?php echo $o->service_billing->display('checkout_amount'); ?></dd>
<?php endif ?>
</div> <!-- /dl-horizontal -->
</fieldset>