Perbaikan transaksi midtrans

This commit is contained in:
Muhammad Raihan Surya 2023-11-06 14:36:22 +07:00
parent 0f45ead6bc
commit 9600ed71f1
30 changed files with 908 additions and 494 deletions

View File

@ -6,17 +6,23 @@ use App\Models\Refund;
use App\Models\Refunds; use App\Models\Refunds;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\RefundDescription; use App\Models\RefundDescription;
use App\Models\Transaction;
use App\Models\TransactionDescription;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Throwable;
class AdminRefundController extends Controller class AdminRefundController extends Controller
{ {
/** /**
* Display a listing of the resource. * Display a listing of the resource.
*/ */
public function index() public function index()
{ {
return view('admin.refund.index', [ return view('admin.refund.index', [
"refunds" => Refund::latest()->get() 'refunds' => Refund::latest()->get(),
]); ]);
} }
@ -28,20 +34,93 @@ class AdminRefundController extends Controller
$refund = Refund::find($id); $refund = Refund::find($id);
$refundDescription = RefundDescription::where('refund_id', $id)->get(); $refundDescription = RefundDescription::where('refund_id', $id)->get();
return view('admin.refund.detail-refund', [ return view('admin.refund.detail-refund', [
"refund"=> $refund, 'refund' => $refund,
'descriptions' => $refundDescription 'descriptions' => $refundDescription,
]); ]);
} }
public function aprroveRefund($id){ public function aprroveRefund($id)
$query = Refund::where('id',$id)->update([ {
$transaction = Transaction::where('id', $id)->first();
$refund = Refund::where('transaction_id', $id)->first();
$params = [
'refund_key' => $id . '-ref1',
'amount' => $transaction->total_harga,
'reason' => $refund->complaint,
];
// $refundMidtrans = Trans::refund($id, $params);
try {
Transaction::where('id', $id)->update([
'status_transaksi' => 'refund',
'status_pembayaran' => 'refund'
]); ]);
}
public function denyRefund($id){ Refund::where('transaction_id', $id)->update([
$query = Refund::where('id',$id)->update([ 'status' => 'refund',
]);
TransactionDescription::create([
'transcation_id' => $id,
'status' => 'refund',
'user' => auth()->user()->email,
'judul' => 'fas fa-long-arrow-alt-left',
'background' => 'bg-primary',
'deskripsi' => 'Admin telah menyetujui refund.',
]);
DB::commit();
return response()->json([
'status' => false,
'message' => 'Refund berhasil dilakukan',
// 'refundMidtrans' => $refundMidtrans,
]);
} catch (Throwable $e) {
DB::rollBack();
Log::error($e->getMessage());
return response()->json([
'status' => false,
'message' => 'Refund gagal dilakukan',
// 'refundMidtrans' => $refundMidtrans
]); ]);
} }
} }
public function denyRefund($id)
{
try {
Transaction::where('id', $id)->update([
'status_transaksi' => 'finished',
'status_pembayaran' => 'settlement'
]);
Refund::where('transaction_id', $id)->update([
'status' => 'deny',
]);
TransactionDescription::create([
'transcation_id' => $id,
'status' => 'deny',
'user' => auth()->user()->email,
'judul' => 'fas fa-long-arrow-alt-left',
'background' => 'bg-primary',
'deskripsi' => 'Admin telah menyetujui refund.',
]);
} catch (Throwable $e) {
DB::rollBack();
Log::error($e->getMessage());
return response()->json([
'status' => false,
'message' => 'Refund gagal dilakukan',
]);
}
}
}

View File

@ -6,6 +6,7 @@ use App\Models\Transaction;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\TransactionDescription; use App\Models\TransactionDescription;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Throwable;
class AdminTransactionController extends Controller class AdminTransactionController extends Controller
{ {
@ -32,4 +33,20 @@ class AdminTransactionController extends Controller
->get(), ->get(),
]); ]);
} }
public function aprroveTransaction($id){
try{
}catch(Throwable $e){
}
}
public function denyTransaction($id){
try{
}catch(Throwable $e){
}
}
} }

View File

