Gutschriften
This commit is contained in:
parent
35ae3da244
commit
6ac9fcc4d2
20 changed files with 510 additions and 63 deletions
85
app/Http/Controllers/PaymentPayCreditController.php
Normal file
85
app/Http/Controllers/PaymentPayCreditController.php
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
use Carbon;
|
||||
use Request;
|
||||
use App\User;
|
||||
use App\Services\Invoice;
|
||||
use App\Services\Payment;
|
||||
use App\Models\ShoppingOrder;
|
||||
|
||||
|
||||
class PaymentPayCreditController extends Controller
|
||||
{
|
||||
|
||||
private $filter_user_status;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->filter_user_status = 'all';
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
$this->setActiveFilter();
|
||||
$data = [
|
||||
'filter_user_status' => $this->filter_user_status,
|
||||
];
|
||||
return view('admin.payment.pay_credit.index', $data);
|
||||
}
|
||||
|
||||
private function setActiveFilter(){
|
||||
if(Request::get('filter_user_status')){
|
||||
$this->filter_user_status = Request::get('filter_user_status');
|
||||
}
|
||||
}
|
||||
|
||||
public function datatable(){
|
||||
|
||||
$this->setActiveFilter();
|
||||
|
||||
|
||||
$query = User::with('account')->select('users.*')->where('users.deleted_at', '=', null)
|
||||
->where('active', true);
|
||||
|
||||
|
||||
//->orderBy('created_at', 'DESC');
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('id', function (User $user) {
|
||||
return '<a href="' . route('admin_lead_edit', [$user->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
})
|
||||
->addColumn('first_name', function (User $user) {
|
||||
return $user->account ? $user->account->first_name : '';
|
||||
})
|
||||
->addColumn('last_name', function (User $user) {
|
||||
return $user->account ? $user->account->last_name : '';
|
||||
})
|
||||
->addColumn('payment_credit', function (User $user) {
|
||||
return $user->payment_credit ? $user->getFormattedPaymentCredit().' €' : '';
|
||||
})
|
||||
->addColumn('is_active_account', function (User $user) {
|
||||
if($user->payment_account){
|
||||
if($user->isActiveAccount()){
|
||||
return '<span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span></a>';
|
||||
}
|
||||
return '<span class="badge badge-pill badge-warning"><i class="fa fa-ban"></i></span></a>';
|
||||
}
|
||||
return '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span></a>';
|
||||
})
|
||||
->addColumn('action', function (User $user) {
|
||||
$ret = '<a href="#" target="_blank" class="btn btn-warning btn-xs"><i class="fa fa-eye"></i></a>';
|
||||
return $ret;
|
||||
})
|
||||
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('txaction', 'txaction $1')
|
||||
->orderColumn('payment_credit', 'payment_credit $1')
|
||||
->orderColumn('is_active_account', 'is_active_account $1')
|
||||
->rawColumns(['id', 'shipping_order', 'is_active_account', 'action'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue