Compare commits

...

No commits in common. "fadiyah" and "main" have entirely different histories.

4910 changed files with 1942883 additions and 5377 deletions

View File

@ -1,59 +0,0 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
MEMCACHED_HOST=127.0.0.1
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_HOST=
PUSHER_PORT=443
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=mt1
VITE_APP_NAME="${APP_NAME}"
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

View File

@ -0,0 +1,127 @@
<?php
namespace App\Http\Controllers\API;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use App\Models\User;
class LoginApiController extends Controller
{
/**
* Create a new AuthController instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth:api', ['except' => ['login', 'register', 'hai']]);
}
/**
* Get a JWT via given credentials.
*
* @return \Illuminate\Http\JsonResponse
*/
public function login()
{
// $request->validate([
// 'email' => 'required|string|email',
// 'password' => 'required',
// ]);
$credentials = request(['email', 'password']);
if (!($token = auth()->attempt($credentials))) {
return response()->json(['error' => 'Unauthorized'], 401);
}
return $this->respondWithToken($token);
}
/**
* Get the authenticated User.
*
* @return \Illuminate\Http\JsonResponse
*/
public function me()
{
return response()->json(Auth::user());
}
public function hai()
{
return response()->json([
'message' => 'Hello from API',
]);
}
/**
* Log the user out (Invalidate the token).
*
* @return \Illuminate\Http\JsonResponse
*/
public function logout()
{
auth()->logout();
return response()->json(['message' => 'Successfully logged out']);
}
/**
* Refresh a token.
*
* @return \Illuminate\Http\JsonResponse
*/
public function refresh()
{
return $this->respondWithToken(Auth::refresh());
}
/**
* Get the token array structure.
*
* @param string $token
*
* @return \Illuminate\Http\JsonResponse
*/
protected function respondWithToken($token)
{
return response()->json([
'user' => auth()->user(),
'access_token' => $token,
'token_type' => 'bearer',
'expires_in' => Auth::factory()->getTTL() * 60,
// 'status' => auth()->check(),
]);
}
public function register(Request $request)
{
$request->validate([
'name' => 'required|string|max:255',
'email' => 'required|string|email|unique:users',
'password' => 'required|string|min:8',
]);
$user = User::create([
'name' => $request->name,
'email' => $request->email,
'password' => Hash::make($request->password),
]);
return response()->json([
'message' => 'User created successfully',
'user' => $user,
]);
}
// public function check()
// {
// return response()->json([
// 'status' => auth()->check(),
// ]);
// }
}

View File

@ -0,0 +1,40 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Carbon\Carbon;
use App\Models\Transactions;
use App\Models\Transaction;
use App\Models\Refund;
use Illuminate\Support\Facades\Auth;
class AdminDashboardController extends Controller
{
public function index(){
$sumSettlement = 0;
$sumCancelled = 0;
$sumRefund = 0;
$currentYear = Carbon::now()->year;
$dataChartTransaction = [];
$dataChartRefund = [];
for($bulan = 1; $bulan <= 12; $bulan++){
$transaction = Transaction::whereMonth('created_at',$bulan)->whereYear('created_at', $currentYear)->sum('total_bayar');
// $transaction = Transaction::where('status','finished')->whereMonth('created_at',$bulan)->whereYear('created_at', $currentYear)->sum('total_bayar');
// $refund = Refund::whereMonth('created_at',$bulan)->whereYear('created_at', $currentYear)->sum('total');
// $refund = Refund::where('status','Partial Refund')->whereMonth('created_at',$bulan)->whereYear('created_at', $currentYear)->sum('total');
$dataChartTransaction[] = intval($transaction);
// $dataChartRefund[] = intval($refund);
}
return view('admin.index',[
"transaction"=>Transactions::allTransactions(),
"dataChartTransaction" => $dataChartTransaction,
// "dataChartRefund" => $dataChartRefund
]);
}
public function profile(){
return view('admin.profile.index');
}
}

View File

@ -0,0 +1,73 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Models\Refund;
use App\Models\Refunds;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class AdminRefundController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
// $refundData = Refund::all();
// return view('Admin.refund.history-refund', ['history_refund' => $refundData]);
return view('admin.refund.index',[
"refunds" => Refunds::HistoryRefund()
]);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(Refund $refund)
{
return view('admin.refund.detail-refund',[
"detail_refund"=> Refunds::DetailRefund()
]);
}
/**
* Show the form for editing the specified resource.
*/
public function edit(Refund $refund)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, Refund $refund)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(Refund $refund)
{
//
}
}

View File

@ -0,0 +1,101 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Models\Setting;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
class AdminSettingController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$settings = Setting::all();
return view('admin.setting.index', [
'settings' => $settings,
]);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
// dd($request->persentase);
[$tahun, $bulan] = explode('-', $request->bulan_tahun);
Setting::create([
'bulan' => $bulan,
'tahun' => $tahun,
'persentase' => $request->persentase,
'status' => 'Active',
]);
return redirect()->route('admin-setting.index');
}
/**
* Display the specified resource.
*/
public function show(Setting $setting)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(Setting $setting)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id)
{
// dd($setting['status'] );
$setting = Setting::findOrFail($id);
if ($setting->status == 'Active') {
$setting->status = 'Nonactive';
$result = $setting->save();
if ($result) {
return response()->json([
'message' => "Berhasil update kebijakan",
'status' => true,
]);
} else {
return response()->json([
'message' => "Gagal update kebijakan",
'status' => true,
]);
}
} else {
$setting->status = 'Active';
$result = $setting->save();
if ($result) {
return response()->json([
'message' => "Berhasil update kebijakan",
'status' => true,
]);
} else {
return response()->json([
'message' => "Gagal update kebijakan",
'status' => true,
]);
}
}
// return response()->json($id);
}
/**
* Remove the specified resource from storage.
*/
public function destroy(Setting $setting)
{
//
}
}

View File

@ -0,0 +1,71 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Models\Transaction;
use App\Models\Transactions;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class AdminTransactionController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
return view('admin.transaction.index', [
'transactions' => Transaction::all(),
]);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(transaction $transaction)
{
return view('admin.transaction.detail-transaction',[
'detail_transaction' => Transactions::allDetailTransactions()
]);
}
/**
* Show the form for editing the specified resource.
*/
public function edit(transaction $transaction)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, transaction $transaction)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(transaction $transaction)
{
//
}
}

View File

@ -0,0 +1,127 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Models\User;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class AdminUserController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
// $users = User::where('role', 'User')
// ->orderByRaw("FIELD(status, 'Progress', 'Finished', 'Rejected') ASC")
// ->latest()
// ->get();
$users = User::where('role', 'User')
->orderByRaw("CASE WHEN status = 'Progress' THEN 1 WHEN status = 'Finished' THEN 2 WHEN status = 'Rejected' THEN 3 ELSE 4 END ASC")
->latest()
->get();
return view('admin.users.index', ['users' => $users]);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show($id)
{
$user = User::find($id);
return view('admin.users.detail-user', ['user' => $user]);
}
/**
* Show the form for editing the specified resource.
*/
public function edit(User $user)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id)
{
return response()->json([
'user' => $request,
'id' => $id,
]);
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
try {
$result = User::destroy($id);
if ($result) {
return response()->json([
'message' => 'Berhasil hapus data',
'status' => true,
]);
}
} catch (\Exception $e) {
return response()->json([
'message' => 'Gagal hapus data, karena ' . $e,
'status' => false,
]);
}
}
public function approveUser($id)
{
$user = User::findOrFail($id);
$user->status = 'Finished';
$result = $user->save();
if ($result) {
return response()->json([
'message' => 'Akun telah disetujui dan dapat digunakan',
'status' => true,
]);
} else {
return response()->json([
'message' => 'Akun gagal disetujui karena ' + $result,
'status' => false,
]);
}
}
public function denyUser($id)
{
$user = User::findOrFail($id);
$user->status = 'Rejected';
$result = $user->save();
if ($result) {
return response()->json([
'message' => 'Akun telah ditolak dan tidak dapat digunakan',
'status' => true,
]);
} else {
return response()->json([
'message' => 'Akun gagal ditolak karena ' + $result,
'status' => false,
]);
}
}
}

View File

@ -1,30 +0,0 @@
<?php
namespace App\Http\Controllers;
use App\Models\Distric;
use App\Models\District;
use App\Models\Provinces;
use App\Models\Regency;
use Illuminate\Http\Request;
class IndonesiaController extends Controller
{
public function provinsi(){
$data = Provinces::where('name', 'LIKE', '%'.request('q').'%')->paginate(10);
return response()->json($data);
}
public function regency($id){
$data = Regency::where('province_id', $id)->where('name', 'LIKE', '%'.request('q').'%')->paginate(10);
return response()->json($data);
}
public function district($id){
$data = District::where('regency_id', $id)->where('name', 'LIKE', '%'.request('q').'%')->paginate(10);
return response()->json($data);
}
}

View File

@ -0,0 +1,352 @@
<?php
namespace App\Http\Controllers\Login;
use App\Http\Controllers\Controller;
use App\Mail\verificationMail;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use App\Models\User;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Storage;
use thiagoalessio\TesseractOCR\TesseractOCR;
use Intervention\Image\ImageManagerStatic as Image;
use Illuminate\Support\Facades\Session;
use Laravolt\Indonesia\Models\City;
use Laravolt\Indonesia\Models\District;
use Laravolt\Indonesia\Models\Province;
use Laravolt\Indonesia\Models\Village;
use Ramsey\Uuid\Uuid;
class LoginController extends Controller
{
// /**
// * Create a new AuthController instance.
// *
// * @return void
// */
// public function __construct()
// {
// $this->middleware('auth:api', ['except' => ['login', 'authenticate', 'register', 'hai']]);
// }
public function login()
{
return view('index');
}
/**
* Get a JWT via given credentials.
*
* @return \Illuminate\Http\JsonResponse
*/
public function authenticate(Request $request)
{
// dd($request);
$credentials = $request->validate(
[
'email' => ['required', 'email'],
'password' => ['required', 'min:8'],
],
[
'email.required' => 'Alamat email wajib diisi.',
'email.email' => 'Alamat email harus berformat valid.',
'password.required' => 'Password wajib diisi.',
'password.min' => 'Password harus memiliki panjang minimal 8 karakter.',
]
);
if (Auth::attempt($credentials)) {
if (Auth::user()->status == 'Finished') {
$request->session()->regenerate();
if (ucwords(Auth::user()->role) == 'Admin') {
// return redirect()->route('admin.index');
return redirect()->intended('admin');
} else {
return redirect()->intended('user');
}
} else if(Auth::user()->status == 'Rejected'){
Session::flash('message', 'Akun ditolak karena tidak memenuhi persyaratan');
return redirect()->back();
} else {
Session::flash('message', 'Akun tidak ditemukan atau sedang dalam pengajuan');
return redirect()->back();
}
}
// $error = $credentials->errors();
// ->withInput($request->except('key'))
// ->withErrors($validator)
return redirect()
->back()
->withErrors($credentials)
->onlyInput('email');
}
/**
* Log the user out (Invalidate the token).
*
* @return \Illuminate\Http\JsonResponse
*/
public function logout(Request $request)
{
Auth::logout();
$request->session()->invalidate();
$request->session()->regenerateToken();
return redirect()->route('login');
}
public function register(Request $request)
{
$nama_depan = $request->get('nama-depan');
$nama_belakang = $request->get('nama-belakang');
$tanggal_lahir = $request->get('tanggal-lahir');
$new_password = $request->get('new-password');
$nik = $request->get('nik');
$email = $request->get('email');
$nohp = $request->get('nohp');
$alamat = $request->get('alamat');
$foto_ktp = '';
$foto_wajah = '';
$persentase_kemiripan = '0%';
$gender = $request->get('gender');
$kode_kelurahan = $request->get('kode-kelurahan');
$ktpBase64 = $request->request->get('ktp');
$wajahBase64 = $request->request->get('wajah');
$validatedData['email_verified_at'] = now();
if ($ktpBase64 && $wajahBase64) {
// Konversi string Base64 ke file gambar
$ktpFile = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $ktpBase64));
$wajahFile = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $wajahBase64));
$foto_ktp = 'Foto-KTP-' . $nama_depan . '-' . $nama_belakang . '.jpg';
$foto_wajah = 'Foto-Wajah-' . $nama_depan . '-' . $nama_belakang . '.jpg';
file_put_contents(public_path('storage/foto-ktp/' . $foto_ktp), $ktpFile);
file_put_contents(public_path('storage/foto-wajah/' . $foto_wajah), $wajahFile);
}
//OCR
try {
$fotoKTP = public_path('storage/foto-ktp/' . $foto_ktp);
$image = Image::make($fotoKTP);
$image->greyscale(); // Convert to grayscale
$image->contrast(10); // Increase contrast, adjust the value as needed
$preprocessedfotoKTP = public_path('storage/preprocessed/preprocessed_image.jpg');
$image->save($preprocessedfotoKTP);
$result = (new TesseractOCR($preprocessedfotoKTP))->run();
// (5) Normalize
$lines = explode("\n", $result);
$namaOCR = '';
$nikOCR = '';
$nikInputan = $nik;
$namaInputan = $nama_depan . ' ' . $nama_belakang;
foreach ($lines as $line) {
// Mencari NIK
if (strpos($line, $nikInputan) !== false) {
$nikOCR = preg_replace('/[^0-9]/', '', $line);
}
// Mencari nama
if (strpos($line, $namaInputan) !== false) {
$namaOCR = trim(substr($line, strpos($line, ':') + 1));
}
}
//Selesai
$persentase_kemiripan = (similar_text($nikInputan, $nikOCR, $percent) + similar_text($namaOCR, $namaOCR, $percent)) / 2;
// $status = 'Progress';
// if (similar_text($nikInputan, $nikOCR, $percent) >= 70 && similar_text($namaOCR, $namaOCR, $percent) >= 70) {
// $status = 'Progress';
// } else {
// $status = 'Progress';
// }
} catch (\Exception $e) {
// $status = 'Progress';
}
//OCR
//Deteksi wajah belum
$password = Hash::make($new_password);
$result = User::create([
'id' => Uuid::uuid4(),
'nama_depan' => $nama_depan,
'nama_belakang' => $nama_belakang,
'tanggal_lahir' => $tanggal_lahir,
'email' => $email,
'email_verified_at' => now(),
'password' => $password,
'nohp' => $nohp,
'nik' => $nik,
'alamat' => $alamat,
'foto_ktp' => $foto_ktp,
'foto_wajah' => $foto_wajah,
'foto_profil' => null,
'persentase_kemiripan' => $persentase_kemiripan,
'gender' => $gender,
'kode_kelurahan' => $kode_kelurahan,
'remember_token' => Str::random(10),
]);
if ($result) {
return response()->json([
'status' => true,
'message' => 'Akun anda sudah terdaftar dan butuh verifikasi hingga maksimal 1 hari kerja',
]);
} else {
return response()->json([
'status' => false,
'message' => 'Akun anda gagal terdaftar. Coba lagi! ' + $result,
]);
}
}
public function statusAkun($email)
{
$result = User::where('email', $email)->get();
if ($result->isNotEmpty()) {
return response()->json([
'status' => true,
'message' => $result,
]);
} else {
return response()->json([
'status' => false,
'message' => $result,
]);
}
}
public function cariProvinsi()
{
$data = Province::where('name', 'LIKE', '%' . strtoupper(request('q')) . '%')->paginate(10);
return response()->json($data);
}
public function cariKota($code)
{
$data = City::where('province_code', $code)
->where('name', 'LIKE', '%' . strtoupper(request('q')) . '%')
->paginate(10);
return response()->json($data);
}
public function cariKecamatan($code)
{
$data = District::where('city_code', $code)
->where('name', 'LIKE', '%' . strtoupper(request('q')) . '%')
->paginate(10);
return response()->json($data);
}
public function cariKelurahan($code)
{
$data = Village::where('district_code', $code)
->where('name', 'LIKE', '%' . strtoupper(request('q')) . '%')
->paginate(10);
return response()->json($data);
}
public function kirimKodeVerifikasi(Request $request)
{
$email = $request->get('email');
$code = $request->get('code');
$verificationEmail = [
'code' => $code,
'email' => $email,
];
try {
Mail::to($email)->send(new verificationMail($verificationEmail));
return response()->json([
'message' => 'Kode verifikasi berhasil dikirim ke email. Silahkan cek di email anda.',
'status' => true,
]);
} catch (\Exception $e) {
return response()->json([
'message' => 'Kode verifikasi gagal dikirim ke email. ' . $e,
'status' => false,
]);
}
}
public function getOcr()
{
//OCR
// dd(phpinfo());
try {
$fotoKTP = public_path('storage/foto-ktp/ktp.jpg');
$image = Image::make($fotoKTP);
$image->greyscale(); // Convert to grayscale
$image->contrast(10); // Increase contrast, adjust the value as needed
$preprocessedfotoKTP = public_path('storage/preprocessed/preprocessed_image.jpg');
$image->save($preprocessedfotoKTP);
$result = (new TesseractOCR($preprocessedfotoKTP))->run();
// (5) Normalize
$lines = explode("\n", $result);
$nikOCR = '';
$namaOCR = '';
$nikInputan = '3471140209790001';
$namaInputan = 'RIYANTO. SE';
foreach ($lines as $line) {
// Mencari NIK
if (strpos($line, $nikInputan) !== false) {
$nikOCR = preg_replace('/[^0-9]/', '', $line);
}
// Mencari nama
if (strpos($line, $namaInputan) !== false) {
$namaOCR = trim(substr($line, strpos($line, ':') + 1));
}
}
//Selesai
$persentase_kemiripan = (similar_text($nikInputan, $nikOCR, $percent) + similar_text($namaOCR, $namaOCR, $percent)) / 2;
// $status = 'Progress';
dd([$persentase_kemiripan, $lines]);
// if (similar_text($nikInputan, $nikOCR, $percent) >= 70 && similar_text($namaOCR, $namaOCR, $percent) >= 70) {
// $status = 'Progress';
// } else {
// $status = 'Progress';
// }
} catch (\Exception $e) {
// $status = 'Progress';
dd($e);
}
//OCR
}
}

View File

@ -2,11 +2,10 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Models\Refund; use App\Models\RefundDescription;
use App\Http\Requests\StoreRefundRequest; use Illuminate\Http\Request;
use App\Http\Requests\UpdateRefundRequest;
class RefundController extends Controller class RefundDescriptionController extends Controller
{ {
/** /**
* Display a listing of the resource. * Display a listing of the resource.
@ -27,7 +26,7 @@ class RefundController extends Controller
/** /**
* Store a newly created resource in storage. * Store a newly created resource in storage.
*/ */
public function store(StoreRefundRequest $request) public function store(Request $request)
{ {
// //
} }
@ -35,7 +34,7 @@ class RefundController extends Controller
/** /**
* Display the specified resource. * Display the specified resource.
*/ */
public function show(Refund $refund) public function show(RefundDescription $refundDescription)
{ {
// //
} }
@ -43,7 +42,7 @@ class RefundController extends Controller
/** /**
* Show the form for editing the specified resource. * Show the form for editing the specified resource.
*/ */
public function edit(Refund $refund) public function edit(RefundDescription $refundDescription)
{ {
// //
} }
@ -51,7 +50,7 @@ class RefundController extends Controller
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
*/ */
public function update(UpdateRefundRequest $request, Refund $refund) public function update(Request $request, RefundDescription $refundDescription)
{ {
// //
} }
@ -59,7 +58,7 @@ class RefundController extends Controller
/** /**
* Remove the specified resource from storage. * Remove the specified resource from storage.
*/ */
public function destroy(Refund $refund) public function destroy(RefundDescription $refundDescription)
{ {
// //
} }

View File

@ -2,11 +2,10 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Models\transaction; use App\Models\TransactionDescription;
use App\Http\Requests\StoretransactionRequest; use Illuminate\Http\Request;
use App\Http\Requests\UpdatetransactionRequest;
class TransactionController extends Controller class TransactionDescriptionController extends Controller
{ {
/** /**
* Display a listing of the resource. * Display a listing of the resource.
@ -27,7 +26,7 @@ class TransactionController extends Controller
/** /**
* Store a newly created resource in storage. * Store a newly created resource in storage.
*/ */
public function store(StoretransactionRequest $request) public function store(Request $request)
{ {
// //
} }
@ -35,7 +34,7 @@ class TransactionController extends Controller
/** /**
* Display the specified resource. * Display the specified resource.
*/ */
public function show(transaction $transaction) public function show(TransactionDescription $transactionDescription)
{ {
// //
} }
@ -43,7 +42,7 @@ class TransactionController extends Controller
/** /**
* Show the form for editing the specified resource. * Show the form for editing the specified resource.
*/ */
public function edit(transaction $transaction) public function edit(TransactionDescription $transactionDescription)
{ {
// //
} }
@ -51,7 +50,7 @@ class TransactionController extends Controller
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
*/ */
public function update(UpdatetransactionRequest $request, transaction $transaction) public function update(Request $request, TransactionDescription $transactionDescription)
{ {
// //
} }
@ -59,7 +58,7 @@ class TransactionController extends Controller
/** /**
* Remove the specified resource from storage. * Remove the specified resource from storage.
*/ */
public function destroy(transaction $transaction) public function destroy(TransactionDescription $transactionDescription)
{ {
// //
} }

View File

@ -0,0 +1,144 @@
<?php
namespace App\Http\Controllers\User;
use App\Models\Contact;
use App\Models\User;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
class UserContactController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$contacts = Contact::where('pemilik_kontak', Auth::user()->email)->get();
return view('user.contact.index', ['contacts' => $contacts]);
// dd($contacts);
}
public function getContact()
{
$data = DB::table('contacts')
->select('contacts.relasi_kontak', 'users.nama_depan', 'users.nama_belakang')
->join('users', 'contacts.relasi_kontak', '=', 'users.email')
->where('contacts.pemilik_kontak','=',Auth::user()->email)
->paginate(10);
return response()->json($data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
$email_relasi = $request->input('email');
if ($email_relasi == Auth::user()->email) {
return response()->json([
'status' => false,
'message' => 'Kontak yang ingin didaftarkan tidak boleh sama',
]);
} else {
$result = Contact::create([
'pemilik_kontak' => Auth::user()->email,
'relasi_kontak' => $request->input('email'),
]);
if ($result) {
return response()->json([
'status' => true,
'message' => 'Akun berhasil masuk ke kontak',
]);
} else {
return response()->json([
'status' => false,
'message' => 'Akun gagal masuk ke kontak',
]);
}
}
}
/**
* Display the specified resource.
*/
public function show(Contact $contact)
{
}
/**
* Show the form for editing the specified resource.
*/
public function edit(Contact $contact)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, Contact $contact)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(Contact $contact, $id)
{
try {
$result = Contact::destroy($id);
if ($result) {
return response()->json([
'message' => 'Berhasil hapus data',
'status' => true,
]);
} else {
return response()->json([
'message' => 'Gagal hapus data karena ' . $result,
'status' => false,
]);
}
} catch (\Exception $e) {
return response()->json([
'message' => 'Gagal hapus data, karena ' . $e,
'status' => false,
]);
}
}
public function cekEmail($email)
{
$result = User::where('email', $email)->get();
if ($result->isNotEmpty() && $result[0]->role == 'User' && $result[0]->status != 'Rejected') {
if ($result[0]->status == 'Finished') {
return response()->json([
'status' => true,
'message' => $result,
]);
} else {
return response()->json([
'status' => false,
'message' => 'Akun dengen email ' . $email . ' tersedia dan belum diverifikasi',
]);
}
} else {
return response()->json([
'status' => false,
'message' => 'Akun dengen email ' . $email . ' tidak tersedia atau ditolak',
]);
}
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\RefundUser;
class UserDashboardController extends Controller
{
public function index(){
return view('user.index',[
"refundUserss"=>RefundUser::HistoryRefundUser()
]);
}
public function profile(){
return view('user.profile.index');
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace App\Http\Controllers\User;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\RefundUser;
class UserRefundController extends Controller
{
public function index()
{
return view('user.refund.index', [
'name' => 'npannisa',
'refundUserss' => RefundUser::HistoryRefundUser(),
]);
}
public function createRefund(Request $request)
{
return view('user.refund.new-refund');
}
public function historyRefund($id){
return view('user.transaction.pembeli.history-refund',[
'name'=>'npannisa',
"refundUserss"=>RefundUser::HistoryRefundUser()
]);
}
}

View File

@ -0,0 +1,280 @@
<?php
namespace App\Http\Controllers\User;
use App\Models\Transaction;
use App\Models\TransactionDescription;
use App\Http\Controllers\Controller;
use App\Models\Setting;
use Illuminate\Http\Request;
use App\Models\TransactionUser;
use App\Models\User;
use Carbon\Carbon;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Auth;
use Ramsey\Uuid\Uuid;
use Midtrans\Config;
use Midtrans\Snap;
use Midtrans\Transaction as Trans;
class UserTransactionController extends Controller
{
/**
* Display a listing of the resource.
*/
public function indexPembeli()
{
return view('user.transaction.pembeli.index', [
'transactions' => Transaction::where('pembeli', Auth::user()->email)
->latest()
->get(),
]);
// dd(Transaction::where('pembeli',Auth::user()->email)->get());
}
/**
* Display a listing of the resource.
*/
public function indexPenjual()
{
return view('user.transaction.penjual.index', [
'transactions' => Transaction::where('penjual', Auth::user()->email)->get(),
]);
}
public function detailTransaction($id)
{
return view('user.transaction.pembeli.detail-transaction', [
'transaction' => Transaction::findOrFail($id),
'trackings' => TransactionDescription::where('order_id', $id)->get(),
]);
// dd(Transaction::findOrFail($id));
}
/**
* Show the form for creating a new resource.
*/
public function createTransaction(Request $request)
{
return view('user.transaction.pembeli.new-transaction');
}
/**
* Store a newly created resource in storage.
*/
public function invoiceTransaction($id)
{
return view('user.transaction.pembeli.invoice-transaction', [
'name' => 'npannisa',
'TransactionUser' => TransactionUser::HistoryTransaction(),
]);
}
public function storeTransaction(Request $request)
{
$pembeli = Auth::user()->email;
$penjual = $request->get('email_penjual');
$nama_barang = $request->get('nama_barang');
$satuan_barang = $request->get('satuan_barang');
$deskripsi_transaksi = $request->get('deskripsi');
$harga_barang = $request->get('harga_barang');
$jumlah_barang = $request->get('jumlah_barang');
$nama_depan_pembeli = Auth::user()->nama_depan;
$nama_belakang_pembeli = Auth::user()->nama_belakang;
$nohp_pembeli = Auth::user()->nohp;
$nama_penjual = User::where('email', $penjual)->value('nama_depan');
$alamat = ucwords(strtolower(Auth::user()->alamat));
$id = Uuid::uuid4();
$now = Carbon::now()->tz('Asia/Jakarta');
$bulan = $now->format('F');
$tahun = $now->year;
// $persentase_keuntungan = Setting::where('status','Active')
// ->where('bulan','=',$bulan)
// ->where('tahun','=',$tahun)->get();
$persentase_keuntungan = $request->get('persentase_keuntungan');
$total_harga = $request->get('total_harga');
$total_keuntungan = $request->get('total_keuntungan');
$total_bayar = $request->get('total_bayar');
$batas_pembayaran = $now->addDays(1)->toDateTimeString();
$batas_pengiriman_barang_awal = $now->addDays(2)->toDateTimeString();
$batas_pengiriman_barang_akhir = $now->addDays(5)->toDateTimeString();
$params = [
'transaction_details' => [
'order_id' => $id,
'gross_amount' => $total_bayar,
],
'item_details' => [
[
'id' => $nama_barang . time(),
'price' => $harga_barang,
'quantity' => $jumlah_barang,
'name' => $nama_barang,
],
[
'id' => 'BA01',
'price' => $total_keuntungan,
'quantity' => 1,
'name' => 'Biaya Admin',
],
],
'customer_details' => [
'firts_name' => $nama_depan_pembeli,
'last_name' => $nama_belakang_pembeli,
'email' => $pembeli,
'phone' => $nohp_pembeli,
'billing' => [
'first_name' => $nama_depan_pembeli,
'last_name' => $nama_belakang_pembeli,
'email' => $pembeli,
'phone' => $nohp_pembeli,
'address' => Auth::user()->alamat,
'city' => Auth::user()->village->district->city->name,
'country_code' => 'IDN',
],
],
'callbacks' => [
'finish' => 'http://127.0.0.1:8000/user/user-transaction-pembeli/',
],
'expiry' => [
'start_time' => $now->format('Y-m-d H:i:s P'),
'unit' => 'hours',
'duration' => 24,
],
];
Config::$serverKey = 'SB-Mid-server-8rydZAwKoWuoQ6g_3ot0-K7p';
Config::$isProduction = false;
// Set sanitization on (default)
Config::$isSanitized = true;
// Set 3DS transaction for credit card to true
Config::$is3ds = true;
$snap_token = Snap::getSnapToken($params);
$token = $snap_token;
$status = 'pending';
$query = Transaction::create([
'id' => $id,
'pembeli' => $pembeli,
'penjual' => $penjual,
'nama_barang' => $nama_barang,
'deskripsi_transaksi' => $deskripsi_transaksi,
'satuan_barang' => $satuan_barang,
'harga_barang' => $harga_barang,
'jumlah_barang' => $jumlah_barang,
'persentase_keuntungan' => $persentase_keuntungan,
'total_keuntungan' => $total_keuntungan,
'total_harga' => $total_harga,
'total_bayar' => $total_bayar,
'token' => $token,
'status' => $status,
'batas_pembayaran' => $batas_pembayaran,
'batas_pengiriman_barang_awal' => $batas_pengiriman_barang_awal,
'batas_pengiriman_barang_akhir' => $batas_pengiriman_barang_akhir,
]);
if ($query) {
TransactionDescription::create([
'order_id' => $id,
'status' => $status,
'user' => $pembeli,
'judul' => 'fa fa-plus',
'background' => 'bg-buyer',
'deskripsi' => $nama_depan_pembeli . ' telah membuat transaksi baru dengan ' . $nama_penjual,
]);
return response()->json([
'status' => true,
'message' => 'Berhasil menambahkan transaksi. Silahkan lakukan pembayaran.',
]);
} else {
return response()->json([
'status' => false,
'message' => 'Gagal menambahkan transaksi.',
]);
}
}
public function updateStatusTransaction(Request $request)
{
}
public function acceptTransaction(Request $request)
{
}
public function paymentTransaction(Request $request, $id)
{
Config::$serverKey = 'SB-Mid-server-8rydZAwKoWuoQ6g_3ot0-K7p';
Config::$isProduction = false;
// Set sanitization on (default)
Config::$isSanitized = true;
// Set 3DS transaction for credit card to true
Config::$is3ds = true;
$payment = Trans::status($id);
$result = json_decode(json_encode($payment), true);
$query = Transaction::where('id', $id)->update([
'acquire' => $result['acquirer'],
'currency' => $result['currency'],
'fraud_status' => $result['fraud_status'],
'issuer' => $result['issuer'],
'merchant_id' => $result['merchant_id'],
'metode_pembayaran' => $result['payment_type'],
'tanggal_pembayaran' => $result['settlement_time'],
'signature_key' => $result['signature_key'],
'status' => $result['transaction_status'],
'tipe_transaction' => $result['transaction_type'],
'status_code' => $result['status_code'],
]);
if ($query) {
return response()->json([
'status' => true,
'message' => 'Pembayaran sukses. Proses akan dilanjutkan ke penjual',
]);
} else {
return response()->json([
'status' => false,
'message' => 'Pembayaran gagal',
]);
}
}
/**
* Display the specified resource.
*/
public function show(Transaction $transaction)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(Transaction $transaction)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, Transaction $transaction)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(Transaction $transaction)
{
//
}
}

View File

@ -64,5 +64,7 @@ class Kernel extends HttpKernel
'signed' => \App\Http\Middleware\ValidateSignature::class, 'signed' => \App\Http\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
'admin' => \App\Http\Middleware\Admin::class,
'user' => \App\Http\Middleware\User::class,
]; ];
} }

View File

@ -0,0 +1,24 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
use Illuminate\Support\Facades\Auth;
class Admin
{
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
*/
public function handle(Request $request, Closure $next): Response
{
if(Auth::user()->role != 'Admin'){
return redirect()->back();
}
return $next($request);
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
use Illuminate\Support\Facades\Auth;
class User
{
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
*/
public function handle(Request $request, Closure $next): Response
{
if(Auth::user()->role != 'User'){
return redirect()->back();
}
return $next($request);
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreSettingRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array|string>
*/
public function rules(): array
{
return [
//
];
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreUsersRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array|string>
*/
public function rules(): array
{
return [
//
];
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateSettingRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array|string>
*/
public function rules(): array
{
return [
//
];
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateUsersRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array|string>
*/
public function rules(): array
{
return [
//
];
}
}

View File

@ -0,0 +1,59 @@
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class verificationMail extends Mailable
{
use Queueable, SerializesModels;
public $verificationEmail;
/**
* Create a new message instance.
*/
public function __construct($verificationEmail)
{
$this->verificationEmail = $verificationEmail;
}
/**
* Get the message envelope.
*/
// public function envelope(): Envelope
// {
// return new Envelope(
// subject: 'Verification Mail',
// );
// }
/**
* Get the message content definition.
*/
// public function content(): Content
// {
// return new Content(
// view: 'view.name',
// );
// }
/**
* Get the attachments for the message.
*
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
*/
// public function attachments(): array
// {
// return [];
// }
public function build(){
return $this->subject('Kode Verifikasi')->view('email.verification-email');
}
}

32
app/Models/Contact.php Normal file
View File

@ -0,0 +1,32 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Contact extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'pemilik_kontak',
'relasi_kontak',
];
//Relasi
public function pemilikKontak(){
return $this->belongsTo(User::class, 'pemilik_kontak', 'email');
}
public function relasiKontak(){
return $this->belongsTo(User::class, 'relasi_kontak', 'email');
}
//Relasi
}

View File

@ -1,12 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class District extends Model
{
use HasFactory;
protected $table = 'districts';
}

View File

@ -1,13 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Provinces extends Model
{
use HasFactory;
protected $table = 'provinces';
}

View File

@ -5,67 +5,25 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class Refund class Refund extends Model
{ {
private static $history_refund=[ use HasFactory;
[
"orderId" => "INV-1234",
"customer" => "Okta",
"seller" => "dodo",
"total" => "Rp. 15000",
"date" => "July 19, 2023 ",
"status"=>"Process Refund"
],
[
"orderId" => "INV-0000",
"customer" => "Selvi",
"seller" => "dedo",
"total" => "Rp. 11000",
"date" => "August 19, 2023 ",
"status"=>"Process Refund"
],
[
"orderId" => "INV-2313",
"customer" => "Septa",
"seller" => "dido",
"total" => "Rp. 15000",
"date" => "July 29, 2023 ",
"status"=>"Process Refund"
],
[
"orderId" => "INV-5664",
"customer" => "Padia",
"seller" => "dedo",
"total" => "Rp. 14000",
"date" => "July 18, 2023 ",
"status"=>"Process Refund"
],
[
"orderId" => "INV-9090",
"customer" => "hantu",
"seller" => "dado",
"total" => "Rp. 45000",
"date" => "June 19, 2023 ",
"status"=>"Process Refund"
]
];
public static $detail_refund=[ /**
[ * The attributes that are mass assignable.
"orderId" => "INV-9090", *
"customer" => "hantu", * @var array<int, string>
"seller" => "dado", */
"total" => "Rp. 45000", protected $fillable = [
"date" => "June 19, 2023 ", 'order_id',
"complaint" =>" Lorem ipsum dolor sit, amet consectetur adipisicing elit. Aliquam inventore, sit enim iure itaque fuga voluptates alias, eveniet quos ex reiciendis! Dolore mollitia ea inventore, excepturi hic fugiat id, magnam molestias sint ut enim repellendus, cum dolorum dolores sapiente adipisci tempora nihil omnis! Accusantium, non perspiciatis? Molestias modi debitis perferendis reprehenderit excepturi voluptates? Sit incidunt consequuntur iusto odit sapiente inventore nemo commodi, quam vero magnam temporibus ducimus praesentium assumenda blanditiis possimus perferendis totam placeat maiores. Quae ut id libero atque pariatur veritatis rerum culpa tempore consequatur quod corrupti corporis nobis quia repellendus iste quidem illum, voluptates aspernatur cumque officia. Tenetur.", 'total',
"image"=>"assets/images/dashboard/img_2.jpg" 'due_date',
] 'status',
]; ];
public static function HistoryRefund(){
return self::$history_refund;
} //Relasi
public static function DetailRefund(){ public function orders(){
return self::$detail_refund; return $this->belongsTo(Transaction::class, 'id', 'order_id');
} }
} //Relasi
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class RefundDescription extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'refund_id',
'filename',
'type',
];
//Relasi
public function refunds(){
return $this->belongsTo(Refund::class, 'refund_id', 'id');
}
//Relasi
}

44
app/Models/RefundUser.php Normal file
View File

@ -0,0 +1,44 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class RefundUser
{
// use HasFactory;
private static $history_refundUser=[
[
"orderId" => "INV-1234",
"Customer" => "npannisa",
"seller" => "rayhan",
"Total" => " Rp.200.000",
"dueDate"=>"29 juni 2023",
"status"=>"diterima",
"uploadBukti" => "5.jpg"
],
[
"orderId" => "INV-1234",
"Customer" => "hantu",
"seller" => "rayhan",
"Total" => " Rp.200.000",
"dueDate"=>"29 juni 2023",
"status"=>"ditolak",
"uploadBukti" => "5.jpg"
],
[
"orderId" => "INV-1234",
"Customer" => "pocong",
"seller" => "rayhan",
"Total" => " Rp.200.000",
"dueDate"=>"29 juni 2023",
"status"=>"diterima",
"uploadBukti" => "5.jpg"
],
];
public static function HistoryRefundUser(){
return self::$history_refundUser;
}
}

80
app/Models/Refunds.php Normal file
View File

@ -0,0 +1,80 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
// class Refund extends Model{
// protected $table = 'refund';
// use HasFactory;
// }
class Refunds
{
private static $history_refund=[
[
"no"=>"1",
"orderId" => "INV-1234",
"customer" => "Okta",
"seller" => "dodo",
"total" => "Rp. 15000",
"date" => "July 19, 2023 ",
"status"=>"Process Refund"
],
[
"no"=>"2",
"orderId" => "INV-0000",
"customer" => "Selvi",
"seller" => "dedo",
"total" => "Rp. 11000",
"date" => "August 19, 2023 ",
"status"=>"Refund Success"
],
[
"no"=>"3",
"orderId" => "INV-2313",
"customer" => "Septa",
"seller" => "dido",
"total" => "Rp. 15000",
"date" => "July 29, 2023 ",
"status"=>"Process Refund"
],
[
"no"=>"4",
"orderId" => "INV-5664",
"customer" => "Padia",
"seller" => "dedo",
"total" => "Rp. 14000",
"date" => "July 18, 2023 ",
"status"=>"Refunds Refused"
],
[
"no"=>"5",
"orderId" => "INV-9090",
"customer" => "hantu",
"seller" => "dado",
"total" => "Rp. 45000",
"date" => "2023-08-14 ",
"status"=>"Refunds Refused"
]
];
public static $detail_refund=[
[
"orderId" => "INV-9090",
"customer" => "hantu",
"seller" => "dado",
"total" => "Rp. 45000",
"date" => "2023-08-14 ",
"complaint" =>" Lorem ipsum dolor sit, amet consectetur adipisicing elit. Aliquam inventore, sit enim iure itaque fuga voluptates alias, eveniet quos ex reiciendis! Dolore mollitia ea inventore, excepturi hic fugiat id, magnam molestias sint ut enim repellendus, cum dolorum dolores sapiente adipisci tempora nihil omnis! Accusantium, non perspiciatis? Molestias modi debitis perferendis reprehenderit excepturi voluptates? Sit incidunt consequuntur iusto odit sapiente inventore nemo commodi, quam vero magnam temporibus ducimus praesentium assumenda blanditiis possimus perferendis totam placeat maiores. Quae ut id libero atque pariatur veritatis rerum culpa tempore consequatur quod corrupti corporis nobis quia repellendus iste quidem illum, voluptates aspernatur cumque officia. Tenetur.",
"image"=>"assets/images/dashboard/img_2.jpg"
]
];
public static function HistoryRefund(){
return self::$history_refund;
}
public static function DetailRefund(){
return self::$detail_refund;
}
}

View File

@ -1,13 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Regency extends Model
{
use HasFactory;
protected $table = 'regencies';
}

23
app/Models/Setting.php Normal file
View File

@ -0,0 +1,23 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Setting extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'bulan',
'tahun',
'persentase',
'status',
];
}

50
app/Models/Settings.php Normal file
View File

@ -0,0 +1,50 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Settings
{
static $History_Setting=[
[
"no" => "1",
"month" => "January",
"year" =>"2021",
"persentase" =>"50%",
"status" =>"Active"
],
[
"no" => "2",
"month" => "February",
"year" =>"2022",
"persentase" =>"40%",
"status" =>"Non Active"
],
[
"no" => "3",
"month" => "March",
"year" =>"2023",
"persentase" =>"30%",
"status" =>"Non Active"
],
[
"no" => "4",
"month" => "April",
"year" =>"2021",
"persentase" =>"60%",
"status" =>"Non Active"
],
[
"no" => "5",
"month" => "May",
"year" =>"2023",
"persentase" =>"20%",
"status" =>"Non Active"
]
];
public static function HistorySetting(){
return self::$History_Setting;
}
}

View File

@ -0,0 +1,35 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class TransactionDescription extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'order_id',
'user',
'judul',
'status',
'background',
'deskripsi'
];
//Relasi
public function order(){
return $this->belongsTo(Transaction::class, 'id', 'order_id');
}
public function user(){
return $this->belongsTo(User::class, 'email', 'user');
}
//Relasi
}

