From 5486e7cbbdfd160157cfb8411521b01294112270 Mon Sep 17 00:00:00 2001 From: Raihan Surya Date: Thu, 9 Nov 2023 11:29:39 +0700 Subject: [PATCH] Datatable server side --- .../Admin/AdminDashboardController.php | 4 +- .../Admin/AdminRefundController.php | 43 +- .../Controllers/Admin/AdminUserController.php | 56 ++ .../Controllers/User/UserRefundController.php | 35 +- app/Models/Refund.php | 1 + composer.json | 3 +- composer.lock | 586 ++++++++++++++++-- config/datatables-buttons.php | 91 +++ config/datatables-fractal.php | 13 + config/datatables-html.php | 27 + config/datatables.php | 127 ++++ .../vendor/datatables/buttons.server-side.js | 284 +++++++++ .../Admin/refund/detail-refund.blade.php | 168 ++++- resources/views/Admin/refund/index.blade.php | 3 +- .../refund/modal-next-detail-refund.blade.php | 30 - resources/views/Admin/setting/index.blade.php | 2 +- .../transaction/detail-transaction.blade.php | 19 +- .../views/Admin/transaction/index.blade.php | 18 +- .../modal-keterangan-status.blade.php | 50 +- resources/views/Admin/users/index.blade.php | 109 ++-- resources/views/User/contact/index.blade.php | 8 +- .../views/User/refund/detail-refund.blade.php | 8 +- resources/views/User/refund/index.blade.php | 4 +- .../views/User/refund/new-refund.blade.php | 72 ++- .../User/transaction/Pembeli/index.blade.php | 26 +- .../Pembeli/modal-keterangan-status.blade.php | 55 +- .../User/transaction/penjual/index.blade.php | 83 +-- .../penjual/modal-keterangan-status.blade.php | 59 +- .../modal-pengiriman-selesai.blade.php | 9 +- .../views/vendor/datatables/editor.blade.php | 15 + .../vendor/datatables/function.blade.php | 14 + .../functions/batch_remove.blade.php | 14 + .../views/vendor/datatables/options.blade.php | 6 + .../views/vendor/datatables/print.blade.php | 37 ++ .../views/vendor/datatables/scout.blade.php | 23 + .../views/vendor/datatables/script.blade.php | 4 + routes/web.php | 13 +- 37 files changed, 1761 insertions(+), 358 deletions(-) create mode 100644 config/datatables-buttons.php create mode 100644 config/datatables-fractal.php create mode 100644 config/datatables-html.php create mode 100644 config/datatables.php create mode 100644 public/vendor/datatables/buttons.server-side.js delete mode 100644 resources/views/Admin/refund/modal-next-detail-refund.blade.php create mode 100644 resources/views/vendor/datatables/editor.blade.php create mode 100644 resources/views/vendor/datatables/function.blade.php create mode 100644 resources/views/vendor/datatables/functions/batch_remove.blade.php create mode 100644 resources/views/vendor/datatables/options.blade.php create mode 100644 resources/views/vendor/datatables/print.blade.php create mode 100644 resources/views/vendor/datatables/scout.blade.php create mode 100644 resources/views/vendor/datatables/script.blade.php diff --git a/app/Http/Controllers/Admin/AdminDashboardController.php b/app/Http/Controllers/Admin/AdminDashboardController.php index 183c74a..f74ebd0 100644 --- a/app/Http/Controllers/Admin/AdminDashboardController.php +++ b/app/Http/Controllers/Admin/AdminDashboardController.php @@ -56,12 +56,12 @@ class AdminDashboardController extends Controller $transaction = Transaction::whereMonth('updated_at', $bulan) ->whereYear('updated_at', $currentYear) ->where('status_pembayaran', 'settlement') - ->sum('total_bayar'); + ->sum('total_bayar')/100; $refund = Transaction::whereMonth('updated_at', $bulan) ->whereYear('updated_at', $currentYear) ->where('status_pembayaran', 'refund') - ->sum('total_harga'); + ->sum('total_harga')/100; $dataChartTransaction[] = intval($transaction); $dataChartRefund[] = intval($refund); diff --git a/app/Http/Controllers/Admin/AdminRefundController.php b/app/Http/Controllers/Admin/AdminRefundController.php index 077faf2..d33cb72 100644 --- a/app/Http/Controllers/Admin/AdminRefundController.php +++ b/app/Http/Controllers/Admin/AdminRefundController.php @@ -39,32 +39,30 @@ class AdminRefundController extends Controller ]); } - public function aprroveRefund($id) + public function approveRefund(Request $request) { - $transaction = Transaction::where('id', $id)->first(); - - $refund = Refund::where('transaction_id', $id)->first(); + $refund = Refund::where('id', $request->id)->first(); $params = [ - 'refund_key' => $id . '-ref1', - 'amount' => $transaction->total_harga, + 'refund_key' => $request->id . '-ref1', + 'amount' => $refund->total, 'reason' => $refund->complaint, ]; - // $refundMidtrans = Trans::refund($id, $params); + // $refundMidtrans = Trans::refund($request->id, $params); try { - Transaction::where('id', $id)->update([ + Transaction::where('id', $refund->transaction_id)->update([ 'status_transaksi' => 'refund', 'status_pembayaran' => 'refund' ]); - Refund::where('transaction_id', $id)->update([ + Refund::where('id', $request->id)->update([ 'status' => 'refund', ]); TransactionDescription::create([ - 'transcation_id' => $id, + 'transaction_id' => $refund->transaction_id, 'status' => 'refund', 'user' => auth()->user()->email, 'judul' => 'fas fa-long-arrow-alt-left', @@ -75,8 +73,8 @@ class AdminRefundController extends Controller DB::commit(); return response()->json([ - 'status' => false, - 'message' => 'Refund berhasil dilakukan', + 'status' => true, + 'message' => 'Refund berhasil dilakukan. Uang akan dikembalikan ke pembeli.', // 'refundMidtrans' => $refundMidtrans, ]); } catch (Throwable $e) { @@ -92,25 +90,34 @@ class AdminRefundController extends Controller } } - public function denyRefund($id) + public function denyRefund(Request $request) { + $refund = Refund::where('id', $request->id)->first(); + try { - Transaction::where('id', $id)->update([ + Transaction::where('id', $refund->transaction_id)->update([ 'status_transaksi' => 'finished', 'status_pembayaran' => 'settlement' ]); - Refund::where('transaction_id', $id)->update([ + Refund::where('id', $request->id)->update([ 'status' => 'deny', ]); TransactionDescription::create([ - 'transcation_id' => $id, + 'transaction_id' => $refund->transaction_id, 'status' => 'deny', 'user' => auth()->user()->email, - 'judul' => 'fas fa-long-arrow-alt-left', + 'judul' => 'fas fa-long-arrow-alt-right', 'background' => 'bg-primary', - 'deskripsi' => 'Admin telah menyetujui refund.', + 'deskripsi' => 'Admin telah menolak refund. Transaksi akan diteruskan ke penjual', + ]); + + DB::commit(); + + return response()->json([ + 'status' => true, + 'message' => 'Refund berhasil ditolak. Transaksi diselesaikan dan uang disampaikan ke penjual.' ]); } catch (Throwable $e) { DB::rollBack(); diff --git a/app/Http/Controllers/Admin/AdminUserController.php b/app/Http/Controllers/Admin/AdminUserController.php index ed0f8bd..92961b5 100644 --- a/app/Http/Controllers/Admin/AdminUserController.php +++ b/app/Http/Controllers/Admin/AdminUserController.php @@ -5,6 +5,10 @@ namespace App\Http\Controllers\Admin; use App\Models\User; use App\Http\Controllers\Controller; use Illuminate\Http\Request; +use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Log; +use Yajra\DataTables\DataTables; +use Throwable; class AdminUserController extends Controller { @@ -85,4 +89,56 @@ class AdminUserController extends Controller ]); } } + + public function listUser(Request $request) + { + try { + $subQuery = User::where('role', 'User') + ->orderByRaw("CASE WHEN status = 'Progress' THEN 1 WHEN status = 'Finished' THEN 2 WHEN status = 'Rejected' THEN 3 ELSE 4 END ASC") + ->latest() + ->select('users.id', DB::raw("CONCAT(users.nama_depan, ' ', users.nama_belakang) as nama_lengkap"), 'users.email', 'users.foto_profile', 'users.status', 'users.created_at as tanggal_daftar'); + + if ($request->has('search') && !empty($request->search['value'])) { + $searchUser = $request->search['value']; + $subQuery->where(function ($a) use ($searchUser) { + $a->whereRaw('email LIKE ?', ['%' . $searchUser . '%']) + ->orWhereRaw('nama_depan LIKE ?', ['%' . $searchUser . '%']) + ->orWhereRaw('nama_belakang LIKE ?', ['%' . $searchUser . '%']); + }); + } + + $queryUser = User::from(DB::raw("({$subQuery->toSql()}) as tmp")) + ->mergeBindings($subQuery->getQuery()) // Menggabungkan binding parameters + ->select('*') + ->get(); + + if ($request->ajax()) { + return DataTables::of($queryUser) + ->addIndexColumn() + ->addColumn('action', function ($row) { + $url = route('admin-user.show', ['id' => $row->id]); + $html_code = ' +
+ + + +
'; + return $html_code; + }) + ->rawColumns(['action']) + ->make(true); + } + } catch (Throwable $e) { + Log::error($e->getMessage()); + + return response()->json(['success' => false, 'message' => 'Terjadi Kesalahan pada sisi server']); + } + } } diff --git a/app/Http/Controllers/User/UserRefundController.php b/app/Http/Controllers/User/UserRefundController.php index 4ba2596..e533498 100644 --- a/app/Http/Controllers/User/UserRefundController.php +++ b/app/Http/Controllers/User/UserRefundController.php @@ -9,6 +9,7 @@ use App\Models\Refund; use App\Models\RefundDescription; use App\Models\Transaction; use App\Models\TransactionDescription; +use Carbon\Carbon; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; use Throwable; @@ -17,10 +18,12 @@ class UserRefundController extends Controller { public function index() { + $refunds = Refund::join('transactions', 'refunds.transaction_id', '=', 'transactions.id') + ->where('transactions.pembeli', auth()->user()->email) + ->get('refunds.*'); + return view('user.refund.index', [ - 'refunds' => Refund::join('transactions', 'refunds.transaction_id', '=', 'transactions.id') - ->where('transactions.pembeli', auth()->user()->email) - ->select() + 'refunds' => $refunds ]); } @@ -29,19 +32,24 @@ class UserRefundController extends Controller return view('user.refund.new-refund',['id' => $id]); } - public function store(Request $request, $id){ + public function store(Request $request){ + $now = Carbon::now(); + $due_date = $now->addDays(2)->toDateTimeString(); + try{ DB::beginTransaction(); - $transaction = Transaction::where('id',$id)->update([ - 'status_transaksi' => 'refund', + $transaction = Transaction::where('id',$request->id)->first(); + + Transaction::where('id', $request->id)->update([ + 'status_transaksi' => 'refund' ]); $refund = Refund::create([ - 'transaction_id' => $id, + 'transaction_id' => $request->id, 'total' => $transaction->total_harga, - 'due_date' => $transaction, - 'complain' => $request->complain + 'due_date' => $due_date, + 'complaint' => $request->complaint ]); if ($request->hasFile('files')) { @@ -68,7 +76,7 @@ class UserRefundController extends Controller } TransactionDescription::create([ - 'transcation_id' => $id, + 'transaction_id' => $request->id, 'status' => 'pending', 'user' => auth()->user()->email, 'judul' => 'fas fa-clock', @@ -77,6 +85,11 @@ class UserRefundController extends Controller ]); DB::commit(); + + return response()->json([ + 'status' => true, + 'message' => 'Permintaan refund anda telah dikirim ke admin untuk direview. Mohon tunggu maksimal 2 hari.', + ]); }catch(Throwable $e){ DB::rollback(); @@ -88,7 +101,7 @@ class UserRefundController extends Controller public function show($id){ $refund = Refund::find($id); - $refundDescription = RefundDescription::where($id)->get(); + $refundDescription = RefundDescription::where('refund_id',$id)->get(); return view('user.refund.detail-refund',[ 'refund' => $refund, 'descriptions' => $refundDescription diff --git a/app/Models/Refund.php b/app/Models/Refund.php index b0056db..b1d758b 100644 --- a/app/Models/Refund.php +++ b/app/Models/Refund.php @@ -19,6 +19,7 @@ class Refund extends Model 'total', 'due_date', 'status', + 'complaint' ]; protected $casts = [ diff --git a/composer.json b/composer.json index 01e309d..5559c57 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,8 @@ "ramsey/uuid": "^4.7", "stichoza/google-translate-php": "^5.1", "thiagoalessio/tesseract_ocr": "^2.12", - "tymon/jwt-auth": "^2.0" + "tymon/jwt-auth": "^2.0", + "yajra/laravel-datatables": "10.0" }, "require-dev": { "fakerphp/faker": "^1.9.1", diff --git a/composer.lock b/composer.lock index d3d028d..688395f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "12fffdf5c68db05168e9385fccb5dec2", + "content-hash": "8a11a96f5b3b33624cb77d7ee7c3dba7", "packages": [ { "name": "brick/math", @@ -1056,16 +1056,16 @@ }, { "name": "laravel/framework", - "version": "v10.30.1", + "version": "v10.31.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "7a2da50258c4d0f693b738d3f3c69b2693aea6c1" + "reference": "507ce9b28bce4b5e4140c28943092ca38e9a52e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/7a2da50258c4d0f693b738d3f3c69b2693aea6c1", - "reference": "7a2da50258c4d0f693b738d3f3c69b2693aea6c1", + "url": "https://api.github.com/repos/laravel/framework/zipball/507ce9b28bce4b5e4140c28943092ca38e9a52e4", + "reference": "507ce9b28bce4b5e4140c28943092ca38e9a52e4", "shasum": "" }, "require": { @@ -1254,7 +1254,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2023-11-01T13:52:17+00:00" + "time": "2023-11-07T13:48:30+00:00" }, { "name": "laravel/prompts", @@ -1315,16 +1315,16 @@ }, { "name": "laravel/sanctum", - "version": "v3.3.1", + "version": "v3.3.2", "source": { "type": "git", "url": "https://github.com/laravel/sanctum.git", - "reference": "338f633e6487e76b255470d3373fbc29228aa971" + "reference": "e1a272893bec13cf135627f7e156030b3afe1e60" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/sanctum/zipball/338f633e6487e76b255470d3373fbc29228aa971", - "reference": "338f633e6487e76b255470d3373fbc29228aa971", + "url": "https://api.github.com/repos/laravel/sanctum/zipball/e1a272893bec13cf135627f7e156030b3afe1e60", + "reference": "e1a272893bec13cf135627f7e156030b3afe1e60", "shasum": "" }, "require": { @@ -1377,7 +1377,7 @@ "issues": "https://github.com/laravel/sanctum/issues", "source": "https://github.com/laravel/sanctum" }, - "time": "2023-09-07T15:46:33+00:00" + "time": "2023-11-03T13:42:14+00:00" }, { "name": "laravel/serializable-closure", @@ -1920,16 +1920,16 @@ }, { "name": "league/flysystem", - "version": "3.18.0", + "version": "3.19.0", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "015633a05aee22490495159237a5944091d8281e" + "reference": "1b2aa10f2326e0351399b8ce68e287d8e9209a83" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/015633a05aee22490495159237a5944091d8281e", - "reference": "015633a05aee22490495159237a5944091d8281e", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/1b2aa10f2326e0351399b8ce68e287d8e9209a83", + "reference": "1b2aa10f2326e0351399b8ce68e287d8e9209a83", "shasum": "" }, "require": { @@ -1994,7 +1994,7 @@ ], "support": { "issues": "https://github.com/thephpleague/flysystem/issues", - "source": "https://github.com/thephpleague/flysystem/tree/3.18.0" + "source": "https://github.com/thephpleague/flysystem/tree/3.19.0" }, "funding": [ { @@ -2006,20 +2006,20 @@ "type": "github" } ], - "time": "2023-10-20T17:59:40+00:00" + "time": "2023-11-07T09:04:28+00:00" }, { "name": "league/flysystem-local", - "version": "3.18.0", + "version": "3.19.0", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem-local.git", - "reference": "e7381ef7643f658b87efb7dbe98fe538fb1bbf32" + "reference": "8d868217f9eeb4e9a7320db5ccad825e9a7a4076" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/e7381ef7643f658b87efb7dbe98fe538fb1bbf32", - "reference": "e7381ef7643f658b87efb7dbe98fe538fb1bbf32", + "url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/8d868217f9eeb4e9a7320db5ccad825e9a7a4076", + "reference": "8d868217f9eeb4e9a7320db5ccad825e9a7a4076", "shasum": "" }, "require": { @@ -2054,7 +2054,7 @@ ], "support": { "issues": "https://github.com/thephpleague/flysystem-local/issues", - "source": "https://github.com/thephpleague/flysystem-local/tree/3.18.0" + "source": "https://github.com/thephpleague/flysystem-local/tree/3.19.0" }, "funding": [ { @@ -2066,7 +2066,77 @@ "type": "github" } ], - "time": "2023-10-19T20:07:13+00:00" + "time": "2023-11-06T20:35:28+00:00" + }, + { + "name": "league/fractal", + "version": "0.20.1", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/fractal.git", + "reference": "8b9d39b67624db9195c06f9c1ffd0355151eaf62" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/fractal/zipball/8b9d39b67624db9195c06f9c1ffd0355151eaf62", + "reference": "8b9d39b67624db9195c06f9c1ffd0355151eaf62", + "shasum": "" + }, + "require": { + "php": ">=7.4" + }, + "require-dev": { + "doctrine/orm": "^2.5", + "illuminate/contracts": "~5.0", + "mockery/mockery": "^1.3", + "pagerfanta/pagerfanta": "~1.0.0", + "phpstan/phpstan": "^1.4", + "phpunit/phpunit": "^9.5", + "squizlabs/php_codesniffer": "~3.4", + "vimeo/psalm": "^4.22", + "zendframework/zend-paginator": "~2.3" + }, + "suggest": { + "illuminate/pagination": "The Illuminate Pagination component.", + "pagerfanta/pagerfanta": "Pagerfanta Paginator", + "zendframework/zend-paginator": "Zend Framework Paginator" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.20.x-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Fractal\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Phil Sturgeon", + "email": "me@philsturgeon.uk", + "homepage": "http://philsturgeon.uk/", + "role": "Developer" + } + ], + "description": "Handle the output of complex data structures ready for API output.", + "homepage": "http://fractal.thephpleague.com/", + "keywords": [ + "api", + "json", + "league", + "rest" + ], + "support": { + "issues": "https://github.com/thephpleague/fractal/issues", + "source": "https://github.com/thephpleague/fractal/tree/0.20.1" + }, + "time": "2022-04-11T12:47:17+00:00" }, { "name": "league/mime-type-detection", @@ -3520,16 +3590,16 @@ }, { "name": "ramsey/uuid", - "version": "4.7.4", + "version": "4.7.5", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "60a4c63ab724854332900504274f6150ff26d286" + "reference": "5f0df49ae5ad6efb7afa69e6bfab4e5b1e080d8e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/60a4c63ab724854332900504274f6150ff26d286", - "reference": "60a4c63ab724854332900504274f6150ff26d286", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/5f0df49ae5ad6efb7afa69e6bfab4e5b1e080d8e", + "reference": "5f0df49ae5ad6efb7afa69e6bfab4e5b1e080d8e", "shasum": "" }, "require": { @@ -3596,7 +3666,7 @@ ], "support": { "issues": "https://github.com/ramsey/uuid/issues", - "source": "https://github.com/ramsey/uuid/tree/4.7.4" + "source": "https://github.com/ramsey/uuid/tree/4.7.5" }, "funding": [ { @@ -3608,7 +3678,7 @@ "type": "tidelift" } ], - "time": "2023-04-15T23:01:58+00:00" + "time": "2023-11-08T05:53:05+00:00" }, { "name": "stella-maris/clock", @@ -6389,6 +6459,446 @@ "source": "https://github.com/webmozarts/assert/tree/1.11.0" }, "time": "2022-06-03T18:03:27+00:00" + }, + { + "name": "yajra/laravel-datatables", + "version": "v10.0.0", + "source": { + "type": "git", + "url": "https://github.com/yajra/datatables.git", + "reference": "5a65f1b611a53a07530915619869ec87dcb823ad" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yajra/datatables/zipball/5a65f1b611a53a07530915619869ec87dcb823ad", + "reference": "5a65f1b611a53a07530915619869ec87dcb823ad", + "shasum": "" + }, + "require": { + "php": "^8.1", + "yajra/laravel-datatables-buttons": "^10", + "yajra/laravel-datatables-editor": "1.*", + "yajra/laravel-datatables-fractal": "^10", + "yajra/laravel-datatables-html": "^10", + "yajra/laravel-datatables-oracle": "^10" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "10.0-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Arjay Angeles", + "email": "aqangeles@gmail.com" + } + ], + "description": "Laravel DataTables Complete Package.", + "keywords": [ + "datatables", + "jquery", + "laravel" + ], + "support": { + "issues": "https://github.com/yajra/datatables/issues", + "source": "https://github.com/yajra/datatables/tree/v10.0.0" + }, + "funding": [ + { + "url": "https://github.com/sponsors/yajra", + "type": "github" + } + ], + "time": "2023-02-07T09:44:57+00:00" + }, + { + "name": "yajra/laravel-datatables-buttons", + "version": "v10.0.7", + "source": { + "type": "git", + "url": "https://github.com/yajra/laravel-datatables-buttons.git", + "reference": "f43f6eb501af2fbbb78d2b2985a9da992af768bd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yajra/laravel-datatables-buttons/zipball/f43f6eb501af2fbbb78d2b2985a9da992af768bd", + "reference": "f43f6eb501af2fbbb78d2b2985a9da992af768bd", + "shasum": "" + }, + "require": { + "illuminate/console": "^10", + "php": "^8.1", + "yajra/laravel-datatables-html": "^10", + "yajra/laravel-datatables-oracle": "^10" + }, + "require-dev": { + "barryvdh/laravel-snappy": "^1.0.1", + "maatwebsite/excel": "^3.1.46", + "nunomaduro/larastan": "^2.4", + "orchestra/testbench": "^8", + "rap2hpoutre/fast-excel": "^5.1" + }, + "suggest": { + "barryvdh/laravel-snappy": "Allows exporting of dataTable to PDF using the print view.", + "dompdf/dompdf": "Allows exporting of dataTable to PDF using the DomPDF.", + "maatwebsite/excel": "Exporting of dataTables (excel, csv and PDF) using maatwebsite package.", + "rap2hpoutre/fast-excel": "Faster exporting of dataTables using fast-excel package.", + "yajra/laravel-datatables-export": "Exporting of dataTables (excel, csv and PDF) via livewire and queue worker." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "10.0-dev" + }, + "laravel": { + "providers": [ + "Yajra\\DataTables\\ButtonsServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Yajra\\DataTables\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Arjay Angeles", + "email": "aqangeles@gmail.com" + } + ], + "description": "Laravel DataTables Buttons Plugin.", + "keywords": [ + "buttons", + "datatables", + "jquery", + "laravel" + ], + "support": { + "issues": "https://github.com/yajra/laravel-datatables-buttons/issues", + "source": "https://github.com/yajra/laravel-datatables-buttons/tree/v10.0.7" + }, + "funding": [ + { + "url": "https://github.com/sponsors/yajra", + "type": "github" + } + ], + "time": "2023-07-31T03:19:53+00:00" + }, + { + "name": "yajra/laravel-datatables-editor", + "version": "v1.25.4", + "source": { + "type": "git", + "url": "https://github.com/yajra/laravel-datatables-editor.git", + "reference": "23962356700d6b31f49bb119665b13e87303e13f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yajra/laravel-datatables-editor/zipball/23962356700d6b31f49bb119665b13e87303e13f", + "reference": "23962356700d6b31f49bb119665b13e87303e13f", + "shasum": "" + }, + "require": { + "illuminate/console": "*", + "illuminate/database": "*", + "illuminate/http": "*", + "illuminate/validation": "*", + "php": ">=7.0" + }, + "require-dev": { + "orchestra/testbench": "~3.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + }, + "laravel": { + "providers": [ + "Yajra\\DataTables\\EditorServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Yajra\\DataTables\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Arjay Angeles", + "email": "aqangeles@gmail.com" + } + ], + "description": "Laravel DataTables Editor plugin for Laravel 5.5+.", + "keywords": [ + "JS", + "datatables", + "editor", + "html", + "jquery", + "laravel" + ], + "support": { + "issues": "https://github.com/yajra/laravel-datatables-editor/issues", + "source": "https://github.com/yajra/laravel-datatables-editor/tree/v1.25.4" + }, + "funding": [ + { + "url": "https://www.paypal.me/yajra", + "type": "custom" + }, + { + "url": "https://github.com/yajra", + "type": "github" + }, + { + "url": "https://www.patreon.com/yajra", + "type": "patreon" + } + ], + "time": "2023-02-21T06:57:59+00:00" + }, + { + "name": "yajra/laravel-datatables-fractal", + "version": "v10.0.0", + "source": { + "type": "git", + "url": "https://github.com/yajra/laravel-datatables-fractal.git", + "reference": "765198d1f2b3f0a7c0c00f08ee41ba11be4ab1e2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yajra/laravel-datatables-fractal/zipball/765198d1f2b3f0a7c0c00f08ee41ba11be4ab1e2", + "reference": "765198d1f2b3f0a7c0c00f08ee41ba11be4ab1e2", + "shasum": "" + }, + "require": { + "league/fractal": "^0.20.1", + "php": "^8.1", + "yajra/laravel-datatables-oracle": "^10.0" + }, + "require-dev": { + "nunomaduro/larastan": "^2.4", + "orchestra/testbench": "^7.21" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "10.0-dev" + }, + "laravel": { + "providers": [ + "Yajra\\DataTables\\FractalServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Yajra\\DataTables\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Arjay Angeles", + "email": "aqangeles@gmail.com" + } + ], + "description": "Laravel DataTables Fractal Plugin.", + "keywords": [ + "api", + "datatables", + "fractal", + "laravel" + ], + "support": { + "issues": "https://github.com/yajra/laravel-datatables-fractal/issues", + "source": "https://github.com/yajra/laravel-datatables-fractal/tree/v10.0.0" + }, + "time": "2023-02-07T03:46:04+00:00" + }, + { + "name": "yajra/laravel-datatables-html", + "version": "v10.11.0", + "source": { + "type": "git", + "url": "https://github.com/yajra/laravel-datatables-html.git", + "reference": "f1154f4ba0c3d228ec70a965315a471e57ca57f2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yajra/laravel-datatables-html/zipball/f1154f4ba0c3d228ec70a965315a471e57ca57f2", + "reference": "f1154f4ba0c3d228ec70a965315a471e57ca57f2", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": "^8.1", + "yajra/laravel-datatables-oracle": "^10.0" + }, + "require-dev": { + "nunomaduro/larastan": "^2.4", + "orchestra/testbench": "^7.21" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "10.0-dev" + }, + "laravel": { + "providers": [ + "Yajra\\DataTables\\HtmlServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Yajra\\DataTables\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Arjay Angeles", + "email": "aqangeles@gmail.com" + } + ], + "description": "Laravel DataTables HTML builder plugin for Laravel 5.4+.", + "keywords": [ + "JS", + "datatables", + "html", + "jquery", + "laravel" + ], + "support": { + "issues": "https://github.com/yajra/laravel-datatables-html/issues", + "source": "https://github.com/yajra/laravel-datatables-html/tree/v10.11.0" + }, + "funding": [ + { + "url": "https://www.paypal.me/yajra", + "type": "custom" + }, + { + "url": "https://github.com/yajra", + "type": "github" + }, + { + "url": "https://www.patreon.com/yajra", + "type": "patreon" + } + ], + "time": "2023-11-06T05:50:47+00:00" + }, + { + "name": "yajra/laravel-datatables-oracle", + "version": "v10.11.0", + "source": { + "type": "git", + "url": "https://github.com/yajra/laravel-datatables.git", + "reference": "6badd623d6352284a926de604b55db881057ca67" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yajra/laravel-datatables/zipball/6badd623d6352284a926de604b55db881057ca67", + "reference": "6badd623d6352284a926de604b55db881057ca67", + "shasum": "" + }, + "require": { + "illuminate/database": "^9|^10", + "illuminate/filesystem": "^9|^10", + "illuminate/http": "^9|^10", + "illuminate/support": "^9|^10", + "illuminate/view": "^9|^10", + "php": "^8.0.2" + }, + "require-dev": { + "algolia/algoliasearch-client-php": "^3.4", + "laravel/scout": "^10.5", + "meilisearch/meilisearch-php": "^1.4", + "nunomaduro/larastan": "^2.4", + "orchestra/testbench": "^8", + "yajra/laravel-datatables-html": "^9.3.4|^10" + }, + "suggest": { + "yajra/laravel-datatables-buttons": "Plugin for server-side exporting of dataTables.", + "yajra/laravel-datatables-editor": "Plugin to use DataTables Editor (requires a license).", + "yajra/laravel-datatables-export": "Plugin for server-side exporting using livewire and queue worker.", + "yajra/laravel-datatables-fractal": "Plugin for server-side response using Fractal.", + "yajra/laravel-datatables-html": "Plugin for server-side HTML builder of dataTables." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "10.x-dev" + }, + "laravel": { + "providers": [ + "Yajra\\DataTables\\DataTablesServiceProvider" + ], + "aliases": { + "DataTables": "Yajra\\DataTables\\Facades\\DataTables" + } + } + }, + "autoload": { + "files": [ + "src/helper.php" + ], + "psr-4": { + "Yajra\\DataTables\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Arjay Angeles", + "email": "aqangeles@gmail.com" + } + ], + "description": "jQuery DataTables API for Laravel 4|5|6|7|8|9|10", + "keywords": [ + "datatables", + "jquery", + "laravel" + ], + "support": { + "issues": "https://github.com/yajra/laravel-datatables/issues", + "source": "https://github.com/yajra/laravel-datatables/tree/v10.11.0" + }, + "funding": [ + { + "url": "https://github.com/sponsors/yajra", + "type": "github" + } + ], + "time": "2023-11-04T01:21:13+00:00" } ], "packages-dev": [ @@ -6584,16 +7094,16 @@ }, { "name": "laravel/pint", - "version": "v1.13.5", + "version": "v1.13.6", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "df105cf8ce7a8f0b8a9425ff45cd281a5448e423" + "reference": "3e3d2ab01c7d8b484c18e6100ecf53639c744fa7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/df105cf8ce7a8f0b8a9425ff45cd281a5448e423", - "reference": "df105cf8ce7a8f0b8a9425ff45cd281a5448e423", + "url": "https://api.github.com/repos/laravel/pint/zipball/3e3d2ab01c7d8b484c18e6100ecf53639c744fa7", + "reference": "3e3d2ab01c7d8b484c18e6100ecf53639c744fa7", "shasum": "" }, "require": { @@ -6604,13 +7114,13 @@ "php": "^8.1.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.34.1", - "illuminate/view": "^10.26.2", - "laravel-zero/framework": "^10.1.2", + "friendsofphp/php-cs-fixer": "^3.38.0", + "illuminate/view": "^10.30.1", + "laravel-zero/framework": "^10.3.0", "mockery/mockery": "^1.6.6", "nunomaduro/larastan": "^2.6.4", "nunomaduro/termwind": "^1.15.1", - "pestphp/pest": "^2.20.0" + "pestphp/pest": "^2.24.2" }, "bin": [ "builds/pint" @@ -6646,7 +7156,7 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2023-10-26T09:26:10+00:00" + "time": "2023-11-07T17:59:57+00:00" }, { "name": "laravel/sail", diff --git a/config/datatables-buttons.php b/config/datatables-buttons.php new file mode 100644 index 0000000..1276d13 --- /dev/null +++ b/config/datatables-buttons.php @@ -0,0 +1,91 @@ + [ + /* + * Base namespace/directory to create the new file. + * This is appended on default Laravel namespace. + * Usage: php artisan datatables:make User + * Output: App\DataTables\UserDataTable + * With Model: App\User (default model) + * Export filename: users_timestamp + */ + 'base' => 'DataTables', + + /* + * Base namespace/directory where your model's are located. + * This is appended on default Laravel namespace. + * Usage: php artisan datatables:make Post --model + * Output: App\DataTables\PostDataTable + * With Model: App\Post + * Export filename: posts_timestamp + */ + 'model' => 'App\\Models', + ], + + /* + * Set Custom stub folder + */ + //'stub' => '/resources/custom_stub', + + /* + * PDF generator to be used when converting the table to pdf. + * Available generators: excel, snappy + * Snappy package: barryvdh/laravel-snappy + * Excel package: maatwebsite/excel + */ + 'pdf_generator' => 'snappy', + + /* + * Snappy PDF options. + */ + 'snappy' => [ + 'options' => [ + 'no-outline' => true, + 'margin-left' => '0', + 'margin-right' => '0', + 'margin-top' => '10mm', + 'margin-bottom' => '10mm', + ], + 'orientation' => 'landscape', + ], + + /* + * Default html builder parameters. + */ + 'parameters' => [ + 'dom' => 'Bfrtip', + 'order' => [[0, 'desc']], + 'buttons' => [ + 'excel', + 'csv', + 'pdf', + 'print', + 'reset', + 'reload', + ], + ], + + /* + * Generator command default options value. + */ + 'generator' => [ + /* + * Default columns to generate when not set. + */ + 'columns' => 'id,add your columns,created_at,updated_at', + + /* + * Default buttons to generate when not set. + */ + 'buttons' => 'excel,csv,pdf,print,reset,reload', + + /* + * Default DOM to generate when not set. + */ + 'dom' => 'Bfrtip', + ], +]; diff --git a/config/datatables-fractal.php b/config/datatables-fractal.php new file mode 100644 index 0000000..39250f1 --- /dev/null +++ b/config/datatables-fractal.php @@ -0,0 +1,13 @@ + 'include', + + /* + * Default fractal serializer. + */ + 'serializer' => League\Fractal\Serializer\DataArraySerializer::class, +]; diff --git a/config/datatables-html.php b/config/datatables-html.php new file mode 100644 index 0000000..5a5036f --- /dev/null +++ b/config/datatables-html.php @@ -0,0 +1,27 @@ + 'LaravelDataTables', + + /* + * Default table attributes when generating the table. + */ + 'table' => [ + 'class' => 'table', + 'id' => 'dataTableBuilder', + ], + + /* + * Html builder script template. + */ + 'script' => 'datatables::script', + + /* + * Html builder script template for DataTables Editor integration. + */ + 'editor' => 'datatables::editor', +]; diff --git a/config/datatables.php b/config/datatables.php new file mode 100644 index 0000000..b6ed653 --- /dev/null +++ b/config/datatables.php @@ -0,0 +1,127 @@ + [ + /* + * Smart search will enclose search keyword with wildcard string "%keyword%". + * SQL: column LIKE "%keyword%" + */ + 'smart' => true, + + /* + * Multi-term search will explode search keyword using spaces resulting into multiple term search. + */ + 'multi_term' => true, + + /* + * Case insensitive will search the keyword in lower case format. + * SQL: LOWER(column) LIKE LOWER(keyword) + */ + 'case_insensitive' => true, + + /* + * Wild card will add "%" in between every characters of the keyword. + * SQL: column LIKE "%k%e%y%w%o%r%d%" + */ + 'use_wildcards' => false, + + /* + * Perform a search which starts with the given keyword. + * SQL: column LIKE "keyword%" + */ + 'starts_with' => false, + ], + + /* + * DataTables internal index id response column name. + */ + 'index_column' => 'DT_RowIndex', + + /* + * List of available builders for DataTables. + * This is where you can register your custom dataTables builder. + */ + 'engines' => [ + 'eloquent' => Yajra\DataTables\EloquentDataTable::class, + 'query' => Yajra\DataTables\QueryDataTable::class, + 'collection' => Yajra\DataTables\CollectionDataTable::class, + 'resource' => Yajra\DataTables\ApiResourceDataTable::class, + ], + + /* + * DataTables accepted builder to engine mapping. + * This is where you can override which engine a builder should use + * Note, only change this if you know what you are doing! + */ + 'builders' => [ + //Illuminate\Database\Eloquent\Relations\Relation::class => 'eloquent', + //Illuminate\Database\Eloquent\Builder::class => 'eloquent', + //Illuminate\Database\Query\Builder::class => 'query', + //Illuminate\Support\Collection::class => 'collection', + ], + + /* + * Nulls last sql pattern for PostgreSQL & Oracle. + * For MySQL, use 'CASE WHEN :column IS NULL THEN 1 ELSE 0 END, :column :direction' + */ + 'nulls_last_sql' => ':column :direction NULLS LAST', + + /* + * User friendly message to be displayed on user if error occurs. + * Possible values: + * null - The exception message will be used on error response. + * 'throw' - Throws a \Yajra\DataTables\Exceptions\Exception. Use your custom error handler if needed. + * 'custom message' - Any friendly message to be displayed to the user. You can also use translation key. + */ + 'error' => env('DATATABLES_ERROR', null), + + /* + * Default columns definition of dataTable utility functions. + */ + 'columns' => [ + /* + * List of columns hidden/removed on json response. + */ + 'excess' => ['rn', 'row_num'], + + /* + * List of columns to be escaped. If set to *, all columns are escape. + * Note: You can set the value to empty array to disable XSS protection. + */ + 'escape' => '*', + + /* + * List of columns that are allowed to display html content. + * Note: Adding columns to list will make us available to XSS attacks. + */ + 'raw' => ['action'], + + /* + * List of columns are forbidden from being searched/sorted. + */ + 'blacklist' => ['password', 'remember_token'], + + /* + * List of columns that are only allowed fo search/sort. + * If set to *, all columns are allowed. + */ + 'whitelist' => '*', + ], + + /* + * JsonResponse header and options config. + */ + 'json' => [ + 'header' => [], + 'options' => 0, + ], + + /* + * Default condition to determine if a parameter is a callback or not. + * Callbacks needs to start by those terms, or they will be cast to string. + */ + 'callback' => ['$', '$.', 'function'], +]; diff --git a/public/vendor/datatables/buttons.server-side.js b/public/vendor/datatables/buttons.server-side.js new file mode 100644 index 0000000..e012c9b --- /dev/null +++ b/public/vendor/datatables/buttons.server-side.js @@ -0,0 +1,284 @@ +(function ($, DataTable) { + "use strict"; + + var _buildParams = function (dt, action, onlyVisibles) { + var params = dt.ajax.params(); + params.action = action; + params._token = $('meta[name="csrf-token"]').attr('content'); + + if (onlyVisibles) { + params.visible_columns = _getVisibleColumns(); + } else { + params.visible_columns = null; + } + + return params; + }; + + var _getVisibleColumns = function () { + + var visible_columns = []; + $.each(DataTable.settings[0].aoColumns, function (key, col) { + if (col.bVisible) { + visible_columns.push(col.name); + } + }); + + return visible_columns; + }; + + var _downloadFromUrl = function (url, params) { + var postUrl = url + '/export'; + var xhr = new XMLHttpRequest(); + xhr.open('POST', postUrl, true); + xhr.responseType = 'arraybuffer'; + xhr.onload = function () { + if (this.status === 200) { + var filename = ""; + var disposition = xhr.getResponseHeader('Content-Disposition'); + if (disposition && disposition.indexOf('attachment') !== -1) { + var filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/; + var matches = filenameRegex.exec(disposition); + if (matches != null && matches[1]) filename = matches[1].replace(/['"]/g, ''); + } + var type = xhr.getResponseHeader('Content-Type'); + + var blob = new Blob([this.response], {type: type}); + if (typeof window.navigator.msSaveBlob !== 'undefined') { + // IE workaround for "HTML7007: One or more blob URLs were revoked by closing the blob for which they were created. These URLs will no longer resolve as the data backing the URL has been freed." + window.navigator.msSaveBlob(blob, filename); + } else { + var URL = window.URL || window.webkitURL; + var downloadUrl = URL.createObjectURL(blob); + + if (filename) { + // use HTML5 a[download] attribute to specify filename + var a = document.createElement("a"); + // safari doesn't support this yet + if (typeof a.download === 'undefined') { + window.location = downloadUrl; + } else { + a.href = downloadUrl; + a.download = filename; + document.body.appendChild(a); + a.click(); + } + } else { + window.location = downloadUrl; + } + + setTimeout(function () { + URL.revokeObjectURL(downloadUrl); + }, 100); // cleanup + } + } + }; + xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); + xhr.send($.param(params)); + }; + + var _buildUrl = function(dt, action) { + var url = dt.ajax.url() || ''; + var params = dt.ajax.params(); + params.action = action; + + if (url.indexOf('?') > -1) { + return url + '&' + $.param(params); + } + + return url + '?' + $.param(params); + }; + + DataTable.ext.buttons.excel = { + className: 'buttons-excel', + + text: function (dt) { + return ' ' + dt.i18n('buttons.excel', 'Excel'); + }, + + action: function (e, dt, button, config) { + var url = _buildUrl(dt, 'excel'); + window.location = url; + } + }; + + DataTable.ext.buttons.postExcel = { + className: 'buttons-excel', + + text: function (dt) { + return ' ' + dt.i18n('buttons.excel', 'Excel'); + }, + + action: function (e, dt, button, config) { + var url = dt.ajax.url() || window.location.href; + var params = _buildParams(dt, 'excel'); + + _downloadFromUrl(url, params); + } + }; + + DataTable.ext.buttons.postExcelVisibleColumns = { + className: 'buttons-excel', + + text: function (dt) { + return ' ' + dt.i18n('buttons.excel', 'Excel (only visible columns)'); + }, + + action: function (e, dt, button, config) { + var url = dt.ajax.url() || window.location.href; + var params = _buildParams(dt, 'excel', true); + + _downloadFromUrl(url, params); + } + }; + + DataTable.ext.buttons.export = { + extend: 'collection', + + className: 'buttons-export', + + text: function (dt) { + return ' ' + dt.i18n('buttons.export', 'Export') + ' '; + }, + + buttons: ['csv', 'excel', 'pdf'] + }; + + DataTable.ext.buttons.csv = { + className: 'buttons-csv', + + text: function (dt) { + return ' ' + dt.i18n('buttons.csv', 'CSV'); + }, + + action: function (e, dt, button, config) { + var url = _buildUrl(dt, 'csv'); + window.location = url; + } + }; + + DataTable.ext.buttons.postCsvVisibleColumns = { + className: 'buttons-csv', + + text: function (dt) { + return ' ' + dt.i18n('buttons.csv', 'CSV (only visible columns)'); + }, + + action: function (e, dt, button, config) { + var url = dt.ajax.url() || window.location.href; + var params = _buildParams(dt, 'csv', true); + + _downloadFromUrl(url, params); + } + }; + + DataTable.ext.buttons.postCsv = { + className: 'buttons-csv', + + text: function (dt) { + return ' ' + dt.i18n('buttons.csv', 'CSV'); + }, + + action: function (e, dt, button, config) { + var url = dt.ajax.url() || window.location.href; + var params = _buildParams(dt, 'csv'); + + _downloadFromUrl(url, params); + } + }; + + DataTable.ext.buttons.pdf = { + className: 'buttons-pdf', + + text: function (dt) { + return ' ' + dt.i18n('buttons.pdf', 'PDF'); + }, + + action: function (e, dt, button, config) { + var url = _buildUrl(dt, 'pdf'); + window.location = url; + } + }; + + DataTable.ext.buttons.postPdf = { + className: 'buttons-pdf', + + text: function (dt) { + return ' ' + dt.i18n('buttons.pdf', 'PDF'); + }, + + action: function (e, dt, button, config) { + var url = dt.ajax.url() || window.location.href; + var params = _buildParams(dt, 'pdf'); + + _downloadFromUrl(url, params); + } + }; + + DataTable.ext.buttons.print = { + className: 'buttons-print', + + text: function (dt) { + return ' ' + dt.i18n('buttons.print', 'Print'); + }, + + action: function (e, dt, button, config) { + var url = _buildUrl(dt, 'print'); + window.location = url; + } + }; + + DataTable.ext.buttons.reset = { + className: 'buttons-reset', + + text: function (dt) { + return ' ' + dt.i18n('buttons.reset', 'Reset'); + }, + + action: function (e, dt, button, config) { + dt.search(''); + dt.columns().search(''); + dt.draw(); + } + }; + + DataTable.ext.buttons.reload = { + className: 'buttons-reload', + + text: function (dt) { + return ' ' + dt.i18n('buttons.reload', 'Reload'); + }, + + action: function (e, dt, button, config) { + dt.draw(false); + } + }; + + DataTable.ext.buttons.create = { + className: 'buttons-create', + + text: function (dt) { + return ' ' + dt.i18n('buttons.create', 'Create'); + }, + + action: function (e, dt, button, config) { + window.location = window.location.href.replace(/\/+$/, "") + '/create'; + } + }; + + if (typeof DataTable.ext.buttons.copyHtml5 !== 'undefined') { + $.extend(DataTable.ext.buttons.copyHtml5, { + text: function (dt) { + return ' ' + dt.i18n('buttons.copy', 'Copy'); + } + }); + } + + if (typeof DataTable.ext.buttons.colvis !== 'undefined') { + $.extend(DataTable.ext.buttons.colvis, { + text: function (dt) { + return ' ' + dt.i18n('buttons.colvis', 'Column visibility'); + } + }); + } +})(jQuery, jQuery.fn.dataTable); diff --git a/resources/views/Admin/refund/detail-refund.blade.php b/resources/views/Admin/refund/detail-refund.blade.php index ef9f58e..748f345 100644 --- a/resources/views/Admin/refund/detail-refund.blade.php +++ b/resources/views/Admin/refund/detail-refund.blade.php @@ -12,8 +12,15 @@
-
+
+
+
+

