-- https://www.phpmyadmin.net/
--

START TRANSACTION;



--
-- Database: `crm_mobile`
--

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

--
-- Table structure for table `login_logs`
--

CREATE TABLE `login_logs` (
  `id` int(11) NOT NULL,
  `user_id` int(11) DEFAULT NULL,
  `login_time` datetime DEFAULT NULL,
  `ip_address` varchar(45) DEFAULT NULL,
  `user_agent` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `login_logs`
--

INSERT INTO `login_logs` (`id`, `user_id`, `login_time`, `ip_address`, `user_agent`) VALUES
(1, 1, '2025-11-09 18:30:11', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36'),
(2, 1, '2025-11-09 18:41:50', '192.168.31.4', 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Mobile Safari/537.36'),
(3, 3, '2025-11-09 18:42:38', '::1', 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Mobile Safari/537.36'),
(4, 3, '2025-11-09 18:44:58', '192.168.31.4', 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Mobile Safari/537.36'),
(5, 3, '2025-11-09 18:46:37', '192.168.31.4', 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Mobile Safari/537.36'),
(6, 3, '2025-11-09 19:25:42', '192.168.31.4', 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Mobile Safari/537.36'),
(7, 1, '2025-11-09 19:29:37', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36'),
(8, 1, '2025-11-09 19:33:33', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36'),
(9, 3, '2025-11-09 19:40:12', '192.168.31.4', 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Mobile Safari/537.36'),
(10, 1, '2025-11-09 19:56:23', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36');

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

--
-- Table structure for table `prospek`
--

CREATE TABLE `prospek` (
  `id` int(11) NOT NULL,
  `tanggal` date NOT NULL,
  `nama_nasabah` varchar(100) NOT NULL,
  `alamat` text NOT NULL,
  `lokasi_gps` varchar(100) DEFAULT NULL,
  `koordinat` varchar(100) DEFAULT NULL,
  `no_telf` varchar(20) NOT NULL,
  `minat` enum('berminat','belum_berminat','tidak_berminat') NOT NULL,
  `sektor_usaha` int(11) DEFAULT NULL,
  `keterangan` text DEFAULT NULL,
  `referal` varchar(100) DEFAULT NULL,
  `foto` varchar(255) DEFAULT NULL,
  `user_id` int(11) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `prospek`
--

INSERT INTO `prospek` (`id`, `tanggal`, `nama_nasabah`, `alamat`, `lokasi_gps`, `koordinat`, `no_telf`, `minat`, `sektor_usaha`, `keterangan`, `referal`, `foto`, `user_id`, `created_at`) VALUES
(1, '2025-11-09', 'anton', 'brumbung', 'aa', '-7.022644, 110.516556', '082133256262', 'berminat', 5, 'jasa service dan pengembangan teknologi', 'as', 'uploads/1762678479_brimo20240221-104435.png', 2, '2025-11-09 08:54:39'),
(2, '2025-11-09', 'laili', 'mranggen', '', '-7.022667, 110.516479', '082133256262', 'belum_berminat', 8, 'pemilik bus pariwisata', '', 'uploads/1762685469_brimo20240221-104435.png', 1, '2025-11-09 10:51:09'),
(3, '2025-11-09', 'ANI', 'GROBOGAN\r\n', 'Lokasi: -7.058227, 110.428160', '-7.0582272, 110.42816', '000213123123', 'berminat', 6, 'USAHA KRIPIK PISANG', '', 'uploads/1762691949_tabungan.jpg', 1, '2025-11-09 12:39:09');

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

--
-- Table structure for table `sektor_usaha`
--

CREATE TABLE `sektor_usaha` (
  `id` int(11) NOT NULL,
  `nama` varchar(100) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `sektor_usaha`
--

INSERT INTO `sektor_usaha` (`id`, `nama`, `created_at`) VALUES
(1, 'Perdagangan', '2025-11-09 08:20:38'),
(2, 'Pertanian', '2025-11-09 08:20:38'),
(3, 'Perikanan', '2025-11-09 08:20:38'),
(4, 'Peternakan', '2025-11-09 08:20:38'),
(5, 'Jasa', '2025-11-09 08:20:38'),
(6, 'Industri Kecil', '2025-11-09 08:20:38'),
(7, 'Pariwisata', '2025-11-09 08:20:38'),
(8, 'Transportasi', '2025-11-09 08:20:38');

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

--
-- Table structure for table `user_activities`
--

CREATE TABLE `user_activities` (
  `id` int(11) NOT NULL,
  `user_id` int(11) DEFAULT NULL,
  `activity_type` varchar(50) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `ip_address` varchar(45) DEFAULT NULL,
  `activity_time` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `login_logs`
--
ALTER TABLE `login_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `prospek`
--
ALTER TABLE `prospek`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sektor_usaha` (`sektor_usaha`),
  ADD KEY `user_id` (`user_id`);

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

--
-- Indexes for table `user_activities`
--
ALTER TABLE `user_activities`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `login_logs`
--
ALTER TABLE `login_logs`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

--
-- AUTO_INCREMENT for table `prospek`
--
ALTER TABLE `prospek`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `sektor_usaha`
--
ALTER TABLE `sektor_usaha`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT for table `user_activities`
--
ALTER TABLE `user_activities`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- Constraints for dumped tables
--

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

--
-- Constraints for table `prospek`
--
ALTER TABLE `prospek`
  ADD CONSTRAINT `prospek_ibfk_1` FOREIGN KEY (`sektor_usaha`) REFERENCES `sektor_usaha` (`id`),
  ADD CONSTRAINT `prospek_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

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

