-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jul 25, 2025 at 10:06 AM
-- Server version: 10.4.32-MariaDB
-- PHP Version: 8.2.12

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `absensikukar`
--

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

--
-- Table structure for table `attendances`
--

CREATE TABLE `attendances` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `date` date NOT NULL,
  `type` enum('in','out') NOT NULL,
  `time` time NOT NULL,
  `photo` varchar(255) NOT NULL,
  `latitude` decimal(10,8) NOT NULL,
  `longitude` decimal(11,8) NOT NULL,
  `location_id` bigint(20) UNSIGNED DEFAULT NULL,
  `status` enum('pending','accepted','rejected','jam_kerja_kurang','lembur','late') NOT NULL DEFAULT 'pending',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `attendances`
--

INSERT INTO `attendances` (`id`, `user_id`, `date`, `type`, `time`, `photo`, `latitude`, `longitude`, `location_id`, `status`, `created_at`, `updated_at`) VALUES
(1, 2, '2025-07-14', 'in', '01:17:48', 'attendances/1752430668_2_in.jpg', -8.16681000, 113.70738500, 1, 'accepted', '2025-07-13 18:17:48', '2025-07-13 18:17:48'),
(2, 2, '2025-07-14', 'out', '01:18:27', 'attendances/1752430707_2_out.jpg', -8.16681000, 113.70738500, 1, 'jam_kerja_kurang', '2025-07-13 18:18:27', '2025-07-13 18:18:27'),
(3, 3, '2025-07-14', 'in', '01:19:58', 'attendances/1752430798_3_in.jpg', -8.16681000, 113.70738500, 1, 'accepted', '2025-07-13 18:19:58', '2025-07-13 18:19:58'),
(4, 3, '2025-07-14', 'out', '15:09:28', 'attendances/1752480567_3_out.jpg', -8.16681000, 113.70738500, 1, 'accepted', '2025-07-14 08:09:28', '2025-07-14 08:09:28'),
(7, 2, '2025-07-20', 'in', '15:03:11', 'attendances/1752998591_2_in.jpg', -8.16668940, 113.70738110, 1, 'late', '2025-07-20 08:03:11', '2025-07-20 08:03:11'),
(8, 2, '2025-07-20', 'out', '15:04:01', 'attendances/1752998641_2_out.jpg', -8.16679880, 113.70740190, 1, 'jam_kerja_kurang', '2025-07-20 08:04:01', '2025-07-20 08:04:01');

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

--
-- Table structure for table `failed_jobs`
--

CREATE TABLE `failed_jobs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `uuid` varchar(255) NOT NULL,
  `connection` text NOT NULL,
  `queue` text NOT NULL,
  `payload` longtext NOT NULL,
  `exception` longtext NOT NULL,
  `failed_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `locations`
--

CREATE TABLE `locations` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `center_lat` decimal(10,6) NOT NULL,
  `center_lng` decimal(11,6) NOT NULL,
  `radius` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `locations`
--

INSERT INTO `locations` (`id`, `name`, `center_lat`, `center_lng`, `radius`, `created_at`, `updated_at`) VALUES
(1, 'Kantor Pusat', -8.162258, 113.709151, 650, '2025-07-13 17:35:55', '2025-07-20 08:02:44');

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

--
-- Table structure for table `migrations`
--

