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

START TRANSACTION;



--
-- Database: `smartcrm`
--

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

--
-- Table structure for table `assign_enquiries`
--

CREATE TABLE `assign_enquiries` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `enquiry_id` int(11) NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT 0,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `assign_enquiries`
--

INSERT INTO `assign_enquiries` (`id`, `user_id`, `enquiry_id`, `status`, `date`) VALUES
(1, 16, 4, 0, '2024-07-02 16:53:58'),
(2, 16, 4, 0, '2024-07-02 16:54:33'),
(3, 16, 4, 0, '2024-07-02 16:56:18'),
(4, 16, 4, 0, '2024-07-02 17:24:13'),
(5, 16, 4, 0, '2024-07-02 17:30:03'),
(6, 16, 4, 0, '2024-07-02 17:37:58'),
(7, 16, 4, 0, '2024-07-02 17:42:08'),
(8, 16, 4, 0, '2024-07-02 17:42:17'),
(9, 16, 4, 0, '2024-07-02 17:42:58'),
(10, 16, 4, 0, '2024-07-02 17:43:02'),
(11, 16, 4, 0, '2024-07-02 17:43:03'),
(12, 16, 4, 0, '2024-07-02 17:43:03'),
(13, 16, 4, 1, '2024-07-02 17:43:03');

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

--
-- Table structure for table `category_level_four`
--