Refund

+
+

#{{ $refund->id }}

+
+

Bukti Foto/Video

@foreach ($descriptions as $description) @if ($description->type == 'image') @@ -26,9 +33,13 @@ @endif @endforeach

+
+
Status
+
{{ ucwords($refund->status) }}
+

ID Order
-
{{ $refund->transaction_id }}
+
#{{ $refund->transaction_id }}

Nama Barang
@@ -50,15 +61,19 @@

Harga Satuan Barang
-
{{ $refund->satuan_barang }}
+
{{ $refund->transaction->satuan_barang }}

Jumlah Barang
-
{{ $refund->jumlah_barang }}
+
{{ $refund->transaction->jumlah_barang }}

-
Total Harga
-
{{ $refund->total_harga }}
+
Total Bayar
+
{{ $refund->transaction->total_bayar }}
+

+
+
Total Refund
+
{{ $refund->transaction->total_harga }}

Batas Pengajuan Refund
@@ -71,12 +86,12 @@ @if ($refund->status == 'pending') @endif -

@@ -84,5 +99,136 @@
- @include('admin.refund.modal-next-detail-refund') + @endsection diff --git a/resources/views/Admin/refund/index.blade.php b/resources/views/Admin/refund/index.blade.php index 95823a8..8935be1 100644 --- a/resources/views/Admin/refund/index.blade.php +++ b/resources/views/Admin/refund/index.blade.php @@ -33,7 +33,6 @@ @foreach ($refunds as $refund) {{ $loop->iteration }} - {{ $refund->id }} {{ $refund->transaction->data_pembeli->nama_depan }} {{ $refund->transaction->nama_barang }} @@ -50,7 +49,7 @@
-
Payment Method
+
Metode Pembayaran
@if ($transaction->metode_pembayaran != null)

