diff --git a/app/Http/Controllers/API/LoginApiController.php b/app/Http/Controllers/API/LoginApiController.php new file mode 100644 index 00000000..bdff9436 --- /dev/null +++ b/app/Http/Controllers/API/LoginApiController.php @@ -0,0 +1,127 @@ +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(), + // ]); + // } +} diff --git a/app/Http/Controllers/Login/LoginController.php b/app/Http/Controllers/Login/LoginController.php new file mode 100644 index 00000000..adae6629 --- /dev/null +++ b/app/Http/Controllers/Login/LoginController.php @@ -0,0 +1,209 @@ +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) + { + $credentials = $request->validate([ + 'email' => ['required', 'email'], + 'password' => ['required', 'min:8'], + ]); + + if (Auth::attempt($credentials)) { + if (Auth::user()->status == 'Finished') { + $request->session()->regenerate(); + + if (ucwords(Auth::user()->role) == 'Admin') { + return redirect()->intended('/dashboard'); + } else { + return redirect()->intended('/'); + } + } else { + Session::flash('message', 'Akun Tidak Ditemukan'); + return redirect()->back(); + } + } + + return redirect()->back() + ->withErrors([ + 'email' => 'Email dengan'.$credentials['email'].' tidak tersedia.', + ]) + ->onlyInput('email'); + } + + public function hai() + { + echo 'sukses'; + } + + /** + * 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 registerStore(Request $request) + { + $validatedData = $request->validate([ + 'nama' => 'required|max:255', + 'email' => 'required|string|email|unique:users', + 'password' => 'required|string|min:8', + 'nohp' => 'required', + 'nik' => 'required', + 'alamat' => 'required', + 'foto_ktp' => 'required|image|mimes:jpeg,svg,png,jpg', + 'foto_wajah' => 'required|image|mimes:jpeg,svg,png,jpg', + 'foto_profil' => 'image|mimes:jpeg,svg,png,jpg', + 'gender' => 'required', + ]); + + // $validatedData['email_verified_at'] = now(); + + $fotoKTP = ''; + $fotoWajah = ''; + $fotoProfil =''; + if ($request->hasFile('foto_ktp') && $request->hasFile('foto_wajah')) { + // $namaGambarOri = $request->file('foto-gambar')->getClientOriginalName(); + // $namaGambar = round(microtime(true) * 1000) . '-' . str_replace(' ', '-', $namaGambarOri); + $tipeFotoKtp = $request->file('foto_ktp')->getClientMimeType(); + $tipeFotoWajah = $request->file('foto_wajah')->getClientMimeType(); + $fotoKTP = 'Foto-KTP-' . $request->nama . '.' . $tipeFotoKtp; + $fotoWajah = 'Foto-Wajah' . $request->nama . '.' . $tipeFotoWajah; + // Simpan foto + $request->file('foto-ktp')->storeAs('public/foto-ktp', $fotoKTP); + $request->file('foto-wajah')->storeAs('public/foto-wajah', $fotoWajah); + } + + if($request->hasFile('foto_profil')){ + $tipeFotoProfil = $request->file('foto_profil')->getClientMimeType(); + $fotoProfil = 'Foto-Profil-' . $request->nama . '.' . $tipeFotoProfil; + // Simpan foto + $request->file('foto-profil')->storeAs('public/foto-profil', $fotoProfil); + } + + //OCR + try { + $imagePath = storage_path('foto-ktp/' . $validatedData['foto-ktp']); + + $image = Image::make($imagePath); + + $image->greyscale(); // Convert to grayscale + $image->contrast(10); // Increase contrast, adjust the value as needed + + $preprocessedImagePath = storage_path('preprocessed_image.jpg'); + $image->save($preprocessedImagePath); + + $result = (new TesseractOCR($preprocessedImagePath))->run(); + + // (5) Normalize + + $lines = explode("\n", $result); + $nikOCR = ''; + $nikInputan = $request->nik; + $namaInputan = $request->nama; + + foreach ($lines as $line) { + // normalize NIK + if (strpos($line, 'NIK') !== false) { + $nikOCR = preg_replace('/[^0-9]/', '', $line); + } + + // Mencari nama + if (strpos($line, $namaInputan) !== false) { + $namaOCR = trim(substr($line, strpos($line, ':') + 1)); + } + } + + //Selesai + + $percent = 0.0; + + if (similar_text($nikInputan, $nikOCR, $percent) >= 70 && similar_text($namaOCR, $namaOCR, $percent) >= 70) { + $validatedData['status'] = 'Progress'; + } else { + $validatedData['status'] = 'Pending'; + } + } catch (\Exception $e) { + $validatedData['status'] = 'Pending'; + } + //OCR + + //Deteksi wajah belum + + $validatedData['remember_token'] = Str::random(10); + $validatedData['password'] = Hash::make($request->password); + User::create([ + 'id' => Str::uuid(), + 'nama' => $validatedData['nama'], + 'email' => $validatedData['email'], + 'email_verified_at' => null, + 'password' => $validatedData['password'], + 'role' => 'User', + 'nohp' => $validatedData['nohp'], + 'nik' => $validatedData['nik'], + 'alamat' => $validatedData['alamat'], + 'foto_ktp' => $fotoKTP, + 'foto_wajah' => $fotoWajah, + 'status' => $validatedData['status'], + 'gender' => $validatedData['gender'], + 'remember_token' => Str::random(10), + ]); + return redirect('/login')->with('daftar', 'Daftar berhasil, silahkan login'); + } + + public function register() + { + return view('index'); + } + + public function approveUser(Request $request) + { + } + + public function deniedUser(Request $request) + { + } +} diff --git a/app/Http/Controllers/RefundDescriptionController.php b/app/Http/Controllers/RefundDescriptionController.php new file mode 100644 index 00000000..f7a69c54 --- /dev/null +++ b/app/Http/Controllers/RefundDescriptionController.php @@ -0,0 +1,65 @@ + + */ + protected $fillable = [ + 'pemilik_kontak', + 'relasi_kontak', + ]; + + //Relasi + public function pemilik_kontak(){ + return $this->belongsTo(User::class, 'email', 'pemilik_kontak'); + } + + public function relasi_kontak(){ + return $this->belongsTo(User::class, 'email', 'relasi_kontak'); + } + //Relasi } diff --git a/app/Models/Refund.php b/app/Models/Refund.php index 42ab3362..1748f78a 100644 --- a/app/Models/Refund.php +++ b/app/Models/Refund.php @@ -8,4 +8,22 @@ use Illuminate\Database\Eloquent\Model; class Refund extends Model { use HasFactory; + + /** + * The attributes that are mass assignable. + * + * @var array + */ + protected $fillable = [ + 'order_id', + 'total', + 'due_date', + 'status', + ]; + + //Relasi + public function orders(){ + return $this->belongsTo(Transaction::class, 'order_id', 'order_id'); + } + //Relasi } diff --git a/app/Models/RefundDescription.php b/app/Models/RefundDescription.php new file mode 100644 index 00000000..258393cf --- /dev/null +++ b/app/Models/RefundDescription.php @@ -0,0 +1,28 @@ + + */ + protected $fillable = [ + 'refund_id', + 'filename', + 'type', + ]; + + //Relasi + public function refunds(){ + return $this->belongsTo(Refund::class, 'refund_id', 'id'); + } + //Relasi +} diff --git a/app/Models/Setting.php b/app/Models/Setting.php index 0fe60afd..914ce0c7 100644 --- a/app/Models/Setting.php +++ b/app/Models/Setting.php @@ -8,4 +8,16 @@ use Illuminate\Database\Eloquent\Model; class Setting extends Model { use HasFactory; + + /** + * The attributes that are mass assignable. + * + * @var array + */ + protected $fillable = [ + 'bulan', + 'tahun', + 'diskon', + 'status', + ]; } diff --git a/app/Models/TransactionDescription.php b/app/Models/TransactionDescription.php new file mode 100644 index 00000000..b2dd450e --- /dev/null +++ b/app/Models/TransactionDescription.php @@ -0,0 +1,33 @@ + + */ + protected $fillable = [ + 'order_id', + 'user', + 'judul', + 'deskripsi' + ]; + + //Relasi + public function order(){ + return $this->belongsTo(Transaction::class, 'order_id', 'order_id'); + } + + public function user(){ + return $this->belongsTo(User::class, 'email', 'user'); + } + //Relasi +} diff --git a/app/Models/User.php b/app/Models/User.php index 275f98fa..6d5be269 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -26,6 +26,7 @@ class User extends Authenticatable 'role_id', 'alamat', 'foto_ktp', + 'foto_wajah', 'nohp', 'nik', 'gender', @@ -77,6 +78,7 @@ class User extends Authenticatable //JWT + //Relasi public function pemilik_kontak(){ return $this->hasMany(Contact::class, 'email', 'pemilik_kontak'); @@ -85,5 +87,14 @@ class User extends Authenticatable 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'); + } //Relasi + } diff --git a/app/Models/transaction.php b/app/Models/transaction.php index b6f6bb0e..876a965c 100644 --- a/app/Models/transaction.php +++ b/app/Models/transaction.php @@ -8,4 +8,51 @@ use Illuminate\Database\Eloquent\Model; class Transaction extends Model { use HasFactory; + + /** + * The attributes that are mass assignable. + * + * @var array + */ + protected $fillable = [ + 'pembeli', + 'penjual', + 'judul_transaksi', + 'deskripsi transaksi', + 'persentase_keuntungan', + 'total_keuntungan', + 'harga', + 'biaya_admin', + 'total_harga', + 'signature_key', + 'metode_pembayaran', + 'status', + 'batas_pembayaran', + 'batas_pengiriman_barang', + ]; + + /** + * The attributes that should be cast. + * + * @var array + */ + protected $casts = [ + 'batas_pembayaran' => 'datetime', + 'batas_pengiriman_barang' => 'datetime', + 'order_id' => 'string', + ]; + + //Relasi + public function pembeli(){ + return $this->belongsTo(User::class, 'email', 'pembeli'); + } + + public function penjual(){ + return $this->belongsTo(User::class, 'email', 'penjual'); + } + + public function refunds(){ + return $this->hasMany(Refund::class, 'order_id', 'order_id'); + } + //Relasi } diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index 96256d62..919963de 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -24,8 +24,8 @@ class UserFactory extends Factory 'email_verified_at' => now(), 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password 'remember_token' => Str::random(10), - 'role' => $this->faker->randomElement(['Admin','User']), - 'nik' => $this->faker->nik, + '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(), 'status'=> $this->faker->randomElement(['Progress', 'Finished']), diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index 2c435f85..4d16b72b 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -17,13 +17,15 @@ return new class extends Migration $table->string('email',50)->unique(); $table->timestamp('email_verified_at')->nullable(); $table->string('password'); - $table->string('role'); + $table->string('role',10); $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('status',10); - $table->string('gender'); + $table->string('gender',15); $table->rememberToken(); $table->timestamps(); }); diff --git a/database/migrations/2023_08_01_073859_create_transactions_table.php b/database/migrations/2023_08_01_073859_create_transactions_table.php new file mode 100644 index 00000000..498d4eca --- /dev/null +++ b/database/migrations/2023_08_01_073859_create_transactions_table.php @@ -0,0 +1,43 @@ +uuid('order_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->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->string('status'); // transaction_status + $table->timestamp('batas_pembayaran'); + $table->timestamp('batas_pengiriman_barang'); + $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'); + } +}; diff --git a/database/migrations/2023_08_16_044527_create_refunds_table.php b/database/migrations/2023_08_16_044527_create_refunds_table.php index 4dbb28f5..80f1aad3 100644 --- a/database/migrations/2023_08_16_044527_create_refunds_table.php +++ b/database/migrations/2023_08_16_044527_create_refunds_table.php @@ -13,12 +13,12 @@ return new class extends Migration { Schema::create('refunds', function (Blueprint $table) { $table->id(); - $table->integer('orderId'); - $table->string('customerName'); - $table->string('sellerName'); - $table->string('total'); - $table->timestamp('dueDate'); - $table->string('status'); + $table->foreignUuid('order_id'); + $table->double('total',10); + $table->timestamp('due_date'); + $table->string('status',20); + + $table->foreign('order_id')->on('transactions')->references('order_id'); }); } @@ -29,4 +29,4 @@ return new class extends Migration { Schema::dropIfExists('refunds'); } -}; \ No newline at end of file +}; diff --git a/database/migrations/2023_08_27_074453_create_settings_table.php b/database/migrations/2023_08_27_074453_create_settings_table.php index 3f09f882..adbd1db1 100644 --- a/database/migrations/2023_08_27_074453_create_settings_table.php +++ b/database/migrations/2023_08_27_074453_create_settings_table.php @@ -13,6 +13,10 @@ return new class extends Migration { Schema::create('settings', function (Blueprint $table) { $table->id(); + $table->string('bulan',20); + $table->string('tahun',5); + $table->double('diskon',5); + $table->string('status',15); $table->timestamps(); }); } diff --git a/database/migrations/2023_09_04_022513_create_transaction_descriptions_table.php b/database/migrations/2023_09_04_022513_create_transaction_descriptions_table.php new file mode 100644 index 00000000..a5822f72 --- /dev/null +++ b/database/migrations/2023_09_04_022513_create_transaction_descriptions_table.php @@ -0,0 +1,34 @@ +id(); + $table->foreignUuid('order_id'); + $table->string('user'); + $table->string('judul'); + $table->string('deskripsi'); + $table->timestamps(); + + $table->foreign('order_id')->on('transactions')->references('order_id'); + $table->foreign('user')->on('users')->references('email'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('transaction_descriptions'); + } +}; diff --git a/database/migrations/2023_09_01_073859_create_transactions_table.php b/database/migrations/2023_09_04_023526_create_refund_descriptions_table.php similarity index 56% rename from database/migrations/2023_09_01_073859_create_transactions_table.php rename to database/migrations/2023_09_04_023526_create_refund_descriptions_table.php index 30e302a0..6481bc8a 100644 --- a/database/migrations/2023_09_01_073859_create_transactions_table.php +++ b/database/migrations/2023_09_04_023526_create_refund_descriptions_table.php @@ -11,9 +11,14 @@ return new class extends Migration */ public function up(): void { - Schema::create('transactions', function (Blueprint $table) { + 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'); }); } @@ -22,6 +27,6 @@ return new class extends Migration */ public function down(): void { - Schema::dropIfExists('transactions'); + Schema::dropIfExists('refund_descriptions'); } }; diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 2218bde1..9bc2e502 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -5,6 +5,9 @@ namespace Database\Seeders; // use Illuminate\Database\Console\Seeds\WithoutModelEvents; use Illuminate\Database\Seeder; use App\Models\User; +use Illuminate\Support\Str; +use Faker\Factory as FakerFactory; +use Faker\Provider\id_ID\Person as Person; class DatabaseSeeder extends Seeder { @@ -13,11 +16,24 @@ class DatabaseSeeder extends Seeder */ public function run(): void { + $faker = FakerFactory::create(); + $faker->addProvider(new Person($faker)); + + User::factory()->create([ + 'id' => Str::uuid(), + 'nama' => $faker->name, + 'email' => fake()->unique()->safeEmail(), + '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'=> $faker->randomElement(['Progress', 'Finished']), + 'gender' => $faker->randomElement(['Laki-laki', 'Perempuan']), + ]); User::factory(100)->create(); - // \App\Models\User::factory()->create([ - // 'name' => 'Test User', - // 'email' => 'test@example.com', - // ]); } } diff --git a/public/assets/css/main.css b/public/assets/css/main.css new file mode 100644 index 00000000..e29ef200 --- /dev/null +++ b/public/assets/css/main.css @@ -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; +} diff --git a/public/assets/js/main.js b/public/assets/js/main.js new file mode 100644 index 00000000..5cdf2676 --- /dev/null +++ b/public/assets/js/main.js @@ -0,0 +1,321 @@ +/** +* Template Name: NiceAdmin +* Updated: Aug 30 2023 with Bootstrap v5.3.1 +* Template URL: https://bootstrapmade.com/nice-admin-bootstrap-admin-html-template/ +* Author: BootstrapMade.com +* License: https://bootstrapmade.com/license/ +*/ +(function() { + "use strict"; + + /** + * Easy selector helper function + */ + const select = (el, all = false) => { + el = el.trim() + if (all) { + return [...document.querySelectorAll(el)] + } else { + return document.querySelector(el) + } + } + + /** + * Easy event listener function + */ + const on = (type, el, listener, all = false) => { + if (all) { + select(el, all).forEach(e => e.addEventListener(type, listener)) + } else { + select(el, all).addEventListener(type, listener) + } + } + + /** + * Easy on scroll event listener + */ + const onscroll = (el, listener) => { + el.addEventListener('scroll', listener) + } + + /** + * Sidebar toggle + */ + if (select('.toggle-sidebar-btn')) { + on('click', '.toggle-sidebar-btn', function(e) { + select('body').classList.toggle('toggle-sidebar') + }) + } + + /** + * Search bar toggle + */ + if (select('.search-bar-toggle')) { + on('click', '.search-bar-toggle', function(e) { + select('.search-bar').classList.toggle('search-bar-show') + }) + } + + /** + * Navbar links active state on scroll + */ + let navbarlinks = select('#navbar .scrollto', true) + const navbarlinksActive = () => { + let position = window.scrollY + 200 + navbarlinks.forEach(navbarlink => { + if (!navbarlink.hash) return + let section = select(navbarlink.hash) + if (!section) return + if (position >= section.offsetTop && position <= (section.offsetTop + section.offsetHeight)) { + navbarlink.classList.add('active') + } else { + navbarlink.classList.remove('active') + } + }) + } + window.addEventListener('load', navbarlinksActive) + onscroll(document, navbarlinksActive) + + /** + * Toggle .header-scrolled class to #header when page is scrolled + */ + let selectHeader = select('#header') + if (selectHeader) { + const headerScrolled = () => { + if (window.scrollY > 100) { + selectHeader.classList.add('header-scrolled') + } else { + selectHeader.classList.remove('header-scrolled') + } + } + window.addEventListener('load', headerScrolled) + onscroll(document, headerScrolled) + } + + /** + * Back to top button + */ + let backtotop = select('.back-to-top') + if (backtotop) { + const toggleBacktotop = () => { + if (window.scrollY > 100) { + backtotop.classList.add('active') + } else { + backtotop.classList.remove('active') + } + } + window.addEventListener('load', toggleBacktotop) + onscroll(document, toggleBacktotop) + } + + /** + * Initiate tooltips + */ + var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')) + var tooltipList = tooltipTriggerList.map(function(tooltipTriggerEl) { + return new bootstrap.Tooltip(tooltipTriggerEl) + }) + + /** + * Initiate quill editors + */ + if (select('.quill-editor-default')) { + new Quill('.quill-editor-default', { + theme: 'snow' + }); + } + + if (select('.quill-editor-bubble')) { + new Quill('.quill-editor-bubble', { + theme: 'bubble' + }); + } + + if (select('.quill-editor-full')) { + new Quill(".quill-editor-full", { + modules: { + toolbar: [ + [{ + font: [] + }, { + size: [] + }], + ["bold", "italic", "underline", "strike"], + [{ + color: [] + }, + { + background: [] + } + ], + [{ + script: "super" + }, + { + script: "sub" + } + ], + [{ + list: "ordered" + }, + { + list: "bullet" + }, + { + indent: "-1" + }, + { + indent: "+1" + } + ], + ["direction", { + align: [] + }], + ["link", "image", "video"], + ["clean"] + ] + }, + theme: "snow" + }); + } + + /** + * Initiate TinyMCE Editor + */ + const useDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches; + const isSmallScreen = window.matchMedia('(max-width: 1023.5px)').matches; + + tinymce.init({ + selector: 'textarea.tinymce-editor', + plugins: 'preview importcss searchreplace autolink autosave save directionality code visualblocks visualchars fullscreen image link media template codesample table charmap pagebreak nonbreaking anchor insertdatetime advlist lists wordcount help charmap quickbars emoticons', + editimage_cors_hosts: ['picsum.photos'], + menubar: 'file edit view insert format tools table help', + toolbar: 'undo redo | bold italic underline strikethrough | fontfamily fontsize blocks | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist | forecolor backcolor removeformat | pagebreak | charmap emoticons | fullscreen preview save print | insertfile image media template link anchor codesample | ltr rtl', + toolbar_sticky: true, + toolbar_sticky_offset: isSmallScreen ? 102 : 108, + autosave_ask_before_unload: true, + autosave_interval: '30s', + autosave_prefix: '{path}{query}-{id}-', + autosave_restore_when_empty: false, + autosave_retention: '2m', + image_advtab: true, + link_list: [{ + title: 'My page 1', + value: 'https://www.tiny.cloud' + }, + { + title: 'My page 2', + value: 'http://www.moxiecode.com' + } + ], + image_list: [{ + title: 'My page 1', + value: 'https://www.tiny.cloud' + }, + { + title: 'My page 2', + value: 'http://www.moxiecode.com' + } + ], + image_class_list: [{ + title: 'None', + value: '' + }, + { + title: 'Some class', + value: 'class-name' + } + ], + importcss_append: true, + file_picker_callback: (callback, value, meta) => { + /* Provide file and text for the link dialog */ + if (meta.filetype === 'file') { + callback('https://www.google.com/logos/google.jpg', { + text: 'My text' + }); + } + + /* Provide image and alt text for the image dialog */ + if (meta.filetype === 'image') { + callback('https://www.google.com/logos/google.jpg', { + alt: 'My alt text' + }); + } + + /* Provide alternative source and posted for the media dialog */ + if (meta.filetype === 'media') { + callback('movie.mp4', { + source2: 'alt.ogg', + poster: 'https://www.google.com/logos/google.jpg' + }); + } + }, + templates: [{ + title: 'New Table', + description: 'creates a new table', + content: '
' + }, + { + title: 'Starting my story', + description: 'A cure for writers block', + content: 'Once upon a time...' + }, + { + title: 'New list with dates', + description: 'New List with dates', + content: '
cdate
mdate