CREATE TABLE `migrations` (
  `id` int(10) UNSIGNED NOT NULL,
  `migration` varchar(255) NOT NULL,
  `batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `migrations`
--

INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2014_10_12_000000_create_users_table', 1),
(2, '2014_10_12_100000_create_password_reset_tokens_table', 1),
(3, '2019_08_19_000000_create_failed_jobs_table', 1),
(4, '2019_12_14_000001_create_personal_access_tokens_table', 1),
(5, '2025_06_15_000001_create_user_profiles_table', 1),
(6, '2025_06_15_000002_create_locations_table', 1),
(8, '2025_06_15_000005_create_permissions_table', 1),
(9, '2025_06_15_000003_create_attendances_table', 2);

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

--
-- Table structure for table `password_reset_tokens`
--

CREATE TABLE `password_reset_tokens` (
  `email` varchar(255) NOT NULL,
  `token` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `permissions`
--

CREATE TABLE `permissions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `start_date` date NOT NULL,
  `end_date` date NOT NULL,
  `category` varchar(255) NOT NULL,
  `reason` text NOT NULL,
  `proof_photo` varchar(255) DEFAULT NULL,
  `status` enum('pending','accepted','rejected') NOT NULL DEFAULT 'pending',
  `approved_by` bigint(20) UNSIGNED DEFAULT NULL,
  `approved_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `permissions`
--

INSERT INTO `permissions` (`id`, `user_id`, `start_date`, `end_date`, `category`, `reason`, `proof_photo`, `status`, `approved_by`, `approved_at`, `created_at`, `updated_at`) VALUES
(1, 2, '2025-07-15', '2025-07-16', 'Dinas di Luar', 'Ditugaskan di Surabaya', NULL, 'accepted', 1, '2025-07-13 18:01:48', '2025-07-13 18:01:15', '2025-07-13 18:01:48'),
(2, 2, '2025-07-24', '2025-07-24', 'Izin Sakit', 'Sakit flu', NULL, 'accepted', 1, '2025-07-14 07:49:57', '2025-07-14 07:17:32', '2025-07-14 07:49:57'),
(3, 2, '2025-07-30', '2025-07-30', 'Izin Setengah Hari', 'setengah hari karna ada kepentingan keluarga', NULL, 'rejected', 1, '2025-07-14 07:49:38', '2025-07-14 07:18:00', '2025-07-14 07:49:38'),
(4, 2, '2025-07-21', '2025-07-21', 'Cuti Tahunan', 'cuti bro', NULL, 'accepted', 1, '2025-07-14 07:49:12', '2025-07-14 07:18:33', '2025-07-14 07:49:12'),
(5, 3, '2025-07-15', '2025-07-15', 'Izin Setengah Hari', 'asd', NULL, 'accepted', 1, '2025-07-14 08:13:38', '2025-07-14 08:09:49', '2025-07-14 08:13:38'),
(6, 3, '2025-07-18', '2025-07-18', 'Dinas di Luar', '1232', NULL, 'accepted', 1, '2025-07-14 08:13:33', '2025-07-14 08:10:01', '2025-07-14 08:13:33'),
(7, 4, '2025-07-16', '2025-07-16', 'Cuti Tahunan', 'asdasd', NULL, 'accepted', 1, '2025-07-14 08:13:28', '2025-07-14 08:11:50', '2025-07-14 08:13:28'),
(8, 2, '2025-07-25', '2025-07-25', 'Cuti Tahunan', 'dgyuuojj', 'permissions/1752998147_2_permission.jpg', 'accepted', 1, '2025-07-20 07:56:49', '2025-07-20 07:55:47', '2025-07-20 07:56:49'),
(9, 2, '2025-07-31', '2025-07-31', 'Cuti Tahunan', 'abc', 'permissions/1752998679_2_permission.jpg', 'accepted', 1, '2025-07-20 08:05:17', '2025-07-20 08:04:39', '2025-07-20 08:05:17');

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

--
-- Table structure for table `personal_access_tokens`
--

CREATE TABLE `personal_access_tokens` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `tokenable_type` varchar(255) NOT NULL,
  `tokenable_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `token` varchar(64) NOT NULL,
  `abilities` text DEFAULT NULL,
  `last_used_at` timestamp NULL DEFAULT NULL,
  `expires_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `personal_access_tokens`
--

INSERT INTO `personal_access_tokens` (`id`, `tokenable_type`, `tokenable_id`, `name`, `token`, `abilities`, `last_used_at`, `expires_at`, `created_at`, `updated_at`) VALUES
(13, 'App\\Models\\User', 4, 'auth_token', 'd21aa4b7b90d81ea455a4df260735d1fceee34832f8dc1a20377b17ab4ffd081', '[\"*\"]', '2025-07-14 08:11:55', NULL, '2025-07-14 08:11:27', '2025-07-14 08:11:55'),
(19, 'App\\Models\\User', 7, 'auth_token', '5e9b0621b19cba90a13bbc09a6a05fe19d705fd2c9dc0f0550497d4c08586e21', '[\"*\"]', '2025-07-20 08:08:57', NULL, '2025-07-20 08:08:44', '2025-07-20 08:08:57');

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

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `email_verified_at` timestamp NULL DEFAULT NULL,
  `password` varchar(255) NOT NULL,
  `role` enum('admin','karyawan') NOT NULL DEFAULT 'karyawan',
  `remember_token` varchar(100) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`id`, `name`, `email`, `email_verified_at`, `password`, `role`, `remember_token`, `created_at`, `updated_at`) VALUES
(1, 'Admin', 'admin@example.com', '2025-07-13 16:52:20', '$2y$10$SN9HQYQ3jjylEFXQAJL/Zu30wBYJobBnuYMIhBmnFKalgEVUOWHwO', 'admin', 'LHNOyGfe2x', '2025-07-13 16:52:20', '2025-07-13 16:52:20'),
(2, 'Yusril', 'yusril@gmail.com', NULL, '$2y$10$kBJonA0pPEHqQ0kwd99cCO1ba.jcNurJifXMirBNNh1296iaz1OXi', 'karyawan', NULL, '2025-07-13 16:55:32', '2025-07-13 16:55:32'),
(3, 'Adib', 'adib@gmail.com', NULL, '$2y$10$a/gg0BgJB6ECGZkUgzq5Xu2n7t4IEV0CBMAsbmPwiLzrHVoNQbkMO', 'karyawan', NULL, '2025-07-13 18:19:10', '2025-07-13 18:19:10'),
(4, 'Zidan', 'zidan@gmail.com', NULL, '$2y$10$FqegCT5/5zjl4HTZKd14hefgDvbNB96CBjBLMJFvp5hY2wargqAuC', 'karyawan', NULL, '2025-07-14 08:11:11', '2025-07-14 08:11:11'),
(5, 'Ardi Aziz', 'ardi@gmail.com', NULL, '$2y$10$wPJRZs.7/kcvAUSjQ4wXReo3bFjFcnmaEJOkEaw2WaRA0ssCvOwg6', 'karyawan', NULL, '2025-07-14 08:12:34', '2025-07-14 08:12:34'),
(6, 'Raihan', 'raihan@gmail.com', NULL, '$2y$10$OXmDtzISX/UuBohoOPvyXu.LHUv3wKPAcwDMpSxxtasnRz3aMJnzi', 'karyawan', NULL, '2025-07-14 08:15:08', '2025-07-14 08:15:08'),
(7, 'Bain', 'bain@gmail.com', NULL, '$2y$10$xd8VHkFZEVpf4UeEqNPqnemttdwacJupVC35yYTIx.6jFpbvnr6B2', 'karyawan', NULL, '2025-07-20 08:08:14', '2025-07-20 08:08:14');

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

--
-- Table structure for table `user_profiles`
--

CREATE TABLE `user_profiles` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `nip` varchar(255) NOT NULL,
  `position` varchar(255) NOT NULL,
  `phone_number` varchar(255) NOT NULL,
  `profile_photo` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `user_profiles`
--

INSERT INTO `user_profiles` (`id`, `user_id`, `nip`, `position`, `phone_number`, `profile_photo`, `created_at`, `updated_at`) VALUES
(1, 2, '12083901242', 'Ketum', '0812321323', '1752425732_IMG_E2696.jpg', '2025-07-13 16:55:33', '2025-07-13 16:55:33'),
(2, 3, '123971247124124', 'SKK', '0812312942412', NULL, '2025-07-13 18:19:10', '2025-07-13 18:19:10'),
(3, 4, '1231242151', 'Lektor', '08123414211', NULL, '2025-07-14 08:11:11', '2025-07-14 08:11:11'),
(4, 5, '1234219841', 'Digital Analisis', '08129319459912', NULL, '2025-07-14 08:12:34', '2025-07-14 08:12:34'),
(5, 6, '1294912842', 'Satpam', '0812412492', NULL, '2025-07-14 08:15:08', '2025-07-14 08:15:08'),
(6, 7, '23456789076', 'Digital Analisis', '0876543212345678', '1752998894_017754 (1).jpg', '2025-07-20 08:08:14', '2025-07-20 08:08:14');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `attendances`
--
ALTER TABLE `attendances`
  ADD PRIMARY KEY (`id`),
  ADD KEY `attendances_user_id_foreign` (`user_id`),
  ADD KEY `attendances_location_id_foreign` (`location_id`);

--
-- Indexes for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`);