+
+ + +
diff --git a/resources/views/Admin/transaction/index.blade.php b/resources/views/Admin/transaction/index.blade.php index 00482ef..95c9f81 100644 --- a/resources/views/Admin/transaction/index.blade.php +++ b/resources/views/Admin/transaction/index.blade.php @@ -26,7 +26,7 @@ Tanggal Transaksi Tanggal Update Status - Action + Aksi @@ -42,23 +42,23 @@ {{ $transaction->created_at }} {{ $transaction->updated_at }} status_transaksi, ['created']) ? 'badge-light' - : (in_array($transaction->status, ['settlement', 'capture']) + : (in_array($transaction->status_transaksi, ['success']) ? 'badge-info' - : (in_array($transaction->status, ['process', 'sending', 'sended']) + : (in_array($transaction->status_transaksi, ['process', 'sending', 'sent']) ? 'badge-warning' - : (in_array($transaction->status, ['cancel', 'expire', 'failure', 'refund']) + : (in_array($transaction->status_transaksi, ['cancel', 'failure', 'refund']) ? 'badge-danger' - : ($transaction->status == 'finished' + : ($transaction->status_transaksi == 'finished' ? 'badge-success' - : '')))) }}">{{ ucwords($transaction->status) }} + : 'bagde-dark')))) }}">{{ ucwords($transaction->status_transaksi) }}
@include('admin.transaction.modal-tracking') - @extends('admin.transaction.modal-keterangan-status') + @include('admin.transaction.modal-keterangan-status') diff --git a/resources/views/User/transaction/Pembeli/index.blade.php b/resources/views/User/transaction/Pembeli/index.blade.php index 7a18db8..80e95ce 100644 --- a/resources/views/User/transaction/Pembeli/index.blade.php +++ b/resources/views/User/transaction/Pembeli/index.blade.php @@ -67,7 +67,7 @@ ? 'badge-danger' : ($transaction->status_transaksi == 'finished' ? 'badge-success' - : '')))) }}">{{ ucwords($transaction->status_transaksi) }} + : 'badge-dark')))) }}">{{ ucwords($transaction->status_transaksi) }}
@@ -83,13 +83,13 @@ {{-- di midtrans statusnya settlement --}} - {{-- @if ($transaction->status_transaksi == 'sent') --}} -
  • Selesaikan -
  • - {{-- @endif --}} + @if ($transaction->status_transaksi == 'sent') +
  • Selesaikan +
  • + @endif @if ($transaction->status_transaksi == 'created')
  • - @extends('user.transaction.pembeli.modal-end-transaction') - @extends('user.transaction.pembeli.modal-tracking') - @extends('user.transaction.pembeli.modal-keterangan-status') + @include('user.transaction.pembeli.modal-end-transaction') + @include('user.transaction.pembeli.modal-tracking') + @include('user.transaction.pembeli.modal-keterangan-status') @@ -477,18 +477,14 @@ text: response.message, icon: 'error' }); - console.log(error); } }); - - console.log(id); }); // complain $('#modalFinish').on('click', '#complain', function() { var id = $(this).data('id'); location.href = "{{ route('user-refund.create', ':id') }}".replace(':id', id); - console.log(id); }); }); diff --git a/resources/views/User/transaction/Pembeli/modal-keterangan-status.blade.php b/resources/views/User/transaction/Pembeli/modal-keterangan-status.blade.php index d66bdef..42d8c73 100644 --- a/resources/views/User/transaction/Pembeli/modal-keterangan-status.blade.php +++ b/resources/views/User/transaction/Pembeli/modal-keterangan-status.blade.php @@ -1,5 +1,5 @@