pint format

dev
Aji Kamaludin 1 year ago
parent 394e4bb40b
commit 53af55bf98
No known key found for this signature in database
GPG Key ID: 19058F67F0083AD3

@ -41,4 +41,4 @@
- [x] ubah filter di mitra list dan customer list menjadi seperti di sale index
- [x] untuk detail mitra nanti akan ada button untuk (transaksi mitra dengan cakupan: pembelian voucher, pembayaran hutang,
topuplimit, penambahan batas bayar, history deposit)
- [ ] tambah floating button untuk notifikasi deposit (angka saja), di dashboard tambahkan list deposit terbaru
- [ ] di dashboard tambahkan list deposit terbaru

@ -115,8 +115,8 @@ class CustomerController extends Controller
public function update(Request $request, Customer $customer)
{
$request->validate([
'email' => 'nullable|email|unique:customers,email,' . $customer->id,
'username' => 'required|string|min:5|alpha_dash|unique:customers,username,' . $customer->id,
'email' => 'nullable|email|unique:customers,email,'.$customer->id,
'username' => 'required|string|min:5|alpha_dash|unique:customers,username,'.$customer->id,
'password' => 'nullable|string|min:8',
'name' => 'required|string',
'fullname' => 'required|string',

@ -220,8 +220,8 @@ class CustomerMitraController extends Controller
public function update(Request $request, Customer $customer)
{
$request->validate([
'email' => 'nullable|email|unique:customers,email,' . $customer->id,
'username' => 'required|string|min:5|alpha_dash|unique:customers,username,' . $customer->id,
'email' => 'nullable|email|unique:customers,email,'.$customer->id,
'username' => 'required|string|min:5|alpha_dash|unique:customers,username,'.$customer->id,
'password' => 'nullable|string|min:8',
'name' => 'required|string',
'fullname' => 'required|string',

@ -55,7 +55,7 @@ class PaylaterController extends Controller
public function show(PaylaterHistory $paylater)
{
return inertia('Paylater/Detail', [
'paylater' => $paylater->load(['customer'])
'paylater' => $paylater->load(['customer']),
]);
}

@ -42,7 +42,7 @@ class DepositController extends Controller
public function create(Request $request)
{
$customer = $request->user('customer');
if (!$customer->allow_transaction) {
if (! $customer->allow_transaction) {
return redirect()->back()
->with('message', ['type' => 'error', 'message' => 'akun anda dibekukan tidak dapat melakukan transaksi']);
}
@ -102,7 +102,7 @@ class DepositController extends Controller
'direct' => $request->direct,
'bank_admin_fee' => Setting::getByKey('ADMINFEE_MANUAL_TRANSFER'),
'cash_admin_fee' => Setting::getByKey('ADMINFEE_CASH_DEPOSIT'),
'back' => $request->back ?? 'transactions.deposit.index'
'back' => $request->back ?? 'transactions.deposit.index',
]);
}
@ -157,7 +157,7 @@ class DepositController extends Controller
if ($is_valid == DepositHistory::STATUS_VALID) {
$deposit->update_customer_balance();
}
// TODO: update for paylater
// TODO: update for paylater
DB::commit();
@ -190,7 +190,7 @@ class DepositController extends Controller
$deposit->save();
}
// TODO: update for paylater
// TODO: update for paylater
DB::commit();

@ -3,10 +3,7 @@
namespace App\Http\Controllers\Customer;
use App\Http\Controllers\Controller;
use App\Models\Account;
use App\Models\Customer;
use App\Models\DepositHistory;
use App\Models\DepositLocation;
use App\Models\PaylaterHistory;
use App\Models\Setting;
use App\Services\GeneralService;
@ -32,10 +29,10 @@ class PaylaterController extends Controller
if ($paylater->type == PaylaterHistory::TYPE_REPAYMENT) {
$deposit = DepositHistory::where('related_id', $paylater->id)->first();
if (!in_array($deposit->is_valid, [DepositHistory::STATUS_VALID])) {
if (! in_array($deposit->is_valid, [DepositHistory::STATUS_VALID])) {
return redirect()->route('transactions.deposit.show', [
'deposit' => $deposit,
'back' => 'customer.paylater.index'
'back' => 'customer.paylater.index',
]);
}
}
@ -65,7 +62,7 @@ class PaylaterController extends Controller
$customer = $request->user('customer');
// validate amount
// validate amount
if ($customer->paylater->usage < $request->amount) {
return redirect()->back()
->with('message', ['type' => 'error', 'message' => 'Nominal Tagihan tidak boleh lebih dari tagihan']);
@ -75,7 +72,7 @@ class PaylaterController extends Controller
$repayment = DepositHistory::query()
->where([
['customer_id', '=', $customer->id],
['type', '=', DepositHistory::TYPE_REPAYMENT]
['type', '=', DepositHistory::TYPE_REPAYMENT],
])->where(function ($query) {
$query->where('is_valid', '!=', DepositHistory::STATUS_VALID)
->where('is_valid', '!=', DepositHistory::STATUS_REJECT)
@ -130,7 +127,7 @@ class PaylaterController extends Controller
return redirect()->route('transactions.deposit.show', [
'deposit' => $deposit->id,
'direct' => 'true',
'back' => 'customer.paylater.index'
'back' => 'customer.paylater.index',
]);
}
}

@ -52,7 +52,7 @@ class DepositHistory extends Model
'format_created_at',
'amount',
'image_prove_url',
'admin_fee'
'admin_fee',
];
protected static function booted(): void
@ -99,10 +99,10 @@ class DepositHistory extends Model
{
return Attribute::make(get: function () {
if ($this->credit == 0) {
return 'Rp ' . number_format($this->debit, is_float($this->debit) ? 2 : 0, ',', '.');
return 'Rp '.number_format($this->debit, is_float($this->debit) ? 2 : 0, ',', '.');
}
return '-Rp ' . number_format($this->credit, is_float($this->credit) ? 2 : 0, ',', '.');
return '-Rp '.number_format($this->credit, is_float($this->credit) ? 2 : 0, ',', '.');
});
}
@ -165,7 +165,7 @@ class DepositHistory extends Model
}
Notification::create([
'entity_type' => User::class,
'description' => $this->customer->fullname . ' melakukan deposit transfer manual sebesar : ' . $this->amount . $status,
'description' => $this->customer->fullname.' melakukan deposit transfer manual sebesar : '.$this->amount.$status,
]);
}
@ -176,14 +176,14 @@ class DepositHistory extends Model
}
Notification::create([
'entity_type' => User::class,
'description' => $this->customer->fullname . ' melakukan deposit manual sebesar : ' . $this->amount . $status,
'description' => $this->customer->fullname.' melakukan deposit manual sebesar : '.$this->amount.$status,
]);
}
if ($this->payment_channel == Setting::PAYMENT_MIDTRANS) {
Notification::create([
'entity_type' => User::class,
'description' => $this->customer->fullname . ' melakukan deposit via midtrans sebesar : ' . $this->amount,
'description' => $this->customer->fullname.' melakukan deposit via midtrans sebesar : '.$this->amount,
]);
}
}
@ -192,7 +192,7 @@ class DepositHistory extends Model
{
Notification::create([
'entity_id' => $this->customer_id,
'description' => 'Deposit ' . $this->description . ' sebesar ' . $this->amount . ' sudah sukses diterima',
'description' => 'Deposit '.$this->description.' sebesar '.$this->amount.' sudah sukses diterima',
]);
}
}