--
-- Indexes for table `locations`
--
ALTER TABLE `locations`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `password_reset_tokens`
--
ALTER TABLE `password_reset_tokens`
  ADD PRIMARY KEY (`email`);

--
-- Indexes for table `permissions`
--
ALTER TABLE `permissions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `permissions_user_id_foreign` (`user_id`),
  ADD KEY `permissions_approved_by_foreign` (`approved_by`);

--
-- Indexes for table `personal_access_tokens`
--
ALTER TABLE `personal_access_tokens`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `personal_access_tokens_token_unique` (`token`),
  ADD KEY `personal_access_tokens_tokenable_type_tokenable_id_index` (`tokenable_type`,`tokenable_id`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `users_email_unique` (`email`);

--
-- Indexes for table `user_profiles`
--
ALTER TABLE `user_profiles`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `user_profiles_nip_unique` (`nip`),
  ADD KEY `user_profiles_user_id_foreign` (`user_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `attendances`
--
ALTER TABLE `attendances`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `locations`
--
ALTER TABLE `locations`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `permissions`
--
ALTER TABLE `permissions`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `personal_access_tokens`
--
ALTER TABLE `personal_access_tokens`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=20;

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT for table `user_profiles`
--
ALTER TABLE `user_profiles`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `attendances`
--
ALTER TABLE `attendances`
  ADD CONSTRAINT `attendances_location_id_foreign` FOREIGN KEY (`location_id`) REFERENCES `locations` (`id`),
  ADD CONSTRAINT `attendances_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `permissions`
--
ALTER TABLE `permissions`
  ADD CONSTRAINT `permissions_approved_by_foreign` FOREIGN KEY (`approved_by`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `permissions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `user_profiles`
--
ALTER TABLE `user_profiles`
  ADD CONSTRAINT `user_profiles_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
