Clean up add and edit for SSL and adsl

This commit is contained in:
Deon George 2016-11-30 22:32:39 +11:00
parent 378946ee37
commit e412ca72d0
6 changed files with 33 additions and 77 deletions

View File

@ -1,11 +1,9 @@
<fieldset>
<legend>ADSL Service Details</legend>
<div class="row">
<?php echo Form::input('plugin[service_number]',NULL,array('class'=>'span2','label'=>'Service Number','placeholder'=>'Service Number','required')); ?>
</div> <!-- /row -->
<?php
echo View::factory('field/text')->set('data',['field'=>'plugin[service_number]','value'=>'','text'=>'Service Number','class'=>'col-md-2']);
echo View::factory('field/text')->set('data',['field'=>'plugin[service_address]','value'=>'','text'=>'Service Address','class'=>'col-md-6']);
?>
<div class="row">
<?php echo Form::input('plugin[service_address]',NULL,array('class'=>'span6','label'=>'Service Address','placeholder'=>'Service Address','required')); ?>
</div> <!-- /row -->
</fieldset>

View File

@ -1,39 +1,15 @@
<fieldset>
<legend>ADSL Service Details</legend>
<div class="row">
<?php echo Form::input('plugin[service_number]',$o->service_number,array('class'=>'span2','label'=>'Service Number','placeholder'=>'Service Number')); ?>
</div> <!-- /row -->
<?php
echo View::factory('field/text')->set('data',['field'=>'plugin[service_number]','value'=>$o->service_number,'text'=>'Service Number','class'=>'col-md-2']);
echo View::factory('field/text')->set('data',['field'=>'plugin[service_address]','value'=>$o->service_address,'text'=>'Service Address','class'=>'col-md-6']);
echo View::factory('field/date')->set('data',['field'=>'plugin[service_connect_date]','value'=>$o->service_connect_date,'text'=>'Service Connect Date','enddate'=>NULL]);
echo View::factory('field/date')->set('data',['field'=>'plugin[service_contract_date]','value'=>$o->service_contract_date,'text'=>'Contract Start Date','enddate'=>'new Date()']);
echo View::factory('field/text')->set('data',['field'=>'plugin[contract_term]','value'=>$o->contract_term,'text'=>'Override Contract Term','class'=>'col-md-1']);
echo View::factory('field/text')->set('data',['field'=>'plugin[service_username]','value'=>$o->service_username,'text'=>'Service Username','class'=>'col-md-4']);
echo View::factory('field/text')->set('data',['field'=>'plugin[service_password]','value'=>$o->service_password,'text'=>'Service Password','class'=>'col-md-2']);
echo View::factory('field/text')->set('data',['field'=>'plugin[ipaddress]','value'=>$o->ipaddress,'text'=>'Service IP Address','class'=>'col-md-2']);
?>
<div class="row">
<?php echo Form::input('plugin[service_address]',$o->service_address,array('class'=>'span6','label'=>'Service Address','placeholder'=>'Service Address')); ?>
</div> <!-- /row -->
<div class="row">
<div class="input-append date" id="service_connect_date_label">
<?php echo Form::input('service_connect_date_label',$o->display('service_connect_date'),array('class'=>'span2','label'=>'Service Connected','add-on'=>'<i class="icon-calendar"></i>','disabled')); ?>
</div>
<?php echo Form::hidden('plugin[service_connect_date]',$o->service_connect_date,array('id'=>'service_connect_date')); ?>
</div> <!-- /row -->
<div class="row">
<div class="input-append date" id="service_contract_date_label">
<?php echo Form::input('service_contract_date_label',$o->display('service_contract_date'),array('class'=>'span2','label'=>'Contract Start Date','add-on'=>'<i class="icon-calendar"></i>','disabled')); ?>
</div>
<?php echo Form::hidden('plugin[service_contract_date]',$o->service_contract_date,array('id'=>'service_contract_date')); ?>
</div> <!-- /row -->
<div class="row">
<?php echo Form::input('plugin[service_username]',$o->service_username,array('class'=>'span6','label'=>'Service Username','placeholder'=>'Service Username')); ?>
</div> <!-- /row -->
<div class="row">
<?php echo Form::input('plugin[service_password]',$o->service_password,array('class'=>'span6','label'=>'Service Password','placeholder'=>'Service Password')); ?>
</div> <!-- /row -->
<div class="row">
<?php echo Form::input('plugin[ipaddress]',$o->ipaddress,array('class'=>'span6','label'=>'Service IP Address','placeholder'=>'Service IP Address')); ?>
</div> <!-- /row -->
</fieldset>

View File

@ -20,7 +20,7 @@ class Model_Product_Category extends ORM {
);
protected $_has_many = array(
'subcategories'=>array('model'=>'product_category','foreign_key'=>'parent_id','far_key'=>'id'),
'subcategories'=>array('model'=>'Product_Category','foreign_key'=>'parent_id','far_key'=>'id'),
'translate'=>array('model'=>'Product_Category_Translate','foreign_key'=>'product_cat_id','far_key'=>'id'),
);

View File

@ -53,28 +53,6 @@ class Controller_Admin_Service extends Controller_Service {
if (! $so->loaded())
HTTP::redirect('welcome/index');
Script::factory()
->type('stdin')
->data('
$(document).ready(function() {
$("#service_connect_date_label").datepicker({
autoclose : true,
format : "dd-M-yyyy",
todayBtn : true,
}).on("hide",function(ev) {
$("input[id=service_connect_date]").val(ev.date.valueOf()/1000);
});
$("#service_contract_date_label").datepicker({
autoclose : true,
format : "dd-M-yyyy",
todayBtn : true,
}).on("hide",function(ev) {
$("input[id=service_contract_date]").val(ev.date.valueOf()/1000);
});
});
');
Block::factory()
->type('form-horizontal')
->title(sprintf('%s: %s %s',_('Update Service'),$id,$so->name()))
@ -88,7 +66,7 @@ $(document).ready(function() {
public function action_listdomainservicesbydnshost() {
$svs = ORM::factory('Service')->list_bylistgroup('DOMAIN');
Sort::MAsort($svs,'plugin()->host,name()');
Sort::MAsort($svs,array('plugin()->host','name()'));
$list = array();
@ -103,7 +81,7 @@ $(document).ready(function() {
25,
array(
'id'=>array('label'=>'ID','url'=>URL::link('user','service/view/')),
'service_name()'=>array('label'=>'Details'),
'name()'=>array('label'=>'Details'),
'plugin()->registrar->id'=>array('label'=>'SID'),
'plugin()->registrar->name'=>array('label'=>'Supplier'),
'display("date_next_invoice")'=>array('label'=>'Next Invoice'),
@ -118,7 +96,7 @@ $(document).ready(function() {
public function action_listhostservicesbysupplier() {
$svs = ORM::factory('Service')->list_bylistgroup('HOST');
Sort::MAsort($svs,'plugin()->host,name()');
Sort::MAsort($svs,array('plugin()->host','name()'));
$list = array();
@ -133,11 +111,11 @@ $(document).ready(function() {
25,
array(
'id'=>array('label'=>'ID','url'=>URL::link('user','service/view/')),
'service_name()'=>array('label'=>'Details'),
'name()'=>array('label'=>'Details'),
'plugin()->display("host_expire")'=>array('label'=>'Expire'),
'recur_schedule'=>array('label'=>'Billing'),
'price(TRUE,TRUE)'=>array('label'=>'Price','class'=>'right'),
'account->accnum()'=>array('label'=>'Cust ID'),
'account->refnum()'=>array('label'=>'Cust ID'),
'account->name()'=>array('label'=>'Customer'),
'display("date_next_invoice")'=>array('label'=>'Next Invoice'),
),
@ -179,9 +157,9 @@ $(document).ready(function() {
if (is_null($bt))
$bt = $iio->date_start;
$a = ($iio->invoice_id > 4000 OR $iio->product->prod_plugin_file == 'ADSL') ? FALSE : TRUE;
$a = ($iio->invoice_id > 4000 OR $iio->service->product->prod_plugin_file == 'ADSL') ? FALSE : TRUE;
$pdata = Period::details($iio->recurring_schedule,$a ? NULL : $iio->product->price_recurr_weekday,$bt,TRUE,$iio->product->price_recurr_strict);
$pdata = Period::details($iio->recurring_schedule,$a ? NULL : $iio->service->product->price_recurr_weekday,$bt,TRUE,$iio->service->product->price_recurr_strict);
switch ($iio->recurring_schedule) {
case 1:
@ -214,7 +192,7 @@ $(document).ready(function() {
$iio->save();
}
if (isset($_REQUEST['go']))
if ($this->request->query('go'))
HTTP::redirect(URL::link('admin','service/view/'.$so->id));
Block::add(array(
@ -239,7 +217,7 @@ $(document).ready(function() {
private function add_edit($id=NULL,$output='') {
$so = ORM::factory('Service',$id);
if ($_POST) {
if ($this->request->post()) {
if ($so->values($this->request->post())->changed() AND ! ($this->save($so)))
$so->reload();

View File

@ -1,6 +1,9 @@
<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)); ?>
<?php
echo View::factory('field/select')->set('data',['field'=>'plugin[ssl_ca_id]','value'=>ORM::factory('SSL_CA')->where_active()->list_select(TRUE),'text'=>'CA','default'=>NULL,'class'=>'col-md-5','sort'=>TRUE]);
echo View::factory('field/textarea')->set('data',['field'=>'plugin[csr]','value'=>'','text'=>'CSR']);
?>
</fieldset>

View File

@ -2,8 +2,9 @@
<legend>SSL Certificate Service Details</legend>
<?php
echo View::factory('field/textarea')->set('data',['field'=>'plugin[csr]','value'=>$o->service->plugin()->csr,'text'=>'CSR']);
echo View::factory('field/textarea')->set('data',['field'=>'plugin[pk]','value'=>$o->service->plugin()->pk,'text'=>'Private Key']);
echo View::factory('field/textarea')->set('data',['field'=>'plugin[cert]','value'=>$o->service->plugin()->cert,'text'=>'Public Certificate']);
echo View::factory('field/select')->set('data',['field'=>'plugin[ssl_ca_id]','value'=>ORM::factory('SSL_CA')->where_active()->list_select(TRUE),'text'=>'CA','default'=>$o->service->plugin()->ssl_ca_id,'class'=>'col-md-5','sort'=>TRUE]);
echo View::factory('field/textarea')->set('data',['field'=>'plugin[csr]','value'=>$o->service->plugin()->csr,'text'=>'CSR']);
echo View::factory('field/textarea')->set('data',['field'=>'plugin[pk]','value'=>$o->service->plugin()->pk,'text'=>'Private Key']);
echo View::factory('field/textarea')->set('data',['field'=>'plugin[cert]','value'=>$o->service->plugin()->cert,'text'=>'Public Certificate']);
?>
</fieldset>