From eca09a6cd6eafe3e8b122ffb2e4426b7eee57c37 Mon Sep 17 00:00:00 2001 From: Aji Kamaludin Date: Fri, 16 Jun 2023 05:38:55 +0700 Subject: [PATCH] move on to mysql, change coin to poin --- .env.example | 7 ++- TODO.md | 47 --------------- .../Controllers/Customer/AuthController.php | 16 ++--- .../Controllers/Customer/CartController.php | 18 +++--- .../Controllers/Customer/CoinController.php | 26 -------- .../Controllers/Customer/PoinController.php | 26 ++++++++ ...troller.php => PoinExchangeController.php} | 26 ++++---- app/Http/Controllers/GeneralController.php | 10 ++-- ...ontroller.php => PoinRewardController.php} | 22 +++---- app/Http/Controllers/SettingController.php | 6 +- app/Http/Controllers/VoucherController.php | 12 ++-- .../HandleInertiaCustomerRequests.php | 3 + app/Models/CoinHistory.php | 4 +- app/Models/Customer.php | 16 ++--- app/Models/PoinHistory.php | 60 +++++++++++++++++++ app/Models/{CoinReward.php => PoinReward.php} | 4 +- app/Models/Sale.php | 14 ++--- app/Models/Setting.php | 15 +++++ app/Models/Voucher.php | 8 +-- app/Services/GeneralService.php | 2 +- config/database.php | 9 +++ ...023_05_24_130522_create_vouchers_table.php | 2 +- ...23_05_24_130552_create_customers_table.php | 2 +- ...16_045835_create_poin_histories_table.php} | 4 +- ...6_16_045840_create_poin_rewards_table.php} | 6 +- database/seeders/DummySeeder.php | 8 +-- database/seeders/InstallationSeed.php | 4 +- database/seeders/PermissionSeeder.php | 12 ++-- docker-compose.yml | 24 ++++++++ resources/js/Customer/Index/BalanceBanner.jsx | 2 +- resources/js/Customer/Index/Index.jsx | 5 +- resources/js/Customer/Index/Notification.jsx | 6 +- resources/js/Customer/Paylater/Detail.jsx | 2 +- .../js/Customer/{Coin => Poin}/Detail.jsx | 12 ++-- .../js/Customer/{Coin => Poin}/Exchange.jsx | 8 +-- .../js/Customer/{Coin => Poin}/Index.jsx | 26 ++++---- .../Customer/{Coin => Poin}/VoucherCard.jsx | 6 +- resources/js/Customer/Profile/Index.jsx | 4 +- resources/js/Layouts/CustomerLayout.jsx | 6 +- resources/js/Layouts/Partials/routes.js | 8 +-- resources/js/Pages/Customer/Index.jsx | 4 +- .../{CoinReward => PoinReward}/FormModal.jsx | 18 +++--- .../{CoinReward => PoinReward}/Index.jsx | 16 ++--- resources/js/Pages/Setting/Index.jsx | 21 +++++-- resources/js/Pages/Voucher/Form.jsx | 12 ++-- resources/js/Pages/Voucher/Import.jsx | 10 ++-- routes/admin.php | 12 ++-- routes/web.php | 14 ++--- 48 files changed, 345 insertions(+), 260 deletions(-) delete mode 100644 app/Http/Controllers/Customer/CoinController.php create mode 100644 app/Http/Controllers/Customer/PoinController.php rename app/Http/Controllers/Customer/{CoinExchangeController.php => PoinExchangeController.php} (76%) rename app/Http/Controllers/{CoinRewardController.php => PoinRewardController.php} (72%) create mode 100644 app/Models/PoinHistory.php rename app/Models/{CoinReward.php => PoinReward.php} (81%) rename database/migrations/{2023_05_24_130650_create_coin_histories_table.php => 2023_06_16_045835_create_poin_histories_table.php} (89%) rename database/migrations/{2023_05_24_145103_create_coin_rewards_table.php => 2023_06_16_045840_create_poin_rewards_table.php} (81%) rename resources/js/Customer/{Coin => Poin}/Detail.jsx (76%) rename resources/js/Customer/{Coin => Poin}/Exchange.jsx (95%) rename resources/js/Customer/{Coin => Poin}/Index.jsx (80%) rename resources/js/Customer/{Coin => Poin}/VoucherCard.jsx (95%) rename resources/js/Pages/{CoinReward => PoinReward}/FormModal.jsx (90%) rename resources/js/Pages/{CoinReward => PoinReward}/Index.jsx (95%) diff --git a/.env.example b/.env.example index 1d88053..7ccfa9d 100644 --- a/.env.example +++ b/.env.example @@ -8,7 +8,12 @@ LOG_CHANNEL=stack LOG_DEPRECATIONS_CHANNEL=null LOG_LEVEL=debug -DB_CONNECTION=sqlite +DB_CONNECTION=mysql +DB_HOST=127.0.0.1 +DB_PORT=3306 +DB_DATABASE=voucher +DB_USERNAME=root +DB_PASSWORD= BROADCAST_DRIVER=log CACHE_DRIVER=file diff --git a/TODO.md b/TODO.md index ae7fbbe..4640904 100644 --- a/TODO.md +++ b/TODO.md @@ -1,48 +1 @@ # TODO - -### Admin - -- [x] CRUD Info -- [x] CRUD Banner -- [x] CRUD Rekening / Account -- [x] CRUD Customer -- [x] CRUD Lokasi -- [x] CRUD Voucher -- [x] Import Voucher -- [x] Setting Web (enable affilate, amount bonus affilate) -- [x] Setting Level Customer (view levels, edit name of level,minimal saldo, max amount saldo, max hutang) -- [x] Deposit Menu (view daftar histori deposit) -- [x] Manual Approve Deposit -- [x] List Customer Verification -- [x] Manual Approve Verification -> mendapatkan limit hutang -- [x] Setting Bonus Coin (memasukan amount bonus coin yang didapat dengan level dan harga voucher) - bonus coin -- [x] Voucher Sales (index: customer, total, jumlah voucher, detail: customer, list voucher, payment) -- [x] Dashboard (gafik hasil penjualan : disorting tanggal, lokasi dan customer) -- [x] Notification ([x]manual deposit, [x]deposit success, [x]stock voucher, [x]sale) -- [x] Voucher - harga per level , fixing detail transaksi -- [x] Voucher - harga coin -- [ ] View Customer Coin History - -### Add - -- hutang (paylater) adalah limit tiap customer jika deposit kurang dalam pembayaran voucher , setiap limit yang digunakan akan di potong / di lunasi ketika melakukan topup deposit -- tukar coin adalah dengan menambahkan harga coin di voucher dan menambahkan 1 fitur di customer untuk explorer voucher yang memiliki harga coin, disimpan menjadi sale biasa dengan cara 1 kali penukaran adalah 1 voucher - -### Customer - -- [x] Tampilan Depan Customer (banner, info, voucher, saldo, coin) - mobile page -- [x] Register Customer (wajib data lengkap) -- [x] Register Customer Gmail -- [x] Login Customer -- [x] Login Customer Gmail -- [x] Customer Edit Profile -- [x] Customer Deposit Manual -- [x] Customer Deposit Payment Gateway -- [x] Customer Purchase Voucher -- [x] Customer Share Buyed Voucher, via WA dll -- [x] Register Refferal -- [x] Customer View Coin History -- [x] Verified Akun -- [x] Paylater: index paylater, payment cart, deposite repay -- [x] Notification ([x] purchase success, [x] deposit success) -- [x] Coin Explorer: list voucher, modal voucher to excange diff --git a/app/Http/Controllers/Customer/AuthController.php b/app/Http/Controllers/Customer/AuthController.php index bab86ec..3a6d4df 100644 --- a/app/Http/Controllers/Customer/AuthController.php +++ b/app/Http/Controllers/Customer/AuthController.php @@ -73,7 +73,7 @@ class AuthController extends Controller 'fullname' => $user->name, 'name' => $user->nickname, 'email' => $user->email, - 'username' => Str::slug($user->name.'_'.Str::random(5), '_'), + 'username' => Str::slug($user->name . '_' . Str::random(5), '_'), 'google_id' => $user->id, 'google_oauth_response' => json_encode($user), ]); @@ -98,7 +98,7 @@ class AuthController extends Controller 'fullname' => 'required|string', 'name' => 'required|string', 'address' => 'required|string', - 'phone' => 'required|numeric', + 'phone' => 'required|numeric|regex:/^([0-9\s\-\+\(\)]*)$/|min:9|max:16', 'username' => 'required|string|min:5|alpha_dash|unique:customers,username', 'password' => 'required|string|min:8|confirmed', 'referral_code' => 'nullable|exists:customers,referral_code', @@ -123,13 +123,13 @@ class AuthController extends Controller $affilateEnabled = Setting::getByKey('AFFILATE_ENABLED'); if ($affilateEnabled == 1) { - $bonusCoin = Setting::getByKey('AFFILATE_COIN_AMOUNT'); - $coin = $refferal->coins()->create([ - 'debit' => $bonusCoin, - 'description' => 'Bonus Refferal #'.Str::random(5), + $bonuspoin = Setting::getByKey('AFFILATE_poin_AMOUNT'); + $poin = $refferal->poins()->create([ + 'debit' => $bonuspoin, + 'description' => 'Bonus Refferal #' . Str::random(5), ]); - $coin->update_customer_balance(); + $poin->update_customer_balance(); } } @@ -143,7 +143,7 @@ class AuthController extends Controller public function destroy() { session()->remove('carts'); - + Auth::logout(); return redirect()->route('customer.login') diff --git a/app/Http/Controllers/Customer/CartController.php b/app/Http/Controllers/Customer/CartController.php index 51a4e61..72eceb0 100644 --- a/app/Http/Controllers/Customer/CartController.php +++ b/app/Http/Controllers/Customer/CartController.php @@ -3,7 +3,7 @@ namespace App\Http\Controllers\Customer; use App\Http\Controllers\Controller; -use App\Models\CoinReward; +use App\Models\PoinReward; use App\Models\Customer; use App\Models\DepositHistory; use App\Models\Sale; @@ -17,7 +17,7 @@ class CartController extends Controller /** * show list of item in cart * has payed button - * show payment method -> deposit, coin, paylater + * show payment method -> deposit, poin, paylater */ public function index() { @@ -159,20 +159,20 @@ class CartController extends Controller } $sale->create_notification(); - $bonus = CoinReward::where('customer_level_id', $customer->customer_level_id) + $bonus = PoinReward::where('customer_level_id', $customer->customer_level_id) ->where('amount_buy', '<=', $total) - ->orderBy('bonus_coin', 'desc')->first(); + ->orderBy('bonus_poin', 'desc')->first(); if ($bonus != null) { - $coin = $customer->coins()->create([ - 'debit' => $bonus->bonus_coin, - 'description' => 'Bonus Pembelian #'.$sale->code, + $poin = $customer->poins()->create([ + 'debit' => $bonus->bonus_poin, + 'description' => 'Bonus Pembelian #' . $sale->code, ]); - $coin->update_customer_balance(); + $poin->update_customer_balance(); } - $description = 'Pembayaran #'.$sale->code; + $description = 'Pembayaran #' . $sale->code; if ($customer->deposit_balance < $total) { if ($customer->deposit_balance > 0) { diff --git a/app/Http/Controllers/Customer/CoinController.php b/app/Http/Controllers/Customer/CoinController.php deleted file mode 100644 index 3e1861b..0000000 --- a/app/Http/Controllers/Customer/CoinController.php +++ /dev/null @@ -1,26 +0,0 @@ -id()) - ->orderBy('updated_at', 'desc'); - - return inertia('Coin/Index', [ - 'coins' => $coins->paginate(20), - ]); - } - - public function show(CoinHistory $coin) - { - return inertia('Coin/Detail', [ - 'coin' => $coin, - ]); - } -} diff --git a/app/Http/Controllers/Customer/PoinController.php b/app/Http/Controllers/Customer/PoinController.php new file mode 100644 index 0000000..060fdff --- /dev/null +++ b/app/Http/Controllers/Customer/PoinController.php @@ -0,0 +1,26 @@ +id()) + ->orderBy('updated_at', 'desc'); + + return inertia('Poin/Index', [ + 'poins' => $poins->paginate(20), + ]); + } + + public function show(poinHistory $poin) + { + return inertia('Poin/Detail', [ + 'poin' => $poin, + ]); + } +} diff --git a/app/Http/Controllers/Customer/CoinExchangeController.php b/app/Http/Controllers/Customer/PoinExchangeController.php similarity index 76% rename from app/Http/Controllers/Customer/CoinExchangeController.php rename to app/Http/Controllers/Customer/PoinExchangeController.php index 9d3e581..7603384 100644 --- a/app/Http/Controllers/Customer/CoinExchangeController.php +++ b/app/Http/Controllers/Customer/PoinExchangeController.php @@ -10,15 +10,15 @@ use App\Models\Voucher; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; -class CoinExchangeController extends Controller +class PoinExchangeController extends Controller { public function index(Request $request) { $locations = Location::get(); $vouchers = Voucher::with(['location']) ->where(function ($q) { - $q->where('price_coin', '!=', 0) - ->where('price_coin', '!=', null); + $q->where('price_poin', '!=', 0) + ->where('price_poin', '!=', null); }) ->where('is_sold', Voucher::UNSOLD) ->groupBy('batch_id') @@ -28,7 +28,7 @@ class CoinExchangeController extends Controller $vouchers->where('location_id', $request->location_id); } - return inertia('Coin/Exchange', [ + return inertia('Poin/Exchange', [ 'locations' => $locations, 'vouchers' => tap($vouchers->paginate(10))->setHidden(['username', 'password']), '_location_id' => $request->location_id ?? '', @@ -39,30 +39,30 @@ class CoinExchangeController extends Controller { $batchCount = $voucher->count_unsold(); if ($batchCount < 1) { - return redirect()->route('customer.coin.exchange') + return redirect()->route('customer.poin.exchange') ->with('message', ['type' => 'error', 'message' => 'transaksi gagal, voucher sedang tidak tersedia']); } $customer = Customer::find(auth()->id()); - if ($customer->coin_balance < $voucher->price_coin) { - return redirect()->route('customer.coin.exchange') + if ($customer->poin_balance < $voucher->price_poin) { + return redirect()->route('customer.poin.exchange') ->with('message', ['type' => 'error', 'message' => 'koin kamu tidak cukup untuk ditukar voucher ini']); } DB::beginTransaction(); $sale = $customer->sales()->create([ - 'code' => 'Tukar Coin '.str()->upper(str()->random(5)), + 'code' => 'Tukar poin ' . str()->upper(str()->random(5)), 'date_time' => now(), 'amount' => 0, - 'payed_with' => Sale::PAYED_WITH_COIN, + 'payed_with' => Sale::PAYED_WITH_poin, ]); $voucher = $voucher->shuffle_unsold(); $sale->items()->create([ 'entity_type' => $voucher::class, 'entity_id' => $voucher->id, - 'price' => $voucher->price_coin, + 'price' => $voucher->price_poin, 'quantity' => 1, 'additional_info_json' => json_encode([ 'id' => $voucher->id, @@ -76,12 +76,12 @@ class CoinExchangeController extends Controller $sale->create_notification(); - $coin = $customer->coins()->create([ - 'credit' => $voucher->price_coin, + $poin = $customer->poins()->create([ + 'credit' => $voucher->price_poin, 'description' => $sale->code, ]); - $coin->update_customer_balance(); + $poin->update_customer_balance(); DB::commit(); return redirect()->route('transactions.show', $sale) diff --git a/app/Http/Controllers/GeneralController.php b/app/Http/Controllers/GeneralController.php index adb97db..e83cc6a 100644 --- a/app/Http/Controllers/GeneralController.php +++ b/app/Http/Controllers/GeneralController.php @@ -24,9 +24,9 @@ class GeneralController extends Controller $month = now()->locale('id')->translatedFormat('F'); $startOfMonth = now()->startOfMonth()->format('m/d/Y'); $endOfMonth = now()->endOfMonth()->format('m/d/Y'); - $total_voucher_sale_this_month = SaleItem::whereBetween(DB::raw("strftime('%m/%d/%Y', created_at)"), [$startOfMonth, $endOfMonth]) + $total_voucher_sale_this_month = SaleItem::whereBetween("created_at", [$startOfMonth, $endOfMonth]) ->sum('price'); - $count_voucher_sale_this_month = SaleItem::whereBetween(DB::raw("strftime('%m/%d/%Y', created_at)"), [$startOfMonth, $endOfMonth]) + $count_voucher_sale_this_month = SaleItem::whereBetween("created_at", [$startOfMonth, $endOfMonth]) ->sum('quantity'); $total_voucher_sale_this_day = SaleItem::whereDate('created_at', now()->format('Y-m-d')) ->sum('price'); @@ -61,10 +61,10 @@ class GeneralController extends Controller if ($request->end_date != '') { $endDate = Carbon::parse($request->end_date)->format('m/d/Y'); } - $charts = Sale::selectRaw("SUM(amount) as sale_total, strftime('%d/%m/%Y', date_time) as date") - ->whereBetween(DB::raw("strftime('%m/%d/%Y', date_time)"), [$startDate, $endDate]) + $charts = Sale::selectRaw('SUM(amount) as sale_total, date_time') + ->whereBetween('date_time', [$startDate, $endDate]) ->orderBy('date_time', 'asc') - ->groupBy(DB::raw("strftime('%m/%d/%Y', date_time)")); + ->groupBy('date_time'); // filter lokasi if ($request->location_id != '') { diff --git a/app/Http/Controllers/CoinRewardController.php b/app/Http/Controllers/PoinRewardController.php similarity index 72% rename from app/Http/Controllers/CoinRewardController.php rename to app/Http/Controllers/PoinRewardController.php index f9c3248..27ab17a 100644 --- a/app/Http/Controllers/CoinRewardController.php +++ b/app/Http/Controllers/PoinRewardController.php @@ -2,18 +2,18 @@ namespace App\Http\Controllers; -use App\Models\CoinReward; +use App\Models\PoinReward; use App\Models\CustomerLevel; use Illuminate\Http\Request; -class CoinRewardController extends Controller +class PoinRewardController extends Controller { public function index() { - $query = CoinReward::with(['level']) + $query = PoinReward::with(['level']) ->orderBy('updated_at', 'desc'); - return inertia('CoinReward/Index', [ + return inertia('PoinReward/Index', [ 'query' => $query->paginate(), 'levels' => CustomerLevel::all(), ]); @@ -23,37 +23,37 @@ class CoinRewardController extends Controller { $request->validate([ 'amount_buy' => 'required|numeric', - 'bonus_coin' => 'required|numeric', + 'bonus_poin' => 'required|numeric', 'customer_level_id' => 'required|exists:customer_levels,id', ]); - CoinReward::create([ + PoinReward::create([ 'amount_buy' => $request->amount_buy, - 'bonus_coin' => $request->bonus_coin, + 'bonus_poin' => $request->bonus_poin, 'customer_level_id' => $request->customer_level_id, ]); session()->flash('message', ['type' => 'success', 'message' => 'Item has beed saved']); } - public function update(Request $request, CoinReward $reward) + public function update(Request $request, PoinReward $reward) { $request->validate([ 'amount_buy' => 'required|numeric', - 'bonus_coin' => 'required|numeric', + 'bonus_poin' => 'required|numeric', 'customer_level_id' => 'required|exists:customer_levels,id', ]); $reward->update([ 'amount_buy' => $request->amount_buy, - 'bonus_coin' => $request->bonus_coin, + 'bonus_poin' => $request->bonus_poin, 'customer_level_id' => $request->customer_level_id, ]); session()->flash('message', ['type' => 'success', 'message' => 'Item has beed updated']); } - public function destroy(CoinReward $reward) + public function destroy(PoinReward $reward) { $reward->delete(); diff --git a/app/Http/Controllers/SettingController.php b/app/Http/Controllers/SettingController.php index 4b89073..4371d5a 100644 --- a/app/Http/Controllers/SettingController.php +++ b/app/Http/Controllers/SettingController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers; use App\Models\Setting; use Illuminate\Http\Request; +use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\DB; class SettingController extends Controller @@ -21,9 +22,10 @@ class SettingController extends Controller public function update(Request $request) { $request->validate([ + 'OPEN_WEBSITE_NAME' => 'required|string', 'VOUCHER_STOCK_NOTIFICATION' => 'required|numeric', 'AFFILATE_ENABLED' => 'required|in:0,1', - 'AFFILATE_COIN_AMOUNT' => 'required|numeric', + 'AFFILATE_POIN_AMOUNT' => 'required|numeric', 'MIDTRANS_SERVER_KEY' => 'required|string', 'MIDTRANS_CLIENT_KEY' => 'required|string', 'MIDTRANS_MERCHANT_ID' => 'required|string', @@ -42,6 +44,8 @@ class SettingController extends Controller Setting::where('key', 'MIDTRANS_LOGO')->update(['value' => $file->hashName('uploads')]); } + Cache::flush(); + DB::commit(); session()->flash('message', ['type' => 'success', 'message' => 'Setting has beed saved']); diff --git a/app/Http/Controllers/VoucherController.php b/app/Http/Controllers/VoucherController.php index 90d3142..1150822 100644 --- a/app/Http/Controllers/VoucherController.php +++ b/app/Http/Controllers/VoucherController.php @@ -47,7 +47,7 @@ class VoucherController extends Controller 'password' => 'required|string', 'discount' => 'required|numeric', 'display_price' => 'required|numeric', - 'price_coin' => 'nullable|numeric', + 'price_poin' => 'nullable|numeric', 'quota' => 'required|string', 'profile' => 'required|string', 'comment' => 'required|string', @@ -67,7 +67,7 @@ class VoucherController extends Controller 'password' => $request->password, 'discount' => $request->discount, 'display_price' => $request->display_price, - 'price_coin' => $request->price_coin, + 'price_poin' => $request->price_poin, 'quota' => $request->quota, 'profile' => $request->profile, 'comment' => $request->comment, @@ -110,7 +110,7 @@ class VoucherController extends Controller 'password' => 'required|string', 'discount' => 'required|numeric', 'display_price' => 'required|numeric', - 'price_coin' => 'nullable|numeric', + 'price_poin' => 'nullable|numeric', 'quota' => 'required|string', 'profile' => 'required|string', 'comment' => 'required|string', @@ -135,7 +135,7 @@ class VoucherController extends Controller 'location_id' => $request->location_id, 'discount' => $request->discount, 'display_price' => $request->display_price, - 'price_coin' => $request->price_coin, + 'price_poin' => $request->price_poin, 'quota' => $request->quota, 'profile' => $request->profile, 'comment' => $request->comment, @@ -184,7 +184,7 @@ class VoucherController extends Controller 'location_id' => 'required|exists:locations,id', 'discount' => 'required|numeric', 'display_price' => 'required|numeric', - 'price_coin' => 'nullable|numeric', + 'price_poin' => 'nullable|numeric', 'expired' => 'required|numeric', 'expired_unit' => 'required|string', 'prices' => 'nullable|array', @@ -203,7 +203,7 @@ class VoucherController extends Controller 'password' => $voucher['password'], 'discount' => $request->discount, 'display_price' => $request->display_price, - 'price_coin' => $request->price_coin, + 'price_poin' => $request->price_poin, 'quota' => $voucher['quota'], 'profile' => $voucher['profile'], 'comment' => $voucher['comment'], diff --git a/app/Http/Middleware/HandleInertiaCustomerRequests.php b/app/Http/Middleware/HandleInertiaCustomerRequests.php index 9a32b4e..690e3d4 100644 --- a/app/Http/Middleware/HandleInertiaCustomerRequests.php +++ b/app/Http/Middleware/HandleInertiaCustomerRequests.php @@ -3,6 +3,7 @@ namespace App\Http\Middleware; use App\Models\Notification; +use App\Models\Setting; use Illuminate\Http\Request; use Inertia\Middleware; @@ -45,6 +46,7 @@ class HandleInertiaCustomerRequests extends Middleware return array_merge(parent::share($request), [ 'app_name' => env('APP_NAME', 'App Name'), + 'setting' => Setting::getSettings(), 'auth' => [ 'user' => auth('customer')->user()?->load(['level', 'paylater']), ], @@ -53,6 +55,7 @@ class HandleInertiaCustomerRequests extends Middleware ], 'notification_count' => $notification_count, 'cart_count' => $cart_count, + ]); } } diff --git a/app/Models/CoinHistory.php b/app/Models/CoinHistory.php index 3578029..1c48480 100644 --- a/app/Models/CoinHistory.php +++ b/app/Models/CoinHistory.php @@ -5,7 +5,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Support\Carbon; -class CoinHistory extends Model +class poinHistory extends Model { protected $fillable = [ 'debit', @@ -55,6 +55,6 @@ class CoinHistory extends Model public function update_customer_balance() { $customer = Customer::find($this->customer_id); - $customer->update(['coin_balance' => $customer->coin_balance + $this->debit - $this->credit]); + $customer->update(['poin_balance' => $customer->poin_balance + $this->debit - $this->credit]); } } diff --git a/app/Models/Customer.php b/app/Models/Customer.php index 2ac9e6a..ff166a0 100644 --- a/app/Models/Customer.php +++ b/app/Models/Customer.php @@ -32,7 +32,7 @@ class Customer extends Authenticatable 'referral_code', 'google_id', 'deposit_balance', - 'coin_balance', + 'poin_balance', 'identity_verified', 'identity_image', 'customer_level_id', @@ -48,7 +48,7 @@ class Customer extends Authenticatable 'image_url', 'identity_image_url', 'display_deposit', - 'display_coin', + 'display_poin', 'display_phone', 'paylater_limit', 'is_allow_paylater', @@ -126,7 +126,7 @@ class Customer extends Authenticatable return ' - '; } - return '+62'.$this->phone; + return '+62' . $this->phone; }); } @@ -137,10 +137,10 @@ class Customer extends Authenticatable }); } - public function displayCoin(): Attribute + public function displayPoin(): Attribute { return Attribute::make(get: function () { - return number_format($this->coin_balance, is_float($this->coin_balance) ? 2 : 0, ',', '.'); + return number_format($this->poin_balance, is_float($this->poin_balance) ? 2 : 0, ',', '.'); }); } @@ -188,9 +188,9 @@ class Customer extends Authenticatable return $this->hasMany(DepositHistory::class); } - public function coins() + public function poins() { - return $this->hasMany(CoinHistory::class); + return $this->hasMany(PoinHistory::class); } public function paylater() @@ -234,7 +234,7 @@ class Customer extends Authenticatable $paylater = $this->paylaterHistories()->create([ 'credit' => $cut, - 'description' => $deposit->description.' (Pengembalian)', + 'description' => $deposit->description . ' (Pengembalian)', ]); $paylater->update_customer_paylater(); diff --git a/app/Models/PoinHistory.php b/app/Models/PoinHistory.php new file mode 100644 index 0000000..50b43fe --- /dev/null +++ b/app/Models/PoinHistory.php @@ -0,0 +1,60 @@ +created_at)->locale('id')->translatedFormat('d F Y'); + }); + } + + public function formatCreatedAt(): Attribute + { + return Attribute::make(get: function () { + return Carbon::parse($this->created_at)->locale('id')->translatedFormat('d F Y H:i:s'); + }); + } + + public function amount(): Attribute + { + return Attribute::make(get: function () { + if ($this->credit == 0) { + return number_format($this->debit, is_float($this->debit) ? 2 : 0, ',', '.'); + } + + return number_format($this->credit, is_float($this->credit) ? 2 : 0, ',', '.'); + }); + } + + public function customer() + { + return $this->belongsTo(Customer::class); + } + + public function update_customer_balance() + { + $customer = Customer::find($this->customer_id); + $customer->update(['poin_balance' => $customer->poin_balance + $this->debit - $this->credit]); + } +} diff --git a/app/Models/CoinReward.php b/app/Models/PoinReward.php similarity index 81% rename from app/Models/CoinReward.php rename to app/Models/PoinReward.php index 3f6f85d..aba8392 100644 --- a/app/Models/CoinReward.php +++ b/app/Models/PoinReward.php @@ -2,11 +2,11 @@ namespace App\Models; -class CoinReward extends Model +class PoinReward extends Model { protected $fillable = [ 'amount_buy', - 'bonus_coin', + 'bonus_poin', 'customer_level_id', ]; diff --git a/app/Models/Sale.php b/app/Models/Sale.php index 8017575..5f47a52 100644 --- a/app/Models/Sale.php +++ b/app/Models/Sale.php @@ -15,7 +15,7 @@ class Sale extends Model const PAYED_WITH_PAYLATER = 'paylater'; - const PAYED_WITH_COIN = 'coin'; + const PAYED_WITH_poin = 'poin'; protected $fillable = [ 'code', @@ -63,21 +63,21 @@ class Sale extends Model public function displayAmount(): Attribute { return Attribute::make(get: function () { - return 'Rp'.number_format($this->amount, is_float($this->amount) ? 2 : 0, ',', '.'); + return 'Rp' . number_format($this->amount, is_float($this->amount) ? 2 : 0, ',', '.'); }); } public function create_notification() { - if ($this->payed_with == self::PAYED_WITH_COIN) { + if ($this->payed_with == self::PAYED_WITH_poin) { Notification::create([ 'entity_type' => User::class, - 'description' => $this->customer->fullname.' melakukan penukaran '.$this->items()->count().' voucher sebesar '.$this->items->value('price').' coin', + 'description' => $this->customer->fullname . ' melakukan penukaran ' . $this->items()->count() . ' voucher sebesar ' . $this->items->value('price') . ' poin', ]); Notification::create([ 'entity_id' => auth()->id(), - 'description' => 'Transaksi '.$this->code.' berhasil', + 'description' => 'Transaksi ' . $this->code . ' berhasil', ]); return; @@ -85,12 +85,12 @@ class Sale extends Model Notification::create([ 'entity_type' => User::class, - 'description' => $this->customer->fullname.' melakukan pembelian '.$this->items()->count().' voucher sebesar '.$this->display_amount, + 'description' => $this->customer->fullname . ' melakukan pembelian ' . $this->items()->count() . ' voucher sebesar ' . $this->display_amount, ]); Notification::create([ 'entity_id' => auth()->id(), - 'description' => 'Transaksi pembelian anda #'.$this->code.' sebesar '.$this->display_amount.' berhasil', + 'description' => 'Transaksi pembelian anda #' . $this->code . ' sebesar ' . $this->display_amount . ' berhasil', ]); } } diff --git a/app/Models/Setting.php b/app/Models/Setting.php index ac494cf..e7a021a 100644 --- a/app/Models/Setting.php +++ b/app/Models/Setting.php @@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Concerns\HasUlids; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; +use Illuminate\Support\Facades\Cache; class Setting extends Model { @@ -43,4 +44,18 @@ class Setting extends Model { return Setting::where('key', $key)->value('value'); } + + public static function getSettings() + { + $data = Cache::get('settings'); + if ($data == null) { + $settings = Setting::where('key', 'like', 'OPEN%')->get(); + foreach ($settings as $setting) { + $data[$setting->key] = $setting->value; + } + Cache::put('settings', $data, now()->addDay()); + } + + return $data; + } } diff --git a/app/Models/Voucher.php b/app/Models/Voucher.php index 6f5202b..20d4ad2 100644 --- a/app/Models/Voucher.php +++ b/app/Models/Voucher.php @@ -17,7 +17,7 @@ class Voucher extends Model 'location_id', 'username', 'password', - 'price_coin', // harga voucher untuk ditukarkan dengan coin + 'price_poin', // harga voucher untuk ditukarkan dengan poin 'price', // harga jual 'discount', 'display_price', //yang di input user @@ -63,14 +63,14 @@ class Voucher extends Model public function displayQuota(): Attribute { return Attribute::make(get: function () { - return round($this->quota / (1024 * 1024 * 1024), 2).' GB'; + return round($this->quota / (1024 * 1024 * 1024), 2) . ' GB'; }); } public function displayExpired(): Attribute { return Attribute::make(get: function () { - return $this->expired.' '.$this->expired_unit; + return $this->expired . ' ' . $this->expired_unit; }); } @@ -146,7 +146,7 @@ class Voucher extends Model if ($count <= $treshold) { Notification::create([ 'entity_type' => User::class, - 'description' => 'stok voucher '.$this->location->name.' ( '.$this->profile.' ) '.'tersisa : '.$count, + 'description' => 'stok voucher ' . $this->location->name . ' ( ' . $this->profile . ' ) ' . 'tersisa : ' . $count, ]); } } diff --git a/app/Services/GeneralService.php b/app/Services/GeneralService.php index 9e2a209..c176a1f 100644 --- a/app/Services/GeneralService.php +++ b/app/Services/GeneralService.php @@ -70,7 +70,7 @@ class GeneralService public static function getCartEnablePayment() { // deposit - // coin + // poin // paylater } } diff --git a/config/database.php b/config/database.php index 137ad18..84b10bb 100644 --- a/config/database.php +++ b/config/database.php @@ -61,6 +61,15 @@ return [ 'options' => extension_loaded('pdo_mysql') ? array_filter([ PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), ]) : [], + 'modes' => [ + // 'ONLY_FULL_GROUP_BY', // Disable this to allow grouping by one column + 'STRICT_TRANS_TABLES', + 'NO_ZERO_IN_DATE', + 'NO_ZERO_DATE', + 'ERROR_FOR_DIVISION_BY_ZERO', + 'NO_AUTO_CREATE_USER', + 'NO_ENGINE_SUBSTITUTION', + ], ], 'pgsql' => [ diff --git a/database/migrations/2023_05_24_130522_create_vouchers_table.php b/database/migrations/2023_05_24_130522_create_vouchers_table.php index 6a668e5..0b840be 100644 --- a/database/migrations/2023_05_24_130522_create_vouchers_table.php +++ b/database/migrations/2023_05_24_130522_create_vouchers_table.php @@ -19,7 +19,7 @@ return new class extends Migration $table->ulid('location_id')->nullable(); $table->string('username')->nullable(); $table->string('password')->nullable(); - $table->decimal('price_coin', 20, 2)->default(0); + $table->decimal('price_poin', 20, 2)->default(0); $table->decimal('price', 20, 2)->default(0); $table->decimal('discount', 20, 0)->default(0); $table->decimal('display_price', 20, 2)->default(0); diff --git a/database/migrations/2023_05_24_130552_create_customers_table.php b/database/migrations/2023_05_24_130552_create_customers_table.php index 3f916af..f1e14d1 100644 --- a/database/migrations/2023_05_24_130552_create_customers_table.php +++ b/database/migrations/2023_05_24_130552_create_customers_table.php @@ -25,7 +25,7 @@ return new class extends Migration $table->string('referral_code')->nullable(); $table->string('google_id')->nullable(); $table->decimal('deposit_balance', 20, 2)->default(0); - $table->decimal('coin_balance', 20, 2)->default(0); + $table->decimal('poin_balance', 20, 2)->default(0); $table->smallInteger('identity_verified')->default(0); $table->string('identity_image')->nullable(); $table->ulid('customer_level_id')->nullable(); diff --git a/database/migrations/2023_05_24_130650_create_coin_histories_table.php b/database/migrations/2023_06_16_045835_create_poin_histories_table.php similarity index 89% rename from database/migrations/2023_05_24_130650_create_coin_histories_table.php rename to database/migrations/2023_06_16_045835_create_poin_histories_table.php index ed10528..9689342 100644 --- a/database/migrations/2023_05_24_130650_create_coin_histories_table.php +++ b/database/migrations/2023_06_16_045835_create_poin_histories_table.php @@ -11,7 +11,7 @@ return new class extends Migration */ public function up(): void { - Schema::create('coin_histories', function (Blueprint $table) { + Schema::create('poin_histories', function (Blueprint $table) { $table->ulid('id')->primary(); $table->decimal('debit', 20, 2)->default(0); @@ -34,6 +34,6 @@ return new class extends Migration */ public function down(): void { - Schema::dropIfExists('coin_histories'); + Schema::dropIfExists('poin_histories'); } }; diff --git a/database/migrations/2023_05_24_145103_create_coin_rewards_table.php b/database/migrations/2023_06_16_045840_create_poin_rewards_table.php similarity index 81% rename from database/migrations/2023_05_24_145103_create_coin_rewards_table.php rename to database/migrations/2023_06_16_045840_create_poin_rewards_table.php index 8656cbd..eee2243 100644 --- a/database/migrations/2023_05_24_145103_create_coin_rewards_table.php +++ b/database/migrations/2023_06_16_045840_create_poin_rewards_table.php @@ -11,11 +11,11 @@ return new class extends Migration */ public function up(): void { - Schema::create('coin_rewards', function (Blueprint $table) { + Schema::create('poin_rewards', function (Blueprint $table) { $table->ulid('id')->primary(); $table->decimal('amount_buy', 20, 2)->default(0); - $table->decimal('bonus_coin', 20, 2)->default(0); + $table->decimal('bonus_poin', 20, 2)->default(0); $table->ulid('customer_level_id')->nullable(); $table->timestamps(); @@ -31,6 +31,6 @@ return new class extends Migration */ public function down(): void { - Schema::dropIfExists('coin_rewards'); + Schema::dropIfExists('poin_rewards'); } }; diff --git a/database/seeders/DummySeeder.php b/database/seeders/DummySeeder.php index 016161b..7b519d7 100644 --- a/database/seeders/DummySeeder.php +++ b/database/seeders/DummySeeder.php @@ -41,8 +41,8 @@ class DummySeeder extends Seeder $images = ['1.webp', '2.webp', '3.webp']; foreach ($images as $index => $image) { Banner::create([ - 'title' => 'Banner '.$index, - 'image' => 'sample/'.$image, + 'title' => 'Banner ' . $index, + 'image' => 'sample/' . $image, 'description' => '

