prepare home page

dev
Aji Kamaludin 1 year ago
parent 1101c82e02
commit cabe8a2e71
No known key found for this signature in database
GPG Key ID: 19058F67F0083AD3

@ -5,6 +5,9 @@
- [ ] CRUD Voucher
- [ ] Import Voucher
- [ ] CRUD Customer
- [ ] CRUD Rekening / Account
- [ ] CRUD Info
- [ ] CRUD Banner
- [ ] Deposit Menu (view daftar histori deposit)
- [ ] Manual Approve Deposit
- [ ] Setting Web (enable affilate, amount bonus affilate)
@ -19,7 +22,7 @@
### Customer
- [ ] Tampilan Depan Customer (banner, info, voucher, saldo, coin) - mobile page
- [x] Tampilan Depan Customer (banner, info, voucher, saldo, coin) - mobile page
- [ ] Register Customer (wajib data lengkap)
- [ ] Register Customer Gmail
- [ ] Login Customer

@ -2,7 +2,6 @@
namespace App\Http\Middleware;
use App\Providers\RouteServiceProvider;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
@ -25,6 +24,7 @@ class RedirectIfAuthenticated
if ($guard == 'web') {
return redirect()->route('dashboard');
}
return redirect()->route('home.index');
}
}

@ -0,0 +1,14 @@
<?php
namespace App\Models;
class Account extends Model
{
protected $fillable = [
'name',
'bank_name',
'holder_name',
'account_number',
];
}

@ -26,5 +26,6 @@ class Customer extends Authenticatable
'coin_balance',
'identity_verified',
'identity_image',
'customer_level_id',
];
}

@ -4,9 +4,22 @@ namespace App\Models;
class CustomerLevel extends Model
{
const BASIC = 'basic';
const SILVER = 'silver';
const GOLD = 'gold';
const PLATINUM = 'platinum';
const MUST_VERIFIED = [self::GOLD, self::PLATINUM];
protected $fillable = [
'name',
'description',
'key',
'min_amount',
'max_amount',
'max_loan',
];
}

@ -4,6 +4,10 @@ namespace App\Models;
class DepositHistory extends Model
{
const VALID = 0;
const WAIT = 1;
const INVALID = 2;
protected $fillable = [
'debit',
'credit',
@ -11,5 +15,7 @@ class DepositHistory extends Model
'customer_id',
'related_type',
'related_id',
'is_valid',
'image_prove'
];
}

@ -0,0 +1,16 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Info extends Model
{
protected $fillable = [
'title',
'destination',
'type',
'is_publish',
];
}

