-- https://www.phpmyadmin.net/
--
-- Waktu pembuatan: 23 Agu 2025 pada 10.24
-- Versi server: 11.8.3-MariaDB-log
-- Versi PHP: 8.3.24

START TRANSACTION;



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

--
-- Struktur dari tabel `distribusi_reseller_log`
--

CREATE TABLE `distribusi_reseller_log` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `router_id` bigint(20) UNSIGNED NOT NULL,
  `profil_id` bigint(20) UNSIGNED NOT NULL,
  `karyawan_id` bigint(20) UNSIGNED NOT NULL,
  `reseller_id` bigint(20) UNSIGNED NOT NULL,
  `nomor_seri` text DEFAULT NULL,
  `jumlah` int(11) NOT NULL,
  `tanggal_distribusi` timestamp NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Struktur dari tabel `distribusi_reseller_logs`
--

CREATE TABLE `distribusi_reseller_logs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Struktur dari tabel `failed_jobs`
--

CREATE TABLE `failed_jobs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `uuid` varchar(191) 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;

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

--
-- Struktur dari tabel `jobs`
--

CREATE TABLE `jobs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `queue` varchar(191) NOT NULL,
  `payload` longtext NOT NULL,
  `attempts` tinyint(3) UNSIGNED NOT NULL,
  `reserved_at` int(10) UNSIGNED DEFAULT NULL,
  `available_at` int(10) UNSIGNED NOT NULL,
  `created_at` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Struktur dari tabel `job_batches`
--

CREATE TABLE `job_batches` (
  `id` varchar(191) NOT NULL,
  `name` varchar(191) NOT NULL,
  `total_jobs` int(11) NOT NULL,
  `pending_jobs` int(11) NOT NULL,
  `failed_jobs` int(11) NOT NULL,
  `failed_job_ids` longtext NOT NULL,
  `options` mediumtext DEFAULT NULL,
  `cancelled_at` int(11) DEFAULT NULL,
  `created_at` int(11) NOT NULL,
  `finished_at` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Struktur dari tabel `karyawan_stok`
--

CREATE TABLE `karyawan_stok` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Struktur dari tabel `migrations`
--

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

--
-- Dumping data untuk tabel `migrations`
--

INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '0001_01_01_000000_create_users_table', 1),
(2, '0001_01_01_000001_create_cache_table', 1),
(3, '0001_01_01_000002_create_jobs_table', 1),
(4, '2025_01_25_100001_create_freeradius_tables', 1),
(5, '2025_01_26_000000_fix_mysql_index_length_issues', 1),
(6, '2025_07_05_104849_add_karyawan_details_to_users_table', 1),
(7, '2025_07_05_161042_add_role_to_users_table', 1),
(8, '2025_07_05_173219_add_karyawan_id_to_users_table', 1),
(9, '2025_07_06_000001_add_status_to_users_table', 1),
(10, '2025_07_06_030000_create_aktivasi_reseller_table', 1),
(11, '2025_07_06_122808_create_settings_table', 1),
(12, '2025_07_09_201806_create_voucher_templates_table', 1),
(13, '2025_07_09_202931_add_html_and_access_to_voucher_templates_table', 1),
(14, '2025_07_20_014821_add_voucher_info_to_aktivasi_reseller_table', 1),
(15, '2025_07_20_134236_add_server_to_users_table', 1),
(16, '2025_07_22_202212_create_user_profiles_table', 1),
(17, '2025_07_23_020642_create_routers_table', 1),
(18, '2025_07_23_022122_create_grup_mikrotik_table', 1),
(19, '2025_07_23_170117_add_koneksi_to_routers_table', 1),
(20, '2025_07_23_235516_add_color_to_user_profiles_table', 1),
(21, '2025_07_24_052613_create_vouchers_table', 1),
(22, '2025_07_25_102520_remove_karyawan_feature_from_users_table', 1),
(23, '2025_07_25_172853_restore_karyawan_columns_to_users_table', 1),
(24, '2025_07_25_173940_restore_karyawan_columns_to_users_table', 1),
(25, '2025_07_25_214322_create_distribusi_offline_table', 1),
(26, '2025_07_25_214329_create_stok_karyawan_table', 1),
(27, '2025_07_25_223040_create_saldo_karyawan_table', 1),
(28, '2025_07_25_224633_create_saldo_reseller_table', 1),
(29, '2025_07_25_225723_add_terbayar_to_saldo_reseller_table', 1),
(30, '2025_07_25_233721_add_limit_max_hutang_to_users_table', 1),
(31, '2025_07_25_235409_add_token_transaksi_to_users_table', 1),
(32, '2025_07_26_053140_add_router_id_to_users_table', 1),
(33, '2025_07_26_070835_remove_mikrotik_columns_from_user_profiles_table', 1),
(34, '2025_07_26_071416_add_router_id_to_user_profiles_table', 1),
(35, '2025_07_27_054210_create_stok_reseller_table', 1),
(36, '2025_07_27_054317_add_columns_to_stok_reseller_table', 1),
(37, '2025_07_27_210209_create_stok_owner_table', 1),
(38, '2025_07_27_212245_add_stok_columns_to_stok_karyawan_table', 1),
(39, '2025_07_27_212804_drop_redundant_reseller_stock_tables', 1),
(40, '2025_07_27_213036_add_sales_columns_to_stok_reseller_table', 1),
(41, '2025_07_27_213923_drop_voucher_database_table', 1),
(42, '2025_07_27_214024_drop_aktivasi_pelanggan_table', 1),
(43, '2025_07_27_214116_drop_grup_mikrotik_table', 1),
(44, '2025_07_27_214155_rename_distribusi_offline_to_offline_distribution_logs_table', 1),
(45, '2025_07_27_220133_modify_user_profiles_and_drop_bandwidth_profiles', 1),
(46, '2025_07_28_001517_create_distribusi_reseller_log_table', 1),
(47, '2025_07_28_012620_create_reseller_distribution_logs_table', 1),
(48, '2025_07_28_013950_create_karyawan_stok_table', 1),
(49, '2025_07_28_014107_create_saldos_table', 1),
(50, '2025_07_28_072818_add_distribusi_reseller_to_stok_karyawans_table', 1),
(51, '2025_07_28_100001_fix_stok_reseller_table', 1),
(52, '2025_07_29_061954_modify_vouchers_duration_column', 1),
(53, '2025_08_03_062056_add_print_side_to_voucher_templates_table', 1),
(54, '2025_08_03_091048_add_columns_to_vouchers_table', 1),
(55, '2025_08_03_091500_add_hpp_komisi_hjk_to_vouchers_table', 1),
(56, '2025_08_03_091656_add_basic_columns_to_vouchers_table', 1),
(57, '2025_08_04_102756_create_distribusi_reseller_log_table', 1),
(58, '2025_08_04_135343_create_distribusi_reseller_logs_table', 1),
(59, '2025_08_04_235628_create_olts_table', 1),
(60, '2025_08_05_162039_add_missing_columns_to_users_table', 1),
(61, '2025_08_06_171808_add_duration_in_minutes_to_user_profiles_table', 1);

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

--
-- Struktur dari tabel `offline_distribution_logs`
--

CREATE TABLE `offline_distribution_logs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `router_id` bigint(20) UNSIGNED NOT NULL,
  `profil_id` bigint(20) UNSIGNED NOT NULL,
  `karyawan_id` bigint(20) UNSIGNED NOT NULL,
  `nomor_seri` text NOT NULL,
  `jumlah` int(11) NOT NULL,
  `tanggal_distribusi` timestamp NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Struktur dari tabel `radacct`
