diff --git a/app/Http/Controllers/Customer/AuthController.php b/app/Http/Controllers/Customer/AuthController.php index 3a6d4df..a2a16a3 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), ]); @@ -126,7 +126,7 @@ class AuthController extends Controller $bonuspoin = Setting::getByKey('AFFILATE_poin_AMOUNT'); $poin = $refferal->poins()->create([ 'debit' => $bonuspoin, - 'description' => 'Bonus Refferal #' . Str::random(5), + 'description' => 'Bonus Refferal #'.Str::random(5), ]); $poin->update_customer_balance(); diff --git a/app/Http/Controllers/Customer/CartController.php b/app/Http/Controllers/Customer/CartController.php index 72eceb0..00fac71 100644 --- a/app/Http/Controllers/Customer/CartController.php +++ b/app/Http/Controllers/Customer/CartController.php @@ -3,9 +3,9 @@ namespace App\Http\Controllers\Customer; use App\Http\Controllers\Controller; -use App\Models\PoinReward; use App\Models\Customer; use App\Models\DepositHistory; +use App\Models\PoinReward; use App\Models\Sale; use App\Models\Voucher; use Illuminate\Http\Request; @@ -166,13 +166,13 @@ class CartController extends Controller if ($bonus != null) { $poin = $customer->poins()->create([ 'debit' => $bonus->bonus_poin, - 'description' => 'Bonus Pembelian #' . $sale->code, + 'description' => 'Bonus Pembelian #'.$sale->code, ]); $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/HomeController.php b/app/Http/Controllers/Customer/HomeController.php index 7f90af9..d3d9cde 100644 --- a/app/Http/Controllers/Customer/HomeController.php +++ b/app/Http/Controllers/Customer/HomeController.php @@ -19,7 +19,6 @@ class HomeController extends Controller $locations = Location::orderBy('updated_at', 'desc')->get(); $vouchers = Voucher::with(['location']) ->where('is_sold', Voucher::UNSOLD) - ->groupBy('batch_id') ->orderBy('updated_at', 'desc'); if ($request->location_id != '') { diff --git a/app/Http/Controllers/Customer/PoinExchangeController.php b/app/Http/Controllers/Customer/PoinExchangeController.php index 7603384..f65ce8a 100644 --- a/app/Http/Controllers/Customer/PoinExchangeController.php +++ b/app/Http/Controllers/Customer/PoinExchangeController.php @@ -52,7 +52,7 @@ class PoinExchangeController extends Controller DB::beginTransaction(); $sale = $customer->sales()->create([ - 'code' => 'Tukar poin ' . str()->upper(str()->random(5)), + 'code' => 'Tukar poin '.str()->upper(str()->random(5)), 'date_time' => now(), 'amount' => 0, 'payed_with' => Sale::PAYED_WITH_poin, diff --git a/app/Http/Controllers/GeneralController.php b/app/Http/Controllers/GeneralController.php index e83cc6a..6017890 100644 --- a/app/Http/Controllers/GeneralController.php +++ b/app/Http/Controllers/GeneralController.php @@ -9,7 +9,6 @@ use App\Models\SaleItem; use App\Models\Voucher; use Illuminate\Http\Request; use Illuminate\Support\Carbon; -use Illuminate\Support\Facades\DB; use Illuminate\Support\Str; class GeneralController extends Controller @@ -24,9 +23,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("created_at", [$startOfMonth, $endOfMonth]) + $total_voucher_sale_this_month = SaleItem::whereBetween('created_at', [$startOfMonth, $endOfMonth]) ->sum('price'); - $count_voucher_sale_this_month = SaleItem::whereBetween("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'); diff --git a/app/Http/Controllers/LocationProfileController.php b/app/Http/Controllers/LocationProfileController.php new file mode 100644 index 0000000..545211e --- /dev/null +++ b/app/Http/Controllers/LocationProfileController.php @@ -0,0 +1,169 @@ +orderBy('updated_at', 'desc'); + + if ($request->location_id != '') { + $query->where('location_id', $request->location_id); + } + + if ($request->q != '') { + $query->where('name', 'like', "%$request->q%") + ->orWhere('display_note', 'like', "%$request->q%"); + } + + return inertia('LocationProfile/Index', [ + 'query' => $query->paginate(), + ]); + } + + public function create() + { + return inertia('LocationProfile/Form', [ + 'expireds' => LocationProfile::EXPIRED_UNIT, + 'levels' => CustomerLevel::all(), + ]); + } + + public function store(Request $request) + { + $request->validate([ + 'location_id' => 'required|exists:locations,id', + 'name' => 'required|string', + 'quota' => 'required|string', + 'display_note' => 'nullable|string', + 'expired' => 'required|numeric', + 'expired_unit' => 'required|string', + 'description' => 'nullable|string', + 'min_stock' => 'required|numeric', + 'display_price' => 'required|numeric', + 'discount' => 'required|numeric|min:0|max:100', + 'price_poin' => 'required|numeric', + 'bonus_poin' => 'required|numeric', + 'prices' => 'nullable|array', + 'prices.*.customer_level_id' => 'required|exists:customer_levels,id', + 'prices.*.display_price' => 'required|numeric', + 'prices.*.discount' => 'required|numeric|min:0|max:100', + 'prices.*.price_poin' => 'required|numeric', + 'prices.*.bonus_poin' => 'required|numeric', + ]); + + DB::beginTransaction(); + $profile = LocationProfile::create([ + 'location_id' => $request->location_id, + 'name' => $request->name, + 'quota' => $request->quota, + 'display_note' => $request->display_note, + 'expired' => $request->expired, + 'expired_unit' => $request->expired_unit, + 'description' => $request->description, + 'min_stock' => $request->min_stock, + 'display_price' => $request->display_price, + 'discount' => $request->discount, + 'price_poin' => $request->price_poin, + 'bonus_poin' => $request->bonus_poin, + ]); + + $prices = collect($request->prices); + if ($prices->count() > 0) { + foreach ($prices as $price) { + $profile->prices()->create([ + 'customer_level_id' => $price['customer_level_id'], + 'display_price' => $price['display_price'], + 'discount' => $price['discount'], + 'price_poin' => $price['price_poin'], + 'bonus_poin' => $price['bonus_poin'], + ]); + } + } + DB::commit(); + + return redirect()->route('location-profile.index') + ->with('message', ['type' => 'success', 'message' => 'Item has beed saved']); + } + + public function edit(LocationProfile $profile) + { + return inertia('LocationProfile/Form', [ + 'expireds' => LocationProfile::EXPIRED_UNIT, + 'levels' => CustomerLevel::all(), + 'profile' => $profile->load(['location', 'prices.level']) + ]); + } + + public function update(Request $request, LocationProfile $profile) + { + $request->validate([ + 'location_id' => 'required|exists:locations,id', + 'name' => 'required|string', + 'quota' => 'required|string', + 'display_note' => 'nullable|string', + 'expired' => 'required|numeric', + 'expired_unit' => 'required|string', + 'description' => 'nullable|string', + 'min_stock' => 'required|numeric', + 'display_price' => 'required|numeric', + 'discount' => 'required|numeric|min:0|max:100', + 'price_poin' => 'required|numeric', + 'bonus_poin' => 'required|numeric', + 'prices' => 'nullable|array', + 'prices.*.customer_level_id' => 'required|exists:customer_levels,id', + 'prices.*.display_price' => 'required|numeric', + 'prices.*.discount' => 'required|numeric|min:0|max:100', + 'prices.*.price_poin' => 'required|numeric', + 'prices.*.bonus_poin' => 'required|numeric', + ]); + + DB::beginTransaction(); + $profile->update([ + 'location_id' => $request->location_id, + 'name' => $request->name, + 'quota' => $request->quota, + 'display_note' => $request->display_note, + 'expired' => $request->expired, + 'expired_unit' => $request->expired_unit, + 'description' => $request->description, + 'min_stock' => $request->min_stock, + 'display_price' => $request->display_price, + 'discount' => $request->discount, + 'price_poin' => $request->price_poin, + 'bonus_poin' => $request->bonus_poin, + ]); + + $profile->prices()->delete(); + $prices = collect($request->prices); + if ($prices->count() > 0) { + foreach ($prices as $price) { + $profile->prices()->create([ + 'customer_level_id' => $price['customer_level_id'], + 'display_price' => $price['display_price'], + 'discount' => $price['discount'], + 'price_poin' => $price['price_poin'], + 'bonus_poin' => $price['bonus_poin'], + ]); + } + } + DB::commit(); + + return redirect()->route('location-profile.index') + ->with('message', ['type' => 'success', 'message' => 'Item has beed updated']); + } + + public function destroy(LocationProfile $profile) + { + $profile->delete(); + + return redirect()->route('location-profile.index') + ->with('message', ['type' => 'success', 'message' => 'Item has beed deleted']); + } +} diff --git a/app/Http/Controllers/PoinRewardController.php b/app/Http/Controllers/PoinRewardController.php index 27ab17a..2ead193 100644 --- a/app/Http/Controllers/PoinRewardController.php +++ b/app/Http/Controllers/PoinRewardController.php @@ -2,8 +2,8 @@ namespace App\Http\Controllers; -use App\Models\PoinReward; use App\Models\CustomerLevel; +use App\Models\PoinReward; use Illuminate\Http\Request; class PoinRewardController extends Controller diff --git a/app/Models/CashDepositLocation.php b/app/Models/CashDepositLocation.php index 0463d91..0f8d09c 100644 --- a/app/Models/CashDepositLocation.php +++ b/app/Models/CashDepositLocation.php @@ -2,10 +2,17 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Factories\HasFactory; -use Illuminate\Database\Eloquent\Model; - class CashDepositLocation extends Model { - use HasFactory; + protected $fillable = [ + 'name', + 'address', + 'phone', + 'gmap_url', + 'image', + 'description', + 'open_hour', + 'close_hour', + 'is_active', + ]; } diff --git a/app/Models/CoinHistory.php b/app/Models/CoinHistory.php deleted file mode 100644 index 1c48480..0000000 --- a/app/Models/CoinHistory.php +++ /dev/null @@ -1,60 +0,0 @@ -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/Customer.php b/app/Models/Customer.php index ff166a0..9163cc2 100644 --- a/app/Models/Customer.php +++ b/app/Models/Customer.php @@ -126,7 +126,7 @@ class Customer extends Authenticatable return ' - '; } - return '+62' . $this->phone; + return '+62'.$this->phone; }); } @@ -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/CustomerCart.php b/app/Models/CustomerCart.php index f7934d6..f6d2364 100644 --- a/app/Models/CustomerCart.php +++ b/app/Models/CustomerCart.php @@ -2,10 +2,15 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Factories\HasFactory; -use Illuminate\Database\Eloquent\Model; - class CustomerCart extends Model { - use HasFactory; + protected $fillable = [ + 'customer_id', + 'sale_id', + 'entity_type', + 'entity_id', + 'price', + 'quantity', + 'additional_info_json', + ]; } diff --git a/app/Models/CustomerLevel.php b/app/Models/CustomerLevel.php index 7ce2814..a80f937 100644 --- a/app/Models/CustomerLevel.php +++ b/app/Models/CustomerLevel.php @@ -14,6 +14,13 @@ class CustomerLevel extends Model const MUST_VERIFIED = [self::GOLD, self::PLATINUM]; + const LEVELS = [ + self::BASIC, + self::SILVER, + self::GOLD, + self::PLATINUM, + ]; + protected $fillable = [ 'name', 'description', @@ -22,4 +29,9 @@ class CustomerLevel extends Model 'max_amount', 'max_loan', ]; + + public static function getByKey($key) + { + return CustomerLevel::where('key', $key)->first(); + } } diff --git a/app/Models/CustomerLocationFavorite.php b/app/Models/CustomerLocationFavorite.php index 2c983eb..fd57b6a 100644 --- a/app/Models/CustomerLocationFavorite.php +++ b/app/Models/CustomerLocationFavorite.php @@ -2,10 +2,10 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Factories\HasFactory; -use Illuminate\Database\Eloquent\Model; - class CustomerLocationFavorite extends Model { - use HasFactory; + protected $fillable = [ + 'customer_id', + 'location_id', + ]; } diff --git a/app/Models/LocationProfile.php b/app/Models/LocationProfile.php index 68c9adc..78c9075 100644 --- a/app/Models/LocationProfile.php +++ b/app/Models/LocationProfile.php @@ -2,10 +2,78 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Factories\HasFactory; -use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Casts\Attribute; class LocationProfile extends Model { - use HasFactory; + const EXPIRED_HOUR = 'Jam'; + + const EXPIRED_DAY = 'Hari'; + + const EXPIRED_WEEK = 'Minggu'; + + const EXPIRED_MONTH = 'Bulan'; + + const EXPIRED_UNIT = [ + self::EXPIRED_HOUR, + self::EXPIRED_DAY, + self::EXPIRED_WEEK, + self::EXPIRED_MONTH, + ]; + + protected $fillable = [ + 'location_id', + 'name', + 'quota', + 'display_note', + 'expired', + 'expired_unit', + 'description', + 'min_stock', + 'price', + 'display_price', + 'discount', + 'price_poin', + 'bonus_poin', + ]; + + protected $appends = [ + 'diplay_expired', + ]; + + protected static function booted(): void + { + static::creating(function (LocationProfile $model) { + $price = $model->display_price; + if ($model->discount > 0) { + $price = $price - ($price * ($model->discount / 100)); + } + $model->price = $price; + }); + + static::updating(function (LocationProfile $model) { + $price = $model->display_price; + if ($model->discount > 0) { + $price = $price - ($price * ($model->discount / 100)); + } + $model->price = $price; + }); + } + + public function prices() + { + return $this->hasMany(LocationProfilePrice::class); + } + + public function location() + { + return $this->belongsTo(Location::class); + } + + public function diplayExpired(): Attribute + { + return Attribute::make(get: function () { + return $this->expired . ' ' . $this->expired_unit; + }); + } } diff --git a/app/Models/LocationProfilePrice.php b/app/Models/LocationProfilePrice.php index 7bd0306..6b4544c 100644 --- a/app/Models/LocationProfilePrice.php +++ b/app/Models/LocationProfilePrice.php @@ -2,10 +2,39 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Factories\HasFactory; -use Illuminate\Database\Eloquent\Model; - class LocationProfilePrice extends Model { - use HasFactory; + protected $fillable = [ + 'location_profile_id', + 'customer_level_id', + 'price', + 'display_price', + 'discount', + 'price_poin', + 'bonus_poin', + ]; + + protected static function booted(): void + { + static::creating(function (LocationProfilePrice $model) { + $price = $model->display_price; + if ($model->discount > 0) { + $price = $price - ($price * ($model->discount / 100)); + } + $model->price = $price; + }); + + static::updating(function (LocationProfilePrice $model) { + $price = $model->display_price; + if ($model->discount > 0) { + $price = $price - ($price * ($model->discount / 100)); + } + $model->price = $price; + }); + } + + public function level() + { + return $this->belongsTo(CustomerLevel::class, 'customer_level_id'); + } } diff --git a/app/Models/Sale.php b/app/Models/Sale.php index 5f47a52..2538ed9 100644 --- a/app/Models/Sale.php +++ b/app/Models/Sale.php @@ -63,7 +63,7 @@ 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, ',', '.'); }); } @@ -72,12 +72,12 @@ class Sale extends Model 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') . ' poin', + '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/Voucher.php b/app/Models/Voucher.php index 8baf097..d65775f 100644 --- a/app/Models/Voucher.php +++ b/app/Models/Voucher.php @@ -2,9 +2,6 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Casts\Attribute; -use Illuminate\Support\Str; - class Voucher extends Model { const UNSOLD = 0; @@ -57,7 +54,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/database/migrations/2023_05_24_183208_create_infos_table.php b/database/migrations/2023_05_24_183208_create_infos_table.php index 59a2711..ec95b4d 100644 --- a/database/migrations/2023_05_24_183208_create_infos_table.php +++ b/database/migrations/2023_05_24_183208_create_infos_table.php @@ -14,7 +14,7 @@ return new class extends Migration Schema::create('infos', function (Blueprint $table) { $table->ulid('id')->primary(); - $table->string('title'); + $table->text('title'); $table->string('destination')->nullable(); $table->string('type')->nullable(); $table->smallInteger('is_publish')->nullable(); diff --git a/database/seeders/DummySeeder.php b/database/seeders/DummySeeder.php index 7b519d7..c80fe26 100644 --- a/database/seeders/DummySeeder.php +++ b/database/seeders/DummySeeder.php @@ -4,13 +4,14 @@ namespace Database\Seeders; use App\Models\Account; use App\Models\Banner; +use App\Models\CustomerLevel; use App\Models\Info; use App\Models\Location; +use App\Models\LocationProfile; use App\Models\Voucher; use App\Services\GeneralService; use Illuminate\Database\Seeder; use Illuminate\Support\Facades\DB; -use Illuminate\Support\Str; class DummySeeder extends Seeder { @@ -25,6 +26,7 @@ class DummySeeder extends Seeder $this->banner(); $this->account(); $this->location(); + $this->location_profile(); $this->voucher(); } @@ -77,6 +79,66 @@ class DummySeeder extends Seeder } } + public function location_profile() + { + $profiles = [ + LocationProfile::EXPIRED_DAY => '1 GB', + LocationProfile::EXPIRED_WEEK => '2 GB', + LocationProfile::EXPIRED_MONTH => '99 GB', + ]; + + $count = 0; + $locations = Location::limit(3)->get(); + foreach ($locations as $location) { //ada 3 lokasi di tiap lokasi ada 3 profile + $count += 1; + foreach ($profiles as $expired => $quota) { + $disply_price = 10000; + $discount = $expired == LocationProfile::EXPIRED_DAY ? 0 : 10; + + $price = $disply_price - ($disply_price * ($discount / 100)); + + $lp = LocationProfile::create([ + 'location_id' => $location->id, + 'name' => $quota, + 'quota' => $quota, + 'display_note' => 'bisa semua', + 'expired' => rand(1, 3), + 'expired_unit' => $expired, + 'description' => '', + 'min_stock' => 10, + 'price' => $price, + 'display_price' => $disply_price, + 'discount' => $discount, + 'price_poin' => $price, + 'bonus_poin' => 0, + ]); + + if ($count == 3) { + $dp = 100000; + $disc = 0; + + $bp = 0; + + foreach (CustomerLevel::LEVELS as $index => $level) { + if ($index != 0) { + $disc += 5; + } + + $p = $dp - ($dp * ($disc / 100)); + $lp->prices()->create([ + 'customer_level_id' => CustomerLevel::getByKey($level)->id, + 'price' => $p, + 'display_price' => $dp, + 'discount' => $disc, + 'price_poin' => $p, + 'bonus_poin' => $bp, + ]); + } + } + } + } + } + public function voucher() { @@ -84,25 +146,15 @@ class DummySeeder extends Seeder DB::beginTransaction(); foreach ([1, 2, 3] as $loop) { - $batchId = Str::ulid(); - $location = Location::get()[$loop]; - - $price_poin = $loop == 3 ? 10 : 0; - + $profile = LocationProfile::get()[$loop]; foreach ($vouchers as $voucher) { Voucher::create([ - 'location_id' => $location->id, + 'location_profile_id' => $profile->id, 'username' => $voucher['username'], 'password' => $voucher['password'], - 'discount' => $loop == 1 ? 10 : 0, - 'display_price' => $loop == 1 ? 100000 : 99000, - 'price_poin' => $price_poin, 'quota' => $voucher['quota'], 'profile' => $voucher['profile'], 'comment' => $voucher['comment'], - 'expired' => 30, - 'expired_unit' => 'Hari', - 'batch_id' => $batchId, ]); } } diff --git a/database/seeders/InstallationSeed.php b/database/seeders/InstallationSeed.php index 7b3e4e6..e6850d6 100644 --- a/database/seeders/InstallationSeed.php +++ b/database/seeders/InstallationSeed.php @@ -37,10 +37,10 @@ class InstallationSeed extends Seeder ['key' => 'ENABLE_CASH_DEPOSIT', 'value' => '0', 'type' => 'text'], ['key' => 'ENABLE_MANUAL_TRANSFER', 'value' => '0', 'type' => 'text'], - ['key' => 'MAX_MANUAL_TRANSFER_TIMEOUT', 'value' => '2', 'type' => 'text'], //dalam jam + ['key' => 'MAX_MANUAL_TRANSFER_TIMEOUT', 'value' => '2', 'type' => 'text'], //dalam jam ['key' => 'MANUAL_TRANSFER_OPEN_HOUR', 'value' => '06:00', 'type' => 'text'], ['key' => 'MANUAL_TRANSFER_CLOSE_HOUR', 'value' => '23:00', 'type' => 'text'], - ['key' => 'MAX_POINT_EXPIRED', 'value' => '90', 'type' => 'text'], //dalam hari + ['key' => 'MAX_POINT_EXPIRED', 'value' => '90', 'type' => 'text'], //dalam hari ]; foreach ($settings as $setting) { diff --git a/database/seeders/PermissionSeeder.php b/database/seeders/PermissionSeeder.php index 1fd8952..039b6b8 100644 --- a/database/seeders/PermissionSeeder.php +++ b/database/seeders/PermissionSeeder.php @@ -83,6 +83,11 @@ class PermissionSeeder extends Seeder ['id' => Str::ulid(), 'label' => 'Update Lokasi', 'name' => 'update-location'], ['id' => Str::ulid(), 'label' => 'View Lokasi', 'name' => 'view-location'], ['id' => Str::ulid(), 'label' => 'Delete Lokasi', 'name' => 'delete-location'], + + ['id' => Str::ulid(), 'label' => 'Create Profile Lokasi', 'name' => 'create-location-profile'], + ['id' => Str::ulid(), 'label' => 'Update Profile Lokasi', 'name' => 'update-location-profile'], + ['id' => Str::ulid(), 'label' => 'View Profile Lokasi', 'name' => 'view-location-profile'], + ['id' => Str::ulid(), 'label' => 'Delete Profile Lokasi', 'name' => 'delete-location-profile'], ]; foreach ($permissions as $permission) { diff --git a/docker-compose.yml b/docker-compose.yml index e00bdf0..6d3e408 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -67,8 +67,18 @@ services: networks: voucher: ipv4_address: 10.25.10.99 + portainer: + image: portainer/portainer-ce:latest + ports: + - 9443:9443 + volumes: + - data:/data + - /var/run/docker.sock:/var/run/docker.sock + restart: unless-stopped volumes: + data: + driver: local mariadb: driver: local diff --git a/resources/js/Components/FormInputNumeric.jsx b/resources/js/Components/FormInputNumeric.jsx index 6cd8e45..f0cd547 100644 --- a/resources/js/Components/FormInputNumeric.jsx +++ b/resources/js/Components/FormInputNumeric.jsx @@ -1,32 +1,58 @@ -import React from "react"; -import { NumericFormat } from "react-number-format"; -import Input from "./Input"; +import React from 'react' +import { NumericFormat } from 'react-number-format' +import Input from './Input' +import { toFixed } from '@/utils' + +export default function FormInputNumeric({ + name, + onChange, + value, + label, + className, + error, + max = 999999999, + fixed = true, +}) { + if (fixed) { + value = toFixed(value) + } + value = Number(value) -export default function FormInputNumeric({ name, onChange, value, label, className, error }) { return ( -
{error}
++ {error} +
)}+ {errors.prices} +
+ )} ++ Level + | ++ Harga + | ++ Diskon + | ++ Harga Poin + | ++ Bonus Poin + | +
---|---|---|---|---|
+ {price.level.name} + | +
+ |
+
+ |
+
+ |
+
+ |
+
+ Nama + | ++ Lokasi + | ++ Kuota + | ++ Masa Aktif + | ++ |
---|---|---|---|---|
+ {profile.name} + | ++ {profile.location.name} + | ++ {profile.quota} + | ++ {profile.diplay_expired} + | +
+
+ Ubah
+
+
+
+
+
+ Hapus
+
+ |
+