@ -8,6 +8,7 @@ use App\Models\RefundUser;
use App\Models\Refund; use App\Models\Refund;
use App\Models\RefundDescription; use App\Models\RefundDescription;
use App\Models\Transaction; use App\Models\Transaction;
use App\Models\TransactionDescription;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Throwable; use Throwable;
@ -32,11 +33,13 @@ class UserRefundController extends Controller
try{ try{
DB::beginTransaction(); DB::beginTransaction();
$transaction = Transaction::where('id',$id)->first(); $transaction = Transaction::where('id',$id)->update([
'status_transaksi' => 'refund',
]);
$refund = Refund::create([ $refund = Refund::create([
'transaction_id' => $id, 'transaction_id' => $id,
'total' => $transaction->harga, 'total' => $transaction->total_harga,
'due_date' => $transaction, 'due_date' => $transaction,
'complain' => $request->complain 'complain' => $request->complain
]); ]);
@ -64,6 +67,15 @@ class UserRefundController extends Controller
} }
} }
TransactionDescription::create([
'transcation_id' => $id,
'status' => 'pending',
'user' => auth()->user()->email,
'judul' => 'fas fa-clock',
'background' => 'bg-buyer',
'deskripsi' => auth()->user()->nama_depan.' mengajukan refund.',
]);
DB::commit(); DB::commit();
}catch(Throwable $e){ }catch(Throwable $e){
DB::rollback(); DB::rollback();
@ -77,11 +89,7 @@ class UserRefundController extends Controller
public function show($id){ public function show($id){
$refund = Refund::find($id); $refund = Refund::find($id);
$refundDescription = RefundDescription::where($id)->get(); $refundDescription = RefundDescription::where($id)->get();
return view('admin.refund.detail-refund',[ return view('user.refund.detail-refund',[
"refund"=> $refund,
'descriptions' => $refundDescription
]);
return view('user.refund.history-refund',[
'refund' => $refund, 'refund' => $refund,
'descriptions' => $refundDescription 'descriptions' => $refundDescription
]); ]);

View File

@ -13,11 +13,10 @@ use App\Models\User;
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Ramsey\Uuid\Uuid; use Ramsey\Uuid\Uuid;
use Midtrans\Config;
use Midtrans\Snap;
use Midtrans\Transaction as Trans;
use Stichoza\GoogleTranslate\GoogleTranslate; use Stichoza\GoogleTranslate\GoogleTranslate;
use Throwable; use Throwable;
@ -27,16 +26,6 @@ class UserTransactionController extends Controller
* Display a listing of the resource. * Display a listing of the resource.
*/ */
public function __construct()
{
Config::$serverKey = 'SB-Mid-server-8rydZAwKoWuoQ6g_3ot0-K7p';
Config::$isProduction = false;
// Set sanitization on (default)
Config::$isSanitized = true;
// Set 3DS transaction for credit card to true
Config::$is3ds = true;
}
public function indexPembeli() public function indexPembeli()
{ {
return view('user.transaction.pembeli.index', [ return view('user.transaction.pembeli.index', [
@ -103,35 +92,71 @@ class UserTransactionController extends Controller
public function store(Request $request) public function store(Request $request)
{ {
$pembeli = Auth::user()->email; $pembeli = Auth::user()->email;
$penjual = $request->get('email_penjual'); $penjual = $request->email_penjual;
$nama_barang = $request->get('nama_barang'); $nama_barang = $request->nama_barang;
$satuan_barang = $request->get('satuan_barang'); $satuan_barang = $request->satuan_barang;
$deskripsi_transaksi = $request->get('deskripsi'); $deskripsi_transaksi = $request->deskripsi;
$harga_barang = $request->get('harga_barang'); $harga_barang = $request->harga_barang;
$jumlah_barang = $request->get('jumlah_barang'); $jumlah_barang = $request->jumlah_barang;
$nama_depan_pembeli = Auth::user()->nama_depan; $nama_depan_pembeli = Auth::user()->nama_depan;
$nama_belakang_pembeli = Auth::user()->nama_belakang; $nama_belakang_pembeli = Auth::user()->nama_belakang;
$nohp_pembeli = Auth::user()->nohp; $nohp_pembeli = Auth::user()->nohp;
$nama_penjual = User::where('email', $penjual)->value('nama_depan'); $nama_penjual = User::where('email', $penjual)->value('nama_depan');
$bank_penjual = User::where('email', $penjual)->value('nama_bank');
$no_rek_penjual = User::where('email', $penjual)->value('no_rek');
if ($bank_penjual == '' && $no_rek_penjual == '') {
return response()->json([
'status' => false,
'message' => 'Penjual belum memiliki/memasukan nomor rek bank',
]);
}
$alamat = ucwords(strtolower(Auth::user()->alamat)); $alamat = ucwords(strtolower(Auth::user()->alamat));
$id = Uuid::uuid4();
$now = Carbon::now(); $now = Carbon::now();
$persentase_keuntungan = $request->get('persentase_keuntungan'); $persentase_keuntungan = $request->persentase_keuntungan;
$total_harga = $request->get('total_harga'); $total_harga = $request->total_harga;
$total_keuntungan = $request->get('total_keuntungan'); $total_keuntungan = $request->total_keuntungan;
$total_bayar = $request->get('total_bayar'); $total_bayar = $request->total_bayar;
$batas_pembayaran = $now->addDays(1)->toDateTimeString(); $batas_pembayaran = $now->addDays(1)->toTimeString();
$batas_pengiriman_barang_awal = $now->addDays(2)->toDateTimeString(); $batas_konfirmasi_transaksi = $now->addDays(2)->toDateTimeString();
$batas_pengiriman_barang_awal = $now->addDays(3)->toDateTimeString();
$batas_pengiriman_barang_akhir = $now->addDays(4)->toDateTimeString(); $batas_pengiriman_barang_akhir = $now->addDays(4)->toDateTimeString();
$status = 'created';
try {
DB::beginTransaction();
$query = Transaction::create([
'pembeli' => $pembeli,
'penjual' => $penjual,
'nama_barang' => $nama_barang,
'deskripsi_transaksi' => $deskripsi_transaksi,
'satuan_barang' => $satuan_barang,
'harga_barang' => $harga_barang,
'jumlah_barang' => $jumlah_barang,
'persentase_keuntungan' => $persentase_keuntungan,
'total_keuntungan' => $total_keuntungan,
'total_harga' => $total_harga,
'total_bayar' => $total_bayar,
'nama_bank_penjual' => $bank_penjual,
'no_rek_penjual' => $no_rek_penjual,
'status_transaksi' => $status,
'batas_pembayaran' => $batas_pembayaran,
'batas_konfirmasi_transaksi' => $batas_konfirmasi_transaksi,
'batas_pengiriman_barang_awal' => $batas_pengiriman_barang_awal,
'batas_pengiriman_barang_akhir' => $batas_pengiriman_barang_akhir,
]);
$params = [ $params = [
'transaction_details' => [ 'transaction_details' => [
'order_id' => $id, 'order_id' => $query->id,
'gross_amount' => $total_bayar, 'gross_amount' => $total_bayar,
], ],
'item_details' => [ 'item_details' => [
@ -164,40 +189,20 @@ class UserTransactionController extends Controller
], ],
], ],
'callbacks' => [ 'callbacks' => [
'finish' => route('user-transaction.index.pembeli'), 'finish' => route('user-pembeli.index'),
],
'enabled_payments' => ['credit_card', 'gopay', 'shopeepay'],
'expiry' => [
'start_time' => $now->format('Y-m-d H:i:s P'),
'unit' => 'days',
'duration' => 1,
], ],
'enabled_payments' => ['credit_card', 'gopay', 'qris'],
]; ];
$snap_token = Snap::getSnapToken($params); $auth = base64_encode(env('MIDTRANS_SERVER_KEY'));
$token = $snap_token;
$status = 'created';
try { $response = Http::withHeaders([
DB::beginTransaction(); 'Content-Type' => 'application/json',
'Authorization' => "Basic $auth",
])->post('https://app.sandbox.midtrans.com/snap/v1/transactions', $params);
$query = Transaction::create([ Transaction::where('id', $query->id)->update([
'pembeli' => $pembeli, 'token' => $response['token'],
'penjual' => $penjual,
'nama_barang' => $nama_barang,
'deskripsi_transaksi' => $deskripsi_transaksi,
'satuan_barang' => $satuan_barang,
'harga_barang' => $harga_barang,
'jumlah_barang' => $jumlah_barang,
'persentase_keuntungan' => $persentase_keuntungan,
'total_keuntungan' => $total_keuntungan,
'total_harga' => $total_harga,
'total_bayar' => $total_bayar,
'token' => $token,
'status' => $status,
'batas_pembayaran' => $batas_pembayaran,
'batas_pengiriman_barang_awal' => $batas_pengiriman_barang_awal,
'batas_pengiriman_barang_akhir' => $batas_pengiriman_barang_akhir,
]); ]);
$contact = Contact::where('pemilik_kontak', $pembeli) $contact = Contact::where('pemilik_kontak', $pembeli)
@ -238,17 +243,17 @@ class UserTransactionController extends Controller
} }
} }
public function acceptTransaction($id) public function acceptTransaction(Request $request)
{ {
try { try {
DB::beginTransaction(); DB::beginTransaction();
Transaction::where('id', $id)->update([ Transaction::where('id', $request->id)->update([
'status' => 'process', 'status_transaksi' => 'process',
]); ]);
TransactionDescription::create([ TransactionDescription::create([
'transaction_id' => $id, 'transaction_id' => $request->id,
'status' => 'process', 'status' => 'process',
'background' => 'bg-seller', 'background' => 'bg-seller',
'user' => Auth::user()->email, 'user' => Auth::user()->email,
@ -274,17 +279,17 @@ class UserTransactionController extends Controller
} }
} }
public function sendingOrder($id) public function sendingOrder(Request $request)
{ {
try { try {
DB::beginTransaction(); DB::beginTransaction();
Transaction::where('id', $id)->update([ Transaction::where('id', $request->id)->update([
'status' => 'sending', 'status_transaksi' => 'sending',
]); ]);
TransactionDescription::create([ TransactionDescription::create([
'transaction_id' => $id, 'transaction_id' => $request->id,
'status' => 'sending', 'status' => 'sending',
'background' => 'bg-seller', 'background' => 'bg-seller',
'user' => Auth::user()->email, 'user' => Auth::user()->email,
@ -310,22 +315,33 @@ class UserTransactionController extends Controller
} }
} }
public function sentOrder($id) public function sentOrder(Request $request)
{ {
try { try {
DB::beginTransaction(); DB::beginTransaction();
Transaction::where('id', $id)->update([ Transaction::where('id', $request->id)->update([
'status' => 'sended', 'status_transaksi' => 'sent',
]); ]);
$bukti_foto = '';
if ($request->hasFile('bukti_foto')) {
$file = $request->file('bukti_foto');
$bukti_foto = time() . '.' . $file->getClientOriginalExtension();
$path = 'bukti-foto/' . $bukti_foto;
Storage::disk('public')->put($path, file_get_contents($file));
}
TransactionDescription::create([ TransactionDescription::create([
'transaction_id' => $id, 'transaction_id' => $request->id,
'status' => 'sended', 'status' => 'sent',
'background' => 'bg-seller', 'background' => 'bg-seller',
'user' => Auth::user()->email, 'user' => Auth::user()->email,
'judul' => 'fas fa-check', 'judul' => 'fas fa-check',
'deskripsi' => 'Pesanan telah sampai di tempat pembeli.', 'deskripsi' => 'Pesanan telah sampai di tempat pembeli.',
'bukti_foto' => $bukti_foto,
]); ]);
DB::commit(); DB::commit();
@ -346,17 +362,18 @@ class UserTransactionController extends Controller
} }
} }
public function finishTransaction($id) public function finishTransaction(Request $request)
{ {
try { try {
DB::beginTransaction(); DB::beginTransaction();
Transaction::where('id', $id)->update([ Transaction::where('id', $request->id)->update([
'status' => 'finished', 'status_transaksi' => 'finished',
'status_pembayaran' => 'settlement',
]); ]);
TransactionDescription::create([ TransactionDescription::create([
'transaction_id' => $id, 'transaction_id' => $request->id,
'status' => 'finished', 'status' => 'finished',
'background' => 'bg-buyer', 'background' => 'bg-buyer',
'user' => Auth::user()->email, 'user' => Auth::user()->email,
@ -382,47 +399,96 @@ class UserTransactionController extends Controller
} }
} }
public function payTransaction($id) public function payTransaction(Request $request)
{ {
// Membuat objek Google Translate
$translator = new GoogleTranslate();
// Mengatur bahasa sumber (Inggris) dan bahasa target (Indonesia)
$translator->setSource('en');
$translator->setTarget('id');
$payment = Trans::status($id);
$result = json_decode(json_encode($payment), true);
if ($result['status_code'] == '200') {
try { try {
DB::beginTransaction(); DB::beginTransaction();
Transaction::where('id', $id)->update([ $auth = base64_encode(env('MIDTRANS_SERVER_KEY'));
'currency' => $result['currency'],
'merchant_id' => $result['merchant_id'], $response = Http::withHeaders([
'Content-Type' => 'application/json',
'Authorization' => "Basic $auth",
])->get('https://api.sandbox.midtrans.com/v2/' . $request->id . '/status');
$result = json_decode($response->body(), true);
if ($result['transaction'] == 'settlement') {
$transaction = 'success';
} elseif ($result['transaction'] == 'capture') {
if ($result['fraud_status'] == 'accept') {
$transaction = 'success';
} elseif ($result['fraud_status'] == 'challenge') {
$transaction = 'challenge';
}
} else {
$transaction = 'failure';
}
$query1 = Transaction::where('id', $request->id)->update([
'metode_pembayaran' => $result['payment_type'], 'metode_pembayaran' => $result['payment_type'],
'tanggal_transaksi' => $result['transaction_time'], 'tanggal_transaksi' => now(),
'signature_key' => $result['signature_key'], 'status_transaksi' => $transaction,
'status' => $result['transaction_status'], 'status_pembayaran' => $result['transaction_status'],
'fraud_status' => $result['fraud_status'], 'fraud_status' => $result['fraud_status'],
'reference_id' => $result['reference_id'],
'signature_key' => $result['signature_key'],
]); ]);
if ($transaction == 'success') {
TransactionDescription::create([ TransactionDescription::create([
'transaction_id' => $id, 'transaction_id' => $request->id,
'status' => $result['transaction_status'], 'status' => 'success',
'user' => Auth::user()->email,
'judul' => 'fas fa-check',
'status_code' => $result['status_code'],
'background' => 'bg-buyer', 'background' => 'bg-buyer',
'judul' => 'fas fa-money-bill',
'deskripsi' => Auth::user()->nama_depan . ' telah sukses melakukan pembayaran. Transaksi diteruskan ke penjual.', 'deskripsi' => Auth::user()->nama_depan . ' telah sukses melakukan pembayaran. Transaksi diteruskan ke penjual.',
'user' => auth()->user()->email,
]); ]);
DB::rollBack(); DB::commit();
return response()->json([ return response()->json([
'status' => true, 'status' => true,
'message' => 'Pembayaran sukses.', 'message' => 'Pembayaran sukses',
'data' => $query1,
]); ]);
} elseif ($transaction == 'challenge') {
TransactionDescription::create([
'transaction_id' => $request->id,
'status' => 'challenge',
'background' => 'bg-primary',
'judul' => 'fas fa-clock',
'deskripsi' => 'Transaksi ' . auth()->user()->email . ' terindikasi masalah, tunggu sesaat hingga admin menyetujui pembayaran.',
'user' => auth()->user()->email,
'keterangan' => $result['status_message'],
]);
DB::commit();
return response()->json([
'status' => false,
'message' => 'Pembayaran ditunda hingga disetujui oleh admin',
'data' => $query1,
]);
} else {
TransactionDescription::create([
'transaction_id' => $request->id,
'status' => 'failure',
'background' => 'bg-primary',
'judul' => 'fas fa-exclamation',
'deskripsi' => 'Terjadi kegagalan pembayaran.',
'user' => auth()->user()->email,
'keterangan' => $result['status_message'],
]);
DB::commit();
return response()->json([
'status' => false,
'message' => 'Transaksi pembayaran gagal',
'data' => $query1,
]);
}
} catch (Throwable $e) { } catch (Throwable $e) {
DB::rollBack(); DB::rollBack();
@ -433,45 +499,43 @@ class UserTransactionController extends Controller
'message' => 'Transaksi pembayaran gagal.', 'message' => 'Transaksi pembayaran gagal.',
]); ]);
} }
} else {
return response()->json([ return response()->json();
'status' => false,
'message' => 'Transaksi pembayaran gagal',
]);
}
} }
public function cancelTransaction($id) public function cancelTransaction(Request $request)
{ {
// Membuat objek Google Translate $auth = base64_encode(env('MIDTRANS_SERVER_KEY'));
$translator = new GoogleTranslate();
$translator->setSource('en'); $response = Http::withHeaders([
$translator->setTarget('id'); 'Content-Type' => 'application/json',
'Authorization' => "Basic $auth",
])->post('https://api.sandbox.midtrans.com/v2/' . $request->id . '/cancel');
$result = json_decode($response->body(), true);
$cancel = json_decode(json_encode(Trans::cancel($id)), true);
if ($cancel['status_code'] == '200') {
try { try {
DB::beginTransaction(); DB::beginTransaction();
Transaction::where('id', $id)->update([ Transaction::where('id', $request->id)->update([
'status' => 'cancel', 'status_transaksi' => 'failure',
'status_pembayaran' => $result['transaction_status'],
]); ]);
TransactionDescription::create([ TransactionDescription::create([
'transcation_id' => $id, 'transaction_id' => $request->id,
'status' => 'cancel', 'status' => 'cancel',
'user' => Auth::user()->email,
'judul' => 'fas fa-exclamation',
'background' => 'bg-buyer', 'background' => 'bg-buyer',
'deskripsi' => 'Transaksi dibatalkan', 'judul' => 'fas fa-exclamation',
'deskripsi' => auth()->user()->nama_depan . ' telah membatalkan transaksi.',
'user' => auth()->user()->email,
]); ]);
DB::commit(); DB::commit();
return response()->json([ return response()->json([
'status' => true, 'status' => true,
'message' => 'Transaksi berhasil dibatal', 'message' => 'Transaksi berhasil dibatalkan',
]); ]);
} catch (Throwable $e) { } catch (Throwable $e) {
DB::rollBack(); DB::rollBack();
@ -483,10 +547,41 @@ class UserTransactionController extends Controller
'message' => 'Transaksi gagal dibatalkan', 'message' => 'Transaksi gagal dibatalkan',
]); ]);
} }
} else { }
public function pendingTransaction(Request $request)
{
$auth = base64_encode(env('MIDTRANS_SERVER_KEY'));
$response = Http::withHeaders([
'Content-Type' => 'application/json',
'Authorization' => "Basic $auth",
])->get('https://api.sandbox.midtrans.com/v2/' . $request->id . '/status');
$result = json_decode($response->body(), true);
try {
DB::beginTransaction();
Transaction::where('id', $request->id)->update([
'status_pembayaran' => $result['transaction_status']
]);
DB::commit();
return response()->json([
'status' => true,
'message' => 'Pembayaran di-pending, silahkan masuk lagi dan bayar secepat mungkin.',
]);
} catch (Throwable $e) {
DB::rollBack();
Log::error($e->getMessage());
return response()->json([ return response()->json([
'status' => false, 'status' => false,
'message' => $translator->translate($cancel['status_message']), 'message' => 'Terjadi error di bagian server.',
]); ]);
} }
} }

View File

@ -15,18 +15,20 @@ class TransactionDescription extends Model
* @var array<int, string> * @var array<int, string>
*/ */
protected $fillable = [ protected $fillable = [
'order_id', 'transaction_id',
'user', 'user',
'judul', 'judul',
'status', 'status',
'status_code', 'status_code',
'background', 'background',
'deskripsi' 'deskripsi',
'keterangan',
'bukti_foto'
]; ];
//Relasi //Relasi
public function order(){ public function transaction(){
return $this->belongsTo(Transaction::class, 'order_id', 'id'); return $this->belongsTo(Transaction::class, 'transaction_id', 'id');
} }
public function user(){ public function user(){

View File

@ -27,10 +27,13 @@ class Transaction extends Model
'total_harga', 'total_harga',
'total_bayar', 'total_bayar',
'token', 'token',
'status', 'status_transaksi',
'status_pembayaran',
'batas_pembayaran', 'batas_pembayaran',
'batas_pengiriman_barang_awal', 'batas_pengiriman_barang_awal',
'batas_pengiriman_barang_akhir', 'batas_pengiriman_barang_akhir',
'nama_bank_penjual',
'no_rek_penjual'
]; ];
/** /**

View File

@ -15,7 +15,6 @@
"laravel/sanctum": "^3.2", "laravel/sanctum": "^3.2",
"laravel/tinker": "^2.8", "laravel/tinker": "^2.8",
"laravolt/indonesia": "^0.34.0", "laravolt/indonesia": "^0.34.0",
"midtrans/midtrans-php": "^2.5",
"nesbot/carbon": "^2.69", "nesbot/carbon": "^2.69",
"pusher/pusher-php-server": "^7.2", "pusher/pusher-php-server": "^7.2",
"ramsey/uuid": "^4.7", "ramsey/uuid": "^4.7",

93
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "7c67133036db6b4f4df2682df682403c", "content-hash": "12fffdf5c68db05168e9385fccb5dec2",
"packages": [ "packages": [
{ {
"name": "brick/math", "name": "brick/math",
@ -1056,16 +1056,16 @@
}, },
{ {
"name": "laravel/framework", "name": "laravel/framework",
"version": "v10.29.0", "version": "v10.30.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/framework.git", "url": "https://github.com/laravel/framework.git",
"reference": "2d002849a16ad131110a50cbea4d64dbb78515a3" "reference": "7a2da50258c4d0f693b738d3f3c69b2693aea6c1"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/2d002849a16ad131110a50cbea4d64dbb78515a3", "url": "https://api.github.com/repos/laravel/framework/zipball/7a2da50258c4d0f693b738d3f3c69b2693aea6c1",
"reference": "2d002849a16ad131110a50cbea4d64dbb78515a3", "reference": "7a2da50258c4d0f693b738d3f3c69b2693aea6c1",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1254,20 +1254,20 @@
"issues": "https://github.com/laravel/framework/issues", "issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework" "source": "https://github.com/laravel/framework"
}, },
"time": "2023-10-24T13:48:53+00:00" "time": "2023-11-01T13:52:17+00:00"
}, },
{ {
"name": "laravel/prompts", "name": "laravel/prompts",
"version": "v0.1.12", "version": "v0.1.13",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/prompts.git", "url": "https://github.com/laravel/prompts.git",
"reference": "b35f249028c22016e45e48626e19e5d42fd827ff" "reference": "e1379d8ead15edd6cc4369c22274345982edc95a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/prompts/zipball/b35f249028c22016e45e48626e19e5d42fd827ff", "url": "https://api.github.com/repos/laravel/prompts/zipball/e1379d8ead15edd6cc4369c22274345982edc95a",
"reference": "b35f249028c22016e45e48626e19e5d42fd827ff", "reference": "e1379d8ead15edd6cc4369c22274345982edc95a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1309,9 +1309,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/laravel/prompts/issues", "issues": "https://github.com/laravel/prompts/issues",
"source": "https://github.com/laravel/prompts/tree/v0.1.12" "source": "https://github.com/laravel/prompts/tree/v0.1.13"
}, },
"time": "2023-10-18T14:18:57+00:00" "time": "2023-10-27T13:53:59+00:00"
}, },
{ {
"name": "laravel/sanctum", "name": "laravel/sanctum",
@ -2124,61 +2124,6 @@
], ],
"time": "2023-10-17T14:13:20+00:00" "time": "2023-10-17T14:13:20+00:00"
}, },
{
"name": "midtrans/midtrans-php",
"version": "2.5.2",
"source": {
"type": "git",
"url": "https://github.com/Midtrans/midtrans-php.git",
"reference": "a1ad0c824449ca8c68c4cf11b3417ad518311d2b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Midtrans/midtrans-php/zipball/a1ad0c824449ca8c68c4cf11b3417ad518311d2b",
"reference": "a1ad0c824449ca8c68c4cf11b3417ad518311d2b",
"shasum": ""
},
"require": {
"ext-curl": "*",
"ext-json": "*",
"php": ">=5.4"
},
"require-dev": {
"phpunit/phpunit": "5.7.*",
"psy/psysh": "0.4.*"
},
"type": "library",
"autoload": {
"psr-4": {
"Midtrans\\": "Midtrans/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Andri Setiawan",
"email": "andri.setiawan@veritrans.co.id"
},
{
"name": "Alvin Litani",
"email": "alvin.litani@veritrans.co.id"
},
{
"name": "Ismail Faruqi",
"email": "ismail.faruqi@veritrans.co.id"
}
],
"description": "PHP Wrapper for Midtrans Payment API.",
"homepage": "https://midtrans.com",
"support": {
"issues": "https://github.com/Midtrans/midtrans-php/issues",
"source": "https://github.com/Midtrans/midtrans-php/tree/2.5.2"
},
"time": "2021-08-23T08:52:05+00:00"
},
{ {
"name": "monolog/monolog", "name": "monolog/monolog",
"version": "3.5.0", "version": "3.5.0",
@ -6517,16 +6462,16 @@
}, },
{ {
"name": "filp/whoops", "name": "filp/whoops",
"version": "2.15.3", "version": "2.15.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/filp/whoops.git", "url": "https://github.com/filp/whoops.git",
"reference": "c83e88a30524f9360b11f585f71e6b17313b7187" "reference": "a139776fa3f5985a50b509f2a02ff0f709d2a546"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/filp/whoops/zipball/c83e88a30524f9360b11f585f71e6b17313b7187", "url": "https://api.github.com/repos/filp/whoops/zipball/a139776fa3f5985a50b509f2a02ff0f709d2a546",
"reference": "c83e88a30524f9360b11f585f71e6b17313b7187", "reference": "a139776fa3f5985a50b509f2a02ff0f709d2a546",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -6576,7 +6521,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/filp/whoops/issues", "issues": "https://github.com/filp/whoops/issues",
"source": "https://github.com/filp/whoops/tree/2.15.3" "source": "https://github.com/filp/whoops/tree/2.15.4"
}, },
"funding": [ "funding": [
{ {
@ -6584,7 +6529,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2023-07-13T12:00:00+00:00" "time": "2023-11-03T12:00:00+00:00"
}, },
{ {
"name": "hamcrest/hamcrest-php", "name": "hamcrest/hamcrest-php",
@ -8895,5 +8840,5 @@
"php": "^8.1" "php": "^8.1"
}, },
"platform-dev": [], "platform-dev": [],
"plugin-api-version": "2.3.0" "plugin-api-version": "2.6.0"
} }

View File

@ -26,13 +26,14 @@ return new class extends Migration
$table->double('total_harga'); // gross amount $table->double('total_harga'); // gross amount
$table->double('total_bayar'); $table->double('total_bayar');
$table->string('signature_key')->nullable(); $table->string('signature_key')->nullable();
$table->string('token'); $table->string('reference_id')->nullable();
$table->string('token')->nullable();
$table->string('metode_pembayaran')->nullable(); $table->string('metode_pembayaran')->nullable();
$table->char('currency',3)->nullable();
$table->string('fraud_status')->nullable(); $table->string('fraud_status')->nullable();
$table->string('merchant_id')->nullable(); $table->enum('status_transaksi',['success','challenge','failure','process','sending','sent','finished','created', 'refund'])->default('created'); // transaction_status
$table->enum('status',['settlement','capture','pending','cancel','refund', 'expire','failure','process','sending','sended','finished','created'])->default('created'); // transaction_status $table->enum('status_pembayaran',['settlement','capture','pending','expire','failure','cancel','refund'])->nullable(); // status transaksi dari midtrans
$table->timestamp('batas_pembayaran'); $table->timestamp('batas_pembayaran')->nullable();
$table->timestamp('batas_konfirmasi_transaksi')->nullable();
$table->timestamp('batas_pengiriman_barang_awal'); $table->timestamp('batas_pengiriman_barang_awal');
$table->timestamp('batas_pengiriman_barang_akhir'); $table->timestamp('batas_pengiriman_barang_akhir');
$table->timestamp('tanggal_transaksi')->nullable(); $table->timestamp('tanggal_transaksi')->nullable();

View File

@ -17,7 +17,7 @@ return new class extends Migration
$table->foreignUuid('transaction_id'); $table->foreignUuid('transaction_id');
$table->double('total',10); $table->double('total',10);
$table->timestamp('due_date'); $table->timestamp('due_date');
$table->enum('status',['partial refund','deny','pending'])->default('pending'); $table->enum('status',['refund','deny','pending'])->default('pending');
$table->text('complaint'); $table->text('complaint');
$table->timestamps(); $table->timestamps();
$table->foreign('transaction_id')->on('transactions')->references('id'); $table->foreign('transaction_id')->on('transactions')->references('id');

View File

@ -19,6 +19,7 @@ return new class extends Migration
$table->string('background'); $table->string('background');
$table->string('judul'); $table->string('judul');
$table->string('deskripsi'); $table->string('deskripsi');
$table->string('keterangan')->nullable();
$table->string('status_code')->nullable(); $table->string('status_code')->nullable();
$table->string('bukti_foto')->nullable(); $table->string('bukti_foto')->nullable();
$table->timestamps(); $table->timestamps();

View File

@ -4,6 +4,7 @@ namespace Database\Seeders;
// use Illuminate\Database\Console\Seeds\WithoutModelEvents; // use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use App\Models\Contact;
use App\Models\Refund; use App\Models\Refund;
use App\Models\RefundDescription; use App\Models\RefundDescription;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
@ -66,6 +67,8 @@ class DatabaseSeeder extends Seeder
'persentase_kemiripan' => 100, 'persentase_kemiripan' => 100,
'gender' => $faker->randomElement(['Laki-laki', 'Perempuan']), 'gender' => $faker->randomElement(['Laki-laki', 'Perempuan']),
'kode_kelurahan' => '1101012002', 'kode_kelurahan' => '1101012002',
'nama_bank' => 'mandiri',
'no_rek' => '019809210873'
]); ]);
$user2 = User::factory()->create([ $user2 = User::factory()->create([
@ -85,7 +88,10 @@ class DatabaseSeeder extends Seeder
'persentase_kemiripan' => 100, 'persentase_kemiripan' => 100,
'gender' => $faker->randomElement(['Laki-laki', 'Perempuan']), 'gender' => $faker->randomElement(['Laki-laki', 'Perempuan']),
'kode_kelurahan' => '1101012002', 'kode_kelurahan' => '1101012002',
'nama_bank' => 'bca',
'no_rek' => '01980921'
]); ]);
// User::factory(20)->create(); // User::factory(20)->create();
$now = Carbon::now()->tz('Asia/Jakarta'); $now = Carbon::now()->tz('Asia/Jakarta');
@ -113,12 +119,12 @@ class DatabaseSeeder extends Seeder
'total_harga' => 2, 'total_harga' => 2,
'total_bayar' => 2, 'total_bayar' => 2,
'token' => 'asda', 'token' => 'asda',
'status' => 'pending', 'status_transaksi' => 'created',
'batas_pembayaran' => now(), 'batas_pembayaran' => now(),
'batas_pengiriman_barang_awal' => now(), 'batas_pengiriman_barang_awal' => now(),
'batas_pengiriman_barang_akhir' => now(), 'batas_pengiriman_barang_akhir' => now(),
'nama_bank_penjual' => 'asd', 'nama_bank_penjual' => $user2->nama_bank,
'no_rek_penjual' => '21-', 'no_rek_penjual' => $user2->no_rek,
]); ]);
TransactionDescription::create([ TransactionDescription::create([
@ -144,12 +150,13 @@ class DatabaseSeeder extends Seeder
'total_harga' => 2, 'total_harga' => 2,
'total_bayar' => 2, 'total_bayar' => 2,
'token' => 'asda', 'token' => 'asda',
'status' => 'refund', 'status_transaksi' => 'success',
'status_pembayaran' => 'refund',
'batas_pembayaran' => now(), 'batas_pembayaran' => now(),
'batas_pengiriman_barang_awal' => now(), 'batas_pengiriman_barang_awal' => now(),
'batas_pengiriman_barang_akhir' => now(), 'batas_pengiriman_barang_akhir' => now(),
'nama_bank_penjual' => 'asd', 'nama_bank_penjual' => $user2->nama_bank,
'no_rek_penjual' => '21-', 'no_rek_penjual' => $user2->no_rek,
]); ]);
$refund = Refund::create([ $refund = Refund::create([
@ -171,6 +178,16 @@ class DatabaseSeeder extends Seeder
'type' => 'image' 'type' => 'image'
]); ]);
Contact::create([
'pemilik_kontak' => $user1->email,
'relasi_kontak' => $user2->email
]);
Contact::create([
'pemilik_kontak' => $user2->email,
'relasi_kontak' => $user1->email
]);
$this->call([ProvincesSeeder::class, CitiesSeeder::class, DistrictsSeeder::class, VillagesSeeder::class]); $this->call([ProvincesSeeder::class, CitiesSeeder::class, DistrictsSeeder::class, VillagesSeeder::class]);
} }
} }

64
docker/8.3/Dockerfile Normal file
View File

@ -0,0 +1,64 @@
FROM ubuntu:22.04
LABEL maintainer="Taylor Otwell"
ARG WWWGROUP
ARG NODE_VERSION=20
ARG POSTGRES_VERSION=15
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND noninteractive
ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update \
&& mkdir -p /etc/apt/keyrings \
&& apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 dnsutils librsvg2-bin fswatch \
&& curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c' | gpg --dearmor | tee /etc/apt/keyrings/ppa_ondrej_php.gpg > /dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
&& apt-get update \
&& apt-get install -y php8.3-cli php8.3-dev \
php8.3-pgsql php8.3-sqlite3 php8.3-gd \
php8.3-curl \
php8.3-imap php8.3-mysql php8.3-mbstring \
php8.3-xml php8.3-zip php8.3-bcmath php8.3-soap \
php8.3-intl php8.3-readline \
php8.3-ldap \
# php8.3-msgpack php8.3-igbinary php8.3-redis php8.3-swoole \
# php8.3-memcached php8.3-pcov php8.3-xdebug \
# php8.3-imagick \
&& curl -sLS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_VERSION.x nodistro main" > /etc/apt/sources.list.d/nodesource.list \
&& apt-get update \
&& apt-get install -y nodejs \
&& npm install -g npm \
&& npm install -g pnpm \
&& npm install -g bun \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /etc/apt/keyrings/yarn.gpg >/dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/yarn.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \
&& curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /etc/apt/keyrings/pgdg.gpg >/dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt jammy-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& apt-get update \
&& apt-get install -y yarn \
&& apt-get install -y mysql-client \
&& apt-get install -y postgresql-client-$POSTGRES_VERSION \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.3
RUN groupadd --force -g $WWWGROUP sail
RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail
COPY start-container /usr/local/bin/start-container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /etc/php/8.3/cli/conf.d/99-sail.ini
RUN chmod +x /usr/local/bin/start-container
EXPOSE 8000
ENTRYPOINT ["start-container"]

7
docker/8.3/php.ini Normal file
View File

@ -0,0 +1,7 @@
[PHP]
post_max_size = 100M
upload_max_filesize = 100M
variables_order = EGPCS
[opcache]
opcache.enable_cli=1

View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
if [ ! -z "$WWWUSER" ]; then
usermod -u $WWWUSER sail
fi
if [ ! -d /.composer ]; then
mkdir /.composer
fi
chmod -R ugo+rw /.composer
if [ $# -gt 0 ]; then
exec gosu $WWWUSER "$@"
else
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
fi

View File

@ -0,0 +1,14 @@
[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
[program:php]
command=/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80
user=sail
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

View File

@ -70,12 +70,12 @@ $("#table-5").dataTable({
// Contact User // Contact User
$("#table-6").dataTable({ $("#table-6").dataTable({
columnDefs: [{ sortable: false, targets: [4] }], columnDefs: [{ sortable: false, targets: [2] }],
searchable: true, searchable: true,
}); });
//Refund User //Refund User
$("#table-7").dataTable({ $("#table-7").dataTable({
columnDefs: [{ sortable: false, targets: [5] }], columnDefs: [{ sortable: false, targets: [7] }],
searchable: true, searchable: true,
}); });

View File

@ -3,11 +3,11 @@
<div class="main-content"> <div class="main-content">
<section class="section"> <section class="section">
<div class="section-header"> <div class="section-header">
<h1>Detail</h1> <h1>Detail Refund</h1>
<div class="section-header-breadcrumb"> <div class="section-header-breadcrumb">
<div class="breadcrumb-item active"><a href="{{ route('admin.index') }}">Dashboard</a></div> <div class="breadcrumb-item active"><a href="{{ route('admin.index') }}">Dashboard</a></div>
<div class="breadcrumb-item"><a href="{{ route('admin-refund.index') }}">Refund</a></div> <div class="breadcrumb-item"><a href="{{ route('admin-refund.index') }}">Refund</a></div>
<div class="breadcrumb-item">Detail</div> <div class="breadcrumb-item">Detail refund</div>
</div> </div>
</div> </div>
<div class="col-md-12"> <div class="col-md-12">
@ -28,23 +28,37 @@
<br><br> <br><br>
<div class="row"> <div class="row">
<div class="col-2"><strong>ID Order</strong></div> <div class="col-2"><strong>ID Order</strong></div>
<div class="col">{{ $refund->order_id }}</div> <div class="col">{{ $refund->transaction_id }}</div>
</div><br> </div><br>
<div class="row"> <div class="row">
<div class="col-2"><strong>Customer Name</strong></div> <div class="col-2"><strong>Nama Barang</strong></div>
<div class="col">
{{ $refund->transaction->nama_barang }}
</div>
</div><br>
<div class="row">
<div class="col-2"><strong>Nama Pembeli</strong></div>
<div class="col"> <div class="col">
{{ $refund->transaction->data_pembeli->nama_depan . ' ' . $refund->transaction->data_pembeli->nama_belakang }} {{ $refund->transaction->data_pembeli->nama_depan . ' ' . $refund->transaction->data_pembeli->nama_belakang }}
</div> </div>
</div><br> </div><br>
<div class="row"> <div class="row">
<div class="col-2"><strong>Seller Name</strong></div> <div class="col-2"><strong>Nama Penjual</strong></div>
<div class="col"> <div class="col">
{{ $refund->transaction->data_penjual->nama_depan . ' ' . $refund->transaction->data_penjual->nama_belakang }} {{ $refund->transaction->data_penjual->nama_depan . ' ' . $refund->transaction->data_penjual->nama_belakang }}
</div> </div>
</div><br> </div><br>
<div class="row"> <div class="row">
<div class="col-2"><strong>Total</strong></div> <div class="col-2"><strong>Harga Satuan Barang</strong></div>
<div class="col">{{ $refund->total }}</div> <div class="col">{{ $refund->satuan_barang }}</div>
</div><br>
<div class="row">
<div class="col-2"><strong>Jumlah Barang</strong></div>
<div class="col">{{ $refund->jumlah_barang }}</div>
</div><br>
<div class="row">
<div class="col-2"><strong>Total Harga</strong></div>
<div class="col">{{ $refund->total_harga }}</div>
</div><br> </div><br>
<div class="row"> <div class="row">
<div class="col-2"><strong>Batas Pengajuan Refund</strong></div> <div class="col-2"><strong>Batas Pengajuan Refund</strong></div>
@ -55,7 +69,7 @@
<div class="col justified-text">{{ $refund->complaint }}</div> <div class="col justified-text">{{ $refund->complaint }}</div>
</div> </div>
@if ($refund) @if ($refund->status == 'pending')
<div class="d-flex justify-content-center mt-3"> <div class="d-flex justify-content-center mt-3">
<a href="#" data-toggle="modal" data-target="#ModalRefund" <a href="#" data-toggle="modal" data-target="#ModalRefund"
class="btn btn-primary mx-1">Accept</a> class="btn btn-primary mx-1">Accept</a>

View File

@ -28,8 +28,6 @@
<tr class="text-center"> <tr class="text-center">
<th>#</th> <th>#</th>
<th>Nama</th> <th>Nama</th>
<th>Email</th>
<th>No. HP</th>
<th>Aksi</th> <th>Aksi</th>
</tr> </tr>
</thead> </thead>
@ -40,10 +38,6 @@
<td class="font-weight-600"> <td class="font-weight-600">
{{ $contact->relasiKontak->nama_depan . ' ' . $contact->relasiKontak->nama_belakang }} {{ $contact->relasiKontak->nama_depan . ' ' . $contact->relasiKontak->nama_belakang }}
</td> </td>
<td class="text-center font-weight-600">{{ $contact->relasiKontak->email }}
</td>
<td class="text-center font-weight-600">{{ $contact->relasiKontak->nohp }}
</td>
<td class="text-center"> <td class="text-center">
<button class="btn btn-info open-detail-modal" data-toggle="modal" <button class="btn btn-info open-detail-modal" data-toggle="modal"
data-target="#modaldetail" id="detailContact" data-target="#modaldetail" id="detailContact"
@ -77,17 +71,20 @@
var teksEmail = document.getElementById('teksEmail'); var teksEmail = document.getElementById('teksEmail');
var teksAlamat = document.getElementById('teksAlamat'); var teksAlamat = document.getElementById('teksAlamat');
$('#table-2').on('click', '#detailContact', function() { $('#modaldetail').on('show.bs.modal', function(event) {
let dataId = $(this).data('id'); var triggerLink = $(event.relatedTarget);
let dataProvince = $(this).data('province'); let dataId = triggerLink.data('id');
let dataCity = $(this).data('city'); let dataProvince = triggerLink.data('province');
let dataDistrict = $(this).data('district'); let dataCity = triggerLink.data('city');
let dataVillage = $(this).data('village'); let dataDistrict = triggerLink.data('district');
let dataVillage = triggerLink.data('village');
teksNama.innerHTML = dataId.nama_depan + " " + dataId.nama_belakang; teksNama.innerHTML = dataId.nama_depan + " " + dataId.nama_belakang;
teksAlamat.innerHTML = dataId.alamat + ", " + capital(dataVillage) + ", " + capital( teksAlamat.innerHTML = dataId.alamat + ", " + capital(dataVillage) + ", " + capital(
dataDistrict) + ", " + capital(dataCity) + ", " + capital(dataProvince); dataDistrict) + ", " + capital(dataCity) + ", " + capital(dataProvince);
teksNohp.innerHTML = dataId.nohp; teksNohp.innerHTML = dataId.nohp;
teksEmail.innerHTML = dataId.email; teksEmail.innerHTML = dataId.email;
console.log(dataId);
}); });
function capital(text) { function capital(text) {

View File

@ -11,23 +11,23 @@
<div class="card-body"> <div class="card-body">
<div class="alert alert-primary" role="alert"> <div class="alert alert-primary" role="alert">
<div class="form-group"> <div class="form-group">
<label for="teksNama" style="color: white; font-size: 1.1em;">Nama</label> <label for="teksNama" style="font-size: 1.1em;">Nama</label>
<p class="form-control-static" id="teksNama">Nurul Prima</p> <p class="form-control-static" id="teksNama"></p>
</div> </div>
<hr style="border-top: 1px solid #fff;"> <hr style="border-top: 1px solid #fff;">
<div class="form-group"> <div class="form-group">
<label for="teksNoHP" style="color: white; font-size: 1.1em;">No HP</label> <label for="teksNoHP" style="font-size: 1.1em;">No HP</label>
<p class="form-control-static" id="teksNoHP">+6282284964524</p> <p class="form-control-static" id="teksNoHP"></p>
</div> </div>
<hr style="border-top: 1px solid #fff;"> <hr style="border-top: 1px solid #fff;">
<div class="form-group"> <div class="form-group">
<label for="teksEmail" style="color: white; font-size: 1.1em;">Email</label> <label for="teksEmail" style="font-size: 1.1em;">Email</label>
<p class="form-control-static" id="teksEmail">npannisa@gmail.com</p> <p class="form-control-static" id="teksEmail"></p>
</div> </div>
<hr style="border-top: 1px solid #fff;"> <hr style="border-top: 1px solid #fff;">
<div class="form-group"> <div class="form-group">
<label for="teksAlamat" style="color: white; font-size: 1.1em;">Alamat</label> <label for="teksAlamat" style="font-size: 1.1em;">Alamat</label>
<p class="form-control-static" id="teksAlamat">Depok City</p> <p class="form-control-static" id="teksAlamat"></p>
</div> </div>
</div> </div>
</div> </div>

View File

@ -3,11 +3,11 @@
<div class="main-content"> <div class="main-content">
<section class="section"> <section class="section">
<div class="section-header"> <div class="section-header">
<h1>Detail</h1> <h1>Detail Refund</h1>
<div class="section-header-breadcrumb"> <div class="section-header-breadcrumb">
<div class="breadcrumb-item active"><a href="{{ route('admin.index') }}">Dashboard</a></div> <div class="breadcrumb-item active"><a href="{{ route('user.index') }}">Dashboard</a></div>
<div class="breadcrumb-item"><a href="{{ route('admin-refund.index') }}">Refund</a></div> <div class="breadcrumb-item"><a href="{{ route('user-refund.index') }}">Refund</a></div>
<div class="breadcrumb-item">Detail</div> <div class="breadcrumb-item">Detail refund</div>
</div> </div>
</div> </div>
<div class="col-md-12"> <div class="col-md-12">
@ -54,15 +54,6 @@
<div class="col-2"><strong>Alasan Komplain</strong></div> <div class="col-2"><strong>Alasan Komplain</strong></div>
<div class="col justified-text">{{ $refund->complaint }}</div> <div class="col justified-text">{{ $refund->complaint }}</div>
</div> </div>
@if ($refund)
<div class="d-flex justify-content-center mt-3">
<a href="#" data-toggle="modal" data-target="#ModalRefund"
class="btn btn-primary mx-1">Accept</a>
<a href="{{ route('admin-refund.index') }}" class="btn btn-danger mx-1">Decline</a>
</div>
@endif
</div> </div>
<br> <br>
</div> </div>
@ -70,5 +61,4 @@
</div> </div>
</section> </section>
</div> </div>
@include('admin.refund.modal-next-detail-refund')
@endsection @endsection

View File

@ -24,6 +24,8 @@
<th>Nama Barang</th> <th>Nama Barang</th>
<th>Penjual</th> <th>Penjual</th>
<th>Total</th> <th>Total</th>
<th>Tanggal Pengajuan</th>
<th>Batas Konfirmasi</th>
<th>Status</th> <th>Status</th>
<th>Aksi</th> <th>Aksi</th>
</tr> </tr>
@ -37,6 +39,8 @@
<td>{{ $refund->transaction->data_penjual->nama_depan }} <td>{{ $refund->transaction->data_penjual->nama_depan }}
</td> </td>
<td>{{ $refund->total }}</td> <td>{{ $refund->total }}</td>
<td>{{ $refund->created_at }}</td>
<td>{{ $refund->due_date }}</td>
<td><a href="#" data-toggle="modal" <td><a href="#" data-toggle="modal"
data-target="#modalKeteranganStatus" data-target="#modalKeteranganStatus"
class="badge {{ $refund->status == 'partial refund' ? 'badge-succes' : ($refund->status == 'pending' ? 'badge-warning' : 'badge-danger') }}">{{ ucwords($refund->status) }}</a> class="badge {{ $refund->status == 'partial refund' ? 'badge-succes' : ($refund->status == 'pending' ? 'badge-warning' : 'badge-danger') }}">{{ ucwords($refund->status) }}</a>

View File

@ -57,17 +57,17 @@
<td>{{ $transaction->updated_at }}</td> <td>{{ $transaction->updated_at }}</td>
<td><a href="#" data-toggle="modal" <td><a href="#" data-toggle="modal"
data-target="#modalKeteranganStatus" data-target="#modalKeteranganStatus"
class="badge {{ in_array($transaction->status, ['pending', 'created']) class="badge {{ in_array($transaction->status_transaksi, ['created'])
? 'badge-light' ? 'badge-light'
: (in_array($transaction->status, ['settlement', 'capture']) : (in_array($transaction->status_transaksi, ['success', 'challenge'])
? 'badge-info' ? 'badge-info'
: (in_array($transaction->status, ['process', 'sending', 'sended']) : (in_array($transaction->status_transaksi, ['process', 'sending', 'sent'])
? 'badge-warning' ? 'badge-warning'
: (in_array($transaction->status, ['cancel', 'expire', 'failure', 'refund']) : (in_array($transaction->status_transaksi, ['cancel', 'failure', 'refund'])
? 'badge-danger' ? 'badge-danger'
: ($transaction->status == 'finished' : ($transaction->status_transaksi == 'finished'
? 'badge-success' ? 'badge-success'
: '')))) }}">{{ ucwords($transaction->status) }}</a> : '')))) }}">{{ ucwords($transaction->status_transaksi) }}</a>
</td> </td>
<td> <td>
<div class="btn-group"> <div class="btn-group">
@ -79,11 +79,11 @@
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a class="dropdown-item" <li><a class="dropdown-item"
href="{{ route('user-transaction.detail.pembeli', $transaction->id) }}">Detail</a> href="{{ route('user-pembeli.show', $transaction->id) }}">Detail</a>
</li> </li>
{{-- di midtrans statusnya settlement --}} {{-- di midtrans statusnya settlement --}}
@if ($transaction->status == 'sended') @if ($transaction->status_transaksi == 'sent')
<li><a class="dropdown-item" data-toggle="modal" <li><a class="dropdown-item" data-toggle="modal"
data-target="#modalFinish" id="tracking" data-target="#modalFinish" id="tracking"
data-id="{{ $transaction->id }}" data-id="{{ $transaction->id }}"
@ -91,7 +91,7 @@
</li> </li>
@endif @endif
@if (in_array($transaction->status, ['pending', 'created'])) @if ($transaction->status_transaksi == 'created')
<li><a class="dropdown-item" id="bayar" <li><a class="dropdown-item" id="bayar"
data-id="{{ $transaction->id }}" data-id="{{ $transaction->id }}"
data-token="{{ $transaction->token }}" data-token="{{ $transaction->token }}"
@ -99,7 +99,7 @@
</li> </li>
@endif @endif
@if (in_array($transaction->status, ['pending', 'capture', 'created'])) @if (in_array($transaction->status_transaksi, ['created', 'challenge']))
<li><a href="#" data-id="{{ $transaction->id }}" <li><a href="#" data-id="{{ $transaction->id }}"
id="cancel" class="dropdown-item">Batal</a></li> id="cancel" class="dropdown-item">Batal</a></li>
@endif @endif
@ -126,16 +126,12 @@
</section> </section>
</div> </div>
<!-- Tambahkan elemen progress bar ke tampilan Anda (dengan awalnya disembunyikan) --> <!-- Tambahkan elemen progress bar ke tampilan Anda (dengan awalnya disembunyikan) -->
<div class="progress" style="display: none;">
<div class="progress-bar" role="progressbar" style="width: 0%;" aria-valuenow="0" aria-valuemin="0"
aria-valuemax="100"></div>
</div>
@extends('user.transaction.pembeli.modal-end-transaction') @extends('user.transaction.pembeli.modal-end-transaction')
@extends('user.transaction.pembeli.modal-tracking') @extends('user.transaction.pembeli.modal-tracking')
@extends('user.transaction.pembeli.modal-keterangan-status') @extends('user.transaction.pembeli.modal-keterangan-status')
<script type="text/javascript" src="https://app.sandbox.midtrans.com/snap/snap.js" <script type="text/javascript" src="https://app.sandbox.midtrans.com/snap/snap.js"
data-client-key="SB-Mid-client-rk6kY5XbPLChy3Lg"></script> data-client-key="SB-Mid-client-lEMALcmIPviksRRe"></script>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
// Bayar // Bayar
@ -144,8 +140,132 @@
const token = $(this).data('token'); const token = $(this).data('token');
const csrfToken = $('meta[name="csrf-token"]').attr('content'); const csrfToken = $('meta[name="csrf-token"]').attr('content');
snap.pay(token, { // snap.pay(token, {
onSuccess: function(result) { // onSuccess: function(result) {
// // $.ajaxSetup({
// // headers: {
// // 'X-CSRF-TOKEN': csrfToken
// // }
// // });
// // $.ajax({
// // url: "{{ route('user-pembeli.pay', ':id') }}"
// // .replace(':id', id),
// // type: "POST",
// // contentType: false,
// // processData: false,
// // success: function(response) {
// // Swal.fire({
// // title: response.status ? 'Berhasil' :
// // 'Gagal',
// // text: response.message,
// // icon: response.status ? 'success' :
// // 'error',
// // confirmButtonText: 'OK'
// // }).then(function() {
// // location.reload();
// // });
// // console.log(response);
// // },
// // error: function(error) {
// // Swal.fire({
// // title: 'Gagal',
// // text: 'Gagal mengupdate pembayaran ke database',
// // icon: 'error'
// // });
// // console.log(result);
// // }
// // });
// console.log(result);
// },
// onPending: function(result) {
// // $.ajaxSetup({
// // headers: {
// // 'X-CSRF-TOKEN': csrfToken
// // }
// // });
// // $.ajax({
// // url: "{{ route('user-pembeli.pay', ':id') }}"
// // .replace(':id', id),
// // type: "POST",
// // contentType: false,
// // processData: false,
// // success: function(response) {
// // Swal.fire({
// // title: 'Berhasil',
// // text: response.message,
// // icon: 'info',
// // confirmButtonText: 'OK'
// // });
// // console.log(response);
// // },
// // error: function(error) {
// // Swal.fire({
// // title: 'Gagal',
// // text: 'Gagal mengupdate pembayaran ke database',
// // icon: 'error'
// // });
// // console.log(error);
// // }
// // });
// console.log(result);
// },
// onError: function(result) {
// // $.ajaxSetup({
// // headers: {
// // 'X-CSRF-TOKEN': csrfToken
// // }
// // });
// // $.ajax({
// // url: "{{ route('user-pembeli.pay', ':id') }}"
// // .replace(':id', id),
// // type: "POST",
// // contentType: false,
// // processData: false,
// // success: function(response) {
// // Swal.fire({
// // title: 'Gagal',
// // text: response.message,
// // icon: 'error',
// // });
// // console.log(response);
// // },
// // error: function(error) {
// // Swal.fire({
// // title: 'Gagal',
// // text: 'Gagal mengupdate pembayaran ke database',
// // icon: 'error'
// // });
// // console.log(error);
// // }
// // });
// // Swal.fire({
// // title: 'Gagal',
// // text: 'Terjadi kesalahan karena ' + result,
// // icon: 'error'
// // });
// console.log(result);
// },
// onClose: function(error) {
// Swal.fire({
// title: 'Ditunda',
// text: 'Kamu menutup halaman pembayaran. Silahkan lakukan pembayaran nanti',
// icon: 'info'
// });
// console.log(error);
// }
// });
Swal.fire({
html: '<div class="mt-3"><lord-icon src="https://cdn.lordicon.com/etwtznjn.json" trigger="loop" colors="primary:#0ab39c,secondary:#405189" style="width:120px;height:120px"></lord-icon><div class="mt-4 pt-2 fs-15"><h4>Form Anda sedang diproses!</h4><p class="text-muted mx-4 mb-0">Mohon tunggu...</p></div></div>',
allowEscapeKey: false,
allowOutsideClick: false,
didOpen: () => {
Swal.showLoading();
}
});
$.ajaxSetup({ $.ajaxSetup({
headers: { headers: {
@ -154,111 +274,29 @@
}); });
$.ajax({ $.ajax({
url: "{{ route('user-pembeli.pay', ':id') }}" url: "{{ route('user-pembeli.pay') }}",
.replace(':id', id), type: 'PUT',
type: "POST", data: {
contentType: false, id: id,
processData: false, },
success: function(response) { success: function(response) {
Swal.fire({ Swal.fire({
title: response.status ? 'Berhasil' : title: response.status ? 'Berhasil' : 'Gagal',
'Gagal',
text: response.message, text: response.message,
icon: response.status ? 'success' : icon: response.status ? 'success' : 'error'
'error',
confirmButtonText: 'OK'
}).then(function() { }).then(function() {
if (response.status) {
location.reload(); location.reload();
}
}); });
console.log(response); console.log(response);
}, },
error: function(error) { error: function(error) {
Swal.fire({ Swal.fire({
title: 'Gagal', title: 'Gagal',
text: 'Gagal mengupdate pembayaran ke database', text: 'Pembayaran gagal',
icon: 'error' icon: 'error'
}); });
console.log(result);
}
});
console.log(result);
},
onPending: function(result) {
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': csrfToken
}
});
$.ajax({
url: "{{ route('user-pembeli.pay', ':id') }}"
.replace(':id', id),
type: "POST",
contentType: false,
processData: false,
success: function(response) {
Swal.fire({
title: 'Berhasil',
text: response.message,
icon: 'info',
confirmButtonText: 'OK'
});
console.log(response);
},
error: function(error) {
Swal.fire({
title: 'Gagal',
text: 'Gagal mengupdate pembayaran ke database',
icon: 'error'
});
console.log(error);
}
});
console.log(result);
},
onError: function(result) {
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': csrfToken
}
});
$.ajax({
url: "{{ route('user-pembeli.pay', ':id') }}"
.replace(':id', id),
type: "POST",
contentType: false,
processData: false,
success: function(response) {
Swal.fire({
title: 'Gagal',
text: response.message,
icon: 'error',
});
console.log(response);
},
error: function(error) {
Swal.fire({
title: 'Gagal',
text: 'Gagal mengupdate pembayaran ke database',
icon: 'error'
});
console.log(error);
}
});
Swal.fire({
title: 'Gagal',
text: 'Terjadi kesalahan karena ' + result,
icon: 'error'
});
console.log(result);
},
onClose: function(error) {
Swal.fire({
title: 'Ditunda',
text: 'Kamu menutup halaman pembayaran. Silahkan lakukan pembayaran nanti',
icon: 'info'
});
console.log(error); console.log(error);
} }
}); });
@ -276,7 +314,17 @@
confirmButtonText: 'Ya, batal', confirmButtonText: 'Ya, batal',
cancelButtonText: 'Tidak', cancelButtonText: 'Tidak',
}).then((result) => { }).then((result) => {
if (result.isConfirmed) { if (result.isConfirmed) {
Swal.fire({
html: '<div class="mt-3"><lord-icon src="https://cdn.lordicon.com/etwtznjn.json" trigger="loop" colors="primary:#0ab39c,secondary:#405189" style="width:120px;height:120px"></lord-icon><div class="mt-4 pt-2 fs-15"><h4>Form Anda sedang diproses!</h4><p class="text-muted mx-4 mb-0">Mohon tunggu...</p></div></div>',
allowEscapeKey: false,
allowOutsideClick: false,
didOpen: () => {
Swal.showLoading();
}
});
$.ajaxSetup({ $.ajaxSetup({
headers: { headers: {
'X-CSRF-TOKEN': csrfToken 'X-CSRF-TOKEN': csrfToken
@ -284,11 +332,11 @@
}); });
$.ajax({ $.ajax({
url: "{{ route('user-pembeli.cancel', ':id') }}" url: "{{ route('user-pembeli.cancel', ':id') }}",
.replace(':id', id), type: "PUT",
type: "POST", data: {
contentType: false, id: id
processData: false, },
success: function(response) { success: function(response) {
Swal.fire({ Swal.fire({
title: response.status ? 'Berhasil' : title: response.status ? 'Berhasil' :
@ -296,7 +344,9 @@
text: response.message, text: response.message,
icon: response.status ? 'success' : 'error' icon: response.status ? 'success' : 'error'
}).then(function() { }).then(function() {
if (response.status) {
location.reload(); location.reload();
}
}); });
console.log(response); console.log(response);
}, },

View File

@ -59,22 +59,24 @@
<label for="hargaBarang"> <label for="hargaBarang">
<h5>Harga Satuan</h5> <h5>Harga Satuan</h5>
</label> </label>
<input type="number" class="form-control" name="harga_barang" id="hargaBarang" <input type="text" class="form-control" name="harga_barang" id="hargaBarang"
placeholder="Rp. 1000.000"> placeholder="Rp. 1000.000"
oninput="this.value = this.value.replace(/[^0-9]/g, '').substring(0, 16);">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="hargaBarang"> <label for="hargaBarang">
<h5>Satuan</h5> <h5>Satuan</h5>
</label> </label>
<input type="text" class="form-control" name="satuan_barang" id="satuanBarang" <input type="text" class="form-control" name="satuan_barang" id="satuanBarang"
placeholder="Buah/Kg/Karung dll."> placeholder="Buah/Kg/Karung/Jutaan dll.">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="jumlahBarang"> <label for="jumlahBarang">
<h5>Jumlah Satuan</h5> <h5>Jumlah Satuan</h5>
</label> </label>
<input type="number" class="form-control" name="jumlah_barang" id="jumlahBarang" <input type="text" class="form-control" name="jumlah_barang" id="jumlahBarang"
placeholder="Jumlah satuan"> placeholder="Jumlah satuan"
oninput="this.value = this.value.replace(/[^0-9.]/g, '').substring(0, 10);">
</div> </div>
<div class="form-group"> <div class="form-group">
@ -117,12 +119,10 @@
</div> </div>
</section> </section>
</div> </div>
@extends('user.transaction.pembeli.modal-keterangan-status')
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
<script> <script>
var persentaseKeuntungan = {{ $persentase_keuntungan }}; var persentaseKeuntungan = {{ $persentase_keuntungan }};
</script> </script>
{{-- <script src="{{ asset('assets/js/user/new-transaction.js') }}"></script> --}}
<script> <script>
$(document).ready(function() { $(document).ready(function() {
let totalHarga = 0; let totalHarga = 0;
@ -305,6 +305,8 @@
}); });
$("#save").on("click", function() { $("#save").on("click", function() {
const csrfToken = $('meta[name="csrf-token"]').attr("content");
let opsiKontak = document.querySelector( let opsiKontak = document.querySelector(
'[name="select_penjual"]' '[name="select_penjual"]'
).value; ).value;
@ -367,22 +369,27 @@
confirmButtonText: "OK", confirmButtonText: "OK",
}); });
} else { } else {
const csrfToken = $('meta[name="csrf-token"]').attr("content"); Swal.fire({
html: '<div class="mt-3"><lord-icon src="https://cdn.lordicon.com/etwtznjn.json" trigger="loop" colors="primary:#0ab39c,secondary:#405189" style="width:120px;height:120px"></lord-icon><div class="mt-4 pt-2 fs-15"><h4>Form Anda sedang diproses!</h4><p class="text-muted mx-4 mb-0">Mohon tunggu...</p></div></div>',
allowEscapeKey: false,
allowOutsideClick: false,
didOpen: () => {
Swal.showLoading();
}
});
const formData = new FormData(); const formData = new FormData();
formData.append("email_penjual", penjual); formData.append("email_penjual", penjual);
formData.append("nama_barang", namaBarang); formData.append("nama_barang", namaBarang);
formData.append("satuan_barang", satuanBarang); formData.append("satuan_barang", satuanBarang);
formData.append("harga_barang", hargaBarang); formData.append("harga_barang", hargaBarang);
formData.append("jumlah_barang", jumlahBarang); formData.append("jumlah_barang", jumlahBarang);
// formData.append('batas_pengiriman', batasPengiriman);
formData.append("deskripsi", deskripsi); formData.append("deskripsi", deskripsi);
formData.append("persentase_keuntungan", biayaAdmin); formData.append("persentase_keuntungan", biayaAdmin);
formData.append("total_keuntungan", totalBiayaAdmin); formData.append("total_keuntungan", totalBiayaAdmin);
formData.append("total_harga", totalHarga); formData.append("total_harga", totalHarga);
formData.append("total_bayar", totalBayar); formData.append("total_bayar", totalBayar);
$(modal).modal("show");
$.ajaxSetup({ $.ajaxSetup({
headers: { headers: {
"X-CSRF-TOKEN": csrfToken, "X-CSRF-TOKEN": csrfToken,
@ -396,20 +403,20 @@
processData: false, processData: false,
contentType: false, contentType: false,
success: function(response) { success: function(response) {
$(modal).modal("hide");
Swal.fire({ Swal.fire({
title: response.status ? "Berhasil" : "Gagal", title: response.status ? "Berhasil" : "Gagal",
text: response.message, text: response.message,
icon: response.status ? "success" : "error", icon: response.status ? "success" : "error",
confirmButtonText: "OK", confirmButtonText: "OK",
}).then(function() { }).then(function() {
if (response.status) {
location.href = location.href =
"{{ route('user-pembeli.index') }}"; "{{ route('user-pembeli.index') }}";
}
}); });
console.log(response); console.log(response);
}, },
error: function(error) { error: function(error) {
$(modal).modal("hide");
Swal.fire({ Swal.fire({
title: "Gagal", title: "Gagal",
text: "Gagal mengirimkan data karena " + error, text: "Gagal mengirimkan data karena " + error,

View File

@ -51,17 +51,17 @@
<td>{{ $transaction->updated_at }}</td> <td>{{ $transaction->updated_at }}</td>
<td><a href="#" data-toggle="modal" <td><a href="#" data-toggle="modal"
data-target="#modalKeteranganStatus" data-target="#modalKeteranganStatus"
class="badge {{ in_array($transaction->status, ['pending', 'created']) class="badge {{ in_array($transaction->status_transaksi, ['created'])
? 'badge-light' ? 'badge-light'
: (in_array($transaction->status, ['settlement', 'capture']) : (in_array($transaction->status_transaksi, ['success', 'challenge'])
? 'badge-info' ? 'badge-info'
: (in_array($transaction->status, ['process', 'sending', 'sended']) : (in_array($transaction->status_transaksi, ['process', 'sending', 'sent'])
? 'badge-warning' ? 'badge-warning'
: (in_array($transaction->status, ['cancel', 'expire', 'failure', 'refund']) : (in_array($transaction->status_transaksi, ['cancel', 'failure', 'refund'])
? 'badge-danger' ? 'badge-danger'
: ($transaction->status == 'finished' : ($transaction->status_transaksi == 'finished'
? 'badge-success' ? 'badge-success'
: '')))) }}">{{ ucwords($transaction->status) }}</a> : '')))) }}">{{ ucwords($transaction->status_transaksi) }}</a>
</td> </td>
<td> <td>
<div class="btn-group"> <div class="btn-group">
@ -81,25 +81,34 @@
</li> </li>
@endif @endif
{{-- Setelah dibayar --}} {{-- Setelah dibayar --}}
@if (in_array($transaction->status, ['settlement', 'capture'])) @if ($transaction->status_transaksi == 'success')
<li><a class="dropdown-item" href="#">Proses <li><a class="dropdown-item" href="#"
id="processTransaction"
data-id="{{ $transaction->id }}">Proses
Transaksi</a> Transaksi</a>
</li> </li>
@endif @endif
{{-- Pengiriman barang --}} {{-- Pengiriman barang --}}
@if ($transaction->status == 'process') @if ($transaction->status_transaksi == 'process')
<li><a class="dropdown-item" href="#">Kirim <li><a class="dropdown-item" href="#"
id="sendOrder"
data-id="{{ $transaction->id }}">Kirim
Barang</a> Barang</a>
</li> </li>
@endif @endif
@if ($transaction->status == 'sending') @if ($transaction->status_transaksi == 'sending')
<li><a class="dropdown-item" href="#">Barang sudah <li><a class="dropdown-item" href="#"
data-toggle="modal"
data-target="#modalOrderSent" id="sentOrder"
data-id="{{ $transaction->id }}">Barang sudah
sampai</a> sampai</a>
</li> </li>
@endif @endif
@if ($transaction->status == 'finished') @if ($transaction->status_transaksi == 'finished')
<li><a class="dropdown-item" href="#">Transaksi <li><a class="dropdown-item" href="#"
Selesai</a> id="acceptResult"
data-id="{{ $transaction->id }}">Terima
Uang</a>
</li> </li>
@endif @endif
</ul> </ul>
@ -119,6 +128,7 @@
</section> </section>
</div> </div>
@extends('user.transaction.penjual.modal-tracking') @extends('user.transaction.penjual.modal-tracking')
@extends('user.transaction.penjual.modal-pengiriman-selesai')
@extends('user.transaction.penjual.modal-keterangan-status') @extends('user.transaction.penjual.modal-keterangan-status')
<script> <script>
$(document).ready(function() { $(document).ready(function() {
@ -169,6 +179,53 @@
var modal = $(this); var modal = $(this);
modal.find('.activities').html(activitiesHtml); modal.find('.activities').html(activitiesHtml);
}); });
$('#table-3').on('click', '#processTransaction', function() {
const id = $(this).data('id');
const csrfToken = $('meta[name="csrf-token"]').attr('content');
Swal.fire({
html: '<div class="mt-3"><lord-icon src="https://cdn.lordicon.com/etwtznjn.json" trigger="loop" colors="primary:#0ab39c,secondary:#405189" style="width:120px;height:120px"></lord-icon><div class="mt-4 pt-2 fs-15"><h4>Form Anda sedang diproses!</h4><p class="text-muted mx-4 mb-0">Mohon tunggu...</p></div></div>',
allowEscapeKey: false,
allowOutsideClick: false,
didOpen: () => {
Swal.showLoading();
}
});
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': csrfToken
}
});
$.ajax({
url: "{{ route('user-penjual.accept') }}",
type: 'PUT',
data: {
id: id,
},
success: function(response) {
Swal.fire({
title: response.status ? 'Berhasil' : 'Gagal',
text: response.message,
icon: response.status ? 'success' : 'error',
}).then((result) => {
Swal.close();
if (result.isConfirmed) {
location.reload();
}
});
},
error: function(error) {
Swal.fire({
title: 'Gagal',
text: 'Pemrosesan transaksi gagal',
icon: 'error'
});
}
});
});
}); });
</script> </script>
@endsection @endsection

View File

@ -0,0 +1,25 @@
<!-- Modal -->
<div class="modal fade" id="modalTracking" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle"
aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h2 class="modal-title" id="exampleModalLongTitle">Tracking Information</h2>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="section-body">
<div class="row">
<div class="col-12">
<div class="activities">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -8,7 +8,7 @@
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
{{-- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/js/bootstrap.bundle.min.js" {{-- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/js/bootstrap.bundle.min.js"
integrity="sha384-u1OknCvxWvY5kfmNBILK2hRnQC3Pr17a+RTT6rIHI7NnikvbZlHgTPOOmMi466C8" crossorigin="anonymous"> --}} integrity="sha384-u1OknCvxWvY5kfmNBILK2hRnQC3Pr17a+RTT6rIHI7NnikvbZlHgTPOOmMi466C8" crossorigin="anonymous"> --}}
</script> {{-- </script> --}}
{{-- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script> --}} {{-- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script> --}}
<script src="{{ asset('assets/modules/popper.js') }}"></script> <script src="{{ asset('assets/modules/popper.js') }}"></script>
<script src="{{ asset('assets/modules/bootstrap/js/bootstrap.min.js') }}"></script> <script src="{{ asset('assets/modules/bootstrap/js/bootstrap.min.js') }}"></script>

View File

@ -93,12 +93,12 @@
<div class="row"> <div class="row">
<div class="col-lg-3 col-md-4 label">Nama Bank/e-Wallet Tujuan</div> <div class="col-lg-3 col-md-4 label">Nama Bank/e-Wallet Tujuan</div>
<div class="col-lg-9 col-md-8">Dana</div> <div class="col-lg-9 col-md-8">{{ auth()->user()->nama_bank }}</div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-lg-3 col-md-4 label">Nomor Rekening/e-Wallet Tujuan</div> <div class="col-lg-3 col-md-4 label">Nomor Rekening/e-Wallet Tujuan</div>
<div class="col-lg-9 col-md-8">088376473</div> <div class="col-lg-9 col-md-8">{{ auth()->user()->no_rek }}</div>
</div> </div>
</div> </div>

View File

@ -153,17 +153,18 @@ Route::middleware(['auth'])->group(function(){
Route::get('user-pembeli/tambah-transaksi','create')->name('user-pembeli.create'); Route::get('user-pembeli/tambah-transaksi','create')->name('user-pembeli.create');
Route::get('user-pembeli/invoice/{id}','invoice')->name('user-pembeli.invoice'); Route::get('user-pembeli/invoice/{id}','invoice')->name('user-pembeli.invoice');
Route::post('user-pembeli','store')->name('user-pembeli.store'); Route::post('user-pembeli','store')->name('user-pembeli.store');
Route::put('user-pembeli/bayar-transaksi/{id}','payTransaction')->name('user-pembeli.pay'); Route::put('user-pembeli/bayar-transaksi','payTransaction')->name('user-pembeli.pay');
Route::put('user-pembeli/batal-transaksi/{id}','cancelTransaction')->name('user-pembeli.cancel'); Route::put('user-pembeli/batal-transaksi','cancelTransaction')->name('user-pembeli.cancel');
Route::put('user-pembeli/transaksi-selesai/{id}','finishTransaction')->name('user-pembeli.finish'); Route::put('user-pembeli/transaksi-selesai','finishTransaction')->name('user-pembeli.finish');
Route::put('user-pembeli/transaksi-komplain/{id}','complaintTransaction')->name('user-pembeli.complain'); Route::put('user-pembeli/transaksi-komplain/{id}','complaintTransaction')->name('user-pembeli.complain');
//Penjual //Penjual
Route::get('user-penjual','indexPenjual')->name('user-penjual.index'); Route::get('user-penjual','indexPenjual')->name('user-penjual.index');
Route::get('user-penjual/detail-transaksi/{id}','show')->name('user-penjual.show'); Route::get('user-penjual/detail-transaksi/{id}','show')->name('user-penjual.show');
Route::put('user-penjual/terima-transaksi/{id}','acceptTransaction')->name('user-penjual.accept'); Route::get('user-penjual/tolak-transaksi','denyTransaction')->name('user-penjual.deny');
Route::put('user-penjual/kirim-pesanan/{id}','sendingOrder')->name('user-penjual.sending'); Route::put('user-penjual/terima-transaksi','acceptTransaction')->name('user-penjual.accept');
Route::put('user-penjual/selesai-kirim-pesanan/{id}','sentOrder')->name('user-penjual.sent'); Route::put('user-penjual/kirim-pesanan','sendingOrder')->name('user-penjual.sending');
Route::put('user-penjual/selesai-kirim-pesanan','sentOrder')->name('user-penjual.sent');
}); });
// Tampilan refund // Tampilan refund