CREATE TABLE `category_level_four` (
  `id` int(11) NOT NULL,
  `category_level_three_id` int(11) DEFAULT NULL,
  `name` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `category_level_four`
--

INSERT INTO `category_level_four` (`id`, `category_level_three_id`, `name`) VALUES
(2, 2, 'cat 4'),
(3, 3, 'category 4');

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

--
-- Table structure for table `category_level_one`
--

CREATE TABLE `category_level_one` (
  `id` int(11) NOT NULL,
  `office_id` int(11) DEFAULT NULL,
  `organization_id` int(11) DEFAULT NULL,
  `name` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `category_level_one`
--

INSERT INTO `category_level_one` (`id`, `office_id`, `organization_id`, `name`) VALUES
(11, 6, NULL, 'cat 1'),
(12, 9, NULL, 'category 1');

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

--
-- Table structure for table `category_level_three`
--

CREATE TABLE `category_level_three` (
  `id` int(11) NOT NULL,
  `category_level_two_id` int(11) DEFAULT NULL,
  `name` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `category_level_three`
--

INSERT INTO `category_level_three` (`id`, `category_level_two_id`, `name`) VALUES
(2, 3, 'cat 3'),
(3, 4, 'category 3');

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

--
-- Table structure for table `category_level_two`
--

CREATE TABLE `category_level_two` (
  `id` int(11) NOT NULL,
  `category_level_one_id` int(11) DEFAULT NULL,
  `name` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `category_level_two`
--

INSERT INTO `category_level_two` (`id`, `category_level_one_id`, `name`) VALUES
(3, 11, 'cat 2'),
(4, 12, 'category 2');

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

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

CREATE TABLE `enquiries` (
  `id` int(11) NOT NULL,
  `enquiry_by` varchar(100) DEFAULT NULL,
  `enquiry_entered_by` varchar(100) DEFAULT NULL,
  `income_range` varchar(100) DEFAULT NULL,
  `enquiry_date` text DEFAULT NULL,
  `username` varchar(255) DEFAULT NULL,
  `cnic` varchar(15) DEFAULT NULL,
  `date_of_birth` text DEFAULT NULL,
  `email` varchar(100) DEFAULT NULL,
  `father_name` varchar(100) DEFAULT NULL,
  `gender` varchar(10) DEFAULT NULL,
  `city` varchar(50) DEFAULT NULL,
  `present_address` varchar(255) DEFAULT NULL,
  `permanent_address` varchar(255) DEFAULT NULL,
  `mobile_no_one` varchar(15) DEFAULT NULL,
  `mobile_no_two` varchar(15) DEFAULT NULL,
  `landline` varchar(15) DEFAULT NULL,
  `project` varchar(100) DEFAULT NULL,
  `product` varchar(100) DEFAULT NULL,
  `developer` varchar(100) DEFAULT NULL,
  `price_offered` decimal(10,2) DEFAULT NULL,
  `property_address` varchar(255) DEFAULT NULL,
  `image` varchar(255) DEFAULT NULL,
  `source_of_information` varchar(100) DEFAULT NULL,
  `enquiry_status` varchar(50) DEFAULT NULL,
  `remarks` varchar(255) DEFAULT NULL,
  `field_one` text DEFAULT NULL,
  `field_two` text DEFAULT NULL,
  `field_three` text DEFAULT NULL,
  `field_four` text DEFAULT NULL,
  `field_five` text DEFAULT NULL,
  `field_six` text DEFAULT NULL,
  `field_seven` text DEFAULT NULL,
  `field_eight` text DEFAULT NULL,
  `field_nine` text DEFAULT NULL,
  `field_ten` text DEFAULT NULL,
  `office_id` int(11) DEFAULT NULL,
  `cat_one_id` int(11) DEFAULT NULL,
  `cat_two_id` int(11) DEFAULT NULL,
  `cat_three_id` int(11) DEFAULT NULL,
  `cat_four_id` int(11) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `enquiries` (`id`, `enquiry_by`, `enquiry_entered_by`, `income_range`, `enquiry_date`, `username`, `cnic`, `date_of_birth`, `email`, `father_name`, `gender`, `city`, `present_address`, `permanent_address`, `mobile_no_one`, `mobile_no_two`, `landline`, `project`, `product`, `developer`, `price_offered`, `property_address`, `image`, `source_of_information`, `enquiry_status`, `remarks`, `field_one`, `field_two`, `field_three`, `field_four`, `field_five`, `field_six`, `field_seven`, `field_eight`, `field_nine`, `field_ten`, `office_id`, `cat_one_id`, `cat_two_id`, `cat_three_id`, `cat_four_id`, `created_at`) VALUES
(16, 'testing', 'test', '21000', '2015-02-24', 'test', '2563525635263', NULL, 'test@gmail.com', 'name test', 'male', 'banglore', 'street#11', 'Street#11', '9265865896', '92658965478', '256589658', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 6, 11, NULL, NULL, NULL, '2024-08-02 07:17:55'),
(17, 'testing', 'test', '21000', '2015-02-24', 'test', '2563525635263', NULL, 'test@gmail.com', 'name test', 'male', 'banglore', 'street#11', 'Street#11', '9265865896', '92658965478', '256589658', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 6, 11, NULL, NULL, NULL, '2024-08-02 07:17:55'),
(18, 'testing', 'test', '21000', '2015-02-24', 'test', '2563525635263', NULL, 'test@gmail.com', 'name test', 'male', 'banglore', 'street#11', 'Street#11', '9265865896', '92658965478', '256589658', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 6, 11, NULL, NULL, NULL, '2024-08-02 07:17:55'),
(19, 'testing', 'test', '21000', '2015-02-24', 'test', '2563525635263', NULL, 'test@gmail.com', 'name test', 'male', 'banglore', 'street#11', 'Street#11', '9265865896', '92658965478', '256589658', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 6, 11, NULL, NULL, NULL, '2024-08-02 07:17:55'),
(25, 'testing', 'test', '21000', '2015-02-24', 'test', '2563525635263', NULL, 'test@gmail.com', 'name test', 'male', 'banglore', 'street#11', 'Street#11', '9265865896', '92658965478', '256589658', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 6, 11, NULL, NULL, NULL, '2024-08-02 07:17:55'),
(26, 'testing', 'test', '21000', '2015-02-24', 'test', '2563525635263', NULL, 'test@gmail.com', 'name test', 'male', 'banglore', 'street#11', 'Street#11', '9265865896', '92658965478', '256589658', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 6, 11, NULL, NULL, NULL, '2024-08-02 07:17:55'),
(27, 'testing', 'test', '21000', '2015-02-24', 'test', '2563525635263', NULL, 'test@gmail.com', 'name test', 'male', 'banglore', 'street#11', 'Street#11', '9265865896', '92658965478', '256589658', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 6, 11, NULL, NULL, NULL, '2024-08-02 07:17:55'),
(28, 'testing', 'test', '21000', '2015-02-24', 'test', '2563525635263', NULL, 'test@gmail.com', 'name test', 'male', 'banglore', 'street#11', 'Street#11', '9265865896', '92658965478', '256589658', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 6, 11, NULL, NULL, NULL, '2024-08-02 07:17:55'),
(29, 'testing', 'test', '21000', '2015-02-24', 'test', '2563525635263', NULL, 'test@gmail.com', 'name test', 'male', 'banglore', 'street#11', 'Street#11', '9265865896', '92658965478', '256589658', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 6, 11, NULL, NULL, NULL, '2024-08-02 07:17:55'),
(30, 'testing', 'test', '21000', '2015-02-24', 'test', '2563525635263', NULL, 'test@gmail.com', 'name test', 'male', 'banglore', 'street#11', 'Street#11', '9265865896', '92658965478', '256589658', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 6, 11, NULL, NULL, NULL, '2024-08-02 07:17:55'),
(31, 'testing', 'test', '21000', '2015-02-24', 'test', '2563525635263', NULL, 'test@gmail.com', 'name test', 'male', 'banglore', 'street#11', 'Street#11', '9265865896', '92658965478', '256589658', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 6, 11, NULL, NULL, NULL, '2024-08-02 07:17:55'),
(32, 'testing', 'test', '21000', '2015-02-24', 'test', '2563525635263', NULL, 'test@gmail.com', 'name test', 'male', 'banglore', 'street#11', 'Street#11', '9265865896', '92658965478', '256589658', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 6, 11, NULL, NULL, NULL, '2024-08-02 07:17:55'),
(33, 'testing', 'test', '21000', '2015-02-24', 'test', '2563525635263', NULL, 'test@gmail.com', 'name test', 'male', 'banglore', 'street#11', 'Street#11', '9265865896', '92658965478', '256589658', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 6, 11, NULL, NULL, NULL, '2024-08-02 07:17:55'),
(47, NULL, NULL, NULL, 'male', '123', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'asd', NULL, NULL, NULL, NULL, NULL, 6, 11, 3, 2, 2, '2024-08-02 07:17:55'),
(49, NULL, NULL, '2024-08-02', 'male', 'asd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'asd', NULL, NULL, NULL, NULL, NULL, 6, 11, NULL, NULL, NULL, '2024-08-02 07:17:55'),
(50, NULL, NULL, '2024-08-02', 'male', 'asd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'asd', NULL, NULL, NULL, NULL, NULL, 6, 11, NULL, NULL, NULL, '2024-08-02 07:17:55'),
(51, NULL, NULL, '2024-08-02', 'male', 'asd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'asd', NULL, NULL, NULL, NULL, NULL, 6, 11, NULL, NULL, NULL, '2024-08-02 07:17:55'),
(52, NULL, NULL, '2024-08-02', 'male', 'asd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'asd', NULL, NULL, NULL, NULL, NULL, 6, 11, NULL, NULL, NULL, '2024-08-02 07:17:55'),
(53, NULL, NULL, '2024-08-02', 'male', 'asd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'asd', NULL, NULL, NULL, NULL, NULL, 6, 11, NULL, NULL, NULL, '2024-08-02 07:17:55'),
(54, NULL, NULL, '2024-08-02', 'male', 'asd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'asd', NULL, NULL, NULL, NULL, NULL, 6, 11, NULL, NULL, NULL, '2024-08-02 07:17:55'),
(55, NULL, NULL, '2024-08-02', 'male', 'asd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'asd', NULL, NULL, NULL, NULL, NULL, 6, 11, 3, NULL, NULL, '2024-08-02 07:17:55'),
(56, NULL, NULL, '2024-08-02', 'male', 'asd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '324', NULL, NULL, NULL, NULL, NULL, 6, 11, NULL, NULL, NULL, '2024-08-02 07:17:55');

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

--
-- Table structure for table `enquiry_fields`
--

CREATE TABLE `enquiry_fields` (
  `id` int(11) NOT NULL,
  `title` varchar(255) NOT NULL,
  `field_name` varchar(255) NOT NULL,
  `status` tinyint(1) NOT NULL,
  `type` varchar(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `enquiry_fields`
--

INSERT INTO `enquiry_fields` (`id`, `title`, `field_name`, `status`, `type`) VALUES
(1, 'Enquiry By', 'enquiry_by', 0, 'Date'),
(2, 'Enquiry Entered By', 'enquiry_entered_by', 0, 'Date'),
(4, 'Income Range', 'income_range', 1, 'Date'),
(5, 'Enquiry Date', 'enquiry_date', 1, 'Drop Down'),
(6, 'Name', 'username', 1, 'Text'),
(7, 'CNIC', 'cnic', 0, 'Text'),
(8, 'Date Of Birth', 'date_of_birth', 0, 'Text'),
(9, 'Email', 'email', 0, 'Number'),
(10, 'Father Name', 'father_name', 0, 'Date'),
(11, 'Gender', 'gender', 0, 'Text'),
(12, 'City', 'city', 0, 'Date'),
(13, 'Present Address', 'present_address', 0, 'Text'),
(14, 'Permanent Address', 'permanent_address', 0, 'Text'),
(15, 'Mobile No One', 'mobile_no_one', 0, 'Text'),
(16, 'Mobile No Two', 'mobile_no_two', 0, 'Text'),
(17, 'Landline', 'landline', 0, 'Date'),
(18, 'Project', 'project', 0, 'Text'),
(19, 'Product', 'product', 0, 'Text'),
(20, 'Developer', 'developer', 0, 'Text'),
(21, 'Price Offered', 'price_offered', 0, 'Number'),
(22, 'Property Address', 'property_address', 0, 'Number'),
(23, 'Image ', 'image \r\n', 0, 'Number'),
(24, 'Source Of Information', 'source_of_information', 0, 'Text'),
(25, 'Enquiry Status', 'enquiry_status', 0, 'Number'),
(26, 'Remarks', 'remarks', 0, 'Text'),
(27, 'Field One', 'field_one', 0, 'Number'),
(28, 'Field Two', 'field_two', 0, 'Text'),
(29, 'Field Three', 'field_three', 0, 'Number'),
(30, 'Field Four', 'field_four', 0, 'Date'),
(31, 'Field Five', 'field_five', 1, 'Text'),
(32, 'Field Six', 'field_six', 0, 'Date'),
(33, 'Field Seven', 'field_seven', 0, 'Text'),
(34, 'Field Eight', 'field_eight', 0, 'Text'),
(35, 'Field Nine fghf', 'field_nine', 0, 'Date'),
(36, 'Something Important', 'field_ten', 0, 'Text');

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

--
-- Table structure for table `enquiry_fields_dropdown`
--

CREATE TABLE `enquiry_fields_dropdown` (
  `id` int(11) NOT NULL,
  `dropdown` varchar(255) DEFAULT NULL,
  `field_name` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `enquiry_fields_dropdown`
--

INSERT INTO `enquiry_fields_dropdown` (`id`, `dropdown`, `field_name`) VALUES
(4, 'male ', 'date_of_birth'),
(5, 'female', 'date_of_birth'),
(6, 'not to say', 'date_of_birth'),
(16, 'male', 'enquiry_date');

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

--
-- Table structure for table `follow_up`
--

CREATE TABLE `follow_up` (
  `id` int(11) NOT NULL,
  `user_id` int(11) DEFAULT NULL,
  `enquiry_id` int(11) DEFAULT NULL,
  `called_by` varchar(255) DEFAULT NULL,
  `called_type` varchar(255) DEFAULT NULL,
  `called_status` varchar(255) DEFAULT NULL,
  `remarks` text DEFAULT NULL,
  `price_offered` varchar(255) DEFAULT NULL,
  `followup_date` date DEFAULT NULL,
  `next_followup_date` date DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `follow_up`
--

INSERT INTO `follow_up` (`id`, `user_id`, `enquiry_id`, `called_by`, `called_type`, `called_status`, `remarks`, `price_offered`, `followup_date`, `next_followup_date`, `created_at`) VALUES
(1, 16, 3, 'asd', NULL, 'Will Call back', 'sdfds', '234', '2024-07-02', '2024-07-02', '2024-07-03 05:53:21'),
(2, 16, 3, 'asd', NULL, 'Will Call back', 'sdfds', '234', '2024-07-03', '2024-07-02', '2024-07-03 05:53:50'),
(3, 16, 3, 'asd', NULL, 'Will Call back', 'sdfds', '234', '2024-07-03', '2024-07-02', '2024-07-03 05:54:23'),
(4, 16, 3, 'asd', NULL, 'Will Call back', 'sdfds', '234', '2024-07-03', '2024-07-02', '2024-07-03 05:54:31'),
(5, 16, 3, 'asd', NULL, 'Will Call back', 'sdfds', '234', '2024-07-03', '2024-07-02', '2024-07-03 05:54:39'),
(6, 16, 3, 'Zubair', NULL, 'Not Answered', 'asdasd', '50000', '2024-07-30', '2024-07-31', '2024-07-03 06:14:14'),
(7, 1, 3, 'asdasd', NULL, 'Answered', 'asdasd', '50000', '2024-07-30', '2024-07-30', '2024-07-03 06:14:55'),
(8, 16, 3, 'asdasd', 'Will Call back', 'Follow Up Required', 'adasd', '333', '2024-07-30', '2024-07-31', '2024-07-03 06:17:48'),
(9, 1, 3, 'asd', 'Will Call back', 'Call Disconnected', 'sdfds', '234', '2024-07-02', '2024-07-02', '2024-07-03 06:21:04'),
(10, 16, 3, 'asd', 'Will Call back', 'Call Disconnected', 'asdasd', '3333', '2024-07-30', '2024-07-31', '2024-07-03 07:04:16'),
(11, 40, 11, 'Someone', 'Answered', 'Sales Matured', 'zsgsdf', '220000', '2024-07-22', NULL, '2024-07-06 12:39:07'),
(12, 40, 11, 'Someone', 'Answered', 'Sales Matured', 'sale has been matured', '220000', '2024-07-05', '2024-07-10', '2024-07-06 12:39:47'),
(13, 40, 11, 'Someone', 'Answered', 'Phone Not Picked', 'asd', '220000', '2024-07-30', NULL, '2024-07-06 12:45:55'),
(14, 43, 15, 'asad', 'Answered', 'Sales Matured', 'good', '25000', '2024-07-12', '2024-07-15', '2024-07-15 07:44:42'),
(15, 16, 15, 'asad', '5', 'Call Disconnected', 'good', '25000', '2024-07-05', '2024-07-01', '2024-07-15 12:35:47'),
(16, 16, 15, 'asad', '4', 'Dropped', 'good', '25000', '2024-07-22', '2024-07-30', '2024-07-15 12:40:37'),
(17, 16, 15, 'asad', '3', 'Dropped', 'goodssss', '25000', '2024-07-14', '2024-07-30', '2024-07-15 12:50:46');

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

--
-- Table structure for table `office`
--

CREATE TABLE `office` (
  `id` int(11) NOT NULL,
  `organization_id` int(11) DEFAULT NULL,
  `name` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `office`
--

INSERT INTO `office` (`id`, `organization_id`, `name`) VALUES
(6, 5, 'asd'),
(9, 14, 'model town');

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

--
-- Table structure for table `organization`
--

CREATE TABLE `organization` (
  `id` int(11) NOT NULL,
  `name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `organization`
--

INSERT INTO `organization` (`id`, `name`) VALUES
(5, 'CFE2'),
(14, 'centillion ');

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

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

CREATE TABLE `permissions` (
  `id` int(11) NOT NULL,
  `role_id` int(11) DEFAULT NULL,
  `user_tab` tinyint(1) DEFAULT NULL,
  `user_add` tinyint(1) DEFAULT NULL,
  `user_view` tinyint(1) DEFAULT NULL,
  `user_delete` tinyint(1) DEFAULT NULL,
  `user_edit` tinyint(1) DEFAULT NULL,
  `role_tab` tinyint(1) DEFAULT NULL,
  `role_add` tinyint(1) DEFAULT NULL,
  `role_delete` tinyint(1) DEFAULT NULL,
  `organization_tab` tinyint(1) DEFAULT NULL,
  `organization_add` tinyint(1) DEFAULT NULL,
  `organization_delete` tinyint(1) DEFAULT NULL,
  `office_tab` tinyint(1) DEFAULT NULL,
  `office_add` tinyint(1) DEFAULT NULL,
  `office_delete` tinyint(1) DEFAULT NULL,
  `cat_level_one_tab` tinyint(1) DEFAULT NULL,
  `cat_level_one_add` tinyint(1) DEFAULT NULL,
  `cat_level_one_delete` tinyint(1) DEFAULT NULL,
  `cat_level_two_tab` tinyint(1) DEFAULT NULL,
  `cat_level_two_add` tinyint(1) DEFAULT NULL,
  `cat_level_two_delete` tinyint(1) DEFAULT NULL,
  `cat_level_three_tab` tinyint(1) DEFAULT NULL,
  `cat_level_three_add` tinyint(1) DEFAULT NULL,
  `cat_level_three_delete` tinyint(1) DEFAULT NULL,
  `cat_level_four_tab` tinyint(1) DEFAULT NULL,
  `cat_level_four_add` tinyint(1) DEFAULT NULL,
  `cat_level_four_delete` tinyint(1) DEFAULT NULL,
  `enquiry_field_tab` tinyint(1) DEFAULT NULL,
  `enquiries_tab` tinyint(1) DEFAULT NULL,
  `enquiries_add` tinyint(1) DEFAULT NULL,
  `enquiries_delete` tinyint(1) DEFAULT NULL,
  `enquiries_edit` tinyint(1) DEFAULT NULL,
  `enquiries_view` tinyint(1) DEFAULT NULL,
  `enquiries_assign` tinyint(1) DEFAULT NULL,
  `follow_up_tab` tinyint(1) DEFAULT NULL,
  `follow_up_add` tinyint(1) DEFAULT NULL,
  `follow_up_view` tinyint(1) DEFAULT NULL,
  `customer_tab` tinyint(1) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `permissions` (`id`, `role_id`, `user_tab`, `user_add`, `user_view`, `user_delete`, `user_edit`, `role_tab`, `role_add`, `role_delete`, `organization_tab`, `organization_add`, `organization_delete`, `office_tab`, `office_add`, `office_delete`, `cat_level_one_tab`, `cat_level_one_add`, `cat_level_one_delete`, `cat_level_two_tab`, `cat_level_two_add`, `cat_level_two_delete`, `cat_level_three_tab`, `cat_level_three_add`, `cat_level_three_delete`, `cat_level_four_tab`, `cat_level_four_add`, `cat_level_four_delete`, `enquiry_field_tab`, `enquiries_tab`, `enquiries_add`, `enquiries_delete`, `enquiries_edit`, `enquiries_view`, `enquiries_assign`, `follow_up_tab`, `follow_up_add`, `follow_up_view`, `customer_tab`) VALUES
(43, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
(44, 2, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0);

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

--
-- Table structure for table `roles`
--

CREATE TABLE `roles` (
  `id` int(11) NOT NULL,
  `role` varchar(255) NOT NULL,
  `self_inquiries` tinyint(1) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `roles`
--

INSERT INTO `roles` (`id`, `role`, `self_inquiries`) VALUES
(1, 'admin', 0),
(2, 'user', 0),
(6, 'test', 1);

--
-- Indexes for dumped tables
--

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

--
-- Indexes for table `category_level_four`
--
ALTER TABLE `category_level_four`
  ADD PRIMARY KEY (`id`),
  ADD KEY `category_level_three_id` (`category_level_three_id`);

--
-- Indexes for table `category_level_one`
--
ALTER TABLE `category_level_one`
  ADD PRIMARY KEY (`id`),
  ADD KEY `organization_id` (`organization_id`),
  ADD KEY `office_id` (`office_id`);

--
-- Indexes for table `category_level_three`
--
ALTER TABLE `category_level_three`
  ADD PRIMARY KEY (`id`),
  ADD KEY `category_level_two_id` (`category_level_two_id`);

--
-- Indexes for table `category_level_two`
--
ALTER TABLE `category_level_two`
  ADD PRIMARY KEY (`id`),
  ADD KEY `category_level_one_id` (`category_level_one_id`);

--
-- Indexes for table `enquiries`
--
ALTER TABLE `enquiries`
  ADD PRIMARY KEY (`id`),
  ADD KEY `office_id` (`office_id`),
  ADD KEY `cat_one_id` (`cat_one_id`),
  ADD KEY `cat_two_id` (`cat_two_id`),
  ADD KEY `cat_three_id` (`cat_three_id`),
  ADD KEY `cat_four_id` (`cat_four_id`);

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

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

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

--
-- Indexes for table `office`
--
ALTER TABLE `office`
  ADD PRIMARY KEY (`id`),
  ADD KEY `organization_id` (`organization_id`);

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

--
-- Indexes for table `permissions`
--
ALTER TABLE `permissions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `role_id` (`role_id`);

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

--
-- AUTO_INCREMENT for dumped tables
--

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

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

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

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

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

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

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

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

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

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

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

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

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `category_level_four`
--
ALTER TABLE `category_level_four`
  ADD CONSTRAINT `category_level_four_ibfk_1` FOREIGN KEY (`category_level_three_id`) REFERENCES `category_level_three` (`id`);

--
-- Constraints for table `category_level_one`
--
ALTER TABLE `category_level_one`
  ADD CONSTRAINT `category_level_one_ibfk_1` FOREIGN KEY (`organization_id`) REFERENCES `organization` (`id`),
  ADD CONSTRAINT `category_level_one_ibfk_2` FOREIGN KEY (`office_id`) REFERENCES `office` (`id`);

--
-- Constraints for table `category_level_three`
--
ALTER TABLE `category_level_three`
  ADD CONSTRAINT `category_level_three_ibfk_1` FOREIGN KEY (`category_level_two_id`) REFERENCES `category_level_two` (`id`);

--
-- Constraints for table `category_level_two`
--
ALTER TABLE `category_level_two`
  ADD CONSTRAINT `category_level_two_ibfk_1` FOREIGN KEY (`category_level_one_id`) REFERENCES `category_level_one` (`id`);

--
-- Constraints for table `enquiries`
--
ALTER TABLE `enquiries`
  ADD CONSTRAINT `enquiries_ibfk_1` FOREIGN KEY (`office_id`) REFERENCES `office` (`id`),
  ADD CONSTRAINT `enquiries_ibfk_2` FOREIGN KEY (`cat_one_id`) REFERENCES `category_level_one` (`id`),
  ADD CONSTRAINT `enquiries_ibfk_3` FOREIGN KEY (`cat_two_id`) REFERENCES `category_level_two` (`id`),
  ADD CONSTRAINT `enquiries_ibfk_4` FOREIGN KEY (`cat_three_id`) REFERENCES `category_level_three` (`id`),
  ADD CONSTRAINT `enquiries_ibfk_5` FOREIGN KEY (`cat_four_id`) REFERENCES `category_level_four` (`id`);

--
-- Constraints for table `office`
--
ALTER TABLE `office`
  ADD CONSTRAINT `office_ibfk_1` FOREIGN KEY (`organization_id`) REFERENCES `organization` (`id`);

--
-- Constraints for table `permissions`
--
ALTER TABLE `permissions`
  ADD CONSTRAINT `permissions_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`);
COMMIT;