My List

' + } + ], + template_cdate_format: '[Date Created (CDATE): %m/%d/%Y : %H:%M:%S]', + template_mdate_format: '[Date Modified (MDATE): %m/%d/%Y : %H:%M:%S]', + height: 600, + image_caption: true, + quickbars_selection_toolbar: 'bold italic | quicklink h2 h3 blockquote quickimage quicktable', + noneditable_class: 'mceNonEditable', + toolbar_mode: 'sliding', + contextmenu: 'link image table', + skin: useDarkMode ? 'oxide-dark' : 'oxide', + content_css: useDarkMode ? 'dark' : 'default', + content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }' + }); + + /** + * Initiate Bootstrap validation check + */ + var needsValidation = document.querySelectorAll('.needs-validation') + + Array.prototype.slice.call(needsValidation) + .forEach(function(form) { + form.addEventListener('submit', function(event) { + if (!form.checkValidity()) { + event.preventDefault() + event.stopPropagation() + } + + form.classList.add('was-validated') + }, false) + }) + + /** + * Initiate Datatables + */ + const datatables = select('.datatable', true) + datatables.forEach(datatable => { + new simpleDatatables.DataTable(datatable); + }) + + /** + * Autoresize echart charts + */ + const mainContainer = select('#main'); + if (mainContainer) { + setTimeout(() => { + new ResizeObserver(function() { + select('.echart', true).forEach(getEchart => { + echarts.getInstanceByDom(getEchart).resize(); + }) + }).observe(mainContainer); + }, 200); + } + + })(); \ No newline at end of file diff --git a/resources/views/index.blade.php b/resources/views/Admin/index.blade.php similarity index 100% rename from resources/views/index.blade.php rename to resources/views/Admin/index.blade.php diff --git a/resources/views/Admin/layout/main.blade.php b/resources/views/Admin/layout/main.blade.php index 58f67b3f..1e6cd737 100644 --- a/resources/views/Admin/layout/main.blade.php +++ b/resources/views/Admin/layout/main.blade.php @@ -136,7 +136,7 @@ - + diff --git a/resources/views/User/contact/add-contact.blade.php b/resources/views/User/contact/add-contact.blade.php new file mode 100644 index 00000000..059e990b --- /dev/null +++ b/resources/views/User/contact/add-contact.blade.php @@ -0,0 +1,45 @@ + \ No newline at end of file diff --git a/resources/views/User/contact/contact.blade.php b/resources/views/User/contact/contact.blade.php new file mode 100644 index 00000000..3a97c7a0 --- /dev/null +++ b/resources/views/User/contact/contact.blade.php @@ -0,0 +1,63 @@ +@extends('user.layout.main') +@section('content') +
+
+ +
+

