refact admin fee

dev
Aji Kamaludin 1 year ago
parent e799de83e5
commit 8a75272248
No known key found for this signature in database
GPG Key ID: 19058F67F0083AD3

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

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

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

@ -12,7 +12,6 @@ class Account extends Model
'holder_name',
'account_number',
'logo',
'admin_fee',
];
protected $appends = [

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

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

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

@ -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'],

@ -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 = () => {
<div className="font-bold mt-5">Rincian</div>
<table className="w-full">
<tbody>
<tr>
<td className="w-1/3">
Jumlah Deposit
</td>
<td>: </td>
<td className="text-right">
<span className="font-bold">
{deposit.amount}
</span>
</td>
<td className="w-5" />
</tr>
<tr>
<td>Biaya Admin</td>
<td>: </td>
<td className="text-right">
<span className="font-bold">
{+cash_admin_fee === 0 ? (
'Gratis'
) : (
<>
Rp.{' '}
{formatIDR(
+cash_admin_fee
)}
</>
)}
</span>
</td>
<td className="w-5" />
</tr>
<tr
onClick={() =>
handleCopyToClipboard(
deposit.amount
+cash_admin_fee + +deposit.debit
)
}
>
<td>Total Deposit</td>
<td>Total Bayar</td>
<td> : </td>
<td className="text-right">
<span className="font-bold">
{deposit.amount}
Rp.{' '}
{formatIDR(
+cash_admin_fee +
+deposit.debit
)}
</span>
</td>
<td className="w-5">

@ -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 = () => {
<td>: </td>
<td className="text-right">
<span className="font-bold">
{+account.admin_fee === 0 ? (
{+bank_admin_fee === 0 ? (
'Gratis'
) : (
<>
Rp.{' '}
{formatIDR(
+account.admin_fee
+bank_admin_fee
)}
</>
)}
@ -200,8 +200,7 @@ export const FormUploadManual = () => {
<tr
onClick={() =>
handleCopyToClipboard(
+account.admin_fee +
+deposit.debit
+bank_admin_fee + +deposit.debit
)
}
>
@ -211,7 +210,7 @@ export const FormUploadManual = () => {
<span className="font-bold">
Rp.{' '}
{formatIDR(
+account.admin_fee +
+bank_admin_fee +
+deposit.debit
)}
</span>

@ -4,7 +4,6 @@ import { isEmpty } from 'lodash'
import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout'
import FormInput from '@/Components/FormInput'
import FormFile from '@/Components/FormFile'
import FormInputNumeric from '@/Components/FormInputNumeric'
import Button from '@/Components/Button'
import { Head, useForm } from '@inertiajs/react'
@ -16,7 +15,6 @@ export default function Form(props) {
bank_name: '',
holder_name: '',
account_number: '',
admin_fee: 0,
logo: null,
logo_url: '',
})
@ -46,7 +44,6 @@ export default function Form(props) {
bank_name: account.bank_name,
holder_name: account.holder_name,
account_number: account.account_number,
admin_fee: account.admin_fee,
logo_url: account.logo_url,
})
}
@ -92,13 +89,6 @@ export default function Form(props) {
label="Nomor Rekening"
error={errors.account_number}
/>
<FormInputNumeric
name="admin_fee"
value={data.admin_fee}
onChange={handleOnChange}
label="Admin Fee"
error={errors.admin_fee}
/>
<FormFile
label={'Logo'}
onChange={(e) => setData('logo', e.target.files[0])}

@ -146,10 +146,12 @@ export default function FormModal(props) {
{isEmpty(data.image_prove_url) === false && (
<div>
<a href={data.image_prove_url} target="_blank">
<img
src={data.image_prove_url}
className="w-full object-fill h-96"
/>
</a>
</div>
)}
{+data.is_valid !== STATUS_APPROVE &&

@ -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"
/>
<FormInputNumeric
name="ADMINFEE_CASH_DEPOSIT"
value={data.ADMINFEE_CASH_DEPOSIT}
onChange={handleOnChange}
label="Biaya Admin Cash / Setor Tunai"
error={errors.ADMINFEE_CASH_DEPOSIT}
/>
<FormInput
name="TEXT_CASH_DEPOSIT"
value={data.TEXT_CASH_DEPOSIT}
@ -113,12 +125,20 @@ export default function General(props) {
label="Nama Pilihan Pembayaran Cash / Setor Tunai"
error={errors.TEXT_CASH_DEPOSIT}
/>
<Checkbox
label="Aktifkan Transfer Manual"
value={+data.ENABLE_MANUAL_TRANSFER === 1}
onChange={handleOnChange}
name="ENABLE_MANUAL_TRANSFER"
/>
<FormInputNumeric
name="ADMINFEE_MANUAL_TRANSFER"
value={data.ADMINFEE_MANUAL_TRANSFER}
onChange={handleOnChange}
label="Biaya Admin Transfer Manual"
error={errors.ADMINFEE_MANUAL_TRANSFER}
/>
<FormInputNumeric
name="MAX_MANUAL_TRANSFER_TIMEOUT"
value={data.MAX_MANUAL_TRANSFER_TIMEOUT}

Loading…
Cancel
Save