-- phpMyAdmin SQL Dump
-- version 5.2.2
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Apr 25, 2026 at 12:16 PM
-- Server version: 10.6.22-MariaDB
-- PHP Version: 8.3.23

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: `persadal_erp`
--

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

--
-- Table structure for table `lead_prospect_customer`
--

CREATE TABLE `lead_prospect_customer` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `customer_code` varchar(100) DEFAULT NULL,
  `group_customer_id` bigint(20) UNSIGNED DEFAULT NULL,
  `group_sampling_customer_id` bigint(20) UNSIGNED DEFAULT NULL,
  `company_type_id` bigint(20) UNSIGNED DEFAULT NULL,
  `company_name` varchar(200) DEFAULT NULL,
  `m_grading_kbli_id` bigint(20) UNSIGNED DEFAULT NULL,
  `m_grading_segmen_id` bigint(20) UNSIGNED DEFAULT NULL,
  `business_scale_id` int(11) DEFAULT NULL,
  `product` varchar(255) DEFAULT NULL,
  `area` varchar(255) DEFAULT NULL,
  `proper` enum('Proper','Non Proper') DEFAULT NULL,
  `province_id` bigint(20) UNSIGNED DEFAULT NULL,
  `city_id` bigint(20) UNSIGNED DEFAULT NULL,
  `district_id` bigint(20) UNSIGNED DEFAULT NULL,
  `office_phone` varchar(50) DEFAULT NULL,
  `business_unit` enum('GMP','QSM') DEFAULT NULL,
  `is_verified` tinyint(1) DEFAULT NULL COMMENT '1=Approved, 2=Rejected, 0=Not Verified',
  `is_lead` tinyint(1) NOT NULL DEFAULT 0,
  `is_ro` tinyint(1) NOT NULL DEFAULT 0,
  `verified_at` datetime DEFAULT NULL,
  `verified_reason` varchar(255) DEFAULT NULL,
  `verified_progress` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `company_address` text DEFAULT NULL,
  `document_delivery_address` text DEFAULT NULL,
  `customer_npwp` varchar(50) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `update_user` bigint(20) DEFAULT NULL,
  `is_delete` tinyint(1) DEFAULT 0,
  `delete_date` timestamp NULL DEFAULT NULL,
  `created_user` bigint(20) DEFAULT NULL,
  `delete_user` bigint(20) DEFAULT NULL,
  `ownership` varchar(255) DEFAULT NULL,
  `company_note` text DEFAULT NULL,
  `m_customer_id_dihapus` bigint(20) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `lead_prospect_customer_contact`
--

CREATE TABLE `lead_prospect_customer_contact` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `branch_id` bigint(20) UNSIGNED DEFAULT NULL,
  `lead_prospect_customer_id` bigint(20) UNSIGNED DEFAULT NULL,
  `sales_contact_id` int(11) DEFAULT NULL,
  `name` varchar(255) DEFAULT NULL,
  `position` varchar(255) DEFAULT NULL,
  `phone` varchar(25) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `registration_date` date DEFAULT NULL,
  `registration_date_alt` date DEFAULT NULL,
  `data_source` varchar(100) DEFAULT NULL,
  `last_update` date DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `update_user` bigint(20) DEFAULT NULL,
  `is_delete` tinyint(1) DEFAULT 0,
  `is_active` tinyint(1) NOT NULL DEFAULT 0,
  `is_import` tinyint(1) NOT NULL DEFAULT 0,
  `is_verified` tinyint(1) DEFAULT 1,
  `verified_at` datetime DEFAULT NULL,
  `verified_reason` varchar(255) DEFAULT NULL,
  `verified_progress` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`verified_progress`)),
  `delete_date` timestamp NULL DEFAULT NULL,
  `created_user` bigint(20) DEFAULT NULL,
  `delete_user` bigint(20) DEFAULT NULL,
  `education` varchar(255) DEFAULT NULL,
  `characteristics` text DEFAULT NULL,
  `achievements` text DEFAULT NULL,
  `hobbies` text DEFAULT NULL,
  `note` text DEFAULT NULL,
  `is_suspect` tinyint(1) NOT NULL DEFAULT 0,
  `is_lead` tinyint(1) NOT NULL DEFAULT 0,
  `is_ro` tinyint(1) NOT NULL DEFAULT 0,
  `m_customer_kode_nomor` varchar(50) DEFAULT NULL,
  `m_customer_id_contact` bigint(20) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `lead_prospect_customer`
--
ALTER TABLE `lead_prospect_customer`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_district_id` (`district_id`),
  ADD KEY `fk_parent_company_id` (`group_customer_id`),
  ADD KEY `fk_company_type_id` (`company_type_id`),
  ADD KEY `fk_m_grading_kbli_id` (`m_grading_kbli_id`),
  ADD KEY `fk_m_grading_segmen_id` (`m_grading_segmen_id`),
  ADD KEY `fk_business_scale_id` (`business_scale_id`),
  ADD KEY `fk_lead_prospect_customer_province` (`province_id`),
  ADD KEY `fk_lead_prospect_customer_city` (`city_id`),
  ADD KEY `fk_lpc_group_sampling_customer` (`group_sampling_customer_id`);

--
-- Indexes for table `lead_prospect_customer_contact`
--
ALTER TABLE `lead_prospect_customer_contact`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_lpc_branch` (`branch_id`),
  ADD KEY `fk_lpc_lead` (`lead_prospect_customer_id`),
  ADD KEY `fk_lpc_sales_contact` (`sales_contact_id`);

--
-- AUTO_INCREMENT for dumped tables
--

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

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `lead_prospect_customer`
--
ALTER TABLE `lead_prospect_customer`
  ADD CONSTRAINT `fk_lpc_group_sampling_customer` FOREIGN KEY (`group_sampling_customer_id`) REFERENCES `m_group_sampling_customer` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `lead_prospect_customer_contact`
--
ALTER TABLE `lead_prospect_customer_contact`
  ADD CONSTRAINT `fk_lpc_branch` FOREIGN KEY (`branch_id`) REFERENCES `m_branch` (`id`),
  ADD CONSTRAINT `fk_lpc_lead` FOREIGN KEY (`lead_prospect_customer_id`) REFERENCES `lead_prospect_customer` (`id`),
  ADD CONSTRAINT `fk_lpc_sales_contact` FOREIGN KEY (`sales_contact_id`) REFERENCES `m_sales_contact` (`id`);
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 */;
