Removed redundant functions, some Standardisation work
This commit is contained in:
@@ -21,8 +21,8 @@ class Controller_Reseller_Charge extends Controller_Charge {
|
||||
public function action_add() {
|
||||
Block::factory()
|
||||
->type('form-horizontal')
|
||||
->title('Add/View Charge')
|
||||
->title_icon('fa fa-wrench')
|
||||
->title('New Charge')
|
||||
->title_icon($this->icon)
|
||||
->body($this->add_edit());
|
||||
}
|
||||
|
||||
@@ -54,72 +54,11 @@ class Controller_Reseller_Charge extends Controller_Charge {
|
||||
private function add_edit($id=NULL,$output='') {
|
||||
$co = ORM::factory('Charge',$id);
|
||||
|
||||
$this->meta->title = sprintf('Charge: %s (%s)',$co->name(),$co->account->name());
|
||||
$this->meta->title = $co->loaded() ? sprintf('Charge: %s (%s)',$co->name(),$co->account->name()) : 'New Charge';
|
||||
|
||||
if ($this->request->post() AND $co->values($this->request->post())->changed() AND (! $this->save($co)))
|
||||
$co->reload();
|
||||
|
||||
Script::factory()
|
||||
->type('file')
|
||||
->data('media/theme/bootstrap/js/bootstrap.datepicker.js');
|
||||
|
||||
Style::factory()
|
||||
->type('file')
|
||||
->data('media/theme/bootstrap/css/bootstrap.datepicker.css');
|
||||
|
||||
Script::factory()
|
||||
->type('stdin')
|
||||
->data('
|
||||
$(document).ready(function() {
|
||||
$("#date_charge_label").datepicker({
|
||||
autoclose : true,
|
||||
endDate : new Date(),
|
||||
todayHighlight: true,
|
||||
format : "dd-M-yyyy",
|
||||
todayBtn : true,
|
||||
}).on("hide",function(ev) {
|
||||
$("input[name=date_charge]").val(ev.date.valueOf()/1000);
|
||||
});
|
||||
|
||||
$("input[name=account_id_label]").typeahead({
|
||||
minLength: 2,
|
||||
source: function (query,process) {
|
||||
search("'.URL::link('reseller','charge/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: "json",
|
||||
cache: false,
|
||||
url: "'.URL::link('reseller','charge/ajaxlistservice',TRUE).'",
|
||||
timeout: 2000,
|
||||
error: function(x) {
|
||||
alert("Failed to submit");
|
||||
},
|
||||
success: function(data) {
|
||||
$("select[name=service_id]").empty();
|
||||
$.each(data, function(i, j){
|
||||
var row = "<option value=\"" + j.value + "\">" + j.label + "</option>";
|
||||
$(row).appendTo("select[name=service_id]");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return item;
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
');
|
||||
|
||||
return View::factory('charge/reseller/add_edit')
|
||||
->set('o',$co);
|
||||
}
|
||||
@@ -130,7 +69,7 @@ $(document).ready(function() {
|
||||
Block::factory()
|
||||
->type('form-horizontal')
|
||||
->title(sprintf('%s: %s',_('View Charges'),$id))
|
||||
->title_icon('fa fa-wrench')
|
||||
->title_icon($this->icon)
|
||||
->body($this->add_edit($id,$output));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user