Ensure site_id is included in ORM::add(), fixed payment revendering, start product category work
This commit is contained in:
@@ -95,7 +95,7 @@ class Controller_Admin_Payment extends Controller_Payment {
|
||||
private function add_edit($id=NULL,$output='') {
|
||||
$po = ORM::factory('Payment',$id);
|
||||
|
||||
$this->meta->title = 'Payment: '.$po->refnum(TRUE);
|
||||
$this->meta->title = $po->loaded() ? 'Payment: '.$po->refnum(TRUE) : 'A|Payment Add';
|
||||
|
||||
if ($this->request->post()) {
|
||||
$po->values($this->request->post());
|
||||
@@ -113,61 +113,6 @@ class Controller_Admin_Payment extends Controller_Payment {
|
||||
$this->save($po);
|
||||
}
|
||||
|
||||
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_payment_label").datepicker({
|
||||
autoclose : true,
|
||||
todayHighlight: true,
|
||||
endDate : new Date(),
|
||||
format : "dd-mm-yyyy",
|
||||
todayBtn : true,
|
||||
}).on("hide",function(ev) {
|
||||
$("input[name=date_payment]").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;
|
||||
},
|
||||
});
|
||||
});
|
||||
');
|
||||
|
||||
if ($po->loaded())
|
||||
Script::factory()
|
||||
->type('stdin')
|
||||
|
@@ -2,30 +2,49 @@
|
||||
<fieldset>
|
||||
<legend>Payment Details</legend>
|
||||
|
||||
<label for="date_payment_label">Date Paid</label>
|
||||
<div class="input-group col-md-2">
|
||||
<input type="text" id="date_payment_label" value="<?php echo date('d-m-Y',$o->date_payment); ?>" class="form-control" placeholder="Date Paid">
|
||||
<span class="input-group-addon" id="basic-addon1"><i class="fa fa-calendar"></i></span>
|
||||
</div>
|
||||
<?php echo Form::hidden('date_payment',$o->date_payment); ?>
|
||||
<?php
|
||||
echo View::factory('field/date')->set('data',['field'=>'date_payment','value'=>$o->date_payment ? $o->date_payment : time(),'text'=>'Date Charge','enddate'=>'new Date()']);
|
||||
echo View::factory('field/select')->set('data',['field'=>'checkout_id','value'=>ORM::factory('Checkout')->list_select(TRUE),'text'=>'Payment Method','default'=>$o->checkout_id,'class'=>'col-md-2']);
|
||||
echo View::factory('field/money')->set('data',['field'=>'total_amt','value'=>$o->total_amt,'text'=>'Total','class'=>'col-md-2']);
|
||||
echo View::factory('field/money')->set('data',['field'=>'fees_amt','value'=>$o->fees_amt,'text'=>'Fees','class'=>'col-md-2']);
|
||||
echo View::factory('field/account')->set('data',['field'=>'account_id','value'=>$o->account_id,'text'=>'Account','name'=>$o->account_id ? sprintf('%s: %s',$o->account->refnum(),$o->account->name()) : '','ajaxurl'=>URL::link('admin','payment/ajaxlist')]);
|
||||
echo View::factory('field/text')->set('data',['field'=>'notes','value'=>$o->notes,'text'=>'Notes','class'=>'col-md-5']);
|
||||
?>
|
||||
|
||||
<?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('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('label'=>'Fees','placeholder'=>'Fees')); ?>
|
||||
<?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::input('notes',$o->notes,array('label'=>'Notes','placeholder'=>'Any notes about this payment?')); ?>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="col-md-8">
|
||||
<legend>Invoice Details</legend>
|
||||
|
||||
<div id="items"></div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<fieldset class="col-md-8">
|
||||
<legend>Invoice Details</legend>
|
||||
|
||||
<div id="items"></div>
|
||||
</fieldset>
|
||||
|
||||
<div class="row col-md-12">
|
||||
<button type="submit" class="btn btn-primary">Save changes</button>
|
||||
<button type="button" class="btn">Cancel</button>
|
||||
<div class="col-md-12">
|
||||
<?php echo View::factory('field/submit'); ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
Script::factory()
|
||||
->type('stdin')
|
||||
->data('
|
||||
$(document).ready(function() {
|
||||
$("input[name=account_id]").change(function(){
|
||||
// Send the request and update sub category dropdown
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: "key="+$(this).val(),
|
||||
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);
|
||||
}
|
||||
});
|
||||
});
|
||||
});');
|
||||
?>
|
||||
|
@@ -14,6 +14,7 @@
|
||||
*/
|
||||
class Model_Product extends ORM {
|
||||
protected $_has_many = array(
|
||||
'product_cat'=>array('through'=>'pivot_product_cat'),
|
||||
'invoice'=>array('through'=>'invoice_item'),
|
||||
'service'=>array('far_key'=>'id'),
|
||||
'translate'=>array('model'=>'Product_Translate','far_key'=>'id'),
|
||||
|
12
modules/product/views/product/category/list.php
Normal file
12
modules/product/views/product/category/list.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<!-- o = Array of Model_Product_Category -->
|
||||
<?php echo Table::factory()
|
||||
->page_items(50)
|
||||
->data($o)
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
'name(TRUE)'=>'Name',
|
||||
))
|
||||
->prepend(array(
|
||||
'id'=>array('url'=>URL::link('admin','product_category/edit/')),
|
||||
));
|
||||
?>
|
Reference in New Issue
Block a user