View File

@ -0,0 +1,57 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class TransactionUser
{
private static $history_transaction=[
[
"userId" => "NPA-9876",
"orderId" => "INV-1234",
"Customer" => "Nurul Prima",
"seller" => "Jilhan",
"total" => "Rp.500.000",
"dueDate"=>"29 juni 2023",
"status"=>"OnProgress",
"action" => ""
],
[
"userId" => "NPA-9879",
"orderId" => "INV-1234",
"Customer" => "Nurul Prima Annisa",
"seller" => "Raihan",
"total" => "Rp.500.000",
"dueDate"=>"29 juni 2025",
"status"=>"Diterima",
"action" => ""
],
// [
// "userId" => "NPA-9877",
// "orderId" => "INV-1235",
// "Customer" => "Nurul Annisa",
// "seller" => "Rayhan",
// "total" => "Rp.900.000",
// "dueDate"=>"29 Juli 2023",
// "status"=>"Pembeli",
// "action" => ""
// ],
// [
// "userId" => "NPA-9878",
// "orderId" => "INV-1236",
// "Customer" => "Nurul Prima Annisa",
// "seller" => "Rayhan",
// "total" => "Rp.900.000",
// "dueDate"=>"29 Juli 2023",
// "status"=>"Pembeli",
// "action" => ""
// ],
];
public static function HistoryTransaction(){
return self::$history_transaction;
}
}

View File

@ -0,0 +1,90 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Transactions
{
private static $list_transaction = [
[
'no' => '1',
'orderId' => 'INV-1234',
'customer' => 'Jilhan',
'seller' => 'dodo',
'total' => 'Rp. 15000',
'date' => 'July 19, 2023 ',
'status' => 'paid',
],
[
'no' => '2',
'orderId' => 'INV-0000',
'customer' => 'hmmm',
'seller' => 'dodo',
'total' => 'Rp. 11000',
'date' => 'August 19, 2023 ',
'status' => 'pending',
],
[
'no' => '3',
'orderId' => 'INV-2313',
'customer' => 'nurul',
'seller' => 'dido',
'total' => 'Rp. 15000',
'date' => 'July 29, 2023 ',
'status' => 'unpaid',
],
[
'no' => '4',
'orderId' => 'INV-5664',
'customer' => 'raihan',
'seller' => 'dedo',
'total' => 'Rp. 14000',
'date' => 'July 18, 2023 ',
'status' => 'pending',
],
[
'no' => '5',
'orderId' => 'INV-9090',
'customer' => 'testing',
'seller' => 'dado',
'total' => 'Rp. 45000',
'date' => 'June 19, 2023 ',
'status' => 'paid',
],
];
private static $detail_transaction = [
[
'idTransaction' => 'INV-76899',
'side' => 'SELL',
'marketPair' => 'IDR',
'email' => 'JilhanHaura07@gmail.com',
'amountTransaction' => 'Rp. 900000',
'feeTransaction' => '10%',
'total' => '68,00989.00 IDR',
'paymentDetail' => 'Bank',
'bankName' => 'BNI',
'accountNumber' => '123',
'statusTransaction' => 'Success',
// "tracking_number" => "09102919209",
// "orderId" => "INV-9090",
// "status"=>"Pending",
// "estimated" => "June 20, 2023",
// "tracking_detail1"=> "August 10: processed payment",
// "tracking_detail2"=> "August 12: payment in system",
// "tracking_detail3"=> "August 14: payment has been received by the seller",
],
];
public static function allTransactions()
{
return self::$list_transaction;
}
public static function allDetailTransactions()
{
return self::$detail_transaction;
}
}