Manajemen Contact

+
+ + + + +
+
+ + {{-- tabel list kontak --}} +
+
+
+
+
+ +
+
+
+
+ + + + + + + + + + + + @foreach ($contacts as $key => $contact) + + + + + + + + @endforeach + +
#EmailNamePhoneAction
{{ ++$key }}{{ $contact['email'] }}{{ $contact['name'] }}{{ $contact['phone'] }} + + {{-- Detail --}} + +
+
+
+
+
+
+ @extends('user.contact.detail-contact') + @extends('user.contact.delete-contact') + @extends('user.contact.add-contact') + +@endsection + diff --git a/resources/views/User/contact/delete-contact.blade.php b/resources/views/User/contact/delete-contact.blade.php new file mode 100644 index 00000000..63cccf9f --- /dev/null +++ b/resources/views/User/contact/delete-contact.blade.php @@ -0,0 +1,38 @@ + + + \ No newline at end of file diff --git a/resources/views/User/contact/detail-contact.blade.php b/resources/views/User/contact/detail-contact.blade.php new file mode 100644 index 00000000..82ede870 --- /dev/null +++ b/resources/views/User/contact/detail-contact.blade.php @@ -0,0 +1,62 @@ +{{-- @extends('user.layout.main') +@section('content') +
+
--}} +{{--
+
+
+

Detail Contact

+
+
+
+ @foreach ($detail_contact as $detail) +

Name: {{ $detail_contact->inputNama }}

+

No HP: {{ $detail_contact->inputNoHP }}

+

Email: {{ $detail_contact->inputEmail }}

+

Alamat: {{ $detail_contact->inputAlamat }}

+ + @endforeach +
+
+
+
--}} +{{--
+
+@endsection --}} + + diff --git a/resources/views/User/index.blade.php b/resources/views/User/index.blade.php index 0d1a4ed2..e5c70b5c 100644 --- a/resources/views/User/index.blade.php +++ b/resources/views/User/index.blade.php @@ -1,4 +1,4 @@ -@extends('User.layout.main') +@extends('user.layout.main') @section('content')
@@ -69,7 +69,7 @@

Total Refund

- 100 + 190
@@ -84,147 +84,72 @@
-

Total user

+

Total Transaction

- 100
+ 109
-
-
-

Transaction Summary Weekly progress

-
-
- - December 30, 2014 - January 28, 2015 -
-
-
+
+
+

INCOME

-
-
-
-
-
-
-
- Total Sessions -

231,809

- - - -
-
- Total Revenue -

$231,809

- - - -
-
- Total Sessions -

231,809

- - - -
-
- -
- -
-
-
-

Top Profiles

- -
-
- -
-
- +
+
+ + +
+
+
+

Transaction

+
+
+
+ + + + + + + + + + + @foreach ($refundUserss as $HistoryRefundUser) + + + + + + + + + + @endforeach +
Order IDCustomerSellerTotalDue DateStatusImage
+ {{ $HistoryRefundUser['orderId'] }} + {{ $HistoryRefundUser['Customer'] }} + {{ $HistoryRefundUser['seller'] }} + {{ $HistoryRefundUser['Total'] }}{{ $HistoryRefundUser['dueDate'] }} +
Diterima
+
+ {{ $HistoryRefundUser['uploadBukti'] }} + +
+
+
+
+
+
- @include('Admin.transaction.Tracking') @endsection diff --git a/resources/views/User/layout/header.blade.php b/resources/views/User/layout/header.blade.php index 95a8709a..e39bb54b 100644 --- a/resources/views/User/layout/header.blade.php +++ b/resources/views/User/layout/header.blade.php @@ -207,15 +207,15 @@