<?php

$conn = new MySQLi("localhost", "karan_live", "Sailor@123!", "karan_live");

$sql = "SELECT * FROM caste";
$caste_result = mysqli_query($conn, $sql);

$sql = "SELECT * FROM sub_caste";
$sub_result = mysqli_query($conn, $sql);

$sql = "SELECT * FROM status";
$status_result = mysqli_query($conn, $sql);

$sql = "SELECT * FROM source";
$source_result = mysqli_query($conn, $sql);

$sql = "SELECT * FROM res_status";
$res_result = mysqli_query($conn, $sql);

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;

$msg = '';

include("include/settings.php");
include("checksession.php");

if (isset($_POST['btnSaveMember'])) {
    if (trim($_POST["txtDate"]) != null) {
        $leadtype = 'rishta_lead';
        $thedate = $thisdate;

        $lead_date = date('Y-m-d', strtotime($_POST['txtDate']));


        
   if (trim($_POST["txtdop"]) != null) {
                $paydate = $_POST["txtdop"];
            }
             else{
             $paydate =    $_POST['txtdop'] = NULL;
            }

               
                       if (trim($_POST["txtpname"]) != null) {
                $txtpname = $_POST["txtpname"];
            }
             else{
              $txtpname =    $_POST['txtpname'] = NULL;
            }

                   if (trim($_POST["txtrelation"]) != null) {
                $txtrelation = $_POST["txtrelation"];
            }
             else{
              $txtrelation =    $_POST['txtrelation'] = NULL;
            }

      if (trim($_POST["txtpcontact"]) != null) {
                $txtpcontact = $_POST["txtpcontact"];
            }
             else{
              $txtpcontact =    $_POST['txtpcontact'] = NULL;
            }
            

  
      if (trim($_POST["txtmstatus"]) != null) {
                $txtmstatus= $_POST["txtmstatus"];
            }
             else{
              $txtmstatus =    $_POST['txtmstatus'] = NULL;
            }
            

  
      if (trim($_POST["txtemail"]) != null) {
                $txtemail = $_POST["txtemail"];
            }
             else{
              $txtemail =    $_POST['txtemail'] = NULL;
            }
            

  
      if (trim($_POST["txtcurrency"]) != null) {
                $txtcurrency = $_POST["txtcurrency"];
            }
             else{
              $txtcurrency =    $_POST['txtcurrency'] = NULL;
            }
            

  
      if (trim($_POST["txtamanual"]) != null) {
                $txtamanual = $_POST["txtamanual"];
            }
             else{
              $txtamanual =    $_POST['txtamanual'] = NULL;
            }
            

  
      if (trim($_POST["txtgender"]) != null) {
                $txtgender = $_POST["txtgender"];
            }
             else{
              $txtgender =    $_POST['txtgender'] = NULL;
            }
            

  
      if (trim($_POST["txtmarital"]) != null) {
                $txtmarital= $_POST["txtmarital"];
            }
             else{
              $txtmarital=    $_POST['txtmarital'] = NULL;
            }
            
 
  
      if (trim($_POST["txtrelation"]) != null) {
                $txtage = $_POST["txtage"];
            }
             else{
              $txtage =    $_POST['txtage'] = NULL;
            }
            

  
      if (trim($_POST["txtheight"]) != null) {
                $txtheight= $_POST["txtheight"];
            }
             else{
              $txtheight=    $_POST['txtheight'] = NULL;
            }
            

  
      if (trim($_POST["txtheightinch"]) != null) {
                $txtheightinch = $_POST["txtheightinch"];
            }
             else{
              $txtheightinch =    $_POST['txtheightinch'] = NULL;
            }
            

  
      if (trim($_POST["txtedu"]) != null) {
                $txtedu = $_POST["txtedu"];
            }
             else{
              $txtedu =    $_POST['txtedu'] = NULL;
            }
            

  
      if (trim($_POST["txtemp"]) != null) {
                $txtemp = $_POST["txtemp"];
            }
             else{
              $txtemp =    $_POST['txtemp'] = NULL;
            }
            
 
  
      if (trim($_POST["txtrelation"]) != null) {
                $txtreligion = $_POST["txtreligion"];
            }
             else{
              $txtreligion =    $_POST['txtreligion'] = NULL;
            }
            
 
  
      if (trim($_POST["txtminfo"]) != null) {
                $txtminfo = $_POST["txtminfo"];
            }
             else{
              $txtminfo=    $_POST['txtminfo'] = NULL;
            }
            

  
      if (trim($_POST["txtcaste"]) != null) {
                $txtcaste = $_POST["txtcaste"];
            }
             else{
              $txtcaste =    $_POST['txtcaste'] = NULL;
            }
            

  
      if (trim($_POST["txtsubcaste"]) != null) {
                $txtsubcaste = $_POST["txtsubcaste"];
            }
             else{
              $txtsubcaste =    $_POST['txtsubcaste'] = NULL;
            }
            

  
      if (trim($_POST["txtrstatus"]) != null) {
                $txtrstatus = $_POST["txtrstatus"];
            }
             else{
              $txtrstatus =    $_POST['txtrstatus'] = NULL;
            }
            
 
  
      if (trim($_POST["txtRemarks"]) != null) {
                $txtRemarks = $_POST["txtRemarks"];
            }
             else{
              $txtRemarks =    $_POST['txtRemarks'] = NULL;
            }
            

  
      if (trim($_POST["txtname1"]) != null) {
                $txtname1 = $_POST["txtname1"];
            }
             else{
              $txtname1 =    $_POST['txtname1'] = NULL;
            }
            

  
      if (trim($_POST["txturl1"]) != null) {
                $txturl1 = $_POST["txturl1"];
            }
             else{
              $txturl1 =    $_POST['txturl1'] = NULL;
            }
            

  
      if (trim($_POST["txtname2"]) != null) {
                $txtname2 = $_POST["txtname2"];
            }
             else{
              $txtname2 =    $_POST['txtname2'] = NULL;
            }
            

  
      if (trim($_POST["txturl2"]) != null) {
                $txturl2 = $_POST["txturl2"];
            }
             else{
              $txturl2 =    $_POST['txturl2'] = NULL;
            }
            
  
  
      if (trim($_POST["txtname3"]) != null) {
                $txtname3 = $_POST["txtname3"];
            }
             else{
              $txtname3 =    $_POST['txtname3'] = NULL;
            }
            

  
      if (trim($_POST["txturl3"]) != null) {
                $txturl3= $_POST["txturl3"];
            }
             else{
              $txturl3 =    $_POST['txturl3'] = NULL;
            }
            

  
      if (trim($_POST["txtname4"]) != null) {
                $txtname4 = $_POST["txtname4"];
            }
             else{
              $txtname4 =    $_POST['txtname4'] = NULL;
            }
            

  
      if (trim($_POST["txturl4"]) != null) {
                $txturl4 = $_POST["txturl4"];
            }
             else{
              $txturl4 =    $_POST['txturl4'] = NULL;
            }
            

  
      if (trim($_POST["txtname5"]) != null) {
                $txtname5 = $_POST["txtname5"];
            }
             else{
              $txtname5 =    $_POST['txtname5'] = NULL;
            }
            
  
      if (trim($_POST["txturl5"]) != null) {
                $txturl5 = $_POST["txturl5"];
            }
             else{
              $txturl5 =    $_POST['txturl5'] = NULL;
            }
            
            

      if (trim($_POST["txtvideocall"]) != null) {
                $txtvideocall = $_POST["txtvideocall"];
            }
            else{
               $txtvideocall =   $_POST['txtvideocall'] = NULL;
            }

     if (trim($_POST["txtvideolink"]) != null) {
                $txtvideolink = $_POST["txtvideolink"];
            }
             else{
              $txtvideolink =   $_POST['txtvideolink'] = NULL;
            }
            
               if (trim($_POST["txtcname2"]) != null) {
                $txtcname2 = $_POST["txtcname2"];
            }
             else{
              $txtcname2 =    $_POST['txtcname2'] = NULL;
            }
            
  
      if (trim($_POST["txtcontact2"]) != null) {
                $txtcontact2 = $_POST["txtcontact2"];
            }
             else{
              $txtcontact2 =    $_POST['txtcontact2'] = NULL;
            }
            
            
              if (trim($_POST["txtemailid2"]) != null) {
                $txtemailid2 = $_POST["txtemailid2"];
            }
             else{
              $txtemailid2 =    $_POST['txtemailid2'] = NULL;
            }
  
      

      //  $call_time_scheduling = NULL;
        if (trim($_POST["call_time_scheduling"]) != null) {
            $call_time_scheduling = date('H:i:s', strtotime($_POST['call_time_scheduling']));
        }
          else{
                $call_time_scheduling = NULL;
            }

        $pass = 1;
        if (isset($_POST['ddlLeadAllocated']) && !empty($_POST['ddlLeadAllocated'])) {

            $check_query = "";
            $check_query .= "SELECT `lead_allocated_to` FROM rishta_leadmaster WHERE lead_allocated_to='" . $_POST['ddlLeadAllocated'] . "' ";
            $checkExists = $mysqli->prepare($check_query);
            $checkExists->execute();
            $checkExists = $checkExists->get_result();
            if (mysqli_num_rows($checkExists) >= 1000) {

                $pass = 0;
                $msg = "Please Select Other Sales execute to allocate lead.";
            }
        }

        if ($pass == 1) {

 
           
             $usermaster = $mysqli->prepare("INSERT INTO rishta_leadmaster(lead_created, lead_payment, source, lead_type, profile_name, contact_name, relation, profile_contact_no, contact_no, member_status, profile_email, email_id, city, state, country, disposition, currency, amount, gender, marital_status, age, height, height_inches, education, employment, religion, more_info, caste, sub_caste, residency_status, lead_remarks, name1, url1, name2, url2, name3, url3, name4, url4, name5, url5, video_calling, video_link, call_scheduling, call_time_scheduling, lead_allocated_to, lead_added_by,contact_name_two,contact_email_two,contact_number_two, lead_created_on) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
            $usermaster->bind_param("ssssssssssssssssssssssssssssssssssssssssssssiisssss", $lead_date, $paydate, $_POST['txtLeadSource'], $leadtype, $txtpname, $_POST['txtcname'],$txtrelation, $txtpcontact, $_POST['txtcontact'], $txtmstatus, $txtemail, $_POST['txtemailid'], $_POST['txtcity'], $_POST['txtstate'], $_POST['txtcountry'], $_POST['ddlLeadStatus'], $txtcurrency, $txtamanual, $txtgender, $txtamanual, $txtage, $txtheight, $txtheightinch, $txtedu, $txtemp, $txtreligion, $txtminfo, $txtcaste, $txtsubcaste, $txtrstatus, $txtRemarks, $txtname1, $txturl1, $txtname2, $txturl2, $txtname3, $txturl3, $txtname4, $txturl4, $txtname5, $txturl5, $txtvideocall, $txtvideolink, $_POST['txtcall'], $call_time_scheduling, $_POST['ddlLeadAllocated'], $_SESSION['userId'],$txtcname2,$txtemailid2,$txtcontact2, $thedate);

            $usermaster->execute();
            $lead_id = $usermaster->insert_id;
            $usermaster->close();


           // $call_scheduling = NULL;
            if (trim($_POST["txtcall"]) != null) {
                $call_scheduling = date('Y-m-d', strtotime(trim($_POST['txtcall'])));
            }
            else{
                $call_scheduling = NULL; 
            }

           // $call_time_scheduling = NULL;
            if (trim($_POST["call_time_scheduling"]) != null) {
                $call_time_scheduling = date('H:i:s', strtotime(trim($_POST['call_time_scheduling'])));
            }
             else{
                $call_scheduling = NULL; 
            }

            $disposition = $_POST['ddlLeadStatus'];
         if (in_array($disposition, array('Follow up', 'New Call','No match shared yet','Match Shared','Close to Conversion','Fully Paid','Lead Rejected','Refund','Fresh Lead','Renewal Lead','Ptential CRM Lead','Interested','Old Leads','Expired (Not to be converted)','Inactive','Ringing','Expired','Active','Wrong Number','On Hold','Confirmed Rishta done','Old Leads','Not Interested'))) {

                if (!empty($call_scheduling) && !empty($call_time_scheduling)) {

                    if (isset($lead_id) && !empty($lead_id)) {

                        $insert_query = "";
                        $insert_query .= "INSERT INTO cbi_call_schedule SET ";
                        $insert_query .= " call_added_by = '" . $_SESSION['userId'] . "', ";
                        $insert_query .= " lead_id = '" . $lead_id . "', ";
                        $insert_query .= " disposition = '" . $disposition . "', ";
                        $insert_query .= " call_scheduling = '" . $call_scheduling . "', ";
                        $insert_query .= " call_time_scheduling = '" . $call_time_scheduling . "', ";
                        $insert_query .= " created_on = '" . date('Y-m-d H:i:s') . "' ";

                        $insertObj = $mysqli->prepare($insert_query);
                        $insertObj->execute();
                        $insertObj->close();
                    }
                }
                
                    if (!empty($disposition) && !empty($disposition)) {

                    if (isset($lead_id) && !empty($lead_id)) {

                        $insert_query = "";
                        $insert_query .= "INSERT INTO timeline SET ";
                        $insert_query .= " call_added_by = '" . $_SESSION['userId'] . "', ";
                        $insert_query .= " lead_id = '" . $lead_id . "', ";
                        $insert_query .= " disposition = '" . $disposition . "', ";
                        $insert_query .= " created_on = '" . date('Y-m-d H:i:s') . "' ";

                        $insertObj = $mysqli->prepare($insert_query);
                        $insertObj->execute();
                        $insertObj->close();
                    }
                }
            }

            $msg = "Lead has been added successfully.";
            header("refresh:2;url=add-new.php");
        }
    } else {
        $msg = "Please enter all the fields correctly.";
    }


//////////////////////////////////////



if(isset($_POST['btnSaveMember']))

{

require 'PHPMailer/src/Exception.php';
require 'PHPMailer/src/PHPMailer.php';
require 'PHPMailer/src/SMTP.php';


//Load Composer's autoloader
require 'vendor/autoload.php';

// Create a new PHPMailer instance
$mail = new PHPMailer();

// Set up SMTP
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'aaadriversacademyca@gmail.com'; // Your Gmail email address
$mail->Password = 'vjqzkpbuigajmtcq'; // Your Gmail password
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; // Enable TLS
//$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
$mail->Port = 587;

// Sender information
$mail->setFrom('rishtadepot@gmail.com', 'Rishta Depot'); // Your Gmail email address and your name

// Recipient information
$mail->addAddress($_POST['txtemailid'], $_POST['txtcname']); // Recipient email address and name

            // Email content
            $mail->isHTML(true);
            $mail->Subject = 'Welcome To Rista Depot';
				$mail->Body=
				
				'<!DOCTYPE html>
<html lang="en" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<title></title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<meta content="width=device-width, initial-scale=1.0" name="viewport"/><!--[if mso]><xml><o:OfficeDocumentSettings><o:PixelsPerInch>96</o:PixelsPerInch><o:AllowPNG/></o:OfficeDocumentSettings></xml><![endif]--><!--[if !mso]><!-->
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;300;400;500;600;700;800;900" rel="stylesheet" type="text/css"/>
<link href="https://fonts.googleapis.com/css2?family=Merriweather:wght@100;200;300;400;500;600;700;800;900" rel="stylesheet" type="text/css"/><!--<![endif]-->
<style>
    * {
        box-sizing: border-box;
    }

    body {
        margin: 0;
        padding: 0;
        background-color: #fff7df;
        -webkit-text-size-adjust: none;
        text-size-adjust: none;
    }

    a[x-apple-data-detectors] {
        color: inherit !important;
        text-decoration: inherit !important;
    }

    #MessageViewBody a {
        color: inherit;
        text-decoration: none;
    }

    p {
        line-height: inherit
    }

    .desktop_hide,
    .desktop_hide table {
        mso-hide: all;
        display: none;
        max-height: 0px;
        overflow: hidden;
    }

    .image_block img+div {
        display: none;
    }

    @media (max-width:700px) {

        .desktop_hide table.icons-inner,
        .social_block.desktop_hide .social-table {
            display: inline-block !important;
        }

        .icons-inner {
            text-align: center;
        }

        .icons-inner td {
            margin: 0 auto;
        }

        .mobile_hide {
            display: none;
        }

        .row-content {
            width: 100% !important;
        }

        .stack .column {
            width: 100%;
            display: block;
        }

        .mobile_hide {
            min-height: 0;
            max-height: 0;
            max-width: 0;
            overflow: hidden;
            font-size: 0px;
        }

        .desktop_hide,
        .desktop_hide table {
            display: table !important;
            max-height: none !important;
        }

        .row-1 .column-1 .block-10.spacer_block {
            height: 80px !important;
        }

        .row-1 .column-1 .block-5.heading_block h1 {
            font-size: 36px !important;
        }

        .row-1 .column-1 .block-8.heading_block td.pad {
            padding: 10px 10px 0 !important;
        }

        .row-1 .column-1 .block-8.heading_block h2 {
            font-size: 20px !important;
        }

        .row-2 .column-1 .block-2.paragraph_block td.pad {
            padding: 10px 0 !important;
        }

        .row-2 .column-1 {
            padding: 5px 10px 15px !important;
        }

        .row-4 .column-1 {
            padding: 10px 0 0 !important;
        }
    }
</style>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" class="nl-container" role="presentation" width="100%">
<tbody>
<tr>
<td>
<table align="center" border="0" cellpadding="0" cellspacing="0" class="row row-1" role="presentation" width="100%">
<tbody>
<tr>
<td>
<table align="center" border="0" cellpadding="0" cellspacing="0" class="row-content stack" role="presentation" width="680">
<tbody>
<tr>
<td class="column column-1" width="100%">
<div class="spacer_block block-1" style="height:20px;line-height:20px;font-size:1px;"> </div>
<table border="0" cellpadding="0" cellspacing="0" class="social_block mobile_hide" role="presentation" style="display:none;" width="100%">
<tbody>
<tr>
<td class="social-table" style="padding:0;" width="100%">
<table align="center" border="0" cellpadding="0" cellspacing="0" class="table table-social" role="presentation" style="margin:auto;">
<tbody>
<tr>
<td align="center" style="padding:0;" width="100%">
<table border="0" cellpadding="0" cellspacing="0" class="icons-inner" role="presentation">
<tbody>

</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<div class="spacer_block block-10 spacer" style="height:80px;line-height:80px;font-size:1px;"> </div>
<table border="0" cellpadding="0" cellspacing="0" class="row row-2" role="presentation" style="margin:auto;">
<tbody>
<tr>
<td>
<table align="center" border="0" cellpadding="0" cellspacing="0" class="row-content stack" role="presentation" width="640">
<tbody>
<tr>
<td class="column column-1" width="100%">
<table border="0" cellpadding="0" cellspacing="0" class="block block-1 paragraph_block" role="presentation" width="100%">
<tbody>
<tr>
<td style="padding:10px;text-align: center;">
<img style="margin-top:0;text-align:center; width:200px; height:68px;" src="https://rishtasite.com/assets/images/logo-black.png" >
</td>
</tr>
<tr>
<td style="padding:10px;">
<h1 style="margin-top:0;text-align:center;">Welcome to Rishta Depot</h1>
</td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="0" cellspacing="0" class="block block-2 paragraph_block" role="presentation" width="100%">
<tbody>
<tr>
<td style="padding:10px;">
<p style="margin:0;text-align:center;">Hi! '.$_POST['txtcname'].'</p>
</td>
</tr>
<tr>
<td style="padding:10px;">
<p style="margin:0;text-align:center;">We are excited to have you join our community!</p>
</td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="0" cellspacing="0" class="block block-3" role="presentation" width="100%">
<tbody>
<tr>
<td style="padding:10px;">
<table align="center" border="0" cellpadding="0" cellspacing="0" class="button_block" role="presentation">
<tbody>
<tr>
<td style="background-color:#f36f21;border-radius:4px;padding:8px 16px;">
<a href="https://rishtasite.com/" style="background-color:#f36f21;border:1px solid #f36f21;border-radius:4px;color:#ffffff;display:inline-block;font-family:Montserrat, Arial, sans-serif;font-size:14px;font-weight:400;line-height:120%;text-align:center;text-decoration:none;width:auto;-webkit-text-size-adjust:none;mso-border-alt:none;">Visit our website</a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<div class="spacer_block block-4" style="height:20px;line-height:20px;font-size:1px;"> </div>
<table border="0" cellpadding="0" cellspacing="0" class="row row-3" role="presentation" width="100%">
<tbody>
<tr>
<td>
<table align="center" border="0" cellpadding="0" cellspacing="0" class="row-content stack" role="presentation" width="640">
<tbody>
<tr>
<td class="column column-1" width="100%">
<table border="0" cellpadding="0" cellspacing="0" class="block block-5 heading_block" role="presentation" width="100%">
<tbody>
<tr>
<td style="padding:0 0 10px;text-align:center;">
<h2 style="margin-top:0;margin-bottom:0;">Why Choose Us?</h2>
</td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="0" cellspacing="0" class="block block-6 paragraph_block" role="presentation" width="100%">
<tbody>
<tr>
<td style="padding:0 10px;">
<p style="margin:0;text-align:center;">RishtaDepot is a matrimonial service powered by world-class matchmakers that provide clients with personalized attention, hand-selected matches, and valuable coaching.</p>
</td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="0" cellspacing="0" class="block block-7 paragraph_block" role="presentation" width="100%">
<tbody>
<tr>
<td style="padding:10px;">
<p style="margin:0;text-align:center;">Perfect Matchmaking service to find your Perfect Match.</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<div class="spacer_block block-9" style="height:20px;line-height:20px;font-size:1px;"> </div>
<table border="0" cellpadding="0" cellspacing="0" class="row row-4" role="presentation" width="100%">
<tbody>
<tr>
<td>
<table align="center" border="0" cellpadding="0" cellspacing="0" class="row-content stack" role="presentation" width="640">
<tbody>
<tr>
<td class="column column-1" width="100%">
<table border="0" cellpadding="0" cellspacing="0" class="block block-8 heading_block" role="presentation" width="100%">
<tbody>
<tr>
<td style="padding:0 0 10px;text-align:center;">
<h2 style="margin-top:0;margin-bottom:0;">Our Services</h2>
</td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="0" cellspacing="0" class="block block-9" role="presentation" width="100%">
<tbody>
<tr>
<td style="padding:10px;">
<table align="center" border="0" cellpadding="0" cellspacing="0" class="divider_block" role="presentation" width="100%">
<tbody>
<tr>
<td style="background-color:#f36f21;font-size:1px;line-height:1px;padding:0;">&nbsp;</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="0" cellspacing="0" class="block block-10 paragraph_block" role="presentation" width="100%">
<tbody>
<tr>
<td style="padding:10px;">
<h3 style="margin-top:0;margin-bottom:0;">1. Premium Matching Algorithm</h3>
</td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="0" cellspacing="0" class="block block-11 paragraph_block" role="presentation" width="100%">
<tbody>
<tr>
<td style="padding:0 10px;">
<p style="margin:0;text-align:center;">
RishtaDepot is a matrimonial service powered by world-class matchmakers that provide clients with personalized attention, hand-selected matches, and valuable coaching. RishtaDepot’s matchmakers combine proven matchmaking techniques with cutting-edge technology to ensure we introduce you to the best possible matches.
</p>
</td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="0" cellspacing="0" class="block block-12 paragraph_block" role="presentation" width="100%">
<tbody>
<tr>
<td style="padding:10px;">
<h3 style="margin-top:0;margin-bottom:0;">2. Secure Communication</h3>
</td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="0" cellspacing="0" class="block block-13 paragraph_block" role="presentation" width="100%">
<tbody>
<tr>
<td style="padding:0 10px;">
<p style="margin:0;text-align:center;">

All of our matchmakers come from impressive corporate backgrounds, but realized their true passion for connecting people and helping singles find lasting love.  They are outgoing, inquisitive, and demonstrate relentless dedication to their roles as matchmakers.


</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<div class="spacer_block block-14" style="height:20px;line-height:20px;font-size:1px;"> </div>
<table border="0" cellpadding="0" cellspacing="0" class="row row-5" role="presentation" width="100%">
<tbody>
<tr>
<td>
<table align="center" border="0" cellpadding="0" cellspacing="0" class="row-content stack" role="presentation" width="640">
<tbody>
<tr>
<td class="column column-1" width="100%">
<table border="0" cellpadding="0" cellspacing="0" class="block block-15 paragraph_block" role="presentation" width="100%">
<tbody>
<tr>
<td style="padding:10px;">
<p style="margin:0;text-align:center;">Find your perfect match, visit our website.</p>
</td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="0" cellspacing="0" class="block block-16" role="presentation" width="100%">
<tbody>
<tr>
<td style="padding:10px;">
<table align="center" border="0" cellpadding="0" cellspacing="0" class="button_block" role="presentation">
<tbody>
<tr>
<td style="background-color:#f36f21;border-radius:4px;padding:8px 16px;">
<a href="https://rishtasite.com/our-matchmakers" style="background-color:#f36f21;border:1px solid #f36f21;border-radius:4px;color:#ffffff;display:inline-block;font-family:Montserrat, Arial, sans-serif;font-size:14px;font-weight:400;line-height:120%;text-align:center;text-decoration:none;width:auto;-webkit-text-size-adjust:none;mso-border-alt:none;">Browse Our Match Maker</a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<div class="spacer_block block-17" style="height:40px;line-height:40px;font-size:1px;"> </div>
<table border="0" cellpadding="0" cellspacing="0" class="row row-6" role="presentation" style="margin:auto;">
<tbody>
<tr>
<td>
<table align="center" border="0" cellpadding="0" cellspacing="0" class="row-content stack" role="presentation" style="margin:auto;" width="640">
<tbody>
<tr>
<td class="column column-1" width="100%">
<table border="0" cellpadding="0" cellspacing="0" class="block block-18" role="presentation" width="100%">
<tbody>
<tr>
<td style="padding:0;text-align:center;">
<table align="center" border="0" cellpadding="0" cellspacing="0" class="divider_block" role="presentation" width="100%">
<tbody>
<tr>
<td style="background-color:#f36f21;font-size:1px;line-height:1px;padding:0;">&nbsp;</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="0" cellspacing="0" class="block block-19" role="presentation" width="100%">
<tbody>
<tr>
<td style="padding:20px;">
<h3 style="margin-top:0;text-align:center;">Contact Us</h3>
<p style="margin:0;text-align:center;">Address: 21 King Street West, 5th Floor, Hamilton, Ontario, L8P 4W7, Canada</p>
<p style="margin:0;text-align:center;">Phone: +91 9054811166</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<div class="spacer_block block-20" style="height:20px;line-height:20px;font-size:1px;"> </div>
<table border="0" cellpadding="0" cellspacing="0" class="row row-7" role="presentation" style="margin:auto;">
<tbody>
<tr>
<td>
<table align="center" border="0" cellpadding="0" cellspacing="0" class="row-content stack" role="presentation" style="margin:auto;" width="640">
<tbody>
<tr>
<td class="column column-1" width="100%">
<table border="0" cellpadding="0" cellspacing="0" class="block block-21" role="presentation" width="100%">
<tbody>
<tr>
<td style="padding:0;text-align:center;">
	<a href="https://www.facebook.com/rishtadepotcom"><img src="https://rishtasite.in/lead-crm/crm/logo/facebook.png" style="margin-right:5px; margin-bottom:5px;"></a>
										<a href="https://www.instagram.com/rishtadepot_official/"><img src="https://rishtasite.in/lead-crm/crm/logo/instagram.png" style="margin-right:5px; margin-bottom:5px;"></a>
										<a href="https://www.youtube.com/channel/UC7vBgqrX1JTECSLK1amee7Q"><img src="https://rishtasite.in/lead-crm/crm/logo/youtube.png" style="margin-bottom:5px;"></a>
</td>
</tr>
<tr>
<td style="padding:0;text-align:center;">
<p style="margin:0;font-size:12px;line-height:180%;">&copy; 2024 Rishta Depot. All Rights Reserved.</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</body>
</html>';
				
						
				//		 Set content-type header for sending HTML email 
						
                 //       $headers = "MIME-Version: 1.0" . "\r\n"; 
                   //    $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; 

                     //  mail($mailTo,$mailSubject,$mailBody,$headers);
                     
                     
                     // Send the email
if ($mail->send()) {
  $msg =   'Lead has been Added and Email has been sent successfully!';
} else {
    echo 'Error: ' . $mail->ErrorInfo;
}
       }
               }
               
                $usermaster = $mysqli->prepare("select * from cdi_usermaster where user_type='sales_exec' and user_status=1 order by user_creationdate desc");
                $usermaster->execute();
                $userresult = $usermaster->get_result();

