diff --git a/app/Http/Controllers/Admin/AccountController.php b/app/Http/Controllers/Admin/AccountController.php index ffe293c..a61194d 100644 --- a/app/Http/Controllers/Admin/AccountController.php +++ b/app/Http/Controllers/Admin/AccountController.php @@ -29,7 +29,6 @@ class AccountController extends Controller 'bank_name' => 'required|string', 'holder_name' => 'required|string', 'account_number' => 'required|string', - 'admin_fee' => 'required|numeric', 'logo' => 'required|image', ]); @@ -41,7 +40,6 @@ class AccountController extends Controller 'bank_name' => $request->bank_name, 'holder_name' => $request->holder_name, 'account_number' => $request->account_number, - 'admin_fee' => $request->admin_fee, 'logo' => $file->hashName('uploads'), ]); @@ -63,7 +61,6 @@ class AccountController extends Controller 'bank_name' => 'required|string', 'holder_name' => 'required|string', 'account_number' => 'required|string', - 'admin_fee' => 'required|numeric', 'logo' => 'nullable|image', ]); @@ -79,7 +76,6 @@ class AccountController extends Controller 'bank_name' => $request->bank_name, 'holder_name' => $request->holder_name, 'account_number' => $request->account_number, - 'admin_fee' => $request->admin_fee ]); return redirect()->route('account.index') diff --git a/app/Http/Controllers/Admin/SettingController.php b/app/Http/Controllers/Admin/SettingController.php index 6db296b..0228a53 100644 --- a/app/Http/Controllers/Admin/SettingController.php +++ b/app/Http/Controllers/Admin/SettingController.php @@ -27,8 +27,10 @@ class SettingController extends Controller 'OPEN_WEBSITE_NAME' => 'required|string', 'SHARE_TEXT' => 'required|string', 'ENABLE_CASH_DEPOSIT' => 'required|in:0,1', + 'ADMINFEE_CASH_DEPOSIT' => 'required|numeric', 'TEXT_CASH_DEPOSIT' => 'required|string', 'ENABLE_MANUAL_TRANSFER' => 'required|in:0,1', + 'ADMINFEE_MANUAL_TRANSFER' => 'required|numeric', 'MAX_MANUAL_TRANSFER_TIMEOUT' => 'required|numeric', 'MANUAL_TRANSFER_OPEN_HOUR' => 'required|string', 'MANUAL_TRANSFER_CLOSE_HOUR' => 'required|string', diff --git a/app/Http/Controllers/Customer/DepositController.php b/app/Http/Controllers/Customer/DepositController.php index 21de577..cda863e 100644 --- a/app/Http/Controllers/Customer/DepositController.php +++ b/app/Http/Controllers/Customer/DepositController.php @@ -84,6 +84,8 @@ class DepositController extends Controller 'midtrans_client_key' => Setting::getByKey('MIDTRANS_CLIENT_KEY'), 'is_production' => app()->isProduction(), 'direct' => $request->direct, + 'bank_admin_fee' => Setting::getByKey('ADMINFEE_MANUAL_TRANSFER'), + 'cash_admin_fee' => Setting::getByKey('ADMINFEE_CASH_DEPOSIT') ]); } diff --git a/app/Models/Account.php b/app/Models/Account.php index 2909225..2ae7395 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -12,7 +12,6 @@ class Account extends Model 'holder_name', 'account_number', 'logo', - 'admin_fee', ]; protected $appends = [ @@ -22,7 +21,7 @@ class Account extends Model protected function logoUrl(): Attribute { return Attribute::make(get: function () { - return asset($this->logo); + return asset($this->logo); }); } } diff --git a/app/Services/GeneralService.php b/app/Services/GeneralService.php index e1484d5..e50442d 100644 --- a/app/Services/GeneralService.php +++ b/app/Services/GeneralService.php @@ -82,7 +82,7 @@ class GeneralService 'name' => Setting::PAYMENT_MANUAL, 'logo' => null, 'display_name' => 'Transfer Manual', - 'admin_fee' => 0 + 'admin_fee' => Setting::getByKey('ADMINFEE_MANUAL_TRANSFER') ]; } } @@ -103,7 +103,7 @@ class GeneralService 'name' => Setting::PAYMENT_CASH_DEPOSIT, 'logo' => null, 'display_name' => Setting::getByKey('TEXT_CASH_DEPOSIT'), - 'admin_fee' => 0 + 'admin_fee' => Setting::getByKey('ADMINFEE_CASH_DEPOSIT') ]; } } diff --git a/database/migrations/2023_05_24_182840_create_accounts_table.php b/database/migrations/2023_05_24_182840_create_accounts_table.php index c4292eb..bd37a6a 100644 --- a/database/migrations/2023_05_24_182840_create_accounts_table.php +++ b/database/migrations/2023_05_24_182840_create_accounts_table.php @@ -19,7 +19,6 @@ return new class extends Migration $table->string('holder_name')->nullable(); $table->string('account_number')->nullable(); $table->string('logo')->nullable(); - $table->decimal('admin_fee', 20, 2)->nullable(); $table->timestamps(); $table->softDeletes(); diff --git a/database/seeders/DummySeeder.php b/database/seeders/DummySeeder.php index 82b1e6c..d2d33c3 100644 --- a/database/seeders/DummySeeder.php +++ b/database/seeders/DummySeeder.php @@ -60,9 +60,9 @@ class DummySeeder extends Seeder public function account() { $banks = [ - ['name' => 'BTPN', 'bank_name' => 'BTPN', 'holder_name' => 'Aji Kamaludin', 'account_number' => '187391738129', 'logo' => 'sample/logo-jenius.png', 'admin_fee' => 0], - ['name' => 'Jago', 'bank_name' => 'Bank Jago', 'holder_name' => 'Aji Kamaludin', 'account_number' => '718297389172', 'logo' => 'sample/logo-jago.png', 'admin_fee' => 2500], - ['name' => 'BNI', 'bank_name' => 'Bank Negara Indoneisa', 'holder_name' => 'Aji Kamaludin', 'account_number' => '718297389172', 'logo' => 'sample/logo-bni.png', 'admin_fee' => 6500], + ['name' => 'BTPN', 'bank_name' => 'BTPN', 'holder_name' => 'Aji Kamaludin', 'account_number' => '187391738129', 'logo' => 'sample/logo-jenius.png'], + ['name' => 'Jago', 'bank_name' => 'Bank Jago', 'holder_name' => 'Aji Kamaludin', 'account_number' => '718297389172', 'logo' => 'sample/logo-jago.png'], + ['name' => 'BNI', 'bank_name' => 'Bank Negara Indoneisa', 'holder_name' => 'Aji Kamaludin', 'account_number' => '718297389172', 'logo' => 'sample/logo-bni.png'], ]; foreach ($banks as $bank) { @@ -72,7 +72,6 @@ class DummySeeder extends Seeder 'holder_name' => $bank['holder_name'], 'account_number' => $bank['account_number'], 'logo' => $bank['logo'], - 'admin_fee' => $bank['admin_fee'] ]); } } diff --git a/database/seeders/InstallationSeed.php b/database/seeders/InstallationSeed.php index 1ca0620..eee1674 100644 --- a/database/seeders/InstallationSeed.php +++ b/database/seeders/InstallationSeed.php @@ -42,7 +42,9 @@ class InstallationSeed extends Seeder // deposit ['key' => 'ENABLE_CASH_DEPOSIT', 'value' => '1', 'type' => 'text'], // deposit by location (on/off) ['key' => 'TEXT_CASH_DEPOSIT', 'value' => 'Setor Tunai di Kantor WBB', 'type' => 'text'], + ['key' => 'ADMINFEE_CASH_DEPOSIT', 'value' => '1000', 'type' => 'text'], ['key' => 'ENABLE_MANUAL_TRANSFER', 'value' => '1', 'type' => 'text'], // transfer manual (on/off) + ['key' => 'ADMINFEE_MANUAL_TRANSFER', 'value' => '2500', 'type' => 'text'], ['key' => 'MAX_MANUAL_TRANSFER_TIMEOUT', 'value' => '2', 'type' => 'text'], // dalam jam ['key' => 'MANUAL_TRANSFER_OPEN_HOUR', 'value' => '00:00', 'type' => 'text'], ['key' => 'MANUAL_TRANSFER_CLOSE_HOUR', 'value' => '23:59', 'type' => 'text'], diff --git a/resources/js/Customer/Deposit/DetailPartials/FormUploadCashDeposit.jsx b/resources/js/Customer/Deposit/DetailPartials/FormUploadCashDeposit.jsx index a7ef731..75877c0 100644 --- a/resources/js/Customer/Deposit/DetailPartials/FormUploadCashDeposit.jsx +++ b/resources/js/Customer/Deposit/DetailPartials/FormUploadCashDeposit.jsx @@ -3,13 +3,14 @@ import { router, useForm, usePage } from '@inertiajs/react' import { isEmpty } from 'lodash' import { HiOutlineClipboardDocumentList } from 'react-icons/hi2' +import { formatIDR } from '@/utils' import { toastSuccess } from '@/Customer/utils' import FormFile from '@/Components/FormFile' import Alert from '@/Components/Alert' export const FormUploadCashDeposit = () => { const { - props: { deposit_locations, deposit, flash }, + props: { deposit_locations, deposit, flash, cash_admin_fee }, } = usePage() const [imageUrl, setImageUrl] = useState(deposit.image_prove_url) @@ -188,18 +189,53 @@ export const FormUploadCashDeposit = () => {
+ Jumlah Deposit + | +: | ++ + {deposit.amount} + + | ++ | |||
Biaya Admin | +: | ++ + {+cash_admin_fee === 0 ? ( + 'Gratis' + ) : ( + <> + Rp.{' '} + {formatIDR( + +cash_admin_fee + )} + > + )} + + | ++ | |||
Total Deposit | +Total Bayar | : | - {deposit.amount} + Rp.{' '} + {formatIDR( + +cash_admin_fee + + +deposit.debit + )} | diff --git a/resources/js/Customer/Deposit/DetailPartials/FormUploadManual.jsx b/resources/js/Customer/Deposit/DetailPartials/FormUploadManual.jsx index 9afd666..7bf053e 100644 --- a/resources/js/Customer/Deposit/DetailPartials/FormUploadManual.jsx +++ b/resources/js/Customer/Deposit/DetailPartials/FormUploadManual.jsx @@ -10,7 +10,7 @@ import Alert from '@/Components/Alert' export const FormUploadManual = () => { const { - props: { accounts, deposit, flash }, + props: { accounts, deposit, flash, bank_admin_fee }, } = usePage() const [imageUrl, setImageUrl] = useState(deposit.image_prove_url) @@ -183,13 +183,13 @@ export const FormUploadManual = () => { | : |
- {+account.admin_fee === 0 ? (
+ {+bank_admin_fee === 0 ? (
'Gratis'
) : (
<>
Rp.{' '}
{formatIDR(
- +account.admin_fee
+ +bank_admin_fee
)}
>
)}
@@ -200,8 +200,7 @@ export const FormUploadManual = () => {
-
+
+
+
)}
{+data.is_valid !== STATUS_APPROVE &&
diff --git a/resources/js/Pages/Setting/Index.jsx b/resources/js/Pages/Setting/Index.jsx
index a44ca23..5de90c7 100644
--- a/resources/js/Pages/Setting/Index.jsx
+++ b/resources/js/Pages/Setting/Index.jsx
@@ -17,8 +17,13 @@ export default function General(props) {
OPEN_WEBSITE_NAME: extractValue(setting, 'OPEN_WEBSITE_NAME'),
SHARE_TEXT: extractValue(setting, 'SHARE_TEXT'),
ENABLE_CASH_DEPOSIT: extractValue(setting, 'ENABLE_CASH_DEPOSIT'),
+ ADMINFEE_CASH_DEPOSIT: extractValue(setting, 'ADMINFEE_CASH_DEPOSIT'),
TEXT_CASH_DEPOSIT: extractValue(setting, 'TEXT_CASH_DEPOSIT'),
ENABLE_MANUAL_TRANSFER: extractValue(setting, 'ENABLE_MANUAL_TRANSFER'),
+ ADMINFEE_MANUAL_TRANSFER: extractValue(
+ setting,
+ 'ADMINFEE_MANUAL_TRANSFER'
+ ),
MAX_MANUAL_TRANSFER_TIMEOUT: extractValue(
setting,
'MAX_MANUAL_TRANSFER_TIMEOUT'
@@ -106,6 +111,13 @@ export default function General(props) {
onChange={handleOnChange}
name="ENABLE_CASH_DEPOSIT"
/>
+ |