View File

@ -7,6 +7,8 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable; use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens; use Laravel\Sanctum\HasApiTokens;
use Tymon\JWTAuth\Contracts\JWTSubject;
use Illuminate\Database\Eloquent\Concerns\HasUuids;
class User extends Authenticatable class User extends Authenticatable
{ {
@ -18,9 +20,24 @@ class User extends Authenticatable
* @var array<int, string> * @var array<int, string>
*/ */
protected $fillable = [ protected $fillable = [
'name', 'id',
'nama_depan',
'nama_belakang',
'tanggal_lahir',
'nik',
'email', 'email',
'password', 'password',
'role',
'nohp',
'alamat',
'foto_ktp',
'foto_wajah',
'foto_profil',
'persentase_kemiripan',
'status',
'gender',
'kode_kelurahan',
'remember_token',
]; ];
/** /**
@ -41,5 +58,72 @@ class User extends Authenticatable
protected $casts = [ protected $casts = [
'email_verified_at' => 'datetime', 'email_verified_at' => 'datetime',
'password' => 'hashed', 'password' => 'hashed',
'id' => 'string',
'status' => 'string',
]; ];
//JWT
/**
* Get the identifier that will be stored in the subject claim of the JWT.
*
* @return mixed
*/
public function getJWTIdentifier()
{
return $this->getKey();
}
/**
* Return a key value array, containing any custom claims to be added to the JWT.
*
* @return array
*/
public function getJWTCustomClaims()
{
return [];
}
//JWT
//Relasi
public function pemilik_kontak(){
return $this->hasMany(Contact::class, 'email', 'pemilik_kontak');
}
public function relasi_kontak(){
return $this->hasMany(Contact::class, 'email', 'relasi_kontak');
}
public function pembeli(){
return $this->hasMany(Transaction::class, 'email', 'pembeli');
}
public function penjual(){
return $this->hasMany(Transaction::class, 'email', 'penjual');
}
public function village(){
return $this->belongsTo('Laravolt\Indonesia\Models\Village', 'kode_kelurahan', 'code');
}
//Relasi
//function alamat
public function getVillageName(){
return $this->village->name;
}
public function getDistrictName(){
return $this->village->district->name;
}
public function getCityName(){
return $this->village->district->city->name;
}
public function getProvinceName(){
return $this->village->district->city->province->name;
}
} }

View File

@ -5,74 +5,57 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class transaction class Transaction extends Model
{ {
use HasFactory;
private static $list_transaction =[ /**
[ * The attributes that are mass assignable.
"orderId" => "INV-1234", *
"customer" => "Jilhan", * @var array<int, string>
"seller" => "dodo", */
"total" => "Rp. 15000", protected $fillable = [
"date" => "July 19, 2023 ", 'id',
"status"=>"paid" 'pembeli',
], 'penjual',
[ 'nama_barang',
"orderId" => "INV-0000", 'deskripsi_transaksi',
"customer" => "hmmm", 'satuan_barang',
"seller" => "dodo", 'harga_barang',
"total" => "Rp. 11000", 'jumlah_barang',
"date" => "August 19, 2023 ", 'persentase_keuntungan',
"status"=>"pending" 'total_keuntungan',
], 'total_harga',
[ 'total_bayar',
"orderId" => "INV-2313", 'token',
"customer" => "nurul", 'status',
"seller" => "dido", 'batas_pembayaran',
"total" => "Rp. 15000", 'batas_pengiriman_barang_awal',
"date" => "July 29, 2023 ", 'batas_pengiriman_barang_akhir',
"status"=>"unpaid" ];
],
[
"orderId" => "INV-5664",
"customer" => "raihan",
"seller" => "dedo",
"total" => "Rp. 14000",
"date" => "July 18, 2023 ",
"status"=>"pending"
],
[
"orderId" => "INV-9090",
"customer" => "testing",
"seller" => "dado",
"total" => "Rp. 45000",
"date" => "June 19, 2023 ",
"status"=>"paid"
]
]; /**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'batas_pembayaran' => 'datetime',
'batas_pengiriman_barang' => 'datetime',
'id' => 'string',
];
private static $detail_transaction=[ //Relasi
[ public function data_pembeli(){
"tracking_number" => "09102919209", return $this->belongsTo(User::class, 'pembeli', 'email');
"orderId" => "INV-9090", }
"status"=>"Pending",
"estimated" => "June 20, 2023",
"tracking_detail1"=> "August 10: processed payment",
"tracking_detail2"=> "August 12: payment in system",
"tracking_detail3"=> "August 14: payment has been received by the seller",
],
]; public function data_penjual(){
return $this->belongsTo(User::class, 'penjual', 'email');
}
public function refunds(){
public static function allTransactions() return $this->hasMany(Refund::class, 'order_id', 'id');
{ }
return self::$list_transaction; //Relasi
} }
public static function allDetailTransactions()
{
return self::$detail_transaction;
}
}

View File

@ -0,0 +1,66 @@
<?php
namespace App\Policies;
use App\Models\Setting;
use App\Models\User;
use Illuminate\Auth\Access\Response;
class SettingPolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
//
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, Setting $setting): bool
{
//
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
//
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, Setting $setting): bool
{
//
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, Setting $setting): bool
{
//
}
/**
* Determine whether the user can restore the model.
*/
public function restore(User $user, Setting $setting): bool
{
//
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(User $user, Setting $setting): bool
{
//
}
}

View File

@ -0,0 +1,66 @@
<?php
namespace App\Policies;
use App\Models\User;
use App\Models\Users;
use Illuminate\Auth\Access\Response;
class UsersPolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
//
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, Users $users): bool
{
//
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
//
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, Users $users): bool
{
//
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, Users $users): bool
{
//
}
/**
* Determine whether the user can restore the model.
*/
public function restore(User $user, Users $users): bool
{
//
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(User $user, Users $users): bool
{
//
}
}

View File

@ -2,14 +2,25 @@
"name": "laravel/laravel", "name": "laravel/laravel",
"type": "project", "type": "project",
"description": "The skeleton application for the Laravel framework.", "description": "The skeleton application for the Laravel framework.",
"keywords": ["laravel", "framework"], "keywords": [
"laravel",
"framework"
],
"license": "MIT", "license": "MIT",
"require": { "require": {
"php": "^8.1", "php": "^8.1",
"guzzlehttp/guzzle": "^7.2", "guzzlehttp/guzzle": "^7.2",
"intervention/image": "^2.7",
"laravel/framework": "^10.10", "laravel/framework": "^10.10",
"laravel/sanctum": "^3.2", "laravel/sanctum": "^3.2",
"laravel/tinker": "^2.8" "laravel/tinker": "^2.8",
"laravolt/indonesia": "^0.34.0",
"midtrans/midtrans-php": "^2.5",
"nesbot/carbon": "^2.69",
"pusher/pusher-php-server": "^7.2",
"ramsey/uuid": "^4.7",
"thiagoalessio/tesseract_ocr": "^2.12",
"tymon/jwt-auth": "^2.0"
}, },
"require-dev": { "require-dev": {
"fakerphp/faker": "^1.9.1", "fakerphp/faker": "^1.9.1",

847
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -109,7 +109,7 @@ return [
| |
*/ */
'faker_locale' => 'en_US', 'faker_locale' => 'id_ID',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

View File

@ -40,6 +40,10 @@ return [
'driver' => 'session', 'driver' => 'session',
'provider' => 'users', 'provider' => 'users',
], ],
'api' => [
'driver' => 'jwt',
'provider' => 'users',
]
], ],
/* /*

View File

@ -35,13 +35,17 @@ return [
'key' => env('PUSHER_APP_KEY'), 'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'), 'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'), 'app_id' => env('PUSHER_APP_ID'),
// 'options' => [
// 'cluster' => env('PUSHER_APP_CLUSTER'),
// 'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com',
// 'port' => env('PUSHER_PORT', 443),
// 'scheme' => env('PUSHER_SCHEME', 'https'),
// 'encrypted' => true,
// 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
// ],
'options' => [ 'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'), 'cluster' => 'ap1',
'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', 'useTLS' => true,
'port' => env('PUSHER_PORT', 443),
'scheme' => env('PUSHER_SCHEME', 'https'),
'encrypted' => true,
'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
], ],
'client_options' => [ 'client_options' => [
// Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html

View File

@ -148,4 +148,4 @@ return [
], ],
]; ];

80
config/flare.php Normal file
View File

@ -0,0 +1,80 @@
<?php
use Spatie\FlareClient\FlareMiddleware\AddGitInformation;
use Spatie\FlareClient\FlareMiddleware\RemoveRequestIp;
use Spatie\FlareClient\FlareMiddleware\CensorRequestBodyFields;
use Spatie\FlareClient\FlareMiddleware\CensorRequestHeaders;
use Spatie\LaravelIgnition\FlareMiddleware\AddDumps;
use Spatie\LaravelIgnition\FlareMiddleware\AddEnvironmentInformation;
use Spatie\LaravelIgnition\FlareMiddleware\AddExceptionInformation;
use Spatie\LaravelIgnition\FlareMiddleware\AddJobs;
use Spatie\LaravelIgnition\FlareMiddleware\AddLogs;
use Spatie\LaravelIgnition\FlareMiddleware\AddQueries;
use Spatie\LaravelIgnition\FlareMiddleware\AddNotifierName;
return [
/*
|
|--------------------------------------------------------------------------
| Flare API key
|--------------------------------------------------------------------------
|
| Specify Flare's API key below to enable error reporting to the service.
|
| More info: https://flareapp.io/docs/general/projects
|
*/
'key' => env('FLARE_KEY'),
/*
|--------------------------------------------------------------------------
| Middleware
|--------------------------------------------------------------------------
|
| These middleware will modify the contents of the report sent to Flare.
|
*/
'flare_middleware' => [
RemoveRequestIp::class,
AddGitInformation::class,
AddNotifierName::class,
AddEnvironmentInformation::class,
AddExceptionInformation::class,
AddDumps::class,
AddLogs::class => [
'maximum_number_of_collected_logs' => 200,
],
AddQueries::class => [
'maximum_number_of_collected_queries' => 200,
'report_query_bindings' => true,
],
AddJobs::class => [
'max_chained_job_reporting_depth' => 5,
],
CensorRequestBodyFields::class => [
'censor_fields' => [
'password',
'password_confirmation',
],
],
CensorRequestHeaders::class => [
'headers' => [
'API-KEY',
]
]
],
/*
|--------------------------------------------------------------------------
| Reporting log statements
|--------------------------------------------------------------------------
|
| If this setting is `false` log statements won't be sent as events to Flare,
| no matter which error level you specified in the Flare log channel.
|
*/
'send_logs_as_events' => true,
];

279
config/ignition.php Normal file
View File

@ -0,0 +1,279 @@
<?php
use Spatie\Ignition\Solutions\SolutionProviders\BadMethodCallSolutionProvider;
use Spatie\Ignition\Solutions\SolutionProviders\MergeConflictSolutionProvider;
use Spatie\Ignition\Solutions\SolutionProviders\UndefinedPropertySolutionProvider;
use Spatie\LaravelIgnition\Recorders\DumpRecorder\DumpRecorder;
use Spatie\LaravelIgnition\Recorders\JobRecorder\JobRecorder;
use Spatie\LaravelIgnition\Recorders\LogRecorder\LogRecorder;
use Spatie\LaravelIgnition\Recorders\QueryRecorder\QueryRecorder;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\DefaultDbNameSolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\GenericLaravelExceptionSolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\IncorrectValetDbCredentialsSolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\InvalidRouteActionSolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\MissingAppKeySolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\MissingColumnSolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\MissingImportSolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\MissingLivewireComponentSolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\MissingMixManifestSolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\MissingViteManifestSolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\RunningLaravelDuskInProductionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\TableNotFoundSolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\UndefinedViewVariableSolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\UnknownValidationSolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\ViewNotFoundSolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\OpenAiSolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\SailNetworkSolutionProvider;
return [
/*
|--------------------------------------------------------------------------
| Editor
|--------------------------------------------------------------------------
|
| Choose your preferred editor to use when clicking any edit button.
|
| Supported: "phpstorm", "vscode", "vscode-insiders", "textmate", "emacs",
| "sublime", "atom", "nova", "macvim", "idea", "netbeans",
| "xdebug", "phpstorm-remote"
|
*/
'editor' => env('IGNITION_EDITOR', 'phpstorm'),
/*
|--------------------------------------------------------------------------
| Theme
|--------------------------------------------------------------------------
|
| Here you may specify which theme Ignition should use.
|
| Supported: "light", "dark", "auto"
|
*/
'theme' => env('IGNITION_THEME', 'auto'),
/*
|--------------------------------------------------------------------------
| Sharing
|--------------------------------------------------------------------------
|
| You can share local errors with colleagues or others around the world.
| Sharing is completely free and doesn't require an account on Flare.
|
| If necessary, you can completely disable sharing below.
|
*/
'enable_share_button' => env('IGNITION_SHARING_ENABLED', true),
/*
|--------------------------------------------------------------------------
| Register Ignition commands
|--------------------------------------------------------------------------
|
| Ignition comes with an additional make command that lets you create
| new solution classes more easily. To keep your default Laravel
| installation clean, this command is not registered by default.
|
| You can enable the command registration below.
|
*/
'register_commands' => env('REGISTER_IGNITION_COMMANDS', false),
/*
|--------------------------------------------------------------------------
| Solution Providers
|--------------------------------------------------------------------------
|
| You may specify a list of solution providers (as fully qualified class
| names) that shouldn't be loaded. Ignition will ignore these classes
| and possible solutions provided by them will never be displayed.
|
*/
'solution_providers' => [
// from spatie/ignition
BadMethodCallSolutionProvider::class,
MergeConflictSolutionProvider::class,
UndefinedPropertySolutionProvider::class,
// from spatie/laravel-ignition
IncorrectValetDbCredentialsSolutionProvider::class,
MissingAppKeySolutionProvider::class,
DefaultDbNameSolutionProvider::class,
TableNotFoundSolutionProvider::class,
MissingImportSolutionProvider::class,
InvalidRouteActionSolutionProvider::class,
ViewNotFoundSolutionProvider::class,
RunningLaravelDuskInProductionProvider::class,
MissingColumnSolutionProvider::class,
UnknownValidationSolutionProvider::class,
MissingMixManifestSolutionProvider::class,
MissingViteManifestSolutionProvider::class,
MissingLivewireComponentSolutionProvider::class,
UndefinedViewVariableSolutionProvider::class,
GenericLaravelExceptionSolutionProvider::class,
OpenAiSolutionProvider::class,
SailNetworkSolutionProvider::class,
],
/*
|--------------------------------------------------------------------------
| Ignored Solution Providers
|--------------------------------------------------------------------------
|
| You may specify a list of solution providers (as fully qualified class
| names) that shouldn't be loaded. Ignition will ignore these classes
| and possible solutions provided by them will never be displayed.
|
*/
'ignored_solution_providers' => [
],
/*
|--------------------------------------------------------------------------
| Runnable Solutions
|--------------------------------------------------------------------------
|
| Some solutions that Ignition displays are runnable and can perform
| various tasks. By default, runnable solutions are only enabled when your
| app has debug mode enabled and the environment is `local` or
| `development`.
|
| Using the `IGNITION_ENABLE_RUNNABLE_SOLUTIONS` environment variable, you
| can override this behaviour and enable or disable runnable solutions
| regardless of the application's environment.
|
| Default: env('IGNITION_ENABLE_RUNNABLE_SOLUTIONS')
|
*/
'enable_runnable_solutions' => env('IGNITION_ENABLE_RUNNABLE_SOLUTIONS'),
/*
|--------------------------------------------------------------------------
| Remote Path Mapping
|--------------------------------------------------------------------------
|
| If you are using a remote dev server, like Laravel Homestead, Docker, or
| even a remote VPS, it will be necessary to specify your path mapping.
|
| Leaving one, or both of these, empty or null will not trigger the remote
| URL changes and Ignition will treat your editor links as local files.
|
| "remote_sites_path" is an absolute base path for your sites or projects
| in Homestead, Vagrant, Docker, or another remote development server.
|
| Example value: "/home/vagrant/Code"
|
| "local_sites_path" is an absolute base path for your sites or projects
| on your local computer where your IDE or code editor is running on.
|
| Example values: "/Users/<name>/Code", "C:\Users\<name>\Documents\Code"
|
*/
'remote_sites_path' => env('IGNITION_REMOTE_SITES_PATH', base_path()),
'local_sites_path' => env('IGNITION_LOCAL_SITES_PATH', ''),
/*
|--------------------------------------------------------------------------
| Housekeeping Endpoint Prefix
|--------------------------------------------------------------------------
|
| Ignition registers a couple of routes when it is enabled. Below you may
| specify a route prefix that will be used to host all internal links.
|
*/
'housekeeping_endpoint_prefix' => '_ignition',
/*
|--------------------------------------------------------------------------
| Settings File
|--------------------------------------------------------------------------
|
| Ignition allows you to save your settings to a specific global file.
|
| If no path is specified, a file with settings will be saved to the user's
| home directory. The directory depends on the OS and its settings but it's
| typically `~/.ignition.json`. In this case, the settings will be applied
| to all of your projects where Ignition is used and the path is not
| specified.
|
| However, if you want to store your settings on a project basis, or you
| want to keep them in another directory, you can specify a path where
| the settings file will be saved. The path should be an existing directory
| with correct write access.
| For example, create a new `ignition` folder in the storage directory and
| use `storage_path('ignition')` as the `settings_file_path`.
|
| Default value: '' (empty string)
*/
'settings_file_path' => '',
/*
|--------------------------------------------------------------------------
| Recorders
|--------------------------------------------------------------------------
|
| Ignition registers a couple of recorders when it is enabled. Below you may
| specify a recorders will be used to record specific events.
|
*/
'recorders' => [
DumpRecorder::class,
JobRecorder::class,
LogRecorder::class,
QueryRecorder::class,
],
/*
* When a key is set, we'll send your exceptions to Open AI to generate a solution
*/
'open_ai_key' => env('IGNITION_OPEN_AI_KEY'),
/*
|--------------------------------------------------------------------------
| Include arguments
|--------------------------------------------------------------------------
|
| Ignition show you stack traces of exceptions with the arguments that were
| passed to each method. This feature can be disabled here.
|
*/
'with_stack_frame_arguments' => true,
/*
|--------------------------------------------------------------------------
| Argument reducers
|--------------------------------------------------------------------------
|
| Ignition show you stack traces of exceptions with the arguments that were
| passed to each method. To make these variables more readable, you can
| specify a list of classes here which summarize the variables.
|
*/
'argument_reducers' => [
\Spatie\Backtrace\Arguments\Reducers\BaseTypeArgumentReducer::class,
\Spatie\Backtrace\Arguments\Reducers\ArrayArgumentReducer::class,
\Spatie\Backtrace\Arguments\Reducers\StdClassArgumentReducer::class,
\Spatie\Backtrace\Arguments\Reducers\EnumArgumentReducer::class,
\Spatie\Backtrace\Arguments\Reducers\ClosureArgumentReducer::class,
\Spatie\Backtrace\Arguments\Reducers\DateTimeArgumentReducer::class,
\Spatie\Backtrace\Arguments\Reducers\DateTimeZoneArgumentReducer::class,
\Spatie\Backtrace\Arguments\Reducers\SymphonyRequestArgumentReducer::class,
\Spatie\LaravelIgnition\ArgumentReducers\ModelArgumentReducer::class,
\Spatie\LaravelIgnition\ArgumentReducers\CollectionArgumentReducer::class,
\Spatie\Backtrace\Arguments\Reducers\StringableArgumentReducer::class,
],
];

20
config/image.php Normal file
View File

@ -0,0 +1,20 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Image Driver
|--------------------------------------------------------------------------
|
| Intervention Image supports "GD Library" and "Imagick" to process images
| internally. You may choose one of them according to your PHP
| configuration. By default PHP's "GD Library" implementation is used.
|
| Supported: "gd", "imagick"
|
*/
'driver' => 'gd'
];

301
config/jwt.php Normal file
View File

@ -0,0 +1,301 @@
<?php
/*
* This file is part of jwt-auth.
*
* (c) Sean Tymon <tymon148@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return [
/*
|--------------------------------------------------------------------------
| JWT Authentication Secret
|--------------------------------------------------------------------------
|
| Don't forget to set this in your .env file, as it will be used to sign
| your tokens. A helper command is provided for this:
| `php artisan jwt:secret`
|
| Note: This will be used for Symmetric algorithms only (HMAC),
| since RSA and ECDSA use a private/public key combo (See below).
|
*/
'secret' => env('JWT_SECRET'),
/*
|--------------------------------------------------------------------------
| JWT Authentication Keys
|--------------------------------------------------------------------------
|
| The algorithm you are using, will determine whether your tokens are
| signed with a random string (defined in `JWT_SECRET`) or using the
| following public & private keys.
|
| Symmetric Algorithms:
| HS256, HS384 & HS512 will use `JWT_SECRET`.
|
| Asymmetric Algorithms:
| RS256, RS384 & RS512 / ES256, ES384 & ES512 will use the keys below.
|
*/
'keys' => [
/*
|--------------------------------------------------------------------------
| Public Key
|--------------------------------------------------------------------------
|
| A path or resource to your public key.
|
| E.g. 'file://path/to/public/key'
|
*/
'public' => env('JWT_PUBLIC_KEY'),
/*
|--------------------------------------------------------------------------
| Private Key
|--------------------------------------------------------------------------
|
| A path or resource to your private key.
|
| E.g. 'file://path/to/private/key'
|
*/
'private' => env('JWT_PRIVATE_KEY'),
/*
|--------------------------------------------------------------------------
| Passphrase
|--------------------------------------------------------------------------
|
| The passphrase for your private key. Can be null if none set.
|
*/
'passphrase' => env('JWT_PASSPHRASE'),
],
/*
|--------------------------------------------------------------------------
| JWT time to live
|--------------------------------------------------------------------------
|
| Specify the length of time (in minutes) that the token will be valid for.
| Defaults to 1 hour.
|
| You can also set this to null, to yield a never expiring token.
| Some people may want this behaviour for e.g. a mobile app.
| This is not particularly recommended, so make sure you have appropriate
| systems in place to revoke the token if necessary.
| Notice: If you set this to null you should remove 'exp' element from 'required_claims' list.
|
*/
'ttl' => env('JWT_TTL', 60),
/*
|--------------------------------------------------------------------------
| Refresh time to live
|--------------------------------------------------------------------------
|
| Specify the length of time (in minutes) that the token can be refreshed
| within. I.E. The user can refresh their token within a 2 week window of
| the original token being created until they must re-authenticate.
| Defaults to 2 weeks.
|
| You can also set this to null, to yield an infinite refresh time.
| Some may want this instead of never expiring tokens for e.g. a mobile app.
| This is not particularly recommended, so make sure you have appropriate
| systems in place to revoke the token if necessary.
|
*/
'refresh_ttl' => env('JWT_REFRESH_TTL', 20160),
/*
|--------------------------------------------------------------------------
| JWT hashing algorithm
|--------------------------------------------------------------------------
|
| Specify the hashing algorithm that will be used to sign the token.
|
*/
'algo' => env('JWT_ALGO', Tymon\JWTAuth\Providers\JWT\Provider::ALGO_HS256),
/*
|--------------------------------------------------------------------------
| Required Claims
|--------------------------------------------------------------------------
|
| Specify the required claims that must exist in any token.
| A TokenInvalidException will be thrown if any of these claims are not
| present in the payload.
|
*/
'required_claims' => [
'iss',
'iat',
'exp',
'nbf',
'sub',
'jti',
],
/*
|--------------------------------------------------------------------------
| Persistent Claims
|--------------------------------------------------------------------------
|
| Specify the claim keys to be persisted when refreshing a token.
| `sub` and `iat` will automatically be persisted, in
| addition to the these claims.
|
| Note: If a claim does not exist then it will be ignored.
|
*/
'persistent_claims' => [
// 'foo',
// 'bar',
],
/*
|--------------------------------------------------------------------------
| Lock Subject
|--------------------------------------------------------------------------
|
| This will determine whether a `prv` claim is automatically added to
| the token. The purpose of this is to ensure that if you have multiple
| authentication models e.g. `App\User` & `App\OtherPerson`, then we
| should prevent one authentication request from impersonating another,
| if 2 tokens happen to have the same id across the 2 different models.
|
| Under specific circumstances, you may want to disable this behaviour
| e.g. if you only have one authentication model, then you would save
| a little on token size.
|
*/
'lock_subject' => true,
/*
|--------------------------------------------------------------------------
| Leeway
|--------------------------------------------------------------------------
|
| This property gives the jwt timestamp claims some "leeway".
| Meaning that if you have any unavoidable slight clock skew on
| any of your servers then this will afford you some level of cushioning.
|
| This applies to the claims `iat`, `nbf` and `exp`.
|
| Specify in seconds - only if you know you need it.
|
*/
'leeway' => env('JWT_LEEWAY', 0),
/*
|--------------------------------------------------------------------------
| Blacklist Enabled
|--------------------------------------------------------------------------
|
| In order to invalidate tokens, you must have the blacklist enabled.
| If you do not want or need this functionality, then set this to false.
|
*/
'blacklist_enabled' => env('JWT_BLACKLIST_ENABLED', true),
/*
| -------------------------------------------------------------------------
| Blacklist Grace Period
| -------------------------------------------------------------------------
|
| When multiple concurrent requests are made with the same JWT,
| it is possible that some of them fail, due to token regeneration
| on every request.
|
| Set grace period in seconds to prevent parallel request failure.
|
*/
'blacklist_grace_period' => env('JWT_BLACKLIST_GRACE_PERIOD', 0),
/*
|--------------------------------------------------------------------------
| Cookies encryption
|--------------------------------------------------------------------------
|
| By default Laravel encrypt cookies for security reason.
| If you decide to not decrypt cookies, you will have to configure Laravel
| to not encrypt your cookie token by adding its name into the $except
| array available in the middleware "EncryptCookies" provided by Laravel.
| see https://laravel.com/docs/master/responses#cookies-and-encryption
| for details.
|
| Set it to true if you want to decrypt cookies.
|
*/
'decrypt_cookies' => false,
/*
|--------------------------------------------------------------------------
| Providers
|--------------------------------------------------------------------------
|
| Specify the various providers used throughout the package.
|
*/
'providers' => [
/*
|--------------------------------------------------------------------------
| JWT Provider
|--------------------------------------------------------------------------
|
| Specify the provider that is used to create and decode the tokens.
|
*/
'jwt' => Tymon\JWTAuth\Providers\JWT\Lcobucci::class,
/*
|--------------------------------------------------------------------------
| Authentication Provider
|--------------------------------------------------------------------------
|
| Specify the provider that is used to authenticate users.
|
*/
'auth' => Tymon\JWTAuth\Providers\Auth\Illuminate::class,
/*
|--------------------------------------------------------------------------
| Storage Provider
|--------------------------------------------------------------------------
|
| Specify the provider that is used to store tokens in the blacklist.
|
*/
'storage' => Tymon\JWTAuth\Providers\Storage\Illuminate::class,
],
];

View File

@ -0,0 +1,16 @@
<?php
return [
'table_prefix' => 'indonesia_',
'route' => [
'enabled' => false,
'middleware' => ['web', 'auth'],
'prefix' => 'indonesia',
],
'view' => [
'layout' => 'ui::layouts.app',
],
'menu' => [
'enabled' => false,
],
];

50
config/tinker.php Normal file
View File

@ -0,0 +1,50 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Console Commands
|--------------------------------------------------------------------------
|
| This option allows you to add additional Artisan commands that should
| be available within the Tinker environment. Once the command is in
| this array you may execute the command in Tinker using its name.
|
*/
'commands' => [
// App\Console\Commands\ExampleCommand::class,
],
/*
|--------------------------------------------------------------------------
| Auto Aliased Classes
|--------------------------------------------------------------------------
|
| Tinker will not automatically alias classes in your vendor namespaces
| but you may explicitly allow a subset of classes to get aliased by
| adding the names of each of those classes to the following list.
|
*/
'alias' => [
//
],
/*
|--------------------------------------------------------------------------
| Classes That Should Not Be Aliased
|--------------------------------------------------------------------------
|
| Typically, Tinker automatically aliases classes as you require them in
| Tinker. However, you may wish to never alias certain classes, which
| you may accomplish by listing the classes in the following array.
|
*/
'dont_alias' => [
'App\Nova',
],
];

View File

@ -1,23 +0,0 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Refund>
*/
class RefundFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}

View File

@ -1,23 +0,0 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\transaction>
*/
class TransactionFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}

View File

@ -18,11 +18,22 @@ class UserFactory extends Factory
public function definition(): array public function definition(): array
{ {
return [ return [
'name' => fake()->name(), 'id' => Str::uuid(),
'nama_depan' => $this->faker->firstName,
'nama_belakang' => $this->faker->lastName,
'tanggal_lahir' => $this->faker->date($format = 'Y-m-d', $max = 'now'),
'email' => fake()->unique()->safeEmail(), 'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(), 'email_verified_at' => now(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'remember_token' => Str::random(10), 'remember_token' => Str::random(10),
'role' => 'User',
'nik' => $this->faker->nik($this->faker->randomElement(['male', 'female']),$this->faker->dateTimeBetween('-65 years', '-18 years')),
'alamat'=> $this->faker->address,
'nohp'=> $this->faker->phoneNumber(),
'persentase_kemiripan' => random_int(0, 100).'%',
'status'=> $this->faker->randomElement(['Progress', 'Finished', 'Rejected']),
'gender' => $this->faker->randomElement(['Laki-laki', 'Perempuan']),
'kode_kelurahan' => '1101012002',
]; ];
} }

View File