@ -4,6 +4,11 @@ namespace App\Models;
class Sale extends Model
{
const PAYED_WITH_MIDTRANS = 'midtrans';
const PAYED_WITH_MANUAL = 'manual';
const PAYED_WITH_DEPOSIT = 'deposit';
const PAYED_WITH_COIN = 'coin';
protected $fillable = [
'customer_id',
'date_time',

@ -19,6 +19,7 @@ return new class extends Migration
$table->string('description')->nullable();
$table->string('destination')->nullable();
$table->string('type')->nullable();
$table->smallInteger('is_publish')->nullable();
$table->timestamps();
$table->softDeletes();

@ -27,6 +27,7 @@ return new class extends Migration
$table->decimal('coin_balance', 20, 2)->default(0);
$table->smallInteger('identity_verified')->nullable();
$table->string('identity_image')->nullable();
$table->ulid('customer_level_id')->nullable();
$table->timestamps();
$table->softDeletes();

@ -17,6 +17,9 @@ return new class extends Migration
$table->string('name')->nullable();
$table->string('description')->nullable();
$table->string('key')->nullable();
$table->decimal('min_amount', 20, 2)->default(0);
$table->decimal('max_amount', 20, 2)->default(0);
$table->decimal('max_loan', 20, 2)->default(0);
$table->timestamps();
$table->softDeletes();

@ -20,6 +20,8 @@ return new class extends Migration
$table->ulid('customer_id')->nullable();
$table->string('related_type')->nullable();
$table->string('related_id')->nullable();
$table->smallInteger('is_valid')->default(0);
$table->string('image_prove')->nullable();
$table->timestamps();
$table->softDeletes();

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('accounts', function (Blueprint $table) {
$table->ulid('id')->primary();
$table->string('name')->nullable();
$table->string('bank_name')->nullable();
$table->string('holder_name')->nullable();
$table->string('account_number')->nullable();
$table->timestamps();
$table->softDeletes();
$table->ulid('created_by')->nullable();
$table->ulid('updated_by')->nullable();
$table->ulid('deleted_by')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('accounts');
}
};

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('infos', function (Blueprint $table) {
$table->ulid('id')->primary();
$table->string('title');
$table->string('destination')->nullable();
$table->string('type')->nullable();
$table->smallInteger('is_publish')->nullable();
$table->timestamps();
$table->softDeletes();
$table->ulid('created_by')->nullable();
$table->ulid('updated_by')->nullable();
$table->ulid('deleted_by')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('infos');
}
};

@ -14,13 +14,8 @@ class DatabaseSeeder extends Seeder
*/
public function run()
{
// \App\Models\User::factory(10)->create();
// \App\Models\User::factory()->create([
// 'name' => 'Test User',
// 'email' => 'test@example.com',
// ]);
$this->call([
InstallationSeed::class,
PermissionSeeder::class,
DummySeeder::class,
]);

@ -13,6 +13,5 @@ class DummySeeder extends Seeder
*/
public function run()
{
//
}
}

@ -0,0 +1,51 @@
<?php
namespace Database\Seeders;
use App\Models\CustomerLevel;
use App\Models\Setting;
use Illuminate\Database\Seeder;
class InstallationSeed extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$this->settings();
$this->customer_levels();
}
public function settings()
{
$settings = [
['key' => 'AFFILATE_ENABLE', 'value' => '0', 'type' => 'checkbox'],
['key' => 'AFFILATE_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'],
['key' => 'MIDTRANS_MERCHANT_ID', 'value' => 'G561244367', 'type' => 'text'],
//
];
foreach ($settings as $setting) {
Setting::create($setting);
}
}
public function customer_levels()
{
$levels = [
['name' => 'Basic', 'key' => 'basic'],
['name' => 'Silver', 'key' => 'silver'],
['name' => 'Gold', 'key' => 'gold'],
['name' => 'Platinum', 'key' => 'platinum'],
];
foreach ($levels as $level) {
CustomerLevel::create($level);
}
}
}

@ -30,6 +30,54 @@ class PermissionSeeder extends Seeder
['id' => Str::ulid(), 'label' => 'Update Role', 'name' => 'update-role'],
['id' => Str::ulid(), 'label' => 'View Role', 'name' => 'view-role'],
['id' => Str::ulid(), 'label' => 'Delete Role', 'name' => 'delete-role'],
['id' => Str::ulid(), 'label' => 'Create Banner', 'name' => 'create-banner'],
['id' => Str::ulid(), 'label' => 'Update Banner', 'name' => 'update-banner'],
['id' => Str::ulid(), 'label' => 'View Banner', 'name' => 'view-banner'],
['id' => Str::ulid(), 'label' => 'Delete Banner', 'name' => 'delete-banner'],
['id' => Str::ulid(), 'label' => 'Create Info', 'name' => 'create-info'],
['id' => Str::ulid(), 'label' => 'Update Info', 'name' => 'update-info'],
['id' => Str::ulid(), 'label' => 'View Info', 'name' => 'view-info'],
['id' => Str::ulid(), 'label' => 'Delete Info', 'name' => 'delete-info'],
['id' => Str::ulid(), 'label' => 'Create Voucher', 'name' => 'create-voucher'],
['id' => Str::ulid(), 'label' => 'Update Voucher', 'name' => 'update-voucher'],
['id' => Str::ulid(), 'label' => 'View Voucher', 'name' => 'view-voucher'],
['id' => Str::ulid(), 'label' => 'Delete Voucher', 'name' => 'delete-voucher'],
['id' => Str::ulid(), 'label' => 'Create Customer', 'name' => 'create-customer'],
['id' => Str::ulid(), 'label' => 'Update Customer', 'name' => 'update-customer'],
['id' => Str::ulid(), 'label' => 'View Customer', 'name' => 'view-customer'],
['id' => Str::ulid(), 'label' => 'Delete Customer', 'name' => 'delete-customer'],
['id' => Str::ulid(), 'label' => 'Create Customer Level', 'name' => 'create-customer-level'],
['id' => Str::ulid(), 'label' => 'Update Customer Level', 'name' => 'update-customer-level'],
['id' => Str::ulid(), 'label' => 'View Customer Level', 'name' => 'view-customer-level'],
['id' => Str::ulid(), 'label' => 'Delete Customer Level', 'name' => 'delete-customer-level'],
['id' => Str::ulid(), 'label' => 'Create Customer Verification', 'name' => 'create-customer-verification'],
['id' => Str::ulid(), 'label' => 'Update Customer Verification', 'name' => 'update-customer-verification'],
['id' => Str::ulid(), 'label' => 'View Customer Verification', 'name' => 'view-customer-verification'],
['id' => Str::ulid(), 'label' => 'Delete Customer Verification', 'name' => 'delete-customer-verification'],
['id' => Str::ulid(), 'label' => 'View Setting', 'name' => 'view-setting'],
['id' => Str::ulid(), 'label' => 'View Deposit', 'name' => 'view-deposite'],
['id' => Str::ulid(), 'label' => 'Update Deposit', 'name' => 'update-deposite'],
['id' => Str::ulid(), 'label' => 'View Coin', 'name' => 'view-coin'],
['id' => Str::ulid(), 'label' => 'Update Coin', 'name' => 'update-coin'],
['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'],
];
foreach ($permissions as $permission) {

@ -32,4 +32,4 @@
"react-toastify": "^9.1.1",
"react-use": "^17.4.0"
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 779 KiB

@ -1,18 +1,36 @@
import React from 'react'
import ApplicationLogo from '@/Components/Defaults/ApplicationLogo'
import { Link } from '@inertiajs/react'
import { HiHome, HiOutlineHome, HiOutlineUserCircle } from 'react-icons/hi'
import {
HiArrowPathRoundedSquare,
HiOutlineShoppingCart,
} from 'react-icons/hi2'
export default function CustomerLayout({ children }) {
return (
<div className="min-h-screen flex flex-col sm:justify-center items-center pt-6 sm:pt-0 bg-gray-100 dark:bg-gray-900">
<div>
<Link href="/">
<ApplicationLogo className="w-auto h-20 fill-current text-gray-500 text-5xl font-bold" />
</Link>
</div>
<div className="w-full max-w-md mt-6 px-6 py-4 bg-white dark:bg-gray-800 shadow-md overflow-hidden sm:rounded-lg">
{children}
<div className="min-h-screen flex flex-col sm:justify-center items-center">
<div className="flex flex-col w-full min-h-screen max-w-md bg-white shadow-md">
<div className="mb-10">{children}</div>
<div className="sticky bottom-0 flex flex-row justify-evenly w-full max-w-md bg-gray-50">
<div className="py-2 px-10 hover:bg-blue-200">
<HiOutlineHome className="text-blue-700 h-8 w-8" />
</div>
<div className="py-2 px-10 hover:bg-blue-200 flex flex-row">
<HiOutlineShoppingCart className="text-gray-600 h-8 w-8" />
<div>
<div className="bg-blue-300 text-blue-600 rounded-lg px-1 text-xs -ml-2">
1
</div>
</div>
</div>
<div className="py-2 px-10 hover:bg-blue-200">
<HiArrowPathRoundedSquare className="text-gray-600 h-8 w-8" />
</div>
<div className="py-2 px-10 hover:bg-blue-200">
<HiOutlineUserCircle className="text-gray-600 h-8 w-8" />
</div>
</div>
</div>
</div>
)

@ -1,12 +1,167 @@
import React from 'react'
import { Head } from '@inertiajs/react'
import CustomerLayout from '@/Layouts/CustomerLayout'
import { HiOutlineBell } from 'react-icons/hi2'
import { HiOutlineCash } from 'react-icons/hi'
export default function Index({ status }) {
return (
<CustomerLayout>
<Head title="Home" />
<h1>This is HOME</h1>
<div className="flex flex-col">
{/* user */}
<div className="flex flex-row justify-between items-center px-5 py-6 text-lg bg-blue-600">
<div className="flex flex-col text-white">
<div className="font-bold">Aji</div>
<div className="flex flex-row items-center space-x-1">
<div>083840745543</div>
<div className="text-xs font-semibold px-2 py-1 bg-white text-black rounded-xl">
Gold
</div>
</div>
</div>
<div className="flex flex-row">
<HiOutlineBell className="text-white w-7 h-7" />
<div>
<div className="bg-white text-blue-700 rounded-lg px-1 text-xs -ml-2.5">
1
</div>
</div>
</div>
</div>
{/* saldo */}
<div className="flex flex-row px-5 pb-3 text-base bg-blue-600">
<div className="flex flex-row w-full shadow py-2 px-2 rounded bg-white items-center justify-between">
<div className="flex flex-col">
<div className="text-xs flex flex-row items-center space-x-1 text-gray-400">
<HiOutlineCash />
<div>Saldo</div>
</div>
<div className="font-bold">Rp 10.000</div>
<div className="text-xs flex flex-row items-center space-x-1 text-gray-400">
<div>Coin 10.000</div>
</div>
</div>
<div className="flex flex-col border-l-2 pl-5 pr-5">
<div className="text-xs flex flex-row items-center space-x-1 text-gray-400">
{/* <HiOutlineAwa /> */}
<div>Rewards</div>
</div>
<div className="font-bold">Gold Member</div>
<div className="text-xs flex flex-row items-center space-x-1 text-gray-400">
<div>Limit 100.000</div>
</div>
</div>
</div>
</div>
{/* banner */}
<div className="w-full">
<div className="flex flex-row overflow-y-scroll space-x-2 py-3 px-2">
<img
src="/sample/1.webp"
className="rounded w-[80%] min-w-[340px] h-28 object-cover"
/>
<img
src="/sample/banner.jpg"
className="rounded w-[80%] min-w-[340px] h-28 object-cover"
/>
<img
src="/sample/2.webp"
className="rounded w-[80%] min-w-[340px] h-28 object-cover"
/>
<img
src="/sample/3.webp"
className="rounded w-[80%] min-w-[340px] h-28 object-cover"
/>
</div>
</div>
{/* info */}
<div className="w-full px-3">
{[1, 2].map((x) => (
<div
className="p-4 mb-4 text-sm text-blue-800 rounded-lg bg-blue-50"
role="alert"
key={x}
>
<span className="font-medium">Info! </span> Change a
few things up and try submitting again.
</div>
))}
</div>
{/* voucher */}
<div className="w-full flex flex-col">
{/* chips */}
<div className="w-full flex flex-row overflow-y-scroll space-x-2 px-2">
<div className="px-2 py-1 rounded-2xl text-white bg-blue-600 border border-blue-800">
Jarbriel.id
</div>
<div className="px-2 py-1 rounded-2xl bg-blue-100 border border-blue-200">
Shaff.net
</div>
<div className="px-2 py-1 rounded-2xl bg-blue-100 border border-blue-200">
Weslycamp.net
</div>
<div className="px-2 py-1 rounded-2xl bg-blue-100 border border-blue-200">
Glory.net
</div>
<div className="px-2 py-1 rounded-2xl bg-blue-100 border border-blue-200">
Salgo.id
</div>
<div className="px-2 py-1 rounded-2xl bg-blue-100 border border-blue-200">
Terna.id
</div>
<div className="px-2 py-1 rounded-2xl bg-blue-100 border border-blue-200">
Kanza.id
</div>
</div>
{/* voucher */}
<div className="flex flex-col w-full px-3 mt-3 space-y-2">
{[1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map((x) => (
<div
className="px-3 py-1 shadow-md rounded border border-gray-100"
key={x}
>
<div className="text-base font-bold">
Lawaranet voucher internet sedap
</div>
<div className="w-full border border-dashed"></div>
<div className="flex flex-row justify-between items-center">
<div>
<div className="text-xs text-gray-400 py-1">
Jabriel.net
</div>
<div className="text-xl font-bold">
IDR 10.000
</div>
<div className="flex flex-row space-x-2 items-center text-xs pb-2">
<div className="bg-red-300 text-red-600 px-1 py-0.5 font-bold rounded">
50%
</div>
<div className="text-gray-400 line-through">
20.000
</div>
</div>
</div>
<div className="flex flex-col justify-center items-center">
<div className="text-3xl font-bold">
8GB
</div>
<div className="text-gray-400">
3 Hari
</div>
</div>
</div>
</div>
))}
</div>
</div>
</div>
</CustomerLayout>
)
}

Loading…
Cancel
Save