--

CREATE TABLE `radacct` (
  `radacctid` bigint(20) UNSIGNED NOT NULL,
  `acctsessionid` varchar(64) DEFAULT NULL,
  `acctuniqueid` varchar(32) NOT NULL,
  `username` varchar(64) DEFAULT NULL,
  `groupname` varchar(64) DEFAULT NULL,
  `realm` varchar(64) DEFAULT NULL,
  `nasipaddress` varchar(15) DEFAULT NULL,
  `nasportid` varchar(15) DEFAULT NULL,
  `nasporttype` varchar(32) DEFAULT NULL,
  `acctstarttime` datetime DEFAULT NULL,
  `acctupdatetime` datetime DEFAULT NULL,
  `acctstoptime` datetime DEFAULT NULL,
  `acctinterval` int(11) DEFAULT NULL,
  `acctsessiontime` bigint(20) UNSIGNED DEFAULT NULL,
  `acctauthentic` varchar(32) DEFAULT NULL,
  `connectinfo_start` varchar(50) DEFAULT NULL,
  `connectinfo_stop` varchar(50) DEFAULT NULL,
  `acctinputoctets` bigint(20) UNSIGNED DEFAULT NULL,
  `acctoutputoctets` bigint(20) UNSIGNED DEFAULT NULL,
  `calledstationid` varchar(50) DEFAULT NULL,
  `callingstationid` varchar(50) DEFAULT NULL,
  `acctterminatecause` varchar(32) DEFAULT NULL,
  `servicetype` varchar(32) DEFAULT NULL,
  `framedprotocol` varchar(32) DEFAULT NULL,
  `framedipaddress` varchar(15) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Struktur dari tabel `radcheck`
--

CREATE TABLE `radcheck` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `username` varchar(64) DEFAULT NULL,
  `attribute` varchar(64) DEFAULT NULL,
  `op` varchar(2) DEFAULT NULL,
  `value` varchar(253) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Struktur dari tabel `radreply`
--

CREATE TABLE `radreply` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `username` varchar(64) DEFAULT NULL,
  `attribute` varchar(64) DEFAULT NULL,
  `op` varchar(2) DEFAULT NULL,
  `value` varchar(253) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Struktur dari tabel `radusergroup`
--

CREATE TABLE `radusergroup` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `username` varchar(64) DEFAULT NULL,
  `groupname` varchar(64) DEFAULT NULL,
  `priority` int(11) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Struktur dari tabel `reseller_distribution_logs`
--

CREATE TABLE `reseller_distribution_logs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Struktur dari tabel `saldos`
--

CREATE TABLE `saldos` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Struktur dari tabel `saldo_karyawan`
--

CREATE TABLE `saldo_karyawan` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `karyawan_id` bigint(20) UNSIGNED NOT NULL,
  `saldo` decimal(15,2) NOT NULL DEFAULT 0.00,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Struktur dari tabel `saldo_reseller`
--

CREATE TABLE `saldo_reseller` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `reseller_id` bigint(20) UNSIGNED NOT NULL,
  `saldo` decimal(15,2) NOT NULL DEFAULT 0.00,
  `terbayar` decimal(15,2) NOT NULL DEFAULT 0.00,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Struktur dari tabel `sessions`
--

CREATE TABLE `sessions` (
  `id` varchar(191) NOT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `ip_address` varchar(45) DEFAULT NULL,
  `user_agent` text DEFAULT NULL,
  `payload` longtext NOT NULL,
  `last_activity` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `sessions`
--

INSERT INTO `sessions` (`id`, `user_id`, `ip_address`, `user_agent`, `payload`, `last_activity`) VALUES
('29ACopCp7mFGxfi6pGVue5Itc2vyQAbNQV7eIUum', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36', 'YTo1OntzOjY6Il90b2tlbiI7czo0MDoiY3NqWnNldHRBZjdsT0JucmxidnlGQk9DS2l5T1JXVk8zNG5OQ0xXSiI7czozOiJ1cmwiO2E6MDp7fXM6OToiX3ByZXZpb3VzIjthOjE6e3M6MzoidXJsIjtzOjgyOiJodHRwOi8vMTI3LjAuMC4xOjgwMDAvdm91Y2hlcnMvcHJpbnQtbGF6eS1sb2FkP2xpbWl0PTEwMCZvZmZzZXQ9MCZwcmludF9zaWRlPWZyb250Ijt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319czo1MDoibG9naW5fd2ViXzU5YmEzNmFkZGMyYjJmOTQwMTU4MGYwMTRjN2Y1OGVhNGUzMDk4OWQiO2k6MTt9', 1755525223),
('Rw9Y7H4IfjAuIZgVTuxtAbwyuuffAffVwP6N1y2P', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Trae/1.100.3 Chrome/132.0.6834.210 Electron/34.5.1 Safari/537.36', 'YTo1OntzOjY6Il90b2tlbiI7czo0MDoiZGJVbWhDQjVrRHV2S3VBTXVwUjBjb0JXYVFpMkdaeGZMT1BrUWVVMSI7czozOiJ1cmwiO2E6MDp7fXM6OToiX3ByZXZpb3VzIjthOjE6e3M6MzoidXJsIjtzOjc4OiJodHRwOi8vMTI3LjAuMC4xOjgwMDAvdm91Y2hlcnMvZGF0YWJhc2U/aWRlX3dlYnZpZXdfcmVxdWVzdF90aW1lPTE3NTU1MjQ2NjU3NDciO31zOjY6Il9mbGFzaCI7YToyOntzOjM6Im9sZCI7YTowOnt9czozOiJuZXciO2E6MDp7fX1zOjUwOiJsb2dpbl93ZWJfNTliYTM2YWRkYzJiMmY5NDAxNTgwZjAxNGM3ZjU4ZWE0ZTMwOTg5ZCI7aToxO30=', 1755524747);

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

--
-- Struktur dari tabel `stok_karyawan`
--

CREATE TABLE `stok_karyawan` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `karyawan_id` bigint(20) UNSIGNED NOT NULL,
  `router_id` bigint(20) UNSIGNED NOT NULL,
  `profil_id` bigint(20) UNSIGNED NOT NULL,
  `jumlah` int(11) NOT NULL DEFAULT 0,
  `distribusi_reseller` int(11) NOT NULL DEFAULT 0,
  `terjual` int(11) NOT NULL DEFAULT 0,
  `retur` int(11) NOT NULL DEFAULT 0,
  `sisa_stok` int(11) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Struktur dari tabel `stok_owner`
--

CREATE TABLE `stok_owner` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `router_name` varchar(191) NOT NULL,
  `profile_name` varchar(191) NOT NULL,
  `stok` int(11) NOT NULL DEFAULT 0,
  `distribusi_karyawan` int(11) NOT NULL DEFAULT 0,
  `terjual` int(11) NOT NULL DEFAULT 0,
  `retur` int(11) NOT NULL DEFAULT 0,
  `sisa_stok` int(11) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `stok_owner`
--

INSERT INTO `stok_owner` (`id`, `router_name`, `profile_name`, `stok`, `distribusi_karyawan`, `terjual`, `retur`, `sisa_stok`, `created_at`, `updated_at`) VALUES
(1, 'Desa Digital', 'RP-3.000/12-JAM', 1000, 0, 0, 0, 1000, '2025-08-14 08:19:29', '2025-08-16 19:01:31');

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

--
-- Struktur dari tabel `stok_reseller`
--

CREATE TABLE `stok_reseller` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `router_name` varchar(191) NOT NULL,
  `profile_name` varchar(191) NOT NULL,
  `karyawan_name` varchar(191) NOT NULL,
  `reseller_name` varchar(191) NOT NULL,
  `stok_dari_karyawan` int(11) NOT NULL DEFAULT 0,
  `terjual` int(11) NOT NULL DEFAULT 0,
  `sisa_stok` int(11) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Struktur dari tabel `user_profiles`
--

CREATE TABLE `user_profiles` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(191) NOT NULL,
  `color` varchar(191) DEFAULT NULL,
  `router_id` bigint(20) UNSIGNED DEFAULT NULL,
  `shared_users` int(11) NOT NULL DEFAULT 1,
  `quota` varchar(191) DEFAULT NULL,
  `duration` varchar(191) NOT NULL,
  `duration_in_minutes` int(11) DEFAULT NULL,
  `active_duration` varchar(191) NOT NULL,
  `hpp` int(11) NOT NULL,
  `commission` int(11) NOT NULL,
  `hjk` int(11) NOT NULL,
  `active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `address_list` varchar(191) DEFAULT NULL,
  `rate_limit` varchar(191) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `user_profiles`
--

INSERT INTO `user_profiles` (`id`, `name`, `color`, `router_id`, `shared_users`, `quota`, `duration`, `duration_in_minutes`, `active_duration`, `hpp`, `commission`, `hjk`, `active`, `created_at`, `updated_at`, `address_list`, `rate_limit`) VALUES
(1, 'RP-3.000/12-JAM', '#faffb8', 1, 1, 'unlimited', 'unlimited', NULL, '12jam', 2500, 500, 3000, 1, '2025-08-10 21:21:48', '2025-08-10 21:21:48', NULL, NULL),
(2, 'RP-5.000/24-JAM', '#b3ffde', 1, 1, 'unlimited', 'unlimited', NULL, '1hari', 4500, 500, 5000, 1, '2025-08-10 21:22:38', '2025-08-10 21:22:38', NULL, NULL);

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

--
-- Struktur dari tabel `voucher_templates`
--

CREATE TABLE `voucher_templates` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(191) NOT NULL,
  `accessible_by` varchar(191) NOT NULL DEFAULT 'All Users',
  `print_side` varchar(191) NOT NULL DEFAULT 'depan',
  `status` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `html_content` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `voucher_templates`
--

INSERT INTO `voucher_templates` (`id`, `name`, `accessible_by`, `print_side`, `status`, `created_at`, `updated_at`, `html_content`) VALUES
(1, 'Desa Digital', 'all', 'depan', 1, '2025-08-14 11:42:34', '2025-08-14 16:58:55', '<!DOCTYPE html>\n<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n<title>Voucher Ticket</title>\n<style type=\"text/css\">\n    :root {\n        /* --- SKALA UTAMA --- */\n        --skala: 0.3; /* Ubah ini saja untuk perbesar/perkecil semua ukuran */\n        \n        /* --- PENGATURAN UTAMA --- */\n        --lebar-voucher: calc(450px * var(--skala));\n        --tinggi-voucher: calc(140px * var(--skala));\n        --warna-latar: [WARNA_BACKGROUND];\n        \n        /* --- PENGATURAN FONT --- */\n        --font-utama: \'Arial Black\', Gadget, sans-serif;\n        --warna-font-utama: #000000;\n\n        /* --- PENGATURAN LOGO --- */\n        --logo-atas: calc(2px * var(--skala));\n        --logo-kiri: calc(20px * var(--skala));\n        --lebar-logo: calc(150px * var(--skala));\n        --tinggi-logo: calc(48px * var(--skala));\n\n        /* --- PENGATURAN TELEPON --- */\n        --telepon-atas: calc(31.6px * var(--skala));\n        --telepon-kanan: calc(270px * var(--skala));\n        --ukuran-font-telepon: calc(11px * var(--skala));\n\n        /* --- PENGATURAN KODE VOUCHER --- */\n        --kode-atas: calc(75px * var(--skala));\n        --kode-kiri: calc(140px * var(--skala));\n        --ukuran-font-kode: calc(25px * var(--skala));\n        --warna-font-kode: #000000;\n\n        /* --- PENGATURAN VALIDITAS --- */\n        --validitas-atas: calc(10px * var(--skala));\n        --validitas-kanan: calc(125px * var(--skala));\n        --ukuran-font-validitas: calc(12px * var(--skala));\n\n        /* --- PENGATURAN HARGA --- */\n        --harga-atas: calc(3px * var(--skala));\n        --harga-kanan: calc(18px * var(--skala));\n        --ukuran-font-harga: calc(14px * var(--skala));\n\n        /* --- PENGATURAN NOMOR URUT --- */\n        --serial-atas: calc(5px * var(--skala));\n        --serial-kiri: calc(210px * var(--skala));\n        --ukuran-font-serial: calc(30px * var(--skala));\n    }\n\n    body { margin: 0; padding: 0; font-family: var(--font-utama); }\n    .voucher-ticket {\n        width: var(--lebar-voucher);\n        height: var(--tinggi-voucher);\n        background-image: url(\'https://indradius.net/voucher.png\');\n        background-color: var(--warna-latar);\n        background-size: 100% 100%;\n        background-repeat: no-repeat;\n        position: relative;\n        overflow: hidden;\n        color: var(--warna-font-utama);\n    }\n    .logo, .telepon, .kode-voucher, .validitas, .harga, .serial-number { position: absolute; }\n    .logo { top: var(--logo-atas); left: var(--logo-kiri); width: var(--lebar-logo); height: var(--tinggi-logo); }\n    .telepon { top: var(--telepon-atas); right: var(--telepon-kanan); font-size: var(--ukuran-font-telepon); font-weight: bold; }\n    .kode-voucher { top: var(--kode-atas); left: var(--kode-kiri); font-size: var(--ukuran-font-kode); color: var(--warna-font-kode); text-align: center; font-weight: bold; }\n    .validitas { top: var(--validitas-atas); right: var(--validitas-kanan); font-size: var(--ukuran-font-validitas); writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; font-weight: bold; }\n    .harga { top: var(--harga-atas); right: var(--harga-kanan); font-size: var(--ukuran-font-harga); writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; font-weight: bold; }\n    .serial-number { top: var(--serial-atas); left: var(--serial-kiri); font-size: var(--ukuran-font-serial); font-weight: bold; }\n</style>\n</head>\n<body>\n    <div class=\"voucher-ticket\">\n        <img src=\"https://indradius.net/logo.png\" class=\"logo\" alt=\"Logo\">\n        <div class=\"telepon\">{$c[\'phone\']}</div>\n        <div class=\"kode-voucher\">{$vs[\'code\']}</div>\n        <div class=\"validitas\">Masa Aktif {$vs[\'validprint\']}</div>\n        <div class=\"harga\">Harga {$vs[\'price\']}</div>\n        <div class=\"serial-number\">{$serial_number}</div>\n    </div>\n</body>\n</html>'),
(2, 'INDRADIUS_B', 'all', 'belakang', 1, '2025-08-19 09:05:52', '2025-08-20 19:23:23', '<!DOCTYPE html> \n<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n<title>Voucher Ticket - Back</title>\n<style type=\"text/css\">\n    :root {\n        --skala: 0.42;\n\n        /* Ukuran Voucher */\n        --lebar-voucher: calc(450px * var(--skala));\n        --tinggi-voucher: calc(140px * var(--skala));\n\n        /* Font */\n        --font-utama: \'Arial\', sans-serif;\n        --warna-font: #111;\n        --ukuran-font-judul: calc(10px * var(--skala));\n        --ukuran-font-isi: calc(9.5px * var(--skala));\n\n        /* Logo */\n        --logo-lebar: calc(45px * var(--skala));\n        --logo-tinggi: auto;\n\n        /* Serial */\n        --ukuran-font-serial: calc(12px * var(--skala));\n    }\n\n    body { margin: 0; padding: 0; font-family: var(--font-utama); }\n    .voucher-back {\n        width: var(--lebar-voucher);\n        height: var(--tinggi-voucher);\n        background: [WARNA_BACKGROUND]; /* ✅ background merah */\n        position: relative;\n        overflow: hidden;\n        color: var(--warna-font);\n        padding: calc(2px * var(--skala));\n        box-sizing: border-box;\n        display: flex;\n        flex-direction: column;\n        justify-content: space-between;\n    }\n\n    /* Background teks berulang */\n    .pattern {\n        position: absolute;\n        inset: 0;\n        font-size: calc(14px * var(--skala));\n        font-weight: bold;\n        color: rgba(255,255,255,0.15);\n        line-height: 1.1;\n        text-align: center;\n        white-space: pre;\n        user-select: none;\n        pointer-events: none;\n    }\n\n    /* Judul */\n    .judul {\n        font-size: var(--ukuran-font-judul);\n        font-weight: bold;\n        text-align: center;\n        margin: calc(1px * var(--skala)) 0;\n        border-bottom: 1px solid #ccc;\n        padding-bottom: calc(1px * var(--skala));\n        position: relative;\n        z-index: 2;\n        background: rgba(255,255,255,0.7);\n    }\n\n    /* Isi */\n    .aturan {\n        font-size: var(--ukuran-font-isi);\n        line-height: 1.3;\n        text-align: center;  /* ✅ semua isi rata tengah */\n        position: relative;\n        z-index: 2;\n        background: rgba(255,255,255,0.7);\n        padding: calc(2px * var(--skala));\n        border-radius: 3px;\n    }\n\n    /* Footer sejajar */\n    .footer {\n        display: flex;\n        justify-content: space-between;\n        align-items: center;\n        position: relative;\n        z-index: 2;\n        background: rgba(255,255,255,0.9);\n        padding: calc(2px * var(--skala));\n        border-radius: 3px;\n    }\n\n    .footer .logo {\n        width: var(--logo-lebar);\n        height: var(--logo-tinggi);\n    }\n\n    .footer .contact {\n        font-size: calc(9px * var(--skala));\n        font-weight: bold;\n        text-align: center;\n        flex: 1;\n    }\n\n    .footer .serial-number {\n        font-size: var(--ukuran-font-serial);\n        font-weight: bold;\n        border: 1px solid #111;\n        padding: 1px 3px;\n        border-radius: 2px;\n        background: #fff;\n        white-space: nowrap;\n    }\n</style>\n</head>\n<body>\n    <div class=\"voucher-back\">\n        <!-- Background teks -->\n        <div class=\"pattern\">\n            indradius.net   INDRADIUS.NET   indradius.net   INDRADIUS.NET<br>\n            INDRADIUS.NET   indradius.net   INDRADIUS.NET   indradius.net<br>\n            indradius.net   INDRADIUS.NET   indradius.net   INDRADIUS.NET<br>\n            INDRADIUS.NET   indradius.net   INDRADIUS.NET   indradius.net<br>\n        </div>\n\n        <div>\n            <!-- Syarat & Ketentuan -->\n            <div class=\"judul\">Syarat & Ketentuan</div>\n            <div class=\"aturan\">\n                Voucher hanya berlaku untuk 1 perangkat. Masa aktif dan harga sesuai yang tertera pada voucher. \n                Jika kode voucher bermasalah silakan hubungi penjual di tempat anda membeli voucher. \n                Satu akun tidak bisa digunakan di 2 perangkat bersamaan. \n                Hubungi admin bila ada masalah login.\n            </div>\n\n            <!-- Cara Menggunakan -->\n            <div class=\"judul\">Cara Menggunakan</div>\n            <div class=\"aturan\">\n                Hubungkan perangkat Anda ke jaringan WiFi <b>INDRADIUS.NET</b>, \n                lalu buka browser dan masukkan <b>Kode Voucher</b>. \n                Setelah login berhasil, internet siap digunakan.\n            </div>\n        </div>\n\n        <!-- Footer sejajar -->\n        <div class=\"footer\">\n            <img src=\"https://indradius.net/logo.png\" class=\"logo\" alt=\"Logo\">\n            <div class=\"contact\">CS/WA: 0823-4555-6666</div>\n            <div class=\"serial-number\">{$serial_number}</div>\n        </div>\n    </div>\n</body>\n</html>');

--
-- Indeks untuk tabel `distribusi_reseller_log`
--
ALTER TABLE `distribusi_reseller_log`
  ADD PRIMARY KEY (`id`),
  ADD KEY `distribusi_reseller_log_router_id_foreign` (`router_id`),
  ADD KEY `distribusi_reseller_log_profil_id_foreign` (`profil_id`),
  ADD KEY `distribusi_reseller_log_karyawan_id_foreign` (`karyawan_id`),
  ADD KEY `distribusi_reseller_log_reseller_id_foreign` (`reseller_id`);

--
-- Indeks untuk tabel `distribusi_reseller_logs`
--
ALTER TABLE `distribusi_reseller_logs`
  ADD PRIMARY KEY (`id`);

--
-- Indeks untuk tabel `failed_jobs`
--
ALTER TABLE `failed_jobs`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`);

--
-- Indeks untuk tabel `jobs`
--
ALTER TABLE `jobs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `jobs_queue_index` (`queue`);

--
-- Indeks untuk tabel `job_batches`
--
ALTER TABLE `job_batches`
  ADD PRIMARY KEY (`id`);

--
-- Indeks untuk tabel `karyawan_stok`
--
ALTER TABLE `karyawan_stok`
  ADD PRIMARY KEY (`id`);

--
-- Indeks untuk tabel `migrations`
--
ALTER TABLE `migrations`
  ADD PRIMARY KEY (`id`);

--
-- Indeks untuk tabel `offline_distribution_logs`
--
ALTER TABLE `offline_distribution_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `distribusi_offline_router_id_foreign` (`router_id`),
  ADD KEY `distribusi_offline_profil_id_foreign` (`profil_id`),
  ADD KEY `distribusi_offline_karyawan_id_foreign` (`karyawan_id`);

--
-- Indeks untuk tabel `radacct`
--
ALTER TABLE `radacct`
  ADD PRIMARY KEY (`radacctid`),
  ADD UNIQUE KEY `radacct_acctuniqueid_unique` (`acctuniqueid`),
  ADD KEY `radacct_username_acctstarttime_index` (`username`,`acctstarttime`),
  ADD KEY `radacct_acctstoptime_nasipaddress_index` (`acctstoptime`,`nasipaddress`),
  ADD KEY `radacct_acctsessionid_index` (`acctsessionid`),
  ADD KEY `radacct_username_index` (`username`),
  ADD KEY `radacct_nasipaddress_index` (`nasipaddress`),
  ADD KEY `radacct_acctstarttime_index` (`acctstarttime`),
  ADD KEY `radacct_acctstoptime_index` (`acctstoptime`),
  ADD KEY `radacct_framedipaddress_index` (`framedipaddress`);

--
-- Indeks untuk tabel `radcheck`
--
ALTER TABLE `radcheck`
  ADD PRIMARY KEY (`id`),
  ADD KEY `radcheck_username_attribute_index` (`username`,`attribute`),
  ADD KEY `radcheck_username_index` (`username`);

--
-- Indeks untuk tabel `radreply`
--
ALTER TABLE `radreply`
  ADD PRIMARY KEY (`id`),
  ADD KEY `radreply_username_attribute_index` (`username`,`attribute`),
  ADD KEY `radreply_username_index` (`username`);

--
-- Indeks untuk tabel `radusergroup`
--
ALTER TABLE `radusergroup`
  ADD PRIMARY KEY (`id`),
  ADD KEY `radusergroup_username_groupname_index` (`username`,`groupname`),
  ADD KEY `radusergroup_username_index` (`username`),
  ADD KEY `radusergroup_groupname_index` (`groupname`);

--
-- Indeks untuk tabel `reseller_distribution_logs`
--
ALTER TABLE `reseller_distribution_logs`
  ADD PRIMARY KEY (`id`);

--
-- Indeks untuk tabel `saldos`
--
ALTER TABLE `saldos`
  ADD PRIMARY KEY (`id`);

--
-- Indeks untuk tabel `saldo_karyawan`
--
ALTER TABLE `saldo_karyawan`
  ADD PRIMARY KEY (`id`),
  ADD KEY `saldo_karyawan_karyawan_id_foreign` (`karyawan_id`);

--
-- Indeks untuk tabel `saldo_reseller`
--
ALTER TABLE `saldo_reseller`
  ADD PRIMARY KEY (`id`),
  ADD KEY `saldo_reseller_reseller_id_foreign` (`reseller_id`);

--
-- Indeks untuk tabel `sessions`
--
ALTER TABLE `sessions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sessions_user_id_index` (`user_id`),
  ADD KEY `sessions_last_activity_index` (`last_activity`);

--
-- Indeks untuk tabel `stok_karyawan`
--
ALTER TABLE `stok_karyawan`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `stok_karyawan_karyawan_id_router_id_profil_id_unique` (`karyawan_id`,`router_id`,`profil_id`),
  ADD KEY `stok_karyawan_router_id_foreign` (`router_id`),
  ADD KEY `stok_karyawan_profil_id_foreign` (`profil_id`);

--
-- Indeks untuk tabel `stok_owner`
--
ALTER TABLE `stok_owner`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `stok_owner_router_name_profile_name_unique` (`router_name`,`profile_name`);

--
-- Indeks untuk tabel `stok_reseller`
--
ALTER TABLE `stok_reseller`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `stok_reseller_unique` (`router_name`,`profile_name`,`karyawan_name`,`reseller_name`);

--
-- Indeks untuk tabel `user_profiles`
--
ALTER TABLE `user_profiles`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_profiles_router_id_foreign` (`router_id`);

--
-- Indeks untuk tabel `voucher_templates`
--
ALTER TABLE `voucher_templates`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT untuk tabel `distribusi_reseller_log`
--
ALTER TABLE `distribusi_reseller_log`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT untuk tabel `distribusi_reseller_logs`
--
ALTER TABLE `distribusi_reseller_logs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

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

--
-- AUTO_INCREMENT untuk tabel `jobs`
--
ALTER TABLE `jobs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT untuk tabel `karyawan_stok`
--
ALTER TABLE `karyawan_stok`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT untuk tabel `migrations`
--
ALTER TABLE `migrations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=62;

--
-- AUTO_INCREMENT untuk tabel `offline_distribution_logs`
--
ALTER TABLE `offline_distribution_logs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT untuk tabel `radacct`
--
ALTER TABLE `radacct`
  MODIFY `radacctid` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT untuk tabel `radcheck`
--
ALTER TABLE `radcheck`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT untuk tabel `radreply`
--
ALTER TABLE `radreply`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT untuk tabel `radusergroup`
--
ALTER TABLE `radusergroup`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT untuk tabel `reseller_distribution_logs`
--
ALTER TABLE `reseller_distribution_logs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT untuk tabel `saldos`
--
ALTER TABLE `saldos`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT untuk tabel `saldo_karyawan`
--
ALTER TABLE `saldo_karyawan`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT untuk tabel `saldo_reseller`
--
ALTER TABLE `saldo_reseller`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT untuk tabel `stok_karyawan`
--
ALTER TABLE `stok_karyawan`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT untuk tabel `stok_owner`
--
ALTER TABLE `stok_owner`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT untuk tabel `stok_reseller`
--
ALTER TABLE `stok_reseller`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT untuk tabel `user_profiles`
--
ALTER TABLE `user_profiles`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT untuk tabel `voucher_templates`
--
ALTER TABLE `voucher_templates`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- Ketidakleluasaan untuk tabel `distribusi_reseller_log`
--
ALTER TABLE `distribusi_reseller_log`
  ADD CONSTRAINT `distribusi_reseller_log_karyawan_id_foreign` FOREIGN KEY (`karyawan_id`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `distribusi_reseller_log_profil_id_foreign` FOREIGN KEY (`profil_id`) REFERENCES `user_profiles` (`id`),
  ADD CONSTRAINT `distribusi_reseller_log_reseller_id_foreign` FOREIGN KEY (`reseller_id`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `distribusi_reseller_log_router_id_foreign` FOREIGN KEY (`router_id`) REFERENCES `routers` (`id`);

--
-- Ketidakleluasaan untuk tabel `offline_distribution_logs`
--
ALTER TABLE `offline_distribution_logs`
  ADD CONSTRAINT `distribusi_offline_karyawan_id_foreign` FOREIGN KEY (`karyawan_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `distribusi_offline_profil_id_foreign` FOREIGN KEY (`profil_id`) REFERENCES `user_profiles` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `distribusi_offline_router_id_foreign` FOREIGN KEY (`router_id`) REFERENCES `routers` (`id`) ON DELETE CASCADE;

--
-- Ketidakleluasaan untuk tabel `saldo_karyawan`
--
ALTER TABLE `saldo_karyawan`
  ADD CONSTRAINT `saldo_karyawan_karyawan_id_foreign` FOREIGN KEY (`karyawan_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Ketidakleluasaan untuk tabel `saldo_reseller`
--
ALTER TABLE `saldo_reseller`
  ADD CONSTRAINT `saldo_reseller_reseller_id_foreign` FOREIGN KEY (`reseller_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Ketidakleluasaan untuk tabel `stok_karyawan`
--
ALTER TABLE `stok_karyawan`
  ADD CONSTRAINT `stok_karyawan_karyawan_id_foreign` FOREIGN KEY (`karyawan_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `stok_karyawan_profil_id_foreign` FOREIGN KEY (`profil_id`) REFERENCES `user_profiles` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `stok_karyawan_router_id_foreign` FOREIGN KEY (`router_id`) REFERENCES `routers` (`id`) ON DELETE CASCADE;

--
-- Ketidakleluasaan untuk tabel `user_profiles`
--
ALTER TABLE `user_profiles`
  ADD CONSTRAINT `user_profiles_router_id_foreign` FOREIGN KEY (`router_id`) REFERENCES `routers` (`id`) ON DELETE SET NULL;
COMMIT;