@ -12,13 +12,28 @@ return new class extends Migration
public function up(): void public function up(): void
{ {
Schema::create('users', function (Blueprint $table) { Schema::create('users', function (Blueprint $table) {
$table->id(); $table->uuid('id')->primary;
$table->string('name'); $table->string('nama_depan',255);
$table->string('email')->unique(); $table->string('nama_belakang',255);
$table->date('tanggal_lahir');
$table->string('email',50)->unique();
$table->timestamp('email_verified_at')->nullable(); $table->timestamp('email_verified_at')->nullable();
$table->string('password'); $table->string('password');
$table->enum('role',['Admin','User'])->default('User');
$table->string('nohp',20);
$table->string('nik',20);
$table->string('alamat',255);
$table->string('foto_ktp')->nullable();
$table->string('foto_wajah')->nullable();
$table->string('foto_profil')->nullable();
$table->string('persentase_kemiripan')->nullable();
$table->enum('status',['Finished','Progress','Rejected'])->default('Progress');
$table->string('gender',15);
$table->char('kode_kelurahan',10);
$table->rememberToken(); $table->rememberToken();
$table->timestamps(); $table->timestamps();
// $table->foreign('kode_kelurahan')->on('villages')->references('code');
}); });
} }

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProvincesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create(config('laravolt.indonesia.table_prefix').'provinces', function (Blueprint $table) {
$table->bigIncrements('id');
$table->char('code', 2)->unique();
$table->string('name', 255);
$table->text('meta')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop(config('laravolt.indonesia.table_prefix').'provinces');
}
}

View File

@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCitiesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create(config('laravolt.indonesia.table_prefix').'cities', function (Blueprint $table) {
$table->bigIncrements('id');
$table->char('code', 4)->unique();
$table->char('province_code', 2);
$table->string('name', 255);
$table->text('meta')->nullable();
$table->timestamps();
$table->foreign('province_code')
->references('code')
->on(config('laravolt.indonesia.table_prefix').'provinces')
->onUpdate('cascade')->onDelete('restrict');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop(config('laravolt.indonesia.table_prefix').'cities');
}
}

View File

@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateDistrictsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create(config('laravolt.indonesia.table_prefix').'districts', function (Blueprint $table) {
$table->bigIncrements('id');
$table->char('code', 7)->unique();
$table->char('city_code', 4);
$table->string('name', 255);
$table->text('meta')->nullable();
$table->timestamps();
$table->foreign('city_code')
->references('code')
->on(config('laravolt.indonesia.table_prefix').'cities')
->onUpdate('cascade')->onDelete('restrict');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop(config('laravolt.indonesia.table_prefix').'districts');
}
}

View File

@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateVillagesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create(config('laravolt.indonesia.table_prefix').'villages', function (Blueprint $table) {
$table->bigIncrements('id');
$table->char('code', 10)->unique();
$table->char('district_code', 7);
$table->string('name', 255);
$table->text('meta')->nullable();
$table->timestamps();
$table->foreign('district_code')
->references('code')
->on(config('laravolt.indonesia.table_prefix').'districts')
->onUpdate('cascade')->onDelete('restrict');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop(config('laravolt.indonesia.table_prefix').'villages');
}
}

View File

@ -0,0 +1,55 @@
<?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('transactions', function (Blueprint $table) {
$table->uuid('id')->primary(); //order_id
$table->string('pembeli'); // untuk customer_details
$table->string('penjual'); //merchant_name
$table->string('nama_barang'); // item_details -> item_name
$table->string('deskripsi_transaksi')->nullable();
$table->string('satuan_barang');
$table->double('harga_barang'); // harga sebelum penambahan
$table->double('jumlah_barang');
$table->double('persentase_keuntungan'); // persentase keuntungan
$table->double('total_keuntungan'); // perolehan keuntungan
$table->double('total_harga'); // gross amount
$table->double('total_bayar');
$table->string('signature_key')->nullable();
$table->string('token');
$table->string('metode_pembayaran')->nullable();
$table->string('acquire')->nullable();
$table->string('issuer')->nullable();
$table->char('currency',3)->nullable();
$table->string('fraud_status')->nullable();
$table->string('merchant_id')->nullable();
$table->string('status_code')->nullable();
$table->string('tipe_transaction')->nullable();
$table->enum('status',['settlement','capture','pending','cancel','refund','expire','failure','progress','failed','sending','sended','finished'])->default('pending'); // transaction_status
$table->timestamp('batas_pembayaran');
$table->timestamp('batas_pengiriman_barang_awal');
$table->timestamp('batas_pengiriman_barang_akhir');
$table->timestamp('tanggal_pembayaran')->nullable();
$table->timestamps();
$table->foreign('pembeli')->on('users')->references('email');
$table->foreign('penjual')->on('users')->references('email');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('transactions');
}
};

View File

@ -13,7 +13,12 @@ return new class extends Migration
{ {
Schema::create('refunds', function (Blueprint $table) { Schema::create('refunds', function (Blueprint $table) {
$table->id(); $table->id();
$table->foreignUuid('order_id');
$table->double('total',10);
$table->timestamp('due_date');
$table->enum('status',['partial refund','deny','pending'])->default('Pending');
$table->timestamps(); $table->timestamps();
$table->foreign('order_id')->on('transactions')->references('id');
}); });
} }

View File

@ -11,8 +11,12 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::create('transactions', function (Blueprint $table) { Schema::create('settings', function (Blueprint $table) {
$table->id(); $table->id();
$table->string('bulan',20);
$table->string('tahun',5);
$table->integer('persentase');
$table->enum('status',['Active', 'Nonactive']);
$table->timestamps(); $table->timestamps();
}); });
} }
@ -22,6 +26,6 @@ return new class extends Migration
*/ */
public function down(): void public function down(): void
{ {
Schema::dropIfExists('transactions'); Schema::dropIfExists('settings');
} }
}; };

View File

@ -0,0 +1,32 @@
<?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('contacts', function (Blueprint $table) {
$table->id();
$table->string('pemilik_kontak');
$table->string('relasi_kontak');
$table->foreign('pemilik_kontak')->on('users')->references('email');
$table->foreign('relasi_kontak')->on('users')->references('email');
$table->unique(['pemilik_kontak','relasi_kontak']);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('contacts');
}
};

View File

@ -0,0 +1,36 @@
<?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('transaction_descriptions', function (Blueprint $table) {
$table->id();
$table->foreignUuid('order_id');
$table->string('status',15);
$table->string('user');
$table->string('background');
$table->string('judul');
$table->string('deskripsi');
$table->timestamps();
$table->foreign('order_id')->on('transactions')->references('id');
$table->foreign('user')->on('users')->references('email');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('transaction_descriptions');
}
};

View File

@ -0,0 +1,32 @@
<?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('refund_descriptions', function (Blueprint $table) {
$table->id();
$table->foreignId('refund_id');
$table->string('filename');
$table->string('type');
$table->timestamps();
$table->foreign('refund_id')->on('refunds')->references('id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('refund_descriptions');
}
};

View File

@ -4,6 +4,16 @@ namespace Database\Seeders;
// use Illuminate\Database\Console\Seeds\WithoutModelEvents; // use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
use App\Models\User;
use Carbon\Carbon;
use App\Models\Setting;
use Illuminate\Support\Str;
use Faker\Factory as FakerFactory;
use Faker\Provider\id_ID\Person as Person;
use Laravolt\Indonesia\Seeds\CitiesSeeder;
use Laravolt\Indonesia\Seeds\VillagesSeeder;
use Laravolt\Indonesia\Seeds\DistrictsSeeder;
use Laravolt\Indonesia\Seeds\ProvincesSeeder;
class DatabaseSeeder extends Seeder class DatabaseSeeder extends Seeder
{ {
@ -12,11 +22,39 @@ class DatabaseSeeder extends Seeder
*/ */
public function run(): void public function run(): void
{ {
// \App\Models\User::factory(10)->create(); $faker = FakerFactory::create();
$faker->addProvider(new Person($faker));
// \App\Models\User::factory()->create([ User::factory()->create([
// 'name' => 'Test User', 'id' => Str::uuid(),
// 'email' => 'test@example.com', 'nama_depan' => $faker->firstName,
// ]); 'nama_belakang' => $faker->lastName,
'tanggal_lahir' => $faker->date($format = 'Y-m-d', $max = 'now'),
'email' => 'admin@example.net',
'email_verified_at' => now(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'remember_token' => Str::random(10),
'role' => 'Admin',
'nik' => $faker->nik($faker->randomElement(['male', 'female']), $faker->dateTimeBetween('-65 years', '-18 years')),
'alamat' => $faker->address,
'nohp' => $faker->phoneNumber(),
'status' => 'Finished',
'persentase_kemiripan' => '100%',
'gender' => $faker->randomElement(['Laki-laki', 'Perempuan']),
'kode_kelurahan' => '1101012002',
]);
User::factory(20)->create();
$now = Carbon::now()->tz('Asia/Jakarta');
$bulan = $now->format('F');
$tahun = $now->year;
Setting::create([
'bulan' => $bulan,
'tahun' => $tahun,
'persentase' => 5,
'status' => 'Active'
]);
$this->call([ProvincesSeeder::class, CitiesSeeder::class, DistrictsSeeder::class, VillagesSeeder::class]);
} }
} }

View File

@ -1,17 +0,0 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class RefundSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}

View File

@ -1,17 +0,0 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class TransactionSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}

59
docker/8.0/Dockerfile Normal file
View File

@ -0,0 +1,59 @@
FROM ubuntu:20.04
LABEL maintainer="Taylor Otwell"
ARG WWWGROUP
ARG NODE_VERSION=16
ARG POSTGRES_VERSION=13
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND noninteractive
ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update \
&& apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 dnsutils librsvg2-bin fswatch \
&& curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c' | gpg --dearmor | tee /usr/share/keyrings/ppa_ondrej_php.gpg > /dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu focal main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
&& apt-get update \
&& apt-get install -y php8.0-cli php8.0-dev \
php8.0-pgsql php8.0-sqlite3 php8.0-gd php8.0-imagick \
php8.0-curl php8.0-memcached \
php8.0-imap php8.0-mysql php8.0-mbstring \
php8.0-xml php8.0-zip php8.0-bcmath php8.0-soap \
php8.0-intl php8.0-readline php8.0-pcov \
php8.0-msgpack php8.0-igbinary php8.0-ldap \
php8.0-redis php8.0-swoole php8.0-xdebug \
&& curl -sLS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer \
&& curl -sLS https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g npm \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarnkey.gpg >/dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \
&& curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /usr/share/keyrings/pgdg.gpg >/dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt focal-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& apt-get update \
&& apt-get install -y yarn \
&& apt-get install -y mysql-client \
&& apt-get install -y postgresql-client-$POSTGRES_VERSION \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN update-alternatives --set php /usr/bin/php8.0
RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.0
RUN groupadd --force -g $WWWGROUP sail
RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail
COPY start-container /usr/local/bin/start-container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /etc/php/8.0/cli/conf.d/99-sail.ini
RUN chmod +x /usr/local/bin/start-container
EXPOSE 8000
ENTRYPOINT ["start-container"]

7
docker/8.0/php.ini Normal file
View File

@ -0,0 +1,7 @@
[PHP]
post_max_size = 100M
upload_max_filesize = 100M
variables_order = EGPCS
[opcache]
opcache.enable_cli=1

