mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 23:37:33 -05:00 
			
		
		
		
	Add pay now button to each row in table
This commit is contained in:
		
							parent
							
								
									fb513ebe69
								
							
						
					
					
						commit
						2e4cd7459a
					
				@ -44,7 +44,7 @@ class InvoiceController extends Controller
 | 
			
		||||
     * @return \Illuminate\Http\Response
 | 
			
		||||
     */
 | 
			
		||||
    public function index(InvoiceFilters $filters, Builder $builder)
 | 
			
		||||
    {//
 | 
			
		||||
    {
 | 
			
		||||
        $invoices = Invoice::filter($filters)->with('client', 'client.country');
 | 
			
		||||
 | 
			
		||||
        if (request()->ajax()) {
 | 
			
		||||
@ -68,7 +68,6 @@ class InvoiceController extends Controller
 | 
			
		||||
                })
 | 
			
		||||
                ->rawColumns(['checkbox', 'action', 'status_id'])
 | 
			
		||||
                ->make(true);
 | 
			
		||||
        
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $data['html'] = $builder;
 | 
			
		||||
@ -82,8 +81,10 @@ class InvoiceController extends Controller
 | 
			
		||||
        $buttons = '<div>';
 | 
			
		||||
 | 
			
		||||
        if($invoice->isPayable()){
 | 
			
		||||
            $buttons .= '<a href="/client/invoices/'. $invoice->hashed_id .'" class="btn btn-sm btn-info"><i class="glyphicon glyphicon-edit"></i>'.ctrans('texts.pay_now').'</a>';
 | 
			
		||||
            $buttons .= "<button type=\"button\" class=\"btn btn-sm btn-info\" onclick=\"payInvoice('".$invoice->hashed_id."')\"><i class=\"glyphicon glyphicon-edit\"></i>".ctrans('texts.pay_now')."</button>";
 | 
			
		||||
        //    $buttons .= '<a href="/client/invoices/'. $invoice->hashed_id .'" class="btn btn-sm btn-info"><i class="glyphicon glyphicon-edit"></i>'.ctrans('texts.pay_now').'</a>';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $buttons .= '<a href="/client/invoices/'. $invoice->hashed_id .'" class="btn btn-sm btn-primary"><i class="glyphicon glyphicon-edit"></i>'.ctrans('texts.view').'</a>';
 | 
			
		||||
 | 
			
		||||
        $buttons .="</div>";
 | 
			
		||||
 | 
			
		||||
@ -218,6 +218,18 @@ function filterTable() {
 | 
			
		||||
    data_table.ajax.reload();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function payInvoice(hashed_id) {
 | 
			
		||||
 | 
			
		||||
    $('#pay_invoices_drop').addClass('disabled');
 | 
			
		||||
    $('#download_invoices').addClass('disabled');
 | 
			
		||||
    
 | 
			
		||||
    $('#hashed_ids').val(hashed_id);
 | 
			
		||||
    $('#action').val('payment');
 | 
			
		||||
 | 
			
		||||
    $('#payment_form').submit();
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Setup status filter
 | 
			
		||||
$('#statuses').select2({
 | 
			
		||||
    placeholder: "{{ ctrans('texts.status') }}",
 | 
			
		||||
@ -251,7 +263,6 @@ $('#statuses').select2({
 | 
			
		||||
    data_table.ajax.reload();
 | 
			
		||||
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
</script>
 | 
			
		||||
@endpush
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user