Banner

', ]); } @@ -87,7 +87,7 @@ class DummySeeder extends Seeder $batchId = Str::ulid(); $location = Location::get()[$loop]; - $price_coin = $loop == 3 ? 10 : 0; + $price_poin = $loop == 3 ? 10 : 0; foreach ($vouchers as $voucher) { Voucher::create([ @@ -96,7 +96,7 @@ class DummySeeder extends Seeder 'password' => $voucher['password'], 'discount' => $loop == 1 ? 10 : 0, 'display_price' => $loop == 1 ? 100000 : 99000, - 'price_coin' => $price_coin, + 'price_poin' => $price_poin, 'quota' => $voucher['quota'], 'profile' => $voucher['profile'], 'comment' => $voucher['comment'], diff --git a/database/seeders/InstallationSeed.php b/database/seeders/InstallationSeed.php index 78b6a9f..8f4b9dd 100644 --- a/database/seeders/InstallationSeed.php +++ b/database/seeders/InstallationSeed.php @@ -20,8 +20,10 @@ class InstallationSeed extends Seeder public function settings() { $settings = [ + ['key' => 'OPEN_WEBSITE_NAME', 'value' => 'Welcome to Voucher App', 'type' => 'text'], + ['key' => 'AFFILATE_ENABLED', 'value' => '0', 'type' => 'checkbox'], - ['key' => 'AFFILATE_COIN_AMOUNT', 'value' => '0', 'type' => 'text'], + ['key' => 'AFFILATE_POIN_AMOUNT', 'value' => '0', 'type' => 'text'], ['key' => 'MIDTRANS_SERVER_KEY', 'value' => 'SB-Mid-server-UA0LQbY4aALV0CfLLX1v7xs8', 'type' => 'text'], ['key' => 'MIDTRANS_CLIENT_KEY', 'value' => 'SB-Mid-client-xqqkspzoZOM10iUG', 'type' => 'text'], diff --git a/database/seeders/PermissionSeeder.php b/database/seeders/PermissionSeeder.php index 49c1080..1fd8952 100644 --- a/database/seeders/PermissionSeeder.php +++ b/database/seeders/PermissionSeeder.php @@ -61,18 +61,18 @@ class PermissionSeeder extends Seeder ['id' => Str::ulid(), 'label' => 'View Deposit', 'name' => 'view-deposit'], ['id' => Str::ulid(), 'label' => 'Update Deposit', 'name' => 'update-deposit'], - ['id' => Str::ulid(), 'label' => 'View Coin', 'name' => 'view-coin'], - ['id' => Str::ulid(), 'label' => 'Update Coin', 'name' => 'update-coin'], + ['id' => Str::ulid(), 'label' => 'View poin', 'name' => 'view-poin'], + ['id' => Str::ulid(), 'label' => 'Update poin', 'name' => 'update-poin'], // ['id' => Str::ulid(), 'label' => 'Create Sale', 'name' => 'create-sale'], // ['id' => Str::ulid(), 'label' => 'Update Sale', 'name' => 'update-sale'], ['id' => Str::ulid(), 'label' => 'View Sale', 'name' => 'view-sale'], // ['id' => Str::ulid(), 'label' => 'Delete Sale', 'name' => 'delete-sale'], - ['id' => Str::ulid(), 'label' => 'Create Coin Reward', 'name' => 'create-coin-reward'], - ['id' => Str::ulid(), 'label' => 'Update Coin Reward', 'name' => 'update-coin-reward'], - ['id' => Str::ulid(), 'label' => 'View Coin Reward', 'name' => 'view-coin-reward'], - ['id' => Str::ulid(), 'label' => 'Delete Coin Reward', 'name' => 'delete-coin-reward'], + ['id' => Str::ulid(), 'label' => 'Create poin Reward', 'name' => 'create-poin-reward'], + ['id' => Str::ulid(), 'label' => 'Update poin Reward', 'name' => 'update-poin-reward'], + ['id' => Str::ulid(), 'label' => 'View poin Reward', 'name' => 'view-poin-reward'], + ['id' => Str::ulid(), 'label' => 'Delete poin Reward', 'name' => 'delete-poin-reward'], ['id' => Str::ulid(), 'label' => 'Create Bank Account', 'name' => 'create-account'], ['id' => Str::ulid(), 'label' => 'Update Bank Account', 'name' => 'update-account'], diff --git a/docker-compose.yml b/docker-compose.yml index 160ca97..e00bdf0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -47,6 +47,30 @@ services: cpus: 0.5 networks: - voucher + mariadb: + image: mariadb:latest + container_name: voucher-mariadb + restart: always + ports: + - 3306:3306 + volumes: + - mariadb:/var/lib/mysql + - ./database:/database + environment: + MARIADB_DATABASE: voucher + MARIADB_USER: aji + MARIADB_PASSWORD: eta + MARIADB_ROOT_PASSWORD: eta + mem_limit: 512m + mem_reservation: 128M + cpus: 1 + networks: + voucher: + ipv4_address: 10.25.10.99 + +volumes: + mariadb: + driver: local networks: voucher: diff --git a/resources/js/Customer/Index/BalanceBanner.jsx b/resources/js/Customer/Index/BalanceBanner.jsx index 16d553a..9f368e4 100644 --- a/resources/js/Customer/Index/BalanceBanner.jsx +++ b/resources/js/Customer/Index/BalanceBanner.jsx @@ -17,7 +17,7 @@ export default function BalanceBanner({ user }) {
Rp {user.display_deposit}
-
Coin {user.display_coin}
+
poin {user.display_poin}
diff --git a/resources/js/Customer/Index/Index.jsx b/resources/js/Customer/Index/Index.jsx index b005ca9..b9c0084 100644 --- a/resources/js/Customer/Index/Index.jsx +++ b/resources/js/Customer/Index/Index.jsx @@ -8,14 +8,14 @@ import VoucherCard from './VoucherCard' const GuestBanner = () => { const { - props: { app_name }, + props: { setting }, } = usePage() return (
{/* user */}
-
Welcome to {app_name}
+
{setting.OPEN_WEBSITE_NAME}
@@ -93,7 +93,6 @@ export default function Index(props) {
{user !== null ? : } -
{/* banner */}
diff --git a/resources/js/Customer/Index/Notification.jsx b/resources/js/Customer/Index/Notification.jsx index 3995fe9..be9acec 100644 --- a/resources/js/Customer/Index/Notification.jsx +++ b/resources/js/Customer/Index/Notification.jsx @@ -7,7 +7,7 @@ export default function Index({ auth: { user }, notification: { data, next_page_url }, }) { - const [_notification, setCoins] = useState(data) + const [_notification, setpoins] = useState(data) const handleNextPage = () => { router.get( @@ -18,7 +18,7 @@ export default function Index({ preserveState: true, only: ['notification'], onSuccess: (res) => { - setCoins(_notification.concat(res.props.notification.data)) + setpoins(_notification.concat(res.props.notification.data)) }, } ) @@ -26,7 +26,7 @@ export default function Index({ return ( - +
- +
- +
{ - router.get(route('customer.coin.index')) + router.get(route('customer.poin.index')) }} > @@ -22,11 +22,11 @@ export default function Detail({ coin }) {
- {coin.description} + {poin.description}
-
{coin.amount}
+
{poin.amount}
- {coin.format_created_at} + {poin.format_created_at}
diff --git a/resources/js/Customer/Coin/Exchange.jsx b/resources/js/Customer/Poin/Exchange.jsx similarity index 95% rename from resources/js/Customer/Coin/Exchange.jsx rename to resources/js/Customer/Poin/Exchange.jsx index 3e8b4cf..9dacae8 100644 --- a/resources/js/Customer/Coin/Exchange.jsx +++ b/resources/js/Customer/Poin/Exchange.jsx @@ -9,7 +9,7 @@ const EmptyHere = () => {
Voucher segera tersedia
- Yuk, share referral kamu untuk tingkatkan coinnya + Yuk, share referral kamu untuk tingkatkan poinnya
) @@ -68,11 +68,11 @@ export default function Exhange(props) { return ( - +
-
Tukar Coin
+
Tukar poin
- tukarkan coin anda dengan voucher manarik + tukarkan poin anda dengan voucher manarik
{v.length <= 0 ? ( diff --git a/resources/js/Customer/Coin/Index.jsx b/resources/js/Customer/Poin/Index.jsx similarity index 80% rename from resources/js/Customer/Coin/Index.jsx rename to resources/js/Customer/Poin/Index.jsx index dd4ed3c..269f14b 100644 --- a/resources/js/Customer/Coin/Index.jsx +++ b/resources/js/Customer/Poin/Index.jsx @@ -4,9 +4,9 @@ import CustomerLayout from '@/Layouts/CustomerLayout' export default function Index({ auth: { user }, - coins: { data, next_page_url }, + poins: { data, next_page_url }, }) { - const [_coins, setCoins] = useState(data) + const [_poins, setpoins] = useState(data) const handleNextPage = () => { router.get( @@ -15,9 +15,9 @@ export default function Index({ { replace: true, preserveState: true, - only: ['coins'], + only: ['poins'], onSuccess: (res) => { - setCoins(_coins.concat(res.props.coins.data)) + setpoins(_poins.concat(res.props.poins.data)) }, } ) @@ -25,7 +25,7 @@ export default function Index({ return ( - +
{user.fullname}
@@ -33,36 +33,36 @@ export default function Index({
- Coin + poin
- {user.display_coin} + {user.display_poin}
- {_coins.map((coin) => ( + {_poins.map((poin) => (
router.get( - route('customer.coin.show', coin.id) + route('customer.poin.show', poin.id) ) } >
- {coin.format_human_created_at} + {poin.format_human_created_at}
- {coin.description} + {poin.description}
- {coin.amount} + {poin.amount}
diff --git a/resources/js/Customer/Coin/VoucherCard.jsx b/resources/js/Customer/Poin/VoucherCard.jsx similarity index 95% rename from resources/js/Customer/Coin/VoucherCard.jsx rename to resources/js/Customer/Poin/VoucherCard.jsx index 49f9fa5..5112b4a 100644 --- a/resources/js/Customer/Coin/VoucherCard.jsx +++ b/resources/js/Customer/Poin/VoucherCard.jsx @@ -25,7 +25,7 @@ const ExchangeModal = ({ show, voucher, setShow }) => { {voucher.profile}
- {formatIDR(voucher.price_coin)} Coin + {formatIDR(voucher.price_poin)} poin
@@ -44,7 +44,7 @@ const ExchangeModal = ({ show, voucher, setShow }) => { onClick={() => router.get( route( - 'customer.coin.exchange.process', + 'customer.poin.exchange.process', voucher ) ) @@ -80,7 +80,7 @@ export default function VoucherCard({ voucher }) { {voucher.profile}
- {formatIDR(voucher.price_coin)} Coin + {formatIDR(voucher.price_poin)} poin
diff --git a/resources/js/Customer/Profile/Index.jsx b/resources/js/Customer/Profile/Index.jsx index 1af2c43..6bc174c 100644 --- a/resources/js/Customer/Profile/Index.jsx +++ b/resources/js/Customer/Profile/Index.jsx @@ -122,9 +122,9 @@ export default function Index({ auth: { user }, notification_count }) {
router.get(route('customer.coin.index'))} + onClick={() => router.get(route('customer.poin.index'))} > -
Riwayat Coin
+
Riwayat poin
handleOnClick('customer.coin.exchange')} + onClick={() => handleOnClick('customer.poin.exchange')} >
-
Coin
+
Poin
- Coin + poin - {customer.display_coin} + {customer.display_poin} { const reward = modalState.data if (reward !== null) { - put(route('coin-reward.update', reward), { + put(route('poin-reward.update', reward), { onSuccess: () => handleClose(), }) return } - post(route('coin-reward.store'), { + post(route('poin-reward.store'), { onSuccess: () => handleClose(), }) } @@ -59,7 +59,7 @@ export default function FormModal(props) { if (isEmpty(reward) === false) { setData({ amount_buy: reward.amount_buy, - bonus_coin: reward.bonus_coin, + bonus_poin: reward.bonus_poin, customer_level_id: reward.customer_level_id, }) return @@ -70,7 +70,7 @@ export default function FormModal(props) {