@ -17,7 +17,7 @@ class PaylaterCustomer extends Model
];
protected $appends = [
'paylater_description'
'paylater_description',
];
public function customer()
@ -30,10 +30,11 @@ class PaylaterCustomer extends Model
return Attribute::make(get: function () {
if ($this->day_deadline_at != null) {
$deadlineAt = Carbon::parse($this->day_deadline_at)->translatedFormat('d F Y');
return "lunasi pinjaman kamu sebelum jatuh tempo pada {$deadlineAt}";
}
return "yuk gunakan terus saldo yang tersedia";
return 'yuk gunakan terus saldo yang tersedia';
});
}
}

@ -71,10 +71,10 @@ class PaylaterHistory extends Model
{
return Attribute::make(get: function () {
if ($this->credit == 0) {
return 'Rp ' . number_format($this->debit, is_float($this->debit) ? 2 : 0, ',', '.');
return 'Rp '.number_format($this->debit, is_float($this->debit) ? 2 : 0, ',', '.');
}
return '-Rp ' . number_format($this->credit, is_float($this->credit) ? 2 : 0, ',', '.');
return '-Rp '.number_format($this->credit, is_float($this->credit) ? 2 : 0, ',', '.');
});
}
@ -116,7 +116,7 @@ class PaylaterHistory extends Model
{
Notification::create([
'entity_id' => $this->customer_id,
'description' => 'Pembayaran ' . $this->description . ' sebesar ' . $this->amount . ' sudah sukses diterima',
'description' => 'Pembayaran '.$this->description.' sebesar '.$this->amount.' sudah sukses diterima',
]);
}

