-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 23, 2026 at 05:56 PM
-- 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: `mkconstruction`
--

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

--
-- Table structure for table `admins`
--

CREATE TABLE `admins` (
  `id` int(11) NOT NULL,
  `username` varchar(50) NOT NULL,
  `password` varchar(255) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `admins`
--

INSERT INTO `admins` (`id`, `username`, `password`, `created_at`) VALUES
(1, 'admin', '$2y$10$O5u3UcG1XICX5Y.DFn3msOt4pszNCQ9H2Fs4LhUmAmkS8LVrsSr2G', '2026-03-05 12:02:44');

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

--
-- Table structure for table `blog_categories`
--

CREATE TABLE `blog_categories` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `slug` varchar(100) NOT NULL,
  `status` enum('active','inactive') DEFAULT 'active',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `blog_categories`
--

INSERT INTO `blog_categories` (`id`, `name`, `slug`, `status`, `created_at`) VALUES
(1, 'General Construction', 'general-construction', 'active', '2026-03-10 06:48:41'),
(2, 'Construction Tips', 'construction-tips', 'active', '2026-03-10 07:45:38'),
(3, 'Architecture Trends', 'architecture-trends', 'active', '2026-03-10 07:45:38'),
(4, 'Interior Design', 'interior-design', 'active', '2026-03-10 07:45:38');

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

--
-- Table structure for table `blog_posts`
--

CREATE TABLE `blog_posts` (
  `id` int(11) NOT NULL,
  `category_id` int(11) NOT NULL,
  `subcategory_id` int(11) DEFAULT NULL,
  `title` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `author` varchar(100) DEFAULT NULL,
  `content` longtext NOT NULL,
  `image_path` varchar(255) DEFAULT NULL,
  `status` enum('published','draft') DEFAULT 'draft',
  `published_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `blog_posts`
--

INSERT INTO `blog_posts` (`id`, `category_id`, `subcategory_id`, `title`, `slug`, `author`, `content`, `image_path`, `status`, `published_at`, `created_at`) VALUES
(1, 1, NULL, 'Understanding the Foundations of Modern Architecture', 'understanding-foundations', 'Admin', '<p>When embarking on a new construction project, ensuring the foundations are solid is the most critical step.</p><p>Explore how modern architecture combines aesthetics with robust engineering.</p>', NULL, 'published', '2026-03-10 06:48:41', '2026-03-10 06:48:41'),
(2, 2, NULL, '5 Crucial Steps Before Pouring Concrete', '5-crucial-steps-pouring-concrete', 'Admin', '<p>Pouring concrete is an irreversible process. Here are 5 critical steps you must take to ensure the foundation of your building is solid and long-lasting.</p><p>1. Ground Preparation...</p>', 'assets/img/blog-concrete.png', 'published', '2026-03-10 07:45:38', '2026-03-10 07:45:38'),
(3, 3, NULL, 'Why Sustainable Architecture is the Future', 'sustainable-architecture-future', 'Guest Architect', '<p>With climate change becoming an ever-present reality, sustainable architecture is no longer just a trend, it is a necessity. Learn how green building materials are changing the landscape.</p>', 'assets/img/blog-sustainable.png', 'published', '2026-03-10 07:45:38', '2026-03-10 07:45:38'),
(4, 4, NULL, 'Choosing the Right Color Palette for Your Living Room', 'choosing-color-palette-living-room', 'Admin', '<p>The color of your living room sets the mood for your entire house. In this post, we explore the psychology of colors and how to choose the perfect palette.</p>', 'assets/img/blog-interior.png', 'published', '2026-03-10 07:45:38', '2026-03-10 07:45:38'),
(5, 2, NULL, 'How to Choose the Right Contractor', 'how-to-choose-right-contractor', 'Admin', '<p>Choosing a contractor is one of the most important decisions you will make when building a home. Here are red flags to watch out for and green flags to seek.</p>', 'assets/img/project-2.jpg', 'published', '2026-03-10 07:45:38', '2026-03-10 07:45:38');

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

--
-- Table structure for table `blog_post_tags`
--

CREATE TABLE `blog_post_tags` (
  `post_id` int(11) NOT NULL,
  `tag_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `blog_subcategories`
--

CREATE TABLE `blog_subcategories` (
  `id` int(11) NOT NULL,
  `category_id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `slug` varchar(100) NOT NULL,
  `status` enum('active','inactive') DEFAULT 'active',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `blog_tags`
--

CREATE TABLE `blog_tags` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `slug` varchar(100) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `blog_tags`
--

INSERT INTO `blog_tags` (`id`, `name`, `slug`, `created_at`) VALUES
(1, 'Tips & Tricks', 'tips-tricks', '2026-03-10 07:59:41'),
(2, 'Guides', 'guides', '2026-03-10 07:59:41'),
(3, 'Construction', 'construction', '2026-03-10 07:59:41'),
(4, 'Architecture', 'architecture', '2026-03-10 07:59:41'),
(5, 'Trends', 'trends', '2026-03-10 07:59:41'),
(6, 'Design', 'design', '2026-03-10 07:59:41'),
(7, 'Renovation', 'renovation', '2026-03-10 07:59:41');

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

--
-- Table structure for table `customers`
--

CREATE TABLE `customers` (
  `id` int(11) NOT NULL,
  `lead_id` int(11) DEFAULT NULL COMMENT 'Reference to original lead',
  `agent_id` int(11) DEFAULT NULL,
  `name` varchar(150) NOT NULL,
  `phone` varchar(50) NOT NULL,
  `email` varchar(150) DEFAULT NULL,
  `building_name` varchar(255) DEFAULT NULL,
  `area` varchar(255) DEFAULT NULL,
  `city` varchar(100) DEFAULT NULL,
  `district` varchar(100) DEFAULT NULL,
  `pincode` varchar(20) DEFAULT NULL,
  `state` varchar(100) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `project_type` varchar(150) DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `status` enum('active','inactive') DEFAULT 'active',
  `converted_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `customers`
--

INSERT INTO `customers` (`id`, `lead_id`, `agent_id`, `name`, `phone`, `email`, `building_name`, `area`, `city`, `district`, `pincode`, `state`, `address`, `project_type`, `notes`, `status`, `converted_at`) VALUES
(1, 10, NULL, 'Lakshmi Iyer', '7788990011', '', NULL, NULL, NULL, NULL, NULL, NULL, '', '', 'Wants to see model house first', 'active', '2026-03-10 09:56:25');

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

--
-- Table structure for table `enquiries`
--

CREATE TABLE `enquiries` (
  `id` int(11) NOT NULL,
  `full_name` varchar(100) NOT NULL,
  `phone` varchar(20) NOT NULL,
  `email` varchar(150) NOT NULL,
  `interest` varchar(100) NOT NULL,
  `message` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `status` enum('pending','converted','junk') DEFAULT 'pending'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `enquiries`
--

INSERT INTO `enquiries` (`id`, `full_name`, `phone`, `email`, `interest`, `message`, `created_at`, `status`) VALUES
(3, 'Praveen Richard Francis', '08940684434', 'richard@wmpcreativeagency.com', 'Interior Designing', 'dymzykk', '2026-03-16 19:46:07', 'pending');

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

--
-- Table structure for table `leads`
--

CREATE TABLE `leads` (
  `id` int(11) NOT NULL,
  `name` varchar(150) NOT NULL,
  `phone` varchar(50) NOT NULL,
  `email` varchar(150) DEFAULT NULL,
  `building_name` varchar(255) DEFAULT NULL,
  `area` varchar(255) DEFAULT NULL,
  `city` varchar(100) DEFAULT NULL,
  `district` varchar(100) DEFAULT NULL,
  `pincode` varchar(20) DEFAULT NULL,
  `state` varchar(100) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `project_type` varchar(100) DEFAULT NULL,
  `source_id` int(11) DEFAULT NULL,
  `status_id` int(11) DEFAULT NULL,
  `assigned_agent_id` int(11) DEFAULT NULL,
  `funnel_id` int(11) DEFAULT NULL,
  `stage_id` int(11) DEFAULT NULL,
  `is_junk` tinyint(1) DEFAULT 0,
  `notes` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `leads`
--

INSERT INTO `leads` (`id`, `name`, `phone`, `email`, `building_name`, `area`, `city`, `district`, `pincode`, `state`, `address`, `project_type`, `source_id`, `status_id`, `assigned_agent_id`, `funnel_id`, `stage_id`, `is_junk`, `notes`, `created_at`) VALUES
(1, 'Praveen Richard Francis', '8940684434', 'praveenrichard16@gmail.com', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, 0, 'Original Enquiry Interest: House Construction\r\n\r\nClient Message:\r\nhi', '2026-03-10 06:51:50'),
(2, 'Rajesh Kumar', '9876543210', 'rajesh@gmail.com', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, 4, 3, 0, 'Interested in 2BHK construction', '2026-02-28 09:38:12'),
(3, 'Priya Sharma', '9876543211', 'priya@email.com', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, NULL, 4, 4, 0, 'Site visit confirmed for next week', '2026-03-02 09:38:12'),
(4, 'Anil Mehta', '9123456789', 'anil@domain.com', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 3, 1, NULL, 4, 5, 0, 'Quotation shared, awaiting response', '2026-03-04 09:38:12'),
(5, 'Sunita Patel', '9988776655', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, 4, 6, 1, 'Negotiating on foundation cost', '2026-03-05 09:38:12'),
(6, 'Deepak Nair', '9871234560', 'deepak@mail.com', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, NULL, 4, 7, 0, 'Work order signed. Starting March 15.', '2026-03-07 09:38:12'),
(7, 'Kiran Rajan', '9090909090', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 3, 1, NULL, 5, 8, 0, 'Office space inquiry 3000 sqft', '2026-03-03 09:38:12'),
(8, 'MK Enterprises', '8001122334', 'info@mkent.com', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, 5, 9, 0, 'Shared proposal for showroom build', '2026-03-06 09:38:12'),
(9, 'Santhosh George', '9876543210', 'santhosh@test.com', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, NULL, 4, 3, 1, 'Duplicate test - same number as Rajesh', '2026-03-08 09:38:12'),
(10, 'Lakshmi Iyer', '7788990011', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 3, 6, NULL, 4, 4, 0, 'Wants to see model house first', '2026-03-09 09:38:12'),
(11, '', '9123456789', '', '', '', '', '', '', '', NULL, '', 1, 5, 1, 1, NULL, 0, '', '2026-03-10 09:38:12');

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

--
-- Table structure for table `lead_followups`
--

CREATE TABLE `lead_followups` (
  `id` int(11) NOT NULL,
  `lead_id` int(11) NOT NULL,
  `followup_date` datetime NOT NULL,
  `notes` text DEFAULT NULL,
  `status` enum('pending','completed','cancelled') DEFAULT 'pending',
  `completed_at` datetime DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `lead_followups`
--

INSERT INTO `lead_followups` (`id`, `lead_id`, `followup_date`, `notes`, `status`, `completed_at`, `created_at`) VALUES
(1, 1, '2026-03-11 12:34:00', 'khvvkvkh\n\n**Outcome:**\nthttdxxxx uyycyu', 'completed', NULL, '2026-03-10 07:04:55'),
(2, 1, '2026-03-11 13:41:00', 'just call', 'pending', NULL, '2026-03-10 07:12:42'),
(3, 2, '2026-03-11 15:09:22', 'Call to confirm site visit interest', 'pending', NULL, '2026-03-10 09:39:22'),
(4, 3, '2026-03-12 15:09:22', 'Confirm visit date and send location', 'pending', NULL, '2026-03-10 09:39:22'),
(5, 4, '2026-03-09 15:09:22', 'Follow up on quotation response - OVERDUE', 'pending', NULL, '2026-03-10 09:39:22'),
(6, 5, '2026-03-13 15:09:22', 'Discuss revised quote for foundation', 'pending', NULL, '2026-03-10 09:39:22'),
(7, 2, '2026-03-05 15:09:22', 'Initial contact made, expressed interest', 'completed', NULL, '2026-03-10 09:39:22'),
(8, 11, '2026-03-13 12:47:00', 'hyivbhk', '', '2026-03-12 17:18:05', '2026-03-12 11:47:48'),
(9, 11, '2026-03-14 12:50:00', '\n\n**Outcome:**\nEVQWR\n\n**Outcome:**\nWREGFRWGV ERG EGVR\n\n**Outcome:**\nRWGWR', '', '2026-03-12 22:39:19', '2026-03-12 11:48:41'),
(10, 11, '2026-03-15 10:00:00', 'WWGRRW', 'pending', NULL, '2026-03-12 17:09:19'),
(11, 11, '2026-03-12 22:46:00', 'KKKKKKNN N\n\n**Outcome:**\nL,L', 'completed', '2026-03-12 22:46:18', '2026-03-12 17:14:56');

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

--
-- Table structure for table `lead_funnels`
--

CREATE TABLE `lead_funnels` (
  `id` int(11) NOT NULL,
  `name` varchar(150) NOT NULL,
  `description` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `lead_funnels`
--

INSERT INTO `lead_funnels` (`id`, `name`, `description`, `created_at`) VALUES
(1, 'Awarness', '', '2026-03-10 06:58:02'),
(2, 'consideration', '', '2026-03-10 06:58:21'),
(3, 'conversion', '', '2026-03-10 06:58:27'),
(4, 'Residential Construction', 'Pipeline for home building projects', '2026-03-10 09:34:57'),
(5, 'Commercial Projects', 'Office and commercial space pipeline', '2026-03-10 09:34:57'),
(6, 'Renovation Works', 'Repair and renovation pipeline', '2026-03-10 09:34:57');

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

--
-- Table structure for table `lead_services`
--

CREATE TABLE `lead_services` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `description` text DEFAULT NULL,
  `status` enum('active','inactive') DEFAULT 'active',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `lead_services`
--

INSERT INTO `lead_services` (`id`, `name`, `description`, `status`, `created_at`) VALUES
(1, 'Residential Construction', NULL, 'active', '2026-03-13 07:46:47'),
(2, 'Commercial Construction', NULL, 'active', '2026-03-13 07:46:48'),
(3, 'Renovation & Repair', NULL, 'active', '2026-03-13 07:46:48'),
(4, 'Interior Works', NULL, 'active', '2026-03-13 07:46:48'),
(5, 'Civil Works', NULL, 'active', '2026-03-13 07:46:48'),
(6, 'Other', NULL, 'active', '2026-03-13 07:46:48');

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

--
-- Table structure for table `lead_sources`
--

CREATE TABLE `lead_sources` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `lead_sources`
--

INSERT INTO `lead_sources` (`id`, `name`, `created_at`) VALUES
(1, 'Website Enquiries', '2026-03-06 18:14:37'),
(2, 'Direct Call', '2026-03-06 18:14:37'),
(3, 'WhatsApp', '2026-03-06 18:14:37'),
(4, 'JustDial', '2026-03-06 18:14:37');

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

--
-- Table structure for table `lead_stages`
--

CREATE TABLE `lead_stages` (
  `id` int(11) NOT NULL,
  `funnel_id` int(11) NOT NULL,
  `name` varchar(150) NOT NULL,
  `stage_order` int(11) DEFAULT 0,
  `status_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `lead_stages`
--

INSERT INTO `lead_stages` (`id`, `funnel_id`, `name`, `stage_order`, `status_id`) VALUES
(1, 1, '1st stage', 1, NULL),
(2, 2, '2nd stage', 2, NULL),
(3, 4, 'Initial Enquiry', 10, NULL),
(4, 4, 'Site Visit Scheduled', 20, NULL),
(5, 4, 'Quotation Sent', 30, NULL),
(6, 4, 'Negotiation', 40, NULL),
(7, 4, 'Work Order Signed', 50, NULL),
(8, 5, 'Lead Received', 10, NULL),
(9, 5, 'Proposal Shared', 20, NULL),
(10, 5, 'Technical Review', 30, NULL),
(11, 5, 'Contract Signed', 40, NULL);

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

--
-- Table structure for table `lead_statuses`
--

CREATE TABLE `lead_statuses` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `color_code` varchar(20) DEFAULT '#64748b',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `lead_statuses`
--

INSERT INTO `lead_statuses` (`id`, `name`, `color_code`, `created_at`) VALUES
(1, 'New Lead', '#94a3b8', '2026-03-10 09:47:36'),
(4, 'Quotation Sent', '#8b5cf6', '2026-03-10 09:47:36'),
(5, 'Negotiation', '#f97316', '2026-03-10 09:47:36'),
(6, 'Converted', '#22c55e', '2026-03-10 09:47:36'),
(7, 'Lost', '#ef4444', '2026-03-10 09:47:36');

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

--
-- Table structure for table `meetings`
--

CREATE TABLE `meetings` (
  `id` int(11) NOT NULL,
  `lead_id` int(11) DEFAULT NULL,
  `agent_id` int(11) DEFAULT NULL,
  `title` varchar(255) NOT NULL,
  `meeting_date` date NOT NULL,
  `start_time` time NOT NULL,
  `end_time` time NOT NULL,
  `location` varchar(255) DEFAULT NULL,
  `status` enum('scheduled','completed','cancelled','rescheduled') DEFAULT 'scheduled',
  `meeting_type` varchar(30) NOT NULL DEFAULT 'live_meeting',
  `meeting_link` varchar(500) DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `portfolio_categories`
--

CREATE TABLE `portfolio_categories` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `slug` varchar(100) NOT NULL,
  `status` enum('active','inactive') NOT NULL DEFAULT 'active',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `portfolio_categories`
--

INSERT INTO `portfolio_categories` (`id`, `name`, `slug`, `status`, `created_at`) VALUES
(1, 'House', 'house', 'active', '2026-03-06 06:51:11'),
(2, 'Residential Builds', 'residential-builds', 'active', '2026-03-10 07:45:37'),
(3, 'Commercial Plazas', 'commercial-plazas', 'active', '2026-03-10 07:45:37'),
(4, 'Interior Makeovers', 'interior-makeovers', 'active', '2026-03-10 07:45:37');

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

--
-- Table structure for table `portfolio_items`
--

CREATE TABLE `portfolio_items` (
  `id` int(11) NOT NULL,
  `category_id` int(11) NOT NULL,
  `subcategory_id` int(11) DEFAULT NULL,
  `title` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `client_name` varchar(150) DEFAULT NULL,
  `completion_date` date DEFAULT NULL,
  `image_path` varchar(255) NOT NULL,
  `status` enum('published','draft') NOT NULL DEFAULT 'published',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `image_planning` varchar(255) DEFAULT NULL,
  `image_execution` varchar(255) DEFAULT NULL,
  `quote_text` text DEFAULT NULL,
  `meta_title` varchar(255) DEFAULT NULL,
  `meta_description` text DEFAULT NULL,
  `meta_keywords` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `portfolio_items`
--

INSERT INTO `portfolio_items` (`id`, `category_id`, `subcategory_id`, `title`, `slug`, `description`, `client_name`, `completion_date`, `image_path`, `status`, `created_at`, `image_planning`, `image_execution`, `quote_text`, `meta_title`, `meta_description`, `meta_keywords`) VALUES
(2, 2, NULL, 'Modern Minimalist Villa', 'modern-minimalist-villa', '<p>A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.</p>\r\nA beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.\r\n\r\nA beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.\r\n\r\n\r\nA beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.\r\n\r\n\r\n\r\nA beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.', 'Mr. Anbu', '2023-11-15', 'assets/img/modern-minimalist-villa.png', 'published', '2026-03-10 07:45:38', 'uploads/portfolio/planning_69afdc4615180.png', 'uploads/portfolio/execution_69afdc4615389.png', '<p>A beautiful two-story villa focusing on modern minimalist aesthetics, featuring large glass panels and an open floor plan.</p>', '', '', ''),
(3, 2, NULL, 'Classic Family Home', 'classic-family-home', '<p>A traditional family home with a warm, welcoming brick exterior and spacious front yard. Perfect for raising a family.</p>', 'Mrs. Priya', '2023-08-20', 'assets/img/classic-family-home.png', 'published', '2026-03-10 07:45:38', NULL, NULL, NULL, NULL, NULL, NULL),
(4, 3, NULL, 'Downtown Tech Hub', 'downtown-tech-hub', '<p>A state-of-the-art commercial plaza designed for IT companies, featuring energy-efficient systems and collaborative workspaces.</p>', 'TechNova Solutions', '2024-01-10', 'assets/img/downtown-tech-hub.png', 'published', '2026-03-10 07:45:38', NULL, NULL, NULL, NULL, NULL, NULL),
(5, 4, NULL, 'Luxury Penthouse Renovation', 'luxury-penthouse-renovation', '<p>Complete interior overhaul of a luxury penthouse, incorporating smart home features and Italian marble flooring.</p>', 'Dr. Rajesh', '2023-05-05', 'assets/img/hero-interior.jpg', 'published', '2026-03-10 07:45:38', NULL, NULL, NULL, NULL, NULL, NULL),
(6, 3, NULL, 'Oasis Shopping Complex', 'oasis-shopping-complex', '<p>A vibrant shopping complex with modern retail spaces and a stunning central atrium to attract foot traffic.</p>', 'Oasis Group', '2023-12-01', 'assets/img/project-5.jpg', 'published', '2026-03-10 07:45:38', NULL, NULL, NULL, NULL, NULL, NULL);

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

--
-- Table structure for table `portfolio_subcategories`
--

CREATE TABLE `portfolio_subcategories` (
  `id` int(11) NOT NULL,
  `category_id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `slug` varchar(100) NOT NULL,
  `status` enum('active','inactive') NOT NULL DEFAULT 'active',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `portfolio_subcategories`
--

INSERT INTO `portfolio_subcategories` (`id`, `category_id`, `name`, `slug`, `status`, `created_at`) VALUES
(1, 1, '1BHK', '1bhk', 'active', '2026-03-06 06:51:34'),
(2, 1, '2BHK', '2bhk', 'active', '2026-03-06 06:51:43'),
(3, 1, '3BHK', '3bhk', 'active', '2026-03-06 06:51:53'),
(4, 1, '4BHK', '4bhk', 'active', '2026-03-06 06:52:01');

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

--
-- Table structure for table `sales_agents`
--

CREATE TABLE `sales_agents` (
  `id` int(11) NOT NULL,
  `name` varchar(150) NOT NULL,
  `phone` varchar(30) DEFAULT NULL,
  `email` varchar(150) DEFAULT NULL,
  `designation` varchar(100) DEFAULT 'Sales Agent',
  `username` varchar(80) DEFAULT NULL,
  `password_hash` varchar(255) DEFAULT NULL,
  `is_active` tinyint(1) DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `sales_agents`
--

INSERT INTO `sales_agents` (`id`, `name`, `phone`, `email`, `designation`, `username`, `password_hash`, `is_active`, `created_at`) VALUES
(1, 'Praveen Richard Francis', '+918940684434', 'praveenrichard16@gmail.com', 'Sales Agent', 'praveenrichard16@gmail.com', '$2y$10$VXxzbBDUekRzpq8B522oXexqAqEBGB8wd2w.4/KO5IKGLNjR6WC1K', 1, '2026-03-11 09:20:21');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `admins`
--
ALTER TABLE `admins`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `username` (`username`);

--
-- Indexes for table `blog_categories`
--
ALTER TABLE `blog_categories`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `slug` (`slug`);

--
-- Indexes for table `blog_posts`
--
ALTER TABLE `blog_posts`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `slug` (`slug`),
  ADD KEY `category_id` (`category_id`),
  ADD KEY `subcategory_id` (`subcategory_id`);

--
-- Indexes for table `blog_post_tags`
--
ALTER TABLE `blog_post_tags`
  ADD PRIMARY KEY (`post_id`,`tag_id`),
  ADD KEY `tag_id` (`tag_id`);

--
-- Indexes for table `blog_subcategories`
--
ALTER TABLE `blog_subcategories`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `slug` (`slug`),
  ADD KEY `category_id` (`category_id`);

--
-- Indexes for table `blog_tags`
--
ALTER TABLE `blog_tags`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `slug` (`slug`);

--
-- Indexes for table `customers`
--
ALTER TABLE `customers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_customer_lead` (`lead_id`),
  ADD KEY `fk_customer_agent` (`agent_id`);

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

--
-- Indexes for table `leads`
--
ALTER TABLE `leads`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_source` (`source_id`),
  ADD KEY `fk_status` (`status_id`),
  ADD KEY `fk_lead_funnel` (`funnel_id`),
  ADD KEY `fk_lead_stage` (`stage_id`),
  ADD KEY `fk_lead_agent` (`assigned_agent_id`);

--
-- Indexes for table `lead_followups`
--
ALTER TABLE `lead_followups`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_lead` (`lead_id`);

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

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

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

--
-- Indexes for table `lead_stages`
--
ALTER TABLE `lead_stages`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_funnel` (`funnel_id`),
  ADD KEY `fk_stage_status` (`status_id`);

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

--
-- Indexes for table `meetings`
--
ALTER TABLE `meetings`
  ADD PRIMARY KEY (`id`),
  ADD KEY `lead_id` (`lead_id`),
  ADD KEY `fk_meeting_agent` (`agent_id`);

--
-- Indexes for table `portfolio_categories`
--
ALTER TABLE `portfolio_categories`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `slug` (`slug`);

--
-- Indexes for table `portfolio_items`
--
ALTER TABLE `portfolio_items`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `slug` (`slug`),
  ADD KEY `category_id` (`category_id`),
  ADD KEY `subcategory_id` (`subcategory_id`);

--
-- Indexes for table `portfolio_subcategories`
--
ALTER TABLE `portfolio_subcategories`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `slug` (`slug`),
  ADD KEY `category_id` (`category_id`);

--
-- Indexes for table `sales_agents`
--
ALTER TABLE `sales_agents`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `idx_agent_username` (`username`);

--
-- AUTO_INCREMENT for dumped tables
--

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `blog_posts`
--
ALTER TABLE `blog_posts`
  ADD CONSTRAINT `blog_posts_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `blog_categories` (`id`),
  ADD CONSTRAINT `blog_posts_ibfk_2` FOREIGN KEY (`subcategory_id`) REFERENCES `blog_subcategories` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `blog_post_tags`
--
ALTER TABLE `blog_post_tags`
  ADD CONSTRAINT `blog_post_tags_ibfk_1` FOREIGN KEY (`post_id`) REFERENCES `blog_posts` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `blog_post_tags_ibfk_2` FOREIGN KEY (`tag_id`) REFERENCES `blog_tags` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `blog_subcategories`
--
ALTER TABLE `blog_subcategories`
  ADD CONSTRAINT `blog_subcategories_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `blog_categories` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `customers`
--
ALTER TABLE `customers`
  ADD CONSTRAINT `fk_customer_agent` FOREIGN KEY (`agent_id`) REFERENCES `sales_agents` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `fk_customer_lead_ref` FOREIGN KEY (`lead_id`) REFERENCES `leads` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `leads`
--
ALTER TABLE `leads`
  ADD CONSTRAINT `fk_lead_agent` FOREIGN KEY (`assigned_agent_id`) REFERENCES `sales_agents` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `fk_lead_funnel_c` FOREIGN KEY (`funnel_id`) REFERENCES `lead_funnels` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `fk_lead_source_c` FOREIGN KEY (`source_id`) REFERENCES `lead_sources` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `fk_lead_stage_c` FOREIGN KEY (`stage_id`) REFERENCES `lead_stages` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `fk_lead_status_c` FOREIGN KEY (`status_id`) REFERENCES `lead_statuses` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `lead_followups`
--
ALTER TABLE `lead_followups`
  ADD CONSTRAINT `fk_followup_lead` FOREIGN KEY (`lead_id`) REFERENCES `leads` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `lead_stages`
--
ALTER TABLE `lead_stages`
  ADD CONSTRAINT `fk_funnel_stages` FOREIGN KEY (`funnel_id`) REFERENCES `lead_funnels` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_stage_status` FOREIGN KEY (`status_id`) REFERENCES `lead_statuses` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `meetings`
--
ALTER TABLE `meetings`
  ADD CONSTRAINT `fk_meeting_agent` FOREIGN KEY (`agent_id`) REFERENCES `sales_agents` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `meetings_ibfk_1` FOREIGN KEY (`lead_id`) REFERENCES `leads` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `portfolio_items`
--
ALTER TABLE `portfolio_items`
  ADD CONSTRAINT `fk_item_cat` FOREIGN KEY (`category_id`) REFERENCES `portfolio_categories` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_item_subcat` FOREIGN KEY (`subcategory_id`) REFERENCES `portfolio_subcategories` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `portfolio_subcategories`
--
ALTER TABLE `portfolio_subcategories`
  ADD CONSTRAINT `fk_portfolio_cat` FOREIGN KEY (`category_id`) REFERENCES `portfolio_categories` (`id`) ON DELETE CASCADE ON UPDATE 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 */;
