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

@ -137,7 +137,7 @@ class Controller_Admin_Module extends Controller_Module {
Block::factory() Block::factory()
->title(sprintf('%s: %s ',_('Defined Module Methods For'),$mo->display('name'))) ->title(sprintf('%s: %s ',_('Defined Module Methods For'),$mo->display('name')))
->title_icon('icon-cog') ->title_icon('fa fa-cog')
->body(Table::factory() ->body(Table::factory()
->data($methods['exist']) ->data($methods['exist'])
->columns(array( ->columns(array(
@ -154,7 +154,7 @@ class Controller_Admin_Module extends Controller_Module {
Block::factory() Block::factory()
->title(sprintf('%s: %s ',_('Missing Module Methods For'),$mo->display('name'))) ->title(sprintf('%s: %s ',_('Missing Module Methods For'),$mo->display('name')))
->title_icon('icon-exclamation-sign') ->title_icon('fa fa-question')
->body(Table::factory() ->body(Table::factory()
->data($methods['missing']) ->data($methods['missing'])
->columns(array( ->columns(array(
@ -173,7 +173,7 @@ class Controller_Admin_Module extends Controller_Module {
public function action_list() { public function action_list() {
Block::factory() Block::factory()
->title('Defined Modules') ->title('Defined Modules')
->title_icon('icon-cog') ->title_icon('fa fa-cog')
->body(Table::factory() ->body(Table::factory()
->data(ORM::factory('Module')->where('parent_id','is',NULL)->find_all()) ->data(ORM::factory('Module')->where('parent_id','is',NULL)->find_all())
->jssort(TRUE) ->jssort(TRUE)

View File

@ -37,7 +37,7 @@ class Controller_Admin_Module_Method extends Controller_Admin_Module {
Block::factory() Block::factory()
->title(sprintf(_('Add Method (%s) to Database for (%s)'),strtoupper($method),strtoupper($mo->name))) ->title(sprintf(_('Add Method (%s) to Database for (%s)'),strtoupper($method),strtoupper($mo->name)))
->title_icon('icon-plus-sign') ->title_icon('fa fa-plus')
->type('form-horizontal') ->type('form-horizontal')
->body(View::factory('module/method/admin/add') ->body(View::factory('module/method/admin/add')
->set('name',$method) ->set('name',$method)
@ -99,11 +99,9 @@ class Controller_Admin_Module_Method extends Controller_Admin_Module {
Block::factory() Block::factory()
->title(sprintf(_('Configure access to method (%s::%s)'),$mmo->controller(),$mmo->method())) ->title(sprintf(_('Configure access to method (%s::%s)'),$mmo->controller(),$mmo->method()))
->title_icon('icon-plus-sign') ->title_icon('fa fa-lock')
->type('form') ->type('form')
->body(View::factory('module/method/admin/edit') ->body(View::factory('module/method/admin/edit')->set('o',$mmo));
->set('o',$mmo)
);
} }
} }
?> ?>

View File

@ -30,7 +30,7 @@ class Menu extends lnApp_Menu {
return $result; return $result;
} }
public static function items($type) { public static function items($type,array $list=array()) {
$result = array(); $result = array();
if (empty(URL::$method_directory[$type])) if (empty(URL::$method_directory[$type]))

View File

@ -55,7 +55,6 @@ abstract class ORM extends lnApp_ORM {
/** /**
* Determine if the account is authoised by the user * Determine if the account is authoised by the user
*/ */
// @todo This function shouldnt be here.
public function authorised(Model $o=NULL,Model_Account $ao=NULL,$aid='account_id') { public function authorised(Model $o=NULL,Model_Account $ao=NULL,$aid='account_id') {
if (is_null($o)) if (is_null($o))
$o = $this; $o = $this;
@ -147,6 +146,13 @@ abstract class ORM extends lnApp_ORM {
return ORM::factory('Module',array('name'=>$this->_table_name)); return ORM::factory('Module',array('name'=>$this->_table_name));
} }
/**
* Name value return for the record
*/
public function name() {
return sprintf('Unknown [%s]',$this->id);
}
/** /**
* Set the site ID attribute for each row update * Set the site ID attribute for each row update
*/ */

View File

@ -0,0 +1,3 @@
<?php echo View::factory('service/user/list')->set('o',$o); ?>
<?php echo View::factory('invoice/user/list/due')->set('o',$o); ?>
<?php echo View::factory('service/user/list/expiring')->set('o',$o); ?>

View File

@ -1,42 +1,44 @@
<div class="span5"> <div class="row">
<fieldset> <div class="col-md-3">
<legend>Method Details</legend> <fieldset>
<legend>Method Details</legend>
<?php echo Form::input('notes',$o->notes,array('label'=>'Description','placeholder'=>'Method Description','class'=>'span5')); ?> <?php echo Form::input('notes',$o->notes,array('label'=>'Description','placeholder'=>'Method Description')); ?>
<?php echo Form::input('menu_display',$o->menu_display,array('label'=>'Menu Title','placeholder'=>'Menu Title')); ?> <?php echo Form::input('menu_display',$o->menu_display,array('label'=>'Menu Title','placeholder'=>'Menu Title')); ?>
</fieldset> </fieldset>
</div> <!-- /span -->
<div class="span6">
<fieldset>
<legend>Method Security</legend>
<table class="table table-striped table-condensed table-hover" id="list-table">
<thead><tr>
<th>Method</th>
<th>Notes</th>
<th>Group Active</th>
<th>Method Enable</th>
</tr></thead>
<tbody>
<?php foreach (ORM::factory('Group')->find_all() as $go) : ?>
<tr>
<td><?php echo HTML::anchor(URL::link('admin','group/edit/'.$go->id,TRUE),$go->display('name')); ?></td>
<td><?php echo $go->display('notes'); ?></td>
<td><?php echo $go->display('status'); ?></td>
<td><?php echo Form::checkbox('groups[]',$go->id,$o->has('group',$go)); ?></td>
</tr>
<?php endforeach ?>
</tbody>
</table>
</fieldset>
<div class="row">
<div class="offset2">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn">Cancel</button>
</div>
</div> </div>
</div> <!-- /span -->
<div class="col-md-7">
<fieldset>
<legend>Method Security</legend>
<table class="table table-striped table-condensed table-hover" id="list-table">
<thead><tr>
<th>Method</th>
<th>Notes</th>
<th>Group Active</th>
<th>Method Enable</th>
</tr></thead>
<tbody>
<?php foreach (ORM::factory('Group')->find_all() as $go) : ?>
<tr>
<td><?php echo HTML::anchor(URL::link('admin','group/edit/'.$go->id,TRUE),$go->display('name')); ?></td>
<td><?php echo $go->display('notes'); ?></td>
<td><?php echo $go->display('status'); ?></td>
<td><?php echo Form::checkbox('groups[]',$go->id,$o->has('group',$go),array('nocg'=>TRUE)); ?></td>
</tr>
<?php endforeach ?>
</tbody>
</table>
</fieldset>
</div>
</div>
<div class="row">
<div class="col-md-4">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn">Cancel</button>
</div>
</div>

View File

@ -17,7 +17,7 @@
<div id="kodoc-header"> <div id="kodoc-header">
<div class="container"> <div class="container">
<a href="http://dev.leenooks.vpn/" id="kodoc-logo"> <a href="http://dev.leenooks.net/" id="kodoc-logo">
<img src="<?php echo Route::url('docs/media', array('file' => 'img/logo-small.png')) ?>" /> <img src="<?php echo Route::url('docs/media', array('file' => 'img/logo-small.png')) ?>" />
</a> </a>
<div id="kodoc-menu"> <div id="kodoc-menu">

View File

@ -0,0 +1,3 @@
<?php echo View::factory('service/user/list')->set('o',$o); ?>
<?php echo View::factory('invoice/user/list/due')->set('o',$o); ?>
<?php echo View::factory('service/user/list/expiring')->set('o',$o); ?>

View File

@ -20,7 +20,7 @@ class Task_Invoice_Service extends Minion_Task {
$max = ($x=Kohana::$config->load('debug')->invoice) ? $x : ORM::factory('Invoice')->config('GEN_INV_MAX'); $max = ($x=Kohana::$config->load('debug')->invoice) ? $x : ORM::factory('Invoice')->config('GEN_INV_MAX');
// Sort our service by account_id, then we can generate 1 invoice. // Sort our service by account_id, then we can generate 1 invoice.
$svs = ORM::factory('Service')->list_invoicesoon($params['days'])->as_array(); $svs = ORM::factory('Service')->list_invoicesoon($params['days'])->as_array();
Sort::MAsort($svs,'account_id'); Sort::MAsort($svs,array('account_id'));
$sids = $params['id'] ? explode(':',$params['id']) : array(); $sids = $params['id'] ? explode(':',$params['id']) : array();

@ -1 +1 @@
Subproject commit 6a33249a95ea484dd60470edc3b38f85ff5e1340 Subproject commit 8f659c50c675c427e60a103a19fd3415d0cbbd07

View File

@ -113,11 +113,11 @@ class Controller_Admin_Payment extends Controller_Payment {
Script::factory() Script::factory()
->type('file') ->type('file')
->data('media/theme/bootstrap/vendor/datepicker/js/bootstrap-datepicker.js'); ->data('media/theme/bootstrap/js/bootstrap.datepicker.js');
Style::factory() Style::factory()
->type('file') ->type('file')
->data('media/theme/bootstrap/vendor/datepicker/css/datepicker.css'); ->data('media/theme/bootstrap/css/bootstrap.datepicker.css');
Script::factory() Script::factory()
->type('stdin') ->type('stdin')
@ -125,6 +125,7 @@ class Controller_Admin_Payment extends Controller_Payment {
$(document).ready(function() { $(document).ready(function() {
$("#date_payment_label").datepicker({ $("#date_payment_label").datepicker({
autoclose : true, autoclose : true,
todayHighlight: true,
endDate : new Date(), endDate : new Date(),
format : "dd-mm-yyyy", format : "dd-mm-yyyy",
todayBtn : true, todayBtn : true,

View File

@ -1,28 +1,29 @@
<div class="span11"> <div class="col-md-11">
<fieldset> <fieldset>
<legend>Payment Details</legend> <legend>Payment Details</legend>
<div class="input-append date" id="date_payment_label"> <label for="date_payment_label">Date Paid</label>
<?php echo Form::input('date_payment_label',$o->display('date_payment'),array('class'=>'span2','label'=>'Date Paid','add-on'=>'<i class="icon-calendar"></i>','disabled')); ?> <div class="input-group col-md-3">
<input type="text" id="date_payment_label" value="" xisabled="disabled" class="form-control" placeholder="Date Paid">
<span class="input-group-addon" id="basic-addon1"><i class="fa fa-calendar"></i></span>
</div> </div>
<?php echo Form::hidden('date_payment',''); ?>
<?php echo Form::hidden('date_payment',$o->date_payment); ?>
<?php echo Form::select('checkout_id',ORM::factory('Checkout')->list_select(),$o->checkout_id,array('label'=>'Payment Method','required')); ?> <?php echo Form::select('checkout_id',ORM::factory('Checkout')->list_select(),$o->checkout_id,array('label'=>'Payment Method','required')); ?>
<?php echo Form::input('total_amt',$o->total_amt,array('class'=>'span2','label'=>'Amount','placeholder'=>'Total','help-block'=>sprintf('Credits: %s, Balance: %s',$o->credit(),$o->total()))); ?> <?php echo Form::input('total_amt',$o->total_amt,array('label'=>'Amount','placeholder'=>'Total','help-block'=>sprintf('Credits: %s, Balance: %s',$o->credit(),$o->total()))); ?>
<?php echo Form::input('fees_amt',$o->fees_amt,array('class'=>'span2','label'=>'Fees','placeholder'=>'Fees')); ?> <?php echo Form::input('fees_amt',$o->fees_amt,array('label'=>'Fees','placeholder'=>'Fees')); ?>
<?php echo Form::input('account_id_label',$o->account->name(),array('class'=>'span5','label'=>'Account','placeholder'=>'Account','data-provide'=>'typeahead')); ?> <?php echo Form::input('account_id_label',$o->account->name(),array('label'=>'Account','placeholder'=>'Account','data-provide'=>'typeahead')); ?>
<?php echo Form::hidden('account_id',$o->account_id); ?> <?php echo Form::hidden('account_id',$o->account_id); ?>
<?php echo Form::input('notes',$o->notes,array('class'=>'span5','label'=>'Notes','placeholder'=>'Any notes about this payment?')); ?> <?php echo Form::input('notes',$o->notes,array('label'=>'Notes','placeholder'=>'Any notes about this payment?')); ?>
</fieldset> </fieldset>
<div class="span11"> <div class="col-md-11">
<div class="span8" id="items"></div> <div class="col-md-8" id="items"></div>
</div> </div>
<div class="row"> <div class="row">
<div class="offset2"> <button type="submit" class="btn btn-primary">Save changes</button>
<button type="submit" class="btn btn-primary">Save changes</button> <button type="button" class="btn">Cancel</button>
<button type="button" class="btn">Cancel</button>
</div>
</div> </div>
</div> <!-- /span --> </div> <!-- /span -->

View File

@ -13,14 +13,27 @@ class Controller_Admin_Product extends Controller_Product {
protected $auth_required = TRUE; protected $auth_required = TRUE;
protected $secure_actions = array( protected $secure_actions = array(
'ajaxaccounting'=>TRUE,
'ajaxtranslatecategory'=>TRUE, 'ajaxtranslatecategory'=>TRUE,
'ajaxtranslate'=>TRUE, 'ajaxtranslate'=>TRUE,
'category'=>TRUE, 'category'=>TRUE,
'edit'=>TRUE, 'edit'=>TRUE,
'list'=>TRUE, 'list'=>TRUE,
'listused'=>TRUE,
'view'=>TRUE, 'view'=>TRUE,
); );
public function action_ajaxaccounting() {
$products = ORM::factory('Product')->where('accounting','LIKE','%'.$this->request->query('term').'%')->find_all();
$result = array();
foreach ($products as $po)
array_push($result,array('value'=>$po->accounting,'label'=>$po->accounting));
$this->response->headers('Content-Type','application/json');
$this->response->body(json_encode(array_values($result)));
}
public function action_ajaxtranslate() { public function action_ajaxtranslate() {
$po = ORM::factory('Product',$this->request->param('id')); $po = ORM::factory('Product',$this->request->param('id'));
@ -140,13 +153,56 @@ $(document).ready(function() {
} }
}); });
}); });
$("input[name=accounting]").typeahead({
minLength: 2,
source: function (query,process) {
accounting(\'a/product/ajaxaccounting\',query,process);
},
matcher: function () { return true; },
});
}); });
var d=0;
var accounting = _.debounce(function(url,query,process){
$.ajax({
url : site_url+url,
type : "GET",
data : "term=" + query,
dataType : "JSON",
async : true,
cache : false,
beforeSend : function() {
if (d++ == 0) $(\'i[name=acclook]\').removeClass("hidden");
},
success : function(data) {
// if json is null, means no match, won\'t do again.
if(data==null || (data.length===0)) return;
users = {};
userLabels = [];
_.each(data,function(item,ix,list) {
if (_.contains(users,item.label)) item.label = item.label + \' #\' + item.value;
userLabels.push(item.label);
users[item.label] = item.value;
});
process(userLabels);
},
complete : function() {
if (--d == 0) $(\'i[name=acclook]\').addClass("hidden");
}
})
}, 500);
'); ');
Block::factory() Block::factory()
->type('form-horizontal') ->type('form-horizontal')
->title('Update Product') ->title('Update Product')
->title_icon('icon-wrench') ->title_icon('fa fa-wrench')
->body(View::factory('product/admin/edit') ->body(View::factory('product/admin/edit')
->set('plugin_form',$po->plugin_edit()) ->set('plugin_form',$po->plugin_edit())
->set('o',$po)); ->set('o',$po));
@ -156,30 +212,33 @@ $(document).ready(function() {
* Show a list of products * Show a list of products
*/ */
public function action_list() { public function action_list() {
$products = ($x=$this->request->param('id')) ? ORM::factory('Product_Category',$x)->products() : ORM::factory('Product')->order_by('status','DESC')->order_by('prod_plugin_file')->find_all(); $products = ($x=ORM::factory('Product_Category',$this->request->param('id')) AND $x->loaded()) ? $x->products() : ORM::factory('Product')->order_by('status','DESC')->order_by('prod_plugin_file')->find_all();
Block::factory() Block::factory()
->title(_('Products')) ->title(_('Products').($x->loaded() ? ' - '.$x->name() : ' - All'))
->title_icon('icon-th') ->title_icon('fa fa-list')
->body(Table::factory() ->body(View::factory('product/list')->set('list',$products));
->data($products)
->page_items(25)
->columns(array(
'id'=>'ID',
'title()'=>'Details',
'status'=>'Active',
'prod_plugin_file'=>'Plugin Name',
'prod_plugin_data'=>'Plugin Data',
'price_type'=>'Price Type',
'taxable'=>'Taxable',
'service->list_count()'=>'Services',
'invoice->list_count()'=>'Invoices',
))
->prepend(array(
'id'=>array('url'=>URL::link('admin','product/edit/')),
)));
} }
/**
* List all the products that have an active service
*/
public function action_listused() {
$db = Database::instance();
$columns = '';
foreach (array_keys(ORM::factory('Product')->table_columns()) as $text)
$columns .= ($columns ? ',' : '').'p.'.$text;
$products = $db->query(Database::SELECT,sprintf('SELECT %s FROM ab_product p,ab_service s WHERE s.product_id=p.id AND s.status=1 AND p.site_id = s.site_id AND s.site_id=%s GROUP BY p.id',$columns,Company::instance()->site()),'Model_Product');
Block::factory()
->title(_('Products with Active Services'))
->title_icon('fa fa-list')
->body(View::factory('product/list')->set('list',$products));
}
public function action_view() { public function action_view() {
$po = ORM::factory('Product',$this->request->param('id')); $po = ORM::factory('Product',$this->request->param('id'));

View File

@ -39,6 +39,12 @@ class Model_Product_Category extends ORM_OSB {
return $x->loaded() ? $x->display('description') : 'No Description'; return $x->loaded() ? $x->display('description') : 'No Description';
} }
public function name() {
$x = $this->translate();
return $x->loaded() ? $x->display('name') : 'No Name';
}
/** /**
* List all the products belonging to this cateogry * List all the products belonging to this cateogry
*/ */

View File

@ -1,68 +1,77 @@
<div class="span11"> <div class="col-md-12">
<fieldset> <fieldset>
<legend>Update Product</legend> <legend><?php echo $o->title();?></legend>
<div class="row"> <div class="form-group">
<div class="tabbable span9"> <label for="status" class="col-sm-2 control-label">Product Active</label>
<div class="col-sm-2"><?php echo StaticList_YesNo::form('status',$o->status,FALSE,array('label'=>'Product Active','nocg'=>TRUE,'id'=>'status','class'=>'form-control')); ?></div>
<ul class="nav nav-tabs">
<?php $c=0;foreach (StaticList_RecurSchedule::table() as $k=>$v) : ?>
<li class="<?php echo $c++ ? '' : 'active'; ?>"><a href="#tab<?php echo $k; ?>" data-toggle="tab"><?php echo $v; ?></a></li>
<?php endforeach ?>
</ul>
<div class="tab-content">
<?php $c=0;foreach (StaticList_RecurSchedule::table() as $k=>$v) : ?>
<div class="tab-pane <?php echo $c++ ? '' : 'active'; ?>" id="tab<?php echo $k; ?>">
<?php echo Form::checkbox("price_group[$k][show]",1,$o->is_price_shown($k),array('label'=>'Price Active','class'=>'span2')); ?>
<?php foreach (ORM::factory('Group')->list_pricegroups() as $go) : ?>
<div class="row">
<div class="span2"><?php echo $go->name; ?></div>
<?php foreach (array_keys($o->price_options()) as $po) : ?>
<div class="span2">
<?php echo Form::input("price_group[$k][{$go->id}][{$o->price_option($po)}]",$o->price($go->id,$k,$po),array('placeholder'=>$po,'nocg'=>TRUE,'class'=>'span2')); ?>
</div>
<?php endforeach ?> <!-- /price_options() -->
</div>
<?php endforeach ?> <!-- /list_pricegroups() -->
</div> <!-- /tab-pane -->
<?php endforeach ?> <!-- /StaticList_RecurSchedule -->
</div> <!-- /tab-content -->
</div> <!-- /tabbable -->
</div> <!-- /row -->
<br>
<div class="row">
<?php echo StaticList_YesNo::form('status',$o->status,FALSE,array('label'=>'Product Active','class'=>'span1')); ?>
</div> </div>
<div class="row"> <div class="form-group">
<?php echo StaticList_RecurSchedule::form('price_recurr_default',$o->price_recurr_default,FALSE,array('label'=>'Default Period','class'=>'span2')); ?></td> <label for="price_recurr_default" class="col-sm-2 control-label">Default Period</label>
</div> <!-- /row --> <div class="col-sm-2"><?php echo StaticList_RecurSchedule::form('price_recurr_default',$o->price_recurr_default,FALSE,array('label'=>'Default Period','nocg'=>TRUE,'class'=>'form-control')); ?></div>
</div>
<div class="row"> <div class="form-group">
<?php echo Form::input('position',$o->position,array('label'=>'Order','class'=>'span1')); ?> <label for="position" class="col-sm-2 control-label">Position</label>
</div> <!-- /row --> <div class="col-sm-2"><?php echo Form::input('position',$o->position,array('label'=>'Order','nocg'=>TRUE,'class'=>'form-control')); ?></div>
</div>
<div class="row"> <div class="form-group">
<?php echo Form::select('language_id',ORM::factory('Language')->list_select(TRUE),'',array('label'=>'Language','required')); ?> <label for="accouting" class="col-sm-2 control-label">Accounting</label>
</div> <!-- /row --> <div class="col-sm-2"><?php echo Form::input('accounting',$o->accounting,array('label'=>'Accounting','autocomplete'=>'off','nocg'=>TRUE,'class'=>'form-control','data-provide'=>'typeahead')); ?></div>
<i class="fa fa-spin fa-spinner hidden" name="acclook"></i>
</div>
<div class="row">
<div class="col-md-10">
<ul class="nav nav-tabs" role="tablist">
<?php $c=0;foreach (StaticList_RecurSchedule::table() as $k=>$v) : ?>
<li class="<?php echo $c++ ? '' : 'active'; ?>"><a href="#tab<?php echo $k; ?>" data-toggle="tab"><?php echo $v; ?></a></li>
<?php endforeach ?>
</ul>
<div class="tab-content">
<?php $c=0;foreach (StaticList_RecurSchedule::table() as $k=>$v) : ?>
<div class="tab-pane <?php echo $c++ ? '' : 'active'; ?>" id="tab<?php echo $k; ?>">
<div class="col-md-7">
<table class="table">
<tr>
<td>Price Active</td>
<td colspan="2"><?php echo Form::checkbox("price_group[$k][show]",1,$o->is_price_shown($k),array('nocg'=>TRUE)); ?></td>
</tr>
<tr><th>&nbsp;</th><th>Setup</th><th>Base</th></tr>
<?php foreach (ORM::factory('Group')->list_pricegroups() as $go) : ?>
<tr>
<td><?php echo $go->name; ?></td>
<?php foreach (array_keys($o->price_options()) as $po) : ?>
<td><?php echo Form::input("price_group[$k][{$go->id}][{$o->price_option($po)}]",$o->price($go->id,$k,$po),array('placeholder'=>$po,'nocg'=>TRUE)); ?></td>
<?php endforeach ?> <!-- /price_options() -->
</tr>
<?php endforeach ?> <!-- /list_pricegroups() -->
</table>
</div>
</div> <!-- /tab-pane -->
<?php endforeach ?> <!-- /StaticList_RecurSchedule -->
</div> <!-- /tab-content -->
</div>
</div>
<div class="form-group">
<label for="language_id" class="col-sm-2 control-label">Language</label>
<div class="col-sm-2"><?php echo Form::select('language_id',ORM::factory('Language')->list_select(TRUE),'',array('nocg'=>TRUE,'class'=>'form-control')); ?></div>
</div>
<div id="translate"></div>
<?php if ($plugin_form) { echo '<br/>'.$plugin_form; } ?>
</fieldset> </fieldset>
<div id="translate"></div>
<?php if ($plugin_form) { echo '<br/>'.$plugin_form; } ?>
<div class="row"> <div class="row">
<div class="offset2"> <div class="col-md-6">
<button type="submit" class="btn btn-primary">Save changes</button> <button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn">Cancel</button> <button type="button" class="btn">Cancel</button>
</div> </div>

View File

@ -0,0 +1,17 @@
<!-- list = array Product -->
<?php echo Table::factory()
->data($list)
->page_items(25)
->columns(array(
'id'=>'ID',
'title()'=>'Details',
'status'=>'Active',
'prod_plugin_file'=>'Plugin Name',
'prod_plugin_data'=>'Plugin Data',
'price_type'=>'Price Type',
'accounting'=>'Accounting',
'service->find_all()->count()'=>'Services',
))
->prepend(array(
'id'=>array('url'=>URL::link('admin','product/edit/')),
)); ?>

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()) if ($this->request->post() AND $so=$this->add_edit() AND $so->loaded())
HTTP::redirect(URL::link('admin','service/edit/'.$so->id)); 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 // @todo This AJAX URL should be a service one
Script::factory() Script::factory()
->type('stdin') ->type('stdin')
->data(' ->data('
$(document).ready(function() { $(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() { $("select[name=product_id]").change(function() {
// If we select a blank, then dont continue // If we select a blank, then dont continue
if (this.value == 0) 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() Block::factory()
->type('form-horizontal') ->type('form-horizontal')
->title('Add/View Charge') ->title('Add/View Charge')

View File

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

View File

@ -270,8 +270,8 @@ class Model_Service extends ORM_OSB {
/** /**
* Return a descriptive name for this service * Return a descriptive name for this service
*/ */
public function service_name() { public function service_name($chars=NULL) {
return is_null($x=$this->plugin()) ? $this->name() : $x->service_name(); 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) { public function list_invoicesoon($days=0) {
return $this->_where_active() 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) ->where('date_next_invoice','<',time()+(ORM::factory('Invoice')->config('GEN_DAYS')+$days)*86400)
->find_all(); ->find_all();
} }

View File

@ -1,51 +1,30 @@
<div class="span11"> <div class="col-md-11">
<fieldset> <fieldset>
<legend>Service Information</legend> <legend>Service Information</legend>
<div class="row"> <?php echo Form::input('account_id_label','',array('label'=>'Account','placeholder'=>'Account','autocomplete'=>'no','data-provide'=>'typeahead')); ?>
<?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',''); ?>
<?php echo Form::hidden('account_id',NULL); ?>
</div> <!-- /row -->
<div class="row"> <?php echo StaticList_YesNo::form('status',NULL,FALSE,array('label'=>'Active')); ?>
<?php echo StaticList_YesNo::form('status',NULL,FALSE,array('label'=>'Active','class'=>'span1')); ?> <?php echo StaticList_RecurSchedule::form('recur_schedule',NULL,FALSE,array('label'=>'Billing Period','required'));?>
</div> <!-- /row -->
<div class="row"> <label for="date_next_invoice_label">Date Next Invoice</label>
<?php echo StaticList_RecurSchedule::form('recur_schedule',NULL,FALSE,array('label'=>'Billing Period','required'));?> <div class="input-group col-md-3">
</div> <!-- /row --> <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"> <?php echo StaticList_YesNo::form('taxable',NULL,FALSE,array('label'=>'Taxable')); ?>
<div class="input-append date" id="date_next_invoice_label"> <?php echo StaticList_YesNo::form('suspend_billing',NULL,FALSE,array('label'=>'Suspend Billing')); ?>
<?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')); ?> <?php echo Form::input('price_override',NULL,array('label'=>'Override Price')); ?>
</div> <?php echo Form::select('product_id',ORM::factory('Product')->list_select(TRUE),NULL,array('label'=>'Product','sort'=>TRUE)); ?>
<?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 -->
</fieldset> </fieldset>
<div id="plugin"></div> <div id="plugin"></div>
<div class="row"> <div class="row">
<div class="offset2"> <button type="submit" class="btn btn-primary">Save changes</button>
<button type="submit" class="btn btn-primary">Save changes</button> <button type="button" class="btn">Cancel</button>
<button type="button" class="btn">Cancel</button>
</div>
</div> </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"> <?php echo View::factory('service/info')->set('o',$o); ?>
<fieldset> <?php echo $o->service_view(); ?>
<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 if ($o->service_billing->loaded()) : ?> <?php if ($o->service_billing->loaded()) : ?>
<div class="span5"> <div class="span5">

View File

@ -27,6 +27,8 @@ class Model_SSL_CA extends ORM_OSB {
), ),
); );
protected $_form = array('id'=>'id','value'=>'subject()');
public function filters() { public function filters() {
return array( return array(
'parent_ssl_ca_id'=>array( 'parent_ssl_ca_id'=>array(

View File

@ -11,6 +11,7 @@
*/ */
class Model_Service_Plugin_Ssl extends Model_Service_Plugin { class Model_Service_Plugin_Ssl extends Model_Service_Plugin {
protected $_table_name = 'service__ssl'; protected $_table_name = 'service__ssl';
protected $_created_column = FALSE;
protected $_updated_column = FALSE; protected $_updated_column = FALSE;
// Relationships // Relationships

View File

@ -0,0 +1,6 @@
<fieldset>
<legend>SSL Details</legend>
<?php echo Form::select('plugin[ssl_ca_id]',ORM::factory('SSL_CA')->list_select(TRUE),NULL,array('label'=>'CA','sort'=>TRUE)); ?>
<?php echo Form::textarea('plugin[csr]','',array('label'=>'CSR','placeholder'=>'CSR','style'=>'font-family: monospace;','cols'=>63,'rows'=>20)); ?>
</fieldset>