backend-admin #3

Open
runggumanalu8 wants to merge 10 commits from backend-admin into master
34 changed files with 17285 additions and 1391 deletions
Showing only changes of commit 6c18bb1a52 - Show all commits

View File

@ -3,10 +3,12 @@
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;
@ -134,7 +136,7 @@ class LoginController extends Controller
$image->greyscale(); // Convert to grayscale
$image->contrast(10); // Increase contrast, adjust the value as needed
$preprocessedfotoKTP = storage_path('preprocessed_image.jpg');
$preprocessedfotoKTP = public_path('storage/preprocessed/preprocessed_image.jpg');
$image->save($preprocessedfotoKTP);
$result = (new TesseractOCR($preprocessedfotoKTP))->run();
@ -142,6 +144,7 @@ class LoginController extends Controller
// (5) Normalize
$lines = explode("\n", $result);
$namaOCR = '';
$nikOCR = '';
$nikInputan = $nik;
$namaInputan = $nama_depan.' '.$nama_belakang;
@ -178,11 +181,6 @@ class LoginController extends Controller
$password = Hash::make($new_password);
// return response()->json([
// 'status' => true,
// 'message' => Uuid::uuid4(),
// ]);
$result = User::create([
'id' => Uuid::uuid4(),
'nama_depan' => $nama_depan,
@ -265,4 +263,83 @@ class LoginController extends Controller
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

@ -7,6 +7,7 @@ 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
{
@ -20,6 +21,16 @@ class UserContactController extends Controller
// 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.
*/
@ -34,23 +45,23 @@ class UserContactController extends Controller
public function store(Request $request)
{
$email_relasi = $request->input('email');
if($email_relasi == Auth::user()->email){
if ($email_relasi == Auth::user()->email) {
return response()->json([
'status' => false,
'message' => 'Kontak yang ingin didaftarkan tidak boleh sama',
]);
}else{
} else {
$result = Contact::create([
'pemilik_kontak' => Auth::user()->email,
'relasi_kontak' => $request->input('email'),
]);
if($result){
if ($result) {
return response()->json([
'status' => true,
'message' => 'Akun berhasil masuk ke kontak',
]);
}else{
} else {
return response()->json([
'status' => false,
'message' => 'Akun gagal masuk ke kontak',
@ -64,7 +75,6 @@ class UserContactController extends Controller
*/
public function show(Contact $contact)
{
}
/**
@ -90,14 +100,14 @@ class UserContactController extends Controller
{
try {
$result = Contact::destroy($id);
if($result){
if ($result) {
return response()->json([
'message' => 'Berhasil hapus data',
'status' => true,
]);
}else{
} else {
return response()->json([
'message' => 'Gagal hapus data karena '.$result,
'message' => 'Gagal hapus data karena ' . $result,
'status' => false,
]);
}
@ -112,13 +122,13 @@ class UserContactController extends Controller
public function cekEmail($email)
{
$result = User::where('email', $email)->get();
if ($result->isNotEmpty() && $result[0]->role == 'User') {
if($result[0]->status == 'Finished'){
if ($result->isNotEmpty() && $result[0]->role == 'User' && $result[0]->status != 'Rejected') {
if ($result[0]->status == 'Finished') {
return response()->json([
'status' => true,
'message' => $result,
]);
}else{
} else {
return response()->json([
'status' => false,
'message' => 'Akun dengen email ' . $email . ' tersedia dan belum diverifikasi',
@ -127,7 +137,7 @@ class UserContactController extends Controller
} else {
return response()->json([
'status' => false,
'message' => 'Akun dengen email ' . $email . ' tidak tersedia',
'message' => 'Akun dengen email ' . $email . ' tidak tersedia atau ditolak',
]);
}
}

View File

@ -4,8 +4,16 @@ namespace App\Http\Controllers\User;
use App\Models\Transaction;
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;
class UserTransactionController extends Controller
{
@ -14,9 +22,9 @@ class UserTransactionController extends Controller
*/
public function indexPembeli()
{
return view('user.transaction.pembeli.index',[
'name'=>'npannisa',
'TransactionUser'=>TransactionUser::HistoryTransaction()
return view('user.transaction.pembeli.index', [
'name' => 'npannisa',
'TransactionUser' => TransactionUser::HistoryTransaction(),
]);
}
@ -25,16 +33,17 @@ class UserTransactionController extends Controller
*/
public function indexPenjual()
{
return view('user.transaction.penjual.transaction-penjual',[
'name'=>'npannisa',
"TransactionUser"=>TransactionUser::HistoryTransaction()
return view('user.transaction.penjual.transaction-penjual', [
'name' => 'npannisa',
'TransactionUser' => TransactionUser::HistoryTransaction(),
]);
}
public function detailTransaction($id){
return view('user.transaction.pembeli.detail-transaction',[
'name'=>'npannisa',
"TransactionUser"=>TransactionUser::HistoryTransaction()
public function detailTransaction($id)
{
return view('user.transaction.pembeli.detail-transaction', [
'name' => 'npannisa',
'TransactionUser' => TransactionUser::HistoryTransaction(),
]);
}
@ -43,9 +52,9 @@ class UserTransactionController extends Controller
*/
public function createTransaction(Request $request)
{
return view('user.transaction.pembeli.new-transaction',[
'name'=>'npannisa',
"TransactionUser"=>TransactionUser::HistoryTransaction()
return view('user.transaction.pembeli.new-transaction', [
'name' => 'npannisa',
'TransactionUser' => TransactionUser::HistoryTransaction(),
]);
}
@ -54,12 +63,113 @@ class UserTransactionController extends Controller
*/
public function invoiceTransaction($id)
{
return view('user.transaction.pembeli.invoice-transaction',[
'name'=>'npannisa',
"TransactionUser"=>TransactionUser::HistoryTransaction()
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);
$now = Carbon::now();
$bulan = $now->format('F');
$tahun = $now->year;
// $persentase_keuntungan = Setting::where('status','Active')
// ->where('bulan','=',$bulan)
// ->where('tahun','=',$tahun)->get();
$persentase_keuntungan = floatval('5');
$total_harga = $jumlah_barang * $harga_barang;
$total_keuntungan = $persentase_keuntungan * $total_harga;
$biaya_admin = 0.1;
$total_bayar = intval($biaya_admin + $total_keuntungan + $total_harga);
$params = [
'transaction_details' => [
'order_id' => Uuid::uuid4(),
'gross_amount' => $total_bayar,
],
'item_details' => [
[
'id' => $nama_barang.time(),
'price' => $total_bayar,
'quantity' => 1,
'name' => $nama_barang,
],
],
'customer_details' => [
'firts_name' => $nama_depan_pembeli,
'last_name' => $nama_belakang_pembeli,
'email' => $pembeli,
'phone' => $nohp_pembeli,
],
];
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;
$batas_pembayaran = $now->addDays(2)->toDateTimeString();
$batas_pengiriman_barang = $now->addDays(6)->toDateTimeString();
$status = 'Pending';
$query = Transaction::create([
'id' => Uuid::uuid4(),
'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,
'biaya_admin' => $biaya_admin,
'total_harga' => $total_harga,
'total_bayar' => $total_bayar,
'token' => $token,
'status' => $status,
'batas_pembayaran' => $batas_pembayaran,
'batas_pengiriman_barang' => $batas_pengiriman_barang,
]);
return response()->json($query);
// $result_api = json_decode($response->body(), true);
// $token = '124';
// $redirect_url = 'haha';
// // save to db
// $payment = new payment;
// $payment->order_id = $params['transaction_details'][ 'order_id'];
// $payment->status = 'pending';
// $payment->price = $request->price;
// $payment->customer_firts_name = $request->customer_firts_name;
// $payment->customer_email = $request->customer_email;
// $payment->item_name = $request->item_name;
// $payment->checkout_link = $response['redirect_url'];
// $payment->save();
}
/**
* Display the specified resource.
*/

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');
}
}

View File

@ -23,7 +23,7 @@ class Refund extends Model
//Relasi
public function orders(){
return $this->belongsTo(Transaction::class, 'order_id', 'order_id');
return $this->belongsTo(Transaction::class, 'id', 'order_id');
}
//Relasi
}

View File

@ -23,7 +23,7 @@ class TransactionDescription extends Model
//Relasi
public function order(){
return $this->belongsTo(Transaction::class, 'order_id', 'order_id');
return $this->belongsTo(Transaction::class, 'id', 'order_id');
}
public function user(){

View File

@ -15,17 +15,20 @@ class Transaction extends Model
* @var array<int, string>
*/
protected $fillable = [
'id',
'pembeli',
'penjual',
'judul_transaksi',
'deskripsi transaksi',
'nama_barang',
'deskripsi_transaksi',
'satuan_barang',
'harga_barang',
'jumlah_barang',
'persentase_keuntungan',
'total_keuntungan',
'harga',
'biaya_admin',
'total_harga',
'signature_key',
'metode_pembayaran',
'total_bayar',
'token',
'status',
'batas_pembayaran',
'batas_pengiriman_barang',
@ -39,7 +42,7 @@ class Transaction extends Model
protected $casts = [
'batas_pembayaran' => 'datetime',
'batas_pengiriman_barang' => 'datetime',
'order_id' => 'string',
'id' => 'string',
];
//Relasi
@ -52,7 +55,7 @@ class Transaction extends Model
}
public function refunds(){
return $this->hasMany(Refund::class, 'order_id', 'order_id');
return $this->hasMany(Refund::class, 'order_id', 'id');
}
//Relasi
}

View File

@ -15,6 +15,7 @@
"laravel/sanctum": "^3.2",
"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",

57
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "eb6424bf82942b6b939788b88ee6586b",
"content-hash": "4dd1066d585142b363e4e114601be8ce",
"packages": [
{
"name": "brick/math",
@ -2111,6 +2111,61 @@
],
"time": "2023-08-05T12:09:49+00:00"
},
{
"name": "midtrans/midtrans-php",
"version": "2.5.2",
"source": {
"type": "git",
"url": "https://github.com/Midtrans/midtrans-php.git",
"reference": "a1ad0c824449ca8c68c4cf11b3417ad518311d2b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Midtrans/midtrans-php/zipball/a1ad0c824449ca8c68c4cf11b3417ad518311d2b",
"reference": "a1ad0c824449ca8c68c4cf11b3417ad518311d2b",
"shasum": ""
},
"require": {
"ext-curl": "*",
"ext-json": "*",
"php": ">=5.4"
},
"require-dev": {
"phpunit/phpunit": "5.7.*",
"psy/psysh": "0.4.*"
},
"type": "library",
"autoload": {
"psr-4": {
"Midtrans\\": "Midtrans/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Andri Setiawan",
"email": "andri.setiawan@veritrans.co.id"
},
{
"name": "Alvin Litani",
"email": "alvin.litani@veritrans.co.id"
},
{
"name": "Ismail Faruqi",
"email": "ismail.faruqi@veritrans.co.id"
}
],
"description": "PHP Wrapper for Midtrans Payment API.",
"homepage": "https://midtrans.com",
"support": {
"issues": "https://github.com/Midtrans/midtrans-php/issues",
"source": "https://github.com/Midtrans/midtrans-php/tree/2.5.2"
},
"time": "2021-08-23T08:52:05+00:00"
},
{
"name": "monolog/monolog",
"version": "3.4.0",

View File

@ -12,18 +12,22 @@ return new class extends Migration
public function up(): void
{
Schema::create('transactions', function (Blueprint $table) {
$table->uuid('order_id')->primary(); //order_id
$table->uuid('id')->primary(); //order_id
$table->string('pembeli'); // untuk customer_details
$table->string('penjual'); //merchant_name
$table->string('judul_transaksi'); // item_details -> item_name
$table->string('deskripsi_transaksi');
$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('harga'); // harga sebelum penambahan
$table->double('biaya_admin'); // biaya tambahan
$table->double('total_harga'); // gross amount
$table->string('signature_key');
$table->string('metode_pembayaran');
$table->double('total_bayar');
$table->string('signature_key')->nullable();
$table->string('token');
$table->string('metode_pembayaran')->nullable();
$table->enum('status',['Settlement','Capture','Pending','Cancel','Refund','Expire','Failure','Progress','Failed'])->default('Pending'); // transaction_status
$table->timestamp('batas_pembayaran');
$table->timestamp('batas_pengiriman_barang');

View File

@ -18,7 +18,7 @@ return new class extends Migration
$table->timestamp('due_date');
$table->enum('status',['Partial Refund','Deny','Pending'])->default('Pending');
$table->foreign('order_id')->on('transactions')->references('order_id');
$table->foreign('order_id')->on('transactions')->references('id');
});
}

View File

@ -16,7 +16,7 @@ return new class extends Migration
$table->string('bulan',20);
$table->string('tahun',5);
$table->string('persentase',5);
$table->string('status',15);
$table->enum('status',['Active', 'Nonactive']);
$table->timestamps();
});
}

View File

@ -20,7 +20,7 @@ return new class extends Migration
$table->string('deskripsi');
$table->timestamps();
$table->foreign('order_id')->on('transactions')->references('order_id');
$table->foreign('order_id')->on('transactions')->references('id');
$table->foreign('user')->on('users')->references('email');
});
}

View File

@ -846,8 +846,9 @@ tr:first-child > td > .fc-day-grid-event {
border-top: 1px solid #f2f2f2;
}
}
/* 1.18 Select2 */
.select2-container--default
/* 1.18 Select2
/* .select2-container--default
.select2-search--dropdown
.select2-search__field:focus {
outline: none;
@ -949,6 +950,7 @@ tr:first-child > td > .fc-day-grid-event {
.select2-results__option {
padding-right: 10px 15px;
}
*/
/* 1.19 Selectric */
.selectric {

File diff suppressed because one or more lines are too long

View File

@ -275,6 +275,14 @@ form p {
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 {
position: absolute;
height: 100%;

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -114,13 +114,6 @@ form_4_back_btn.addEventListener("click", function () {
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
******************************************/

View File

@ -49,3 +49,9 @@ $("#table-2").dataTable({
ordering: true,
searchable: true,
});
// Transaksi pembeli
$("#table-3").dataTable({
columnDefs: [{ sortable: false, targets: [6] }],
searchable: true,
});

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

View File

@ -69,7 +69,10 @@
<!-- /END GA -->
{{-- JS --}}
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
{{-- <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> --}}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.1/jquery.min.js"
integrity="sha512-aVKKRRi/Q/YV+4mjoKBsE4x3H+BkegoM/em46NNlCqNTmUYADjBbeNefNxYV7giUp0VxICtqdrbqU7iVaeZNXA=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="{{ asset('assets/modules/chart.min.js') }}"></script>
</head>
@ -137,26 +140,25 @@
</script>
<!-- General JS Scripts -->
<script src="{{ asset('assets/modules/jquery.min.js') }}"></script>
<script src="{{ asset('assets/modules/popper.js') }}"></script>i
<script src="{{ asset('assets/modules/popper.js') }}"></script>
<script src="{{ asset('assets/modules/tooltip.js') }}"></script>
<script src="{{ asset('assets/modules/bootstrap/js/bootstrap.min.js') }}"></script>
<script src="{{ asset('assets/modules/nicescroll/jquery.nicescroll.min.js') }}"></script>
<script src="{{ asset('assets/modules/moment.min.js') }}"></script>
<script src="{{ asset('assets/js/stisla.js') }}"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<!-- JS Libraies -->
<script src="{{ asset('assets/modules/jquery.sparkline.min.js') }}"></script>
{{-- <script src="{{ asset('assets/modules/jquery.sparkline.min.js') }}"></script> --}}
<script src="{{ asset('assets/modules/owlcarousel2/dist/owl.carousel.min.js') }}"></script>
<script src="{{ asset('assets/modules/summernote/summernote-bs4.js') }}"></script>
<script src="{{ asset('assets/modules/chocolat/dist/js/jquery.chocolat.min.js') }}"></script>
{{-- <script src="{{ asset('assets/modules/chocolat/dist/js/jquery.chocolat.min.js') }}"></script> --}}
<!-- JS Libraies -->
<script src="{{ asset('assets/modules/datatables/datatables.min.js') }}"></script>
<script src="{{ asset('assets/modules/datatables/DataTables-1.10.16/js/dataTables.bootstrap4.min.js') }}"></script>
<script src="{{ asset('assets/modules/datatables/Select-1.2.4/js/dataTables.select.min.js') }}"></script>
<script src="{{ asset('assets/modules/jquery-ui/jquery-ui.min.js') }}"></script>
{{-- <script src="{{ asset('assets/modules/jquery-ui/jquery-ui.min.js') }}"></script> --}}
{{-- <script type="text/javascript">
$(function() {
@ -180,14 +182,10 @@
<script src="{{ asset('assets/js/page/modules-datatables.js') }}"></script>
<!-- Page Specific JS File -->
{{-- <script src="{{ asset('assets/js/page/index.js') }}"></script> --}}
<script src="https://cdn.jsdelivr.net/npm/daterangepicker@3.1.0/daterangepicker.min.js"></script>i
{{-- <script src="{{ asset('assets/js/page/index-0.js') }}"></script> --}}
<!-- Template JS File -->
<script src="{{ asset('assets/js/scripts.js') }}"></script>
<script src="{{ asset('assets/js/custom.js') }}"></script>
{{-- <script src="{{ asset('assets/js/main.js') }}"></script> --}}
</body>
</html>

View File

@ -55,3 +55,4 @@
</div> --}}
</aside>
</div>
<script src="{{ asset('assets/modules/nicescroll/jquery.nicescroll.min.js') }}"></script>

View File

@ -3,8 +3,6 @@
<div class="main-content">
<section class="section">
<div class="section-header">
<div class="section-header-breadcrumb">
<div class="breadcrumb-item active"><a href="#">Dashboard</a></div>
<div class="breadcrumb-item"><a href="#"> Transaction</a></div>
@ -17,30 +15,29 @@
<div class="col-12 mb-4">
<div class="hero bg-primary text-white">
<div class="hero-inner">
<h1>Welcome! npannisa</h1>
<p class="lead">How Are You Today?</p>
<h1>Welcome! {{ Auth::user()->nama_depan }}</h1>
<p class="lead">Mau belanja apa hari ini?</p>
</div>
</div>
</div>
<div class="col-md-12">
<div class="card">
<div class="d-grid gap-2 d-md-flex justify-content-md-end" style="margin-bottom: 20px">
<a class="nav-link active" href="new-transaction">
<a class="nav-link active" href="{{ route('tambah-transaction.pembeli') }}">
<button class="btn btn-primary btn-lg">Lakukan Transaksi Baru</button>
</a>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-striped" id="table-1">
<table class="table table-striped" id="table-3">
<thead>
<tr>
<th>User ID</th>
<th>No</th>
<th>Order ID</th>
<th>Customer</th>
<th>Seller</th>
<th>Penjual</th>
<th>Total</th>
<th>Due Date</th>
<th>Batas Pengiriman</th>
<th>Status</th>
<th>Action</th>
</tr>
@ -48,9 +45,8 @@
<tbody>
@foreach ($TransactionUser as $HistoryTransaction)
<tr>
<td>{{ $HistoryTransaction['userId'] }}</td>
<td>{{ $loop->iteration }}</td>
<td>{{ $HistoryTransaction['orderId'] }}</td>
<td>{{ $HistoryTransaction['Customer'] }}</td>
<td>{{ $HistoryTransaction['seller'] }}</td>
<td>{{ $HistoryTransaction['total'] }}</td>
<td>{{ $HistoryTransaction['dueDate'] }}</td>
@ -65,15 +61,20 @@
<ul class="dropdown-menu">
<li><a class="dropdown-item"
href="/detail-transaction">Detail</a></li>
href="{{route('user-transaction.detail.pembeli',$HistoryTransaction['orderId'])}}">Detail</a></li>
<li><a class="dropdown-item"
href="/refund-transaction">Refund</a></li>
{{-- <li><a class="dropdown-item"
href="/invoice-transaction">Bayar</a></li> --}}
<li><a class="dropdown-item" data-toggle="modal"
data-target="#bayar">Bayar</a></li>
<li><a class="dropdown-item" data-toggle="modal"
data-target="#selesai">Selesai</a></li>
<li><a class="dropdown-item" id="bayar"
data-id="{{ $HistoryTransaction['orderId'] }}">Bayar</a>
{{-- data-id="{{ $transaction }}">Bayar</a> --}}
</li>
<li><a class="dropdown-item" id="selesai"
data-id="{{ $HistoryTransaction['orderId'] }}">Selesai</a>
{{-- data-id="{{ $transaction }}">Selesai</a> --}}
</li>
</ul>
</div>
</td>
@ -87,7 +88,96 @@
</div>
</div>
</section>
</div>
@extends('user.transaction.pembeli.modal-bayar-transaction')
@extends('user.transaction.pembeli.modal-end-transaction')
<script type="text/javascript" src="https://app.sandbox.midtrans.com/snap/snap.js"
data-client-key="SB-Mid-client-rk6kY5XbPLChy3Lg"></script>
<script>
$(document).ready(function() {
// Bayar
$('#table-3').on('click', '#bayar', function() {
const id = $(this).data('id');
const csrfToken = $('meta[name="csrf-token"]').attr('content');
@extends('user.transaction.pembeli.modal-bayar-transaction')
@extends('user.transaction.pembeli.modal-end-transaction')
@endsection
snap.pay("98f6ed6d-3562-42ba-9ef5-cb7d52258e9f", {
onSuccess: function(result) {
/* You may add your own implementation here */
alert("payment success!");
console.log(result);
},
onPending: function(result) {
/* You may add your own implementation here */
// alert("wating your payment!");
console.log(result);
},
onError: function(result) {
/* You may add your own implementation here */
alert("payment failed!");
console.log(result);
},
onClose: function(error) {
/* You may add your own implementation here */
alert('you closed the popup without finishing the payment '+error);
}
});
// $.ajaxSetup({
// headers: {
// 'X-CSRF-TOKEN': csrfToken
// }
// });
// $.ajax({
// url: '/transaction',
// type: 'POST',
// data: formData,
// processData: false,
// contentType: false,
// success: function(response) {
// Swal.fire({
// title: 'Berhasil!',
// text: 'Berhasil bayar',
// icon: 'success',
// confirmButtonText: 'OK'
// }).then(function() {
// // console.log("Sukses bayar " + response['token']);
// window.snap.pay("610bcd2b-700a-4bff-a570-35c6fbd0b57b", {
// onSuccess: function(result) {
// /* You may add your own implementation here */
// alert("payment success!");
// console.log(result);
// },
// onPending: function(result) {
// /* You may add your own implementation here */
// alert("wating your payment!");
// console.log(result);
// },
// onError: function(result) {
// /* You may add your own implementation here */
// alert("payment failed!");
// console.log(result);
// },
// onClose: function() {
// /* You may add your own implementation here */
// alert(
// 'you closed the popup without finishing the payment'
// );
// }
// });
// });
// },
// error: function(error) {
// console.log("error");
// }
// });
});
$('#table-3').on('click', '#selesai', function() {
const id = $(this).data('id');
console.log(id);
});
});
</script>
@endsection

View File

@ -1,5 +1,7 @@
@extends('user.layout.main')
@section('content')
{{-- <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" /> --}}
<link rel="stylesheet" href="{{ asset('assets/modules/select2/dist/css/select2.min.css') }}">
<div class="main-content">
<section class="section">
<div class="container">
@ -14,123 +16,303 @@
<div class="card-body">
<div class="form-row">
<div class="form-group col-md-12">
<label for="inputpembeli">Nama Pembeli</label>
<input type="email" class="form-control" id="inputpembeli"
placeholder="Masukkan nama pembeli">
</div>
</div>
<div class="form-group">
<label for="inputpenjual">Nama Penjual</label>
<input type="text" class="form-control" id="inputpenjual"
placeholder="Masukkan nama penjual">
</div>
<div class="form-group">
<label for="harga">Harga</label>
<input type="text" class="form-control" id="harga" placeholder="Rp.1000.000">
</div>
<div class="form-group">
<label for="inputjenis">Jenis Barang</label>
<input type="text" class="form-control" id="inputjenis" placeholder="">
</div>
<div class="form-group">
<label>Due Date</label>
<input type="date" class="form-control">
</div>
<div class="form-group">
<label for="inputdeskripsi">Deskripsi</label>
<textarea class="form-control resizable" id="deskripsi"
placeholder="Deskripsikan jenis apa transaksi yang anda lakukan"></textarea>
</div>
<div class="form-group mb-0">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="gridCheck">
<label class="form-check-label" for="gridCheck">
Check me out
<label for="inputpembeli">
<h5>Nama Pembeli</h5>
</label>
<input type="email" class="form-control" id="inputpembeli"
placeholder="Masukkan nama pembeli"
value="{{ Auth::user()->nama_depan . ' ' . Auth::user()->nama_belakang }}"
disabled>
</div>
</div>
</div>
<div class="card-footer d-flex justify-content-center">
<a href="/pembeli" class="btn btn-primary">Submit</a>
<div class="form-group">
<label for="inputpenjual">
<h5>Penjual</h5>
</label>
<h6>Pilih dari kontak</h6>
<div class="input-group">
<select class="form-control" id="selectContact" name="select_penjual">
</select>
<button class="btn btn-danger" type="button" id="deleteOption">Hapus</button>
</div>
</div>
<div class="form-group">
<h6>atau dari email</h6>
<div class="input-group">
<input type="email" class="form-control" id="inputPenjual"
name="input_penjual" placeholder="Masukkan email penjual">
<button class="btn btn-danger" type="button" id="checkButton">Check</button>
</div>
</div>
<div class="form-group">
<label for="inputBarang">
<h5>Nama Barang/Jasa</h5>
</label>
<input type="text" class="form-control" id="inputBarang"
placeholder="Sepeda Motor" name="nama_barang">
</div>
<div class="form-group">
<label for="hargaBarang">
<h5>Harga Satuan</h5>
</label>
<input type="number" class="form-control" name="harga_barang" id="hargaBarang"
placeholder="Rp. 1000.000">
</div>
<div class="form-group">
<label for="hargaBarang">
<h5>Satuan</h5>
</label>
<input type="text" class="form-control" name="satuan_barang" id="satuanBarang"
placeholder="Buah/Kg/Karung dll.">
</div>
<div class="form-group">
<label for="jumlahBarang">
<h5>Jumlah Satuan</h5>
</label>
<input type="number" class="form-control" name="jumlah_barang" id="jumlahBarang"
placeholder="Jumlah satuan">
</div>
<div class="form-group">
<label for="batasPengiriman">
<h5>Batas Pengiriman Barang</h5>
</label>
<input type="date" class="form-control" name="batas_pengiriman"
id="batasPengiriman" nama="batas_pengiriman">
</div>
<div class="form-group">
<label for="inputDeskripsi">
<h5>Deskripsi</h5>
</label>
<textarea class="form-control resizable" name="deskripsi" id="inputDeskripsi" placeholder="Deskripsikan transaksi anda"></textarea>
</div>
<div class="dashed-line"></div>
<div class="form-row">
<label style="margin-right: 500px;">Nominal</label>
<div style="display: inline-block;">Rp. 890000</div>
</div>
<div class="form-row">
<label style="margin-right: 500px;">Biaya Admin</label>
<div style="display: inline-block; ">Rp.0</div>
</div>
<div class="form-row">
<h6 style="margin-right: 500px;">Total Biaya</h6>
<div style="display: inline-block; ">
<h6>Rp.0</h6>
</div>
</div>
<div class="dashed-line"></div>
<div class="card-footer d-flex justify-content-center">
<button type="button" class="btn btn-primary" id="save">Buat</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
<script>
$(document).ready(function() {
$("#selectContact").select2({
placeholder: "Pilih Kontak",
ajax: {
url: "{{ route('user-contact.get') }}",
processResults: function({
data
}) {
return {
results: $.map(data, function(item) {
return {
id: item.relasi_kontak,
text: item.nama_depan + " " + item.nama_belakang,
};
}),
};
},
},
});
$('#selectContact').change(function() {
let email = $('#selectContact').val();
if (email === null) {
$('#inputPenjual').prop('disabled', false);
$('#checkButton').prop('disabled', false);
$('#deleteOption').prop('disabled', false);
} else {
$('#inputPenjual').prop('disabled', true);
$('#deleteOption').prop('disabled', false);
$('#checkButton').prop('disabled', true);
}
});
{{-- form transaksi --}}
{{-- <div class="container">
<div class="row justify-content-center">
<div class="col-md-6">
<div class="card">
<div class="card-body">
<form>
<div class="mb-3">
<label for="orderid" class="form-label">Order Id</label>
<input type="text" class="form-control" id="orderId" name="order" required>
</div>
$('#deleteOption').click(function() {
$('#selectContact').val(null).trigger("change");
});
<div class="mb-3">
<label for="customer" class="form-label">Customer</label>
<input type="text" class="form-control" id="customer" name="customer" required>
</div>
$('#inputPenjual').on('input', function() {
let emailInput = $('#inputPenjual').val();
if (emailInput.trim() == '') {
$('#selectContact').prop('disabled', false);
$('#deleteOption').prop('disabled', false);
} else {
$('#selectContact').prop('disabled', true);
$('#deleteOption').prop('disabled', true);
}
});
<div class="mb-3">
<label for="seller" class="form-label">Norek Asal</label>
<input type="text" class="form-control" id="norekasal" name="norekasal" pattern="[0-9]+" required>
<div class="invalid-feedback">
Harap masukkan hanya angka</div>
</div>
$('#checkButton').click(function() {
let email = document.querySelector('[name="input_penjual"]').value;
const csrfToken = $('meta[name="csrf-token"]').attr('content');
<div class="mb-3">
<label for="seller" class="form-label">Seller</label>
<input type="text" class="form-control" id="seller" name="seller" required>
</div>
if (email.trim() == '') {
Swal.fire({
title: 'Gagal',
text: 'Email tidak boleh kosong',
icon: 'error'
});
} else {
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': csrfToken
}
});
<div class="mb-3">
<label for="seller" class="form-label">Norek Tujuan</label>
<input type="text" class="form-control" id="norektujuan" name="norektujuan" pattern="[0-9]+" required>
<div class="invalid-feedback">
Harap masukkan hanya angka.
</div>
</div>
$.ajax({
url: "{{ route('user-contact.email', ':email') }}".replace(':email', email),
type: 'GET',
success: function(response) {
if (response.status) {
Swal.fire({
title: 'Berhasil',
text: 'Akun tersedia',
icon: 'success'
});
} else {
Swal.fire({
title: 'Gagal',
text: response.message,
icon: 'error'
});
}
},
error: function(error) {
Swal.fire({
title: 'Gagal',
text: 'Terjadi error karena, ' + error,
icon: 'error'
});
}
});
}
});
$('#save').on('click', function() {
let opsiKontak = document.querySelector('[name="select_penjual"]').value;
let inputKontak = document.querySelector('[name="input_penjual"]').value;
let namaBarang = document.querySelector('[name="nama_barang"]').value;
let hargaBarang = document.querySelector('[name="harga_barang"]').value;
let satuanBarang = document.querySelector('[name="satuan_barang"]').value;
let jumlahBarang = document.querySelector('[name="jumlah_barang"]').value;
let batasPengiriman = document.querySelector('[name="batas_pengiriman"]').value;
let deskripsi = document.querySelector('[name="deskripsi"]').value;
<div class="mb-3">
<label for="total" class="form-label">Total</label>
<input type="text" class="form-control" id="total" name="total">
</div>
let emptyInput = [];
<div class="mb-3">
<label for="seller" class="form-label">Due Date</label>
<input type="calendar" class="form-control" id="duedate" name="duedate" required>
</div>
let penjual = '';
if (opsiKontak != "" && inputKontak != "") {
penjual = opsiKontak;
} else if (opsiKontak == "" && inputKontak != "") {
penjual = inputKontak;
} else if (inputKontak == "" && opsiKontak != "") {
penjual = opsiKontak;
} else {
console.log('Kosong');
emptyInput.push("Kolom penjual tidak boleh kosong");
}
<div class="mb-3">
<label for="textareadesc" class="form-label">Deskripsi</label>
<textarea class="form-control" id="textareadesc" rows="3"></textarea>
</div>
if (namaBarang == "") {
emptyInput.push("Nama barang tidak boleh kosong");
}
if (hargaBarang == "") {
emptyInput.push("Harga barang tidak boleh kosong");
}
{{-- <div class="d-flex justify-content-center">
<button class="btn btn-info open-detail-modal" data-toggle="modal fade"
data-target="#confirmtransaction">Transaksi Sudah Benar</button>
</div> --}}
if (satuanBarang == "") {
emptyInput.push("Satuan barang tidak boleh kosong");
}
<div class="d-flex justiffy-content-center">
<a href="/pembeli" type="button" class="btn btn-primary" data-bs-dismiss="modal">Transaksi Sudah
Benar</a>
</div>
</form>
</div>
</div>
</div>
</div>
{{-- </div> --}}
</div>
if (jumlahBarang == "") {
emptyInput.push("Jumlah barang tidak boleh kosong");
}
if (batasPengiriman == "") {
emptyInput.push("Batas pengiriman tidak boleh kosong");
}
if (emptyInput.length > 0) {
const emptyInputError = emptyInput.join(', ');
Swal.fire({
title: 'Gagal',
text: emptyInputError,
icon: 'error',
confirmButtonText: 'OK',
});
} else {
const csrfToken = $('meta[name="csrf-token"]').attr('content');
const formData = new FormData();
formData.append('email_penjual', penjual);
formData.append('nama_barang', namaBarang);
formData.append('satuan_barang', satuanBarang);
formData.append('harga_barang', hargaBarang);
formData.append('jumlah_barang', jumlahBarang);
formData.append('batas_pengiriman', batasPengiriman);
formData.append('deskripsi', deskripsi);
$.ajaxSetup({
headers:{
'X-CSRF-TOKEN':csrfToken
}
});
$.ajax({
url:"{{route('store-transaction.pembeli')}}",
type:"POST",
data: formData,
processData: false,
contentType: false,
success: function(response){
Swal.fire({
title:'Berhasil',
text: "Transaksi berhasil didaftar",
icon: 'success'
});
console.log(response);
},
error: function(error){
Swal.fire({
title:'Gagal',
text:'Gagal mengirimkan data karena ' + error,
icon: 'error'
});
console.log(error)
}
});
}
});
});
</script>
@endsection

View File

@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, shrink-to-fit=no" name="viewport">
<title>Verifikasi Email Pemulihan</title>
<link rel="stylesheet" href="{{ asset('assets/modules/bootstrap/css/bootstrap.min.css') }}">
<link rel="stylesheet" href="{{ asset('assets/css/style.css') }}">
</head>
<body>
<div id="app">
<section class="section">
<div class="container mt-5">
<div class="row justify-content-center">
<div class="col-md-10">
<div class="card">
<div class="card-header d-flex justify-content-center bg-primary text-white">
<img class="mr-3 rounded" width="150"
src="{{ asset('assets/images/google-removebg-preview.png') }}">
</div>
<div class="d-flex justify-content-center bg-primary text-white">
<h2 class="mb-0">Verifikasi Email</h2>
</div>
<div class="card-body">
<p>Rekber mengirimkan kode verifikasi ke</p>
<p><b>{{ $verificationEmail['email'] }}</b></p>
<p class="mt-4">Gunakan kode ini untuk menyelesaikan syarat pendaftaran akun:</p>
<div class="d-flex justify-content-center">
<h1 class="verification-code">{{ $verificationEmail['code'] }}</h1>
</div>
<div class="text-center">
<p><b>Masa berlaku kode ini akan berakhir dalam 2 menit.</b> </p>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
</body>
</html>

View File

@ -181,14 +181,14 @@
<input type="email" placeholder="Email" class="email-input" name="new_email"
id="newEmail" />
</div>
<button id="verifikasiEmail" class="btn-otp solid"
type="button">Verifikasi</button>
<button id="verifikasiEmail" class="btn-otp" type="button"
disabled=true>Verifikasi</button>
</div>
<div class="input-field up">
<i class="fa fa-ellipsis-h" aria-hidden="true"></i>
<input type="text" class="telp-input-signup"
oninput="this.value = this.value.replace(/[^0-6]/g, '').substring(0, 6);"
placeholder="Kode Verifikasi Email" name="email-verification">
oninput="this.value = this.value.replace(/[^0-9]/g, '').substring(0, 6);"
placeholder="Kode Verifikasi Email" name="email_verification">
</div>
<div class="input-field up">
<i class="fa fa-phone" aria-hidden="true"></i>
@ -378,7 +378,7 @@
<button class="btn transparent" id="sign-up-btn">
Sign up
</button>
<p><a href="/">kembali</a></p>
<p><a href="{{ route('login') }}">kembali</a></p>
</div>
<img src="{{ asset('assets/img/login_register/Payment Information-pana.svg') }}" class="image"
alt="" />
@ -399,7 +399,6 @@
</div>
</div>
</div>
{{-- <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> --}}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.1/jquery.min.js"
integrity="sha512-aVKKRRi/Q/YV+4mjoKBsE4x3H+BkegoM/em46NNlCqNTmUYADjBbeNefNxYV7giUp0VxICtqdrbqU7iVaeZNXA=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
@ -415,6 +414,7 @@
$(document).ready(function() {
let verificationStatus = false;
let verificationCode = '';
let waktuSekarangDetik = 0;
function generateVerificationCode() {
const codeLength = 6;
@ -492,25 +492,91 @@
}
});
$('#verifikasiEmail').on('click', function() {
});
$('#newEmail').on('input', function() {
const newEmail = $(this);
clearTimeout(newEmail.timer); // Menghapus timeout yang ada
const verificationButton = document.getElementById('verifikasiEmail');
verificationButton.disabled = true;
// Menunggu 5 detik sebelum menghasilkan kode verifikasi
newEmail.timer = setTimeout(function() {
const email = newEmail.val().trim(); // Menghapus spasi di awal dan akhir
const email = newEmail.val().trim(); // Menghapus spasi di awal dan akhir
if (email != '') {
// Menunggu 5 detik sebelum menghasilkan kode verifikasi
newEmail.timer = setTimeout(function() {
if (waktuSekarangDetik == 0) {
verificationStatus = false;
verificationButton.disabled = false;
verificationButton.innerHTML = 'Verifikasi';
}
}, 1000);
}
});
if (email === '') {
alert('Silakan masukkan alamat email Anda terlebih dahulu.');
$('#verifikasiEmail').on('click', function() {
const newEmail = $(this);
let email = document.querySelector('[name="new_email"]').value;
const csrfToken = $('meta[name="csrf-token"]').attr('content');
verificationCode = generateVerificationCode();
const formData = new FormData();
formData.append('email', email);
formData.append('code', verificationCode);
// Menonaktifkan tombol verifikasi
newEmail.prop('disabled', true);
// Mengatur waktu dalam detik (misalnya, 2 menit = 120 detik)
const waktuTotalDetik = 120;
waktuSekarangDetik = waktuTotalDetik;
// Mengupdate teks tombol dengan format menit:detik
function updateButtonText() {
const menit = Math.floor(waktuSekarangDetik / 60);
const detik = waktuSekarangDetik % 60 < 10 ? '0' + (waktuSekarangDetik % 60) :
waktuSekarangDetik % 60;
newEmail.text(`${menit}:${detik}`);
}
// Memulai timer dan mengupdate teks tombol setiap detik
const timerInterval = setInterval(function() {
if (waktuSekarangDetik > 0) {
waktuSekarangDetik--;
updateButtonText();
} else {
const verificationCode = generateVerificationCode();
console.log(verificationCode);
clearInterval(timerInterval);
newEmail.text("Verifikasi"); // Mengembalikan teks awal tombol
newEmail.prop('disabled', false); // Mengaktifkan kembali tombol
}
}, 5000);
}, 1000); // Setiap 1 detik
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': csrfToken
}
});
$.ajax({
url: "{{ route('kirim.kode') }}",
type: 'POST',
data: formData,
contentType: false,
processData: false,
success: function(response) {
Swal.fire({
title: response.status ? 'Berhasil' : 'Gagal',
text: response.message,
icon: response.status ? 'success' : 'error',
});
},
error: function(error) {
Swal.fire({
title: 'Gagal',
text: 'Gagal karena ' + error,
icon: 'error',
});
},
});
verificationStatus = true;
});
$('#signUp').on('click', function() {
@ -522,7 +588,7 @@
let email = document.querySelector('[name="new_email"]').value;
let nohp = document.querySelector('[name="nohp"]').value;
let gender = document.querySelector('[name="gender"]').value;
let emailVerification = document.querySelector('[name="email-verification"]').value;
let emailVerification = document.querySelector('[name="email_verification"]').value;
// Tanggal lahir
let tanggalLahir = document.querySelector('[name="tanggal_lahir"]').value;
@ -548,7 +614,7 @@
let confirmPassword = document.querySelector('[name="confirm_password"]').value;
// Pengecekan inputan yang kosong
if (namaDepan.trim() === "" || namaBelakang.trim() === "") {
if (namaDepan.trim() === "" && namaBelakang.trim() === "") {
emptyInput.push("Nama depan dan nama belakang tidak boleh kosong");
}
@ -560,6 +626,8 @@
emptyInput.push("Email tidak boleh kosong");
} else if (!verificationStatus) {
emptyInput.push("Verifikasi email terlebih dahulu");
} else if (emailVerification != verificationCode) {
emptyInput.push('Kode verifikasi harus sama dengan kode yang dikirim ke email');
}
if (nohp.trim() === "") {
@ -589,7 +657,7 @@
emptyInput.push("Silahkan ambil foto KTP anda");
}
if (newPassword.trim() === "" || confirmPassword === "") {
if (newPassword.trim() === "" && confirmPassword === "") {
emptyInput.push("Password tidak boleh kosong");
} else if (newPassword.trim() != confirmPassword) {
emptyInput.push("Password baru harus sama dengan password yang dikonfirmasi");

View File

@ -93,29 +93,23 @@ Route::get('/next_detail_refund',function() {
// --------------------------------------------------------------------------------------------
// Route::get('/Ini', function () {
// return view('user/index',[
// 'name'=>'Jilhan Haura',
// "transaction"=>Transactions::allTransactions()
// ]);
// });
// Route::resource('/login',LoginController::class);
//Index
// Login, logout dan register
Route::controller(LoginController::class)->group(function(){
Route::get('/','login')->name('login');
Route::get('/login','login')->name('login');
Route::get('/logout','logout')->name('logout');
Route::post('/','authenticate')->name('authenticate');
Route::post('/authenticate','authenticate')->name('authenticate');
Route::post('/register','register')->name('register');
Route::get('/cek-email/{email}','statusAkun')->name('status.akun');
Route::get('/cari-provinsi','cariProvinsi')->name('cari.provinsi');
Route::get('/cari-kota/{code}','cariKota')->name('cari.kota');
Route::get('/cari-kecamatan/{code}','cariKecamatan')->name('cari.kecamatan');
Route::get('/cari-kelurahan/{code}','cariKelurahan')->name('cari.kelurahan');
Route::post('/kode-verifikasi','kirimKodeVerifikasi')->name('kirim.kode');
Route::get('ocr','getOcr');
});
// admin dan user
@ -157,12 +151,18 @@ Route::middleware(['auth'])->group(function(){
Route::get('cek-contact/{email}','cekEmail')->name('user-contact.email');
Route::post('user-contact','store')->name('user-contact.store');
Route::delete('user-contact/{id}','destroy')->name('user-contact.delete');
Route::get('get-user-contact','getContact')->name('user-contact.get');
});
// Tampilan transaksi, bayar, update status pengiriman dan refund
Route::controller(UserTransactionController::class)->group(function(){
// Pembeli
Route::get('user-transaction-pembeli','indexPembeli')->name('user-transaction.index.pembeli');
Route::get('detail-user-transaction-pembeli/{id}','detailTransaction')->name('user-transaction.detail.pembeli');
Route::get('tambah-transaction','createTransaction')->name('tambah-transaction.pembeli');
Route::post('store-transaction','storeTransaction')->name('store-transaction.pembeli');
//Penjual
Route::get('user-transaction-penjual','indexPenjual')->name('user-transaction.index.penjual');
//bayar
});
// Tampilan refund

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB