push project skripsi

This commit is contained in:
brilliantridho 2025-06-18 09:36:07 +07:00
commit ca56e8f535
106 changed files with 17944 additions and 0 deletions

66
README.md Normal file
View File

@ -0,0 +1,66 @@
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
<p align="center">
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>
## About Laravel
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
Laravel is accessible, powerful, and provides tools required for large, robust applications.
## Learning Laravel
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch.
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
## Laravel Sponsors
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the [Laravel Partners program](https://partners.laravel.com).
### Premium Partners
- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[WebReinvent](https://webreinvent.com/)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
- **[Cyber-Duck](https://cyber-duck.co.uk)**
- **[DevSquad](https://devsquad.com/hire-laravel-developers)**
- **[Jump24](https://jump24.co.uk)**
- **[Redberry](https://redberry.international/laravel/)**
- **[Active Logic](https://activelogic.com)**
- **[byte5](https://byte5.de)**
- **[OP.GG](https://op.gg)**
## Contributing
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
## Code of Conduct
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
## Security Vulnerabilities
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
## License
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

View File

@ -0,0 +1,45 @@
<?php
namespace App\Events;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class LocationUpdate
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public $kurirId;
public $latitude;
public $longitude;
/**
* Create a new event instance.
*/
public function __construct($kurirId, $latitude, $longitude)
{
$this->kurirId = $kurirId;
$this->latitude = $latitude;
$this->longitude = $longitude;
}
/**
* Get the channels the event should broadcast on.
*
* @return array<int, \Illuminate\Broadcasting\Channel>
*/
public function broadcastOn(): array
{
return new \Illuminate\Broadcasting\Channel('kurir-location');
}
public function broadcastAs()
{
return 'location.updated';
}
}

View File

@ -0,0 +1,39 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ConfirmsPasswords;
class ConfirmPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Confirm Password Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password confirmations and
| uses a simple trait to include the behavior. You're free to explore
| this trait and override any functions that require customization.
|
*/
use ConfirmsPasswords;
/**
* Where to redirect users when the intended url fails.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
class ForgotPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset emails and
| includes a trait which assists in sending these notifications from
| your application to your users. Feel free to explore this trait.
|
*/
use SendsPasswordResetEmails;
}

View File

@ -0,0 +1,63 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request; // Pastikan ini diimport
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Support\Facades\Auth;
class LoginController extends Controller
{
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/
use AuthenticatesUsers;
/**
* Where to redirect users after login.
*
* @var string
*/
public function login(Request $request)
{
$credentials = $request->validate([
'email' => 'required|email',
'password' => 'required',
]);
if (Auth::attempt($credentials, $request->remember)) {
$user = Auth::user();
// Redirect berdasarkan role
if ($user->role === 'owner') {
return redirect()->route('home');
} elseif ($user->role === 'kurir') {
return redirect()->route('kurir.dashboard');
}
// Redirect default jika role tidak dikenali
return redirect()->route('home');
}
// Jika login gagal, kembalikan dengan pesan error
return back()->withInput($request->only('email'))->with('error', 'Email atau password salah!');
}
/**
* Create a new controller instance.
*/
public function __construct()
{
// Hanya user yang belum login (guest) yang bisa mengakses method ini
$this->middleware('guest')->except('logout');
}
}

View File

@ -0,0 +1,57 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
class RegisterController extends Controller
{
/*
|--------------------------------------------------------------------------
| Register Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users as well as their
| validation and creation. By default this controller uses a trait to
| provide this functionality without requiring any additional code.
|
*/
use RegistersUsers;
protected $redirectTo = '/register'; // Tetap di halaman register setelah registrasi
public function __construct()
{
$this->middleware(['auth', 'role:owner']);
}
public function showRegistrationForm()
{
return view('auth.register');
}
protected function validator(array $data)
{
return Validator::make($data, [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => ['required', 'string', 'min:8', 'confirmed'],
'role' => ['required', 'string', 'in:kurir,owner'], // Validasi role
]);
}
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => Hash::make($data['password']),
'role' => $data['role'], // Simpan role ke database
]);
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;
class ResetPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
use ResetsPasswords;
/**
* Where to redirect users after resetting their password.
*
* @var string
*/
protected $redirectTo = '/home';
}

View File

@ -0,0 +1,41 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\VerifiesEmails;
class VerificationController extends Controller
{
/*
|--------------------------------------------------------------------------
| Email Verification Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling email verification for any
| user that recently registered with the application. Emails may also
| be re-sent if the user didn't receive the original email message.
|
*/
use VerifiesEmails;
/**
* Where to redirect users after verification.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
$this->middleware('signed')->only('verify');
$this->middleware('throttle:6,1')->only('verify', 'resend');
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{
use AuthorizesRequests, ValidatesRequests;
}

View File

@ -0,0 +1,84 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Location;
use App\Models\Order;
use App\Models\User;
use Carbon\Carbon;
class HomeController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function index()
{
$totalGajiKurir = Order::whereNotNull('kurir_id')
->whereMonth('created_at', Carbon::now()->month)
->whereYear('created_at', Carbon::now()->year)
->count() * 5000;
$totalOrders = Order::whereMonth('created_at', Carbon::now()->month)
->count();
$ordersProcessing = Order::where('status', 'Assigned')->count();
$ordersCompleted = Order::where('status', 'Delivered')->count();
// Ambil semua kurir
$kurirs = User::where('role', 'kurir')->get();
$today = now()->format('Y-m-d');
// Ambil lokasi terbaru per user hari ini
$latestLocations = Location::select('user_id', 'latitude', 'longitude', 'created_at')
->whereDate('created_at', $today)
->latest('created_at')
->get()
->keyBy('user_id'); // Supaya bisa diakses pakai $latestLocations[$kurir->id]
// Ambil semua lokasi yang sudah diupload oleh kurir, termasuk informasi user (kurir)
$locations = Location::with('user')
->select('locations.*')
->join(Location::raw('(
SELECT user_id, MAX(id) as latest_id
FROM locations
WHERE DATE(created_at) = CURDATE()
GROUP BY user_id
) as latest'), function ($join) {
$join->on('locations.user_id', '=', 'latest.user_id')
->on('locations.id', '=', 'latest.latest_id');
})
->get();
$today = now()->format('Y-m-d');
$locationsPresence = Location::with('user')
->select('user_id', Location::raw('MIN(created_at) as check_in_time'))
->whereDate('created_at', $today)
->groupBy('user_id')
->get();
$presensiCount = $locationsPresence->count();
$presensiRecords = Location::with('user')
->select('user_id', Location::raw('MIN(created_at) as check_in_time'))
->whereDate('created_at', $today)
->groupBy('user_id')
->get();
return view('home', compact('locations', 'totalOrders', 'ordersProcessing', 'ordersCompleted',
'totalGajiKurir', 'presensiCount', 'presensiRecords', 'kurirs', 'latestLocations'));
}
}

View File

@ -0,0 +1,63 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Order;
use App\Models\User;
use App\Models\Location;
use Illuminate\Support\Facades\Auth;
use App\Http\Controllers\Controller;
use Carbon\Carbon;
class KurirDashboardController extends Controller
{
public function indexKurir()
{
$kurirId = auth()->id(); // Ambil ID kurir yang sedang login'
$totalOrders = Order::where('kurir_id', $kurirId)
->whereDate('created_at', Carbon::today())
->count();
$ordersProcessing = Order::where('kurir_id', $kurirId)
->where('status', 'Assigned')
->whereDate('created_at', Carbon::today())
->count();
$ordersCompleted = Order::where('kurir_id', $kurirId)
->where('status', 'Delivered')
->whereDate('created_at', Carbon::today())
->count();
$locations = Location::where('user_id', $kurirId)
->whereDate('created_at', Carbon::today()) // Hanya ambil data dari hari ini
->get();
$estimateSalary = $ordersCompleted * 5000;
return view('kurir.dashboard', compact('totalOrders', 'ordersProcessing', 'ordersCompleted', 'locations', 'estimateSalary'));
}
public function updateLocation(Request $request)
{
$request->validate([
'order_id' => 'required|exists:orders,id',
'kurir_id' => 'required|exists:users,id',
'latitude' => 'required|numeric',
'longitude' => 'required|numeric',
]);
Location::create([
'user_id' => $request->kurir_id,
'latitude' => $request->latitude,
'longitude' => $request->longitude,
'order_id' => $request->order_id
]);
return response()->json(['message' => 'Lokasi terkini berhasil dikirim']);
}
}

View File

@ -0,0 +1,83 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use App\Models\Location;
use Carbon\Carbon;
class LocationController extends Controller
{
public function index()
{
$locations = Location::where('user_id', auth()->id())
->whereDate('created_at', Carbon::today()) // Hanya ambil data dari hari ini
->get();
return view('kurir.dashboard', compact('locations'));
}
// Simpan lokasi yang diupload (via AJAX)
public function store(Request $request)
{
if (!auth()->check()) {
return response()->json([
'success' => false,
'message' => 'User belum login'
], 401);
}
$request->validate([
'latitude' => 'required|numeric',
'longitude' => 'required|numeric',
]);
$location = Location::create([
'user_id' => auth()->id(),
'latitude' => $request->latitude,
'longitude' => $request->longitude,
]);
return response()->json([
'success' => true,
'location' => $location,
]);
}
public function update(Request $request)
{
Location::updateOrCreate(
['user_id' => Auth::id()],
[
'latitude' => $request->latitude,
'longitude' => $request->longitude,
]
);
return response()->json(['message' => 'Lokasi berhasil diperbarui']);
}
public function cleanupYesterday()
{
$yesterday = now()->subDay()->toDateString();
$idsToKeep = Location::select(DB::raw('MIN(id) as id'))
->whereDate('created_at', $yesterday)
->groupBy('user_id')
->pluck('id');
$query = Location::whereDate('created_at', $yesterday)
->whereNotIn('id', $idsToKeep);
$deleted = $query->count(); // Hitung dulu sebelum delete
if ($deleted > 0) {
$query->delete();
return redirect()->back()->with('success', 'Data kemarin dibersihkan.');
}
return redirect()->back()->with('info', 'Data kemarin sudah bersih, tidak ada yang perlu dihapus.');
}
}

View File

@ -0,0 +1,171 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Order;
use App\Models\User;
use Carbon\Carbon;
use Illuminate\Support\Facades\Storage;
class OrderController extends Controller
{
public function indexOrderKurir(Request $request)
{
// Ambil tanggal dari request, default ke hari ini jika tidak dipilih
$filterDate = $request->input('filter_date', Carbon::today()->toDateString());
// Ambil order yang ditugaskan kepada kurir yang sedang login
$orders = Order::where('kurir_id', auth()->id())
->whereDate('updated_at', $filterDate)
->get();
return view('kurir.order', compact('orders', 'filterDate'));
}
public function indexCustomer()
{
$orders = Order::with('kurir')->latest()->get();
$kurirs = User::where('role', 'kurir')->get(); // Ambil daftar kurir
return view('customer.index', compact('orders', 'kurirs'));
}
public function index(Request $request)
{
$totalOrders = Order::count();
$ordersProcessing = Order::where('status', 'Assigned')->count();
$ordersCompleted = Order::where('status', 'Delivered')->count();
$filterDate = $request->input('filter_date', Carbon::today()->toDateString());
// $orders = Order::where('owner_id', auth()->id())
// ->whereDate('updated_at', $filterDate) --> Order pakai Owner_id
$orders = Order::whereDate('updated_at', $filterDate)
->get();
$kurirs = User::where('role', 'kurir')->get(); // Ambil kurir dari tabel users
return view('orders.index', compact('orders', 'kurirs', 'filterDate', 'totalOrders', 'ordersProcessing', 'ordersCompleted'));
}
// Tampilkan form tambah pesanan (hanya untuk owner)
public function create()
{
// Menampilkan form untuk menambah order
$kurirs = User::where('role', 'kurir')->get(); // Ambil kurir dari tabel users
return view('orders.create', compact('kurirs'));
}
// Simpan pesanan baru (hanya untuk owner)
public function store(Request $request)
{
$request->validate([
'recipient_name' => 'required|string|max:255',
'address' => 'required|string|max:255',
'description' => 'required|string|max:255',
'kurir_id' => 'required|exists:users,id', // Pastikan kurir ada di tabel users
]);
Order::create([
// 'owner_id' => auth()->id(), // ID pemilik yang sedang login
'kurir_id' => $request->kurir_id,
'recipient_name' => $request->recipient_name,
'address' => $request->address,
'description' => $request->description,
'status' => 'Assigned', // Status awal pesanan
]);
return redirect()->route('orders.index')->with('success', 'Pesanan berhasil ditambahkan!');
}
// Order Store untuk Customer
public function Customer(Request $request)
{
$request->validate([
'recipient_name' => 'required|string|max:255',
'address' => 'required|string',
'description' => 'required|string',
'kurir_id' => 'required|exists:users,id',
]);
Order::create([
'user_id' => auth()->id(),
'recipient_name' => $request->recipient_name,
'address' => $request->address,
'description' => $request->description,
'kurir_id' => $request->kurir_id,
'status' => 'Assigned', // Status awal pesanan
]);
return response()->json([
'success' => true,
'message' => 'Pesanan berhasil ditambahkan!',
'order' => $order->load('kurir'), // Sertakan data kurir dalam response
]);
}
public function updateStatus($id)
{
$order = Order::findOrFail($id);
if ($order->status === 'Assigned') {
$order->status = 'Delivered';
$order->save();
return redirect()->back()->with('success', 'Status pesanan berhasil diperbarui!');
}
return redirect()->back()->with('error', 'Pesanan sudah dikirim atau selesai.');
}
public function deliveredOrders()
{
$deliveredOrders = Order::where('status', 'Delivered')->get(); // Ambil pesanan yang sudah delivered
return view('kurir.deliveredOrders', compact('deliveredOrders'));
}
public function sendLocation(Request $request)
{
if (!auth()->check()) {
return response()->json([
'success' => false,
'message' => 'User belum login'
], 401);
}
$request->validate([
'latitude' => 'required|numeric',
'longitude' => 'required|numeric',
]);
$location = Location::create([
'user_id' => auth()->id(),
'latitude' => $request->latitude,
'longitude' => $request->longitude,
]);
return response()->json([
'success' => true,
'location' => $location,
]);
}
public function uploadBuktiPengiriman(Request $request, $id)
{
$request->validate([
'image' => 'required|image'
]);
$order = Order::findOrFail($id);
if ($request->hasFile('image')) {
$path = $request->file('image')->store('public/bukti_pengiriman');
$order->bukti_pengiriman = str_replace('public/', '', $path);
$order->status = 'Delivered';
$order->save();
return response()->json(['success' => true, 'message' => 'Bukti pengiriman berhasil disimpan']);
}
return response()->json(['success' => false, 'error' => 'Gagal menyimpan gambar'], 500);
}
}

View File

@ -0,0 +1,45 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Location;
use App\Models\User;
use Carbon\Carbon;
class PresenceController extends Controller
{
public function index()
{
// Ambil semua data presensi (upload lokasi)
$presences = Location::with('user')
->select('user_id', 'created_at')
->orderBy('created_at')
->get();
// Mapping data menjadi [tanggal => [nama kurir, ...]]
$presenceData = [];
foreach ($presences as $presence) {
$date = Carbon::parse($presence->created_at)->toDateString();
$name = $presence->user->name;
// Hindari duplikat nama di tanggal yang sama
if (!isset($presenceData[$date])) {
$presenceData[$date] = [];
}
if (!in_array($name, $presenceData[$date])) {
$presenceData[$date][] = $name;
}
$today = now()->format('Y-m-d');
$presensiRecords = Location::with('user')
->select('user_id', Location::raw('MIN(created_at) as check_in_time'))
->whereDate('created_at', $today)
->groupBy('user_id')
->get();
}
return view('presensi.index', compact('presenceData', 'presensiRecords'));
}
}

View File

@ -0,0 +1,259 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Carbon\Carbon;
use App\Models\Order;
use App\Models\Location;
use App\Models\User;
class ReportController extends Controller
{
public function index(Request $request)
{
// Ambil bulan dan tahun dari request, default ke bulan & tahun saat ini
$month = $request->input('month', now()->month);
$year = $request->input('year', now()->year);
// Ambil semua kurir dari tabel users (urutkan agar konsisten)
$kurirs = User::where('role', 'kurir')->orderBy('name')->get();
$kurirNames = $kurirs->pluck('name')->toArray();
// Hitung total pesanan per kurir pada bulan tertentu
$totalOrders = Order::select('kurir_id', Order::raw('COUNT(*) as total_orders'))
->whereMonth('created_at', $month)
->whereYear('created_at', $year)
->groupBy('kurir_id')
->pluck('total_orders', 'kurir_id');
// Ambil data presensi pertama per hari per kurir
$presences = Location::select('user_id', Location::raw('DATE(created_at) as date'), Location::raw('MIN(created_at) as check_in_time'))
->whereMonth('created_at', $month)
->whereYear('created_at', $year)
->groupBy('user_id', 'date')
->get();
// Hitung total presensi per kurir
$totalPresences = $presences->groupBy('user_id')->map->count();
// Hitung total presensi on-time (check-in sebelum 07:30)
$ontimeCount = $presences->filter(function ($presence) {
return Carbon::parse($presence->check_in_time)->format('H:i') < '07:30';
})->groupBy('user_id')->map->count();
// Hitung jumlah hari kurir mencapai target (lebih dari 5 order per hari)
$onTargetCount = Order::select('kurir_id', Order::raw('COUNT(*) as total_orders'), Order::raw('DATE(created_at) as order_date'))
->whereMonth('created_at', $month)
->whereYear('created_at', $year)
->groupBy('kurir_id', 'order_date')
->havingRaw('COUNT(*) > 5') // Hitung hanya hari dengan >5 order
->get()
->groupBy('kurir_id')
->map(fn($orders) => $orders->count()); // Hitung jumlah hari
// Mapping semua data ke dalam urutan $kurirs
$totalOrdersData = [];
$totalPresencesData = [];
$ontimePresencesData = [];
$totalDaysWorkedData = [];
foreach ($kurirs as $kurir) {
$kurirId = $kurir->id;
$totalOrdersData[] = $totalOrders[$kurirId] ?? 0;
$totalPresencesData[] = $totalPresences[$kurirId] ?? 0;
$ontimePresencesData[] = $ontimeCount[$kurirId] ?? 0;
// Optional: kalau kamu ingin "Total Hari Kerja" sama dengan total presensi
$totalDaysWorkedData[] = $totalPresences[$kurirId] ?? 0;
}
// Hitung predikat
$penilaian = $kurirs->map(function ($kurir) use ($onTargetCount, $ontimeCount) {
$targetHarian = $onTargetCount[$kurir->id] ?? 0;
$ontime = $ontimeCount[$kurir->id] ?? 0;
$total = $targetHarian + $ontime;
// Cek apakah keduanya memenuhi minimal 5
if ($ontime >= 5 && $targetHarian >= 5) {
$total = $targetHarian + $ontime;
if ($total >= 20 && $total <= 30) {
$predikat = 'Baik Sekali';
} elseif ($total >= 15 && $total < 20) {
$predikat = 'Baik';
} elseif ($total >= 5) {
$predikat = 'Cukup';
} else {
$predikat = '-';
}
} else {
// Jika salah satu belum memenuhi minimal 5, tidak diberi predikat
$predikat = '-';
}
return [
'id' => $kurir->id, // ✅ tambahkan ID
'nama_kurir' => $kurir->name,
'target_harian' => $targetHarian,
'ontime' => $ontime,
'predikat' => $predikat
];
});
return view('report.index', compact('totalOrdersData', 'kurirs', 'kurirNames',
'totalPresencesData', 'ontimePresencesData', 'totalDaysWorkedData',
'onTargetCount', 'month', 'year', 'penilaian'));
}
public function generatePdf($kurir_id)
{
$kurir = Kurir::findOrFail($kurir_id);
// Data yang akan dikirim ke view
$data = [
'kurir' => $kurir,
'total_pesanan' => $kurir->total_pesanan,
'on_target' => $kurir->on_target,
'total_presensi' => $kurir->total_presensi,
'on_time' => $kurir->on_time,
];
// Load view dan generate PDF
$pdf = PDF::loadView('report.kurir', $data);
// Download PDF dengan nama sesuai kurir
return $pdf->download('Laporan_Kinerja_'.$kurir->nama.'.pdf');
}
public function cetakKinerja($id, $month, $year)
{
// Ambil data kurir berdasarkan ID
$kurir = User::findOrFail($id);
$posisi = User::where('role', 'kurir');
$formattedMonthYear = Carbon::createFromDate($year, $month, 1)->translatedFormat('F Y');
// Hitung total pesanan per kurir pada bulan tertentu
$totalOrders = Order::select('kurir_id', Order::raw('COUNT(*) as total_orders'))
->whereMonth('created_at', $month)
->whereYear('created_at', $year)
->groupBy('kurir_id')
->pluck('total_orders', 'kurir_id');
// Ambil data presensi pertama per hari per kurir
$presences = Location::select('user_id', Location::raw('DATE(created_at) as date'), Location::raw('MIN(created_at) as check_in_time'))
->whereMonth('created_at', $month)
->whereYear('created_at', $year)
->groupBy('user_id', 'date')
->get();
// Total hari kerja (jumlah presensi hari unik untuk kurir ini)
$total_hari_kerja = $presences->where('user_id', $id)->count();
// Total ontime (presensi sebelum jam 07:30)
$total_ontime = $presences
->where('user_id', $id)
->filter(fn($presence) => Carbon::parse($presence->check_in_time)->format('H:i') < '07:30')
->count();
// Hitung jumlah hari kurir mencapai target (lebih dari 5 order per hari)
$onTargetCount = Order::select('kurir_id', Order::raw('COUNT(*) as total_orders'), Order::raw('DATE(created_at) as order_date'))
->whereMonth('created_at', $month)
->whereYear('created_at', $year)
->groupBy('kurir_id', 'order_date')
->havingRaw('COUNT(*) > 5')
->get()
->where('kurir_id', $id)
->count();
// Cek apakah keduanya memenuhi minimal 5
if ($total_ontime >= 5 && $onTargetCount >= 5) {
$total = $onTargetCount + $total_ontime;
if ($total >= 20 && $total <= 30) {
$predikat = 'Baik Sekali';
} elseif ($total >= 15 && $total < 20) {
$predikat = 'Baik';
} elseif ($total >= 5) {
$predikat = 'Cukup';
}
} else {
// Jika salah satu belum memenuhi minimal 5, tidak diberi predikat
$predikat = '-';
}
$kinerja = [
'total_hari_kerja' => $total_hari_kerja,
'total_ontime' => $total_ontime,
'total_ontarget' => $onTargetCount,
'predikat' => $predikat,
];
return view('report.cetak', compact('kurir', 'kinerja', 'month', 'year', 'posisi', 'formattedMonthYear'));
}
public function cetakSemuaKinerja($month, $year)
{
$users = User::where('role', 'kurir')->get();
$data = $users->map(function ($kurir) use ($month, $year) {
$presences = Location::select('user_id', DB::raw('DATE(created_at) as date'), DB::raw('MIN(created_at) as check_in_time'))
->where('user_id', $kurir->id)
->whereMonth('created_at', $month)
->whereYear('created_at', $year)
->groupBy('user_id', 'date')
->get();
$totalHariKerja = $presences->count();
$totalOnTime = $presences->filter(function ($presence) {
return Carbon::parse($presence->check_in_time)->format('H:i') < '07:30';
})->count();
$onTarget = Order::select(DB::raw('DATE(created_at) as order_date'), DB::raw('COUNT(*) as total'))
->where('kurir_id', $kurir->id)
->whereMonth('created_at', $month)
->whereYear('created_at', $year)
->groupBy('order_date')
->havingRaw('COUNT(*) > 5')
->get()
->count();
if ($totalOnTime >= 5 && $onTarget >= 5) {
$total = $onTarget + $totalOnTime;
if ($total >= 20 && $total <= 30) {
$predikat = 'Baik Sekali';
} elseif ($total >= 15 && $total < 20) {
$predikat = 'Baik';
} elseif ($total >= 5) {
$predikat = 'Cukup';
}
} else {
// Jika salah satu belum memenuhi minimal 5, tidak diberi predikat
$predikat = '-';
}
return [
'nama' => $kurir->name,
'total_hari_kerja' => $totalHariKerja,
'total_ontime' => $totalOnTime,
'total_ontarget' => $onTarget,
'predikat' => $predikat,
];
});
return view('report.cetak-semua', [
'data' => $data,
'month' => $month,
'year' => $year
]);
}
}

View File

@ -0,0 +1,63 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Location;
use App\Models\Order;
use Carbon\Carbon;
class ReportKurirController extends Controller
{
public function index(Request $request)
{
$month = $request->month ?? now()->month;
$year = $request->year ?? now()->year;
$userId = auth()->id();
// Ambil presensi (lokasi pertama per hari)
$presences = Location::select('user_id', Location::raw('DATE(created_at) as date'), Location::raw('MIN(created_at) as check_in_time'))
->where('user_id', $userId)
->whereMonth('created_at', $month)
->whereYear('created_at', $year)
->groupBy('user_id', 'date')
->get();
// Hitung presensi yang ontime
$ontimePresensi = $presences->filter(function ($presence) {
return Carbon::parse($presence->check_in_time)->format('H:i') < '07:30';
})->count();
// Hitung hari on target (≥5 order per hari)
$onTargetDays = Order::selectRaw('DATE(created_at) as date')
->where('kurir_id', $userId)
->whereMonth('created_at', $month)
->whereYear('created_at', $year)
->groupBy('date')
->havingRaw('COUNT(*) >= 5')
->get()
->count();
$totalNilai = $ontimePresensi + $onTargetDays;
// Predikat berdasarkan total nilai
if ($totalNilai >= 20 && $totalNilai <= 30) {
$predikat = 'Baik Sekali';
} elseif ($totalNilai >= 15 && $totalNilai < 20) {
$predikat = 'Baik';
} elseif ($totalNilai >= 5) {
$predikat = 'Perfect';
} else {
$predikat = '-';
}
return view('kurir.report', compact(
'month', 'year',
'ontimePresensi',
'onTargetDays',
'predikat'
));
}
}

View File

@ -0,0 +1,60 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\User;
use Carbon\Carbon;
use App\Models\Order;
use Barryvdh\DomPDF\Facade\Pdf;
class SalaryController extends Controller
{
public function index(Request $request)
{
// Ambil tanggal dari request atau default ke bulan ini
$startDate = $request->startDate ?? Carbon::now()->startOfMonth()->toDateString();
$endDate = $request->endDate ?? Carbon::now()->endOfMonth()->toDateString();
// Ambil data gaji kurir berdasarkan order dalam periode tertentu
$courierSalaries = User::whereHas('ordersAsKurir', function ($query) use ($startDate, $endDate) {
$query->whereBetween('created_at', [$startDate, $endDate]);
})->with(['ordersAsKurir' => function ($query) use ($startDate, $endDate) {
$query->whereBetween('created_at', [$startDate, $endDate]);
}])->get()->map(function ($kurir) {
$totalOrders = $kurir->ordersAsKurir->count();
return (object) [
'courier_id' => $kurir->id,
'courier_name' => $kurir->name,
'total_orders' => $totalOrders,
'salary_per_order' => 5000, // Pastikan field ini ada di database
'total_salary' => $totalOrders * 5000,
'last_order_date' => $kurir->ordersAsKurir->max('created_at') ?? '-',
];
});
// Hitung total gaji semua kurir
$totalSalary = $courierSalaries->sum('total_salary');
$query = Order::whereNotNull('kurir_id');
if ($startDate && $endDate) {
$query->whereBetween('created_at', [$startDate, $endDate]);
} else {
// Default: bulan ini
$query->whereMonth('created_at', now()->month)
->whereYear('created_at', now()->year);
}
$totalGajiKurir = $query->count() * 5000;
return view('salary.index', compact('courierSalaries', 'totalSalary', 'startDate', 'endDate', 'totalGajiKurir'));
}
public function printPDF()
{
$kurirs = User::where('role', 'kurir')->get(); // Ambil kurir dari tabel users
$pdf = Pdf::loadView('salary.print', compact('kurirs'));
return $pdf->download('gaji_kurir.pdf');
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Location;
class TrackingController extends Controller
{
public function getLatestLocation($id)
{
$latest = Location::where('user_id', $id)
->latest('created_at')
->first();
return response()->json([
'lat' => $latest->latitude,
'lng' => $latest->longitude,
]);
}
public function showTracking($id)
{
return view('tracking', ['kurirId' => $id]);
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
use Illuminate\Support\Facades\Auth;
class RoleMiddleware
{
public function handle(Request $request, Closure $next, $role)
{
if (!Auth::check() || Auth::user()->role !== $role) {
abort(403, 'Unauthorized action.');
}
return $next($request);
}
}

18
app/Models/Location.php Normal file
View File

@ -0,0 +1,18 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Location extends Model
{
use HasFactory;
protected $fillable = ['user_id','latitude', 'longitude'];
public function user()
{
return $this->belongsTo(User::class);
}
}

34
app/Models/Order.php Normal file
View File

@ -0,0 +1,34 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class Order extends Model
{
use HasFactory;
// protected $table = 'orders';
protected $fillable = ['owner_id', 'kurir_id', 'recipient_name', 'address', 'description', 'status'];
// protected $attributes = [
// 'harga' => 15000, // Harga default per pesanan
// ];
public function getGajiKurirAttribute()
{
return 5000;
}
// Relasi ke tabel users (kurir)
public function owner()
{
return $this->belongsTo(User::class, 'owner_id');
}
public function kurir()
{
return $this->belongsTo(User::class, 'kurir_id');
}
}

18
app/Models/Presence.php Normal file
View File

@ -0,0 +1,18 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Presence extends Model
{
protected $fillable = ['user_id', 'created_at'];
public $timestamps = false; // karena kita cuma pakai created_at
public function presences()
{
return $this->hasMany(Presence::class);
}
}

60
app/Models/User.php Normal file
View File

@ -0,0 +1,60 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
/** @use HasFactory<\Database\Factories\UserFactory> */
use HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'name',
'email',
'password',
'role',
'salary_per_order',
];
public function ordersAsKurir()
{
return $this->hasMany(Order::class, 'kurir_id');
}
public function ordersAsOwner()
{
return $this->hasMany(Order::class, 'owner_id');
}
/**
* The attributes that should be hidden for serialization.
*
* @var list<string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
//
}
}

15
artisan Normal file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env php
<?php
use Symfony\Component\Console\Input\ArgvInput;
define('LARAVEL_START', microtime(true));
// Register the Composer autoloader...
require __DIR__.'/vendor/autoload.php';
// Bootstrap Laravel and handle the command...
$status = (require_once __DIR__.'/bootstrap/app.php')
->handleCommand(new ArgvInput);
exit($status);

22
bootstrap/app.php Normal file
View File

@ -0,0 +1,22 @@
<?php
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
use App\Http\Middleware\RoleMiddleware;
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
commands: __DIR__.'/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware) {
$middleware->alias([
'role' => RoleMiddleware::class,
]);
})
->withExceptions(function (Exceptions $exceptions) {
//
})->create();

2
bootstrap/cache/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

5
bootstrap/providers.php Normal file
View File

@ -0,0 +1,5 @@
<?php
return [
App\Providers\AppServiceProvider::class,
];

74
composer.json Normal file
View File

@ -0,0 +1,74 @@
{
"$schema": "https://getcomposer.org/schema.json",
"name": "laravel/laravel",
"type": "project",
"description": "The skeleton application for the Laravel framework.",
"keywords": ["laravel", "framework"],
"license": "MIT",
"require": {
"php": "^8.2",
"barryvdh/laravel-dompdf": "^3.1",
"laravel/framework": "^11.31",
"laravel/tinker": "^2.9",
"laravel/ui": "^4.6",
"pusher/pusher-php-server": "^7.2"
},
"require-dev": {
"fakerphp/faker": "^1.23",
"laravel/pail": "^1.1",
"laravel/pint": "^1.13",
"laravel/sail": "^1.26",
"mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.1",
"phpunit/phpunit": "^11.0.1"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi",
"@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"",
"@php artisan migrate --graceful --ansi"
],
"dev": [
"Composer\\Config::disableProcessTimeout",
"npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1\" \"php artisan pail --timeout=0\" \"npm run dev\" --names=server,queue,logs,vite"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"php-http/discovery": true
}
},
"minimum-stability": "stable",
"prefer-stable": true
}

8668
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

127
config/app.php Normal file
View File

@ -0,0 +1,127 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application, which will be used when the
| framework needs to place the application's name in a notification or
| other UI elements where an application name needs to be displayed.
|
*/
'name' => env('APP_NAME', 'Laravel'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => (bool) env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| the application so that it's available within Artisan commands.
|
*/
'url' => env('APP_URL', 'http://localhost'),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. The timezone
| is set to "UTC" by default as it is suitable for most use cases.
|
*/
'timezone' => env('APP_TIMEZONE', 'UTC'),
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by Laravel's translation / localization methods. This option can be
| set to any locale for which you plan to have translation strings.
|
*/
'locale' => env('APP_LOCALE', 'id'),
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'id'),
'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'),
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is utilized by Laravel's encryption services and should be set
| to a random, 32 character string to ensure that all encrypted values
| are secure. You should do this prior to deploying the application.
|
*/
'cipher' => 'AES-256-CBC',
'key' => env('APP_KEY'),
'previous_keys' => [
...array_filter(
explode(',', env('APP_PREVIOUS_KEYS', ''))
),
],
/*
|--------------------------------------------------------------------------
| Maintenance Mode Driver
|--------------------------------------------------------------------------
|
| These configuration options determine the driver used to determine and
| manage Laravel's "maintenance mode" status. The "cache" driver will
| allow maintenance mode to be controlled across multiple machines.
|
| Supported drivers: "file", "cache"
|
*/
'maintenance' => [
'driver' => env('APP_MAINTENANCE_DRIVER', 'file'),
'store' => env('APP_MAINTENANCE_STORE', 'database'),
],
];

115
config/auth.php Normal file
View File

@ -0,0 +1,115 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option defines the default authentication "guard" and password
| reset "broker" for your application. You may change these values
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
'guard' => env('AUTH_GUARD', 'web'),
'passwords' => env('AUTH_PASSWORD_BROKER', 'users'),
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| which utilizes session storage plus the Eloquent user provider.
|
| All authentication guards have a user provider, which defines how the
| users are actually retrieved out of your database or other storage
| system used by the application. Typically, Eloquent is utilized.
|
| Supported: "session"
|
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication guards have a user provider, which defines how the
| users are actually retrieved out of your database or other storage
| system used by the application. Typically, Eloquent is utilized.
|
| If you have multiple user tables or models you may configure multiple
| providers to represent the model / table. These providers may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => env('AUTH_MODEL', App\Models\User::class),
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| These configuration options specify the behavior of Laravel's password
| reset functionality, including the table utilized for token storage
| and the user provider that is invoked to actually retrieve users.
|
| The expiry time is the number of minutes that each reset token will be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
| The throttle setting is the number of seconds a user must wait before
| generating more password reset tokens. This prevents the user from
| quickly generating a very large amount of password reset tokens.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'),
'expire' => 60,
'throttle' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the amount of seconds before a password confirmation
| window expires and users are asked to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800),
];

108
config/cache.php Normal file
View File

@ -0,0 +1,108 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache store that will be used by the
| framework. This connection is utilized if another isn't explicitly
| specified when running a cache operation inside the application.
|
*/
'default' => env('CACHE_STORE', 'database'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
| Supported drivers: "array", "database", "file", "memcached",
| "redis", "dynamodb", "octane", "null"
|
*/
'stores' => [
'array' => [
'driver' => 'array',
'serialize' => false,
],
'database' => [
'driver' => 'database',
'connection' => env('DB_CACHE_CONNECTION'),
'table' => env('DB_CACHE_TABLE', 'cache'),
'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'),
'lock_table' => env('DB_CACHE_LOCK_TABLE'),
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
'lock_path' => storage_path('framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => env('REDIS_CACHE_CONNECTION', 'cache'),
'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'),
],
'dynamodb' => [
'driver' => 'dynamodb',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
'endpoint' => env('DYNAMODB_ENDPOINT'),
],
'octane' => [
'driver' => 'octane',
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing the APC, database, memcached, Redis, and DynamoDB cache
| stores, there might be other applications using the same cache. For
| that reason, you may prefix every cache key to avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'),
];

173
config/database.php Normal file
View File

@ -0,0 +1,173 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for database operations. This is
| the connection which will be utilized unless another connection
| is explicitly specified when you execute a query / statement.
|
*/
'default' => env('DB_CONNECTION', 'sqlite'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Below are all of the database connections defined for your application.
| An example configuration is provided for each database system which
| is supported by Laravel. You're free to add / remove connections.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DB_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
'busy_timeout' => null,
'journal_mode' => null,
'synchronous' => null,
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'mariadb' => [
'driver' => 'mariadb',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
'search_path' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DB_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run on the database.
|
*/
'migrations' => [
'table' => 'migrations',
'update_date_on_publish' => true,
],
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer body of commands than a typical key-value system
| such as Memcached. You may define your connection settings here.
|
*/
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
],
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
],
],
];

80
config/filesystems.php Normal file
View File

@ -0,0 +1,80 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application for file storage.
|
*/
'default' => env('FILESYSTEM_DISK', 'local'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Below you may configure as many filesystem disks as necessary, and you
| may even configure multiple disks for the same driver. Examples for
| most supported storage drivers are configured here for reference.
|
| Supported drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app/private'),
'serve' => true,
'throw' => false,
'report' => false,
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
'throw' => false,
'report' => false,
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
'throw' => false,
'report' => false,
],
],
/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/
'links' => [
public_path('storage') => storage_path('app/public'),
],
];

132
config/logging.php Normal file
View File

@ -0,0 +1,132 @@
<?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
use Monolog\Processor\PsrLogMessageProcessor;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that is utilized to write
| messages to your logs. The value provided here should match one of
| the channels present in the list of "channels" configured below.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Deprecations Log Channel
|--------------------------------------------------------------------------
|
| This option controls the log channel that should be used to log warnings
| regarding deprecated PHP and library features. This allows you to get
| your application ready for upcoming major versions of dependencies.
|
*/
'deprecations' => [
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
'trace' => env('LOG_DEPRECATIONS_TRACE', false),
],
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Laravel
| utilizes the Monolog PHP logging library, which includes a variety
| of powerful log handlers and formatters that you're free to use.
|
| Available drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog", "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => explode(',', env('LOG_STACK', 'single')),
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => env('LOG_DAILY_DAYS', 14),
'replace_placeholders' => true,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => env('LOG_SLACK_USERNAME', 'Laravel Log'),
'emoji' => env('LOG_SLACK_EMOJI', ':boom:'),
'level' => env('LOG_LEVEL', 'critical'),
'replace_placeholders' => true,
],
'papertrail' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
],
'processors' => [PsrLogMessageProcessor::class],
],
'stderr' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDERR_FORMATTER'),
'with' => [
'stream' => 'php://stderr',
],
'processors' => [PsrLogMessageProcessor::class],
],
'syslog' => [
'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'),
'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER),
'replace_placeholders' => true,
],
'errorlog' => [
'driver' => 'errorlog',
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],
];

116
config/mail.php Normal file
View File

@ -0,0 +1,116 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Mailer
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send all email
| messages unless another mailer is explicitly specified when sending
| the message. All additional mailers can be configured within the
| "mailers" array. Examples of each type of mailer are provided.
|
*/
'default' => env('MAIL_MAILER', 'log'),
/*
|--------------------------------------------------------------------------
| Mailer Configurations
|--------------------------------------------------------------------------
|
| Here you may configure all of the mailers used by your application plus
| their respective settings. Several examples have been configured for
| you and you are free to add your own as your application requires.
|
| Laravel supports a variety of mail "transport" drivers that can be used
| when delivering an email. You may specify which one you're using for
| your mailers below. You may also add additional mailers if needed.
|
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
| "postmark", "resend", "log", "array",
| "failover", "roundrobin"
|
*/
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'scheme' => env('MAIL_SCHEME'),
'url' => env('MAIL_URL'),
'host' => env('MAIL_HOST', '127.0.0.1'),
'port' => env('MAIL_PORT', 2525),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url(env('APP_URL', 'http://localhost'), PHP_URL_HOST)),
],
'ses' => [
'transport' => 'ses',
],
'postmark' => [
'transport' => 'postmark',
// 'message_stream_id' => env('POSTMARK_MESSAGE_STREAM_ID'),
// 'client' => [
// 'timeout' => 5,
// ],
],
'resend' => [
'transport' => 'resend',
],
'sendmail' => [
'transport' => 'sendmail',
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
'failover' => [
'transport' => 'failover',
'mailers' => [
'smtp',
'log',
],
],
'roundrobin' => [
'transport' => 'roundrobin',
'mailers' => [
'ses',
'postmark',
],
],
],
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all emails sent by your application to be sent from
| the same address. Here you may specify a name and address that is
| used globally for all emails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
];

112
config/queue.php Normal file
View File

@ -0,0 +1,112 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Connection Name
|--------------------------------------------------------------------------
|
| Laravel's queue supports a variety of backends via a single, unified
| API, giving you convenient access to each backend using identical
| syntax for each. The default queue connection is defined below.
|
*/
'default' => env('QUEUE_CONNECTION', 'database'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection options for every queue backend
| used by your application. An example configuration is provided for
| each backend supported by Laravel. You're also free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'connection' => env('DB_QUEUE_CONNECTION'),
'table' => env('DB_QUEUE_TABLE', 'jobs'),
'queue' => env('DB_QUEUE', 'default'),
'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90),
'after_commit' => false,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'),
'queue' => env('BEANSTALKD_QUEUE', 'default'),
'retry_after' => (int) env('BEANSTALKD_QUEUE_RETRY_AFTER', 90),
'block_for' => 0,
'after_commit' => false,
],
'sqs' => [
'driver' => 'sqs',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'default'),
'suffix' => env('SQS_SUFFIX'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'after_commit' => false,
],
'redis' => [
'driver' => 'redis',
'connection' => env('REDIS_QUEUE_CONNECTION', 'default'),
'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => (int) env('REDIS_QUEUE_RETRY_AFTER', 90),
'block_for' => null,
'after_commit' => false,
],
],
/*
|--------------------------------------------------------------------------
| Job Batching
|--------------------------------------------------------------------------
|
| The following options configure the database and table that store job
| batching information. These options can be updated to any database
| connection and table which has been defined by your application.
|
*/
'batching' => [
'database' => env('DB_CONNECTION', 'sqlite'),
'table' => 'job_batches',
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control how and where failed jobs are stored. Laravel ships with
| support for storing failed jobs in a simple file or in a database.
|
| Supported drivers: "database-uuids", "dynamodb", "file", "null"
|
*/
'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'database' => env('DB_CONNECTION', 'sqlite'),
'table' => 'failed_jobs',
],
];

38
config/services.php Normal file
View File

@ -0,0 +1,38 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Mailgun, Postmark, AWS and more. This file provides the de facto
| location for this type of information, allowing packages to have
| a conventional file to locate the various service credentials.
|
*/
'postmark' => [
'token' => env('POSTMARK_TOKEN'),
],
'ses' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
'resend' => [
'key' => env('RESEND_KEY'),
],
'slack' => [
'notifications' => [
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
],
],
];

217
config/session.php Normal file
View File

@ -0,0 +1,217 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option determines the default session driver that is utilized for
| incoming requests. Laravel supports a variety of storage options to
| persist session data. Database storage is a great default choice.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "dynamodb", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'database'),
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to expire immediately when the browser is closed then you may
| indicate that via the expire_on_close configuration option.
|
*/
'lifetime' => (int) env('SESSION_LIFETIME', 120),
'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false),
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it's stored. All encryption is performed
| automatically by Laravel and you may use the session like normal.
|
*/
'encrypt' => env('SESSION_ENCRYPT', false),
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When utilizing the "file" session driver, the session files are placed
| on disk. The default storage location is defined here; however, you
| are free to provide another location where they should be stored.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => env('SESSION_CONNECTION'),
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table to
| be used to store sessions. Of course, a sensible default is defined
| for you; however, you're welcome to change this to another table.
|
*/
'table' => env('SESSION_TABLE', 'sessions'),
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| When using one of the framework's cache driven session backends, you may
| define the cache store which should be used to store the session data
| between requests. This must match one of your defined cache stores.
|
| Affects: "apc", "dynamodb", "memcached", "redis"
|
*/
'store' => env('SESSION_STORE'),
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the session cookie that is created by
| the framework. Typically, you should not need to change this value
| since doing so does not grant a meaningful security improvement.
|
*/
'cookie' => env(
'SESSION_COOKIE',
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
),
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application, but you're free to change this when necessary.
|
*/
'path' => env('SESSION_PATH', '/'),
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| This value determines the domain and subdomains the session cookie is
| available to. By default, the cookie will be available to the root
| domain and all subdomains. Typically, this shouldn't be changed.
|
*/
'domain' => env('SESSION_DOMAIN'),
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you when it can't be done securely.
|
*/
'secure' => env('SESSION_SECURE_COOKIE'),
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. It's unlikely you should disable this option.
|
*/
'http_only' => env('SESSION_HTTP_ONLY', true),
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| will set this value to "lax" to permit secure cross-site requests.
|
| See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
|
| Supported: "lax", "strict", "none", null
|
*/
'same_site' => env('SESSION_SAME_SITE', 'lax'),
/*
|--------------------------------------------------------------------------
| Partitioned Cookies
|--------------------------------------------------------------------------
|
| Setting this value to true will tie the cookie to the top-level site for
| a cross-site context. Partitioned cookies are accepted by the browser
| when flagged "secure" and the Same-Site attribute is set to "none".
|
*/
'partitioned' => env('SESSION_PARTITIONED_COOKIE', false),
];

1
database/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.sqlite*

View File

@ -0,0 +1,44 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
*/
class UserFactory extends Factory
{
/**
* The current password being used by the factory.
*/
protected static ?string $password;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'name' => fake()->name(),
'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => static::$password ??= Hash::make('password'),
'remember_token' => Str::random(10),
];
}
/**
* Indicate that the model's email address should be unverified.
*/
public function unverified(): static
{
return $this->state(fn (array $attributes) => [
'email_verified_at' => null,
]);
}
}

View File

@ -0,0 +1,49 @@
<?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('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
Schema::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->longText('payload');
$table->integer('last_activity')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
Schema::dropIfExists('password_reset_tokens');
Schema::dropIfExists('sessions');
}
};

View File

@ -0,0 +1,35 @@
<?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('cache', function (Blueprint $table) {
$table->string('key')->primary();
$table->mediumText('value');
$table->integer('expiration');
});
Schema::create('cache_locks', function (Blueprint $table) {
$table->string('key')->primary();
$table->string('owner');
$table->integer('expiration');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('cache');
Schema::dropIfExists('cache_locks');
}
};

View File

@ -0,0 +1,57 @@
<?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('jobs', function (Blueprint $table) {
$table->id();
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedTinyInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
Schema::create('job_batches', function (Blueprint $table) {
$table->string('id')->primary();
$table->string('name');
$table->integer('total_jobs');
$table->integer('pending_jobs');
$table->integer('failed_jobs');
$table->longText('failed_job_ids');
$table->mediumText('options')->nullable();
$table->integer('cancelled_at')->nullable();
$table->integer('created_at');
$table->integer('finished_at')->nullable();
});
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('jobs');
Schema::dropIfExists('job_batches');
Schema::dropIfExists('failed_jobs');
}
};

View File

@ -0,0 +1,28 @@
<?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::table('users', function (Blueprint $table) {
$table->string('role')->default('kurir'); // Default role adalah 'kurir'
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
//
});
}
};

View File

@ -0,0 +1,30 @@
<?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('locations', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained()->onDelete('cascade'); // Relasi ke tabel users
$table->decimal('latitude', 10, 7);
$table->decimal('longitude', 10, 7);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('locations');
}
};

View File

@ -0,0 +1,33 @@
<?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('orders', function (Blueprint $table) {
$table->id();
$table->foreignId('owner_id')->constrained('users')->onDelete('cascade'); // Owner
$table->foreignId('kurir_id')->nullable()->constrained('users')->onDelete('set null'); // Kurir
$table->string('recipient_name'); // Nama penerima
$table->text('address'); // Alamat penerima
$table->text('description'); // Deskripsi pesanan
$table->enum('status', ['pending', 'assigned', 'delivered'])->default('pending'); // Status
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('orders');
}
};

View File

@ -0,0 +1,27 @@
<?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('presensis', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('presensis');
}
};

View File

@ -0,0 +1,28 @@
<?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::table('orders', function (Blueprint $table) {
$table->string('bukti_pengiriman')->nullable()->after('status');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('orders', function (Blueprint $table) {
$table->dropColumn('bukti_pengiriman');
});
}
};

View File

@ -0,0 +1,31 @@
<?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('presences', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained()->onDelete('cascade');
$table->date('date');
$table->time('time');
$table->string('status');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('presences');
}
};

View File

@ -0,0 +1,23 @@
<?php
namespace Database\Seeders;
use App\Models\User;
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*/
public function run(): void
{
// User::factory(10)->create();
User::factory()->create([
'name' => 'Test User',
'email' => 'test@example.com',
]);
}
}

3191
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

24
package.json Normal file
View File

@ -0,0 +1,24 @@
{
"private": true,
"type": "module",
"scripts": {
"build": "vite build",
"dev": "vite"
},
"devDependencies": {
"@popperjs/core": "^2.11.6",
"autoprefixer": "^10.4.20",
"axios": "^1.7.4",
"bootstrap": "^5.2.3",
"concurrently": "^9.0.1",
"laravel-vite-plugin": "^1.2.0",
"postcss": "^8.4.47",
"sass": "^1.56.1",
"tailwindcss": "^3.4.13",
"vite": "^6.0.11"
},
"dependencies": {
"laravel-echo": "^1.19.0",
"pusher-js": "^8.4.0"
}
}

33
phpunit.xml Normal file
View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Unit">
<directory>tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory>tests/Feature</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>app</directory>
</include>
</source>
<php>
<env name="APP_ENV" value="testing"/>
<env name="APP_MAINTENANCE_DRIVER" value="file"/>
<env name="BCRYPT_ROUNDS" value="4"/>
<env name="CACHE_STORE" value="array"/>
<!-- <env name="DB_CONNECTION" value="sqlite"/> -->
<!-- <env name="DB_DATABASE" value=":memory:"/> -->
<env name="MAIL_MAILER" value="array"/>
<env name="PULSE_ENABLED" value="false"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="TELESCOPE_ENABLED" value="false"/>
</php>
</phpunit>

6
postcss.config.js Normal file
View File

@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};

25
public/.htaccess Normal file
View File

@ -0,0 +1,25 @@
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Handle X-XSRF-Token Header
RewriteCond %{HTTP:x-xsrf-token} .
RewriteRule .* - [E=HTTP_X_XSRF_TOKEN:%{HTTP:X-XSRF-Token}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

0
public/favicon.ico Normal file
View File

17
public/index.php Normal file
View File

@ -0,0 +1,17 @@
<?php
use Illuminate\Http\Request;
define('LARAVEL_START', microtime(true));
// Determine if the application is in maintenance mode...
if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
require $maintenance;
}
// Register the Composer autoloader...
require __DIR__.'/../vendor/autoload.php';
// Bootstrap Laravel and handle the request...
(require_once __DIR__.'/../bootstrap/app.php')
->handleRequest(Request::capture());

2
public/robots.txt Normal file
View File

@ -0,0 +1,2 @@
User-agent: *
Disallow:

3
resources/css/app.css Normal file
View File

@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

1
resources/js/app.js Normal file
View File

@ -0,0 +1 @@
import './bootstrap';

34
resources/js/bootstrap.js vendored Normal file
View File

@ -0,0 +1,34 @@
import 'bootstrap';
/**
* We'll load the axios HTTP library which allows us to easily issue requests
* to our Laravel back-end. This library automatically handles sending the
* CSRF token as a header based on the value of the "XSRF" token cookie.
*/
import axios from 'axios';
window.axios = axios;
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
/**
* Echo exposes an expressive API for subscribing to channels and listening
* for events that are broadcast by Laravel. Echo and event broadcasting
* allows your team to easily build robust real-time web applications.
*/
// import Echo from 'laravel-echo';
// import Pusher from 'pusher-js';
// window.Pusher = Pusher;
// window.Echo = new Echo({
// broadcaster: 'pusher',
// key: import.meta.env.VITE_PUSHER_APP_KEY,
// cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER ?? 'mt1',
// wsHost: import.meta.env.VITE_PUSHER_HOST ?? `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`,
// wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80,
// wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443,
// forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https',
// enabledTransports: ['ws', 'wss'],
// });

View File

@ -0,0 +1,7 @@
// Body
$body-bg: #f8fafc;
// Typography
$font-family-sans-serif: 'Nunito', sans-serif;
$font-size-base: 0.9rem;
$line-height-base: 1.6;

8
resources/sass/app.scss Normal file
View File

@ -0,0 +1,8 @@
// Fonts
@import url('https://fonts.bunny.net/css?family=Nunito');
// Variables
@import 'variables';
// Bootstrap
@import 'bootstrap/scss/bootstrap';

View File

@ -0,0 +1,105 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">
<style>
/* Tambahkan CSS custom Anda di sini jika diperlukan */
body {
background-color: #f8f9fa; /* Contoh warna latar belakang */
}
.card {
border-radius: 12px;
}
</style>
</head>
<body>
<div class="d-flex justify-content-center align-items-center vh-100">
<div class="card shadow-lg p-4" style="width: 400px;">
<div class="card-body">
<h1 class="text-center mb-4">Login</h1>
<form method="POST" action="{{ route('login') }}">
@csrf
<div class="mb-3">
<label for="email" class="form-label">Email Address</label>
<div class="input-group">
<span class="input-group-text"><i class="bi bi-envelope"></i></span>
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autofocus>
</div>
@error('email')
<span class="text-danger small">{{ $message }}</span>
@enderror
</div>
<div class="mb-3">
<label for="password" class="form-label">Password</label>
<div class="input-group">
<span class="input-group-text"><i class="bi bi-lock"></i></span>
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required>
<button type="button" class="btn btn-outline-secondary" id="togglePassword">
<i class="bi bi-eye"></i>
</button>
</div>
@error('password')
<span class="text-danger small">{{ $message }}</span>
@enderror
</div>
<div class="mb-3 text-start mt-3 mr-1">
<a class="small" href="{{ route('password.request') }}">Forgot Your Password?</a>
</div>
<!-- <div class="mb-3 form-check">
<input class="form-check-input" type="checkbox" name="remember" id="remember">
<label class="form-check-label" for="remember">
Remember Me
</label>
</div> -->
<div class="d-grid">
<button type="submit" class="btn btn-primary">
Login
</button>
</div>
<!-- <div class="text-center mt-3">
<p class="small">Don't have an account? <a href="register">Register here</a></p>
</div> -->
</form>
{{-- Pesan Error Jika Email/Password Salah --}}
@if (session('error'))
<div class="alert alert-danger mt-3">
{{ session('error') }}
</div>
@endif
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>
<script>
document.getElementById('togglePassword').addEventListener('click', function () {
let passwordField = document.getElementById('password');
let icon = this.querySelector('i');
if (passwordField.type === 'password') {
passwordField.type = 'text';
icon.classList.remove('bi-eye');
icon.classList.add('bi-eye-slash');
} else {
passwordField.type = 'password';
icon.classList.remove('bi-eye-slash');
icon.classList.add('bi-eye');
}
});
</script>
</body>
</html>

View File

@ -0,0 +1,49 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Confirm Password') }}</div>
<div class="card-body">
{{ __('Please confirm your password before continuing.') }}
<form method="POST" action="{{ route('password.confirm') }}">
@csrf
<div class="row mb-3">
<label for="password" class="col-md-4 col-form-label text-md-end">{{ __('Password') }}</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="current-password">
@error('password')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="row mb-0">
<div class="col-md-8 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Confirm Password') }}
</button>
@if (Route::has('password.request'))
<a class="btn btn-link" href="{{ route('password.request') }}">
{{ __('Forgot Your Password?') }}
</a>
@endif
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@ -0,0 +1,47 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Reset Password') }}</div>
<div class="card-body">
@if (session('status'))
<div class="alert alert-success" role="alert">
{{ session('status') }}
</div>
@endif
<form method="POST" action="{{ route('password.email') }}">
@csrf
<div class="row mb-3">
<label for="email" class="col-md-4 col-form-label text-md-end">{{ __('Email Address') }}</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus>
@error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="row mb-0">
<div class="col-md-6 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Send Password Reset Link') }}
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@ -0,0 +1,65 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Reset Password') }}</div>
<div class="card-body">
<form method="POST" action="{{ route('password.update') }}">
@csrf
<input type="hidden" name="token" value="{{ $token }}">
<div class="row mb-3">
<label for="email" class="col-md-4 col-form-label text-md-end">{{ __('Email Address') }}</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ $email ?? old('email') }}" required autocomplete="email" autofocus>
@error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="row mb-3">
<label for="password" class="col-md-4 col-form-label text-md-end">{{ __('Password') }}</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="new-password">
@error('password')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="row mb-3">
<label for="password-confirm" class="col-md-4 col-form-label text-md-end">{{ __('Confirm Password') }}</label>
<div class="col-md-6">
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required autocomplete="new-password">
</div>
</div>
<div class="row mb-0">
<div class="col-md-6 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Reset Password') }}
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@ -0,0 +1,122 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Register</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css" rel="stylesheet">
<style>
body {
background: #f8f9fa;
}
.register-container {
max-width: 500px;
background: white;
padding: 2rem;
border-radius: 10px;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}
</style>
</head>
<body>
<div class="d-flex justify-content-center align-items-center vh-100">
<div class="card shadow-lg p-4" style="width: 400px;">
<h3 class="text-center mb-4">Register Account</h3>
<form method="POST" action="/register">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<!-- Role Selection -->
<div class="mb-3">
<label for="role" class="form-label">Select Role</label>
<select name="role" id="role" class="form-control" required>
<option value="kurir">Kurir</option>
<option value="owner">Owner</option>
</select>
</div>
<!-- Name -->
<div class="mb-3">
<label for="name" class="form-label">Full Name</label>
<div class="input-group">
<span class="input-group-text"><i class="bi bi-person"></i></span>
<input id="name" type="text" class="form-control" name="name" required autofocus>
</div>
</div>
<!-- Email -->
<div class="mb-3">
<label for="email" class="form-label">Email Address</label>
<div class="input-group">
<span class="input-group-text"><i class="bi bi-envelope"></i></span>
<input id="email" type="email" class="form-control" name="email" required>
</div>
</div>
<!-- Password -->
<div class="mb-3">
<label for="password" class="form-label">Password</label>
<div class="input-group">
<span class="input-group-text"><i class="bi bi-lock"></i></span>
<input id="password" type="password" class="form-control" name="password" required>
<button type="button" class="btn btn-outline-secondary" id="togglePassword">
<i class="bi bi-eye"></i>
</button>
</div>
</div>
<!-- Confirm Password -->
<div class="mb-3">
<label for="password-confirm" class="form-label">Confirm Password</label>
<div class="input-group">
<span class="input-group-text"><i class="bi bi-lock"></i></span>
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required>
<button type="button" class="btn btn-outline-secondary" id="toggleConfirmPassword">
<i class="bi bi-eye"></i>
</button>
</div>
</div>
<!-- Submit Button -->
<div class="d-grid">
<button type="submit" class="btn btn-primary">Register</button>
</div>
<!-- Already have an account? -->
<div class="text-center mt-3">
<p class="small">Already have an account? <a href="/">Login here</a></p>
</div>
@if(session('success'))
<script>
alert("{{ session('success') }}");
window.location.href = "{{ route('login') }}"; // Redirect ke halaman login
</script>
@endif
</form>
</div>
</div>
<script>
document.getElementById('togglePassword').addEventListener('click', function () {
let passwordField = document.getElementById('password');
let icon = this.querySelector('i');
passwordField.type = passwordField.type === 'password' ? 'text' : 'password';
icon.classList.toggle('bi-eye');
icon.classList.toggle('bi-eye-slash');
});
document.getElementById('toggleConfirmPassword').addEventListener('click', function () {
let confirmPasswordField = document.getElementById('password-confirm');
let icon = this.querySelector('i');
confirmPasswordField.type = confirmPasswordField.type === 'password' ? 'text' : 'password';
icon.classList.toggle('bi-eye');
icon.classList.toggle('bi-eye-slash');
});
</script>
</body>
</html>

View File

@ -0,0 +1,28 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Verify Your Email Address') }}</div>
<div class="card-body">
@if (session('resent'))
<div class="alert alert-success" role="alert">
{{ __('A fresh verification link has been sent to your email address.') }}
</div>
@endif
{{ __('Before proceeding, please check your email for a verification link.') }}
{{ __('If you did not receive the email') }},
<form class="d-inline" method="POST" action="{{ route('verification.resend') }}">
@csrf
<button type="submit" class="btn btn-link p-0 m-0 align-baseline">{{ __('click here to request another') }}</button>.
</form>
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@ -0,0 +1,77 @@
@extends('layouts.app')
@section('content')
<div class="container mt-4">
<div class="row">
<!-- Form Tambah Pesanan -->
<div class="col-md-6">
<div class="card shadow-lg border-0">
<div class="card-header bg-primary text-white text-center">
<h5 class="mb-0">Tambah Pesanan</h5>
</div>
<div class="card-body">
<form id="orderForm" action="{{ route('orders.customer') }}" method="POST">
@csrf
<div class="mb-3">
<label for="recipient_name" class="form-label">Nama Penerima</label>
<input type="text" class="form-control" id="recipient_name" name="recipient_name" required>
</div>
<div class="mb-3">
<label for="address" class="form-label">Alamat</label>
<input type="text" class="form-control" id="address" name="address" required>
</div>
<div class="mb-3">
<label for="description" class="form-label">Deskripsi</label>
<textarea class="form-control" id="description" name="description" rows="2" required></textarea>
</div>
<div class="mb-3" style="display: none;">
<label for="kurir_id" class="form-label">Kurir</label>
<input type="hidden" id="kurir_id" name="kurir_id">
</div>
<button type="submit" class="btn btn-primary w-100">Simpan Order</button>
</form>
</div>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function() {
$("#orderForm").submit(function(event) {
event.preventDefault(); // Mencegah reload
$.ajax({
url: "{{ route('orders.store') }}",
method: "POST",
data: $(this).serialize(),
success: function(response) {
if(response.success) {
alert(response.message);
// Tambahkan order baru ke tabel tanpa reload
$("#ordersTable tbody").prepend(`
<tr>
<td>NEW</td>
<td>${response.order.recipient_name}</td>
<td>${response.order.address}</td>
<td>${response.order.description}</td>
<td><span class="badge badge-secondary">Pending</span></td>
<td>${response.order.kurir ? response.order.kurir.name : 'Belum Ditugaskan'}</td>
<td>${new Date(response.order.created_at).toLocaleString()}</td>
</tr>
`);
// Reset form setelah submit
$("#orderForm")[0].reset();
}
},
error: function(xhr) {
alert("Terjadi kesalahan: " + xhr.responseJSON.message);
}
});
});
});
</script>
@endsection

View File

@ -0,0 +1,254 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dashboard Owner</title>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css"
integrity="..." crossorigin="anonymous" referrerpolicy="no-referrer" />
<style>
.table-responsive {
max-height: 400px;
overflow-y: auto;
}
.body {
font-family: 'Poppins', sans-serif; /* Font yang lebih modern */
background-color: #ffffff; /* Warna latar belakang lembut */
padding-top: 80px;
}
.card {
border: none;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
border-radius: 10px;
}
.card-header {
background-color: #e9ecef;
color: #343a40;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
.card-title {
color: #343a40;
}
.badge {
border-radius: 5px;
padding: 0.3rem 0.6rem;
}
.bg-light-soft {
background-color: #f9f9f9; /* Soft light gray */
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container">
<a class="navbar-brand" href="#">Dashboard Owner</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="{{ route('home') }}">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('orders.index') }}">Order</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('salary.index') }}">Salary</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('report.index') }}">Report</a>
</li>
<li class="nav-item">
<form action="{{ route('logout') }}" method="POST" class="d-flex mt-1">
@csrf
<button type="submit" class="btn btn-sm btn-danger">Logout</button>
</form>
</li>
</ul>
</div>
</div>
</nav>
<div class="container mt-3">
<h2>Selamat datang, {{ auth()->user()->name }}!</h2>
<p>Berikut Total Pesanan dan Update Lokasi Kurir</p>
<div class="card border-0 mt-4 shadow">
<div class="card-body" id="cardInfo">
<div class="row">
<div class="col-md-4 mb-4 mb-md-0">
<div class="card border-0 bg-light-soft p-3 rounded">
<div class="card-body text-center">
<h5 class="card-title text-muted">Presensi</h5>
<h1 class="fw-bold text-info">{{ $presensiCount }}</h1>
<p class="text-muted mb-0">Total Kehadiran</p>
</div>
</div>
</div>
<div class="col-md-4 mb-4 mb-md-0">
<div class="card border-0 bg-light-soft p-3 rounded">
<div class="card-body text-center">
<h5 class="card-title text-muted">Gaji</h5>
<h1 class="fw-bold text-success">Rp
{{ number_format($totalGajiKurir, 0, ',', '.') }}</h1>
<p class="text-muted mb-0">Total Bayar Gaji Bulan Ini</p>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card border-0 bg-light-soft p-3 rounded">
<div class="card-body text-center">
<h5 class="card-title text-muted">Pesanan</h5>
<h1 class="fw-bold text-primary">{{ $totalOrders }}</h1>
<p class="text-muted mb-0">Total Pesanan Bulan Ini</p>
</div>
</div>
</div>
</div>
</div>
</div>
{{-- Card Presensi --}}
<div class="card border-0 mb-4 mt-4">
<div class="card-header">
Data Presensi Hari Ini
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="locationTable">
<thead>
<tr>
<th>Nama Kurir</th>
<th>Waktu Presensi</th>
<th>Status</th>
</tr>
</thead>
<tbody>
@if (count($presensiRecords) > 0)
@foreach ($presensiRecords as $record)
<tr>
<td>{{ $record->user->name }}</td>
<td>{{ \Carbon\Carbon::parse($record->check_in_time)->format('H:i:s') }}</td>
<td>
@php
$waktuPresensi = \Carbon\Carbon::parse($record->check_in_time)->format('H:i');
$status = $waktuPresensi <= '07:30' ? 'Ontime' : 'Late';
@endphp
<span class="badge badge-{{ $status === 'Ontime' ? 'success' : 'danger' }}">
{{ $status }}
</span>
</td>
</tr>
@endforeach
@else
<tr>
<td colspan="6" class="text-center">
<div class="alert alert-warning mb-0">Data Belum Tersedia</div>
</td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
</div>
<div class="card mt-4 mb-4">
<div class="card-header">
Daftar Lokasi Kurir
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="locationTable">
<thead>
<tr>
<th>No</th>
<th>Nama Kurir</th>
<th>Latitude</th>
<th>Longitude</th>
<th>Waktu Upload</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
@if (count($locations) > 0)
@foreach ($locations as $index => $location)
<tr>
<td>{{ $index + 1 }}</td>
<td>{{ $location->user->name }}</td>
<td>{{ $location->latitude }}</td>
<td>{{ $location->longitude }}</td>
<td>{{ $location->created_at->format('d-m-Y H:i:s') }}</td>
<td>
<!-- <a href="http://maps.google.com/maps?q={{ $location->latitude }},{{ $location->longitude }}"
target="_blank" class="btn btn-sm btn-primary">Lihat di Maps</a> -->
<a href="{{ route('tracking.view', ['id' => $location->user_id]) }}" class="btn btn-primary">Lihat di Maps</a>
</td>
</tr>
@endforeach
@else
<tr>
<td colspan="6" class="text-center">
<div class="alert alert-warning mb-0">Data Belum Tersedia</div>
</td>
</tr>
@endif
</tbody>
</table>
<!-- <form action="{{ url('/cleanup-yesterday') }}" method="GET">
<button type="submit" class="btn btn-danger">Bersihkan Data Kemarin</button>
</form> -->
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<script>
setInterval(() => {
window.location.reload();
}, 10000); // 10.000 ms = 10 detik
</script>
<script>
document.addEventListener('DOMContentLoaded', function () {
fetch('/cleanup-yesterday')
.then(response => {
if (response.redirected) {
// Jika Laravel redirect karena session expired / middleware auth
console.log('Redirected to login or home');
return;
}
return response.text(); // atau response.json() kalau pakai json
})
.then(data => {
console.log('Cleanup request sent successfully');
// Optional: tampilkan notifikasi swal / toast kalau mau
})
.catch(error => {
console.error('Error during cleanup:', error);
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,258 @@
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SIMAS KURIR</title>
<!-- Google Fonts: Poppins -->
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap" rel="stylesheet">
<!-- Bootstrap CSS -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" crossorigin="anonymous" />
<style>
/* Menggunakan font Poppins */
body {
font-family: 'Poppins', sans-serif;
padding-top: 50px; /* Memberikan ruang untuk navbar fixed */
}
/* Navbar Fixed */
.navbar {
position: fixed;
top: 0;
width: 100%;
z-index: 1030;
}
/* Table */
.table-responsive {
max-height: 400px;
overflow-y: auto;
}
/* Card */
.bg-light-soft {
background-color: #f9f9f9; /* Soft light gray */
}
.btn-dynamic {
background-color: #007BFF;
border: none;
color: white;
padding: 12px 20px;
font-size: 16px;
font-weight: 600;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
transition: background-color 0.3s, transform 0.2s;
cursor: pointer;
}
.btn-dynamic:hover {
transform: scale(1.03);
}
.btn-start {
background-color: #007BFF !important; /* Biru */
}
.btn-stop {
background-color: #DC3545 !important; /* Merah */
}
</style>
</head>
<body>
<!-- Navbar -->
<nav class="navbar navbar-expand-lg navbar-light bg-light fixed-top">
<div class="container">
<a class="navbar-brand" href="#">Kurir Dashboard</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="{{ route('kurir.dashboard') }}">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('kurir.order') }}">Order</a>
</li>
<li class="nav-item">
<form action="{{ route('logout') }}" method="POST" class="d-flex mt-1">
@csrf
<button type="submit" class="btn btn-sm btn-danger">Logout</button>
</form>
</li>
</ul>
</div>
</div>
</nav>
<!-- Konten -->
<div class="container mt-3">
<h2>Selamat datang, {{ auth()->user()->name }}!</h2>
<p>Jangan lupa untuk Presensi dan Cek Pesanan Anda hari ini!</p>
<div class="card border-0 mt-4 shadow">
<div class="card-body">
<div class="row">
<div class="col-md-4 mb-md-0 p-3">
<div class="card border-0 shadow bg-light-soft text-center">
<div class="card-body text-center">
<h5 class="card-title">
<i class="fas fa-map-marker-alt text-muted me-2"></i> Presensi
</h5>
@php $firstPresence = $locations->first(); @endphp
@if ($firstPresence)
<span class="badge {{ $firstPresence->created_at->format('H:i') < '07:30' ? 'bg-success text-white' : 'bg-danger text-white' }}">
{{ $firstPresence->created_at->format('H:i') < '07:30' ? 'Ontime' : 'Late' }}
</span>
<p class="text-muted mt-2"><strong>Waktu Upload:</strong> {{ $firstPresence->created_at->format('d-m-Y, H:i:s') }}</p>
@else
<p class="text-muted">Upload lokasi untuk melakukan presensi!</p>
@endif
</div>
</div>
</div>
<div class="col-md-4 mb-md-0 p-3">
<div class="card border-0 shadow bg-light-soft">
<div class="card-body text-center">
<h5 class="card-title"><i class="fas fa-clock text-muted mr-2"></i> Pesanan Menunggu</h5>
<h1 class="fw-bold text-warning">{{ $ordersProcessing }}</h1>
<p class="text-muted mb-0">Pesanan baru hari ini</p>
</div>
</div>
</div>
<div class="col-md-4 mb-md-0 p-3">
<div class="card border-0 shadow bg-light-soft">
<div class="card-body text-center">
<h5 class="card-title"><i class="fas fa-money-bill-wave text-muted mr-2"></i> Estimasi Pendapatan</h5>
<h1 class="fw-bold text-success">Rp {{ number_format($estimateSalary, 0, ',', '.') }}</h1>
<p class="text-muted mb-0">Total pendapatan hari ini</p>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Tabel Lokasi -->
<div class="card mt-4 mb-4">
<div class="card-header">Daftar Lokasi Anda</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="presenceTable">
<thead>
<tr>
<th>No</th>
<th>Latitude</th>
<th>Longitude</th>
<th>Waktu Upload</th>
</tr>
</thead>
<tbody id="locationTableBody">
@if ($locations->isNotEmpty())
@php
$lastLocation = $locations->last();
@endphp
<tr>
<td>1</td>
<td>{{ $lastLocation->latitude }}</td>
<td>{{ $lastLocation->longitude }}</td>
<td>{{ $lastLocation->created_at->format('d-m-Y, H:i:s') }} WIB</td>
</tr>
@else
<tr>
<td colspan="6" class="text-center">
<div class="alert alert-warning mb-0">Data Belum Tersedia</div>
</td>
</tr>
@endif
</tbody>
</table>
</div>
<div class="location-controls mt-4 d-flex align-items-center gap-3">
<button id="uploadLocation" class="btn-dynamic">
📍 Upload Lokasi
</button>
</div>
<small id="locationStatus" class="text-muted d-block mt-2"></small>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script>
const statusElement = document.getElementById('locationStatus');
const locationTableBody = document.getElementById('locationTableBody');
function uploadLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
function (position) {
const latitude = position.coords.latitude.toString();
const longitude = position.coords.longitude.toString();
axios.post('/location/store', {
latitude: latitude,
longitude: longitude,
_token: '{{ csrf_token() }}'
})
.then(function (response) {
statusElement.textContent = 'Lokasi berhasil diunggah.';
updateLocationTable(latitude, longitude);
})
.catch(function (error) {
statusElement.textContent = 'Gagal mengunggah lokasi.';
console.error(error);
});
},
function (error) {
statusElement.textContent = 'Gagal mengambil lokasi.';
console.error(error);
}
);
} else {
statusElement.textContent = 'Browser tidak mendukung Geolocation.';
}
}
function updateLocationTable(lat, long) {
locationTableBody.innerHTML = '';
const row = document.createElement('tr');
const now = new Date().toLocaleString('id-ID');
row.innerHTML = `
<td>1</td>
<td>${lat}</td>
<td>${long}</td>
<td>${now}</td>
`;
locationTableBody.appendChild(row);
}
// ⏬ Jalankan upload saat halaman selesai dimuat
window.addEventListener('load', function () {
uploadLocation();
// 🔁 Auto reload setiap 30 detik
setTimeout(() => {
location.reload();
}, 30000);
});
</script>
<!-- Bootstrap JS -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

View File

@ -0,0 +1,202 @@
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SIMAS KURIR</title>
<!-- Google Fonts: Poppins -->
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap" rel="stylesheet">
<!-- Bootstrap CSS -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" crossorigin="anonymous" />
<style>
/* Menggunakan font Poppins */
body {
font-family: 'Poppins', sans-serif;
padding-top: 50px; /* Memberikan ruang untuk navbar fixed */
}
/* Navbar Fixed */
.navbar {
position: fixed;
top: 0;
width: 100%;
z-index: 1030;
}
/* Table */
.table-responsive {
max-height: 400px;
overflow-y: auto;
}
/* Card */
.bg-light-soft {
background-color: #f9f9f9; /* Soft light gray */
}
</style>
</head>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light fixed-top">
<div class="container">
<a class="navbar-brand" href="#">Kurir Dashboard</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="{{ route('kurir.dashboard') }}">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('kurir.order') }}">Order</a>
</li>
<li class="nav-item">
<form action="{{ route('logout') }}" method="POST" class="d-flex mt-1">
@csrf
<button type="submit" class="btn btn-sm btn-danger">Logout</button>
</form>
</li>
</ul>
</div>
</div>
</nav>
<div class="container">
<h4 class="mt-4">Daftar Pesanan - {{ \Carbon\Carbon::now()->translatedFormat('l, d F Y') }}</h4>
@if($orders->where('status', 'Assigned')->isEmpty())
<div class="alert alert-warning text-center">Tidak ada pesanan yang ditugaskan.</div>
@else
<div class="row">
@foreach($orders as $order)
@if($order->status != 'Delivered')
<div class="col-md-4">
<div class="card">
<div class="card-body">
<h4 class="card-header bg
@if($order->status == 'Delivered')
bg-success
@elseif($order->status == 'Assigned')
bg-warning
@else
bg-secondary
@endif">{{ $order->status }}
</h4>
<h5 class="card-title mt-3">{{ $order->recipient_name }}</h5>
<p class="card-text">
<strong>Alamat:</strong> {{ $order->address }}<br>
<strong>Deskripsi Pesanan:</strong> {{ $order->description }}<br>
<strong>Tanggal:</strong> {{ $order->created_at->format('d-m-Y, H:i:s') }}<br>
@if ($order->status == 'Assigned')
<!-- Tombol Selesaikan Pesanan -->
<form action="{{ route('kurir.updateStatus', ['id' => $order->id]) }}" method="POST" class="d-inline">
@csrf
@method('PUT')
<button type="submit" id="btn-selesaikan-{{ $order->id }}" class="btn btn-sm btn-success">
Selesaikan Pesanan
</button>
</form>
@endif
</p>
</div>
</div>
</div>
@endif
@endforeach
</div>
@endif
</div>
<div class="container mt-4">
<div class="card mt-5 mb-4">
<h4 class="card-header">
Pesanan Selesai
</h4>
<form method="GET" class="mt-4 ml-4" action="{{ route('kurir.order') }}">
<label for="filter_date">Filter Tanggal:</label>
<input type="date" id="filter_date" name="filter_date" value="{{ request('filter_date', now()->toDateString()) }}">
<button type="submit" class="btn btn-primary btn-sm mb-1">Filter</button>
</form>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered table-hover"> <thead>
<tr>
<th>No</th>
<th>Nama Penerima</th>
<th>Alamat</th>
<th>Deskripsi</th>
<th>Status</th>
<th>Tanggal Selesai</th>
</tr>
</thead>
<tbody>
@foreach($orders as $index => $order)
@if($order->status == 'Delivered')
<tr>
<td>{{ $index + 1 }}</td>
<td>{{ $order->recipient_name }}</td>
<td>{{ $order->address }}</td>
<td>{{ $order->description}}</td>
<td><span class="badge badge-success">{{ $order->status }}</span></td>
<td>{{ $order->updated_at->format('d-m-Y, H:i:s') }}</td>
</tr>
@endif
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script>
function uploadLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
function(position) {
const latitude = position.coords.latitude.toString();
const longitude = position.coords.longitude.toString();
axios.post('/location/store', {
latitude: latitude,
longitude: longitude,
_token: '{{ csrf_token() }}'
})
.then(function(response) {
console.log('Lokasi terkirim');
})
.catch(function(error) {
console.error('Gagal mengirim lokasi', error);
});
},
function(error) {
console.error('Gagal mengambil lokasi', error);
}
);
} else {
console.error('Browser tidak mendukung Geolocation.');
}
}
// Saat halaman selesai dimuat
window.onload = function () {
uploadLocation();
setInterval(uploadLocation, 10000); // Kirim ulang setiap 10 detik
};
// Paksa halaman reload setiap 60 detik
setInterval(function () {
window.location.reload();
}, 30000);
</script>
</body>
</html>

View File

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<title>Laporan Kinerja Kurir</title>
<style>
body { font-family: Arial, sans-serif; }
h2 { text-align: center; }
table { width: 100%; border-collapse: collapse; margin-top: 20px; }
th, td { border: 1px solid black; padding: 10px; text-align: center; }
th { background-color: #f2f2f2; }
</style>
</head>
<body>
<h2>Laporan Kinerja Kurir - Bulan {{ $month }}/{{ $year }}</h2>
<table>
<thead>
<tr>
<th>Total Ontime Presensi</th>
<th>Total On Target Order</th>
<th>Predikat</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ $ontimePresensi }}</td>
<td>{{ $onTargetDays }}</td>
<td>{{ $predikat }}</td>
</tr>
</tbody>
</table>
<p style="margin-top: 20px;">Laporan dibuat pada: {{ now()->format('d-m-Y H:i:s') }}</p>
</body>
</html>

View File

@ -0,0 +1,55 @@
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<title>Tracking Lokasi Kurir</title>
</head>
<body style="font-family: sans-serif; padding: 2rem; text-align: center;">
<h2>📍 Tracking Lokasi Aktif</h2>
<p id="status">Menunggu update lokasi...</p>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script>
function uploadLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
function(position) {
const latitude = position.coords.latitude.toString();
const longitude = position.coords.longitude.toString();
axios.post('/location/store', {
latitude: latitude,
longitude: longitude,
_token: '{{ csrf_token() }}'
})
.then(function(response) {
console.log('Lokasi terkirim');
})
.catch(function(error) {
console.error('Gagal mengirim lokasi', error);
});
},
function(error) {
console.error('Gagal mengambil lokasi', error);
}
);
} else {
console.error('Browser tidak mendukung Geolocation.');
}
}
// Saat halaman selesai dimuat
window.onload = function () {
uploadLocation();
setInterval(uploadLocation, 10000); // Kirim ulang setiap 10 detik
};
// Paksa halaman reload setiap 60 detik
setInterval(function () {
window.location.reload();
}, 10000);
</script>
</body>
</html>

View File

@ -0,0 +1,29 @@
<!doctype html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'Laravel') }}</title>
<!-- Fonts -->
<link rel="dns-prefetch" href="//fonts.bunny.net">
<link href="https://fonts.bunny.net/css?family=Nunito" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Scripts -->
@vite(['resources/sass/app.scss', 'resources/js/app.js'])
</head>
<body>
<div id="app">
<main class="py-4">
@yield('content')
</main>
</div>
</body>
</html>

View File

@ -0,0 +1,35 @@
@extends('layouts.app')
@section('content')
<div class="container">
<h2>Buat Order Baru</h2>
<form method="POST" action="{{ route('orders.store') }}">
@csrf
<div class="mb-3">
<label class="form-label">Nama Penerima</label>
<input type="text" class="form-control" name="recipient_name" required>
</div>
<div class="mb-3">
<label class="form-label">Alamat</label>
<textarea class="form-control" name="address" required></textarea>
</div>
<div class="mb-3">
<label class="form-label">Deskripsi</label>
<textarea class="form-control" name="description" required></textarea>
</div>
<div class="mb-3">
<label class="form-label">Harga</label>
<textarea class="form-control" name="price" required></textarea>
</div>
<div class="mb-3">
<label class="form-label">Pilih Kurir</label>
<select class="form-control" name="kurir_id" required>
@foreach ($kurirs as $kurir)
<option value="{{ $kurir->id }}">{{ $kurir->name }}</option>
@endforeach
</select>
</div>
<button type="submit" class="btn btn-primary">Simpan</button>
</form>
</div>
@endsection

View File

@ -0,0 +1,256 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Daftar Pesanan</title>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css"
integrity="..." crossorigin="anonymous" referrerpolicy="no-referrer" />
<style>
body {
font-family: 'Poppins', sans-serif;
background-color: #ffffff; /* Warna latar belakang lembut */
padding-top: 50px;
}
.card {
border: none;
box-shadow: 0 4px 8px rgba(0,0,0,0.1); /* Efek bayangan */
border-radius: 10px; /* Sudut membulat */
}
.card-header {
background-color: #e9ecef; /* Warna header lembut */
color: #343a40;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
.card-title {
color: #343a40;
}
.badge {
border-radius: 5px;
padding: 0.3rem 0.6rem;
}
.table-responsive {
max-height: 500px;
overflow-y: auto;
}
/* Warna-warna lembut */
.bg-primary-soft { background-color: #cfe2ff; color: #007bff; }
.bg-success-soft { background-color: #d4edda; color: #28a745; }
.bg-warning-soft { background-color: #fff3cd; color: #ffc107; }
.bg-danger-soft { background-color: #f8d7da; color: #dc3545; }
.bg-info-soft { background-color: #d1ecf1; color: #17a2b8; }
.bg-light-soft {
background-color: #f9f9f9; /* Soft light gray */
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light fixed-top">
<div class="container">
<a class="navbar-brand" href="#">Dashboard Pesanan</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="{{ route('home') }}">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('orders.index') }}">Order</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('salary.index') }}">Salary</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('report.index') }}">Report</a>
</li>
<li class="nav-item">
<form action="{{ route('logout') }}" method="POST" class="d-flex mt-1">
@csrf
<button type="submit" class="btn btn-sm btn-danger">Logout</button>
</form>
</li>
</ul>
</div>
</div>
</nav>
<div class="container mt-3">
@if(session('success'))
<div class="alert alert-success">
{{ session('success') }}
</div>
@endif
<div class="card border-0 mt-5 shadow">
<div class="card-body">
<div class="row">
<div class="col-md-4 mb-4 mb-md-0">
<div class="card border-1 bg-light-soft">
<div class="card-body text-center">
<h5 class="card-title"><i class="fas fa-list-ol text-muted mr-2"></i> Total Pesanan</h5>
<h1 class="fw-bold text-primary">{{ $totalOrders }}</h1>
<p class="text-muted mb-0">Pesanan yang telah dibuat</p>
</div>
</div>
</div>
<div class="col-md-4 mb-4 mb-md-0">
<div class="card border-1 bg-light-soft">
<div class="card-body text-center">
<h5 class="card-title"><i class="fas fa-tasks text-muted mr-2"></i> Pesanan Diproses</h5>
<h1 class="fw-bold text-warning">{{ $ordersProcessing }}</h1>
<p class="text-muted mb-0">Sedang dalam pengiriman</p>
</div>
</div>
</div>
<div class="col-md-4 mb-4 mb-md-0">
<div class="card border-1 bg-light-soft">
<div class="card-body text-center">
<h5 class="card-title"><i class="fas fa-check-circle text-muted mr-2"></i> Pesanan Selesai</h5>
<h1 class="fw-bold text-success">{{ $ordersCompleted }}</h1>
<p class="text-muted mb-0">Pesanan berhasil dikirim</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="card shadow p-2 mt-5">
<h4 class="card-header bg-primary-soft text-center p-2">
<i class="fas fa-plus-circle text-primary mr-2"></i> Tambah Pesanan
</h4>
<div class="card-body">
<form action="{{ route('orders.store') }}" method="POST">
@csrf
<div class="form-group">
<label for="recipient_name"><i class="fas fa-user mr-2"></i> Nama Penerima:</label>
<input type="text" class="form-control" id="recipient_name" name="recipient_name" required>
</div>
<div class="form-group">
<label for="address"><i class="fas fa-map-marker-alt mr-2"></i> Alamat:</label>
<input type="text" class="form-control" id="address" name="address" required>
</div>
<div class="form-group">
<label for="description"><i class="fas fa-info-circle mr-2"></i> Deskripsi Pesanan:</label>
<input type="text" class="form-control" id="description" name="description" required>
</div>
<div class="form-group">
<label for="kurir_id"><i class="fas fa-motorcycle mr-2"></i> Pilih Kurir:</label>
<select class="form-control" id="kurir_id" name="kurir_id" required>
@foreach($kurirs as $kurir)
<option value="{{ $kurir->id }}">{{ $kurir->name }}</option>
@endforeach
</select>
</div>
<button type="submit" class="btn btn-primary mt-3">
<i class="fas fa-save mr-2"></i> Simpan Order
</button>
</form>
</div>
</div>
<div class="card mt-5 mb-4">
<h4 class="card-header bg-info-soft">
<i class="fas fa-table mr-2"></i> Daftar Pesanan
</h4>
<form method="GET" class="mt-4 ml-4" action="{{ route('orders.index') }}">
<p>Pilih tanggal dan klik filter</p>
<label for="filter_date"><i class="fas fa-calendar-alt mr-2"></i></label>
<input type="date" id="filter_date" name="filter_date" value="{{ request('filter_date', now()->toDateString()) }}">
<button type="submit" class="btn btn-primary btn-sm mb-1">Filter</button>
</form>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered table-hover" id="ordersTable">
<thead>
<tr>
<th>No</th>
<th>Nama Penerima</th>
<th>Alamat</th>
<th>Deskripsi</th>
<th>Status</th>
<th>Kurir</th>
<th>Waktu Order</th>
<th>Selesai</th>
<!-- <th>Bukti Pengiriman</th> -->
</tr>
</thead>
<tbody>
@foreach($orders as $order)
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $order->recipient_name }}</td>
<td>{{ $order->address }}</td>
<td>{{ $order->description }}</td>
<td>
<span class="badge
@if($order->status == 'Delivered') badge-success
@elseif($order->status == 'Assigned') badge-warning
@else badge-secondary
@endif">
{{ ucfirst($order->status) }}
</span>
</td>
<td>{{ $order->kurir->name ?? 'Belum ditugaskan' }}</td>
<td>{{ $order->created_at->format('H:i:s') }} WIB</td>
<td>{{ $order->updated_at->format('H:i:s') }} WIB</td>
<!-- <td>
@if($order->image)
<a href="{{ asset('storage/' . $order->image) }}" target="_blank">
<img src="{{ asset('storage/' . $order->image) }}" width="100px" height="auto">
</a>
@else
<span class="text-muted">Belum ada</span>
@endif
</td> -->
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
<script>
document.addEventListener("DOMContentLoaded", function() {
document.querySelectorAll(".track-location").forEach(button => {
button.addEventListener("click", function() {
const kurirId = this.getAttribute("data-kurir-id");
fetch(`/get-latest-location/${kurirId}`)
.then(response => response.json())
.then(data => {
if (data.latitude && data.longitude) {
const url = `http://maps.google.com/maps?q=${data.latitude},${data.longitude}`;
window.open(url, "_blank");
} else {
alert("Lokasi belum tersedia.");
}
})
.catch(error => {
console.error("Error:", error);
});
});
});
});
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

View File

@ -0,0 +1,82 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Kalender Presensi Kurir</title>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css"
integrity="..." crossorigin="anonymous" referrerpolicy="no-referrer" />
<style>
body {
background-color: #f8f9fa;
padding: 2rem;
}
.table-responsive {
max-height: 400px;
overflow-y: auto;
}
.fc-daygrid-event {
background-color: #0d6efd !important;
color: white !important;
border: none !important;
border-radius: 0.25rem;
font-size: 0.75rem;
padding: 2px 4px;
}
.fc-toolbar-title {
font-size: 1.5rem;
}
.calendar-container {
max-width: 1000px;
margin: auto;
background: white;
padding: 1rem;
border-radius: 1rem;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}
</style>
</head>
<body>
<div class="calendar-container">
<h3 class="text-center mb-4">Kalender Presensi Kurir</h3>
<div id="calendar"></div>
</div>
<script src="https://cdn.jsdelivr.net/npm/fullcalendar@6.1.4/index.global.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
const calendarEl = document.getElementById('calendar');
const calendar = new FullCalendar.Calendar(calendarEl, {
initialView: 'dayGridMonth',
locale: 'id', // Optional: Bahasa Indonesia
headerToolbar: {
left: 'prev,next',
center: 'title',
right: 'today'
},
events: [
@foreach($presenceData as $date => $names)
@foreach($names as $name)
{
title: '{{ $name }}',
start: '{{ $date }}',
allDay: true
},
@endforeach
@endforeach
]
});
calendar.render();
});
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

View File

@ -0,0 +1,30 @@
<h3>Laporan Penilaian Semua Kurir - {{ \Carbon\Carbon::createFromDate($year, $month)->translatedFormat('F Y') }}</h3>
<table border="1" cellspacing="0" cellpadding="6">
<thead>
<tr>
<th>No</th>
<th>Nama Kurir</th>
<th>Total Hari Kerja</th>
<th>Total On Time</th>
<th>Total On Target</th>
<th>Predikat</th>
</tr>
</thead>
<tbody>
@foreach($data as $index => $kurir)
<tr>
<td>{{ $index + 1 }}</td>
<td>{{ $kurir['nama'] }}</td>
<td>{{ $kurir['total_hari_kerja'] }}</td>
<td>{{ $kurir['total_ontime'] }}</td>
<td>{{ $kurir['total_ontarget'] }}</td>
<td>{{ $kurir['predikat'] }}</td>
</tr>
@endforeach
</tbody>
</table>
<script>
window.onload = () => window.print();
</script>

View File

@ -0,0 +1,107 @@
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<title>Formulir Penilaian Kinerja - {{ $kurir['nama'] }}</title>
<style>
body {
font-family: 'Arial', sans-serif;
margin: 30px;
font-size: 14px;
}
h2, h3 {
text-align: center;
margin: 0;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 15px;
}
td, th {
border: 1px solid #000;
padding: 6px;
text-align: center;
}
.no-border td {
border: none;
padding: 3px;
}
.keterangan {
margin-top: 10px;
}
.section-title {
font-weight: bold;
margin-top: 25px;
}
.signature {
margin-top: 60px;
display: flex;
justify-content: space-between;
}
.signature div {
width: 45%;
text-align: center;
}
</style>
</head>
<body>
<h2>Formulir Penilaian Kinerja Pegawai</h2>
<h3>MAS KURIR</h3>
<!-- @php
use Carbon\Carbon;
$formattedMonthYear = Carbon::createFromDate($year, $month, 1)->translatedFormat('F Y');
@endphp -->
<div style="text-align: left; margin-top: 20px;">
<p><strong>Nama</strong> : {{ $kurir->name }}</p>
<p><strong>Posisi</strong> : {{ ucfirst($kurir->role) }}</p>
<p><strong>Periode</strong> : {{ $formattedMonthYear }}</p>
</div>
<div class="section-title">I. Rekap Penilaian Kinerja</div>
<table>
<thead>
<tr>
<th>Total Hari Kerja</th>
<th>Total On Time</th>
<th>Total On Target</th>
<th>Predikat</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ $kinerja['total_hari_kerja'] }}</td>
<td>{{ $kinerja['total_ontime'] }}</td>
<td>{{ $kinerja['total_ontarget'] }}</td>
<td><strong>{{ strtoupper($kinerja['predikat']) }}</strong></td>
</tr>
</tbody>
</table>
<div class="keterangan">
<strong>Keterangan:</strong><br>
- On Time: Presensi sebelum pukul 07:30<br>
- On Target: Kurir menerima ≥5 order dalam 1 hari<br>
- Predikat dihitung dari total ontime + on target
</div>
<div class="signature">
<div>
Pegawai<br><br><br><br>
(____________________)
</div>
<div>
Disetujui Oleh<br><br><br><br>
(____________________)
</div>
</div>
</body>
</html>
<script>
window.onload = () => window.print();
</script>

View File

@ -0,0 +1,248 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Laporan Kinerja Pegawai</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" />
<style>
body {
font-family: 'Poppins', sans-serif;
background-color: #ffffff;
padding-top: 50px;
}
.card {
border: none;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
border-radius: 10px;
}
.table-responsive {
max-height: 500px;
overflow-y: auto;
}
.bg-primary-soft {
background-color: #e7f1ff;
}
.table th, .table td {
vertical-align: middle;
}
.card-title i {
margin-right: 0.5rem;
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light fixed-top">
<div class="container">
<a class="navbar-brand" href="#">Dashboard Report</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="{{ route('home') }}">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('orders.index') }}">Order</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('salary.index') }}">Salary</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('report.index') }}">Report</a>
</li>
<li class="nav-item">
<form action="{{ route('logout') }}" method="POST" class="d-flex mt-1">
@csrf
<button type="submit" class="btn btn-sm btn-danger">Logout</button>
</form>
</li>
</ul>
</div>
</div>
</nav>
<div class="container mt-4">
{{-- Filter Bulan --}}
<div class="row">
<div class="col-md-12">
<div class="card shadow-sm">
<div class="card-header bg-primary-soft">
<h4 class="card-title mb-0"><i class="fas fa-filter mr-2"></i> Filter Bulan</h4>
</div>
<div class="card-body">
<form action="{{ route('report.index') }}" method="GET" class="mb-0">
<div class="row g-3">
<div class="col-md-4">
<label for="month">Pilih Bulan:</label>
<select name="month" id="month" class="form-control">
@for ($m = 1; $m <= 12; $m++)
<option value="{{ $m }}" {{ request('month', now()->month) == $m ? 'selected' : '' }}>
{{ \Carbon\Carbon::create(null, $m, 1)->translatedFormat('F') }}
</option>
@endfor
</select>
</div>
<div class="col-md-4">
<label for="year">Pilih Tahun:</label>
<select name="year" id="year" class="form-control">
@for ($y = now()->year; $y >= 2023; $y--)
<option value="{{ $y }}" {{ request('year', now()->year) == $y ? 'selected' : '' }}>
{{ $y }}
</option>
@endfor
</select>
</div>
<div class="col-md-4 d-flex align-items-end">
<button type="submit" class="btn btn-primary w-100">Filter</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
{{-- Grafik --}}
<div class="row mt-4">
<div class="col-md-6 mb-4">
<div class="card h-100 d-flex flex-column">
<div class="card-header bg-info text-white">
<h5 class="mb-0">Grafik Pesanan Pegawai</h5>
</div>
<div class="card-body d-flex flex-column justify-content-center">
<canvas id="ordersChart"></canvas>
</div>
</div>
</div>
<div class="col-md-6 mb-4">
<div class="card h-100 d-flex flex-column">
<div class="card-header bg-info text-white">
<h5 class="mb-0">Grafik Presensi Pegawai</h5>
</div>
<div class="card-body d-flex flex-column justify-content-center">
<canvas id="presencesChart"></canvas>
<a href="{{ route('presensi.index') }}" class="btn btn-outline-primary mt-3 w-100">
Calendar
</a>
</div>
</div>
</div>
</div>
{{-- Tabel Penilaian --}}
<div class="row">
<div class="col-12">
<div class="card shadow-sm mb-3">
<div class="card-header bg-primary text-white">
<h5 class="mb-0">Penilaian Kinerja Kurir</h5>
</div>
<div class="card-body table-responsive">
<table class="table table-bordered table-hover">
<thead class="table-light">
<tr>
<th>No</th>
<th>Nama Kurir</th>
<th>Target Harian</th>
<th>On Time</th>
<th>Predikat</th>
<th>Aksi</th>
<!-- Tambahkan kolom aksi -->
</tr>
</thead>
<tbody>
@foreach ($penilaian as $index => $item)
<tr>
<td>{{ $index + 1 }}</td>
<td>{{ $item['nama_kurir'] }}</td>
<td>{{ $item['target_harian'] }}</td>
<td>{{ $item['ontime'] }}</td>
<td>{{ $item['predikat'] }}</td>
<td>
<a href="{{ route('report.cetak', ['id' => $item['id'], 'month' => $month, 'year' => $year]) }}"
class="btn btn-sm btn-primary" target="_blank">
Cetak
</a>
</td>
</tr>
@endforeach
</tbody>
</table>
<a href="{{ route('report.cetak.semua', ['month' => $month, 'year' => $year]) }}" target="_blank">
<button class="btn btn-primary">Cetak Tabel</button>
</a>
</div>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function() {
let kurirNames = @json($kurirNames);
let totalOrders = @json($totalOrdersData);
let totalDaysWorked = @json($totalDaysWorkedData);
let totalPresences = @json($totalPresencesData);
let ontimePresences = @json($ontimePresencesData);
// Orders Chart
new Chart(document.getElementById('ordersChart'), {
type: 'bar',
data: {
labels: kurirNames,
datasets: [{
label: 'Total Pesanan',
backgroundColor: 'rgba(54, 162, 235, 0.5)',
borderColor: 'rgba(54, 162, 235, 1)',
borderWidth: 1,
data: totalOrders
}, {
label: 'Total Hari Kerja',
backgroundColor: 'rgba(255, 99, 132, 0.5)',
borderColor: 'rgba(255, 99, 132, 1)',
borderWidth: 1,
data: totalDaysWorked
}]
}
});
// Presence Chart
new Chart(document.getElementById('presencesChart'), {
type: 'bar',
data: {
labels: kurirNames,
datasets: [{
label: 'Total Presensi',
backgroundColor: 'rgba(75, 192, 192, 0.5)',
borderColor: 'rgba(75, 192, 192, 1)',
borderWidth: 1,
data: totalPresences
}, {
label: 'On Time',
backgroundColor: 'rgba(255, 205, 86, 0.5)',
borderColor: 'rgba(255, 205, 86, 1)',
borderWidth: 1,
data: ontimePresences
}]
}
});
});
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

View File

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Laporan Kinerja Kurir</title>
<style>
body { font-family: Arial, sans-serif; }
h2 { text-align: center; }
table { width: 100%; border-collapse: collapse; margin-top: 20px; }
th, td { border: 1px solid black; padding: 10px; text-align: left; }
th { background-color: #f2f2f2; }
</style>
</head>
<body>
<h2>Laporan Kinerja Kurir</h2>
<p><strong>Nama Kurir:</strong> {{ $kurir->nama }}</p>
<table>
<tr>
<th>Total Pesanan</th>
<th>On Target</th>
<th>Total Presensi</th>
<th>On Time</th>
</tr>
<tr>
<td>{{ $total_pesanan }}</td>
<td>{{ $on_target }} hari</td>
<td>{{ $total_presensi }}</td>
<td>{{ $on_time }}</td>
</tr>
</table>
<p style="margin-top: 20px;">Laporan ini dibuat pada: {{ now()->format('d-m-Y H:i:s') }}</p>
</body>
</html>

View File

@ -0,0 +1,205 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gaji Kurir</title>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css"
integrity="..." crossorigin="anonymous" referrerpolicy="no-referrer" />
<style>
body {
font-family: 'Poppins', sans-serif; /* Font yang lebih modern */
background-color: #ffffff; /* Warna latar belakang lembut */
padding-top: 50px;
}
.card {
border: none;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Efek bayangan */
border-radius: 10px; /* Sudut membulat */
}
.card-header {
background-color: #e9ecef; /* Warna header lembut */
color: #343a40;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
.card-title {
color: #343a40;
}
.badge {
border-radius: 5px;
padding: 0.3rem 0.6rem;
}
.table-responsive {
max-height: 500px;
overflow-y: auto;
}
/* Warna-warna lembut */
.bg-success-soft {
background-color: #d4edda;
color: #28a745;
}
.bg-primary-soft {
background-color: #cfe2ff;
color: #007bff;
}
.bg-info-soft {
background-color: #d1ecf1;
color: #17a2b8;
}
.bg-warning-soft {
background-color: #fff3cd;
color: #ffc107;
}
</style>
</head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.5.25/jspdf.plugin.autotable.min.js"></script>
<script>
function downloadPDF() {
const { jsPDF } = window.jspdf;
const doc = new jsPDF();
doc.text("Laporan Gaji Kurir", 14, 10);
doc.autoTable({
html: "#salaryTable", // Pastikan ID tabel benar
startY: 20,
theme: "grid",
styles: { fontSize: 10 },
});
doc.save("laporan_gaji_kurir.pdf"); // Nama file PDF
}
</script>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light fixed-top">
<div class="container">
<a class="navbar-brand" href="#">Dashboard Owner</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="{{ route('home') }}">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('orders.index') }}">Order</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('salary.index') }}">Salary</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('report.index') }}">Report</a>
</li>
<li class="nav-item">
<form action="{{ route('logout') }}" method="POST" class="d-flex mt-1">
@csrf
<button type="submit" class="btn btn-sm btn-danger">Logout</button>
</form>
</li>
</ul>
</div>
</div>
</nav>
<div class="container mt-3">
<div class="card mb-4">
<div class="card-header bg-primary-soft">
<i class="fas fa-filter mr-2"></i> Filter Periode
</div>
<div class="card-body">
<form method="GET" action="{{ route('salary.index') }}">
<div class="row">
<div class="col-md-6 mb-2">
<label for="startDate" class="form-label">Tanggal Mulai</label>
<input type="date" class="form-control" name="startDate" value="{{ $startDate }}">
</div>
<div class="col-md-6 mb-2">
<label for="endDate" class="form-label">Tanggal Selesai</label>
<input type="date" class="form-control" name="endDate" value="{{ $endDate }}">
</div>
</div>
<button type="submit" class="btn btn-primary">Filter</button>
</form>
</div>
</div>
<div class="card mb-4">
<div class="card-header bg-success-soft">
<i class="fas fa-money-bill-wave mr-2"></i> Total Gaji
</div>
<div class="card-body">
<h4 class="card-title"><strong>Rp
{{ number_format($totalGajiKurir, 0, ',', '.') }}</strong></h4>
<p class="card-text">Total gaji yang harus dibayarkan bulan ini</p>
</div>
</div>
<div class="card mb-4">
<div class="card-header bg-info-soft">
<i class="fas fa-table mr-2"></i> Daftar Gaji Kurir
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered table-striped" id="salaryTable">
<thead>
<tr>
<th>No</th>
<th>Nama Kurir</th>
<th>Jumlah Pesanan</th>
<th>Gaji per Pesanan</th>
<th>Total Gaji</th>
<th>Aktivitas Terakhir</th>
<th>Target</th>
</tr>
</thead>
<tbody>
@foreach($courierSalaries as $index => $salary)
<tr>
<td>{{ $index + 1 }}</td>
<td>{{ $salary->courier_name }}</td>
<td>{{ $salary->total_orders }}</td>
<td>Rp
{{ number_format($salary->salary_per_order, 0, ',', '.') }}</td>
<td>Rp
{{ number_format($salary->total_salary, 0, ',', '.') }}</td>
<td>{{ $salary->last_order_date }}</td>
<td>
@if($salary->total_orders >= 10)
<span class="badge bg-success text-white">On Target</span>
@else
<span class="badge bg-danger text-white">Off Target</span>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<a onclick="window.print()" class="btn btn-success">Cetak PDF</a>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

View File

@ -0,0 +1,48 @@
<!DOCTYPE html>
<html>
<head>
<title>Gaji Kurir</title>
<style>
table {
width: 100%;
border-collapse: collapse;
}
table, th, td {
border: 1px solid black;
}
th, td {
padding: 10px;
text-align: left;
}
</style>
</head>
<body>
<h2>Daftar Gaji Kurir</h2>
<table>
<thead>
<tr>
<th>No</th>
<th>Nama Kurir</th>
<th>Jumlah Pesanan</th>
<th>Gaji per Pesanan</th>
<th>Total Gaji</th>
<th>Aktivitas Terakhir</th>
<th>Target</th>
</tr>
</thead>
<tbody>
@foreach ($kurirs as $index => $kurir)
<tr>
<td>{{ $index + 1 }}</td>
<td>{{ $kurir->name }}</td>
<td>{{ $kurir->jumlah_pesanan }}</td>
<td>Rp {{ number_format($kurir->gaji_per_pesanan, 0, ',', '.') }}</td>
<td>Rp {{ number_format($kurir->total_gaji, 0, ',', '.') }}</td>
<td>{{ $kurir->aktivitas_terakhir }}</td>
<td>{{ $kurir->target }}</td>
</tr>
@endforeach
</tbody>
</table>
</body>
</html>

View File

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html>
<head>
<title>Live Location</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Leaflet CSS -->
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
<!-- Leaflet JS -->
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<style>
#map {
height: 90vh;
}
</style>
</head>
<body>
<h3>Live Location</h3>
<div id="map"></div>
<script>
const kurirId = {{ $kurirId }}; // Inject dari server
const map = L.map('map').setView([-7.257472, 112.752088], 14);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap contributors'
}).addTo(map);
const marker = L.marker([-7.257472, 112.752088]).addTo(map);
async function updateLocation() {
const res = await fetch(`/api/lokasi-kurir/${kurirId}`);
const data = await res.json();
if (data.lat && data.lng) {
marker.setLatLng([data.lat, data.lng]);
map.panTo([data.lat, data.lng]);
}
}
updateLocation(); // Panggil pertama kali
setInterval(updateLocation, 5000); // Update setiap 5 detik
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

8
routes/console.php Normal file
View File

@ -0,0 +1,8 @@
<?php
use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;
Artisan::command('inspire', function () {
$this->comment(Inspiring::quote());
})->purpose('Display an inspiring quote');

83
routes/web.php Normal file
View File

@ -0,0 +1,83 @@
<?php
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\Auth\RegisterController;
use App\Http\Controllers\KurirDashboardController;
use App\Http\Controllers\LocationController;
use App\Http\Controllers\PresenceController;
use App\Http\Controllers\OrderController;
use App\Http\Controllers\HomeController;
use App\Http\Controllers\SalaryController;
use App\Http\Controllers\ReportController;
use App\Http\Controllers\ReportKurirController;
use App\Http\Controllers\Presences;
use App\Http\Middleware;
use App\Events\LocationUpdated;
use App\Http\Controllers\TrackingController;
Route::get('/', function () {
return view('auth.login');
});
Route::get('/register', function () {
return view('auth.register');
});
Auth::routes();
Route::middleware(['auth', 'role:owner'])->group(function () {
Route::get('/register', [RegisterController::class, 'showRegistrationForm'])->name('register'); // Form register
Route::post('/register', [RegisterController::class, 'register'])->name('register.store'); // Proses register
Route::get('/salary', [SalaryController::class, 'index'])->name('salary.index');
Route::get('/report', [ReportController::class, 'index'])->name('report.index');
Route::get('/order', [OrderController::class, 'index'])->name('orders.index');
Route::post('/order', [OrderController::class, 'create'])->name('orders.index'); // Rute untuk menambah order
Route::post('/order', [OrderController::class, 'store'])->name('orders.store'); // Rute untuk menyimpan order
Route::get('/home', [HomeController::class, 'index'])->name('home');
Route::get('/get-latest-location/{kurir_id}', [TrackingController::class, 'getLatestLocation']);
Route::get('/salary/print', [SalaryController::class, 'printPDF'])->name('salary.print');
Route::get('/presensi', [PresenceController::class, 'index'])->name('presensi.index');
Route::get('/tracking/{id}', [TrackingController::class, 'showTracking'])->name('tracking.view');
Route::get('/api/lokasi-kurir/{id}', [TrackingController::class, 'getLatestLocation']);
Route::get('/cleanup-yesterday', [LocationController::class, 'cleanupYesterday'])->name('location.cleanupYesterday');
Route::get('/report/cetak/{id}/{month}/{year}', [ReportController::class, 'cetakKinerja'])->name('report.cetak');
Route::get('/report/cetak-semua/{month}/{year}', [ReportController::class, 'cetakSemuaKinerja'])->name('report.cetak.semua');
});
// Route untuk customer melihat halaman index dan daftar pesanan
Route::get('/customer/orders', [OrderController::class, 'indexCustomer'])->name('customer.index');
// Route untuk menyimpan pesanan yang dibuat oleh customer
Route::post('/customer/orders/store', [OrderController::class, 'Customer'])->name('orders.customer');
Route::middleware(['auth', 'role:kurir'])->group(function () {
Route::get('/kurir/dashboard', [KurirDashboardController::class, 'indexKurir'])->name('kurir.dashboard');
// Route::get('/kurir/dashboard', [OrderController::class, 'index'])->name('kurir.dashboard');
// Route::get('/kurir/dashboard', [LocationController::class, 'index'])->name('kurir.dashboard');
Route::get('/kurir/order', [OrderController::class, 'indexOrderKurir'])->name('kurir.order');
Route::get('/kurir/report', [ReportKurirController::class, 'index'])->name('kurir.report');
Route::post('/location/store', [LocationController::class, 'store'])->name('location.store');
Route::put('/location/update', [LocationController::class, 'update'])->name('location.update');
Route::post('/location/delete-all', [LocationController::class, 'deleteAll'])->name('location.deleteAll');
Route::put('/kurir/order/{id}/update-status', [OrderController::class, 'updateStatus'])
->name('kurir.updateStatus');
Route::get('/kurir/delivered-orders', [OrderController::class, 'deliveredOrders'])->name('kurir.deliveredOrders');
Route::post('/update-location', function (Request $request) {
$user = auth()->user();
broadcast(new LocationUpdated($user->id, $request->latitude, $request->longitude));
return response()->json(['message' => 'Location updated successfully']);
});
Route::post('/update-location', [KurirController::class, 'updateLocation'])->name('kurir.updateLocation');
Route::get('/report/pdf/{kurir_id}', [ReportController::class, 'generatePdf'])->name('report.pdf');
Route::post('/kurir/send-location', [OrderController::class, 'sendLocation'])->name('kurir.sendLocation');
Route::post('/kurir/upload-bukti/{id}', [OrderController::class, 'uploadBuktiPengiriman'])->name('kurir.uploadBuktiPengiriman');
Route::get('/kurir/track', function () {
return view('kurir.track');
});
});

4
storage/app/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*
!private/
!public/
!.gitignore

2
storage/app/private/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

2
storage/app/public/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

9
storage/framework/.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
compiled.php
config.php
down
events.scanned.php
maintenance.php
routes.php
routes.scanned.php
schedule-*
services.json

3
storage/framework/cache/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
*
!data/
!.gitignore

View File

@ -0,0 +1,2 @@
*
!.gitignore

2
storage/framework/sessions/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

2
storage/framework/testing/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

2
storage/framework/views/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

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