Removed redundant functions, some Standardisation work

This commit is contained in:
Deon George
2016-08-15 21:23:18 +10:00
parent 24bb4a701b
commit 07de13f678
82 changed files with 367 additions and 590 deletions

View File

@@ -23,89 +23,13 @@ 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');
$this->meta->title = 'New Service';
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)
return false;
// Send the request and update sub category dropdown
$.ajax({
type: "GET",
data: "key="+$(this).val(),
dataType: "html",
cache: false,
url: "'.URL::link('admin','service/ajaxaddplugin/',TRUE).'",
timeout: 2000,
error: function(x) {
alert("Failed to submit");
},
success: function(data) {
$("div[id=plugin]").empty().append(data);
}
});
});
});
');
// @todo Move this to automatically add this if a date format is used
Block::factory()
->type('form-horizontal')
->title('Add/View Charge')
->title_icon('fa fa-wrench')
->body(View::factory('service/admin/add'));
->title('Add New Service')
->title_icon($this->icon)
->body(View::factory('service/admin/add')->set('o',ORM::factory('Service')));
}
public function action_ajaxaddplugin() {
@@ -129,26 +53,10 @@ $(document).ready(function() {
if (! $so->loaded())
HTTP::redirect('welcome/index');
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');
Script::factory()
->type('stdin')
->data('
$(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);
});
$("#service_connect_date_label").datepicker({
autoclose : true,
format : "dd-M-yyyy",
@@ -314,12 +222,12 @@ $(document).ready(function() {
HTTP::redirect(URL::link('admin','service/view/'.$so->id));
Block::add(array(
'title'=>sprintf('Transaction History for %s: %s',$so->id(),$so->name()),
'title'=>sprintf('Transaction History for %s: %s',$so->refnum(TRUE),$so->name()),
'body'=>$loutput,
));
Block::add(array(
'title'=>sprintf('Transaction Debug for %s: %s',$so->id(),$so->name()),
'title'=>sprintf('Transaction Debug for %s: %s',$so->refnum(TRUE),$so->name()),
'body'=>$doutput,
));
@@ -327,7 +235,7 @@ $(document).ready(function() {
->set('o',$so);
Block::add(array(
'title'=>sprintf('%s: %s',$so->id(),$so->service_name()),
'title'=>sprintf('%s: %s',$so->refnum(TRUE),$so->name()),
'body'=>$output,
));
}