@ -139,9 +139,9 @@ class GeneralService
$time = explode(':', $time);
foreach ($time as $t) { //00 : 00
if ($t < 10) {
$r .= '0' . (int) $t . ':';
$r .= '0'.(int) $t.':';
} else {
$r .= $t . ':';
$r .= $t.':';
}
}
@ -154,7 +154,7 @@ class GeneralService
->whereDate('created_at', now())
->count() + 1;
return 'Invoice #TLH' . now()->format('dmy') . GeneralService::formatNumberCode($code);
return 'Invoice #TLH'.now()->format('dmy').GeneralService::formatNumberCode($code);
}
public static function generateDepositCode()
@ -163,7 +163,7 @@ class GeneralService
->whereDate('created_at', now())
->count() + 1;
return 'Invoice #DSR' . now()->format('dmy') . GeneralService::formatNumberCode($code);
return 'Invoice #DSR'.now()->format('dmy').GeneralService::formatNumberCode($code);
}
public static function generateDepositRepayCode()
@ -172,7 +172,7 @@ class GeneralService
->whereDate('created_at', now())
->count() + 1;
return 'Invoice #PLH' . now()->format('dmy') . GeneralService::formatNumberCode($code);
return 'Invoice #PLH'.now()->format('dmy').GeneralService::formatNumberCode($code);
}
public static function generateSaleVoucherCode()
@ -181,14 +181,14 @@ class GeneralService
->where('payed_with', '!=', Sale::PAYED_WITH_POIN)
->count() + 1;
return 'Invoice #VCR' . now()->format('dmy') . GeneralService::formatNumberCode($code);
return 'Invoice #VCR'.now()->format('dmy').GeneralService::formatNumberCode($code);
}
public static function generateBonusPoinCode()
{
$code = PoinHistory::whereDate('created_at', now())->count() + 1;
return 'Invoice #BPN' . now()->format('dmy') . GeneralService::formatNumberCode($code);
return 'Invoice #BPN'.now()->format('dmy').GeneralService::formatNumberCode($code);
}
public static function generateExchangePoinCode()
@ -197,19 +197,19 @@ class GeneralService
->where('payed_with', '=', Sale::PAYED_WITH_POIN)
->count() + 1;
return 'Invoice #PVC' . now()->format('dmy') . GeneralService::formatNumberCode($code);
return 'Invoice #PVC'.now()->format('dmy').GeneralService::formatNumberCode($code);
}
public static function formatNumberCode($number)
{
if ($number < 10) {
return '000' . $number;
return '000'.$number;
}
if ($number < 100) {
return '00' . $number;
return '00'.$number;
}
if ($number < 1000) {
return '0' . $number;
return '0'.$number;
}
return $number;

Loading…
Cancel
Save