Many updates as a result of updating lnapp; added SSL service order

This commit is contained in:
Deon George
2016-06-05 22:33:12 +10:00
parent 44769e3de7
commit 0c7fe830a3
25 changed files with 384 additions and 268 deletions

View File

@@ -23,11 +23,59 @@ class Controller_Admin_Service extends Controller_Service {
if ($this->request->post() AND $so=$this->add_edit() AND $so->loaded())
HTTP::redirect(URL::link('admin','service/edit/'.$so->id));
Script::factory()
->type('file')
->data('media/theme/bootstrap/js/bootstrap.datepicker.js');
Style::factory()
->type('file')
->data('media/theme/bootstrap/css/bootstrap.datepicker.css');
// @todo This AJAX URL should be a service one
Script::factory()
->type('stdin')
->data('
$(document).ready(function() {
$("#date_next_invoice_label").datepicker({
autoclose : true,
todayHighlight: true,
format : "dd-mm-yyyy",
todayBtn : true,
}).on("hide",function(ev) {
$("input[name=date_next_invoice]").val(ev.date.valueOf()/1000);
});
$("input[name=account_id_label]").typeahead({
minLength: 2,
source: function (query,process) {
search("'.URL::link('admin','payment/ajaxlist').'",query,process);
},
matcher: function () { return true; },
updater: function (item) {
$("input[name=account_id]").val(users[item]);
// Send the request and update sub category dropdown
$.ajax({
type: "GET",
data: "key="+users[item],
dataType: "html",
cache: false,
url: "'.URL::link('admin','payment/ajaxitemlist',TRUE).'",
timeout: 2000,
error: function(x) {
alert("Failed to submit");
},
success: function(data) {
$("div[id=items]").empty().append(data);
}
});
return item;
},
});
$("select[name=product_id]").change(function() {
// If we select a blank, then dont continue
if (this.value == 0)
@@ -49,40 +97,9 @@ $(document).ready(function() {
}
});
});
$("#date_next_invoice_label").datepicker({
autoclose : true,
format : "dd-M-yyyy",
todayBtn : true,
}).on("hide",function(ev) {
$("input[name=date_next_invoice]").val(ev.date.valueOf()/1000);
});
$("input[name=account_id_label]").typeahead({
minLength: 2,
source: function (query,process) {
search("'.URL::link('admin','payment/ajaxlist').'",query,process);
},
matcher: function () { return true; },
updater: function (item) {
$("input[name=account_id]").val(users[item]);
return item;
},
});
});
');
Script::factory()
->type('file')
->data('media/theme/bootstrap/vendor/datepicker/js/bootstrap-datepicker.js');
Style::factory()
->type('file')
->data('media/theme/bootstrap/vendor/datepicker/css/datepicker.css');
Block::factory()
->type('form-horizontal')
->title('Add/View Charge')

View File

@@ -69,7 +69,7 @@ class Controller_User_Service extends Controller_Service {
Block::factory()
->title(sprintf('%s: %s',$so->id(),$so->service_name()))
->title_icon('icon-list-alt')
->title_icon('fa fa-server')
->body($output);
}
}

View File