?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
<style>
.required{
	color:red;
}
</style>
    <title>Add New Leads - Rishta Depot </title>
  <?php include('./include/meta.php'); ?>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-ui-timepicker-addon/1.6.3/jquery-ui-timepicker-addon.min.css">

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
      <script src="js/countrystatecity.js"></script>
</head>
<?php include('./include/header.php'); ?>
  
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
	  <div class="container-full">
		<!-- Content Header (Page header) -->
		<div class="content-header">
			<div class="d-flex align-items-center">
				<div class="me-auto">
					<h4 class="page-title">Forms</h4>
					<div class="d-inline-block align-items-center">
						<nav>
							<ol class="breadcrumb">
								<li class="breadcrumb-item"><a href="#"><i class="mdi mdi-home-outline"></i></a></li>
								<li class="breadcrumb-item" aria-current="page">Add New Leads</li>
								<li class="breadcrumb-item active" aria-current="page">Forms</li>
							</ol>
						</nav>
					</div>
				</div>
				
			</div>
		</div>	  

		<!-- Main content -->
		<section class="content">
			<div class="row">			  
				<div class="col-12">
				          <?php
                    if (trim($msg) != null) {
                        ?>
                        <div class='row'>
                            <div class='col-md-12'>
                                <div class="alert alert-success errormessage" id="errormessage">
                                    <strong><?php echo $msg ?></strong>
                                </div>
                            </div>
                        </div>
                        <?php
                    }
                    ?>
                    <div id="div_error"></div>
					<div class="box">
						<div class="box-header with-border">
						  <h4 class="box-title">Add Leads</h4>
						</div>
						<!-- /.box-header -->
