Tambah invoice

This commit is contained in:
Muhammad Raihan Surya 2023-11-13 16:49:06 +07:00
parent 676f05a162
commit c1a837ca88
15 changed files with 1220 additions and 173 deletions

View File

@ -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,8 +51,21 @@ class AdminRefundController extends Controller
'reason' => $refund->complaint, 'reason' => $refund->complaint,
]; ];
// $refundMidtrans = Trans::refund($request->id, $params); $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'];
if($code == '200'){
try { try {
Transaction::where('id', $refund->transaction_id)->update([ Transaction::where('id', $refund->transaction_id)->update([
'status_transaksi' => 'refund', 'status_transaksi' => 'refund',
@ -76,7 +90,6 @@ class AdminRefundController extends Controller
return response()->json([ return response()->json([
'status' => true, 'status' => true,
'message' => 'Refund berhasil dilakukan. Uang akan dikembalikan ke pembeli.', 'message' => 'Refund berhasil dilakukan. Uang akan dikembalikan ke pembeli.',
// 'refundMidtrans' => $refundMidtrans,
]); ]);
} catch (Throwable $e) { } catch (Throwable $e) {
DB::rollBack(); DB::rollBack();
@ -86,9 +99,16 @@ class AdminRefundController extends Controller
return response()->json([ return response()->json([
'status' => false, 'status' => false,
'message' => 'Refund gagal dilakukan', 'message' => 'Refund gagal dilakukan',
// 'refundMidtrans' => $refundMidtrans
]); ]);
} }
}else{
return response()->json([
'status' => false,
'message' => 'Refund gagal dilakukan',
]);
}
} }
public function denyRefund(Request $request) public function denyRefund(Request $request)

View File

@ -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,6 +38,21 @@ class AdminTransactionController extends Controller
public function approveTransaction(Request $request) public function approveTransaction(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.'/approve');
$result = json_decode($response->body(), true);
$code = $result['status_code'];
if($code == '200'){
try { try {
DB::beginTransaction(); DB::beginTransaction();
@ -68,6 +82,12 @@ class AdminTransactionController extends Controller
Log::error($e->getMessage()); 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,6 +97,21 @@ class AdminTransactionController extends Controller
public function denyTransaction(Request $request) public function denyTransaction(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.'/deny');
$result = json_decode($response->body(), true);
$code = $result['status_code'];
if($code == '200'){
try { try {
DB::beginTransaction(); DB::beginTransaction();
@ -106,6 +141,12 @@ class AdminTransactionController extends Controller
Log::error($e->getMessage()); 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.',

View File

@ -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']);
} }
} }

View File

@ -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),
]);
} }
} }

View File

@ -240,7 +240,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,

View File

@ -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)

View File

@ -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
View File

@ -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
View 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,
),
);

View File

@ -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'));
}); });
}); });

View File

@ -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>

View File

@ -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>

View 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>

View File

@ -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

View File

@ -92,7 +92,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');
}); });
}); });