@@ -270,8 +270,8 @@ class Model_Service extends ORM_OSB {
/**
* Return a descriptive name for this service
*/
public function service_name() {
return is_null($x=$this->plugin()) ? $this->name() : $x->service_name();
public function service_name($chars=NULL) {
return HTML::abbr(is_null($x=$this->plugin()) ? $this->name() : $x->service_name(),$chars);
}
/**
@@ -385,7 +385,14 @@ class Model_Service extends ORM_OSB {
*/
public function list_invoicesoon($days=0) {
return $this->_where_active()
->where_open()->where('suspend_billing','IS',NULL)->or_where('suspend_billing','=','0')->where_close()
->where_open()
->where('suspend_billing','IS',NULL)
->or_where('suspend_billing','=','0')
->where_close()
->where_open()
->or_where('external_billing','=','0')
->or_where('external_billing','IS',NULL)
->where_close()
->where('date_next_invoice','<',time()+(ORM::factory('Invoice')->config('GEN_DAYS')+$days)*86400)
->find_all();
}

View File

@@ -1,51 +1,30 @@
<div class="span11">
<div class="col-md-11">
<fieldset>
<legend>Service Information</legend>
<div class="row">
<?php echo Form::input('account_id_label',NULL,array('class'=>'span5','label'=>'Account','placeholder'=>'Account','data-provide'=>'typeahead','required')); ?>
<?php echo Form::hidden('account_id',NULL); ?>
</div> <!-- /row -->
<?php echo Form::input('account_id_label','',array('label'=>'Account','placeholder'=>'Account','autocomplete'=>'no','data-provide'=>'typeahead')); ?>
<?php echo Form::hidden('account_id',''); ?>
<div class="row">
<?php echo StaticList_YesNo::form('status',NULL,FALSE,array('label'=>'Active','class'=>'span1')); ?>
</div> <!-- /row -->
<?php echo StaticList_YesNo::form('status',NULL,FALSE,array('label'=>'Active')); ?>
<?php echo StaticList_RecurSchedule::form('recur_schedule',NULL,FALSE,array('label'=>'Billing Period','required'));?>
<div class="row">
<?php echo StaticList_RecurSchedule::form('recur_schedule',NULL,FALSE,array('label'=>'Billing Period','required'));?>
</div> <!-- /row -->
<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="" xisabled="disabled" 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',time()); ?>
<div class="row">
<div class="input-append date" id="date_next_invoice_label">
<?php echo Form::input('date_next_invoice_label',Site::Date(time()),array('class'=>'span2','label'=>'Date Next Invoice','add-on'=>'<i class="icon-calendar"></i>','disabled')); ?>
</div>
<?php echo Form::hidden('date_next_invoice',time()); ?>
</div> <!-- /row -->
<div class="row">
<?php echo StaticList_YesNo::form('taxable',NULL,FALSE,array('label'=>'Taxable','class'=>'span1')); ?>
</div> <!-- /row -->
<div class="row">
<?php echo StaticList_YesNo::form('suspend_billing',NULL,FALSE,array('label'=>'Suspend Billing','class'=>'span1')); ?>
</div> <!-- /row -->
<div class="row">
<?php echo Form::input('price_override',NULL,array('label'=>'Override Price','class'=>'span1')); ?>
</div> <!-- /row -->
<div class="row">
<?php echo Form::select('product_id',ORM::factory('Product')->list_select(TRUE),NULL,array('label'=>'Product','class'=>'span4','sort'=>TRUE)); ?>
</div> <!-- /row -->
<?php echo StaticList_YesNo::form('taxable',NULL,FALSE,array('label'=>'Taxable')); ?>
<?php echo StaticList_YesNo::form('suspend_billing',NULL,FALSE,array('label'=>'Suspend Billing')); ?>
<?php echo Form::input('price_override',NULL,array('label'=>'Override Price')); ?>
<?php echo Form::select('product_id',ORM::factory('Product')->list_select(TRUE),NULL,array('label'=>'Product','sort'=>TRUE)); ?>
</fieldset>
<div id="plugin"></div>
<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

@@ -0,0 +1,46 @@
<!-- o = Service -->
<div class="col-md-5">
<fieldset>
<legend>Service Information</legend>
<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>
<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 endif ?>
</div> <!-- /dl-horizontal -->
</fieldset>
<?php echo $o->product->feature_summary(); ?>
</div> <!-- /span -->

View File

@@ -1,52 +1,5 @@
<div class="span5">
<fieldset>
<legend>Service Information</legend>
<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>
<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 endif ?>
</div> <!-- /dl-horizontal -->
</fieldset>
<?php echo $o->product->feature_summary(); ?>
</div> <!-- /span -->
<div class="span5">
<?php echo $o->service_view(); ?>
</div> <!-- /span -->
<?php echo View::factory('service/info')->set('o',$o); ?>
<?php echo $o->service_view(); ?>
<?php if ($o->service_billing->loaded()) : ?>
<div class="span5">