<form action="#" method="post" class="form" enctype="multipart/form-data">
                            <div class="box-body">
                                <center><strong><h3 class="box-title">Lead Details</h3></strong></center>

                                <!-- Lead Status + Lead Source -->
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label">Lead Status</label><span class="required">*</span>
                                           <select id="ddlLeadStatus" name="ddlLeadStatus" class="form-select">

    <option value="">Lead Status</option>

    <?php while($row = mysqli_fetch_assoc($status_result)) { ?>

        <option value="<?php echo htmlspecialchars($row['name']); ?>">

            <?php echo htmlspecialchars($row['name']); ?>

        </option>

    <?php } ?>

</select>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label">Lead Source</label><span class="required">*</span>
                                            <select id="txtLeadSource" name="txtLeadSource" class="form-select">
                                                <option value="">Lead Source</option>
                                                <?php
                                                mysqli_data_seek($source_result, 0);
                                                while ($row = mysqli_fetch_assoc($source_result)):
                                                ?>
                                                    <option value="<?php echo htmlspecialchars($row['name']); ?>"
<?php echo ($memberrow->source == $row['name']) ? 'selected' : ''; ?>>

    <?php echo htmlspecialchars($row['name']); ?>

</option>
                                                <?php endwhile; ?>
                                            </select>
                                        </div>
                                    </div>
                                </div>

                                <!-- Member Status + Country -->
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label">Member Status</label>
                                            <select id="txtmstatus" name="txtmstatus" class="form-select">
                                                <option value="">Member Status</option>
                                                <option value="#2">#2</option>
                                                <option value="#3">#3</option>
                                                <option value="#4">#4</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label">Country</label><span class="required">*</span>
                                            <select name="txtcountry" class="countries form-select" id="countryId">
                                                <option value="">Select Country</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>

                                <!-- State + City -->
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label">State</label>
                                            <select name="txtstate" class="states form-select" id="stateId">
                                                <option value="">Select State</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label">City</label>
                                            <select name="txtcity" class="cities form-select" id="cityId">
                                                <option value="">Select City</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>

                                <!-- Payment Date -->
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label">Payment Date</label>
                                            <input type="date" id="txtdop" name="txtdop" class="form-control"/>
                                        </div>
                                    </div>
                                </div>

                                <hr style="height:10px;">
                                <center><strong><h3 class="box-title">1st Contact Information</h3></strong></center>

                                <!-- Contact Name + Phone -->
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label">Contact 1 Name</label><span class="required">*</span>
                                            <input type="text" maxlength="50" id="txtcname" name="txtcname" class="form-control" placeholder="Name"/>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label">Contact 1 Phone Number</label><span class="required">*</span>
                                            <input type="text" maxlength="15" id="txtcontact" name="txtcontact" class="form-control" placeholder="Phone Number"/>
                                        </div>
                                    </div>
                                </div>

                                <!-- Email + Relation -->
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label">Contact 1 Email-ID</label><span class="required">*</span>
                                            <input type="text" id="txtemailid" autocomplete="off" name="txtemailid" class="form-control" placeholder="Contact Email-ID"/>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label">Relation</label>
                                            <select class="form-select" name="txtrelation" id="txtrelation">
                                                <option value="">Relation</option>
                                                <?php
                                                $relations = ['Match','Father','Mother','Brother','Sister','Brother-in-law',
                                                    'Bhabi Ji','Chacha Ji','Chachi Ji','Mama Ji','Mami Ji','Bhua Ji',
                                                    'Fufar Ji','Masi Ji','Masar Ji','Dada Ji','Dadi Ji','Dewar',
                                                    'Dewrani','Nana Ji','Nani Ji','Taya Ji','Tayi Ji','Friend','Self'];
                                                foreach ($relations as $rel):
                                                ?>
                                                    <option value="<?php echo $rel; ?>"><?php echo $rel; ?></option>
                                                <?php endforeach; ?>
                                            </select>
                                        </div>
                                    </div>
                                </div>

                                <!-- Gender + Marital Status (ADDED - were commented out but needed for filter) -->
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label">Gender</label>
                                            <select id="txtgender" name="txtgender" class="form-select">
                                                <option value="">Gender</option>
                                                <option value="Male">Male</option>
                                                <option value="Female">Female</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label">Marital Status</label>
                                            <select id="txtmarital" name="txtmarital" class="form-select">
                                                <option value="">Marital Status</option>
                                                <option value="Never Married">Never Married</option>
                                                <option value="Annulled">Annulled</option>
                                                <option value="Not Living Together">Not Living Together</option>
                                                <option value="Divorce Awaited">Divorce Awaited</option>
                                                <option value="Divorced No Kids">Divorced No Kids</option>
                                                <option value="Divorced 1 Child">Divorced 1 Child</option>
                                                <option value="Divorced 2 Children">Divorced 2 Children</option>
                                                <option value="Divorced 3 Children">Divorced 3 Children</option>
                                                <option value="Widow">Widow</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>

                                <!-- Age + Residency Status (ADDED) -->
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label">Age</label>
                                            <select class="form-select" name="txtage" id="txtage">
                                                <option value="">Age</option>
                                                <?php for ($i = 18; $i <= 75; $i++): ?>
                                                    <option value="<?php echo $i; ?>"><?php echo $i; ?></option>
                                                <?php endfor; ?>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label">Residency Status</label>
                                            <select id="txtrstatus" name="txtrstatus" class="form-select">
                                                <option value="">Residency Status</option>
                                                <?php
                                                mysqli_data_seek($res_result, 0);
                                                while ($row = mysqli_fetch_assoc($res_result)):
                                                ?>
                                                    <option value="<?php echo htmlspecialchars($row['name']); ?>">
                                                        <?php echo htmlspecialchars($row['name']); ?>
                                                    </option>
                                                <?php endwhile; ?>
                                            </select>
                                        </div>
                                    </div>
                                </div>

                               

                                <hr style="height:10px;">
                                <center><strong><h3 class="box-title">Profile Information</h3></strong></center>

                                <!-- Profile Name + SmartMatch -->
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label">Profile Name</label>
                                            <input type="text" maxlength="50" id="txtcname2" name="txtcname2" class="form-control" placeholder="Profile Name"/>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label">SmartMatch Profile Link</label>
                                            <input type="text" maxlength="255" id="txtsmartmatch" name="txtsmartmatch" class="form-control" placeholder="SmartMatch Profile Link"/>
                                        </div>
                                    </div>
                                </div>

                                <!-- Profile Phone + Profile Email -->
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label">Profile Phone No.</label>
                                            <input type="text" maxlength="15" id="txtcontact2" name="txtcontact2" class="form-control" placeholder="Profile Phone No."/>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label">Profile Email-ID</label>
                                            <input type="text" id="txtemailid2" autocomplete="off" name="txtemailid2" class="form-control" placeholder="Profile Email-ID"/>
                                        </div>
                                    </div>
                                </div>

                                <hr style="height:10px;">
                                <center><strong><h3 class="box-title">Matches</h3></strong></center>

                                <?php for ($m = 1; $m <= 5; $m++): ?>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label">Name <?php echo $m; ?></label>
                                            <input type="text" maxlength="50" id="txtname<?php echo $m; ?>" name="txtname<?php echo $m; ?>" class="form-control" placeholder="Name <?php echo $m; ?>"/>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label">URL <?php echo $m; ?></label>
                                            <input type="text" maxlength="250" id="txturl<?php echo $m; ?>" name="txturl<?php echo $m; ?>" class="form-control" placeholder="URL <?php echo $m; ?>"/>
                                        </div>
                                    </div>
                                </div>
                                <?php endfor; ?>

                                <!-- Video Calling + Video Link -->
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label">Video Calling</label>
                                            <select id="txtvideocall" name="txtvideocall" class="form-select">
                                                <option value="">Video Calling</option>
                                                <option value="Yes">Yes</option>
                                                <option value="No">No</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label">Video Link</label>
                                            <input type="text" maxlength="250" id="txtvideolink" name="txtvideolink" class="form-control" placeholder="Video Link"/>
                                        </div>
                                    </div>
                                </div>

								<div class="row">
								  <div class="col-md-6">
									<div class="form-group">
									  <label class="form-label">Created On</label>
									  <input value="<?php echo date('Y-m-d') ?>" type="text" id="txtDate" name="txtDate" class="form-control" autocomplete='off' readonly='readonly'/>
									</div>
								  </div>
								  <div class="col-md-6">
								        <input type="hidden" id="ddlLeadAllocated" name="ddlLeadAllocated" class="form-control-custom" value="<?php echo $_SESSION['userId'] ?>"/>
									<!--div class="form-group">
									  <label class="form-label">Lead Allocated To </label>
									    <select id="ddlLeadAllocated" name="ddlLeadAllocated" class="form-select">
                                <option value="">Lead Allocated To</option>
                                <?php
                             //   while ($userrow = mysqli_fetch_object($userresult)) {
                                    ?>
                                    <option value='<?php //echo $userrow->user_id ?>'><?php //echo $userrow->user_full_name ?></option>
                                    <?php
                           //     }
                                ?>
                            </select>
									</div-->
								  </div>
								</div>
								<hr style="height:10px;">
								<div class="row">
								  
								  <div class="col-md-12">
									<div class="form-group">
									  <label class="form-label">Add Notes</label>
									  <textarea maxlength="500" style='height:100px' id="txtRemarks" name="txtRemarks" class="form-control" placeholder="Add Notes"></textarea>
								    </div>
								  </div>
								</div>
								<div class="row">
								  <div class="col-md-6">
									<div class="form-group">
									  <!--label class="form-label">Next Date of Call</label><span class="required">*</span-->
									  	  <label class="form-label">Next Date of Call</label>
									  <input type="date" maxlength="50" id="txtcall" name="txtcall" class="form-control" value=""/>
								    </div>
								  </div>
								  	  <div class="col-md-6">
									<div class="form-group">
									  <!--label class="form-label">Next Date of Call</label><span class="required">*</span-->
									  <label class="form-label">Next Time of Call</label>
									 <input type="time" id="call_time_scheduling" name="call_time_scheduling" class="form-control" value=""/>
								    </div>
								  </div>
								</div>
								<div class="box-footer">
								<!--button type="submit" class="btn btn-primary">
								  <i class="ti-save-alt"></i> Save Rishta Lead</button-->
								  <input type="submit" id="btnSaveMember" name="btnSaveMember" value="Save Lead" class="btn btn-primary" onclick="return saveuser()"/>
								<!--button type="button" class="btn btn-warning me-1">
								  <i class="ti-trash"></i> Cancel</button-->
								  <input type="button" name="btnBack" value="Back" class="btn btn-warning" onclick="return back(1)"/>
							</div>
							</div>
							</div>
						</form>
                    </div>
                </div>
			</div>
        </section>
   	<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-ui-timepicker-addon/1.6.3/jquery-ui-timepicker-addon.min.js" type="text/javascript"></script>
