diff --git a/app/Http/Controllers/Admin/AdminRefundController.php b/app/Http/Controllers/Admin/AdminRefundController.php
index d33cb72..50b7fe7 100644
--- a/app/Http/Controllers/Admin/AdminRefundController.php
+++ b/app/Http/Controllers/Admin/AdminRefundController.php
@@ -2,16 +2,16 @@
namespace App\Http\Controllers\Admin;
+use Throwable;
use App\Models\Refund;
-use App\Models\Refunds;
-use App\Http\Controllers\Controller;
-use App\Models\RefundDescription;
use App\Models\Transaction;
-use App\Models\TransactionDescription;
use Illuminate\Http\Request;
+use Yajra\DataTables\DataTables;
+use App\Models\RefundDescription;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
-use Throwable;
+use App\Http\Controllers\Controller;
+use App\Models\TransactionDescription;
class AdminRefundController extends Controller
{
@@ -130,4 +130,47 @@ class AdminRefundController extends Controller
]);
}
}
+
+ public function listRefund(Request $request)
+ {
+ $subQuery = Refund::with('transaction')
+ ->select('id', 'pembeli', 'nama_barang', 'penjual', 'total', 'tanggal_transaksi', 'batas_konfirmasi_transaksi', 'status');
+
+ if ($request->has('search') && !empty($request->search['value'])) {
+ $searchRefund = $request->search['value'];
+ $subQuery->where(function ($a) use ($searchRefund) {
+ $a->whereRaw('pembeli LIKE ?', ['%' . $searchRefund . '%'])
+ ->orWhereRaw('nama_barang LIKE ?', ['%' . $searchRefund . '%'])
+ ->orWhereRaw('penjual LIKE ?', ['%' . $searchRefund . '%']);
+ });
+ }
+ $queryRefund = Refund::from(DB::raw("({$subQuery->toSql()}) as tmp"))
+ ->mergeBindings($subQuery->getQuery()) // Menggabungkan binding parameters
+ ->select('*')
+ ->get();
+
+ if ($request->ajax()) {
+ return DataTables::of($queryRefund)
+ ->addIndexColumn()
+ ->addColumn('aksi', function ($row) {
+ $url = route('admin-refund.show', ['id' => $row->id]);
+ $html_code = '
+
+
+
+
+
';
+ return $html_code;
+ })
+ ->rawColumns(['aksi'])
+ ->make(true);
+ }
+ }
}
diff --git a/app/Http/Controllers/User/UserContactController.php b/app/Http/Controllers/User/UserContactController.php
index 374a1a8..bd74bef 100644
--- a/app/Http/Controllers/User/UserContactController.php
+++ b/app/Http/Controllers/User/UserContactController.php
@@ -2,12 +2,13 @@
namespace App\Http\Controllers\User;
-use App\Models\Contact;
use App\Models\User;
-use App\Http\Controllers\Controller;
+use App\Models\Contact;
use Illuminate\Http\Request;
-use Illuminate\Support\Facades\Auth;
+use Yajra\DataTables\DataTables;
use Illuminate\Support\Facades\DB;
+use App\Http\Controllers\Controller;
+use Illuminate\Support\Facades\Auth;
class UserContactController extends Controller
{
@@ -111,4 +112,54 @@ class UserContactController extends Controller
]);
}
}
+
+ public function show($id)
+ {
+ $user = Contact::find($id);
+ return view('user.contact.modal-detail-contact', ['user' => $user]);
+ }
+
+ public function listContact(Request $request)
+ {
+ $subQuery = DB::table('contacts')
+ ->leftJoin('users', 'contacts.user_id', '=', 'users.id')
+ ->select('users.nama_depan');
+
+ if ($request->has('search') && !empty($request->search['value'])) {
+ $searchContact = $request->search['value'];
+ $subQuery->where(function ($a) use ($searchContact) {
+ $a->whereRaw('nama_depan LIKE ?', ['%' . $searchContact . '%']);
+ });
+ }
+
+ $queryUser = Contact::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 ($user) {
+ $url = route('admin-contact.show', ['id' => $user->id]);
+ $html_code = '
+
+
+
+
+
';
+ return $html_code;
+ })
+
+ ->rawColumns(['action'])
+ ->make(true);
+ }
+ }
}
diff --git a/app/Http/Controllers/User/UserRefundController.php b/app/Http/Controllers/User/UserRefundController.php
index e533498..31175a8 100644
--- a/app/Http/Controllers/User/UserRefundController.php
+++ b/app/Http/Controllers/User/UserRefundController.php
@@ -2,17 +2,18 @@
namespace App\Http\Controllers\User;
-use Illuminate\Http\Request;
-use App\Http\Controllers\Controller;
-use App\Models\RefundUser;
-use App\Models\Refund;
-use App\Models\RefundDescription;
-use App\Models\Transaction;
-use App\Models\TransactionDescription;
+use Throwable;
use Carbon\Carbon;
+use App\Models\Refund;
+use App\Models\RefundUser;
+use App\Models\Transaction;
+use Illuminate\Http\Request;
+use Yajra\DataTables\DataTables;
+use App\Models\RefundDescription;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
-use Throwable;
+use App\Http\Controllers\Controller;
+use App\Models\TransactionDescription;
class UserRefundController extends Controller
{
@@ -107,4 +108,47 @@ class UserRefundController extends Controller
'descriptions' => $refundDescription
]);
}
+
+ public function listRefund(Request $request)
+ {
+ $subQuery = Refund::with('transaction')
+ ->select('*');
+
+ if ($request->has('search') && !empty($request->search['value'])) {
+ $searchRefund = $request->search['value'];
+ $subQuery->where(function ($a) use ($searchRefund) {
+ $a->whereRaw('pembeli LIKE ?', ['%' . $searchRefund . '%'])
+ ->orWhereRaw('nama_barang LIKE ?', ['%' . $searchRefund . '%'])
+ ->orWhereRaw('penjual LIKE ?', ['%' . $searchRefund . '%']);
+ });
+ }
+ $queryRefund = Refund::from(DB::raw("({$subQuery->toSql()}) as tmp"))
+ ->mergeBindings($subQuery->getQuery()) // Menggabungkan binding parameters
+ ->select('*')
+ ->get();
+
+ if ($request->ajax()) {
+ return DataTables::of($queryRefund)
+ ->addIndexColumn()
+ ->addColumn('aksi', function ($row) {
+ $url = route('user-refund.show', ['id' => $row->id]);
+ $html_code = '
+
+
+
+
+
';
+ return $html_code;
+ })
+ ->rawColumns(['aksi'])
+ ->make(true);
+ }
+ }
}
diff --git a/app/Models/Contact.php b/app/Models/Contact.php
index 233a15f..c090940 100644
--- a/app/Models/Contact.php
+++ b/app/Models/Contact.php
@@ -33,5 +33,10 @@ class Contact extends Model
return $this->belongsTo(User::class, 'relasi_kontak', 'email');
}
+ public function user()
+ {
+ return $this->belongsTo(User::class, 'user_id');
+ }
+
//Relasi
}
diff --git a/app/Models/User.php b/app/Models/User.php
index f6b5cc2..109bcee 100644
--- a/app/Models/User.php
+++ b/app/Models/User.php
@@ -126,4 +126,9 @@ class User extends Authenticatable
return $this->village->district->city->province->name;
}
+ public function contacts()
+ {
+ return $this->hasMany(Contact::class, 'user_id');
+ }
+
}
diff --git a/composer.lock b/composer.lock
index 688395f..14cdcab 100644
--- a/composer.lock
+++ b/composer.lock
@@ -9350,5 +9350,5 @@
"php": "^8.1"
},
"platform-dev": [],
- "plugin-api-version": "2.6.0"
+ "plugin-api-version": "2.3.0"
}
diff --git a/pp._matsuriasli.pptx b/pp._matsuriasli.pptx
new file mode 100644
index 0000000..6ed1163
Binary files /dev/null and b/pp._matsuriasli.pptx differ
diff --git a/resources/views/Admin/refund/index.blade.php b/resources/views/Admin/refund/index.blade.php
index 8935be1..9a04492 100644
--- a/resources/views/Admin/refund/index.blade.php
+++ b/resources/views/Admin/refund/index.blade.php
@@ -13,7 +13,7 @@
-
+
@@ -29,7 +29,7 @@
| Aksi |
-
+ {{--
@foreach ($refunds as $refund)
{{ $loop->iteration }} |
@@ -59,7 +59,7 @@
@endforeach
-
+ --}}
@@ -67,5 +67,83 @@
+
@extends('admin.transaction.modal-keterangan-status')
@endsection
diff --git a/resources/views/User/contact/index.blade.php b/resources/views/User/contact/index.blade.php
index c5bbba0..ae5c846 100644
--- a/resources/views/User/contact/index.blade.php
+++ b/resources/views/User/contact/index.blade.php
@@ -23,7 +23,7 @@
-
+
@@ -64,6 +64,37 @@
@endsection
diff --git a/routes/web.php b/routes/web.php
index d1e2c74..6f6cf79 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -144,6 +144,7 @@ Route::middleware(['auth'])->group(function(){
Route::get('user-contact','index')->name('user-contact.index');
Route::get('user-contact/list-contact','listContact')->name('user-contact.list-contact');
Route::post('user-contact','store')->name('user-contact.store');
+ Route::get('admin-contact/{id}','show')->name('admin-contact.show');
Route::delete('user-contact/delete/{id}','destroy')->name('user-contact.destroy');
Route::get('user-contact/get-user-contact','getContact')->name('user-contact.get');
Route::get('user-contact/cek-contact/{email}','cekEmail')->name('user-contact.email');