View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
if [ ! -z "$WWWUSER" ]; then
usermod -u $WWWUSER sail
fi
if [ ! -d /.composer ]; then
mkdir /.composer
fi
chmod -R ugo+rw /.composer
if [ $# -gt 0 ]; then
exec gosu $WWWUSER "$@"
else
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
fi

View File

@ -0,0 +1,14 @@
[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
[program:php]
command=/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80
user=sail
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

58
docker/8.1/Dockerfile Normal file
View File

@ -0,0 +1,58 @@
FROM ubuntu:22.04
LABEL maintainer="Taylor Otwell"
ARG WWWGROUP
ARG NODE_VERSION=18
ARG POSTGRES_VERSION=15
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND noninteractive
ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update \
&& apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 dnsutils librsvg2-bin fswatch \
&& curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c' | gpg --dearmor | tee /usr/share/keyrings/ppa_ondrej_php.gpg > /dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
&& apt-get update \
&& apt-get install -y php8.1-cli php8.1-dev \
php8.1-pgsql php8.1-sqlite3 php8.1-gd php8.1-imagick \
php8.1-curl \
php8.1-imap php8.1-mysql php8.1-mbstring \
php8.1-xml php8.1-zip php8.1-bcmath php8.1-soap \
php8.1-intl php8.1-readline \
php8.1-ldap \
php8.1-msgpack php8.1-igbinary php8.1-redis php8.1-swoole \
php8.1-memcached php8.1-pcov php8.1-xdebug \
&& curl -sLS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer \
&& curl -sLS https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g npm \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarn.gpg >/dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/yarn.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \
&& curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /usr/share/keyrings/pgdg.gpg >/dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt jammy-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& apt-get update \
&& apt-get install -y yarn \
&& apt-get install -y mysql-client \
&& apt-get install -y postgresql-client-$POSTGRES_VERSION \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.1
RUN groupadd --force -g $WWWGROUP sail
RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail
COPY start-container /usr/local/bin/start-container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /etc/php/8.1/cli/conf.d/99-sail.ini
RUN chmod +x /usr/local/bin/start-container
EXPOSE 8000
ENTRYPOINT ["start-container"]

7
docker/8.1/php.ini Normal file
View File

@ -0,0 +1,7 @@
[PHP]
post_max_size = 100M
upload_max_filesize = 100M
variables_order = EGPCS
[opcache]
opcache.enable_cli=1

View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
if [ ! -z "$WWWUSER" ]; then
usermod -u $WWWUSER sail
fi
if [ ! -d /.composer ]; then
mkdir /.composer
fi
chmod -R ugo+rw /.composer
if [ $# -gt 0 ]; then
exec gosu $WWWUSER "$@"
else
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
fi

View File

@ -0,0 +1,14 @@
[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
[program:php]
command=/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80
user=sail
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

59
docker/8.2/Dockerfile Normal file
View File

@ -0,0 +1,59 @@
FROM ubuntu:22.04
LABEL maintainer="Taylor Otwell"
ARG WWWGROUP
ARG NODE_VERSION=18
ARG POSTGRES_VERSION=15
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND noninteractive
ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update \
&& apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 dnsutils librsvg2-bin fswatch \
&& curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c' | gpg --dearmor | tee /etc/apt/keyrings/ppa_ondrej_php.gpg > /dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
&& apt-get update \
&& apt-get install -y php8.2-cli php8.2-dev \
php8.2-pgsql php8.2-sqlite3 php8.2-gd php8.2-imagick \
php8.2-curl \
php8.2-imap php8.2-mysql php8.2-mbstring \
php8.2-xml php8.2-zip php8.2-bcmath php8.2-soap \
php8.2-intl php8.2-readline \
php8.2-ldap \
php8.2-msgpack php8.2-igbinary php8.2-redis php8.2-swoole \
php8.2-memcached php8.2-pcov php8.2-xdebug \
&& curl -sLS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer \
&& curl -sLS https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g npm \
&& npm install -g pnpm \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /etc/apt/keyrings/yarn.gpg >/dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/yarn.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \
&& curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /etc/apt/keyrings/pgdg.gpg >/dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt jammy-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& apt-get update \
&& apt-get install -y yarn \
&& apt-get install -y mysql-client \
&& apt-get install -y postgresql-client-$POSTGRES_VERSION \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.2
RUN groupadd --force -g $WWWGROUP sail
RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail
COPY start-container /usr/local/bin/start-container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /etc/php/8.2/cli/conf.d/99-sail.ini
RUN chmod +x /usr/local/bin/start-container
EXPOSE 8000
ENTRYPOINT ["start-container"]

7
docker/8.2/php.ini Normal file
View File

@ -0,0 +1,7 @@
[PHP]
post_max_size = 100M
upload_max_filesize = 100M
variables_order = EGPCS
[opcache]
opcache.enable_cli=1

View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
if [ ! -z "$WWWUSER" ]; then
usermod -u $WWWUSER sail
fi
if [ ! -d /.composer ]; then
mkdir /.composer
fi
chmod -R ugo+rw /.composer
if [ $# -gt 0 ]; then
exec gosu $WWWUSER "$@"
else
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
fi

View File

@ -0,0 +1,14 @@
[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
[program:php]
command=/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80
user=sail
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
mysql --user=root --password="$MYSQL_ROOT_PASSWORD" <<-EOSQL
CREATE DATABASE IF NOT EXISTS testing;
GRANT ALL PRIVILEGES ON \`testing%\`.* TO '$MYSQL_USER'@'%';
EOSQL

View File

@ -0,0 +1,2 @@
SELECT 'CREATE DATABASE testing'
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'testing')\gexec

1075
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,10 @@
}, },
"devDependencies": { "devDependencies": {
"axios": "^1.1.2", "axios": "^1.1.2",
"laravel-vite-plugin": "^0.7.5", "laravel-vite-plugin": "^0.8.0",
"vite": "^4.0.0" "vite": "^4.0.0"
},
"dependencies": {
"datatables.net-dt": "^1.13.6"
} }
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -59,8 +59,8 @@ video {
} }
.flex-input-btn { .flex-input-btn {
width: 100%; width: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
margin-top: 3%; margin-top: 3%;
} }
@ -275,6 +275,14 @@ form p {
transform: translateY(-0.252m); transform: translateY(-0.252m);
} }
.btn-otp:disabled {
cursor: not-allowed; /* Mengganti cursor menjadi "not-allowed" saat tombol dinonaktifkan */
opacity: 0.6; /* Mengurangi opasitas tombol saat dinonaktifkan */
border-color: #ccc; /* Mengganti warna border saat dinonaktifkan */
color: #ccc; /* Mengganti warna teks saat dinonaktifkan */
pointer-events: none; /* Mencegah interaksi dengan tombol saat dinonaktifkan */
}
.panels-container { .panels-container {
position: absolute; position: absolute;
height: 100%; height: 100%;
@ -418,7 +426,6 @@ form p {
.header ul li div { .header ul li div {
padding: 0 1.2rem; padding: 0 1.2rem;
} }
.signin-signup { .signin-signup {
width: 100%; width: 100%;
@ -792,7 +799,7 @@ form p {
} }
/****************************************** /******************************************
/* END DROPDOWN INPUT /* END DROPDOWN INPUT
==================================================*/ ==================================================*/
.select2-container .select2-selection--single { .select2-container .select2-selection--single {
border: none; border: none;
@ -908,11 +915,11 @@ form p {
color: #333; color: #333;
} }
/****************************************** /******************************************
/* END DROPDOWN INPUT /* END DROPDOWN INPUT
==================================================*/ ==================================================*/
/****************************************** /******************************************
/* SLIDER /* SLIDER
==================================================*/ ==================================================*/
.slider-container { .slider-container {
position: relative; position: relative;
@ -973,12 +980,11 @@ form p {
background-color: #900c3e; background-color: #900c3e;
} }
#webcamKtp, #webcamKtp,
#webcamEkyc { #webcamEkyc {
height: 30vh; height: 30vh;
border-radius: 1rem; border-radius: 1rem;
} }
/****************************************** /******************************************
/* END SLIDER /* END SLIDER
==================================================*/ ==================================================*/

View File

@ -0,0 +1,54 @@
/*--------------------------------------------------------------
# Profie Page
--------------------------------------------------------------*/
.profile .profile-card img {
max-width: 120px;
}
.profile .profile-card h2 {
font-size: 24px;
font-weight: 700;
color: #2c384e;
margin: 10px 0 0 0;
}
.profile .profile-card h3 {
font-size: 18px;
}
.profile .profile-card .social-links a {
font-size: 20px;
display: inline-block;
color: rgba(1, 41, 112, 0.5);
line-height: 0;
margin-right: 10px;
transition: 0.3s;
}
.profile .profile-card .social-links a:hover {
color: #012970;
}
.profile .profile-overview .row {
margin-bottom: 20px;
font-size: 15px;
}
.profile .profile-overview .card-title {
color: #012970;
}
.profile .profile-overview .label {
font-weight: 600;
color: rgba(1, 41, 112, 0.6);
}
.profile .profile-edit label {
font-weight: 600;
color: rgba(1, 41, 112, 0.6);
}
.profile .profile-edit img {
max-width: 120px;
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -0,0 +1,26 @@
<svg width="1181" height="244" viewBox="0 0 1181 244" fill="none" xmlns="http://www.w3.org/2000/svg">
<mask id="mask0_227_12316" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="2" y="2" width="1179" height="242">
<path d="M2.8894 2.35156H1181V243.142H2.8894V2.35156Z" fill="white"/>
</mask>
<g mask="url(#mask0_227_12316)">
<path d="M1047.44 17.0875C1000.64 13.9376 966.174 38.9274 930.591 63.2079C886.889 93.0366 837.228 111.561 782.195 95.7215C733.176 81.6131 695.878 46.0322 650.202 24.7491C604.332 3.37598 549.896 -2.843 499.505 7.53667C471.21 13.3679 444.55 24.1316 417.42 33.3847C286.246 78.1415 140.375 101.152 3.34485 73.9184V242.829H1180.92V49.9374C1119.63 42.2464 1093.74 20.2007 1047.44 17.0875Z" fill="#BA2760"/>
</g>
<mask id="mask1_227_12316" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="0" width="1181" height="244">
<path d="M0 0H1181V243.143H0V0Z" fill="white"/>
</mask>
<g mask="url(#mask1_227_12316)">
<path d="M1180.92 126.055C1120.33 126.752 1051.84 122.492 993.029 113.329C965.292 109.008 937.504 103.523 911.953 92.9371C878.967 79.2697 850.169 57.3029 815.202 48.4247C785.959 40.9983 753.686 43.5951 726.394 55.5754C700.444 66.9659 679.614 86.0914 654.123 98.2813C615.362 116.81 569.504 117.787 525.578 118.34C465.212 119.098 401.172 119.004 349.667 90.7961C299.114 63.1139 263.649 9.92367 205.131 1.54533C167.852 -3.79152 131.066 11.0502 96.9417 25.5134C65.7421 38.7379 34.5466 51.9624 3.34695 65.1869V242.828H-0.0294189H1180.92V126.055Z" fill="#A10949"/>
</g>
<mask id="mask2_227_12316" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="2" y="66" width="1179" height="178">
<path d="M2.8894 66.8062H1181V243.143H2.8894V66.8062Z" fill="white"/>
</mask>
<g mask="url(#mask2_227_12316)">
<path d="M1176.51 108.389C1149.17 95.7745 1120.38 82.7264 1089.45 79.2549C1056.69 75.5757 1028.02 88.7561 999.993 102.401C940.96 131.14 823.249 186.828 758.371 145.317C742.628 135.248 732.954 119.329 719.086 107.246C618.726 19.8181 495.283 96.471 394.189 134.843C354.655 149.849 310.079 160.625 266.999 154.675C188.409 143.825 117.684 85.5309 3.34485 88.2765V242.828H1180.92V110.624C1179.46 109.804 1177.96 109.056 1176.51 108.389Z" fill="#900C3F"/>
</g>
<mask id="mask3_227_12316" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="2" y="139" width="1179" height="105">
<path d="M2.8894 139.258H1181V243.143H2.8894V139.258Z" fill="white"/>
</mask>
<g mask="url(#mask3_227_12316)">
<path d="M1180.82 213.266C1119.27 219.913 1062.06 182.737 1000.24 178.531C959.072 175.73 918.199 187.734 876.928 186.709C793.596 184.634 716.622 130.023 634.201 141.231C595.196 146.539 560.446 166.221 522.163 174.765C427.877 195.805 331.776 147.074 234.606 146.778C161.556 146.555 74.6445 171.731 3.34485 156.233V242.828H1180.92L1180.82 213.266Z" fill="#900C3F"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

@ -16,20 +16,16 @@ sign_in_btn.addEventListener("click", () => {
* END ANIMATION BTN SIGN IN & SIGN UP * END ANIMATION BTN SIGN IN & SIGN UP
******************************************/ ******************************************/
/****************************************** /******************************************
* PRELOADER * PRELOADER
******************************************/ ******************************************/
setTimeout(function () { setTimeout(function () {
$('#preloader').fadeToggle(); $("#preloader").fadeToggle();
}, 200); }, 200);
/****************************************** /******************************************
* END PRELOADER * END PRELOADER
******************************************/ ******************************************/
/****************************************** /******************************************
* MULTIPLE FORM * MULTIPLE FORM
******************************************/ ******************************************/
@ -38,13 +34,11 @@ var form_2 = document.querySelector(".form_2");
var form_3 = document.querySelector(".form_3"); var form_3 = document.querySelector(".form_3");
var form_4 = document.querySelector(".form_4"); var form_4 = document.querySelector(".form_4");
var form_1_btns = document.querySelector(".form_1_btns"); var form_1_btns = document.querySelector(".form_1_btns");
var form_2_btns = document.querySelector(".form_2_btns"); var form_2_btns = document.querySelector(".form_2_btns");
var form_3_btns = document.querySelector(".form_3_btns"); var form_3_btns = document.querySelector(".form_3_btns");
var form_4_btns = document.querySelector(".form_4_btns"); var form_4_btns = document.querySelector(".form_4_btns");
var form_1_next_btn = document.querySelector(".form_1_btns .btn_next"); var form_1_next_btn = document.querySelector(".form_1_btns .btn_next");
var form_2_back_btn = document.querySelector(".form_2_btns .btn_back"); var form_2_back_btn = document.querySelector(".form_2_btns .btn_back");
var form_2_next_btn = document.querySelector(".form_2_btns .btn_next"); var form_2_next_btn = document.querySelector(".form_2_btns .btn_next");
@ -120,18 +114,10 @@ form_4_back_btn.addEventListener("click", function () {
form_4_progessbar.classList.remove("active"); form_4_progessbar.classList.remove("active");
}); });
btn_done.addEventListener("click", function () {
modal_wrapper.classList.add("active");
})
shadow.addEventListener("click", function () {
modal_wrapper.classList.remove("active");
})
/****************************************** /******************************************
* MULTIPLE FORM END * MULTIPLE FORM END
******************************************/ ******************************************/
/****************************************** /******************************************
* KTP & E-KYC CAMERA * KTP & E-KYC CAMERA
******************************************/ ******************************************/
@ -141,16 +127,30 @@ document.addEventListener("DOMContentLoaded", function () {
const fotoInputKtp = document.getElementById("fotoKtp"); const fotoInputKtp = document.getElementById("fotoKtp");
const startButtonKtp = document.getElementById("startButtonKtp"); const startButtonKtp = document.getElementById("startButtonKtp");
const refreshButtonKtp = document.getElementById("refreshButtonKtp"); const refreshButtonKtp = document.getElementById("refreshButtonKtp");
const imageHolderKtp = document.getElementById("imageHolderKtp");
const videoElementEkyc = document.getElementById("webcamEkyc"); const videoElementEkyc = document.getElementById("webcamEkyc");
const captureButtonEkyc = document.getElementById("captureButtonEkyc"); const captureButtonEkyc = document.getElementById("captureButtonEkyc");
const fotoInputEkyc = document.getElementById("fotoEkyc"); const fotoInputEkyc = document.getElementById("fotoEkyc");
const startButtonEkyc = document.getElementById("startButtonEkyc"); const startButtonEkyc = document.getElementById("startButtonEkyc");
const refreshButtonEkyc = document.getElementById("refreshButtonEkyc"); const refreshButtonEkyc = document.getElementById("refreshButtonEkyc");
const imageHolderEkyc = document.getElementById("imageHolderEkyc");
// Inisialisasi status kamera
let ktpStream = null; let ktpStream = null;
let ekycStream = null; let ekycStream = null;
// Tampilan tombol capture dan refresh
captureButtonKtp.style.display = "none";
refreshButtonKtp.style.display = "none";
videoElementKtp.style.display = "none";
imageHolderKtp.style.display = "block";
captureButtonEkyc.style.display = "none";
refreshButtonEkyc.style.display = "none";
videoElementEkyc.style.display = "none";
imageHolderEkyc.style.display = "block";
// Fungsi untuk menyalakan kamera // Fungsi untuk menyalakan kamera
function turnOnCamera(stream, videoElement, startButton) { function turnOnCamera(stream, videoElement, startButton) {
videoElement.srcObject = stream; videoElement.srcObject = stream;
@ -179,8 +179,13 @@ document.addEventListener("DOMContentLoaded", function () {
// Matikan kamera jika sudah aktif // Matikan kamera jika sudah aktif
turnOffCamera(ktpStream, videoElementKtp, startButtonKtp); turnOffCamera(ktpStream, videoElementKtp, startButtonKtp);
// Hapus hasil foto // Hapus hasil foto
clearPhoto(fotoInputKtp, document.getElementById("foto-preview-ktp")); clearPhoto(
fotoInputKtp,
document.getElementById("foto-preview-ktp")
);
ktpStream = null; ktpStream = null;
imageHolderKtp.style.display = "block";
captureButtonKtp.style.display = "none";
} else { } else {
// Aktifkan kamera jika belum aktif // Aktifkan kamera jika belum aktif
navigator.mediaDevices navigator.mediaDevices
@ -188,9 +193,15 @@ document.addEventListener("DOMContentLoaded", function () {
.then(function (stream) { .then(function (stream) {
ktpStream = stream; ktpStream = stream;
turnOnCamera(ktpStream, videoElementKtp, startButtonKtp); turnOnCamera(ktpStream, videoElementKtp, startButtonKtp);
imageHolderKtp.style.display = "none";
captureButtonKtp.style.display = "block";
}) })
.catch(function (error) { .catch(function (error) {
console.error("Gagal mengakses kamera: ", error); Swal.fire({
title: "Gagal",
text: "Gagal mengakses kamera, karena " + error,
icon: "error",
});
}); });
} }
}); });
@ -200,8 +211,13 @@ document.addEventListener("DOMContentLoaded", function () {
// Matikan kamera jika sudah aktif // Matikan kamera jika sudah aktif
turnOffCamera(ekycStream, videoElementEkyc, startButtonEkyc); turnOffCamera(ekycStream, videoElementEkyc, startButtonEkyc);
// Hapus hasil foto // Hapus hasil foto
clearPhoto(fotoInputEkyc, document.getElementById("foto-preview-ekyc")); clearPhoto(
fotoInputEkyc,
document.getElementById("foto-preview-ekyc")
);
ekycStream = null; ekycStream = null;
imageHolderEkyc.style.display = "block";
captureButtonEkyc.style.display = "none";
} else { } else {
// Aktifkan kamera jika belum aktif // Aktifkan kamera jika belum aktif
navigator.mediaDevices navigator.mediaDevices
@ -209,9 +225,15 @@ document.addEventListener("DOMContentLoaded", function () {
.then(function (stream) { .then(function (stream) {
ekycStream = stream; ekycStream = stream;
turnOnCamera(ekycStream, videoElementEkyc, startButtonEkyc); turnOnCamera(ekycStream, videoElementEkyc, startButtonEkyc);
imageHolderEkyc.style.display = "none";
captureButtonEkyc.style.display = "block";
}) })
.catch(function (error) { .catch(function (error) {
console.error("Gagal mengakses kamera: ", error); Swal.fire({
title: "Gagal",
text: "Gagal mengakses kamera, karena " + error,
icon: "error",
});
}); });
} }
}); });
@ -219,13 +241,13 @@ document.addEventListener("DOMContentLoaded", function () {
refreshButtonKtp.addEventListener("click", function () { refreshButtonKtp.addEventListener("click", function () {
// Hapus hasil foto jika tombol "Ulang Foto" ditekan // Hapus hasil foto jika tombol "Ulang Foto" ditekan
clearPhoto(fotoInputKtp, document.getElementById("foto-preview-ktp")); clearPhoto(fotoInputKtp, document.getElementById("foto-preview-ktp"));
if (ktpStream) { if (ktpStream) {
// Matikan kamera jika sedang aktif // Matikan kamera jika sedang aktif
turnOffCamera(ktpStream, videoElementKtp, startButtonKtp); turnOffCamera(ktpStream, videoElementKtp, startButtonKtp);
ktpStream = null; ktpStream = null;
} }
// Menyalakan kembali kamera // Menyalakan kembali kamera
navigator.mediaDevices navigator.mediaDevices
.getUserMedia({ video: true }) .getUserMedia({ video: true })
@ -234,20 +256,27 @@ document.addEventListener("DOMContentLoaded", function () {
turnOnCamera(ktpStream, videoElementKtp, startButtonKtp); turnOnCamera(ktpStream, videoElementKtp, startButtonKtp);
}) })
.catch(function (error) { .catch(function (error) {
console.error("Gagal mengakses kamera: ", error); Swal.fire({
title: "Gagal",
text: "Gagal mengakses kamera, karena " + error,
icon: "error",
});
}); });
refreshButtonKtp.style.display = "none";
captureButtonKtp.style.display = "block";
startButtonKtp.style.display = "block";
}); });
refreshButtonEkyc.addEventListener("click", function () { refreshButtonEkyc.addEventListener("click", function () {
// Hapus hasil foto jika tombol "Ulang Foto" ditekan // Hapus hasil foto jika tombol "Ulang Foto" ditekan
clearPhoto(fotoInputEkyc, document.getElementById("foto-preview-ekyc")); clearPhoto(fotoInputEkyc, document.getElementById("foto-preview-ekyc"));
if (ekycStream) { if (ekycStream) {
// Matikan kamera jika sedang aktif // Matikan kamera jika sedang aktif
turnOffCamera(ekycStream, videoElementEkyc, startButtonEkyc); turnOffCamera(ekycStream, videoElementEkyc, startButtonEkyc);
ekycStream = null; ekycStream = null;
} }
// Menyalakan kembali kamera // Menyalakan kembali kamera
navigator.mediaDevices navigator.mediaDevices
.getUserMedia({ video: true }) .getUserMedia({ video: true })
@ -256,8 +285,15 @@ document.addEventListener("DOMContentLoaded", function () {
turnOnCamera(ekycStream, videoElementEkyc, startButtonEkyc); turnOnCamera(ekycStream, videoElementEkyc, startButtonEkyc);
}) })
.catch(function (error) { .catch(function (error) {
console.error("Gagal mengakses kamera: ", error); Swal.fire({
title: "Gagal",
text: "Gagal mengakses kamera, karena " + error,
icon: "error",
});
}); });
refreshButtonEkyc.style.display = "none";
captureButtonEkyc.style.display = "block";
startButtonEkyc.style.display = "block";
}); });
captureButtonKtp.addEventListener("click", function () { captureButtonKtp.addEventListener("click", function () {
@ -266,16 +302,27 @@ document.addEventListener("DOMContentLoaded", function () {
const context = canvas.getContext("2d"); const context = canvas.getContext("2d");
canvas.width = videoElementKtp.videoWidth; canvas.width = videoElementKtp.videoWidth;
canvas.height = videoElementKtp.videoHeight; canvas.height = videoElementKtp.videoHeight;
context.drawImage(videoElementKtp, 0, 0, canvas.width, canvas.height); context.drawImage(
videoElementKtp,
0,
0,
canvas.width,
canvas.height
);
const fotoDataUrl = canvas.toDataURL("image/jpeg"); const fotoDataUrl = canvas.toDataURL("image/jpeg");
fotoInputKtp.value = fotoDataUrl; fotoInputKtp.value = fotoDataUrl;
const fotoPreview = document.getElementById("foto-preview-ktp"); const fotoPreview = document.getElementById("foto-preview-ktp");
fotoPreview.innerHTML = '<img src="' + fotoDataUrl + '" alt="Foto">'; fotoPreview.innerHTML =
'<img src="' + fotoDataUrl + '" alt="Foto">';
// Matikan kamera setelah mengambil foto // Matikan kamera setelah mengambil foto
turnOffCamera(ktpStream, videoElementKtp, startButtonKtp); turnOffCamera(ktpStream, videoElementKtp, startButtonKtp);
// Tombol ulang muncul
refreshButtonKtp.style.display = "block";
captureButtonKtp.style.display = "none";
startButtonKtp.style.display = "none";
} }
}); });
@ -285,16 +332,27 @@ document.addEventListener("DOMContentLoaded", function () {
const context = canvas.getContext("2d"); const context = canvas.getContext("2d");
canvas.width = videoElementEkyc.videoWidth; canvas.width = videoElementEkyc.videoWidth;
canvas.height = videoElementEkyc.videoHeight; canvas.height = videoElementEkyc.videoHeight;
context.drawImage(videoElementEkyc, 0, 0, canvas.width, canvas.height); context.drawImage(
videoElementEkyc,
0,
0,
canvas.width,
canvas.height
);
const fotoDataUrl = canvas.toDataURL("image/jpeg"); const fotoDataUrl = canvas.toDataURL("image/jpeg");
fotoInputEkyc.value = fotoDataUrl; fotoInputEkyc.value = fotoDataUrl;
const fotoPreview = document.getElementById("foto-preview-ekyc"); const fotoPreview = document.getElementById("foto-preview-ekyc");
fotoPreview.innerHTML = '<img src="' + fotoDataUrl + '" alt="Foto">'; fotoPreview.innerHTML =
'<img src="' + fotoDataUrl + '" alt="Foto">';
// Matikan kamera setelah mengambil foto // Matikan kamera setelah mengambil foto
turnOffCamera(ekycStream, videoElementEkyc, startButtonEkyc); turnOffCamera(ekycStream, videoElementEkyc, startButtonEkyc);
refreshButtonEkyc.style.display = "block";
captureButtonEkyc.style.display = "none";
startButtonEkyc.style.display = "none";
} }
}); });
}); });
@ -302,7 +360,6 @@ document.addEventListener("DOMContentLoaded", function () {
* END KTP & E-KYC CAMERA * END KTP & E-KYC CAMERA
******************************************/ ******************************************/
/****************************************** /******************************************
* SLIDE KTP & E-KYC FORM 3 * SLIDE KTP & E-KYC FORM 3
******************************************/ ******************************************/
@ -310,16 +367,16 @@ let slideIndex = 1;
showSlide(slideIndex); showSlide(slideIndex);
function plusSlide(n) { function plusSlide(n) {
showSlide(slideIndex += n); showSlide((slideIndex += n));
} }
function currentSlide(n) { function currentSlide(n) {
showSlide(slideIndex = n); showSlide((slideIndex = n));
} }
function showSlide(n) { function showSlide(n) {
let slides = document.querySelectorAll('.slide'); let slides = document.querySelectorAll(".slide");
let dots = document.querySelectorAll('.dot'); let dots = document.querySelectorAll(".dot");
if (n > slides.length) { if (n > slides.length) {
slideIndex = 1; slideIndex = 1;
@ -330,149 +387,192 @@ function showSlide(n) {
} }
for (let i = 0; i < slides.length; i++) { for (let i = 0; i < slides.length; i++) {
slides[i].style.transform = 'translateX(-' + ((slideIndex - 1) * 100) + '%)'; slides[i].style.transform =
"translateX(-" + (slideIndex - 1) * 100 + "%)";
} }
for (let i = 0; i < dots.length; i++) { for (let i = 0; i < dots.length; i++) {
dots[i].classList.remove('active'); dots[i].classList.remove("active");
} }
dots[slideIndex - 1].classList.add('active'); dots[slideIndex - 1].classList.add("active");
} }
/****************************************** /******************************************
* END SLIDE KTP & E-KYC FORM 3 * END SLIDE KTP & E-KYC FORM 3
******************************************/ ******************************************/
/****************************************** /******************************************
* DROPDOWN SELECT GENDER * DROPDOWN SELECT GENDER
******************************************/ ******************************************/
$(document).ready(function () { $(document).ready(function () {
$('#gender-select').select2(); $("#gender-select").select2();
}); });
/****************************************** /******************************************
* END DROPDOWN SELECT GENDER * END DROPDOWN SELECT GENDER
******************************************/ ******************************************/
/****************************************** /******************************************
* AJAX DROPDOWN SELECT PROVINSI, KABUPATEN & KECAMATAN * AJAX DROPDOWN SELECT PROVINSI, KABUPATEN & KECAMATAN
******************************************/ ******************************************/
$(document).ready(function () { $(document).ready(function () {
// Inisialisasi select2 untuk selectProv $("#selectProvince").select2({
$("#selectProv").select2({ placeholder: "Pilih Provinsi",
placeholder: 'Pilih Provinsi',
ajax: { ajax: {
url: $("#selectProv").data("url"), url: $("#selectProvince").data("url"),
processResults: function ({ data }) { processResults: function ({ data }) {
return { return {
results: $.map(data, function (item) { results: $.map(data, function (item) {
return { return {
id: item.id, id: item.code,
text: item.name text: item.name,
} };
}) }),
}; };
} },
} },
}); });
// Inisialisasi select2 untuk selectRegenc $("#selectCity").select2({
$("#selectRegenc").select2({ placeholder: "Pilih Kabupaten/Kota",
placeholder: 'Pilih Kabupaten/Kota',
ajax: { ajax: {
url: "", // Isi dengan URL yang sesuai url: "", // Isi dengan URL yang sesuai
processResults: function ({ data }) { processResults: function ({ data }) {
return { return {
results: $.map(data, function (item) { results: $.map(data, function (item) {
return { return {
id: item.id, id: item.code,
text: item.name text: item.name,
} };
}) }),
}; };
} },
} },
}); });
// Inisialisasi select2 untuk selectDistric $("#selectDistrict").select2({
$("#selectDistric").select2({ placeholder: "Pilih Kecamatan",
placeholder: 'Pilih Kecamatan',
ajax: { ajax: {
url: "", // Isi dengan URL yang sesuai url: "", // Isi dengan URL yang sesuai
processResults: function ({ data }) { processResults: function ({ data }) {
return { return {
results: $.map(data, function (item) { results: $.map(data, function (item) {
return { return {
id: item.id, id: item.code,
text: item.name text: item.name,
} };
}) }),
}; };
} },
} },
}); });
// Event listener untuk perubahan pada selectProv $("#selectVillage").select2({
$("#selectProv").change(function () { placeholder: "Pilih Kelurahan",
let id = $('#selectProv').val(); ajax: {
url: "", // Isi dengan URL yang sesuai
processResults: function ({ data }) {
return {
results: $.map(data, function (item) {
return {
id: item.code,
text: item.name,
};
}),
};
},
},
});
// Mengosongkan pilihan di selectRegenc dan selectDistric // Event Listener untuk selectProvince
$("#selectRegenc, #selectDistric").empty(); $("#selectProvince").change(function () {
let code = $("#selectProvince").val();
// Menghapus properti 'disabled' pada selectRegenc dan selectDistric // Mengosongkan pilihan di selectCity dan selectDistrict dan selectVillage
$("#selectRegenc, #selectDistric").prop("disabled", false); $("#selectCity", "#selectDistrict", "#selectVillage").empty();
// Memuat ulang data berdasarkan provinsi yang baru dipilih di selectRegenc // Menghapus properti 'disabled' pada selectCity dan selectDistrict dan selectVillage
$("#selectRegenc").select2({ $("#selectCity", "#selectDistrict", "#selectVillage").prop(
placeholder: 'Pilih Wilayah', "disable",
false
);
// Muat ulang data berdasarkan provinsi yang baru dipilih di selectProvince
$("#selectCity").select2({
placeholder: "Pilih Kabupaten/Kota",
ajax: { ajax: {
url: "/selectRegenc/" + id, // Isi dengan URL yang sesuai url: "/cari-kota/" + code,
processResults: function ({ data }) { processResults: function ({ data }) {
return { return {
results: $.map(data, function (item) { results: $.map(data, function (item) {
return { return {
id: item.id, id: item.code,
text: item.name text: item.name,
} };
}) }),
}; };
} },
} },
}); });
}); });
// Event listener untuk perubahan pada selectRegenc // Event Listener untuk perubahan pada selectCity
$("#selectRegenc").change(function () { $("#selectCity").change(function () {
let id = $('#selectRegenc').val(); let code = $("#selectCity").val();
// Mengosongkan pilihan di selectDistric // Mengosongkan pilihan di selectDistrict dan selectVillage
$("#selectDistric").empty(); $("#selectDristrict", "#selectVillage").empty();
// Menghapus properti 'disabled' pada selectDistric // Menghapus properti 'disable' pada selectDistrict dan selectVillage
$("#selectDistric").prop("disabled", false); $("#selectDistrict", "#selectVillage").prop("disabled", false);
// Memuat ulang data berdasarkan wilayah yang baru dipilih di selectDistric // Memuat ulang data berdasarkan wilayah yang baru dipilih di selectCity
$("#selectDistric").select2({ $("#selectDistrict").select2({
placeholder: 'Pilih Kecamatan', placeholder: "Pilih Kecamatan",
ajax: { ajax: {
url: "/selectDistric/" + id, // Isi dengan URL yang sesuai url: "/cari-kecamatan/" + code, // Isi dengan URL yang sesuai
processResults: function ({ data }) { processResults: function ({ data }) {
return { return {
results: $.map(data, function (item) { results: $.map(data, function (item) {
return { return {
id: item.id, id: item.code,
text: item.name text: item.name,
} };
}) }),
}; };
} },
} },
});
});
// Event Listener untuk selectDistrict
$("#selectDistrict").change(function () {
let code = $("#selectDistrict").val();
// Mengosongkan pilihan di selectVillage
$("#selectVillage").empty();
// Menghapus properti 'disabled' pada selectVillage
$("#selectVillage").prop("disabled", false);
// Memuat ulang data berdasarkan wilayah yang baru dipilih di selectDistrict
$("#selectVillage").select2({
placeholder: "Pilih Kelurahan",
ajax: {
url: "/cari-kelurahan/" + code, // Isi dengan URL yang sesuai
processResults: function ({ data }) {
return {
results: $.map(data, function (item) {
return {
id: item.code,
text: item.name,
};
}),
};
},
},
}); });
}); });
}); });
/****************************************** /******************************************
* END AJAX DROPDOWN SELECT PROVINSI, KABUPATEN & KECAMATAN * END AJAX DROPDOWN SELECT PROVINSI, KABUPATEN & KECAMATAN
******************************************/ ******************************************/

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More