<script>

    $('#div_error').hide();
    $('#div_error').html("");

    function checkContactNumber() {

        $('#div_error').hide();
        $('#div_error').html("");

        var txtcontact = $('#txtcontact').val();

        if ($.trim(txtcontact).length > 0) {

            $.ajax({
                url: 'common_ajax.php',
                type: 'POST',
                data: {"ajax_for": 'unique_contact', "contact_no": txtcontact},
                datatype: 'html',
                success: function (result) {

                    if (result != "pass") {

                        $('#txtcontact').val("");
                        $('#div_error').html(result);
                        $('#div_error').show();
                    }
                }
            });
        }
    }

    $('#txtcontact').blur(function () {

        checkContactNumber();
         
    });

    function saveuser() {

        checkContactNumber();

        var txtName = $('#txtName').val();
        var txtMobile = $('#txtMobile').val();
        var ddlLeadAllocated = $('#ddlLeadAllocated').val();
        var txtAddress = $('#txtAddress').val();
        var txtRemarks = $('#txtRemarks').val();
        var txtCollege = $('#txtCollege').val();
        var txtDate = $('#txtDate').val();
        var txtLeadSource = $('#txtLeadSource').val();
        var txtYear = $('#txtYear').val();
        var txtemailid = $('#txtemailid').val();
        var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
        var txtcname = $('#txtcname').val();
        var txtcontact = $('#txtcontact').val();
        var txtcountry = $('#countryId').val();
        var txtstate = $('#stateId').val();
        var txtcity = $('#cityId').val();
        var txtcall = $('#txtcall').val();
        checkContactNumber();

       // if ($.trim(txtLeadSource).length == 0 || $.trim(ddlLeadStatus).length == 0 || $.trim(txtcountry).length == 0 || $.trim(txtstate).length == 0 || $.trim(txtcity).length == 0 || $.trim(txtcall).length == 0 || $.trim(txtcname).length == 0 || $.trim(txtcontact).length == 0 || $.trim(txtemailid).length == 0) {
              if ($.trim(txtLeadSource).length == 0 || $.trim(ddlLeadStatus).length == 0 || $.trim(txtcountry).length == 0 || $.trim(txtcname).length == 0 || $.trim(txtcontact).length == 0 || $.trim(txtemailid).length == 0) {
           
            alert("Please fill all the required fields.");
            return false;
        }
        else if (emailReg.test(txtemailid) == false) {
            alert("Enter the valid email");
            return false;
        }
        else {
            return confirm('Are You Sure?');
        }
    }

    function back(param) {
        var c = confirm('Are You Sure');
        if (c == true && param == 0) {
            window.location = "filter-manage-rishta-leads.php";
        }
        else if (c == true) {
            window.location = "filter-manage-rishta-leads.php";
        }
        else {
            return c;
        }
    }

    function isDecimal(evt, element) {
        var charCode = (evt.which) ? evt.which : event.keyCode
        if ((charCode != 46 || $(element).val().indexOf('.') != -1) &&      // “.” CHECK DOT, AND ONLY ONE.
            (charCode < 48 || charCode > 57))
            return false;
        return true;
    }

    function isNumber(evt, element) {
        var charCode = (evt.which) ? evt.which : event.keyCode
        if ((charCode < 48 || charCode > 57))
            return false;
        return true;
    }

    $(document).ready(function () {
        $('body').on("keypress", '#txtYear', function () {
            return isNumber(event, this)
        });

        //$("#txtDate").datepicker({
          //  dateFormat: 'yy-mm-dd',
            // minDate: 0, // 0 days offset = today
        //});

        $('#txtName').keypress(function (e) {
            var regex = new RegExp("^[a-zA-Z ]+$");
            var str = String.fromCharCode(!e.charCode ? e.which : e.charCode);
            if (regex.test(str)) {
                return true;
            }

            e.preventDefault();
            return false;
        });
        //   $('input').bind("cut copy paste", function (e) {
        //     e.preventDefault();
        //});

        $('#call_time_scheduling').timepicker({
            timeFormat: "hh:mm tt"
        });
    });
</script>
<?php include('./include/footer.php'); ?>