Merge branch 'master' of https://git.abbauf.com/MAGANG_TB_dan_PNP_2023/Aplikasi_Rekber into oktaaa
This commit is contained in:
commit
b93a3be3fc
@ -13,6 +13,7 @@ use Illuminate\Support\Facades\Log;
|
|||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\TransactionDescription;
|
use App\Models\TransactionDescription;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Support\Facades\Http;
|
||||||
|
|
||||||
class AdminRefundController extends Controller
|
class AdminRefundController extends Controller
|
||||||
{
|
{
|
||||||
@ -50,45 +51,66 @@ class AdminRefundController extends Controller
|
|||||||
'reason' => $refund->complaint,
|
'reason' => $refund->complaint,
|
||||||
];
|
];
|
||||||
|
|
||||||
// $refundMidtrans = Trans::refund($request->id, $params);
|
$auth = base64_encode(env('MIDTRANS_SERVER_KEY'));
|
||||||
|
|
||||||
try {
|
$response = Http::withOptions([
|
||||||
Transaction::where('id', $refund->transaction_id)->update([
|
'verify' => false,
|
||||||
'status_transaksi' => 'refund',
|
])
|
||||||
'status_pembayaran' => 'refund',
|
->withHeaders([
|
||||||
]);
|
'Content-Type' => 'application/json',
|
||||||
|
'Authorization' => "Basic $auth",
|
||||||
|
])
|
||||||
|
->post('https://api.sandbox.midtrans.com/v2/'.$request->id.'/refund', $params);
|
||||||
|
|
||||||
Refund::where('id', $request->id)->update([
|
$result = json_decode($response->body(), true);
|
||||||
'status' => 'refund',
|
$code = $result['status_code'];
|
||||||
]);
|
|
||||||
|
|
||||||
TransactionDescription::create([
|
if($code == '200'){
|
||||||
'transaction_id' => $refund->transaction_id,
|
try {
|
||||||
'status' => 'refund',
|
Transaction::where('id', $refund->transaction_id)->update([
|
||||||
'user' => auth()->user()->email,
|
'status_transaksi' => 'refund',
|
||||||
'judul' => 'fas fa-long-arrow-alt-left',
|
'status_pembayaran' => 'refund',
|
||||||
'background' => 'bg-primary',
|
]);
|
||||||
'deskripsi' => 'Admin telah menyetujui refund.',
|
|
||||||
]);
|
|
||||||
|
|
||||||
DB::commit();
|
Refund::where('id', $request->id)->update([
|
||||||
|
'status' => 'refund',
|
||||||
|
]);
|
||||||
|
|
||||||
return response()->json([
|
TransactionDescription::create([
|
||||||
'status' => true,
|
'transaction_id' => $refund->transaction_id,
|
||||||
'message' => 'Refund berhasil dilakukan. Uang akan dikembalikan ke pembeli.',
|
'status' => 'refund',
|
||||||
// 'refundMidtrans' => $refundMidtrans,
|
'user' => auth()->user()->email,
|
||||||
]);
|
'judul' => 'fas fa-long-arrow-alt-left',
|
||||||
} catch (Throwable $e) {
|
'background' => 'bg-primary',
|
||||||
DB::rollBack();
|
'deskripsi' => 'Admin telah menyetujui refund.',
|
||||||
|
]);
|
||||||
|
|
||||||
Log::error($e->getMessage());
|
DB::commit();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => true,
|
||||||
|
'message' => 'Refund berhasil dilakukan. Uang akan dikembalikan ke pembeli.',
|
||||||
|
]);
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
|
||||||
|
Log::error($e->getMessage());
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Refund gagal dilakukan',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
Log::error($result['status_message']);
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status' => false,
|
'status' => false,
|
||||||
'message' => 'Refund gagal dilakukan',
|
'message' => 'Refund gagal dilakukan',
|
||||||
// 'refundMidtrans' => $refundMidtrans
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function denyRefund(Request $request)
|
public function denyRefund(Request $request)
|
||||||
@ -144,12 +166,12 @@ class AdminRefundController extends Controller
|
|||||||
if ($request->has('search') && !empty($request->search['value'])) {
|
if ($request->has('search') && !empty($request->search['value'])) {
|
||||||
$searchRefund = $request->search['value'];
|
$searchRefund = $request->search['value'];
|
||||||
if (!is_numeric($searchRefund)) {
|
if (!is_numeric($searchRefund)) {
|
||||||
$subQuery->where(function ($a) use ($searchRefund) {
|
$subQuery->where(function ($a) use ($searchRefund) {
|
||||||
$a->whereRaw("LOWER(CONCAT(b.nama_depan,' ',b.nama_belakang)) LIKE ?", ['%' . strtolower($searchRefund) . '%'])
|
$a->whereRaw("LOWER(CONCAT(b.nama_depan,' ',b.nama_belakang)) LIKE ?", ['%' . strtolower($searchRefund) . '%'])
|
||||||
->orWhereRaw("LOWER(CONCAT(s.nama_depan,' ',s.nama_belakang)) LIKE ?", ['%' . strtolower($searchRefund) . '%'])
|
->orWhereRaw("LOWER(CONCAT(s.nama_depan,' ',s.nama_belakang)) LIKE ?", ['%' . strtolower($searchRefund) . '%'])
|
||||||
->orWhereRaw('LOWER(transactions.nama_barang) LIKE ?', ['%' . strtolower($searchRefund) . '%'])
|
->orWhereRaw('LOWER(transactions.nama_barang) LIKE ?', ['%' . strtolower($searchRefund) . '%'])
|
||||||
->orWhereRaw('LOWER(refunds.status) LIKE ?', ['%' . strtolower($searchRefund) . '%']);
|
->orWhereRaw('LOWER(refunds.status) LIKE ?', ['%' . strtolower($searchRefund) . '%']);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$subQuery->where(function ($a) use ($searchRefund) {
|
$subQuery->where(function ($a) use ($searchRefund) {
|
||||||
$a->whereDay('refunds.created_at', '=', $searchRefund)
|
$a->whereDay('refunds.created_at', '=', $searchRefund)
|
||||||
|
@ -8,6 +8,7 @@ use App\Models\TransactionDescription;
|
|||||||
use App\Models\TransactionUser;
|
use App\Models\TransactionUser;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
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 Throwable;
|
use Throwable;
|
||||||
use Yajra\DataTables\DataTables;
|
use Yajra\DataTables\DataTables;
|
||||||
@ -19,9 +20,7 @@ class AdminTransactionController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
return view('admin.transaction.index', [
|
return view('admin.transaction.index');
|
||||||
'transactions' => Transaction::latest()->get(),
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,35 +38,56 @@ class AdminTransactionController extends Controller
|
|||||||
|
|
||||||
public function approveTransaction(Request $request)
|
public function approveTransaction(Request $request)
|
||||||
{
|
{
|
||||||
try {
|
$auth = base64_encode(env('MIDTRANS_SERVER_KEY'));
|
||||||
DB::beginTransaction();
|
|
||||||
|
|
||||||
Transaction::where('id', $request->id)->update([
|
$response = Http::withOptions([
|
||||||
'status_transaksi' => 'success',
|
'verify' => false,
|
||||||
'status_pembayaran' => 'settlement',
|
])
|
||||||
'fraud_status' => 'accept'
|
->withHeaders([
|
||||||
]);
|
'Content-Type' => 'application/json',
|
||||||
|
'Authorization' => "Basic $auth",
|
||||||
|
])
|
||||||
|
->post('https://api.sandbox.midtrans.com/v2/'.$request->id.'/approve');
|
||||||
|
|
||||||
TransactionDescription::create([
|
$result = json_decode($response->body(), true);
|
||||||
'transaction_id' => $request->id,
|
$code = $result['status_code'];
|
||||||
'status' => 'success',
|
|
||||||
'user' => auth()->user()->email,
|
|
||||||
'judul' => 'fa fa-check',
|
|
||||||
'background' => 'bg-primary',
|
|
||||||
'deskripsi' => 'Admin telah menerima pembayaran transaksi dan dilanjutkan ke penjual.',
|
|
||||||
]);
|
|
||||||
|
|
||||||
DB::commit();
|
if($code == '200'){
|
||||||
|
try {
|
||||||
|
DB::beginTransaction();
|
||||||
|
|
||||||
return response()->json([
|
Transaction::where('id', $request->id)->update([
|
||||||
'status' => true,
|
'status_transaksi' => 'success',
|
||||||
'message' => 'Transaksi telah diterima.'
|
'status_pembayaran' => 'settlement',
|
||||||
]);
|
'fraud_status' => 'accept'
|
||||||
} catch (Throwable $e) {
|
]);
|
||||||
DB::rollBack();
|
|
||||||
|
|
||||||
Log::error($e->getMessage());
|
TransactionDescription::create([
|
||||||
|
'transaction_id' => $request->id,
|
||||||
|
'status' => 'success',
|
||||||
|
'user' => auth()->user()->email,
|
||||||
|
'judul' => 'fa fa-check',
|
||||||
|
'background' => 'bg-primary',
|
||||||
|
'deskripsi' => 'Admin telah menerima pembayaran transaksi dan dilanjutkan ke penjual.',
|
||||||
|
]);
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => true,
|
||||||
|
'message' => 'Transaksi telah diterima.'
|
||||||
|
]);
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
|
||||||
|
Log::error($e->getMessage());
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Terjadi kesalahan di bagian server.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status' => false,
|
'status' => false,
|
||||||
'message' => 'Terjadi kesalahan di bagian server.',
|
'message' => 'Terjadi kesalahan di bagian server.',
|
||||||
@ -77,35 +97,56 @@ class AdminTransactionController extends Controller
|
|||||||
|
|
||||||
public function denyTransaction(Request $request)
|
public function denyTransaction(Request $request)
|
||||||
{
|
{
|
||||||
try {
|
$auth = base64_encode(env('MIDTRANS_SERVER_KEY'));
|
||||||
DB::beginTransaction();
|
|
||||||
|
|
||||||
Transaction::where('id', $request->id)->update([
|
$response = Http::withOptions([
|
||||||
'status_transaksi' => 'failure',
|
'verify' => false,
|
||||||
'status_pembayaran' => 'failure',
|
])
|
||||||
'fraud_status' => 'deny'
|
->withHeaders([
|
||||||
]);
|
'Content-Type' => 'application/json',
|
||||||
|
'Authorization' => "Basic $auth",
|
||||||
|
])
|
||||||
|
->post('https://api.sandbox.midtrans.com/v2/'.$request->id.'/deny');
|
||||||
|
|
||||||
TransactionDescription::create([
|
$result = json_decode($response->body(), true);
|
||||||
'transaction_id' => $request->id,
|
$code = $result['status_code'];
|
||||||
'status' => 'failure',
|
|
||||||
'user' => auth()->user()->email,
|
|
||||||
'judul' => 'fa fa-times',
|
|
||||||
'background' => 'bg-primary',
|
|
||||||
'deskripsi' => 'Admin telah menolak pembayaran karena terindikasi penipuan.',
|
|
||||||
]);
|
|
||||||
|
|
||||||
DB::commit();
|
if($code == '200'){
|
||||||
|
try {
|
||||||
|
DB::beginTransaction();
|
||||||
|
|
||||||
return response()->json([
|
Transaction::where('id', $request->id)->update([
|
||||||
'status' => true,
|
'status_transaksi' => 'failure',
|
||||||
'message' => 'Transaksi telah ditolak.'
|
'status_pembayaran' => 'failure',
|
||||||
]);
|
'fraud_status' => 'deny'
|
||||||
} catch (Throwable $e) {
|
]);
|
||||||
DB::rollBack();
|
|
||||||
|
|
||||||
Log::error($e->getMessage());
|
TransactionDescription::create([
|
||||||
|
'transaction_id' => $request->id,
|
||||||
|
'status' => 'failure',
|
||||||
|
'user' => auth()->user()->email,
|
||||||
|
'judul' => 'fa fa-times',
|
||||||
|
'background' => 'bg-primary',
|
||||||
|
'deskripsi' => 'Admin telah menolak pembayaran karena terindikasi penipuan.',
|
||||||
|
]);
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => true,
|
||||||
|
'message' => 'Transaksi telah ditolak.'
|
||||||
|
]);
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
|
||||||
|
Log::error($e->getMessage());
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Terjadi kesalahan di bagian server.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status' => false,
|
'status' => false,
|
||||||
'message' => 'Terjadi kesalahan di bagian server.',
|
'message' => 'Terjadi kesalahan di bagian server.',
|
||||||
|
@ -52,37 +52,46 @@ class AdminUserController extends Controller
|
|||||||
|
|
||||||
public function approveUser(Request $request)
|
public function approveUser(Request $request)
|
||||||
{
|
{
|
||||||
$user = User::findOrFail($request->id);
|
try{
|
||||||
$user->status = 'Finished';
|
DB::beginTransaction();
|
||||||
$result = $user->save();
|
|
||||||
if ($result) {
|
User::where('id', $request->id)->update([
|
||||||
|
'status' => 'Finished'
|
||||||
|
]);
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'message' => 'Akun telah disetujui dan dapat digunakan',
|
'message' => 'Akun telah disetujui dan dapat digunakan',
|
||||||
'status' => true,
|
'status' => true,
|
||||||
]);
|
]);
|
||||||
} else {
|
}catch(Throwable $e){
|
||||||
return response()->json([
|
Log::error($e->getMessage());
|
||||||
'message' => 'Akun gagal disetujui karena ' + $result,
|
|
||||||
'status' => false,
|
return response()->json(['success' => false, 'message' => 'Terjadi Kesalahan pada sisi server']);
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function denyUser(Request $request)
|
public function denyUser(Request $request)
|
||||||
{
|
{
|
||||||
$user = User::findOrFail($request->id);
|
try{
|
||||||
$user->status = 'Rejected';
|
DB::beginTransaction();
|
||||||
$result = $user->save();
|
|
||||||
if ($result) {
|
User::where('id', $request->id)->update([
|
||||||
|
'status' => 'Rejected'
|
||||||
|
]);
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'message' => 'Akun telah ditolak dan tidak dapat digunakan',
|
'message' => 'Akun telah ditolak dan tidak dapat digunakan',
|
||||||
'status' => true,
|
'status' => true,
|
||||||
]);
|
]);
|
||||||
} else {
|
|
||||||
return response()->json([
|
}catch(Throwable $e){
|
||||||
'message' => 'Akun gagal ditolak karena ' + $result,
|
Log::error($e->getMessage());
|
||||||
'status' => false,
|
|
||||||
]);
|
return response()->json(['success' => false, 'message' => 'Terjadi Kesalahan pada sisi server']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,8 +4,7 @@ namespace App\Http\Controllers\Invoice;
|
|||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\Transaction;
|
use App\Models\Transaction;
|
||||||
use App\Models\TransactionDescription;
|
use Barryvdh\DomPDF\Facade\Pdf;
|
||||||
use App\Models\TransactionUser;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class InvoiceController extends Controller
|
class InvoiceController extends Controller
|
||||||
@ -13,12 +12,17 @@ class InvoiceController extends Controller
|
|||||||
public function getInvoice($id)
|
public function getInvoice($id)
|
||||||
{
|
{
|
||||||
return view('invoice.invoice-transaction', [
|
return view('invoice.invoice-transaction', [
|
||||||
'TransactionUser' => TransactionUser::HistoryTransaction(),
|
'transaction' => Transaction::findOrFail($id),
|
||||||
// 'transaction' => Transaction::findOrFail($id),
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function exportInvoice(Request $request)
|
public function exportInvoice(Request $request)
|
||||||
{
|
{
|
||||||
|
// $transaction = Transaction::findOrFail($request->id);
|
||||||
|
// $pdf = Pdf::loadView('invoice.export-invoice',compact('transaction'))->setPaper('A4','Portrait');
|
||||||
|
// return $pdf->download("invoice-$request->id.pdf");
|
||||||
|
return view('invoice.export-invoice', [
|
||||||
|
'transaction' => Transaction::findOrFail($request->id),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ namespace App\Http\Controllers\Login;
|
|||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Mail\verificationMail;
|
use App\Mail\verificationMail;
|
||||||
|
use App\Models\Transaction;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
@ -240,7 +241,7 @@ class LoginController extends Controller
|
|||||||
|
|
||||||
$password = Hash::make($new_password);
|
$password = Hash::make($new_password);
|
||||||
|
|
||||||
$result = User::create([
|
User::create([
|
||||||
'nama_depan' => $nama_depan,
|
'nama_depan' => $nama_depan,
|
||||||
'nama_belakang' => $nama_belakang,
|
'nama_belakang' => $nama_belakang,
|
||||||
'tanggal_lahir' => $tanggal_lahir,
|
'tanggal_lahir' => $tanggal_lahir,
|
||||||
@ -405,4 +406,18 @@ class LoginController extends Controller
|
|||||||
}
|
}
|
||||||
//OCR
|
//OCR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function email(){
|
||||||
|
$verificationEmail = [
|
||||||
|
'email' => 'Halo',
|
||||||
|
'code' => 'kode'
|
||||||
|
];
|
||||||
|
return view('email.verification-email',compact('verificationEmail'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function invoice(){
|
||||||
|
return view('invoice.export-invoice', [
|
||||||
|
'transaction' => Transaction::findOrFail('80d9b19b-ba17-4aea-8cad-c3b4661d33bc'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,65 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use App\Models\RefundDescription;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
|
|
||||||
class RefundDescriptionController extends Controller
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Display a listing of the resource.
|
|
||||||
*/
|
|
||||||
public function index()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the form for creating a new resource.
|
|
||||||
*/
|
|
||||||
public function create()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Store a newly created resource in storage.
|
|
||||||
*/
|
|
||||||
public function store(Request $request)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Display the specified resource.
|
|
||||||
*/
|
|
||||||
public function show(RefundDescription $refundDescription)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the form for editing the specified resource.
|
|
||||||
*/
|
|
||||||
public function edit(RefundDescription $refundDescription)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the specified resource in storage.
|
|
||||||
*/
|
|
||||||
public function update(Request $request, RefundDescription $refundDescription)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove the specified resource from storage.
|
|
||||||
*/
|
|
||||||
public function destroy(RefundDescription $refundDescription)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,65 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use App\Models\TransactionDescription;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
|
|
||||||
class TransactionDescriptionController extends Controller
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Display a listing of the resource.
|
|
||||||
*/
|
|
||||||
public function index()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the form for creating a new resource.
|
|
||||||
*/
|
|
||||||
public function create()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Store a newly created resource in storage.
|
|
||||||
*/
|
|
||||||
public function store(Request $request)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Display the specified resource.
|
|
||||||
*/
|
|
||||||
public function show(TransactionDescription $transactionDescription)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the form for editing the specified resource.
|
|
||||||
*/
|
|
||||||
public function edit(TransactionDescription $transactionDescription)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the specified resource in storage.
|
|
||||||
*/
|
|
||||||
public function update(Request $request, TransactionDescription $transactionDescription)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove the specified resource from storage.
|
|
||||||
*/
|
|
||||||
public function destroy(TransactionDescription $transactionDescription)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
|
756
app/Http/Controllers/User/PembeliController.php
Normal file
756
app/Http/Controllers/User/PembeliController.php
Normal file
@ -0,0 +1,756 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\User;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Contact;
|
||||||
|
use App\Models\Setting;
|
||||||
|
use App\Models\Transaction;
|
||||||
|
use App\Models\TransactionDescription;
|
||||||
|
use App\Models\User;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use GuzzleHttp\Client;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Http;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use Throwable;
|
||||||
|
use Yajra\DataTables\DataTables;
|
||||||
|
|
||||||
|
class PembeliController extends Controller
|
||||||
|
{
|
||||||
|
public function indexPembeli()
|
||||||
|
{
|
||||||
|
return view('user.transaction.pembeli.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
$now = Carbon::now();
|
||||||
|
$bulan = $now->format('F');
|
||||||
|
$tahun = $now->year;
|
||||||
|
$persentase_keuntungan = Setting::where('status', 'Active')
|
||||||
|
->where('bulan', '=', $bulan)
|
||||||
|
->where('tahun', '=', $tahun)
|
||||||
|
->value('persentase');
|
||||||
|
if (is_null($persentase_keuntungan)) {
|
||||||
|
$persentase_keuntungan = Setting::where('status', 'Active')
|
||||||
|
->latest()
|
||||||
|
->value('persentase');
|
||||||
|
}
|
||||||
|
return view('user.transaction.pembeli.new-transaction', [
|
||||||
|
'persentase_keuntungan' => $persentase_keuntungan,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$pembeli = auth()->user()->email;
|
||||||
|
$penjual = $request->email_penjual;
|
||||||
|
$nama_barang = $request->nama_barang;
|
||||||
|
$satuan_barang = $request->satuan_barang;
|
||||||
|
$deskripsi_transaksi = $request->deskripsi;
|
||||||
|
$harga_barang = $request->harga_barang;
|
||||||
|
$jumlah_barang = $request->jumlah_barang;
|
||||||
|
|
||||||
|
$nama_depan_pembeli = auth()->user()->nama_depan;
|
||||||
|
$nama_belakang_pembeli = auth()->user()->nama_belakang;
|
||||||
|
$nohp_pembeli = auth()->user()->nohp;
|
||||||
|
$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));
|
||||||
|
|
||||||
|
$now = Carbon::now();
|
||||||
|
|
||||||
|
$persentase_keuntungan = $request->persentase_keuntungan;
|
||||||
|
|
||||||
|
$total_harga = $request->total_harga;
|
||||||
|
$total_keuntungan = $request->total_keuntungan;
|
||||||
|
$total_bayar = $request->total_bayar;
|
||||||
|
|
||||||
|
$batas_pembayaran = $now->addDays(1)->toTimeString();
|
||||||
|
$batas_konfirmasi_transaksi = $now->addDays(2)->toDateTimeString();
|
||||||
|
$batas_pengiriman_barang_awal = $now->addDays(3)->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 = [
|
||||||
|
'transaction_details' => [
|
||||||
|
'order_id' => $query->id,
|
||||||
|
'gross_amount' => $total_bayar,
|
||||||
|
],
|
||||||
|
'item_details' => [
|
||||||
|
[
|
||||||
|
'id' => $nama_barang . time(),
|
||||||
|
'price' => $harga_barang,
|
||||||
|
'quantity' => $jumlah_barang,
|
||||||
|
'name' => $nama_barang,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'id' => 'BA01',
|
||||||
|
'price' => $total_keuntungan,
|
||||||
|
'quantity' => 1,
|
||||||
|
'name' => 'Biaya Admin',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'customer_details' => [
|
||||||
|
'firts_name' => $nama_depan_pembeli,
|
||||||
|
'last_name' => $nama_belakang_pembeli,
|
||||||
|
'email' => $pembeli,
|
||||||
|
'phone' => $nohp_pembeli,
|
||||||
|
'billing' => [
|
||||||
|
'first_name' => $nama_depan_pembeli,
|
||||||
|
'last_name' => $nama_belakang_pembeli,
|
||||||
|
'email' => $pembeli,
|
||||||
|
'phone' => $nohp_pembeli,
|
||||||
|
'address' => $alamat,
|
||||||
|
'city' => auth()->user()->village->district->city->name,
|
||||||
|
'country_code' => 'IDN',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'callbacks' => [
|
||||||
|
'finish' => route('user-pembeli.index'),
|
||||||
|
],
|
||||||
|
'enabled_payments' => ['credit_card', 'shopeepay', 'gopay', 'other_qris'],
|
||||||
|
];
|
||||||
|
|
||||||
|
$client = new Client([
|
||||||
|
'verify' => false,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$auth = base64_encode(env('MIDTRANS_SERVER_KEY'));
|
||||||
|
|
||||||
|
$response = $client->request('POST', 'https://app.sandbox.midtrans.com/snap/v1/transactions', [
|
||||||
|
'body' => json_encode($params),
|
||||||
|
'headers' => [
|
||||||
|
'accept' => 'application/json',
|
||||||
|
'authorization' => 'Basic ' . $auth,
|
||||||
|
'content-type' => 'application/json',
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$result = json_decode($response->getBody(), true);
|
||||||
|
|
||||||
|
Transaction::where('id', $query->id)->update([
|
||||||
|
'token' => $result['token'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$contact = Contact::where('pemilik_kontak', $pembeli)
|
||||||
|
->where('relasi_kontak', $penjual)
|
||||||
|
->count();
|
||||||
|
|
||||||
|
if ($contact == 0) {
|
||||||
|
Contact::create([
|
||||||
|
'pemilik_kontak' => $pembeli,
|
||||||
|
'relasi_kontak' => $penjual,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
TransactionDescription::create([
|
||||||
|
'transaction_id' => $query->id,
|
||||||
|
'status' => $status,
|
||||||
|
'user' => $pembeli,
|
||||||
|
'judul' => 'fa fa-plus',
|
||||||
|
'background' => 'bg-buyer',
|
||||||
|
'deskripsi' => $nama_depan_pembeli . ' telah membuat transaksi baru dengan ' . $nama_penjual,
|
||||||
|
]);
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => true,
|
||||||
|
'message' => 'Berhasil menambahkan transaksi. Silahkan lakukan pembayaran.',
|
||||||
|
]);
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
|
||||||
|
Log::error($e->getMessage());
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Gagal menambahkan transaksi.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function finishTransaction(Request $request)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
DB::beginTransaction();
|
||||||
|
|
||||||
|
Transaction::where('id', $request->id)->update([
|
||||||
|
'status_transaksi' => 'finished',
|
||||||
|
'status_pembayaran' => 'settlement',
|
||||||
|
]);
|
||||||
|
|
||||||
|
TransactionDescription::create([
|
||||||
|
'transaction_id' => $request->id,
|
||||||
|
'status' => 'finished',
|
||||||
|
'background' => 'bg-buyer',
|
||||||
|
'user' => auth()->user()->email,
|
||||||
|
'judul' => 'fas fa-check',
|
||||||
|
'deskripsi' => 'Pesanan telah diselesaikan oleh ' . auth()->user()->nama_depan . '.',
|
||||||
|
]);
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => true,
|
||||||
|
'message' => 'Pesanan telah diselesaikan oleh ' . auth()->user()->nama_depan . '.',
|
||||||
|
]);
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
|
||||||
|
Log::error($e->getMessage());
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Gagal update status karena kesalahan server.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function payTransaction(Request $request)
|
||||||
|
{
|
||||||
|
$auth = base64_encode(env('MIDTRANS_SERVER_KEY'));
|
||||||
|
|
||||||
|
$response = Http::withOptions([
|
||||||
|
'verify' => false,
|
||||||
|
])
|
||||||
|
->withHeaders([
|
||||||
|
'Content-Type' => 'application/json',
|
||||||
|
'Authorization' => "Basic $auth",
|
||||||
|
])
|
||||||
|
->get('https://api.sandbox.midtrans.com/v2/' . $request->id . '/status');
|
||||||
|
|
||||||
|
$result = json_decode($response->body(), true);
|
||||||
|
|
||||||
|
$code = substr($result['status_code'], 0, 1);
|
||||||
|
|
||||||
|
try {
|
||||||
|
DB::beginTransaction();
|
||||||
|
|
||||||
|
if ($code == '4') {
|
||||||
|
return response()->json([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Terjadi error di server.',
|
||||||
|
'data' => $result,
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
if ($result['transaction_status'] == 'settlement') {
|
||||||
|
$transaction = 'success';
|
||||||
|
} elseif ($result['transaction_status'] == 'capture') {
|
||||||
|
if ($result['fraud_status'] == 'accept') {
|
||||||
|
$transaction = 'success';
|
||||||
|
} elseif ($result['fraud_status'] == 'challenge') {
|
||||||
|
$transaction = 'challenge';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$transaction = 'failure';
|
||||||
|
}
|
||||||
|
|
||||||
|
Transaction::where('id', $request->id)->update([
|
||||||
|
'metode_pembayaran' => $result['payment_type'],
|
||||||
|
'tanggal_transaksi' => $result['transaction_time'],
|
||||||
|
'status_transaksi' => $transaction,
|
||||||
|
'status_pembayaran' => $result['transaction_status'],
|
||||||
|
'fraud_status' => $result['fraud_status'],
|
||||||
|
'signature_key' => $result['signature_key'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($transaction == 'success') {
|
||||||
|
TransactionDescription::create([
|
||||||
|
'transaction_id' => $request->id,
|
||||||
|
'status' => 'success',
|
||||||
|
'background' => 'bg-buyer',
|
||||||
|
'judul' => 'fas fa-money-bill',
|
||||||
|
'deskripsi' => auth()->user()->nama_depan . ' telah sukses melakukan pembayaran. Transaksi diteruskan ke penjual.',
|
||||||
|
'user' => auth()->user()->email,
|
||||||
|
]);
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => true,
|
||||||
|
'message' => 'Pembayaran sukses',
|
||||||
|
]);
|
||||||
|
} 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' => 'admin@example.net',
|
||||||
|
'keterangan' => $result['status_message'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Pembayaran ditunda hingga disetujui oleh admin.',
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
TransactionDescription::create([
|
||||||
|
'transaction_id' => $request->id,
|
||||||
|
'status' => 'failure',
|
||||||
|
'background' => 'bg-primary',
|
||||||
|
'judul' => 'fas fa-exclamation',
|
||||||
|
'deskripsi' => 'Terjadi kegagalan pembayaran.',
|
||||||
|
'user' => 'admin@example.net',
|
||||||
|
'keterangan' => $result['status_message'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Transaksi pembayaran gagal',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
|
||||||
|
Log::error($e->getMessage());
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Transaksi pembayaran gagal.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function cancelTransaction(Request $request)
|
||||||
|
{
|
||||||
|
$auth = base64_encode(env('MIDTRANS_SERVER_KEY'));
|
||||||
|
|
||||||
|
$response = Http::withOptions([
|
||||||
|
'verify' => false,
|
||||||
|
])
|
||||||
|
->withHeaders([
|
||||||
|
'Content-Type' => 'application/json',
|
||||||
|
'Authorization' => "Basic $auth",
|
||||||
|
])
|
||||||
|
->post('https://api.sandbox.midtrans.com/v2/' . $request->id . '/cancel');
|
||||||
|
|
||||||
|
$result = json_decode($response->body(), true);
|
||||||
|
|
||||||
|
if (in_array($result['status_code'], ['412','401'])) {
|
||||||
|
return response()->json([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Transaksi gagal.',
|
||||||
|
'data' => $result
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
DB::beginTransaction();
|
||||||
|
|
||||||
|
Transaction::where('id', $request->id)->update([
|
||||||
|
'status_transaksi' => 'failure',
|
||||||
|
'status_pembayaran' => 'cancel'
|
||||||
|
]);
|
||||||
|
|
||||||
|
TransactionDescription::create([
|
||||||
|
'transaction_id' => $request->id,
|
||||||
|
'status' => 'cancel',
|
||||||
|
'background' => 'bg-buyer',
|
||||||
|
'judul' => 'fas fa-exclamation',
|
||||||
|
'deskripsi' => auth()->user()->nama_depan . ' telah membatalkan transaksi.',
|
||||||
|
'user' => auth()->user()->email,
|
||||||
|
]);
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => true,
|
||||||
|
'message' => 'Transaksi berhasil dibatalkan',
|
||||||
|
]);
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
|
||||||
|
Log::error($e->getMessage());
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Transaksi gagal dibatalkan',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function pendingTransaction(Request $request)
|
||||||
|
{
|
||||||
|
$auth = base64_encode(env('MIDTRANS_SERVER_KEY'));
|
||||||
|
|
||||||
|
$response = Http::withOptions([
|
||||||
|
'verify' => false,
|
||||||
|
])
|
||||||
|
->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([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Terjadi error di bagian server.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function complaintTransaction($id)
|
||||||
|
{
|
||||||
|
return view('user.refund.new-refund', compact('id'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function onErrorTransaction(Request $request)
|
||||||
|
{
|
||||||
|
$auth = base64_encode(env('MIDTRANS_SERVER_KEY'));
|
||||||
|
|
||||||
|
$response = Http::withOptions([
|
||||||
|
'verify' => false,
|
||||||
|
])
|
||||||
|
->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'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($result['transaction_status'] == 'expire') {
|
||||||
|
TransactionDescription::create([
|
||||||
|
'transaction_id' => $request->id,
|
||||||
|
'status' => 'cancel',
|
||||||
|
'background' => 'bg-buyer',
|
||||||
|
'judul' => 'fas fa-exclamation',
|
||||||
|
'deskripsi' => 'Pembayaran sudah expire',
|
||||||
|
'user' => 'admin@example.net',
|
||||||
|
]);
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Pembayaran sudah expire, silahkan buat transaksi baru.',
|
||||||
|
]);
|
||||||
|
} elseif ($result['transaction'] == 'failure') {
|
||||||
|
TransactionDescription::create([
|
||||||
|
'transaction_id' => $request->id,
|
||||||
|
'status' => 'failure',
|
||||||
|
'background' => 'bg-buyer',
|
||||||
|
'judul' => 'fas fa-exclamation',
|
||||||
|
'deskripsi' => auth()->user()->nama_depan . ' telah membatalkan transaksi.',
|
||||||
|
'user' => 'admin@example.net',
|
||||||
|
]);
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Terjadi kesalahan di server saat pembayaran.',
|
||||||
|
'data' => $result,
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
TransactionDescription::create([
|
||||||
|
'transaction_id' => $request->id,
|
||||||
|
'status' => $result['transaction_status'],
|
||||||
|
'background' => 'bg-primary',
|
||||||
|
'judul' => 'fas fa-exclamation',
|
||||||
|
'deskripsi' => 'Status tidak diketahui',
|
||||||
|
'user' => 'admin@example.net',
|
||||||
|
'keterangan' => $result['status_message'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => true,
|
||||||
|
'message' => 'Terjadi kesalahan di server',
|
||||||
|
'data' => $result,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
|
||||||
|
Log::error($e->getMessage());
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Terjadi error di bagian server.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function onCloseTransaction(Request $request)
|
||||||
|
{
|
||||||
|
$auth = base64_encode(env('MIDTRANS_SERVER_KEY'));
|
||||||
|
|
||||||
|
$response = Http::withOptions([
|
||||||
|
'verify' => false,
|
||||||
|
])
|
||||||
|
->withHeaders([
|
||||||
|
'Content-Type' => 'application/json',
|
||||||
|
'Authorization' => "Basic $auth",
|
||||||
|
])
|
||||||
|
->get('https://api.sandbox.midtrans.com/v2/' . $request->id . '/status');
|
||||||
|
|
||||||
|
$result = json_decode($response->body(), true);
|
||||||
|
|
||||||
|
$status = $result['transaction_status'] == null ? '' : $result['transaction_status'];
|
||||||
|
|
||||||
|
if ($status == '') {
|
||||||
|
return response()->json([
|
||||||
|
'status' => true,
|
||||||
|
'message' => 'On Close',
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
DB::beginTransaction();
|
||||||
|
|
||||||
|
if ($result['transaction_status'] == 'expire') {
|
||||||
|
Transaction::where('id', $request->id)->update([
|
||||||
|
'status_pembayaran' => $result['transaction_status'],
|
||||||
|
'status_transaksi' => 'failure',
|
||||||
|
]);
|
||||||
|
|
||||||
|
TransactionDescription::create([
|
||||||
|
'transaction_id' => $request->id,
|
||||||
|
'status' => 'cancel',
|
||||||
|
'background' => 'bg-buyer',
|
||||||
|
'judul' => 'fas fa-exclamation',
|
||||||
|
'deskripsi' => 'Pembayaran sudah expire',
|
||||||
|
'user' => 'admin@example.net',
|
||||||
|
]);
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Pembayaran sudah expire, silahkan buat transaksi baru.',
|
||||||
|
]);
|
||||||
|
} elseif ($result['transaction'] == 'failure') {
|
||||||
|
Transaction::where('id', $request->id)->update([
|
||||||
|
'status_pembayaran' => $result['transaction_status'],
|
||||||
|
'status_transaksi' => 'failure',
|
||||||
|
]);
|
||||||
|
|
||||||
|
TransactionDescription::create([
|
||||||
|
'transaction_id' => $request->id,
|
||||||
|
'status' => 'failure',
|
||||||
|
'background' => 'bg-buyer',
|
||||||
|
'judul' => 'fas fa-exclamation',
|
||||||
|
'deskripsi' => auth()->user()->nama_depan . ' telah membatalkan transaksi.',
|
||||||
|
'user' => 'admin@example.net',
|
||||||
|
]);
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Terjadi kesalahan di server saat pembayaran.',
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
Transaction::where('id', $request->id)->update([
|
||||||
|
'status_pembayaran' => $result['transaction_status'],
|
||||||
|
'status_transaksi' => 'failure',
|
||||||
|
]);
|
||||||
|
|
||||||
|
TransactionDescription::create([
|
||||||
|
'transaction_id' => $request->id,
|
||||||
|
'status' => $result['transaction_status'],
|
||||||
|
'background' => 'bg-primary',
|
||||||
|
'judul' => 'fas fa-exclamation',
|
||||||
|
'deskripsi' => 'Status tidak diketahui.',
|
||||||
|
'user' => 'admin@example.net',
|
||||||
|
]);
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => true,
|
||||||
|
'message' => 'Terjadi kesalahan di server',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
|
||||||
|
Log::error($e->getMessage());
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Terjadi error di bagian server.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function listPembeli(Request $request)
|
||||||
|
{
|
||||||
|
try{
|
||||||
|
$subQuery = Transaction::join('users','transactions.penjual','=','users.email')
|
||||||
|
->where('transactions.pembeli',auth()->user()->email)
|
||||||
|
->select(
|
||||||
|
'transactions.id',
|
||||||
|
DB::raw("CONCAT(users.nama_depan,' ',users.nama_belakang) as nama_penjual"),
|
||||||
|
'transactions.nama_barang',
|
||||||
|
'transactions.total_harga',
|
||||||
|
'transactions.created_at',
|
||||||
|
'transactions.status_transaksi',
|
||||||
|
'transactions.token'
|
||||||
|
);
|
||||||
|
|
||||||
|
if($request->has('search') && !empty($request->search['value'])){
|
||||||
|
$searchPembeli = $request->search['value'];
|
||||||
|
if(!is_numeric($searchPembeli)){
|
||||||
|
$subQuery->where(function($a) use ($searchPembeli){
|
||||||
|
$a->whereRaw("LOWER(CONCAT(users.nama_depan,' ',users.nama_belakang)) LIKE ?",['%'.strtolower($searchPembeli).'%'])
|
||||||
|
->orWhereRaw('LOWER(transactions.nama_barang) LIKE ?',['%'.strtolower($searchPembeli).'%'])
|
||||||
|
->orWhereRaw('LOWER(transactions.status_transaksi) LIKE ?',['%'.strtolower($searchPembeli).'%']);
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
$subQuery->where(function($a) use ($searchPembeli){
|
||||||
|
$a->where('transactions.total_harga','=',$searchPembeli);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$queryPembeli = Transaction::from(DB::raw("({$subQuery->toSql()}) as tmp"))
|
||||||
|
->mergeBindings($subQuery->getQuery()) // Menggabungkan binding parameters
|
||||||
|
->select('*')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
if ($request->ajax()) {
|
||||||
|
return DataTables::of($queryPembeli)
|
||||||
|
->addIndexColumn()
|
||||||
|
->addColumn('action', function ($row) {
|
||||||
|
$url = route('user-transaction.show', ['id' => $row->id]);
|
||||||
|
$invoice = route('invoice.get',['id' => $row->id]);
|
||||||
|
$html_code = '
|
||||||
|
<div class="btn-group">
|
||||||
|
<button type="button" class="btn btn-primary dropdown-toggle"
|
||||||
|
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
|
....
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><a class="dropdown-item"
|
||||||
|
href="'.$url.'">Detail</a>
|
||||||
|
</li>
|
||||||
|
<li><a class="dropdown-item"
|
||||||
|
href="'.$invoice.'">Invoice</a>
|
||||||
|
</li>
|
||||||
|
<li><a class="dropdown-item" data-toggle="modal"
|
||||||
|
data-target="#modalTracking"
|
||||||
|
data-id="'.$row->id.'"
|
||||||
|
href="#">Tracking</a>
|
||||||
|
</li>';
|
||||||
|
|
||||||
|
if($row->status_transaksi == 'created'){
|
||||||
|
$html_code .= '
|
||||||
|
<li><a class="dropdown-item" id="bayar"
|
||||||
|
data-id="'.$row->id.'"
|
||||||
|
data-token="'.$row->token.'"
|
||||||
|
href="#">Bayar</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="#" data-id="'.$row->id.'"
|
||||||
|
id="cancel" class="dropdown-item">Batal</a>
|
||||||
|
</li>
|
||||||
|
';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($row->status_transaksi == 'sent'){
|
||||||
|
$html_code .= '
|
||||||
|
<li><a class="dropdown-item" data-toggle="modal"
|
||||||
|
data-target="#modalFinish"
|
||||||
|
data-id="'.$row->id.'"
|
||||||
|
href="#">Selesaikan</a>
|
||||||
|
</li>
|
||||||
|
';
|
||||||
|
}
|
||||||
|
|
||||||
|
$html_code .= '
|
||||||
|
</ul>
|
||||||
|
</div>';
|
||||||
|
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']);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
331
app/Http/Controllers/User/PenjualController.php
Normal file
331
app/Http/Controllers/User/PenjualController.php
Normal file
@ -0,0 +1,331 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\User;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Refund;
|
||||||
|
use App\Models\Transaction;
|
||||||
|
use App\Models\TransactionDescription;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Http;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Throwable;
|
||||||
|
use Yajra\DataTables\DataTables;
|
||||||
|
|
||||||
|
class PenjualController extends Controller
|
||||||
|
{
|
||||||
|
public function indexPenjual()
|
||||||
|
{
|
||||||
|
return view('user.transaction.penjual.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function listPenjual(Request $request){
|
||||||
|
try{
|
||||||
|
$subQuery = Transaction::join('users','transactions.pembeli','=','users.email')
|
||||||
|
->where('transactions.penjual',auth()->user()->email)
|
||||||
|
->select(
|
||||||
|
'transactions.id',
|
||||||
|
DB::raw("CONCAT(users.nama_depan,' ',users.nama_belakang) as nama_pembeli"),
|
||||||
|
'transactions.nama_barang',
|
||||||
|
'transactions.total_harga',
|
||||||
|
'transactions.created_at',
|
||||||
|
'transactions.status_transaksi',
|
||||||
|
);
|
||||||
|
|
||||||
|
if($request->has('search') && !empty($request->search['value'])){
|
||||||
|
$searchPenjual = $request->search['value'];
|
||||||
|
if(!is_numeric($searchPenjual)){
|
||||||
|
$subQuery->where(function($a) use ($searchPenjual){
|
||||||
|
$a->whereRaw("LOWER(CONCAT(users.nama_depan,' ',users.nama_belakang)) LIKE ?",['%'.strtolower($searchPenjual).'%'])
|
||||||
|
->orWhereRaw('LOWER(transactions.nama_barang) LIKE ?',['%'.strtolower($searchPenjual).'%'])
|
||||||
|
->orWhereRaw('LOWER(transactions.status_transaksi) LIKE ?',['%'.strtolower($searchPenjual).'%']);
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
$subQuery->where(function($a) use ($searchPenjual){
|
||||||
|
$a->whereDay('transactions.created_at', '=', $searchPenjual)
|
||||||
|
->orWhereMonth('transactions.created_at', '=', $searchPenjual)
|
||||||
|
->orWhereYear('transactions.created_at', '=', $searchPenjual)
|
||||||
|
->orWhere('transactions.total_harga', '=', $searchPenjual);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$queryPenjual = Transaction::from(DB::raw("({$subQuery->toSql()}) as tmp"))
|
||||||
|
->mergeBindings($subQuery->getQuery()) // Menggabungkan binding parameters
|
||||||
|
->select('*')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
if ($request->ajax()) {
|
||||||
|
return DataTables::of($queryPenjual)
|
||||||
|
->addIndexColumn()
|
||||||
|
->addColumn('action', function ($row) {
|
||||||
|
$url = route('user-transaction.show', ['id' => $row->id]);
|
||||||
|
$invoice = route('invoice.get',['id' => $row->id]);
|
||||||
|
$html_code = '
|
||||||
|
<div class="btn-group">
|
||||||
|
<button type="button" class="btn btn-primary dropdown-toggle"
|
||||||
|
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
|
....
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><a class="dropdown-item"
|
||||||
|
href="'.$url.'">Detail</a>
|
||||||
|
</li>
|
||||||
|
<li><a class="dropdown-item"
|
||||||
|
href="'.$invoice.'">Invoice</a>
|
||||||
|
</li>
|
||||||
|
<li><a class="dropdown-item" data-toggle="modal"
|
||||||
|
data-target="#modalTracking"
|
||||||
|
data-id="'.$row->id.'"
|
||||||
|
href="#">Tracking</a>
|
||||||
|
</li>
|
||||||
|
<li><a class="dropdown-item" id="denyTransaction"
|
||||||
|
data-id="'.$row->id.'"
|
||||||
|
href="#">Tolak Transaksi</a>
|
||||||
|
</li>';
|
||||||
|
|
||||||
|
if($row->status_transaksi == 'success'){
|
||||||
|
$html_code .= '
|
||||||
|
<li><a class="dropdown-item" id="processTransaction"
|
||||||
|
data-id="'.$row->id.'"
|
||||||
|
href="#">Proses Transaksi</a>
|
||||||
|
</li>
|
||||||
|
';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($row->status_transaksi == 'progress'){
|
||||||
|
$html_code .= '
|
||||||
|
<li><a class="dropdown-item" id="sendOrder"
|
||||||
|
data-id="'.$row->id.'"
|
||||||
|
href="#">Kirim barang</a>
|
||||||
|
</li>
|
||||||
|
';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($row->status_transaksi == 'sent'){
|
||||||
|
$html_code .= '
|
||||||
|
<li><a class="dropdown-item" data-toggle="modal"
|
||||||
|
data-target="#modalOrderSent"
|
||||||
|
data-id="'.$row->id.'"
|
||||||
|
href="#">Barang sudah sampai</a>
|
||||||
|
</li>
|
||||||
|
';
|
||||||
|
}
|
||||||
|
$html_code .= '
|
||||||
|
</ul>
|
||||||
|
</div>';
|
||||||
|
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']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function acceptTransaction(Request $request)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
DB::beginTransaction();
|
||||||
|
|
||||||
|
Transaction::where('id', $request->id)->update([
|
||||||
|
'status_transaksi' => 'process',
|
||||||
|
]);
|
||||||
|
|
||||||
|
TransactionDescription::create([
|
||||||
|
'transaction_id' => $request->id,
|
||||||
|
'status' => 'process',
|
||||||
|
'background' => 'bg-seller',
|
||||||
|
'user' => auth()->user()->email,
|
||||||
|
'judul' => 'fas fa-handshake',
|
||||||
|
'deskripsi' => 'Transaksi telah diterima oleh ' . auth()->user()->nama_depan,
|
||||||
|
]);
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => true,
|
||||||
|
'message' => 'Transaksi telah diterima. Siapkan pesanan untuk dikirim ke penjual.',
|
||||||
|
]);
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
|
||||||
|
Log::error($e->getMessage());
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Gagal update status karena kesalahan server.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denyTransaction(Request $request){
|
||||||
|
|
||||||
|
$transaction = Transaction::where('id', $request->id)->first();
|
||||||
|
$refund = Refund::create([
|
||||||
|
'transaction_id' => $request->id,
|
||||||
|
'total' => $transaction->total_bayar,
|
||||||
|
'due_date' => now(),
|
||||||
|
'status' => 'refund',
|
||||||
|
'complaint' => $request->complaint
|
||||||
|
]);
|
||||||
|
|
||||||
|
// $params = [
|
||||||
|
// 'refund_key' => $request->id . '-ref1',
|
||||||
|
// 'amount' => $refund->total,
|
||||||
|
// 'reason' => $refund->complaint,
|
||||||
|
// ];
|
||||||
|
|
||||||
|
// $auth = base64_encode(env('MIDTRANS_SERVER_KEY'));
|
||||||
|
|
||||||
|
// $response = Http::withOptions([
|
||||||
|
// 'verify' => false,
|
||||||
|
// ])
|
||||||
|
// ->withHeaders([
|
||||||
|
// 'Content-Type' => 'application/json',
|
||||||
|
// 'Authorization' => "Basic $auth",
|
||||||
|
// ])
|
||||||
|
// ->post('https://api.sandbox.midtrans.com/v2/'.$request->id.'/refund', $params);
|
||||||
|
|
||||||
|
// $result = json_decode($response->body(), true);
|
||||||
|
// $code = $result['status_code'];
|
||||||
|
$code = '200';
|
||||||
|
|
||||||
|
if($code == '200'){
|
||||||
|
try{
|
||||||
|
DB::beginTransaction();
|
||||||
|
|
||||||
|
Transaction::where('id', $request->id)->update([
|
||||||
|
|
||||||
|
]);
|
||||||
|
|
||||||
|
TransactionDescription::create([
|
||||||
|
'transaction_id' => $request->id,
|
||||||
|
'status' => 'refund',
|
||||||
|
'background' => 'bg-seller',
|
||||||
|
'user' => auth()->user()->email,
|
||||||
|
'judul' => 'fas fa-handshake',
|
||||||
|
'deskripsi' => 'Transaksi ditolak '.auth()->user()->nama_depan.', uang akan dikembalikan ke pembeli. ',
|
||||||
|
]);
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => true,
|
||||||
|
'message' => 'Transaksi telah ditolak. Uang akan dikirimkan ke pembeli.',
|
||||||
|
]);
|
||||||
|
}catch(Throwable $e){
|
||||||
|
DB::rollBack();
|
||||||
|
|
||||||
|
Log::error($e->getMessage());
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Gagal update status karena kesalahan server.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
// Log::error($result['status_message']);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Transaksi gagal',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sendingOrder(Request $request)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
DB::beginTransaction();
|
||||||
|
|
||||||
|
Transaction::where('id', $request->id)->update([
|
||||||
|
'status_transaksi' => 'sending',
|
||||||
|
]);
|
||||||
|
|
||||||
|
TransactionDescription::create([
|
||||||
|
'transaction_id' => $request->id,
|
||||||
|
'status' => 'sending',
|
||||||
|
'background' => 'bg-seller',
|
||||||
|
'user' => auth()->user()->email,
|
||||||
|
'judul' => 'fas fa-truck-moving',
|
||||||
|
'deskripsi' => 'Pesanan telah dikirim oleh ' . auth()->user()->nama_depan . ' dan sedang dalam perjalanan menuju pembeli.',
|
||||||
|
]);
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => true,
|
||||||
|
'message' => 'Pesanan sedang dikirim dan menuju pembeli.',
|
||||||
|
]);
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
|
||||||
|
Log::error($e->getMessage());
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Gagal update status karena kesalahan server.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sentOrder(Request $request)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
DB::beginTransaction();
|
||||||
|
|
||||||
|
Transaction::where('id', $request->transaction_id)->update([
|
||||||
|
'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([
|
||||||
|
'transaction_id' => $request->transaction_id,
|
||||||
|
'status' => 'sent',
|
||||||
|
'background' => 'bg-seller',
|
||||||
|
'user' => auth()->user()->email,
|
||||||
|
'judul' => 'fas fa-check',
|
||||||
|
'deskripsi' => 'Pesanan telah sampai di tempat pembeli. Keterangan: '.$request->keterangan_bukti,
|
||||||
|
'bukti_foto' => $bukti_foto,
|
||||||
|
]);
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => true,
|
||||||
|
'message' => 'Pesanan telah sampai di tempat pembeli.',
|
||||||
|
]);
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
|
||||||
|
Log::error($e->getMessage());
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Gagal update status karena kesalahan server.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response([
|
||||||
|
'status' => true,
|
||||||
|
'message' => 'Sukses kirim data.',
|
||||||
|
'data' => $request
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
@ -5,7 +5,6 @@ namespace App\Http\Controllers\User;
|
|||||||
use Throwable;
|
use Throwable;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use App\Models\Refund;
|
use App\Models\Refund;
|
||||||
use App\Models\RefundUser;
|
|
||||||
use App\Models\Transaction;
|
use App\Models\Transaction;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Yajra\DataTables\DataTables;
|
use Yajra\DataTables\DataTables;
|
||||||
@ -19,13 +18,7 @@ class UserRefundController extends Controller
|
|||||||
{
|
{
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$refunds = Refund::join('transactions', 'refunds.transaction_id', '=', 'transactions.id')
|
return view('user.refund.index');
|
||||||
->where('transactions.pembeli', auth()->user()->email)
|
|
||||||
->get('refunds.*');
|
|
||||||
|
|
||||||
return view('user.refund.index', [
|
|
||||||
'refunds' => $refunds
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create($id)
|
public function create($id)
|
||||||
|
@ -24,23 +24,6 @@ use Stichoza\GoogleTranslate\GoogleTranslate;
|
|||||||
|
|
||||||
class UserTransactionController extends Controller
|
class UserTransactionController extends Controller
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Display a listing of the resource.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public function indexPembeli()
|
|
||||||
{
|
|
||||||
return view('user.transaction.pembeli.index');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Display a listing of the resource.
|
|
||||||
*/
|
|
||||||
public function indexPenjual()
|
|
||||||
{
|
|
||||||
return view('user.transaction.penjual.index');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function show($id)
|
public function show($id)
|
||||||
{
|
{
|
||||||
return view('user.transaction.pembeli.detail-transaction', [
|
return view('user.transaction.pembeli.detail-transaction', [
|
||||||
@ -51,968 +34,6 @@ class UserTransactionController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the form for creating a new resource.
|
|
||||||
*/
|
|
||||||
public function create()
|
|
||||||
{
|
|
||||||
$now = Carbon::now();
|
|
||||||
$bulan = $now->format('F');
|
|
||||||
$tahun = $now->year;
|
|
||||||
$persentase_keuntungan = Setting::where('status', 'Active')
|
|
||||||
->where('bulan', '=', $bulan)
|
|
||||||
->where('tahun', '=', $tahun)
|
|
||||||
->value('persentase');
|
|
||||||
if (is_null($persentase_keuntungan)) {
|
|
||||||
$persentase_keuntungan = Setting::where('status', 'Active')
|
|
||||||
->latest()
|
|
||||||
->value('persentase');
|
|
||||||
}
|
|
||||||
return view('user.transaction.pembeli.new-transaction', [
|
|
||||||
'persentase_keuntungan' => $persentase_keuntungan,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Store a newly created resource in storage.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public function store(Request $request)
|
|
||||||
{
|
|
||||||
$pembeli = Auth::user()->email;
|
|
||||||
$penjual = $request->email_penjual;
|
|
||||||
$nama_barang = $request->nama_barang;
|
|
||||||
$satuan_barang = $request->satuan_barang;
|
|
||||||
$deskripsi_transaksi = $request->deskripsi;
|
|
||||||
$harga_barang = $request->harga_barang;
|
|
||||||
$jumlah_barang = $request->jumlah_barang;
|
|
||||||
|
|
||||||
$nama_depan_pembeli = Auth::user()->nama_depan;
|
|
||||||
$nama_belakang_pembeli = Auth::user()->nama_belakang;
|
|
||||||
$nohp_pembeli = Auth::user()->nohp;
|
|
||||||
$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));
|
|
||||||
|
|
||||||
$now = Carbon::now();
|
|
||||||
|
|
||||||
$persentase_keuntungan = $request->persentase_keuntungan;
|
|
||||||
|
|
||||||
$total_harga = $request->total_harga;
|
|
||||||
$total_keuntungan = $request->total_keuntungan;
|
|
||||||
$total_bayar = $request->total_bayar;
|
|
||||||
|
|
||||||
$batas_pembayaran = $now->addDays(1)->toTimeString();
|
|
||||||
$batas_konfirmasi_transaksi = $now->addDays(2)->toDateTimeString();
|
|
||||||
$batas_pengiriman_barang_awal = $now->addDays(3)->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 = [
|
|
||||||
'transaction_details' => [
|
|
||||||
'order_id' => $query->id,
|
|
||||||
'gross_amount' => $total_bayar,
|
|
||||||
],
|
|
||||||
'item_details' => [
|
|
||||||
[
|
|
||||||
'id' => $nama_barang . time(),
|
|
||||||
'price' => $harga_barang,
|
|
||||||
'quantity' => $jumlah_barang,
|
|
||||||
'name' => $nama_barang,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 'BA01',
|
|
||||||
'price' => $total_keuntungan,
|
|
||||||
'quantity' => 1,
|
|
||||||
'name' => 'Biaya Admin',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
'customer_details' => [
|
|
||||||
'firts_name' => $nama_depan_pembeli,
|
|
||||||
'last_name' => $nama_belakang_pembeli,
|
|
||||||
'email' => $pembeli,
|
|
||||||
'phone' => $nohp_pembeli,
|
|
||||||
'billing' => [
|
|
||||||
'first_name' => $nama_depan_pembeli,
|
|
||||||
'last_name' => $nama_belakang_pembeli,
|
|
||||||
'email' => $pembeli,
|
|
||||||
'phone' => $nohp_pembeli,
|
|
||||||
'address' => $alamat,
|
|
||||||
'city' => Auth::user()->village->district->city->name,
|
|
||||||
'country_code' => 'IDN',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
'callbacks' => [
|
|
||||||
'finish' => route('user-pembeli.index'),
|
|
||||||
],
|
|
||||||
'enabled_payments' => ['credit_card', 'shopeepay', 'gopay', 'other_qris'],
|
|
||||||
];
|
|
||||||
|
|
||||||
$client = new Client([
|
|
||||||
'verify' => false,
|
|
||||||
]);
|
|
||||||
|
|
||||||
$auth = base64_encode(env('MIDTRANS_SERVER_KEY'));
|
|
||||||
|
|
||||||
$response = $client->request('POST', 'https://app.sandbox.midtrans.com/snap/v1/transactions', [
|
|
||||||
'body' => json_encode($params),
|
|
||||||
'headers' => [
|
|
||||||
'accept' => 'application/json',
|
|
||||||
'authorization' => 'Basic ' . $auth,
|
|
||||||
'content-type' => 'application/json',
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
|
|
||||||
$result = json_decode($response->getBody(), true);
|
|
||||||
|
|
||||||
Transaction::where('id', $query->id)->update([
|
|
||||||
'token' => $result['token'],
|
|
||||||
]);
|
|
||||||
|
|
||||||
$contact = Contact::where('pemilik_kontak', $pembeli)
|
|
||||||
->where('relasi_kontak', $penjual)
|
|
||||||
->count();
|
|
||||||
|
|
||||||
if ($contact == 0) {
|
|
||||||
Contact::create([
|
|
||||||
'pemilik_kontak' => $pembeli,
|
|
||||||
'relasi_kontak' => $penjual,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
TransactionDescription::create([
|
|
||||||
'transaction_id' => $query->id,
|
|
||||||
'status' => $status,
|
|
||||||
'user' => $pembeli,
|
|
||||||
'judul' => 'fa fa-plus',
|
|
||||||
'background' => 'bg-buyer',
|
|
||||||
'deskripsi' => $nama_depan_pembeli . ' telah membuat transaksi baru dengan ' . $nama_penjual,
|
|
||||||
]);
|
|
||||||
|
|
||||||
DB::commit();
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'status' => true,
|
|
||||||
'message' => 'Berhasil menambahkan transaksi. Silahkan lakukan pembayaran.',
|
|
||||||
]);
|
|
||||||
} catch (Throwable $e) {
|
|
||||||
DB::rollBack();
|
|
||||||
|
|
||||||
Log::error($e->getMessage());
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'status' => false,
|
|
||||||
'message' => 'Gagal menambahkan transaksi.',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function acceptTransaction(Request $request)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
DB::beginTransaction();
|
|
||||||
|
|
||||||
Transaction::where('id', $request->id)->update([
|
|
||||||
'status_transaksi' => 'process',
|
|
||||||
]);
|
|
||||||
|
|
||||||
TransactionDescription::create([
|
|
||||||
'transaction_id' => $request->id,
|
|
||||||
'status' => 'process',
|
|
||||||
'background' => 'bg-seller',
|
|
||||||
'user' => Auth::user()->email,
|
|
||||||
'judul' => 'fas fa-handshake',
|
|
||||||
'deskripsi' => 'Transaksi telah diterima oleh ' . Auth::user()->nama_depan,
|
|
||||||
]);
|
|
||||||
|
|
||||||
DB::commit();
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'status' => true,
|
|
||||||
'message' => 'Transaksi telah diterima. Siapkan pesanan untuk dikirim ke penjual.',
|
|
||||||
]);
|
|
||||||
} catch (Throwable $e) {
|
|
||||||
DB::rollBack();
|
|
||||||
|
|
||||||
Log::error($e->getMessage());
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'status' => false,
|
|
||||||
'message' => 'Gagal update status karena kesalahan server.',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function sendingOrder(Request $request)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
DB::beginTransaction();
|
|
||||||
|
|
||||||
Transaction::where('id', $request->id)->update([
|
|
||||||
'status_transaksi' => 'sending',
|
|
||||||
]);
|
|
||||||
|
|
||||||
TransactionDescription::create([
|
|
||||||
'transaction_id' => $request->id,
|
|
||||||
'status' => 'sending',
|
|
||||||
'background' => 'bg-seller',
|
|
||||||
'user' => Auth::user()->email,
|
|
||||||
'judul' => 'fas fa-truck-moving',
|
|
||||||
'deskripsi' => 'Pesanan telah dikirim oleh ' . Auth::user()->nama_depan . ' dan sedang dalam perjalanan menuju pembeli.',
|
|
||||||
]);
|
|
||||||
|
|
||||||
DB::commit();
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'status' => true,
|
|
||||||
'message' => 'Pesanan sedang dikirim dan menuju pembeli.',
|
|
||||||
]);
|
|
||||||
} catch (Throwable $e) {
|
|
||||||
DB::rollBack();
|
|
||||||
|
|
||||||
Log::error($e->getMessage());
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'status' => false,
|
|
||||||
'message' => 'Gagal update status karena kesalahan server.',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function sentOrder(Request $request)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
DB::beginTransaction();
|
|
||||||
|
|
||||||
Transaction::where('id', $request->transaction_id)->update([
|
|
||||||
'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([
|
|
||||||
'transaction_id' => $request->transaction_id,
|
|
||||||
'status' => 'sent',
|
|
||||||
'background' => 'bg-seller',
|
|
||||||
'user' => Auth::user()->email,
|
|
||||||
'judul' => 'fas fa-check',
|
|
||||||
'deskripsi' => 'Pesanan telah sampai di tempat pembeli. Keterangan: '.$request->keterangan_bukti,
|
|
||||||
'bukti_foto' => $bukti_foto,
|
|
||||||
]);
|
|
||||||
|
|
||||||
DB::commit();
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'status' => true,
|
|
||||||
'message' => 'Pesanan telah sampai di tempat pembeli.',
|
|
||||||
]);
|
|
||||||
} catch (Throwable $e) {
|
|
||||||
DB::rollBack();
|
|
||||||
|
|
||||||
Log::error($e->getMessage());
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'status' => false,
|
|
||||||
'message' => 'Gagal update status karena kesalahan server.',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return response([
|
|
||||||
'status' => true,
|
|
||||||
'message' => 'Sukses kirim data.',
|
|
||||||
'data' => $request
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function finishTransaction(Request $request)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
DB::beginTransaction();
|
|
||||||
|
|
||||||
Transaction::where('id', $request->id)->update([
|
|
||||||
'status_transaksi' => 'finished',
|
|
||||||
'status_pembayaran' => 'settlement',
|
|
||||||
]);
|
|
||||||
|
|
||||||
TransactionDescription::create([
|
|
||||||
'transaction_id' => $request->id,
|
|
||||||
'status' => 'finished',
|
|
||||||
'background' => 'bg-buyer',
|
|
||||||
'user' => Auth::user()->email,
|
|
||||||
'judul' => 'fas fa-check',
|
|
||||||
'deskripsi' => 'Pesanan telah diselesaikan oleh ' . auth()->user()->nama_depan . '.',
|
|
||||||
]);
|
|
||||||
|
|
||||||
DB::commit();
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'status' => true,
|
|
||||||
'message' => 'Pesanan telah diselesaikan oleh ' . auth()->user()->nama_depan . '.',
|
|
||||||
]);
|
|
||||||
} catch (Throwable $e) {
|
|
||||||
DB::rollBack();
|
|
||||||
|
|
||||||
Log::error($e->getMessage());
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'status' => false,
|
|
||||||
'message' => 'Gagal update status karena kesalahan server.',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function payTransaction(Request $request)
|
|
||||||
{
|
|
||||||
$auth = base64_encode(env('MIDTRANS_SERVER_KEY'));
|
|
||||||
|
|
||||||
$response = Http::withOptions([
|
|
||||||
'verify' => false,
|
|
||||||
])
|
|
||||||
->withHeaders([
|
|
||||||
'Content-Type' => 'application/json',
|
|
||||||
'Authorization' => "Basic $auth",
|
|
||||||
])
|
|
||||||
->get('https://api.sandbox.midtrans.com/v2/' . $request->id . '/status');
|
|
||||||
|
|
||||||
$result = json_decode($response->body(), true);
|
|
||||||
|
|
||||||
$code = substr($result['status_code'], 0, 1);
|
|
||||||
|
|
||||||
try {
|
|
||||||
DB::beginTransaction();
|
|
||||||
|
|
||||||
if ($code == '4') {
|
|
||||||
return response()->json([
|
|
||||||
'status' => false,
|
|
||||||
'message' => 'Terjadi error di server.',
|
|
||||||
'data' => $result,
|
|
||||||
]);
|
|
||||||
} else {
|
|
||||||
if ($result['transaction_status'] == 'settlement') {
|
|
||||||
$transaction = 'success';
|
|
||||||
} elseif ($result['transaction_status'] == 'capture') {
|
|
||||||
if ($result['fraud_status'] == 'accept') {
|
|
||||||
$transaction = 'success';
|
|
||||||
} elseif ($result['fraud_status'] == 'challenge') {
|
|
||||||
$transaction = 'challenge';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$transaction = 'failure';
|
|
||||||
}
|
|
||||||
|
|
||||||
Transaction::where('id', $request->id)->update([
|
|
||||||
'metode_pembayaran' => $result['payment_type'],
|
|
||||||
'tanggal_transaksi' => $result['transaction_time'],
|
|
||||||
'status_transaksi' => $transaction,
|
|
||||||
'status_pembayaran' => $result['transaction_status'],
|
|
||||||
'fraud_status' => $result['fraud_status'],
|
|
||||||
'signature_key' => $result['signature_key'],
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($transaction == 'success') {
|
|
||||||
TransactionDescription::create([
|
|
||||||
'transaction_id' => $request->id,
|
|
||||||
'status' => 'success',
|
|
||||||
'background' => 'bg-buyer',
|
|
||||||
'judul' => 'fas fa-money-bill',
|
|
||||||
'deskripsi' => Auth::user()->nama_depan . ' telah sukses melakukan pembayaran. Transaksi diteruskan ke penjual.',
|
|
||||||
'user' => auth()->user()->email,
|
|
||||||
]);
|
|
||||||
|
|
||||||
DB::commit();
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'status' => true,
|
|
||||||
'message' => 'Pembayaran sukses',
|
|
||||||
]);
|
|
||||||
} 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' => 'admin@example.net',
|
|
||||||
'keterangan' => $result['status_message'],
|
|
||||||
]);
|
|
||||||
|
|
||||||
DB::commit();
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'status' => false,
|
|
||||||
'message' => 'Pembayaran ditunda hingga disetujui oleh admin.',
|
|
||||||
]);
|
|
||||||
} else {
|
|
||||||
TransactionDescription::create([
|
|
||||||
'transaction_id' => $request->id,
|
|
||||||
'status' => 'failure',
|
|
||||||
'background' => 'bg-primary',
|
|
||||||
'judul' => 'fas fa-exclamation',
|
|
||||||
'deskripsi' => 'Terjadi kegagalan pembayaran.',
|
|
||||||
'user' => 'admin@example.net',
|
|
||||||
'keterangan' => $result['status_message'],
|
|
||||||
]);
|
|
||||||
|
|
||||||
DB::commit();
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'status' => false,
|
|
||||||
'message' => 'Transaksi pembayaran gagal',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Throwable $e) {
|
|
||||||
DB::rollBack();
|
|
||||||
|
|
||||||
Log::error($e->getMessage());
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'status' => false,
|
|
||||||
'message' => 'Transaksi pembayaran gagal.',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return response()->json();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function cancelTransaction(Request $request)
|
|
||||||
{
|
|
||||||
$auth = base64_encode(env('MIDTRANS_SERVER_KEY'));
|
|
||||||
|
|
||||||
$response = Http::withOptions([
|
|
||||||
'verify' => false,
|
|
||||||
])
|
|
||||||
->withHeaders([
|
|
||||||
'Content-Type' => 'application/json',
|
|
||||||
'Authorization' => "Basic $auth",
|
|
||||||
])
|
|
||||||
->post('https://api.sandbox.midtrans.com/v2/' . $request->id . '/cancel');
|
|
||||||
|
|
||||||
$result = json_decode($response->body(), true);
|
|
||||||
|
|
||||||
if (in_array($result['status_code'], ['412','401'])) {
|
|
||||||
return response()->json([
|
|
||||||
'status' => false,
|
|
||||||
'message' => 'Transaksi gagal.',
|
|
||||||
'data' => $result
|
|
||||||
]);
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
DB::beginTransaction();
|
|
||||||
|
|
||||||
Transaction::where('id', $request->id)->update([
|
|
||||||
'status_transaksi' => 'failure',
|
|
||||||
'status_pembayaran' => 'cancel'
|
|
||||||
]);
|
|
||||||
|
|
||||||
TransactionDescription::create([
|
|
||||||
'transaction_id' => $request->id,
|
|
||||||
'status' => 'cancel',
|
|
||||||
'background' => 'bg-buyer',
|
|
||||||
'judul' => 'fas fa-exclamation',
|
|
||||||
'deskripsi' => auth()->user()->nama_depan . ' telah membatalkan transaksi.',
|
|
||||||
'user' => auth()->user()->email,
|
|
||||||
]);
|
|
||||||
|
|
||||||
DB::commit();
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'status' => true,
|
|
||||||
'message' => 'Transaksi berhasil dibatalkan',
|
|
||||||
]);
|
|
||||||
} catch (Throwable $e) {
|
|
||||||
DB::rollBack();
|
|
||||||
|
|
||||||
Log::error($e->getMessage());
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'status' => false,
|
|
||||||
'message' => 'Transaksi gagal dibatalkan',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function pendingTransaction(Request $request)
|
|
||||||
{
|
|
||||||
$auth = base64_encode(env('MIDTRANS_SERVER_KEY'));
|
|
||||||
|
|
||||||
$response = Http::withOptions([
|
|
||||||
'verify' => false,
|
|
||||||
])
|
|
||||||
->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([
|
|
||||||
'status' => false,
|
|
||||||
'message' => 'Terjadi error di bagian server.',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function complaintTransaction($id)
|
|
||||||
{
|
|
||||||
return view('user.refund.new-refund', compact('id'));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function onErrorTransaction(Request $request)
|
|
||||||
{
|
|
||||||
$auth = base64_encode(env('MIDTRANS_SERVER_KEY'));
|
|
||||||
|
|
||||||
$response = Http::withOptions([
|
|
||||||
'verify' => false,
|
|
||||||
])
|
|
||||||
->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'],
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($result['transaction_status'] == 'expire') {
|
|
||||||
TransactionDescription::create([
|
|
||||||
'transaction_id' => $request->id,
|
|
||||||
'status' => 'cancel',
|
|
||||||
'background' => 'bg-buyer',
|
|
||||||
'judul' => 'fas fa-exclamation',
|
|
||||||
'deskripsi' => 'Pembayaran sudah expire',
|
|
||||||
'user' => 'admin@example.net',
|
|
||||||
]);
|
|
||||||
|
|
||||||
DB::commit();
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'status' => false,
|
|
||||||
'message' => 'Pembayaran sudah expire, silahkan buat transaksi baru.',
|
|
||||||
]);
|
|
||||||
} elseif ($result['transaction'] == 'failure') {
|
|
||||||
TransactionDescription::create([
|
|
||||||
'transaction_id' => $request->id,
|
|
||||||
'status' => 'failure',
|
|
||||||
'background' => 'bg-buyer',
|
|
||||||
'judul' => 'fas fa-exclamation',
|
|
||||||
'deskripsi' => auth()->user()->nama_depan . ' telah membatalkan transaksi.',
|
|
||||||
'user' => 'admin@example.net',
|
|
||||||
]);
|
|
||||||
|
|
||||||
DB::commit();
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'status' => false,
|
|
||||||
'message' => 'Terjadi kesalahan di server saat pembayaran.',
|
|
||||||
'data' => $result,
|
|
||||||
]);
|
|
||||||
} else {
|
|
||||||
TransactionDescription::create([
|
|
||||||
'transaction_id' => $request->id,
|
|
||||||
'status' => $result['transaction_status'],
|
|
||||||
'background' => 'bg-primary',
|
|
||||||
'judul' => 'fas fa-exclamation',
|
|
||||||
'deskripsi' => 'Status tidak diketahui',
|
|
||||||
'user' => 'admin@example.net',
|
|
||||||
'keterangan' => $result['status_message'],
|
|
||||||
]);
|
|
||||||
|
|
||||||
DB::commit();
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'status' => true,
|
|
||||||
'message' => 'Terjadi kesalahan di server',
|
|
||||||
'data' => $result,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
} catch (Throwable $e) {
|
|
||||||
DB::rollBack();
|
|
||||||
|
|
||||||
Log::error($e->getMessage());
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'status' => false,
|
|
||||||
'message' => 'Terjadi error di bagian server.',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function onCloseTransaction(Request $request)
|
|
||||||
{
|
|
||||||
$auth = base64_encode(env('MIDTRANS_SERVER_KEY'));
|
|
||||||
|
|
||||||
$response = Http::withOptions([
|
|
||||||
'verify' => false,
|
|
||||||
])
|
|
||||||
->withHeaders([
|
|
||||||
'Content-Type' => 'application/json',
|
|
||||||
'Authorization' => "Basic $auth",
|
|
||||||
])
|
|
||||||
->get('https://api.sandbox.midtrans.com/v2/' . $request->id . '/status');
|
|
||||||
|
|
||||||
$result = json_decode($response->body(), true);
|
|
||||||
|
|
||||||
$status = $result['transaction_status'] == null ? '' : $result['transaction_status'];
|
|
||||||
|
|
||||||
if ($status == '') {
|
|
||||||
return response()->json([
|
|
||||||
'status' => true,
|
|
||||||
'message' => 'On Close',
|
|
||||||
]);
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
DB::beginTransaction();
|
|
||||||
|
|
||||||
if ($result['transaction_status'] == 'expire') {
|
|
||||||
Transaction::where('id', $request->id)->update([
|
|
||||||
'status_pembayaran' => $result['transaction_status'],
|
|
||||||
'status_transaksi' => 'failure',
|
|
||||||
]);
|
|
||||||
|
|
||||||
TransactionDescription::create([
|
|
||||||
'transaction_id' => $request->id,
|
|
||||||
'status' => 'cancel',
|
|
||||||
'background' => 'bg-buyer',
|
|
||||||
'judul' => 'fas fa-exclamation',
|
|
||||||
'deskripsi' => 'Pembayaran sudah expire',
|
|
||||||
'user' => 'admin@example.net',
|
|
||||||
]);
|
|
||||||
|
|
||||||
DB::commit();
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'status' => false,
|
|
||||||
'message' => 'Pembayaran sudah expire, silahkan buat transaksi baru.',
|
|
||||||
]);
|
|
||||||
} elseif ($result['transaction'] == 'failure') {
|
|
||||||
Transaction::where('id', $request->id)->update([
|
|
||||||
'status_pembayaran' => $result['transaction_status'],
|
|
||||||
'status_transaksi' => 'failure',
|
|
||||||
]);
|
|
||||||
|
|
||||||
TransactionDescription::create([
|
|
||||||
'transaction_id' => $request->id,
|
|
||||||
'status' => 'failure',
|
|
||||||
'background' => 'bg-buyer',
|
|
||||||
'judul' => 'fas fa-exclamation',
|
|
||||||
'deskripsi' => auth()->user()->nama_depan . ' telah membatalkan transaksi.',
|
|
||||||
'user' => 'admin@example.net',
|
|
||||||
]);
|
|
||||||
|
|
||||||
DB::commit();
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'status' => false,
|
|
||||||
'message' => 'Terjadi kesalahan di server saat pembayaran.',
|
|
||||||
]);
|
|
||||||
} else {
|
|
||||||
Transaction::where('id', $request->id)->update([
|
|
||||||
'status_pembayaran' => $result['transaction_status'],
|
|
||||||
'status_transaksi' => 'failure',
|
|
||||||
]);
|
|
||||||
|
|
||||||
TransactionDescription::create([
|
|
||||||
'transaction_id' => $request->id,
|
|
||||||
'status' => $result['transaction_status'],
|
|
||||||
'background' => 'bg-primary',
|
|
||||||
'judul' => 'fas fa-exclamation',
|
|
||||||
'deskripsi' => 'Status tidak diketahui.',
|
|
||||||
'user' => 'admin@example.net',
|
|
||||||
]);
|
|
||||||
|
|
||||||
DB::commit();
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'status' => true,
|
|
||||||
'message' => 'Terjadi kesalahan di server',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
} catch (Throwable $e) {
|
|
||||||
DB::rollBack();
|
|
||||||
|
|
||||||
Log::error($e->getMessage());
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'status' => false,
|
|
||||||
'message' => 'Terjadi error di bagian server.',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function listPembeli(Request $request)
|
|
||||||
{
|
|
||||||
try{
|
|
||||||
$subQuery = Transaction::join('users','transactions.penjual','=','users.email')
|
|
||||||
->where('transactions.pembeli',auth()->user()->email)
|
|
||||||
->select(
|
|
||||||
'transactions.id',
|
|
||||||
DB::raw("CONCAT(users.nama_depan,' ',users.nama_belakang) as nama_penjual"),
|
|
||||||
'transactions.nama_barang',
|
|
||||||
'transactions.total_harga',
|
|
||||||
'transactions.created_at',
|
|
||||||
'transactions.status_transaksi',
|
|
||||||
'transactions.token'
|
|
||||||
);
|
|
||||||
|
|
||||||
if($request->has('search') && !empty($request->search['value'])){
|
|
||||||
$searchPembeli = $request->search['value'];
|
|
||||||
if(!is_numeric($searchPembeli)){
|
|
||||||
$subQuery->where(function($a) use ($searchPembeli){
|
|
||||||
$a->whereRaw("LOWER(CONCAT(users.nama_depan,' ',users.nama_belakang)) LIKE ?",['%'.strtolower($searchPembeli).'%'])
|
|
||||||
->orWhereRaw('LOWER(transactions.nama_barang) LIKE ?',['%'.strtolower($searchPembeli).'%'])
|
|
||||||
->orWhereRaw('LOWER(transactions.status_transaksi) LIKE ?',['%'.strtolower($searchPembeli).'%']);
|
|
||||||
});
|
|
||||||
}else{
|
|
||||||
$subQuery->where(function($a) use ($searchPembeli){
|
|
||||||
$a->where('transactions.total_harga','=',$searchPembeli);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$queryPembeli = Transaction::from(DB::raw("({$subQuery->toSql()}) as tmp"))
|
|
||||||
->mergeBindings($subQuery->getQuery()) // Menggabungkan binding parameters
|
|
||||||
->select('*')
|
|
||||||
->get();
|
|
||||||
|
|
||||||
if ($request->ajax()) {
|
|
||||||
return DataTables::of($queryPembeli)
|
|
||||||
->addIndexColumn()
|
|
||||||
->addColumn('action', function ($row) {
|
|
||||||
$url = route('user-pembeli.show', ['id' => $row->id]);
|
|
||||||
$invoice = route('invoice.get',['id' => $row->id]);
|
|
||||||
$html_code = '
|
|
||||||
<div class="btn-group">
|
|
||||||
<button type="button" class="btn btn-primary dropdown-toggle"
|
|
||||||
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
|
||||||
....
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<ul class="dropdown-menu">
|
|
||||||
<li><a class="dropdown-item"
|
|
||||||
href="'.$url.'">Detail</a>
|
|
||||||
</li>
|
|
||||||
<li><a class="dropdown-item"
|
|
||||||
href="'.$invoice.'">Invoice</a>
|
|
||||||
</li>
|
|
||||||
<li><a class="dropdown-item" data-toggle="modal"
|
|
||||||
data-target="#modalTracking"
|
|
||||||
data-id="'.$row->id.'"
|
|
||||||
href="#">Tracking</a>
|
|
||||||
</li>';
|
|
||||||
|
|
||||||
if($row->status_transaksi == 'created'){
|
|
||||||
$html_code .= '
|
|
||||||
<li><a class="dropdown-item" id="bayar"
|
|
||||||
data-id="'.$row->id.'"
|
|
||||||
data-token="'.$row->token.'"
|
|
||||||
href="#">Bayar</a>
|
|
||||||
</li>
|
|
||||||
<li><a href="#" data-id="'.$row->id.'"
|
|
||||||
id="cancel" class="dropdown-item">Batal</a>
|
|
||||||
</li>
|
|
||||||
';
|
|
||||||
}
|
|
||||||
|
|
||||||
if($row->status_transaksi == 'sent'){
|
|
||||||
$html_code .= '
|
|
||||||
<li><a class="dropdown-item" data-toggle="modal"
|
|
||||||
data-target="#modalFinish"
|
|
||||||
data-id="'.$row->id.'"
|
|
||||||
href="#">Selesaikan</a>
|
|
||||||
</li>
|
|
||||||
';
|
|
||||||
}
|
|
||||||
|
|
||||||
$html_code .= '
|
|
||||||
</ul>
|
|
||||||
</div>';
|
|
||||||
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']);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function listPenjual(Request $request){
|
|
||||||
try{
|
|
||||||
$subQuery = Transaction::join('users','transactions.pembeli','=','users.email')
|
|
||||||
->where('transactions.penjual',auth()->user()->email)
|
|
||||||
->select(
|
|
||||||
'transactions.id',
|
|
||||||
DB::raw("CONCAT(users.nama_depan,' ',users.nama_belakang) as nama_pembeli"),
|
|
||||||
'transactions.nama_barang',
|
|
||||||
'transactions.total_harga',
|
|
||||||
'transactions.created_at',
|
|
||||||
'transactions.status_transaksi',
|
|
||||||
);
|
|
||||||
|
|
||||||
if($request->has('search') && !empty($request->search['value'])){
|
|
||||||
$searchPenjual = $request->search['value'];
|
|
||||||
if(!is_numeric($searchPenjual)){
|
|
||||||
$subQuery->where(function($a) use ($searchPenjual){
|
|
||||||
$a->whereRaw("LOWER(CONCAT(users.nama_depan,' ',users.nama_belakang)) LIKE ?",['%'.strtolower($searchPenjual).'%'])
|
|
||||||
->orWhereRaw('LOWER(transactions.nama_barang) LIKE ?',['%'.strtolower($searchPenjual).'%'])
|
|
||||||
->orWhereRaw('LOWER(transactions.status_transaksi) LIKE ?',['%'.strtolower($searchPenjual).'%']);
|
|
||||||
});
|
|
||||||
}else{
|
|
||||||
$subQuery->where(function($a) use ($searchPenjual){
|
|
||||||
$a->whereDay('transactions.created_at', '=', $searchPenjual)
|
|
||||||
->orWhereMonth('transactions.created_at', '=', $searchPenjual)
|
|
||||||
->orWhereYear('transactions.created_at', '=', $searchPenjual)
|
|
||||||
->orWhere('transactions.total_harga', '=', $searchPenjual);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$queryPenjual = Transaction::from(DB::raw("({$subQuery->toSql()}) as tmp"))
|
|
||||||
->mergeBindings($subQuery->getQuery()) // Menggabungkan binding parameters
|
|
||||||
->select('*')
|
|
||||||
->get();
|
|
||||||
|
|
||||||
if ($request->ajax()) {
|
|
||||||
return DataTables::of($queryPenjual)
|
|
||||||
->addIndexColumn()
|
|
||||||
->addColumn('action', function ($row) {
|
|
||||||
$url = route('user-penjual.show', ['id' => $row->id]);
|
|
||||||
$invoice = route('invoice.get',['id' => $row->id]);
|
|
||||||
$html_code = '
|
|
||||||
<div class="btn-group">
|
|
||||||
<button type="button" class="btn btn-primary dropdown-toggle"
|
|
||||||
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
|
||||||
....
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<ul class="dropdown-menu">
|
|
||||||
<li><a class="dropdown-item"
|
|
||||||
href="'.$url.'">Detail</a>
|
|
||||||
</li>
|
|
||||||
<li><a class="dropdown-item"
|
|
||||||
href="'.$invoice.'">Invoice</a>
|
|
||||||
</li>
|
|
||||||
<li><a class="dropdown-item" data-toggle="modal"
|
|
||||||
data-target="#modalTracking"
|
|
||||||
data-id="'.$row->id.'"
|
|
||||||
href="#">Tracking</a>
|
|
||||||
</li>';
|
|
||||||
|
|
||||||
if($row->status_transaksi == 'success'){
|
|
||||||
$html_code .= '
|
|
||||||
<li><a class="dropdown-item" id="processTransaction"
|
|
||||||
data-id="'.$row->id.'"
|
|
||||||
href="#">Proses Transaksi</a>
|
|
||||||
</li>
|
|
||||||
';
|
|
||||||
}
|
|
||||||
|
|
||||||
if($row->status_transaksi == 'progress'){
|
|
||||||
$html_code .= '
|
|
||||||
<li><a class="dropdown-item" id="sendOrder"
|
|
||||||
data-id="'.$row->id.'"
|
|
||||||
href="#">Kirim barang</a>
|
|
||||||
</li>
|
|
||||||
';
|
|
||||||
}
|
|
||||||
|
|
||||||
if($row->status_transaksi == 'sent'){
|
|
||||||
$html_code .= '
|
|
||||||
<li><a class="dropdown-item" data-toggle="modal"
|
|
||||||
data-target="#modalOrderSent"
|
|
||||||
data-id="'.$row->id.'"
|
|
||||||
href="#">Barang sudah sampai</a>
|
|
||||||
</li>
|
|
||||||
';
|
|
||||||
}
|
|
||||||
$html_code .= '
|
|
||||||
</ul>
|
|
||||||
</div>';
|
|
||||||
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']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function transactionTracking(Request $request){
|
public function transactionTracking(Request $request){
|
||||||
$data = TransactionDescription::where('transaction_id', $request->id)->get();
|
$data = TransactionDescription::where('transaction_id', $request->id)->get();
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^8.1",
|
"php": "^8.1",
|
||||||
|
"barryvdh/laravel-dompdf": "^2.0",
|
||||||
"guzzlehttp/guzzle": "^7.2",
|
"guzzlehttp/guzzle": "^7.2",
|
||||||
"intervention/image": "^2.7",
|
"intervention/image": "^2.7",
|
||||||
"laravel/framework": "^10.10",
|
"laravel/framework": "^10.10",
|
||||||
|
353
composer.lock
generated
353
composer.lock
generated
@ -4,8 +4,85 @@
|
|||||||
"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": "8a11a96f5b3b33624cb77d7ee7c3dba7",
|
"content-hash": "fb619bb949178b27fd06e732826b1686",
|
||||||
"packages": [
|
"packages": [
|
||||||
|
{
|
||||||
|
"name": "barryvdh/laravel-dompdf",
|
||||||
|
"version": "v2.0.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/barryvdh/laravel-dompdf.git",
|
||||||
|
"reference": "9843d2be423670fb434f4c978b3c0f4dd92c87a6"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/barryvdh/laravel-dompdf/zipball/9843d2be423670fb434f4c978b3c0f4dd92c87a6",
|
||||||
|
"reference": "9843d2be423670fb434f4c978b3c0f4dd92c87a6",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"dompdf/dompdf": "^2.0.1",
|
||||||
|
"illuminate/support": "^6|^7|^8|^9|^10",
|
||||||
|
"php": "^7.2 || ^8.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"nunomaduro/larastan": "^1|^2",
|
||||||
|
"orchestra/testbench": "^4|^5|^6|^7|^8",
|
||||||
|
"phpro/grumphp": "^1",
|
||||||
|
"squizlabs/php_codesniffer": "^3.5"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.0-dev"
|
||||||
|
},
|
||||||
|
"laravel": {
|
||||||
|
"providers": [
|
||||||
|
"Barryvdh\\DomPDF\\ServiceProvider"
|
||||||
|
],
|
||||||
|
"aliases": {
|
||||||
|
"Pdf": "Barryvdh\\DomPDF\\Facade\\Pdf",
|
||||||
|
"PDF": "Barryvdh\\DomPDF\\Facade\\Pdf"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Barryvdh\\DomPDF\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Barry vd. Heuvel",
|
||||||
|
"email": "barryvdh@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "A DOMPDF Wrapper for Laravel",
|
||||||
|
"keywords": [
|
||||||
|
"dompdf",
|
||||||
|
"laravel",
|
||||||
|
"pdf"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/barryvdh/laravel-dompdf/issues",
|
||||||
|
"source": "https://github.com/barryvdh/laravel-dompdf/tree/v2.0.1"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://fruitcake.nl",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/barryvdh",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2023-01-12T15:12:49+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "brick/math",
|
"name": "brick/math",
|
||||||
"version": "0.11.0",
|
"version": "0.11.0",
|
||||||
@ -304,6 +381,68 @@
|
|||||||
],
|
],
|
||||||
"time": "2022-12-15T16:57:16+00:00"
|
"time": "2022-12-15T16:57:16+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "dompdf/dompdf",
|
||||||
|
"version": "v2.0.3",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/dompdf/dompdf.git",
|
||||||
|
"reference": "e8d2d5e37e8b0b30f0732a011295ab80680d7e85"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/dompdf/dompdf/zipball/e8d2d5e37e8b0b30f0732a011295ab80680d7e85",
|
||||||
|
"reference": "e8d2d5e37e8b0b30f0732a011295ab80680d7e85",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-dom": "*",
|
||||||
|
"ext-mbstring": "*",
|
||||||
|
"masterminds/html5": "^2.0",
|
||||||
|
"phenx/php-font-lib": ">=0.5.4 <1.0.0",
|
||||||
|
"phenx/php-svg-lib": ">=0.3.3 <1.0.0",
|
||||||
|
"php": "^7.1 || ^8.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"ext-json": "*",
|
||||||
|
"ext-zip": "*",
|
||||||
|
"mockery/mockery": "^1.3",
|
||||||
|
"phpunit/phpunit": "^7.5 || ^8 || ^9",
|
||||||
|
"squizlabs/php_codesniffer": "^3.5"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"ext-gd": "Needed to process images",
|
||||||
|
"ext-gmagick": "Improves image processing performance",
|
||||||
|
"ext-imagick": "Improves image processing performance",
|
||||||
|
"ext-zlib": "Needed for pdf stream compression"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Dompdf\\": "src/"
|
||||||
|
},
|
||||||
|
"classmap": [
|
||||||
|
"lib/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"LGPL-2.1"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "The Dompdf Community",
|
||||||
|
"homepage": "https://github.com/dompdf/dompdf/blob/master/AUTHORS.md"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "DOMPDF is a CSS 2.1 compliant HTML to PDF converter",
|
||||||
|
"homepage": "https://github.com/dompdf/dompdf",
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/dompdf/dompdf/issues",
|
||||||
|
"source": "https://github.com/dompdf/dompdf/tree/v2.0.3"
|
||||||
|
},
|
||||||
|
"time": "2023-02-07T12:51:48+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "dragonmantank/cron-expression",
|
"name": "dragonmantank/cron-expression",
|
||||||
"version": "v3.3.3",
|
"version": "v3.3.3",
|
||||||
@ -2194,6 +2333,73 @@
|
|||||||
],
|
],
|
||||||
"time": "2023-10-17T14:13:20+00:00"
|
"time": "2023-10-17T14:13:20+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "masterminds/html5",
|
||||||
|
"version": "2.8.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/Masterminds/html5-php.git",
|
||||||
|
"reference": "f47dcf3c70c584de14f21143c55d9939631bc6cf"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/Masterminds/html5-php/zipball/f47dcf3c70c584de14f21143c55d9939631bc6cf",
|
||||||
|
"reference": "f47dcf3c70c584de14f21143c55d9939631bc6cf",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-dom": "*",
|
||||||
|
"php": ">=5.3.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "^4.8.35 || ^5.7.21 || ^6 || ^7 || ^8"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.7-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Masterminds\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Matt Butcher",
|
||||||
|
"email": "technosophos@gmail.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Matt Farina",
|
||||||
|
"email": "matt@mattfarina.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Asmir Mustafic",
|
||||||
|
"email": "goetas@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "An HTML5 parser and serializer.",
|
||||||
|
"homepage": "http://masterminds.github.io/html5-php",
|
||||||
|
"keywords": [
|
||||||
|
"HTML5",
|
||||||
|
"dom",
|
||||||
|
"html",
|
||||||
|
"parser",
|
||||||
|
"querypath",
|
||||||
|
"serializer",
|
||||||
|
"xml"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/Masterminds/html5-php/issues",
|
||||||
|
"source": "https://github.com/Masterminds/html5-php/tree/2.8.1"
|
||||||
|
},
|
||||||
|
"time": "2023-05-10T11:58:31+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "monolog/monolog",
|
"name": "monolog/monolog",
|
||||||
"version": "3.5.0",
|
"version": "3.5.0",
|
||||||
@ -2827,6 +3033,96 @@
|
|||||||
},
|
},
|
||||||
"time": "2023-04-30T00:54:53+00:00"
|
"time": "2023-04-30T00:54:53+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "phenx/php-font-lib",
|
||||||
|
"version": "0.5.4",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/dompdf/php-font-lib.git",
|
||||||
|
"reference": "dd448ad1ce34c63d09baccd05415e361300c35b4"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/dompdf/php-font-lib/zipball/dd448ad1ce34c63d09baccd05415e361300c35b4",
|
||||||
|
"reference": "dd448ad1ce34c63d09baccd05415e361300c35b4",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-mbstring": "*"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"symfony/phpunit-bridge": "^3 || ^4 || ^5"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"FontLib\\": "src/FontLib"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"LGPL-3.0"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Fabien Ménager",
|
||||||
|
"email": "fabien.menager@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "A library to read, parse, export and make subsets of different types of font files.",
|
||||||
|
"homepage": "https://github.com/PhenX/php-font-lib",
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/dompdf/php-font-lib/issues",
|
||||||
|
"source": "https://github.com/dompdf/php-font-lib/tree/0.5.4"
|
||||||
|
},
|
||||||
|
"time": "2021-12-17T19:44:54+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "phenx/php-svg-lib",
|
||||||
|
"version": "0.5.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/dompdf/php-svg-lib.git",
|
||||||
|
"reference": "76876c6cf3080bcb6f249d7d59705108166a6685"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/dompdf/php-svg-lib/zipball/76876c6cf3080bcb6f249d7d59705108166a6685",
|
||||||
|
"reference": "76876c6cf3080bcb6f249d7d59705108166a6685",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-mbstring": "*",
|
||||||
|
"php": "^7.1 || ^8.0",
|
||||||
|
"sabberworm/php-css-parser": "^8.4"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Svg\\": "src/Svg"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"LGPL-3.0"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Fabien Ménager",
|
||||||
|
"email": "fabien.menager@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "A library to read, parse and export to PDF SVG files.",
|
||||||
|
"homepage": "https://github.com/PhenX/php-svg-lib",
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/dompdf/php-svg-lib/issues",
|
||||||
|
"source": "https://github.com/dompdf/php-svg-lib/tree/0.5.0"
|
||||||
|
},
|
||||||
|
"time": "2022-09-06T12:16:56+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "phpoption/phpoption",
|
"name": "phpoption/phpoption",
|
||||||
"version": "1.9.1",
|
"version": "1.9.1",
|
||||||
@ -3680,6 +3976,59 @@
|
|||||||
],
|
],
|
||||||
"time": "2023-11-08T05:53:05+00:00"
|
"time": "2023-11-08T05:53:05+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "sabberworm/php-css-parser",
|
||||||
|
"version": "8.4.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/sabberworm/PHP-CSS-Parser.git",
|
||||||
|
"reference": "e41d2140031d533348b2192a83f02d8dd8a71d30"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/sabberworm/PHP-CSS-Parser/zipball/e41d2140031d533348b2192a83f02d8dd8a71d30",
|
||||||
|
"reference": "e41d2140031d533348b2192a83f02d8dd8a71d30",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-iconv": "*",
|
||||||
|
"php": ">=5.6.20"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"codacy/coverage": "^1.4",
|
||||||
|
"phpunit/phpunit": "^4.8.36"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"ext-mbstring": "for parsing UTF-8 CSS"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Sabberworm\\CSS\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Raphael Schweikert"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Parser for CSS Files written in PHP",
|
||||||
|
"homepage": "https://www.sabberworm.com/blog/2010/6/10/php-css-parser",
|
||||||
|
"keywords": [
|
||||||
|
"css",
|
||||||
|
"parser",
|
||||||
|
"stylesheet"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/sabberworm/PHP-CSS-Parser/issues",
|
||||||
|
"source": "https://github.com/sabberworm/PHP-CSS-Parser/tree/8.4.0"
|
||||||
|
},
|
||||||
|
"time": "2021-12-11T13:40:54+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "stella-maris/clock",
|
"name": "stella-maris/clock",
|
||||||
"version": "0.1.7",
|
"version": "0.1.7",
|
||||||
@ -9350,5 +9699,5 @@
|
|||||||
"php": "^8.1"
|
"php": "^8.1"
|
||||||
},
|
},
|
||||||
"platform-dev": [],
|
"platform-dev": [],
|
||||||
"plugin-api-version": "2.3.0"
|
"plugin-api-version": "2.6.0"
|
||||||
}
|
}
|
||||||
|
284
config/dompdf.php
Normal file
284
config/dompdf.php
Normal file
@ -0,0 +1,284 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return array(
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Settings
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Set some default values. It is possible to add all defines that can be set
|
||||||
|
| in dompdf_config.inc.php. You can also override the entire config file.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
'show_warnings' => false, // Throw an Exception on warnings from dompdf
|
||||||
|
|
||||||
|
'public_path' => null, // Override the public path if needed
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Dejavu Sans font is missing glyphs for converted entities, turn it off if you need to show € and £.
|
||||||
|
*/
|
||||||
|
'convert_entities' => true,
|
||||||
|
|
||||||
|
'options' => array(
|
||||||
|
/**
|
||||||
|
* The location of the DOMPDF font directory
|
||||||
|
*
|
||||||
|
* The location of the directory where DOMPDF will store fonts and font metrics
|
||||||
|
* Note: This directory must exist and be writable by the webserver process.
|
||||||
|
* *Please note the trailing slash.*
|
||||||
|
*
|
||||||
|
* Notes regarding fonts:
|
||||||
|
* Additional .afm font metrics can be added by executing load_font.php from command line.
|
||||||
|
*
|
||||||
|
* Only the original "Base 14 fonts" are present on all pdf viewers. Additional fonts must
|
||||||
|
* be embedded in the pdf file or the PDF may not display correctly. This can significantly
|
||||||
|
* increase file size unless font subsetting is enabled. Before embedding a font please
|
||||||
|
* review your rights under the font license.
|
||||||
|
*
|
||||||
|
* Any font specification in the source HTML is translated to the closest font available
|
||||||
|
* in the font directory.
|
||||||
|
*
|
||||||
|
* The pdf standard "Base 14 fonts" are:
|
||||||
|
* Courier, Courier-Bold, Courier-BoldOblique, Courier-Oblique,
|
||||||
|
* Helvetica, Helvetica-Bold, Helvetica-BoldOblique, Helvetica-Oblique,
|
||||||
|
* Times-Roman, Times-Bold, Times-BoldItalic, Times-Italic,
|
||||||
|
* Symbol, ZapfDingbats.
|
||||||
|
*/
|
||||||
|
"font_dir" => storage_path('fonts'), // advised by dompdf (https://github.com/dompdf/dompdf/pull/782)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The location of the DOMPDF font cache directory
|
||||||
|
*
|
||||||
|
* This directory contains the cached font metrics for the fonts used by DOMPDF.
|
||||||
|
* This directory can be the same as DOMPDF_FONT_DIR
|
||||||
|
*
|
||||||
|
* Note: This directory must exist and be writable by the webserver process.
|
||||||
|
*/
|
||||||
|
"font_cache" => storage_path('fonts'),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The location of a temporary directory.
|
||||||
|
*
|
||||||
|
* The directory specified must be writeable by the webserver process.
|
||||||
|
* The temporary directory is required to download remote images and when
|
||||||
|
* using the PFDLib back end.
|
||||||
|
*/
|
||||||
|
"temp_dir" => sys_get_temp_dir(),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ==== IMPORTANT ====
|
||||||
|
*
|
||||||
|
* dompdf's "chroot": Prevents dompdf from accessing system files or other
|
||||||
|
* files on the webserver. All local files opened by dompdf must be in a
|
||||||
|
* subdirectory of this directory. DO NOT set it to '/' since this could
|
||||||
|
* allow an attacker to use dompdf to read any files on the server. This
|
||||||
|
* should be an absolute path.
|
||||||
|
* This is only checked on command line call by dompdf.php, but not by
|
||||||
|
* direct class use like:
|
||||||
|
* $dompdf = new DOMPDF(); $dompdf->load_html($htmldata); $dompdf->render(); $pdfdata = $dompdf->output();
|
||||||
|
*/
|
||||||
|
"chroot" => realpath(base_path()),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Protocol whitelist
|
||||||
|
*
|
||||||
|
* Protocols and PHP wrappers allowed in URIs, and the validation rules
|
||||||
|
* that determine if a resouce may be loaded. Full support is not guaranteed
|
||||||
|
* for the protocols/wrappers specified
|
||||||
|
* by this array.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
'allowed_protocols' => [
|
||||||
|
"file://" => ["rules" => []],
|
||||||
|
"http://" => ["rules" => []],
|
||||||
|
"https://" => ["rules" => []]
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
'log_output_file' => null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to enable font subsetting or not.
|
||||||
|
*/
|
||||||
|
"enable_font_subsetting" => false,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The PDF rendering backend to use
|
||||||
|
*
|
||||||
|
* Valid settings are 'PDFLib', 'CPDF' (the bundled R&OS PDF class), 'GD' and
|
||||||
|
* 'auto'. 'auto' will look for PDFLib and use it if found, or if not it will
|
||||||
|
* fall back on CPDF. 'GD' renders PDFs to graphic files. {@link
|
||||||
|
* Canvas_Factory} ultimately determines which rendering class to instantiate
|
||||||
|
* based on this setting.
|
||||||
|
*
|
||||||
|
* Both PDFLib & CPDF rendering backends provide sufficient rendering
|
||||||
|
* capabilities for dompdf, however additional features (e.g. object,
|
||||||
|
* image and font support, etc.) differ between backends. Please see
|
||||||
|
* {@link PDFLib_Adapter} for more information on the PDFLib backend
|
||||||
|
* and {@link CPDF_Adapter} and lib/class.pdf.php for more information
|
||||||
|
* on CPDF. Also see the documentation for each backend at the links
|
||||||
|
* below.
|
||||||
|
*
|
||||||
|
* The GD rendering backend is a little different than PDFLib and
|
||||||
|
* CPDF. Several features of CPDF and PDFLib are not supported or do
|
||||||
|
* not make any sense when creating image files. For example,
|
||||||
|
* multiple pages are not supported, nor are PDF 'objects'. Have a
|
||||||
|
* look at {@link GD_Adapter} for more information. GD support is
|
||||||
|
* experimental, so use it at your own risk.
|
||||||
|
*
|
||||||
|
* @link http://www.pdflib.com
|
||||||
|
* @link http://www.ros.co.nz/pdf
|
||||||
|
* @link http://www.php.net/image
|
||||||
|
*/
|
||||||
|
"pdf_backend" => "CPDF",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PDFlib license key
|
||||||
|
*
|
||||||
|
* If you are using a licensed, commercial version of PDFlib, specify
|
||||||
|
* your license key here. If you are using PDFlib-Lite or are evaluating
|
||||||
|
* the commercial version of PDFlib, comment out this setting.
|
||||||
|
*
|
||||||
|
* @link http://www.pdflib.com
|
||||||
|
*
|
||||||
|
* If pdflib present in web server and auto or selected explicitely above,
|
||||||
|
* a real license code must exist!
|
||||||
|
*/
|
||||||
|
//"DOMPDF_PDFLIB_LICENSE" => "your license key here",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* html target media view which should be rendered into pdf.
|
||||||
|
* List of types and parsing rules for future extensions:
|
||||||
|
* http://www.w3.org/TR/REC-html40/types.html
|
||||||
|
* screen, tty, tv, projection, handheld, print, braille, aural, all
|
||||||
|
* Note: aural is deprecated in CSS 2.1 because it is replaced by speech in CSS 3.
|
||||||
|
* Note, even though the generated pdf file is intended for print output,
|
||||||
|
* the desired content might be different (e.g. screen or projection view of html file).
|
||||||
|
* Therefore allow specification of content here.
|
||||||
|
*/
|
||||||
|
"default_media_type" => "screen",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default paper size.
|
||||||
|
*
|
||||||
|
* North America standard is "letter"; other countries generally "a4"
|
||||||
|
*
|
||||||
|
* @see CPDF_Adapter::PAPER_SIZES for valid sizes ('letter', 'legal', 'A4', etc.)
|
||||||
|
*/
|
||||||
|
"default_paper_size" => "a4",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default paper orientation.
|
||||||
|
*
|
||||||
|
* The orientation of the page (portrait or landscape).
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
'default_paper_orientation' => "portrait",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default font family
|
||||||
|
*
|
||||||
|
* Used if no suitable fonts can be found. This must exist in the font folder.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
"default_font" => "serif",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Image DPI setting
|
||||||
|
*
|
||||||
|
* This setting determines the default DPI setting for images and fonts. The
|
||||||
|
* DPI may be overridden for inline images by explictly setting the
|
||||||
|
* image's width & height style attributes (i.e. if the image's native
|
||||||
|
* width is 600 pixels and you specify the image's width as 72 points,
|
||||||
|
* the image will have a DPI of 600 in the rendered PDF. The DPI of
|
||||||
|
* background images can not be overridden and is controlled entirely
|
||||||
|
* via this parameter.
|
||||||
|
*
|
||||||
|
* For the purposes of DOMPDF, pixels per inch (PPI) = dots per inch (DPI).
|
||||||
|
* If a size in html is given as px (or without unit as image size),
|
||||||
|
* this tells the corresponding size in pt.
|
||||||
|
* This adjusts the relative sizes to be similar to the rendering of the
|
||||||
|
* html page in a reference browser.
|
||||||
|
*
|
||||||
|
* In pdf, always 1 pt = 1/72 inch
|
||||||
|
*
|
||||||
|
* Rendering resolution of various browsers in px per inch:
|
||||||
|
* Windows Firefox and Internet Explorer:
|
||||||
|
* SystemControl->Display properties->FontResolution: Default:96, largefonts:120, custom:?
|
||||||
|
* Linux Firefox:
|
||||||
|
* about:config *resolution: Default:96
|
||||||
|
* (xorg screen dimension in mm and Desktop font dpi settings are ignored)
|
||||||
|
*
|
||||||
|
* Take care about extra font/image zoom factor of browser.
|
||||||
|
*
|
||||||
|
* In images, <img> size in pixel attribute, img css style, are overriding
|
||||||
|
* the real image dimension in px for rendering.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
"dpi" => 96,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable inline PHP
|
||||||
|
*
|
||||||
|
* If this setting is set to true then DOMPDF will automatically evaluate
|
||||||
|
* inline PHP contained within <script type="text/php"> ... </script> tags.
|
||||||
|
*
|
||||||
|
* Enabling this for documents you do not trust (e.g. arbitrary remote html
|
||||||
|
* pages) is a security risk. Set this option to false if you wish to process
|
||||||
|
* untrusted documents.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
"enable_php" => false,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable inline Javascript
|
||||||
|
*
|
||||||
|
* If this setting is set to true then DOMPDF will automatically insert
|
||||||
|
* JavaScript code contained within <script type="text/javascript"> ... </script> tags.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
"enable_javascript" => true,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable remote file access
|
||||||
|
*
|
||||||
|
* If this setting is set to true, DOMPDF will access remote sites for
|
||||||
|
* images and CSS files as required.
|
||||||
|
* This is required for part of test case www/test/image_variants.html through www/examples.php
|
||||||
|
*
|
||||||
|
* Attention!
|
||||||
|
* This can be a security risk, in particular in combination with DOMPDF_ENABLE_PHP and
|
||||||
|
* allowing remote access to dompdf.php or on allowing remote html code to be passed to
|
||||||
|
* $dompdf = new DOMPDF(, $dompdf->load_html(...,
|
||||||
|
* This allows anonymous users to download legally doubtful internet content which on
|
||||||
|
* tracing back appears to being downloaded by your server, or allows malicious php code
|
||||||
|
* in remote html pages to be executed by your server with your account privileges.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
"enable_remote" => true,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A ratio applied to the fonts height to be more like browsers' line height
|
||||||
|
*/
|
||||||
|
"font_height_ratio" => 1.1,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the HTML5 Lib parser
|
||||||
|
*
|
||||||
|
* @deprecated This feature is now always on in dompdf 2.x
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
"enable_html5_parser" => true,
|
||||||
|
),
|
||||||
|
|
||||||
|
|
||||||
|
);
|
@ -162,9 +162,9 @@
|
|||||||
<div class="col-lg-4">
|
<div class="col-lg-4">
|
||||||
<div class="input-group mt-4">
|
<div class="input-group mt-4">
|
||||||
<input type="text" name="from-to" class="form-control" id="date-range">
|
<input type="text" name="from-to" class="form-control" id="date-range">
|
||||||
<span class="input-group-text bg-primary text-white align-items-center">
|
<label class="input-group-text bg-primary text-white align-items-center" for="date-range">
|
||||||
<i class="mdi mdi-calendar-range font-13"></i>
|
<i class="mdi mdi-calendar-range font-13"></i>
|
||||||
</span>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="card gradient-bottom">
|
<div class="card gradient-bottom">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
@ -431,6 +431,10 @@
|
|||||||
],
|
],
|
||||||
'All time': [moment().subtract(30, 'year').startOf('month'), moment().endOf('month')],
|
'All time': [moment().subtract(30, 'year').startOf('month'), moment().endOf('month')],
|
||||||
}
|
}
|
||||||
|
}, function(start, end, label) {
|
||||||
|
// Menangkap rentang tanggal yang dipilih dan menampilkan di console
|
||||||
|
console.log('New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format(
|
||||||
|
'YYYY-MM-DD'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="col-md-12">
|
{{-- <div class="col-md-12">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h2>Transaction</h2>
|
<h2>Transaction</h2>
|
||||||
@ -162,7 +162,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> --}}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
@ -106,7 +106,8 @@
|
|||||||
<div class="section-title">Rangkuman Transaksi</div>
|
<div class="section-title">Rangkuman Transaksi</div>
|
||||||
<p class="section-lead">Semua barang yang didaftarkan dalam transaksi.</p>
|
<p class="section-lead">Semua barang yang didaftarkan dalam transaksi.</p>
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped table-hover table-md">
|
<table class="table table-striped table-hover table-md"
|
||||||
|
style="font-size: 16px;">
|
||||||
<tr>
|
<tr>
|
||||||
<th data-width="40">#</th>
|
<th data-width="40">#</th>
|
||||||
<th>Nama Barang</th>
|
<th>Nama Barang</th>
|
||||||
@ -117,17 +118,19 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>1</td>
|
<td>1</td>
|
||||||
<td>{{ $transaction->nama_barang }}</td>
|
<td>{{ $transaction->nama_barang }}</td>
|
||||||
<td class="text-center">{{ $transaction->harga_barang }}</td>
|
<td class="text-center">
|
||||||
|
Rp.{{ number_format($transaction->harga_barang, 2, ',', '.') }}
|
||||||
|
</td>
|
||||||
<td class="text-center">{{ $transaction->jumlah_barang }}</td>
|
<td class="text-center">{{ $transaction->jumlah_barang }}</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
{{ $transaction->harga_barang * $transaction->jumlah_barang }}
|
Rp.{{ number_format($transaction->total_harga, 2, ',', '.') }}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mt-4">
|
<div class="row mt-4">
|
||||||
<div class="col-lg-8">
|
<div class="col-lg-8">
|
||||||
<div class="section-title">Payment Method</div>
|
<div class="section-title">Metode Pembayaran</div>
|
||||||
<div class="images">
|
<div class="images">
|
||||||
@if ($transaction->metode_pembayaran != null)
|
@if ($transaction->metode_pembayaran != null)
|
||||||
<img style="width: 20%; height: 20%;"
|
<img style="width: 20%; height: 20%;"
|
||||||
@ -140,21 +143,20 @@
|
|||||||
<div class="invoice-detail-item">
|
<div class="invoice-detail-item">
|
||||||
<div class="invoice-detail-name">Subtotal</div>
|
<div class="invoice-detail-name">Subtotal</div>
|
||||||
<div class="invoice-detail-value">Rp
|
<div class="invoice-detail-value">Rp
|
||||||
{{ number_format($transaction->total_harga, 2, ',', '.') }}
|
Rp.{{ number_format($transaction->total_harga, 2, ',', '.') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="invoice-detail-item">
|
<div class="invoice-detail-item">
|
||||||
<div class="invoice-detail-name">Biaya Admin</div>
|
<div class="invoice-detail-name">Biaya Admin</div>
|
||||||
<div class="invoice-detail-value">
|
<div class="invoice-detail-value">
|
||||||
Rp
|
Rp.{{ number_format($transaction->total_keuntungan, 2, ',', '.') }}
|
||||||
{{ number_format($transaction->total_keuntungan, 2, ',', '.') }}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr class="mt-2 mb-2">
|
<hr class="mt-2 mb-2">
|
||||||
<div class="invoice-detail-item">
|
<div class="invoice-detail-item">
|
||||||
<div class="invoice-detail-name">Total</div>
|
<div class="invoice-detail-name">Total</div>
|
||||||
<div class="invoice-detail-value invoice-detail-value-lg">
|
<div class="invoice-detail-value invoice-detail-value-lg">
|
||||||
Rp {{ number_format($transaction->total_bayar, 2, ',', '.') }}
|
Rp.{{ number_format($transaction->total_bayar, 2, ',', '.') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -278,6 +278,83 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#table-penjual').on('click', '#denyTransaction', function() {
|
||||||
|
const id = $(this).data('id');
|
||||||
|
const csrfToken = $('meta[name="csrf-token"]').attr('content');
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Tolak Transaksi?',
|
||||||
|
text: 'Apakah anda yakin untuk menolak transaksi ini?',
|
||||||
|
icon: 'question',
|
||||||
|
showCancelButton: true,
|
||||||
|
cancelButtonText: 'Tunggu, lihat detail dahulu.',
|
||||||
|
confirmButtonText: 'Ya, tolak transaksi.'
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
const {
|
||||||
|
value: complaint
|
||||||
|
} = await Swal.fire({
|
||||||
|
title: 'Tolak Transaksi?',
|
||||||
|
inputLabel: 'Berikan alasan untuk menolak transaksi ini',
|
||||||
|
input: 'text',
|
||||||
|
inputPlaceholder: 'Cth: Salah penjual.'
|
||||||
|
});
|
||||||
|
|
||||||
|
if (complaint) {
|
||||||
|
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.deny') }}",
|
||||||
|
type: 'PUT',
|
||||||
|
data: {
|
||||||
|
id: id,
|
||||||
|
complaint: complaint
|
||||||
|
},
|
||||||
|
success: function(response) {
|
||||||
|
Swal.fire({
|
||||||
|
title: response.status ? 'Berhasil' :
|
||||||
|
'Gagal',
|
||||||
|
text: response.message,
|
||||||
|
icon: response.status ? 'success' :
|
||||||
|
'error',
|
||||||
|
}).then(function() {
|
||||||
|
Swal.close();
|
||||||
|
if (response.status) {
|
||||||
|
listPenjual.ajax.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: function(error) {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Gagal',
|
||||||
|
text: 'Pemrosesan transaksi gagal',
|
||||||
|
icon: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Swal.close();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
location.href = "{{ route('user-transaction.show', ':id') }}".replace(':id',
|
||||||
|
id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
$('#table-penjual').on('click', '#sendOrder', function() {
|
$('#table-penjual').on('click', '#sendOrder', function() {
|
||||||
const id = $(this).data('id');
|
const id = $(this).data('id');
|
||||||
const csrfToken = $('meta[name="csrf-token"]').attr('content');
|
const csrfToken = $('meta[name="csrf-token"]').attr('content');
|
||||||
|
@ -17,12 +17,12 @@
|
|||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header d-flex justify-content-center bg-primary text-white">
|
<div class="card-header d-flex justify-content-center bg-primary text-white font-weight-bold"
|
||||||
<img class="mr-3 rounded" width="150"
|
style="font-size: 36px; margin-bottom: -10px;">
|
||||||
src="{{ asset('assets/images/google-removebg-preview.png') }}">
|
REKBER
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex justify-content-center bg-primary text-white">
|
<div class="d-flex justify-content-center bg-primary text-white">
|
||||||
<h2 class="mb-0">Verifikasi Email</h2>
|
<p class="mb-3">Verifikasi Email</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
330
resources/views/invoice/export-invoice.blade.php
Normal file
330
resources/views/invoice/export-invoice.blade.php
Normal file
@ -0,0 +1,330 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta content="width=device-width, initial-scale=1, maximum-scale=1, shrink-to-fit=no" name="viewport">
|
||||||
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||||
|
<title>REKBER</title>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="{{ asset('assets/modules/bootstrap/css/bootstrap.min.css') }}">
|
||||||
|
<link rel="stylesheet" href="{{ asset('assets/css/style.css') }}">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
main,
|
||||||
|
section {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1,
|
||||||
|
h2,
|
||||||
|
h3,
|
||||||
|
h4,
|
||||||
|
h5,
|
||||||
|
h6 {
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-content {
|
||||||
|
transition: all 0.5s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-content {
|
||||||
|
padding-left: 280px;
|
||||||
|
padding-right: 30px;
|
||||||
|
padding-top: 80px;
|
||||||
|
width: 100%;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-content {
|
||||||
|
padding-left: 30px;
|
||||||
|
padding-right: 30px;
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section>*:first-child {
|
||||||
|
margin-top: -7px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section .section-title+.section-lead {
|
||||||
|
margin-top: -20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section .section-buyer+.section-lead {
|
||||||
|
margin-top: -20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section .section-seller+.section-lead {
|
||||||
|
margin-top: -20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section .section-lead {
|
||||||
|
margin-left: 45px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section .section-title {
|
||||||
|
font-size: 18px;
|
||||||
|
color: #191d21;
|
||||||
|
font-weight: 600;
|
||||||
|
position: relative;
|
||||||
|
margin: 30px 0 25px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section .section-title:before {
|
||||||
|
content: " ";
|
||||||
|
border-radius: 5px;
|
||||||
|
height: 8px;
|
||||||
|
width: 30px;
|
||||||
|
background-color: #900c3f;
|
||||||
|
display: inline-block;
|
||||||
|
float: left;
|
||||||
|
margin-top: 6px;
|
||||||
|
margin-right: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice {
|
||||||
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.03);
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 3px;
|
||||||
|
border: none;
|
||||||
|
position: relative;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
padding: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice .invoice-title .invoice-number {
|
||||||
|
float: right;
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 700;
|
||||||
|
margin-top: -45px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice hr {
|
||||||
|
margin-top: 40px;
|
||||||
|
margin-bottom: 40px;
|
||||||
|
border-top-color: #f9f9f9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice .invoice-detail-item {
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice .invoice-detail-item .invoice-detail-name {
|
||||||
|
letter-spacing: 0.3px;
|
||||||
|
color: #98a6ad;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice .invoice-detail-item .invoice-detail-value {
|
||||||
|
font-size: 18px;
|
||||||
|
color: #34395e;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice .invoice-detail-item .invoice-detail-value.invoice-detail-value-lg {
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row {
|
||||||
|
display: -ms-flexbox;
|
||||||
|
display: flex;
|
||||||
|
-ms-flex-wrap: wrap;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin-right: -15px;
|
||||||
|
margin-left: -15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.col,
|
||||||
|
.col-lg-12,
|
||||||
|
.col-md-6,
|
||||||
|
.col-lg-4,
|
||||||
|
.col-lg-8 {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
min-height: 1px;
|
||||||
|
padding-right: 15px;
|
||||||
|
padding-left: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.col-lg-12 {
|
||||||
|
-ms-flex: 0 0 100%;
|
||||||
|
flex: 0 0 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.col-md-6 {
|
||||||
|
-ms-flex: 0 0 50%;
|
||||||
|
flex: 0 0 50%;
|
||||||
|
max-width: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.col-lg-4 {
|
||||||
|
-ms-flex: 0 0 33.333333%;
|
||||||
|
flex: 0 0 33.333333%;
|
||||||
|
max-width: 33.333333%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.col-lg-8 {
|
||||||
|
-ms-flex: 0 0 66.666667%;
|
||||||
|
flex: 0 0 66.666667%;
|
||||||
|
max-width: 66.666667%;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
.text-md-left {
|
||||||
|
text-align: left !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-md-right {
|
||||||
|
text-align: right !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-md-center {
|
||||||
|
text-align: center !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-right {
|
||||||
|
text-align: right !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-center {
|
||||||
|
text-align: center !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mt-4,
|
||||||
|
.my-4 {
|
||||||
|
margin-top: 1.5rem !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<main id="main">
|
||||||
|
<div class="main-content">
|
||||||
|
<section class="section">
|
||||||
|
<div class="section-body">
|
||||||
|
<div class="invoice">
|
||||||
|
<div class="invoice-print">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="invoice-title">
|
||||||
|
<h2>Invoice</h2>
|
||||||
|
<div class="invoice-number">Order #{{ $transaction->id }}</div>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<address>
|
||||||
|
<strong>Pembeli:</strong><br>
|
||||||
|
{{ ucwords(strtolower($transaction->data_pembeli->nama_depan . ' ' . $transaction->data_pembeli->nama_belakang)) }}<br>
|
||||||
|
{{ ucwords(strtolower($transaction->data_pembeli->alamat)) }}<br>
|
||||||
|
{{ ucwords(strtolower($transaction->data_pembeli->getVillageName() . ', ' . $transaction->data_pembeli->getDistrictName())) }}<br>
|
||||||
|
{{ ucwords(strtolower($transaction->data_pembeli->getCityName() . ', ' . $transaction->data_pembeli->getProvinceName())) }}
|
||||||
|
</address>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6 text-md-right">
|
||||||
|
<address>
|
||||||
|
<strong>Penjual:</strong><br>
|
||||||
|
{{ ucwords(strtolower($transaction->data_penjual->nama_depan . ' ' . $transaction->data_penjual->nama_belakang)) }}<br>
|
||||||
|
{{ ucwords(strtolower($transaction->data_penjual->alamat)) }}<br>
|
||||||
|
{{ ucwords(strtolower($transaction->data_penjual->getVillageName() . ', ' . $transaction->data_penjual->getDistrictName())) }}<br>
|
||||||
|
{{ ucwords(strtolower($transaction->data_penjual->getCityName() . ', ' . $transaction->data_penjual->getProvinceName())) }}
|
||||||
|
</address>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<address>
|
||||||
|
<strong>Payment Method:</strong><br>
|
||||||
|
Visa ending **** 4242<br>
|
||||||
|
npannisa@gmail.com
|
||||||
|
</address>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6 text-md-right">
|
||||||
|
<address>
|
||||||
|
<strong>Tanggal Transaksi:</strong><br>
|
||||||
|
{{ $transaction->created_at->format('d M Y, g:i') }}<br><br>
|
||||||
|
</address>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mt-4">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="section-title">Rangkuman Transaksi</div>
|
||||||
|
<p class="section-lead">Semua barang yang didaftarkan dalam transaksi.</p>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped table-hover table-md"
|
||||||
|
style="font-size: 16px;">
|
||||||
|
<tr>
|
||||||
|
<th data-width="40">#</th>
|
||||||
|
<th>Nama Barang</th>
|
||||||
|
<th class="text-center">Harga</th>
|
||||||
|
<th class="text-center">Jumlah</th>
|
||||||
|
<th class="text-right">Total</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>1</td>
|
||||||
|
<td>{{ $transaction->nama_barang }}</td>
|
||||||
|
<td class="text-center">
|
||||||
|
Rp.{{ number_format($transaction->harga_barang, 2, ',', '.') }}
|
||||||
|
</td>
|
||||||
|
<td class="text-center">{{ $transaction->jumlah_barang }}</td>
|
||||||
|
<td class="text-right">
|
||||||
|
Rp.{{ number_format($transaction->total_harga, 2, ',', '.') }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="row mt-4">
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<div class="section-title">Metode Pembayaran</div>
|
||||||
|
<div class="images">
|
||||||
|
@if ($transaction->metode_pembayaran != null)
|
||||||
|
<img style="width: 20%; height: 20%;"
|
||||||
|
src="{{ asset('assets/img/metode_pembayaran/' . $transaction->metode_pembayaran . '.png') }}"
|
||||||
|
alt="{{ $transaction->metode_pembayaran }}">
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4 text-right">
|
||||||
|
<div class="invoice-detail-item">
|
||||||
|
<div class="invoice-detail-name">Subtotal</div>
|
||||||
|
<div class="invoice-detail-value">
|
||||||
|
Rp.{{ number_format($transaction->total_harga, 2, ',', '.') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="invoice-detail-item">
|
||||||
|
<div class="invoice-detail-name">Biaya Admin</div>
|
||||||
|
<div class="invoice-detail-value">
|
||||||
|
Rp.{{ number_format($transaction->total_keuntungan, 2, ',', '.') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="invoice-detail-item">
|
||||||
|
<div class="invoice-detail-name">Total</div>
|
||||||
|
<div class="invoice-detail-value invoice-detail-value-lg">
|
||||||
|
Rp.{{ number_format($transaction->total_bayar, 2, ',', '.') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
@ -2,15 +2,6 @@
|
|||||||
@section('content')
|
@section('content')
|
||||||
<div class="main-content">
|
<div class="main-content">
|
||||||
<section class="section">
|
<section class="section">
|
||||||
<div class="section-header">
|
|
||||||
<h1>Invoice</h1>
|
|
||||||
<div class="section-header-breadcrumb">
|
|
||||||
<div class="breadcrumb-item active"><a href="{{ route('user.index') }}">Dashboard</a></div>
|
|
||||||
<div class="breadcrumb-item"><a href="{{ route('user-pembeli.index') }}"> Transaction</a></div>
|
|
||||||
<div class="breadcrumb-item">Invoice</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="section-body">
|
<div class="section-body">
|
||||||
<div class="invoice">
|
<div class="invoice">
|
||||||
<div class="invoice-print">
|
<div class="invoice-print">
|
||||||
@ -18,26 +9,26 @@
|
|||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<div class="invoice-title">
|
<div class="invoice-title">
|
||||||
<h2>Invoice</h2>
|
<h2>Invoice</h2>
|
||||||
<div class="invoice-number">Order #NVI-1234</div>
|
<div class="invoice-number">Order #{{ $transaction->id }}</div>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<address>
|
<address>
|
||||||
<strong>Billed To:</strong><br>
|
<strong>Pembeli:</strong><br>
|
||||||
npannisa<br>
|
{{ ucwords(strtolower($transaction->data_pembeli->nama_depan . ' ' . $transaction->data_pembeli->nama_belakang)) }}<br>
|
||||||
1234 Main<br>
|
{{ ucwords(strtolower($transaction->data_pembeli->alamat)) }}<br>
|
||||||
Apt. 4B<br>
|
{{ ucwords(strtolower($transaction->data_pembeli->getVillageName() . ', ' . $transaction->data_pembeli->getDistrictName())) }}<br>
|
||||||
Depok City, Indonesia
|
{{ ucwords(strtolower($transaction->data_pembeli->getCityName() . ', ' . $transaction->data_pembeli->getProvinceName())) }}
|
||||||
</address>
|
</address>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 text-md-right">
|
<div class="col-md-6 text-md-right">
|
||||||
<address>
|
<address>
|
||||||
<strong>Shipped To:</strong><br>
|
<strong>Penjual:</strong><br>
|
||||||
Jilhan Haura<br>
|
{{ ucwords(strtolower($transaction->data_penjual->nama_depan . ' ' . $transaction->data_penjual->nama_belakang)) }}<br>
|
||||||
12345 Main<br>
|
{{ ucwords(strtolower($transaction->data_penjual->alamat)) }}<br>
|
||||||
Apt. 5B<br>
|
{{ ucwords(strtolower($transaction->data_penjual->getVillageName() . ', ' . $transaction->data_penjual->getDistrictName())) }}<br>
|
||||||
Bogor Barat, Indonesia
|
{{ ucwords(strtolower($transaction->data_penjual->getCityName() . ', ' . $transaction->data_penjual->getProvinceName())) }}
|
||||||
</address>
|
</address>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -51,8 +42,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 text-md-right">
|
<div class="col-md-6 text-md-right">
|
||||||
<address>
|
<address>
|
||||||
<strong>Order Date:</strong><br>
|
<strong>Tanggal Transaksi:</strong><br>
|
||||||
September 19, 2023<br><br>
|
{{ $transaction->created_at->format('d M Y, g:i') }}<br><br>
|
||||||
</address>
|
</address>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -61,51 +52,59 @@
|
|||||||
|
|
||||||
<div class="row mt-4">
|
<div class="row mt-4">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="section-title">Order Summary</div>
|
<div class="section-title">Rangkuman Transaksi</div>
|
||||||
<p class="section-lead">All items here cannot be deleted.</p>
|
<p class="section-lead">Semua barang yang didaftarkan dalam transaksi.</p>
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped table-hover table-md">
|
<table class="table table-striped table-hover table-md" style="font-size: 16px;">
|
||||||
<tr>
|
<tr>
|
||||||
<th data-width="40">#</th>
|
<th data-width="40">#</th>
|
||||||
<th>Item</th>
|
<th>Nama Barang</th>
|
||||||
<th class="text-center">Price</th>
|
<th class="text-center">Harga</th>
|
||||||
<th class="text-center">Quantity</th>
|
<th class="text-center">Jumlah</th>
|
||||||
<th class="text-right">Totals</th>
|
<th class="text-right">Total</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>1</td>
|
<td>1</td>
|
||||||
<td>Ayam Warna Warni</td>
|
<td>{{ $transaction->nama_barang }}</td>
|
||||||
<td class="text-center">Rp. 50.000.000</td>
|
<td class="text-center">
|
||||||
<td class="text-center">1</td>
|
Rp.{{ number_format($transaction->harga_barang, 2, ',', '.') }}</td>
|
||||||
<td class="text-right">Rp. 50.000.000</td>
|
<td class="text-center">{{ $transaction->jumlah_barang }}</td>
|
||||||
|
<td class="text-right">
|
||||||
|
Rp.{{ number_format($transaction->total_harga, 2, ',', '.') }}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mt-4">
|
<div class="row mt-4">
|
||||||
<div class="col-lg-8">
|
<div class="col-lg-8">
|
||||||
<div class="section-title">Payment Method</div>
|
<div class="section-title">Metode Pembayaran</div>
|
||||||
<p class="section-lead">The payment method that we provide is to make it easier for
|
|
||||||
you to pay invoices.</p>
|
|
||||||
<div class="images">
|
<div class="images">
|
||||||
<img src="assets/img/visa.png" alt="visa">
|
@if ($transaction->metode_pembayaran != null)
|
||||||
<img src="assets/img/jcb.png" alt="jcb">
|
<img style="width: 20%; height: 20%;"
|
||||||
<img src="assets/img/mastercard.png" alt="mastercard">
|
src="{{ asset('assets/img/metode_pembayaran/' . $transaction->metode_pembayaran . '.png') }}"
|
||||||
<img src="assets/img/paypal.png" alt="paypal">
|
alt="{{ $transaction->metode_pembayaran }}">
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-4 text-right">
|
<div class="col-lg-4 text-right">
|
||||||
<div class="invoice-detail-item">
|
<div class="invoice-detail-item">
|
||||||
<div class="invoice-detail-name">Subtotal</div>
|
<div class="invoice-detail-name">Subtotal</div>
|
||||||
<div class="invoice-detail-value">Rp.670.000.000</div>
|
<div class="invoice-detail-value">
|
||||||
|
Rp.{{ number_format($transaction->total_harga, 2, ',', '.') }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="invoice-detail-item">
|
<div class="invoice-detail-item">
|
||||||
<div class="invoice-detail-name">Shipping</div>
|
<div class="invoice-detail-name">Biaya Admin</div>
|
||||||
<div class="invoice-detail-value">Rp.15.000</div>
|
<div class="invoice-detail-value">
|
||||||
|
Rp.{{ number_format($transaction->total_keuntungan, 2, ',', '.') }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr class="mt-2 mb-2">
|
<hr class="mt-2 mb-2">
|
||||||
<div class="invoice-detail-item">
|
<div class="invoice-detail-item">
|
||||||
<div class="invoice-detail-name">Total</div>
|
<div class="invoice-detail-name">Total</div>
|
||||||
<div class="invoice-detail-value invoice-detail-value-lg">Rp.6715.000.000</div>
|
<div class="invoice-detail-value invoice-detail-value-lg">
|
||||||
|
Rp.{{ number_format($transaction->total_bayar, 2, ',', '.') }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -114,10 +113,21 @@
|
|||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
<div class="text-md-right">
|
<div class="text-md-right">
|
||||||
<button class="btn btn-warning btn-icon icon-left"><i class="fas fa-print"></i>Print</button>
|
<button class="btn btn-warning btn-icon icon-left" id="btnPDF"
|
||||||
|
data-id="{{ $transaction->id }}"><i class="fas fa-print"></i>Print</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#btnPDF').on('click', function() {
|
||||||
|
const id = $(this).data('id');
|
||||||
|
window.open(
|
||||||
|
"{{ route('invoice.export') }}?id=" + id
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@endsection
|
@endsection
|
||||||
|
@ -22,6 +22,8 @@ use App\Http\Controllers\Profile\ProfileController;
|
|||||||
|
|
||||||
//Invoice
|
//Invoice
|
||||||
use App\Http\Controllers\Invoice\InvoiceController;
|
use App\Http\Controllers\Invoice\InvoiceController;
|
||||||
|
use App\Http\Controllers\User\PembeliController;
|
||||||
|
use App\Http\Controllers\User\PenjualController;
|
||||||
|
|
||||||
// use Illuminate\Foundation\Auth\User;
|
// use Illuminate\Foundation\Auth\User;
|
||||||
|
|
||||||
@ -77,6 +79,8 @@ Route::controller(LoginController::class)->group(function(){
|
|||||||
Route::get('cari-kelurahan','searchVillage')->name('cari-kelurahan');
|
Route::get('cari-kelurahan','searchVillage')->name('cari-kelurahan');
|
||||||
Route::post('kode-verifikasi','sendVerificationCode')->name('kirim-kode');
|
Route::post('kode-verifikasi','sendVerificationCode')->name('kirim-kode');
|
||||||
Route::get('ocr','getOcr');
|
Route::get('ocr','getOcr');
|
||||||
|
Route::get('email','email');
|
||||||
|
Route::get('test-invoice','invoice');
|
||||||
});
|
});
|
||||||
|
|
||||||
// admin dan user
|
// admin dan user
|
||||||
@ -92,7 +96,7 @@ Route::middleware(['auth'])->group(function(){
|
|||||||
|
|
||||||
Route::prefix('invoice')->group(function(){
|
Route::prefix('invoice')->group(function(){
|
||||||
Route::controller(InvoiceController::class)->group(function(){
|
Route::controller(InvoiceController::class)->group(function(){
|
||||||
Route::get('/{id}','getInvoice')->name('invoice.get');
|
Route::get('invoice/{id}','getInvoice')->name('invoice.get');
|
||||||
Route::get('export-invoice','exportInvoice')->name('invoice.export');
|
Route::get('export-invoice','exportInvoice')->name('invoice.export');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -157,7 +161,6 @@ Route::middleware(['auth'])->group(function(){
|
|||||||
Route::get('user-contact','index')->name('user-contact.index');
|
Route::get('user-contact','index')->name('user-contact.index');
|
||||||
Route::get('user-contact/list-contact','listContact')->name('user-contact.list-contact');
|
Route::get('user-contact/list-contact','listContact')->name('user-contact.list-contact');
|
||||||
Route::post('user-contact','store')->name('user-contact.store');
|
Route::post('user-contact','store')->name('user-contact.store');
|
||||||
Route::get('admin-contact/{id}','show')->name('admin-contact.show');
|
|
||||||
Route::delete('user-contact/delete','destroy')->name('user-contact.destroy');
|
Route::delete('user-contact/delete','destroy')->name('user-contact.destroy');
|
||||||
Route::get('user-contact/get-user-contact','getContact')->name('user-contact.get');
|
Route::get('user-contact/get-user-contact','getContact')->name('user-contact.get');
|
||||||
Route::get('user-contact/cek-contact','cekEmail')->name('user-contact.email');
|
Route::get('user-contact/cek-contact','cekEmail')->name('user-contact.email');
|
||||||
@ -166,10 +169,14 @@ Route::middleware(['auth'])->group(function(){
|
|||||||
|
|
||||||
// Tampilan transaksi, bayar, update status pengiriman dan refund
|
// Tampilan transaksi, bayar, update status pengiriman dan refund
|
||||||
Route::controller(UserTransactionController::class)->group(function(){
|
Route::controller(UserTransactionController::class)->group(function(){
|
||||||
// Pembeli
|
Route::get('transaction-tracking','transactionTracking')->name('user.transaction-tracking');
|
||||||
|
Route::get('user-transaction/detail-transaksi/{id}','show')->name('user-transaction.show');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Pembeli
|
||||||
|
Route::controller(PenjualController::class)->group(function(){
|
||||||
Route::get('user-pembeli','indexPembeli')->name('user-pembeli.index');
|
Route::get('user-pembeli','indexPembeli')->name('user-pembeli.index');
|
||||||
Route::get('user-pembeli/list-pembeli','listPembeli')->name('user-pembeli.list-pembeli');
|
Route::get('user-pembeli/list-pembeli','listPembeli')->name('user-pembeli.list-pembeli');
|
||||||
Route::get('user-pembeli/detail-transaksi/{id}','show')->name('user-pembeli.show');
|
|
||||||
Route::get('user-pembeli/tambah-transaksi','create')->name('user-pembeli.create');
|
Route::get('user-pembeli/tambah-transaksi','create')->name('user-pembeli.create');
|
||||||
Route::post('user-pembeli','store')->name('user-pembeli.store');
|
Route::post('user-pembeli','store')->name('user-pembeli.store');
|
||||||
Route::put('user-pembeli/bayar-transaksi','payTransaction')->name('user-pembeli.pay');
|
Route::put('user-pembeli/bayar-transaksi','payTransaction')->name('user-pembeli.pay');
|
||||||
@ -179,17 +186,16 @@ Route::middleware(['auth'])->group(function(){
|
|||||||
Route::put('user-pembeli/transaksi-close','onCloseTransaction')->name('user-pembeli.close');
|
Route::put('user-pembeli/transaksi-close','onCloseTransaction')->name('user-pembeli.close');
|
||||||
Route::put('user-pembeli/transaksi-selesai','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::controller(PembeliController::class)->group(function(){
|
||||||
Route::get('user-penjual','indexPenjual')->name('user-penjual.index');
|
Route::get('user-penjual','indexPenjual')->name('user-penjual.index');
|
||||||
Route::get('user-penjual/list-penjual','listPenjual')->name('user-penjual.list-penjual');
|
Route::get('user-penjual/list-penjual','listPenjual')->name('user-penjual.list-penjual');
|
||||||
Route::get('user-penjual/detail-transaksi/{id}','show')->name('user-penjual.show');
|
|
||||||
Route::get('user-penjual/tolak-transaksi','denyTransaction')->name('user-penjual.deny');
|
Route::get('user-penjual/tolak-transaksi','denyTransaction')->name('user-penjual.deny');
|
||||||
Route::put('user-penjual/terima-transaksi','acceptTransaction')->name('user-penjual.accept');
|
Route::put('user-penjual/terima-transaksi','acceptTransaction')->name('user-penjual.accept');
|
||||||
Route::put('user-penjual/kirim-pesanan','sendingOrder')->name('user-penjual.sending');
|
Route::put('user-penjual/kirim-pesanan','sendingOrder')->name('user-penjual.sending');
|
||||||
Route::post('user-penjual/selesai-kirim-pesanan','sentOrder')->name('user-penjual.sent');
|
Route::post('user-penjual/selesai-kirim-pesanan','sentOrder')->name('user-penjual.sent');
|
||||||
|
|
||||||
Route::get('transaction-tracking','transactionTracking')->name('user.transaction-tracking');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Tampilan refund
|
// Tampilan refund
|
||||||
|
Loading…
Reference in New Issue
Block a user